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 |
|---|---|---|---|---|---|---|
Determine whether a given node (integer) is a goal. | def is_goal(self, node):
# print("is {} in {}".format(node, self.goal_nodes))
if node in self.goal_nodes:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_goal_node(self, node):\n for agent, position in node.curr_positions.items():\n\n if position['location'] != self.goalPositions[agent]:\n return False\n\n return True",
"def goal_check(current_node, target_node):\n if current_node.id == target_node.id:\n re... | [
"0.7745861",
"0.77347404",
"0.7607998",
"0.7598765",
"0.6697669",
"0.66941226",
"0.66614336",
"0.6644969",
"0.65993065",
"0.6584588",
"0.6578508",
"0.65657824",
"0.6546743",
"0.6546743",
"0.6519068",
"0.6494294",
"0.64898604",
"0.64898604",
"0.6487343",
"0.6479085",
"0.643681... | 0.8285476 | 0 |
Creates the tables. Creates the tables token and val unless they already exist. | def _create_tables(self):
self._c.execute("CREATE TABLE IF NOT EXISTS token ( "
"id INTEGER PRIMARY KEY, "
"name CHAR(50) NOT NULL)")
self._c.execute("CREATE TABLE IF NOT EXISTS val ( "
"id INTEGER PRIMARY KEY, "
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_tables():\n db.create_all()",
"def create_tables():\n db.create_all()",
"def create_tables():\n\tlog_msg4(\"No hay tablas para el año \" + txt_year + \". Creando\")\n\n\tcreate_table('visited')\n\tcreate_table('saved')\n\tcreate_table('actions')\n\n\tglobal new_tables_created\n\tnew_ta... | [
"0.7213501",
"0.7213501",
"0.709232",
"0.7071358",
"0.7042877",
"0.7016754",
"0.7002311",
"0.6998767",
"0.69555557",
"0.6837791",
"0.68354166",
"0.6826234",
"0.6808454",
"0.67988825",
"0.679569",
"0.67859083",
"0.6774804",
"0.6771013",
"0.67707205",
"0.6755286",
"0.67444205",... | 0.79203916 | 0 |
Select a random image file from the provided directory and return its href. `path` should be relative to MEDIA_ROOT. | def random_img(path):
fullpath = os.path.join(settings.MEDIA_ROOT, path)
filenames = [f for f in os.listdir(fullpath) if is_image_file(f)]
pick = random.choice(filenames)
return posixpath.join(settings.MEDIA_URL, path, pick) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_image():\n img_dir = \"./static\"\n img_list = os.listdir(img_dir)\n img_path = os.path.join(img_dir, random.choice(img_list))\n return img_path",
"def getRandomFile(path):\n files = os.listdir(path)\n index = random.randrange(0, len(files))\n return files[index]",
"def getRandomFile(... | [
"0.69949996",
"0.69562453",
"0.69319504",
"0.66163427",
"0.65788853",
"0.65531594",
"0.6411281",
"0.6372213",
"0.61189675",
"0.6089854",
"0.6044328",
"0.57691604",
"0.57397974",
"0.5736351",
"0.5660149",
"0.56311595",
"0.5586078",
"0.55792195",
"0.54374486",
"0.54130507",
"0.... | 0.79798245 | 0 |
Push retrieved data onto stack and point SP register to top of stack. | def push(self, data):
self.STACK.appendleft(data)
self.SP = self.STACK[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_stack(self, data):\n\n self.memory.write(0x0100 + self.sp, data)\n self.dec_sp()",
"def push(self, data):\n self.__stack.append(data)",
"def _push_d_to_stack(self) -> None:\n self._write(self._update_sp_value())\n self._write(self._increment_sp())",
"def push(self,... | [
"0.74157417",
"0.66672546",
"0.63689286",
"0.63071984",
"0.62629527",
"0.6238625",
"0.6133951",
"0.61260116",
"0.6123999",
"0.6122239",
"0.6028521",
"0.5983305",
"0.59680617",
"0.59141326",
"0.5906109",
"0.58515936",
"0.58515936",
"0.58387136",
"0.5827118",
"0.5822674",
"0.58... | 0.7426554 | 0 |
Setup to debug after each step is executed. | def after_step(context, step):
if context.config.userdata.getbool("debug") and step.status == "failed":
spost_mortem(step.exc_traceback) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debug(self):\r\n self.setUp()\r\n getattr(self, self._testMethodName)()\r\n self.tearDown()\r\n while self._cleanups:\r\n function, args, kwargs = self._cleanups.pop(-1)\r\n function(*args, **kwargs)",
"def debug(self):\r\n debug = _DebugResult()\r\n ... | [
"0.67443174",
"0.6674586",
"0.6580183",
"0.6514101",
"0.6451735",
"0.64197975",
"0.6378369",
"0.6351324",
"0.62425333",
"0.62420815",
"0.62219393",
"0.620304",
"0.6157006",
"0.6157006",
"0.6146772",
"0.60993856",
"0.6088124",
"0.6079479",
"0.6076435",
"0.6072431",
"0.60711485... | 0.70949566 | 0 |
Validates that the class is not an audio file | def __validate_class(self):
if type(self) == AudioFile:
raise ValueError('Cannot be the base-type AudioFile. Must be a song or podcast') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_audio(self):\n return self.__audio_format is not None",
"def test_repair_file(self):\n\n audio_path = self.converter.audio\n self.assertTrue(audio_path.endswith('.wav'))\n # Make sure it can be loaded in moviepy\n clip = AudioFileClip(audio_path)",
"def is_audio(self)... | [
"0.663141",
"0.65109545",
"0.63020545",
"0.61979604",
"0.61077374",
"0.6051123",
"0.6033432",
"0.5982588",
"0.59822273",
"0.59727514",
"0.597196",
"0.5882004",
"0.58617276",
"0.58566153",
"0.57839566",
"0.5773115",
"0.5769186",
"0.5737006",
"0.57342756",
"0.5711538",
"0.56982... | 0.80893236 | 0 |
Returns the current user rating for the audio_file instance | def user_rating(self) -> int:
return self._user_rating | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mean_user_rating(self, user_id):\n return self.mean_user_rating[self.mean_user_rating['user_id'] == user_id]['rating'].item()",
"def _get_user_ratings(self, user_id):\n return self.ratings[self.ratings['user_id'] == user_id]",
"def average_rating(self):\n return self.proto.aggregat... | [
"0.6627338",
"0.6283099",
"0.62079924",
"0.6195082",
"0.61833507",
"0.61767393",
"0.61595863",
"0.61358863",
"0.61311936",
"0.6091103",
"0.6088088",
"0.6088088",
"0.608783",
"0.6077677",
"0.604285",
"0.60403967",
"0.6000047",
"0.5988844",
"0.59556884",
"0.595322",
"0.59321564... | 0.7233619 | 0 |
Returns a formatted string that shows the audio_file name and times played | def display_play_count(self):
play_string = "{} has been played {} time".format(self._title, self._usage.play_count)
if self._usage.play_count > 1 or self._usage.play_count == 0:
play_string += 's'
print(play_string) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_wav_info(file_name):\n wr = wave.open(file_name, 'r')\n sample_width = wr.getsampwidth()\n frame_rate = wr.getframerate()\n num_frames = wr.getnframes()\n n_channels = wr.getnchannels()\n s = \"sample width: {} bytes\\n\".format(sample_width) + \\\n \"frame rate: {} Hz\\n\".format(... | [
"0.6399311",
"0.62130934",
"0.61505574",
"0.6130907",
"0.61177164",
"0.59263015",
"0.5895166",
"0.5891737",
"0.58695537",
"0.58237946",
"0.582293",
"0.5818907",
"0.5816524",
"0.5814739",
"0.5798617",
"0.5791161",
"0.57439744",
"0.57388574",
"0.57361794",
"0.5724271",
"0.57057... | 0.6288807 | 1 |
Adds values to the instance variables of _file_path and _file_name | def __set_file_info(self, path_name):
file_name = os.path.basename(path_name)
file_path = os.path.dirname(path_name)
self._file_path = file_path
self._file_name = file_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, file_path):\r\n self.file_path = Path(file_path)\r\n self.fname = self.file_path.name\r\n self.d_stgs = settings.DisplaySettings()\r\n self.c_stgs = settings.CalculationSettings()\r\n logger.info(f'{self} create')",
"def addFile(self, filePath): \n ... | [
"0.68173146",
"0.6816269",
"0.6767655",
"0.67057264",
"0.66120636",
"0.6543475",
"0.6415376",
"0.6385318",
"0.6372942",
"0.63543934",
"0.6310648",
"0.6266481",
"0.625771",
"0.6242952",
"0.6215847",
"0.61981493",
"0.6116218",
"0.61038667",
"0.6090746",
"0.60780096",
"0.6051546... | 0.7291003 | 0 |
Validates the file location on audio_file creation | def __validate_location(self):
if not os.path.exists(self._file_path):
raise FileNotFoundError("Directory does not exist")
if not os.path.isfile(self._path_name):
raise FileNotFoundError('File does not exist') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_repair_file(self):\n\n audio_path = self.converter.audio\n self.assertTrue(audio_path.endswith('.wav'))\n # Make sure it can be loaded in moviepy\n clip = AudioFileClip(audio_path)",
"def _validate_file(self, filepath: str):\n if not os.path.exists(filepath):\n ... | [
"0.6535944",
"0.6222438",
"0.6179639",
"0.6132857",
"0.61180186",
"0.61142653",
"0.6057974",
"0.6003508",
"0.5997679",
"0.59274644",
"0.59230053",
"0.5897067",
"0.58911514",
"0.58665925",
"0.58571357",
"0.5856971",
"0.5826535",
"0.58189064",
"0.57884556",
"0.57699084",
"0.576... | 0.6403663 | 1 |
Updates the usage stats for this audio_file instance | def update_usage_stats(self):
self._usage.increment_usage_stats() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_usage(self):\n sample_bytes = c_longlong()\n stream_bytes = c_longlong()\n other_bytes = c_longlong()\n self._call_fmod(\n \"FMOD_System_GetFileUsage\",\n byref(sample_bytes),\n byref(stream_bytes),\n byref(other_bytes),\n )\n ... | [
"0.63656265",
"0.604398",
"0.5945882",
"0.58650523",
"0.5777148",
"0.57336956",
"0.57336956",
"0.57336956",
"0.56838757",
"0.5676413",
"0.5644809",
"0.56228846",
"0.56089145",
"0.55970824",
"0.558926",
"0.55886096",
"0.55807585",
"0.5557321",
"0.55488783",
"0.5468506",
"0.546... | 0.7604168 | 0 |
Returns usage stats for the audio_file instance | def get_usage_stats(self) -> UsageStats:
return self._usage | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_usage(self):\n sample_bytes = c_longlong()\n stream_bytes = c_longlong()\n other_bytes = c_longlong()\n self._call_fmod(\n \"FMOD_System_GetFileUsage\",\n byref(sample_bytes),\n byref(stream_bytes),\n byref(other_bytes),\n )\n ... | [
"0.72261053",
"0.6124308",
"0.6114478",
"0.6020074",
"0.6007624",
"0.58869827",
"0.58685887",
"0.5845944",
"0.58433527",
"0.5724268",
"0.5693848",
"0.5679898",
"0.565591",
"0.56389683",
"0.56379646",
"0.55806625",
"0.55493265",
"0.5534491",
"0.55340797",
"0.553199",
"0.553025... | 0.6492788 | 1 |
Part of the Retriever interface returns random popularity for the last 10 years for 30 teams. | def retrieve(team, year):
return random.randint(100,200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def random_album_popularity():\n center_popularity = 0.8\n\n curvature = 40\n lower_bound = -1\n upper_bound = erf(math.sqrt(curvature) * (1 - center_popularity))\n x = random.uniform(lower_bound, upper_bound)\n y = erfinv(x) / math.sqrt(curvature) + center_popularit... | [
"0.61707",
"0.5977368",
"0.5913488",
"0.5875789",
"0.5764712",
"0.5724223",
"0.56071246",
"0.5606961",
"0.5584765",
"0.55392265",
"0.5520799",
"0.54928696",
"0.54886365",
"0.54675436",
"0.5457642",
"0.54536635",
"0.54129916",
"0.5411857",
"0.53772235",
"0.5366331",
"0.5365081... | 0.73440933 | 0 |
Test the expected circuit. If it equals the correct ``IntegerComparator`` we know the circuit is correct. | def test_circuit(self):
num_qubits = 3
strike_price = 0.5
bounds = (0, 2)
ecd = EuropeanCallDeltaObjective(
num_state_qubits=num_qubits, strike_price=strike_price, bounds=bounds
)
# map strike_price to a basis state
x = (strike_price - bounds[0]) / (b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_circuit(circuit, n):\n a = circuit_to_state(ABPWrapper, n, circuit)\n b = circuit_to_state(AndersWrapper, n, circuit)\n assert a == b",
"def test_compare_answer(self):\r\n problem = self.build_problem(answer=\"42\")\r\n responder = problem.responders.values()[0]\r\n self.as... | [
"0.5948422",
"0.56976664",
"0.56222135",
"0.558988",
"0.550158",
"0.54605484",
"0.5453518",
"0.5414741",
"0.53781354",
"0.53777385",
"0.53646106",
"0.53355116",
"0.5325121",
"0.53056604",
"0.52928746",
"0.52886176",
"0.52553624",
"0.52471507",
"0.52270675",
"0.518414",
"0.517... | 0.59250706 | 1 |
Open the pkg_appname csv file(MOB) and load all the pkg name with app name into a dictionary. The key is the pkg name, the value is the | def pkg_appname_file_process(self, file_path):
pkg_app_dict = dict()
with open(file_path, 'r', encoding='utf-8') as pkg_app_file:
reader = csv.reader(pkg_app_file)
for row in reader:
row[0] = row[0].encode('utf-8').decode('utf-8-sig')
pkg_app_dict[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apps_information(self):\n with open(self.app_data_path, 'r') as app_csv_file:\n csv_reader = csv.reader(app_csv_file)\n apps = [self.AppInformation(app[0], app[1], app[2], app[3], app[4], app[5]) for app in csv_reader]\n return apps",
"def load_appdata():\n try:\n ... | [
"0.63364863",
"0.55948925",
"0.5310131",
"0.5260571",
"0.5207814",
"0.5193486",
"0.5185272",
"0.51173306",
"0.5108168",
"0.50463223",
"0.501235",
"0.49871638",
"0.4957913",
"0.49394888",
"0.49283963",
"0.4919405",
"0.4898494",
"0.48967785",
"0.4881588",
"0.4877747",
"0.487321... | 0.79811215 | 1 |
The core of the program. Search the target app name in each user's applist and count the occurrence, and also output a sum for each search terms. | def search_term_counter(self, search_terms, rows_list):
# step1 process the search terms
search_terms_list = search_terms.split(',')
for i in range(len(search_terms_list)):
search_terms_list[i] = search_terms_list[i].strip()
# step2 process the rows_list and output the calcu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_term_counter(self, search_terms, rows_list):\n\n # step1 process the search terms\n search_terms_list = search_terms.split(',')\n for i in range(len(search_terms_list)):\n search_terms_list[i] = search_terms_list[i].strip()\n # step2 process the rows_list and outpu... | [
"0.6465494",
"0.6357469",
"0.6192437",
"0.57465947",
"0.5733671",
"0.57218575",
"0.5694345",
"0.5674444",
"0.5674131",
"0.563181",
"0.55903935",
"0.55687356",
"0.5463936",
"0.54459745",
"0.5428002",
"0.54066473",
"0.53714556",
"0.53581446",
"0.5357267",
"0.5346933",
"0.533890... | 0.64370674 | 1 |
Convert case to YAML. | def _convert_case_to_yaml(vert):
if vert:
yamlfile = os.path.join(os.getcwd(), str(vert).strip())
scripts.generate_case_tmpl(yamlfile) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_fx(self):\n return yaml.dump(self, default_flow_style=False)",
"def to_content(cls, data: Mapping) -> str:\n cls._check_yaml()\n s = yaml.safe_dump(data, default_flow_style=False)\n s = '---\\n' + s\n return s",
"def yaml(self):\n raise NotImplementedError",
"def... | [
"0.6454334",
"0.62974006",
"0.6220049",
"0.6185964",
"0.6162941",
"0.61317366",
"0.6078299",
"0.6077618",
"0.6061961",
"0.6004179",
"0.60023457",
"0.59866875",
"0.5951766",
"0.59207284",
"0.59049976",
"0.58119917",
"0.57915694",
"0.57865554",
"0.5780798",
"0.57802284",
"0.577... | 0.7723443 | 0 |
Convert http.har to YAML. | def _convert_httphar_to_yaml(har):
if har:
temp_dict = ConvertHarToYAML.convert_har_to_ht(har)
ConvertHarToYAML.write_case_to_yaml('', temp_dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_yaml(self):\n return yaml.dump(self.raw, Dumper=yaml.SafeDumper)",
"def _dict_to_single_line_yaml(self, *, data):\n result = yaml.dump(data, default_flow_style=True)\n result = result.replace(\"\\n\", \" \").strip()\n result = re.sub(r\" *\", \" \", result)\n return res... | [
"0.6067014",
"0.5750265",
"0.57344013",
"0.56418574",
"0.563329",
"0.55278426",
"0.54972774",
"0.54600006",
"0.543247",
"0.5431276",
"0.54208314",
"0.5402448",
"0.53819096",
"0.5340411",
"0.53272843",
"0.53181577",
"0.52950203",
"0.52925503",
"0.5226353",
"0.5226287",
"0.5211... | 0.8132008 | 0 |
Get file case YAML. | def _get_file_yaml(case_file):
temp_list = []
# Get the yaml file name and write to the queue.
if case_file:
# Specify the execution CASE.
fargs = '&#'.join(case_file)
temp_list.append(os.path.join(os.getcwd(), fargs))
cache_dir = os.path.join(gl.loadcasePath, ".am_cache")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_case_to_yaml(vert):\n if vert:\n yamlfile = os.path.join(os.getcwd(), str(vert).strip())\n scripts.generate_case_tmpl(yamlfile)",
"def parse_case(case_file):\n yaml_config = open(case_file)\n config = yaml.load(yaml_config)\n config['model_dir'] = MODEL_ROOT\n return con... | [
"0.6853437",
"0.6578174",
"0.62572324",
"0.61814916",
"0.6178755",
"0.6049517",
"0.5951054",
"0.59024477",
"0.5877184",
"0.57700133",
"0.5766219",
"0.5735199",
"0.5725975",
"0.57209015",
"0.570617",
"0.5703252",
"0.57023776",
"0.5657186",
"0.5652669",
"0.5633805",
"0.56329685... | 0.67364377 | 1 |
Get dirs case YAML. | def _get_dirs_case_yaml(case_dir):
temp_list = []
if case_dir:
for root, dirs, files in os.walk(case_dir):
for f in files:
if 'yaml' in f:
d = os.path.join(os.getcwd(), case_dir)
temp_list.append(os.path.join(d, f))
# 缓存目录
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _include_dir_list_yaml(\n loader: SafeLineLoader, node: yaml.nodes.Node\n) -> List[JSON_TYPE]:\n loc = os.path.join(os.path.dirname(loader.name), node.value)\n return [load_yaml(f) for f in _find_files(loc, \"*.yaml\")]",
"def test_list_dir_returns_dirs_only(self):\n with self.settings(MIDDLE... | [
"0.6026741",
"0.5887233",
"0.58870244",
"0.5847705",
"0.58441544",
"0.5832931",
"0.5762401",
"0.5751674",
"0.5578222",
"0.5469639",
"0.5451286",
"0.5439777",
"0.5383624",
"0.53767186",
"0.5369411",
"0.53230035",
"0.5315739",
"0.5311082",
"0.52985185",
"0.5269976",
"0.5224979"... | 0.6822702 | 0 |
Mock multimatic to only handle binary_sensor. | def fixture_only_binary_sensor(mock_manager):
orig_platforms = multimatic.PLATFORMS
multimatic.PLATFORMS = ["binary_sensor"]
yield
multimatic.PLATFORMS = orig_platforms | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_binary_sensor(self):\n with patch.dict(TYPES, {'BinarySensor': self.mock_type}):\n state = State('binary_sensor.opening', 'on',\n {ATTR_DEVICE_CLASS: 'opening'})\n get_accessory(None, state, 2, {})",
"async def test_binary_sensor(\n hass: HomeAssi... | [
"0.70172524",
"0.69213176",
"0.68962634",
"0.6880899",
"0.66873306",
"0.668323",
"0.653575",
"0.6391671",
"0.6293144",
"0.6285726",
"0.6262305",
"0.62507784",
"0.62121636",
"0.6177298",
"0.61380684",
"0.60967207",
"0.60932285",
"0.60851926",
"0.6082248",
"0.5990177",
"0.59833... | 0.7022091 | 0 |
Fetch an observation with a specific ID. | def get_observation(observation_id: str):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_observation(self, repository_name, observation_id):\n r = requests.get('/'.join([self.base_url, self.PATH,\n repository_name,\n str(observation_id)]))\n return r.json()",
"def get(self, _id):",
"def get_by_id(cls, id... | [
"0.6886935",
"0.6751204",
"0.661921",
"0.6606036",
"0.6606036",
"0.65816283",
"0.6497011",
"0.6492073",
"0.64547455",
"0.6452723",
"0.6441457",
"0.642305",
"0.6399904",
"0.6359599",
"0.63225454",
"0.62624294",
"0.6227105",
"0.6209396",
"0.6198391",
"0.6187224",
"0.6182605",
... | 0.6980907 | 0 |
Count the observations within a given geo area that meet the filter, if any, passed in via the request body. | def count_observations_by_geo(geohash: str, filter: Optional[ObservationFilter]):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_filtered(cls, client, filter_) :\n try :\n obj = nshttpprofile()\n option_ = options()\n option_.count = True\n option_.filter = filter_\n response = obj.getfiltered(client, option_)\n if response :\n return response[... | [
"0.60347617",
"0.5891019",
"0.580047",
"0.5770361",
"0.5668953",
"0.56624526",
"0.56583375",
"0.5630639",
"0.55900496",
"0.5567828",
"0.5549276",
"0.5518491",
"0.55175954",
"0.5496701",
"0.5484503",
"0.54686797",
"0.54477036",
"0.5416191",
"0.53936267",
"0.5331708",
"0.531999... | 0.7847384 | 0 |
Query for observations within a given geohash area that meet the filter, if any, passed in via the request body. | def get_observations_by_geo(geohash: str, filter: Optional[ObservationFilter]):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_observations_by_geo(geohash: str, filter: Optional[ObservationFilter]):\n pass",
"def search():\n # q is the name of the http parameter\n request.args.get(\"q\")\n\n #check for missing arguments\n if not(request.args.get(\"q\")):\n raise RuntimeError(\"Missing geo!\")\n\n #\"%\... | [
"0.63080734",
"0.5984022",
"0.5846426",
"0.55425745",
"0.55073506",
"0.5383388",
"0.533326",
"0.5295821",
"0.5281164",
"0.5275028",
"0.5261173",
"0.52193195",
"0.51902753",
"0.518922",
"0.5177632",
"0.5135236",
"0.5114231",
"0.50733876",
"0.5057123",
"0.5021546",
"0.49862424"... | 0.71598756 | 0 |
Build a dictionary containing information about an album. | def make_album(artist, title):
album_dict = {
'artist': artist.title(),
'title': title.title(),
}
return album_dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_album(album_id, albumtype):\n result = {'titel': '',\n 'artist': '',\n # 'artistid': '',\n 'artist_name': '',\n 'details': [('Label/jaar:', ''),\n ('Produced by:', ''),\n ('Credits:', ''),\n ... | [
"0.7404342",
"0.72909915",
"0.7182269",
"0.715337",
"0.7013407",
"0.699136",
"0.693986",
"0.693986",
"0.68889886",
"0.6887246",
"0.6852019",
"0.68512756",
"0.68042725",
"0.6757702",
"0.67372036",
"0.67091304",
"0.6667391",
"0.6649321",
"0.6649316",
"0.6605043",
"0.6493447",
... | 0.72914594 | 1 |
Print the name of each magician in the list. | def show_magicians(magicians):
for magician in magicians:
print(magician.title()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_magicians(magician_names):\r\n for magician in magicians:\r\n print(magician.title())",
"def show_magicians(magicians):\n for magician in magicians:\n print(magician.title())",
"def show_magicians(names):\n for name in names:\n print(name.title())",
"def show_magicians(ma... | [
"0.8714682",
"0.8514172",
"0.8484406",
"0.84754664",
"0.83554345",
"0.8332724",
"0.8313311",
"0.8313311",
"0.82606876",
"0.6553883",
"0.63504726",
"0.63497484",
"0.63316244",
"0.6321548",
"0.6302823",
"0.6291485",
"0.62575394",
"0.62557036",
"0.6243572",
"0.6215778",
"0.62060... | 0.851634 | 1 |
Make a sandwich with the given items. | def make_sandwich(*items):
print("\nI'll make you a great sandwich:")
for item in items:
print(" ...adding " + item + " to your sandwich.")
print("Your sandwich is ready!") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_sandwich(*items):\n print(\"\\nLet's make a sandwich\")\n for item in items:\n print(f\" ...adding {item} to your sandwich.\")\n print(\"Your sandwich is ready!\")",
"def make_sandwich(*items):\r\n print(\"\\nI'll make you a great sandwich:\")\r\n for item in items:\r\n pri... | [
"0.8152394",
"0.8003603",
"0.69834894",
"0.6879198",
"0.6675288",
"0.5725165",
"0.54576844",
"0.54569757",
"0.54341316",
"0.54065806",
"0.53949875",
"0.53869104",
"0.534376",
"0.53420186",
"0.5321193",
"0.530678",
"0.53014386",
"0.52681535",
"0.5256891",
"0.5253725",
"0.52497... | 0.80531454 | 1 |
Show all the models that were printed. | def show_completed_models(completed_models):
print("\nThe following models have been printed:")
for completed_model in completed_models:
print(completed_model) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_completed_models(completed_models):\r\n print(\"\\nThe following models have been printed:\")\r\n for completed_model in completed_models:\r\n print(completed_model)",
"def show_completed_models(completed_models):\n\tprint(\"\\n The following models has been printed \")\n\tfor completed_mod... | [
"0.7549775",
"0.75047755",
"0.747714",
"0.74623185",
"0.7298368",
"0.6900053",
"0.68073606",
"0.6799979",
"0.6793256",
"0.67166597",
"0.66848123",
"0.6670663",
"0.66703516",
"0.66703516",
"0.6633097",
"0.6624305",
"0.6621623",
"0.6609719",
"0.6587271",
"0.64904606",
"0.647244... | 0.75553346 | 1 |
Save a torch tensor as an image. x is the tensor. x could be in shape of (C, H, W) or (H, W). The values in x must be already regulated in the range of 0255, although internal clipping is applied. Only png file is supported for output. | def save_tensor_image(fn, x):
if ( 3 == len( x.size() ) ):
x = x.permute((1, 2, 0))
# Get the CPU NumPy version.
x = torch.clamp(x, 0, 255)
x = x.cpu().numpy().astype(np.uint8)
# Save the iamge.
cv2.imwrite(fn, x, [cv2.IMWRITE_PNG_COMPRESSION, 0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tensor_to_image(x):\n\n # scale back from [-1,1] to [0,255] \n x = x.add(1).mul_(255).div_(2) # x = ((x + 1)*255 / (2))\n \n if x.is_cuda:\n x = x.cpu()\n\n x = x.data.numpy().astype(np.uint8) # convert to numpy\n\n return x",
"def tensor_to_image(tensor, save=None):\n img = t... | [
"0.7132745",
"0.6428868",
"0.6382926",
"0.62783366",
"0.6204363",
"0.615871",
"0.5957649",
"0.59140444",
"0.58868974",
"0.5822866",
"0.57088614",
"0.5677415",
"0.56736916",
"0.5664144",
"0.56620467",
"0.56524575",
"0.5628871",
"0.55921406",
"0.55885255",
"0.5586449",
"0.55835... | 0.84762025 | 0 |
Cache parameter group name to use for the new engine version. This parameter cannot be modified independently. | def cache_parameter_group_name(self) -> Optional[str]:
return pulumi.get(self, "cache_parameter_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parameter_group_name(self) -> str:\n return pulumi.get(self, \"parameter_group_name\")",
"def parameter_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"parameter_group_name\")",
"def parameter_group_name(self) -> Optional[str]:\n return pulumi.get(self, \"parameter_... | [
"0.7216925",
"0.6994307",
"0.69770503",
"0.6923793",
"0.67310417",
"0.67310417",
"0.67310417",
"0.67310417",
"0.6433151",
"0.60383093",
"0.5932667",
"0.5915389",
"0.5878341",
"0.58480775",
"0.58480775",
"0.5787056",
"0.578535",
"0.5764399",
"0.5715472",
"0.5715472",
"0.570959... | 0.81070614 | 0 |
join TargetSizes that have the same length | def compress(self):
known_sizes = dict()
# list to dict to make them unique
for size in self.target_sizes:
if size.length in known_sizes:
known_sizes[size.length] += size.quantity
else:
known_sizes[size.length] = size.quantity
# b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _assign_sizes(self):",
"def _make_sizes_compatible(self, Q, K):\n N, L, H, E = Q.shape\n _, S, _, _ = K.shape\n if L == S:\n return Q, K\n\n if L < S:\n return Q, K[:, :L, :, :]\n\n if L > S:\n return Q, torch.cat([K, K.new_zeros(N, L-S, H, ... | [
"0.591205",
"0.5814371",
"0.57521456",
"0.5681011",
"0.5628014",
"0.56145144",
"0.5530423",
"0.5525208",
"0.5389106",
"0.53867835",
"0.5330181",
"0.5307243",
"0.52659696",
"0.5264594",
"0.5239204",
"0.52326137",
"0.52295434",
"0.52041596",
"0.5181093",
"0.51572216",
"0.514731... | 0.6324888 | 0 |
Number of target sizes in job | def __len__(self) -> int:
return sum(target.quantity for target in self.target_sizes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_size(self) -> pulumi.Output[float]:\n return pulumi.get(self, \"target_size\")",
"def target_size(self):\n return self.env.action_space",
"def __number_of_jobs__(self):\n # | - __number_of_jobs__\n num_jobs = 0\n\n # Regular jobs\n if self.job_var_lst is not... | [
"0.7234782",
"0.7010287",
"0.6874883",
"0.68653023",
"0.680723",
"0.6792699",
"0.6780713",
"0.6763353",
"0.6763353",
"0.6701251",
"0.6700382",
"0.66983193",
"0.6667928",
"0.6655481",
"0.6654997",
"0.665241",
"0.6647511",
"0.6643108",
"0.6638866",
"0.663687",
"0.6628715",
"0... | 0.7818226 | 0 |
Attempt to get a handler for target content type, based on the following naming convention. content_type.model_class()._meta.db_table as StudlyCaps + Handler | def get_handler(self, content_name):
import django_userhistory.handlers as handlers
def to_studly(x):
return "".join([token.capitalize() for token in x.split("_")])
handler_class = getattr(handlers,
"%sHandler" % ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gettype(self):\r\n\r\n return self.__handler_type",
"def get_handler_for_type(target_type):\n for handler in _config_handlers:\n if handler.accepts(target_type=target_type):\n return handler\n raise TargetException(f'Target type \"{target_type}\" was not found!')",
"def c... | [
"0.651118",
"0.5998275",
"0.59647256",
"0.593344",
"0.58753526",
"0.5871856",
"0.5785072",
"0.5724954",
"0.56091833",
"0.55546266",
"0.55406535",
"0.5533929",
"0.55305445",
"0.5512185",
"0.5508278",
"0.54950327",
"0.54917645",
"0.54868597",
"0.54856116",
"0.5467477",
"0.54616... | 0.69953233 | 0 |
Registers a handler from django_userhistory.handlers with the target content type. | def register(self, content_type, action):
content_name = content_type.model_class()._meta.db_table
if not content_name in self._registry.keys():
HandlerClass = self.get_handler(content_name)
handler = HandlerClass(content_type, action)
self._registry[content_name] = c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_handler(self, content_name):\n import django_userhistory.handlers as handlers\n \n def to_studly(x):\n return \"\".join([token.capitalize() for token in x.split(\"_\")])\n \n handler_class = getattr(handlers, \n ... | [
"0.6919011",
"0.6254006",
"0.621797",
"0.6046543",
"0.5963028",
"0.59110653",
"0.5872785",
"0.58714676",
"0.5799117",
"0.57870024",
"0.56773645",
"0.5652179",
"0.56483096",
"0.56220603",
"0.5613974",
"0.56060797",
"0.559053",
"0.5566109",
"0.5524837",
"0.5523579",
"0.5506833"... | 0.6814383 | 1 |
trilinear interpolation of a list of float indices into an input array | def trilinear_interp(img, indices):
input_array = np.array(img.get_data())
indices = np.array(indices)
x_indices = indices[:,0]
y_indices = indices[:,1]
z_indices = indices[:,2]
# get lower bounds
x0 = x_indices.astype(np.integer)
y0 = y_indices.astype(np.integer)
z0 = z_indice... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interpolate_arrays(t, idx, x_array, time_array):\n x1 = np.array([x_array[i, idx[i] - 1] for i in range(len(idx))])\n x2 = np.array([x_array[i, idx[i]] for i in range(len(idx))])\n t1 = np.array([time_array[i, idx[i] - 1] for i in range(len(idx))])\n t2 = np.array([time_array[i, idx[i]] for i in ra... | [
"0.6562217",
"0.64404553",
"0.63050056",
"0.6226838",
"0.61786574",
"0.61719245",
"0.6143853",
"0.61357576",
"0.60519886",
"0.60353947",
"0.6019923",
"0.5996599",
"0.59902215",
"0.5978184",
"0.59293574",
"0.5901753",
"0.5899994",
"0.58801246",
"0.5853711",
"0.5835718",
"0.582... | 0.7516063 | 0 |
returns a list of categories for given word word is assumed to be a noun | def get_synsets_rt(word: str) -> List:
return rt.categories(word) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wn_category(word):\n cats = ['transport', 'food', 'building', 'animal', 'appliance', 'action', 'clothes', 'utensil', 'body', 'color',\n 'electronics', 'number', 'human']\n cat_synsets = dict(zip(cats, map(wn.synsets, cats)))\n hyper = lambda s: s.hypernyms()\n synsets = wn.synsets(word)\... | [
"0.7372485",
"0.6690225",
"0.6612448",
"0.6525401",
"0.651774",
"0.6493844",
"0.640752",
"0.63505787",
"0.6314549",
"0.62869805",
"0.6224794",
"0.62062716",
"0.6177013",
"0.6115759",
"0.61153084",
"0.6073131",
"0.6063036",
"0.60554355",
"0.60387295",
"0.6015676",
"0.5999472",... | 0.67636645 | 1 |
endpoint for creating users. | def users_create(): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(self):\n data = flask.request.json\n user_dao.create_user(data)\n return None, 201",
"def create_user():\n return jsonify(success=True)",
"def create():\n api_request = apireq.APIRequest(request, 'client_schema')\n if api_request.is_invalid():\n return api_request.... | [
"0.8091536",
"0.8008507",
"0.78345585",
"0.7825197",
"0.778745",
"0.77282506",
"0.76912504",
"0.76757556",
"0.76596755",
"0.7652361",
"0.761085",
"0.7606998",
"0.76064557",
"0.75811917",
"0.7570787",
"0.7570725",
"0.7567286",
"0.75407255",
"0.7536876",
"0.7515103",
"0.7507312... | 0.86409366 | 0 |
endpoint for getting all users. | def get_all_users(): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_users():\n return jsonify(admin.get_all_users(current_app.scoped_session()))",
"def get(self):\n return get_all_users()",
"def get(self):\n return get_all_users()",
"def get(self):\n return get_all_users()",
"def get(self):\n return get_all_users()",
"def get_us... | [
"0.82880515",
"0.8201519",
"0.8201519",
"0.8201519",
"0.8201519",
"0.815641",
"0.8096515",
"0.80507237",
"0.80426705",
"0.79793996",
"0.79609495",
"0.79481286",
"0.78754205",
"0.78691787",
"0.7821718",
"0.77538985",
"0.7660757",
"0.76215994",
"0.76201195",
"0.7619997",
"0.759... | 0.83393633 | 0 |
endpoint for deleting an existing user. | def delete_user(): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_user():\n #TODO user delete\n pass",
"def delete(self):\n\n user_id = get_jwt_identity()\n user = user_crud.get(user_id)\n if not user:\n abort(404, message=\"User not Found\")\n all_tokens = auth_crud.get_user_tokens(user_id)\n tokens = [token.to_di... | [
"0.8224173",
"0.82240254",
"0.8095131",
"0.80867517",
"0.80733824",
"0.8055473",
"0.7964339",
"0.7946512",
"0.7930604",
"0.79290235",
"0.7910624",
"0.7896976",
"0.7892968",
"0.78766555",
"0.7868632",
"0.78527737",
"0.7849741",
"0.7782329",
"0.7761921",
"0.77443945",
"0.773288... | 0.83809257 | 0 |
endpoint for creating a meal item. | def create_meal(): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_item(self, user: User, **kwargs) -> None:",
"def add_item(self, m_id):\r\n \r\n # Take the meals entires from TOML file\r\n meals = self.cfg.get('payload',{}).get('plan',{})[0].get('meal',{})\r\n for entries in meals:\r\n # Check for valid entires\r\n ... | [
"0.71748585",
"0.68743443",
"0.68039215",
"0.64654106",
"0.64327985",
"0.63162285",
"0.6283834",
"0.6248784",
"0.6199066",
"0.6165938",
"0.6162627",
"0.61076814",
"0.6091239",
"0.60557234",
"0.60058933",
"0.5975615",
"0.5962668",
"0.59546316",
"0.5939682",
"0.5906587",
"0.590... | 0.7291947 | 0 |
endpoint for getting all meals. | def get_all_meals(): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_all_meals():\n return jsonify(meal.get_all_meals(request, client))",
"def getItems(self): \n \n kwargs = {}\n kwargs[\"max\"] = {\"deals.mocality.co.ke\" : 1, \"www.zetu.co.ke\":1, \"manual\":2}\n from frontpage import get_deals\n items = get_deals(self.context, ... | [
"0.80295134",
"0.66022474",
"0.62061334",
"0.61473227",
"0.6084214",
"0.60441476",
"0.60381746",
"0.59300137",
"0.59300137",
"0.59300137",
"0.5876583",
"0.5843697",
"0.5819183",
"0.5802667",
"0.5800906",
"0.57834834",
"0.57679635",
"0.5755792",
"0.5730585",
"0.5719813",
"0.57... | 0.7813046 | 1 |
endpoint for getting a particular meal. | def get_one_meal(): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_meals(self):\n with self.client:\n self.add_meal(\"fries\", 10000)\n response = self.get_meals()\n data = json.loads(response.data.decode())\n self.assertEqual(response.status_code, 200)\n self.assertIn(u\"fries\",\n ... | [
"0.60887384",
"0.5869869",
"0.5832309",
"0.5657703",
"0.558055",
"0.556172",
"0.55488896",
"0.55460864",
"0.5539888",
"0.54974526",
"0.5476253",
"0.54542285",
"0.54169923",
"0.54148626",
"0.5378161",
"0.53042907",
"0.5247249",
"0.5228154",
"0.52224445",
"0.52126676",
"0.52082... | 0.7270524 | 0 |
endpoint for updating an existing meal. | def update_meal(): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, request, pk=None): #update a specific object\n return Response({'http_method': 'PUT'})",
"def test_put_meal(self):\n with self.client:\n response = self.put_meal()\n data = json.loads(response.data.decode())\n self.assertEqual(response.status_code, ... | [
"0.6507705",
"0.6398263",
"0.6368367",
"0.6364509",
"0.6334011",
"0.63113445",
"0.62659824",
"0.6198881",
"0.6096849",
"0.60259545",
"0.6010511",
"0.6006679",
"0.5983854",
"0.5958844",
"0.59419256",
"0.589347",
"0.5877758",
"0.5875174",
"0.58732295",
"0.5864798",
"0.586193",
... | 0.7398946 | 0 |
endpoint for deleting an existing meal. | def delete_meal(): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_meal(self): # TODO test\n day = self.meal.day\n day.meals.remove(self.meal)\n self.meal_tree_box.screen.right_panel.update_calculated_day_fields()\n\n self.meal_tree.remove_node(self)\n # tree.remove_node(item_label)\n print(\"delete meal\")",
"def delete(sel... | [
"0.6889974",
"0.67704266",
"0.6749711",
"0.6742716",
"0.6738298",
"0.6704301",
"0.66982025",
"0.66842574",
"0.66842574",
"0.6655721",
"0.66549045",
"0.6634125",
"0.66098577",
"0.6557094",
"0.65524954",
"0.65377855",
"0.6501081",
"0.64808947",
"0.6441292",
"0.64284486",
"0.642... | 0.78557765 | 0 |
endpoint for creating a menu option. | def create_menu(): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_menus( self ):",
"def menuItem(*args):\n\toptionsWindow()",
"def getMenuOption():\n return menu_option",
"def menuItem(*args, allowOptionBoxes: bool=True, annotation: Union[AnyStr, bool]=\"\", boldFont:\n bool=False, checkBox: bool=True, collection: Union[AnyStr, bool]=\"\", command... | [
"0.68931335",
"0.63852745",
"0.6295836",
"0.6192427",
"0.61108965",
"0.6049615",
"0.60445213",
"0.6029763",
"0.59544194",
"0.59048945",
"0.5893975",
"0.5832266",
"0.577007",
"0.57663107",
"0.5752948",
"0.57408607",
"0.5731725",
"0.57203996",
"0.57009035",
"0.56737286",
"0.566... | 0.71429455 | 0 |
endpoint for getting all menu options. | def get_all_menu(): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_menus():\n\n pass",
"def menus(self):\r\n return []",
"def get_menu_items():\n\n pass",
"def get_menu_items(self) -> typing.List[typing.Tuple[str, typing.List[typing.Tuple[str, typing.Callable[[], None]]]]]: #this method is to be queried by the root frame when it is creating the menu bar... | [
"0.70815724",
"0.69816834",
"0.6871903",
"0.67523617",
"0.6738893",
"0.65586245",
"0.6513264",
"0.64703333",
"0.6469544",
"0.63830936",
"0.6311068",
"0.62826604",
"0.6193034",
"0.61624",
"0.61610705",
"0.609421",
"0.60562307",
"0.6017952",
"0.59730583",
"0.5913068",
"0.590251... | 0.7615595 | 0 |
endpoint for getting a particular menu option. | def get_one_menu_option(): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMenuOption():\n return menu_option",
"def get(self, option):\n return get(self.name, option)",
"def get_option(self, option):\n\t\treturn self.options[option]",
"def get_menu(menu_name):\n\n pass",
"def get_option(self, key):\n return self.options[key]",
"def get_menu_item(menu... | [
"0.76989347",
"0.67983544",
"0.6498565",
"0.64266354",
"0.64108473",
"0.61798805",
"0.61085516",
"0.61001223",
"0.6090635",
"0.5995749",
"0.59775877",
"0.59622097",
"0.59517455",
"0.5914217",
"0.5882963",
"0.5869925",
"0.5865383",
"0.58620507",
"0.5859168",
"0.5853871",
"0.58... | 0.7357763 | 1 |
Stops the running simulation and starts it again. Arguments are same as those of start_lab | def restart_lab(lab_path, prefix, **kwargs):
stop_lab(lab_path, prefix)
ret = start_lab(lab_path, prefix, **kwargs)
print('\n...done', flush=True)
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_and_restart():\n U.stop()\n os.execl(sys.executable, sys.executable, *sys.argv)",
"def restart():\n stop()\n start()",
"def restart(self):\n self.stop()\n self.start(init=False)",
"def _step(self):\n title()\n self.runCount = 1\n self.experiment.pause = False\n self._runE... | [
"0.63853216",
"0.62956566",
"0.6220585",
"0.6185616",
"0.6108431",
"0.60999876",
"0.5996634",
"0.59952164",
"0.59931463",
"0.59931463",
"0.59910524",
"0.598707",
"0.598707",
"0.598707",
"0.598707",
"0.5979689",
"0.59515053",
"0.59271854",
"0.5908728",
"0.5902196",
"0.5900538"... | 0.7154644 | 0 |
Looks up for an ID relevant to the passed action text in the list of known actions and their ids. | def get_action_id(self, action_text: str) -> int:
return self.templates.actions.index(action_text) # todo unhandled exception when not found | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_action_id(self, action_text: str) -> int:\n\n actions_tuple = tuple(action_text.split('+'))\n return self.action_tuples2ids[actions_tuple] # todo unhandled exception when not found",
"def findAction(self, actionId): #$NON-NLS-1$\r",
"def _act_id(self, act_str):\n\n # FIXME: instea... | [
"0.79540676",
"0.68357974",
"0.6595333",
"0.63970345",
"0.6138555",
"0.60993737",
"0.59390396",
"0.565289",
"0.5619492",
"0.56081283",
"0.55117035",
"0.549655",
"0.542244",
"0.54189414",
"0.5377593",
"0.5312524",
"0.5264652",
"0.52601194",
"0.52601194",
"0.52601194",
"0.52601... | 0.7702094 | 1 |
Generate text for the predicted speech action using the pattern provided for the action. The slotfilled state provides info to encapsulate to the pattern. | def _generate_slotfilled_text_for_action(self, action_id: int, slots: dict) -> str:
text = self.templates.templates[action_id].generate_text(slots)
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prep_robot_action(self):\n if self.robot.sensing:\n action_str = \"Action: Sensing...\"\n elif self.robot.moving_forward or self.robot.moving_backward:\n action_str = \"Action: Moving...\"\n else:\n action_str = \"Action: Target reached...\"\n # Prep... | [
"0.54468054",
"0.5371816",
"0.5289512",
"0.52670103",
"0.52567196",
"0.5169926",
"0.512893",
"0.510748",
"0.5070998",
"0.5065135",
"0.5036081",
"0.50309205",
"0.5020942",
"0.49984378",
"0.4987873",
"0.4969967",
"0.49653178",
"0.49584985",
"0.49402234",
"0.4929596",
"0.4927033... | 0.65132505 | 0 |
Assert that `actual_obj` is the same as `expected_obj` except keys where values are None. | def obj_assert(actual_obj, expected_obj):
# Pytest shortens the diff so we have to produce the diff ourselves
# to workaround this.
# https://github.com/pytest-dev/pytest/issues/2256
# https://github.com/pytest-dev/pytest/issues/3632
# pylint: disable=unidiomatic-typecheck
assert type(actual_obj) == type(ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expect_obj(expected, actual):\n return {k: v for k, v in expected.iteritems() if actual.get(k) != v}",
"def _dict_assert(actual_dict, expected_dict):\n for key in set(actual_dict) & set(expected_dict):\n _value_assert(key, actual_dict[key], expected_dict[key])",
"def _validate_dict_data(self, expect... | [
"0.74569476",
"0.6970658",
"0.6581951",
"0.65769976",
"0.6518167",
"0.6475961",
"0.63508976",
"0.6308672",
"0.62935245",
"0.6293422",
"0.622943",
"0.6208412",
"0.6177125",
"0.61715347",
"0.61401564",
"0.6114121",
"0.6101795",
"0.6098102",
"0.60845935",
"0.6082214",
"0.6074565... | 0.76034325 | 0 |
Returns connection widgets to add to connection form | def get_connection_form_widgets():
from flask_appbuilder.fieldwidgets import (
BS3TextFieldWidget,
BS3PasswordFieldWidget,
)
from wtforms import StringField
return {
"extra__ewah_amazon_ads__lwa_client_id": StringField(
"AWS LWA Client... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_connection_form_widgets() -> dict[str, Any]:\n from flask_appbuilder.fieldwidgets import BS3TextFieldWidget\n from flask_babel import lazy_gettext\n from wtforms import StringField\n\n return {\n \"auth_type\": StringField(lazy_gettext(\"Grpc Auth Type\"), widget=BS3T... | [
"0.70522356",
"0.7042836",
"0.701988",
"0.697619",
"0.6860358",
"0.66343844",
"0.66322803",
"0.66137195",
"0.6560368",
"0.6487957",
"0.6404302",
"0.63220257",
"0.62522",
"0.62083644",
"0.6205021",
"0.619013",
"0.6173819",
"0.60571605",
"0.6050816",
"0.5965908",
"0.5938909",
... | 0.73458636 | 0 |
adults_directory > string, directory of employed_adults_apr2020_jul2020.csv eg '../../src/csv/employed_adults_apr2020_jul2020.csv' covid_pol_directory > string, directory of pol_covid.csv eg '../../src/csv/pol_covid.csv' returns > pandas.DataFrame containing features of intereast | def catch_up(employed_adults_directory, covid_pol_directory):
# load in df
try:
df = pd.read_csv(employed_adults_directory, index_col=0)
except Exception as e:
print(str(e))
print("Please enter the correct directory for employed_adults_apr2020_jul2020.csv")
# create target v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_uci_adult(data_dir: pathlib.Path) \\\n -> Tuple[pd.DataFrame, pd.DataFrame]:\n train_pkl = data_dir / 'train_df.pkl'\n test_pkl = data_dir / 'test_df.pkl'\n\n if data_dir.exists() and len(tuple(data_dir.iterdir())) > 1:\n train_df = pd.read_pickle(train_pkl)\n test_df = p... | [
"0.61798716",
"0.59276307",
"0.58808255",
"0.5871795",
"0.5857944",
"0.5836723",
"0.57604444",
"0.57296884",
"0.5686535",
"0.5665045",
"0.5616399",
"0.5515983",
"0.5407081",
"0.53935385",
"0.537482",
"0.53732526",
"0.53600115",
"0.5358962",
"0.5354479",
"0.5339399",
"0.533573... | 0.6207496 | 0 |
read size samples starting at start, if resize_if_less is True and less than size samples are read, resize the array to size and fill with zeros | def read(self, start, size, resize_if_less=False):
# number of zeros to add to start and end of the buffer
add_to_start = 0
add_to_end = 0
if start < 0:
# the first FFT window starts centered around zero
if size + start <= 0:
return numpy.zeros... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sampleArray(sizeOfReducedSample = DEFSIZEOFREDUCEDSAMPLE): \n return np.zeros((sizeOfReducedSample, sizeOfReducedSample))",
"def read(self, size: int) -> np.ndarray:\n if size > self._buffer_size:\n raise ValueError('Cannot read more samples than the size of the buffer.')\n elif size <= 0:\n... | [
"0.6392703",
"0.6109369",
"0.60328317",
"0.5798559",
"0.5625615",
"0.5618283",
"0.55389684",
"0.54604983",
"0.54114455",
"0.54114455",
"0.54114455",
"0.54114455",
"0.5408911",
"0.53622127",
"0.5339409",
"0.53011173",
"0.52464396",
"0.5239562",
"0.5238701",
"0.5213627",
"0.520... | 0.6704879 | 0 |
starting at seek_point read fft_size samples, and calculate the spectral centroid | def spectral_centroid(self, seek_point, spec_range=120.0):
samples = self.read(seek_point - self.fft_size/2, self.fft_size, True)
samples *= self.window
fft = numpy.fft.fft(samples)
spectrum = numpy.abs(fft[:fft.shape[0] / 2 + 1]) / float(self.fft_size) # normalized abs(FFT) b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spectral_centroid(data, fft_data):\n freq = np.fft.fftfreq(len(data))[:len(fft_data)]\n freq[-1] += 1 # last element needs to be 0.5 not -0.5\n spec = np.abs(fft_data)\n spec_sum = np.sum(spec)\n if spec_sum == 0:\n return 0.25\n centroid = np.sum(spec*freq)/spec_sum\n return centro... | [
"0.6987702",
"0.69700575",
"0.5854527",
"0.5807606",
"0.56573975",
"0.5532542",
"0.54825485",
"0.5459714",
"0.54594535",
"0.5409072",
"0.53965884",
"0.53914803",
"0.5350007",
"0.5337808",
"0.5335611",
"0.53254294",
"0.5310589",
"0.5289045",
"0.5252126",
"0.523885",
"0.5222600... | 0.7856427 | 0 |
read all samples between start_seek and end_seek, then find the minimum and maximum peak in that range. Returns that pair in the order they were found. So if min was found first, it returns (min, max) else the other way around. | def peaks(self, start_seek, end_seek):
# larger blocksizes are faster but take more mem...
# Aha, Watson, a clue, a tradeof!
block_size = 4096
max_index = -1
max_value = -1
min_index = -1
min_value = 1
if end_seek > self.frames:
end_seek ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_peaks(chromosome, start, end, peaks):\n candidates = peaks[chromosome]\n indexes = [int(x[0]) for x in candidates]\n index_start = bisect(indexes, start)\n index_end = bisect(indexes, end)\n return candidates[index_start:index_end]",
"def find_best_point(self, start_i, end_i, ranges):\n ... | [
"0.61837894",
"0.6173824",
"0.61459947",
"0.6092279",
"0.5959186",
"0.5880018",
"0.5835617",
"0.5823718",
"0.5818205",
"0.5803422",
"0.5780151",
"0.5759469",
"0.57121974",
"0.57082546",
"0.5670549",
"0.56219447",
"0.5562173",
"0.5556161",
"0.5530582",
"0.54886013",
"0.5486243... | 0.83790404 | 0 |
given a list of colors, create a larger list of colors interpolating the first one. If flatten is True a list of numers will be returned. If False, a list of (r,g,b) tuples. num_colors is the number of colors wanted in the final list | def interpolate_colors(colors, flat=False, num_colors=256):
palette = []
for i in range(num_colors):
index = (i * (len(colors) - 1))/(num_colors - 1.0)
index_int = int(index)
alpha = index - float(index_int)
if alpha > 0:
r = (1.0 - alpha) * colors[index_int][0]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expand(colors, cutoff=12):\n output = []\n if len(colors) != 7 or cutoff > 14:\n leds_per_color = int(cutoff / len(colors))\n for i in colors:\n output += [i] * leds_per_color\n else:\n for j, i in enumerate(colors):\n output += [i] * (1 + (j % 2 == 1))\n ... | [
"0.64414346",
"0.59855473",
"0.59649986",
"0.5934188",
"0.5889408",
"0.5880003",
"0.58734107",
"0.58412755",
"0.57989866",
"0.57159334",
"0.57072985",
"0.564304",
"0.56237763",
"0.56205845",
"0.55856353",
"0.55585176",
"0.5531769",
"0.5525841",
"0.55230904",
"0.551889",
"0.54... | 0.68439347 | 0 |
draw 2 peaks at x using the spectral_centroid for color | def draw_peaks(self, x, peaks, spectral_centroid):
y1 = self.image_height * 0.5 - peaks[0] * (self.image_height - 4) * 0.5
y2 = self.image_height * 0.5 - peaks[1] * (self.image_height - 4) * 0.5
line_color = self.color_lookup[int(spectral_centroid*255.0)]
if self.previous_y != None... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spectral_centroid(data, fft_data):\n freq = np.fft.fftfreq(len(data))[:len(fft_data)]\n freq[-1] += 1 # last element needs to be 0.5 not -0.5\n spec = np.abs(fft_data)\n spec_sum = np.sum(spec)\n if spec_sum == 0:\n return 0.25\n centroid = np.sum(spec*freq)/spec_sum\n return centro... | [
"0.5565935",
"0.55516964",
"0.5502938",
"0.5441322",
"0.54362696",
"0.5434571",
"0.5309243",
"0.52560365",
"0.5229369",
"0.5216679",
"0.52092195",
"0.52085143",
"0.52022046",
"0.51788944",
"0.51619655",
"0.5126687",
"0.51110417",
"0.50897557",
"0.50891215",
"0.5059896",
"0.50... | 0.7422464 | 0 |
vertical antialiasing at y1 and y2 | def draw_anti_aliased_pixels(self, x, y1, y2, color):
y_max = max(y1, y2)
y_max_int = int(y_max)
alpha = y_max - y_max_int
if alpha > 0.0 and alpha < 1.0 and y_max_int + 1 < self.image_height:
current_pix = self.pix[x, y_max_int + 1]
r = int((1-alpha)*curren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def align_yaxis(ax1,v1,ax2,v2):\n _, y1 = ax1.transData.transform((0,v1))\n _, y2 = ax2.transData.transform((0,v2))\n inv = ax2.transData.inverted()\n _, dy = inv.transform((0,0)) - inv.transform((0,y1-y2))\n miny, maxy = ax2.get_ylim()\n ax2.set_ylim(miny+dy,maxy+dy)",
"def align_yaxis(ax1, v1... | [
"0.6360667",
"0.6215254",
"0.6199557",
"0.6111456",
"0.5963644",
"0.58766294",
"0.58105594",
"0.56630284",
"0.5614204",
"0.5412466",
"0.5403085",
"0.5402024",
"0.53698987",
"0.53581375",
"0.5276377",
"0.5246595",
"0.5245473",
"0.5243996",
"0.5223279",
"0.52162933",
"0.5195818... | 0.6659348 | 0 |
Detecta el cloudfare de un sitio web | def main():
word = 'cloudflare'
url = requests.get("") #aquí va la url del sitio a analizar
cabeceras = dict(url.headers) #convertimos las cabeceras de la respuesta de la peticion a dicionario
verify = False
#print(cabeceras)
for c in cabeceras:
if word in cabeceras[c].lower(): #verifico... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def urlvoid_check(name, api_key):\n if not is_fqdn(name):\n return None\n\n url = 'http://api.urlvoid.com/api1000/{key}/host/{name}'.format(key=api_key, name=name)\n response = requests.get(url)\n tree = ET.fromstring(response.text)\n if tree.find('./detections/engines'):\n return [e.t... | [
"0.53747594",
"0.53653574",
"0.52719367",
"0.5268355",
"0.5257263",
"0.52445626",
"0.5123494",
"0.51095825",
"0.51084846",
"0.50459176",
"0.50425947",
"0.5035714",
"0.5021042",
"0.5016012",
"0.5014428",
"0.5005225",
"0.50031245",
"0.4995821",
"0.49765348",
"0.49742797",
"0.49... | 0.67101336 | 0 |
Compute marginal distribution of nodes. Compute marginal distribution of Bayes net nodes by repeatedly applying self transition kernel and storing state counts. | def marginals(self, num_transitions):
counter = marg.MarginalCounter(self.net)
for _ in xrange(num_transitions):
self.transition()
counter.observe(self.state)
return counter.marginals() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marginal(self):\n m = np.zeros(len(self.domain))\n for fnode in self.neighbors:\n m += self.received[fnode]\n return np.exp(normalize(m))",
"def compute_marginals_given_observations(nodes, edges, node_potentials,\n edge_potentials, obser... | [
"0.6104626",
"0.58904034",
"0.5747067",
"0.5744962",
"0.5721854",
"0.57086504",
"0.5690536",
"0.5610403",
"0.5544684",
"0.5456729",
"0.54229796",
"0.5422455",
"0.5412697",
"0.54079825",
"0.54021573",
"0.53901523",
"0.5372916",
"0.5358692",
"0.5350604",
"0.5345664",
"0.5319810... | 0.65188247 | 0 |
Construct from a path to a MOS file | def from_file(cls, mos_file_path):
try:
xml = ET.parse(mos_file_path).getroot()
except ET.ParseError as e:
raise MosInvalidXML(e) from e
if cls == MosFile:
return cls._classify(xml)
return cls(xml) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_from_file(cls, path):\n\n with open(path, 'r') as file:\n # Possible FileNotFound.\n text = file.read()\n return cls.create_from_string(text)",
"def from_file(filename):\n fileExt = os.path.splitext(filename)[1][1:]\n with zopen(filename, \"rt\") as f:... | [
"0.6184103",
"0.58548456",
"0.5774671",
"0.57031673",
"0.565141",
"0.56513387",
"0.5645759",
"0.55453944",
"0.5529791",
"0.55261177",
"0.5455109",
"0.5442665",
"0.5438008",
"0.5430294",
"0.5424084",
"0.5416518",
"0.5410248",
"0.5409268",
"0.54073787",
"0.537686",
"0.5353092",... | 0.6487925 | 0 |
Construct from an XML string of a MOS document | def from_string(cls, mos_xml_string):
try:
xml = ET.fromstring(mos_xml_string)
except ET.ParseError as e:
raise MosInvalidXML(e) from e
if cls == MosFile:
return cls._classify(xml)
return cls(xml) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(cls, xml_string, mws_access_key=None, mws_secret_key=None, mws_account_id=None, mws_auth_token=None):\n ptn = '\\s+xmlns=\\\".*?\\\"'\n xml_string = re.sub(ptn, '', xml_string)\n tree = etree.fromstring(xml_string)\n return cls(tree)",
"def parse_string(s):\n return XmlWra... | [
"0.677168",
"0.6612326",
"0.63725734",
"0.6326176",
"0.62717223",
"0.61985093",
"0.61985093",
"0.61985093",
"0.6167916",
"0.61670464",
"0.61522174",
"0.612725",
"0.61039",
"0.61039",
"0.61039",
"0.60487014",
"0.60487014",
"0.60487014",
"0.60487014",
"0.60487014",
"0.60487014"... | 0.7452539 | 0 |
Construct from a MOS file in an S3 bucket | def from_s3(cls, bucket_name, mos_file_key):
xml = s3.get_file_contents(bucket_name, mos_file_key)
return cls.from_string(xml) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_s3(cls, *, bucket_name, prefix, suffix='.mos.xml', allow_incomplete=False):\n mos_file_keys = s3.get_mos_files(\n bucket_name=bucket_name,\n prefix=prefix,\n suffix=suffix,\n )\n logger.info(\"Making MosCollection from %s S3 files\", len(mos_file_keys)... | [
"0.70692635",
"0.6516148",
"0.63925534",
"0.62746304",
"0.6263018",
"0.6217099",
"0.61856353",
"0.6092108",
"0.60755974",
"0.60474473",
"0.5999944",
"0.5954371",
"0.59525806",
"0.594638",
"0.59445775",
"0.5909588",
"0.5888902",
"0.58853376",
"0.58819103",
"0.58480173",
"0.583... | 0.78974116 | 0 |
The XML element of the MOS file | def xml(self):
return self._xml | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml(self):\n raise NotImplementedError('This api does not return xml')",
"def xml(self):\n raise NotImplementedError('must be implemented by all subclasses')",
"def _get_ome_xml_root(self) -> ElementTree:\n ome_metadata_element = ElementTree.fromstring(self._ome_metadata)\n tree... | [
"0.6191037",
"0.6160161",
"0.61207587",
"0.6118511",
"0.59950256",
"0.59950256",
"0.59761906",
"0.5936559",
"0.5900199",
"0.58816946",
"0.5870264",
"0.574504",
"0.57075924",
"0.57042193",
"0.5647414",
"0.5576311",
"0.5558796",
"0.55405986",
"0.5529754",
"0.5440866",
"0.543838... | 0.6513476 | 1 |
``RunningOrder`` objects can be merged with other MOS files which | def __add__(self, other):
if self.xml.find('mosromgrmeta') is None or isinstance(other, RunningOrderControl):
return other.merge(self)
raise MosCompletedMergeError("Cannot merge completed MOS file") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createOrders(self):\n self.ordersDict = {}\n for pstep in self.processingSteps:\n if pstep.orderid not in self.ordersDict:\n self.ordersDict[pstep.orderid] = Order()\n self.ordersDict[pstep.orderid].addProcessingStep(pstep)",
"def update_order():",
"def up... | [
"0.57301384",
"0.5578974",
"0.5578974",
"0.54810643",
"0.5430899",
"0.54154515",
"0.5309957",
"0.5185033",
"0.5128715",
"0.5126834",
"0.5089472",
"0.5089172",
"0.50702393",
"0.5054465",
"0.5026765",
"0.50191027",
"0.49839538",
"0.4982578",
"0.49293143",
"0.49293143",
"0.49261... | 0.65616006 | 0 |
A list of elements found in the story bodies. Each item in the list is either a string (representing a ```` tag) or an | def body(self):
return list(
itertools.chain.from_iterable(story.body for story in self.stories)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags():",
"def getTagList(tags):\n tags = tags[1:len(tags)-1]\n return tags.split('><')",
"def collect_body(body_area: BeautifulSoup\n ) -> List[str]:\n body = []\n for p in body_area.find_all(\"p\"):\n body += [\n tidy_string(t) for t in p.text.split('\\n') if... | [
"0.60707825",
"0.60060203",
"0.58251345",
"0.57283133",
"0.57280487",
"0.5677742",
"0.5661054",
"0.56156766",
"0.5602193",
"0.5600598",
"0.55853176",
"0.5578002",
"0.5571787",
"0.5564393",
"0.5518274",
"0.550434",
"0.55031526",
"0.5496203",
"0.5487744",
"0.54559624",
"0.54465... | 0.62860036 | 0 |
Converts tag from roStorySend format to a tag to | def _convert_story_send_to_story_tag(self, ss_tag_orig):
# take a copy to preserve the original
ss_tag = copy.deepcopy(ss_tag_orig)
# change <roStorySend> to <story>
ss_tag.tag = 'story'
for item in ss_tag.find('storyBody').findall('storyItem'):
# change <storyItem> t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag(self, sent):\n # WORK HERE!!",
"def _get_tag(self, tag):\n return self.prefix + tag",
"def ot2bio_ts(ts_tag_sequence):\n new_ts_sequence = []\n n_tag = len(ts_tag_sequence)\n prev_pos = '$$$'\n for i in range(n_tag):\n cur_ts_tag = ts_tag_sequence[i]\n if cur_ts_... | [
"0.6616682",
"0.5686074",
"0.56662285",
"0.56404865",
"0.5538538",
"0.55253917",
"0.5520457",
"0.5515949",
"0.5489913",
"0.54678446",
"0.5449973",
"0.528295",
"0.52594507",
"0.5237474",
"0.5227021",
"0.52217084",
"0.51967645",
"0.517157",
"0.517157",
"0.51439154",
"0.51325005... | 0.66734785 | 0 |
Compute source wavelets for all events. | def compute(self):
wavelet_dict = dict()
self.count_dict = dict()
windows = self.compute_windows()
self.windows = windows
if self.verbose > 0:
print(
'Number of time windows before selection: {}'
.format(len(windows)))
wavelet_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculator_build_events_from_sources(self):\n gsims_by_trt = self.calculator.csm.full_lt.get_gsims_by_trt()\n print('FetchOpenQuake: self.calculator.csm.src_groups = ')\n print(self.calculator.csm.src_groups)\n sources = self.calculator.csm.get_sources()\n print('FetchOpenQua... | [
"0.63917893",
"0.5611098",
"0.5553969",
"0.5509747",
"0.54442126",
"0.53985703",
"0.5396504",
"0.5381248",
"0.5366619",
"0.5278929",
"0.52540815",
"0.5248997",
"0.5241827",
"0.5209363",
"0.52085286",
"0.5201672",
"0.5173375",
"0.5171574",
"0.5152607",
"0.51278114",
"0.5094215... | 0.5768997 | 1 |
Add the clusters into two cluster lists, based on the files they come from. The spectra list in each cluster has been sorted based on the "filename" and "index(spec_id)", to reduce the comparing cost. Cluster with sorted spectra is stored in self.sorted_spectra_dict. | def process_cluster(self, cluster):
if self._ignore_cluster(cluster):
return
self.cluster_lists[self.file_index].append(cluster)
spectra = list(cluster.get_spectra())
def mixed_order( spec ): # for sorting
return (spec.get_title())
spectra.sort(key = mi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_pairing(self, include=None, exclude=None):\n\n # List the file names for both the images and the catalogs\n if isinstance(self._irac_image_dir, list):\n image_files = list(chain.from_iterable(glob.glob(f'{img_dir}/*.fits') for img_dir in self._irac_image_dir))\n else:\n ... | [
"0.671192",
"0.6579183",
"0.623321",
"0.6212616",
"0.58086264",
"0.57499635",
"0.5719938",
"0.5465947",
"0.545334",
"0.54432523",
"0.53136796",
"0.52571845",
"0.52283037",
"0.5213647",
"0.5186864",
"0.5181228",
"0.5170263",
"0.5169883",
"0.5166386",
"0.5146968",
"0.5141218",
... | 0.7109906 | 0 |
Calculate the similarity between to cluster. | def calculate_similarity(self, cluster0, cluster1):
def compare_spectrum(spectrum0, spectrum1):
"""
Compare a pair of spectra to decide the
order.
:param: pair of spectra
:return: 0 equal, -1 spectrum0 is less,
1, spectrum0 is bigger.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_cluster_similarities(emb_clusters1, emb_clusters2, compare, order, clmethod, plot):\n def compute_sim(e, e1, cls, cls1):\n sims = np.empty((20, 20))\n xticks, yticks = [], []\n for i, c in enumerate(cls):\n yticks.append(', '.join(c[1]) + (f' {round(c[3], 5)}' if orde... | [
"0.7004203",
"0.6960784",
"0.68198586",
"0.680045",
"0.67387044",
"0.6730371",
"0.67269003",
"0.67176515",
"0.6708255",
"0.6648994",
"0.6643601",
"0.6629708",
"0.6614624",
"0.6608014",
"0.6588627",
"0.6569378",
"0.65644586",
"0.6536995",
"0.65363985",
"0.65344214",
"0.6531359... | 0.7982397 | 0 |
Compare a pair of spectra to decide the order. | def compare_spectrum(spectrum0, spectrum1):
title0 = spectrum0.get_title()
title1 = spectrum1.get_title()
if(title0 < title1):
return -1
elif(title0 > title1):
return 1
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_models(model1,model2):\n\n # initialisation:\n n_radial = 0\n n_radial_numax = 0\n n_non_radial = 0\n n_non_radial_numax = 0\n result = np.zeros((6+nglb,),dtype=gtype)\n # define frequency interval around numax:\n numax = 0.5*(model1.numax/model1.glb[ifreq_ref] \\\n + ... | [
"0.6231901",
"0.6170436",
"0.60652286",
"0.59840304",
"0.5847573",
"0.58054245",
"0.58004314",
"0.5777185",
"0.5762237",
"0.57182205",
"0.5710124",
"0.57029307",
"0.5690969",
"0.5687309",
"0.56795",
"0.56760997",
"0.56754684",
"0.56592643",
"0.5640042",
"0.5572353",
"0.554725... | 0.67257226 | 0 |
Compare two cluster lists, get the distribution of the similarities. And build the connection network between clusters. | def compare(self):
len0 = len(self.cluster_lists[0])
len1 = len(self.cluster_lists[1])
longer_index = 0 if len0 >= len1 else 1
shorter_index = 1 if len1 <= len0 else 0
self.stars_length = len(self.cluster_lists[shorter_index])
self.starlets_length = len(self.cluster_list... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linkage(self, other):\n \n distance = 0\n list1 = self.get_cluster_elements\n list2 = other.get_cluster_elements\n lenght = 0\n t = 0\n \n #first it \"de-clusterize\" the cluster into a simple list\n #of Sequence.\n done = False\n whi... | [
"0.7432022",
"0.7403706",
"0.6922472",
"0.65903777",
"0.65444666",
"0.64513767",
"0.6268047",
"0.6203793",
"0.6194198",
"0.6192187",
"0.6148422",
"0.6138819",
"0.6125411",
"0.60899097",
"0.60899097",
"0.60692817",
"0.60341746",
"0.6033754",
"0.60336924",
"0.6031622",
"0.60186... | 0.7985712 | 0 |
Only for debug, output the intersted intermediate data. | def output_debug_info(self): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_debug(self):",
"def debug():",
"def debug():\n return exported_res_dict",
"def hook_debug(module, input, output):\n print('Hooking ' + module.__class__.__name__)\n print('output size:', output.data.size())\n return output",
"def debug_print(input_data, debug_flag):\n if debug_fla... | [
"0.64916664",
"0.63190013",
"0.6053072",
"0.59637755",
"0.5934237",
"0.5929946",
"0.59256124",
"0.59170365",
"0.58803976",
"0.586192",
"0.5836801",
"0.5834557",
"0.58341",
"0.58013886",
"0.5766095",
"0.57624286",
"0.57618135",
"0.5743867",
"0.5743867",
"0.57432413",
"0.572956... | 0.68176574 | 0 |
Initialize the graphs, set default namespaces, and add schema information | def initGraphs(self):
self.graph = ConjunctiveGraph()
# Create a separate graph for annotations
self.annotationGraph = ConjunctiveGraph()
self.log.debug('Adding namespaces to graphs')
# Bind namespaces to graphs
for namespace in self.namespaces:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setup_graph(self):\n pass",
"def _setup_graph(self):\n pass",
"def graphing_setup(self):\n pass",
"def load_default_schema(self):\n self.schema = preprocess_schema(load_schemaorg())\n self.schemaorg_schema = self.schema\n if \"@context\" in self.schema:\n ... | [
"0.68641925",
"0.68641925",
"0.67362523",
"0.64591694",
"0.63962966",
"0.63340455",
"0.630638",
"0.62226146",
"0.62033623",
"0.6092146",
"0.6045552",
"0.5990174",
"0.5989362",
"0.5975724",
"0.5940292",
"0.5923793",
"0.58770597",
"0.5811327",
"0.5799534",
"0.57994545",
"0.5796... | 0.81335664 | 0 |
Add definition of data cell resource to graph | def addDataCellProperty(self):
if len(self.config.get('dataCell', 'propertyName')) > 0 :
self.dataCellPropertyName = self.config.get('dataCell', 'propertyName')
else :
self.dataCellPropertyName = 'hasValue'
self.graph.add((self.namespaces['tablink'][self.dataCel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parseData(self, i,j) :\n \n if self.isEmpty(i,j) and self.config.get('dataCell', 'implicitZeros') == '0':\n return\n\n # Use the fully qualified name of the cell for the resource name\n observation = self.namespaces['scope'][self.source_cell_qname]\n \n # It... | [
"0.6125234",
"0.5949589",
"0.5604612",
"0.5538034",
"0.53618133",
"0.53510714",
"0.53040045",
"0.5273849",
"0.5217118",
"0.52152145",
"0.5190409",
"0.5168822",
"0.51595867",
"0.5157983",
"0.5156494",
"0.51276433",
"0.5088871",
"0.50712395",
"0.5062926",
"0.5030208",
"0.502128... | 0.72946614 | 0 |
Start tablinker for all sheets in workbook | def doLink(self):
self.log.info('Starting TabLinker for all sheets in workbook')
for n in range(self.rb.nsheets) :
self.log.info('Starting with sheet {0}'.format(n))
self.r_sheet = self.rb.sheet_by_index(n)
self.w_sheet = self.wb.get_sheet(n)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dfs_tabs(df_list, sheet_list, file_name):\n\n writer = pd.ExcelWriter(file_name,engine='xlsxwriter') \n for dataframe, sheet in zip(df_list, sheet_list):\n dataframe.to_excel(writer, sheet_name=sheet, startrow=0 , startcol=0, index=False) \n writer.save()",
"def init_tab(self):",
"def _... | [
"0.5541069",
"0.5510997",
"0.53878844",
"0.5301912",
"0.52269375",
"0.5203114",
"0.5169694",
"0.51684624",
"0.51476425",
"0.5124174",
"0.5094382",
"0.5086308",
"0.5036357",
"0.50047654",
"0.5000547",
"0.498682",
"0.49550384",
"0.4946182",
"0.49025017",
"0.48974904",
"0.488194... | 0.7718059 | 0 |
Check if the specified cell is inside a merge box | def insideMergeBox(self, i, j):
self.merged_cells = self.r_sheet.merged_cells
for crange in self.merged_cells:
rlo, rhi, clo, chi = crange
if i <= rhi - 1 and i >= rlo and j <= chi - 1 and j >= clo:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _cell_in_boundary(self, i_row, i_col):\n return ((i_row, i_col) == self._tl_cell or\n (i_row, i_col) == self._tr_cell or\n (i_row, i_col) == self._bl_cell or\n (i_row, i_col) == self._br_cell or\n (i_row, i_col) in self._ls_cells or\n ... | [
"0.6639167",
"0.62162066",
"0.62069386",
"0.6185728",
"0.6135019",
"0.613434",
"0.60930055",
"0.60695374",
"0.6034053",
"0.599769",
"0.59915805",
"0.59759665",
"0.59484524",
"0.5945689",
"0.59377486",
"0.59255916",
"0.586906",
"0.57882535",
"0.5784687",
"0.57802624",
"0.57582... | 0.7624417 | 0 |
Get type for a given excel style. Style name must be prefixed by 'TL ' | def getType(self, style):
typematch = re.search('TL\s(.*)',style)
if typematch :
cellType = typematch.group(1)
else :
cellType = 'Unknown'
return cellType | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_style_name(style):\n return style_names[style]",
"def getStyle( oDrawDoc, cStyleFamily, cStyleName ):\n return oDrawDoc.getStyleFamilies().getByName( cStyleFamily ).getByName( cStyleName )",
"def getStyle( oDrawDoc, cStyleFamily, cStyleName ):\n return oDrawDoc.getStyleFamilies().getByName( cS... | [
"0.6604656",
"0.56850237",
"0.56850237",
"0.567217",
"0.56424755",
"0.56234217",
"0.555254",
"0.5535046",
"0.55263466",
"0.54266644",
"0.541407",
"0.54030395",
"0.5391107",
"0.53663534",
"0.53261137",
"0.5313256",
"0.5309504",
"0.52514493",
"0.5199331",
"0.5185982",
"0.518364... | 0.8320291 | 0 |
Determine whether the row 'i' is empty by iterating over all its cells | def isEmptyRow(self, i, colns):
for j in range(0,colns) :
if not self.isEmpty(i,j):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _empty_cell(self, i_row, i_col):\n return self._board[i_row][i_col] == \" \"",
"def isEmpty(self, i,j):\n if (self.r_sheet.cell(i,j).ctype == XL_CELL_EMPTY or self.r_sheet.cell(i,j).ctype == XL_CELL_BLANK) or self.r_sheet.cell(i,j).value == '' :\n return True\n else :\n ... | [
"0.7473845",
"0.7296481",
"0.7214513",
"0.7045703",
"0.69759065",
"0.6929257",
"0.69021064",
"0.68930095",
"0.68914115",
"0.6884303",
"0.677159",
"0.6761381",
"0.66550964",
"0.6649621",
"0.6636591",
"0.6615453",
"0.6603428",
"0.65721446",
"0.6551199",
"0.65251505",
"0.6506972... | 0.80203426 | 0 |
Determine whether the column 'j' is empty by iterating over all its cells | def isEmptyColumn(self, j, rowns ):
for i in range(0,rowns) :
if not self.isEmpty(i,j):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isEmpty(self, i,j):\n if (self.r_sheet.cell(i,j).ctype == XL_CELL_EMPTY or self.r_sheet.cell(i,j).ctype == XL_CELL_BLANK) or self.r_sheet.cell(i,j).value == '' :\n return True\n else :\n return False",
"def isEmptyRow(self, i, colns):\n for j in range(0,colns) :\n ... | [
"0.7546138",
"0.7499232",
"0.7411689",
"0.7362343",
"0.7212022",
"0.700954",
"0.6992287",
"0.69318384",
"0.68618983",
"0.6854895",
"0.6771662",
"0.67496836",
"0.67292607",
"0.67151654",
"0.67087036",
"0.66941625",
"0.66847795",
"0.6680317",
"0.6675843",
"0.6639423",
"0.660467... | 0.82039 | 0 |
Create a valid QName from a string or dictionary of names | def getQName(self, names):
if type(names) == dict :
qname = self.sheet_qname
for k in names :
qname = qname + '_' + self.processString(names[k])
else :
qname = self.sheet_qname + '_' + self.processString(names)
self.log.debug(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefixed_to_qname(name, namespaces):\n if not name or name[0] == '{':\n return name\n\n try:\n prefix, name = name.split(':')\n except ValueError:\n if ':' in name:\n raise XMLSchemaValueError(\"wrong format for reference name %r\" % name)\n try:\n uri... | [
"0.63530743",
"0.62808156",
"0.5452673",
"0.53344524",
"0.53202206",
"0.53112113",
"0.5212181",
"0.5110032",
"0.49981594",
"0.49654347",
"0.49509653",
"0.49226233",
"0.4908517",
"0.490726",
"0.48862973",
"0.48777443",
"0.48484436",
"0.48263034",
"0.47890726",
"0.47470844",
"0... | 0.6753324 | 0 |
Add a "value" + optional label to the graph for a cell in the source Excel sheet. The value is typically the value stored in the source cell itself, but may also be a copy of another cell (e.g. in the case of 'idem.'). | def addValue(self, source_cell_value, altLabel=None):
source_cell_value_qname = self.getQName(source_cell_value)
#self.graph.add((self.namespaces['scope'][source_cell_value_qname],self.namespaces['qb']['dataSet'],self.namespaces['scope'][self.sheet_qname]))
#self.graph.add((self.namespa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addDataCellProperty(self):\n\n if len(self.config.get('dataCell', 'propertyName')) > 0 :\n self.dataCellPropertyName = self.config.get('dataCell', 'propertyName')\n else :\n self.dataCellPropertyName = 'hasValue'\n \n self.graph.add((self.namespaces['tablink'][... | [
"0.615311",
"0.6016978",
"0.5784294",
"0.57634187",
"0.5491898",
"0.54802597",
"0.54665345",
"0.5313811",
"0.53111017",
"0.52833664",
"0.52833664",
"0.5218997",
"0.5212952",
"0.51941884",
"0.5180054",
"0.51653117",
"0.5137305",
"0.51121974",
"0.510059",
"0.5096071",
"0.50943"... | 0.7885539 | 0 |
Parses the currently selected sheet in the workbook, takes no arguments. Iterates over all cells in the Excel sheet and produces relevant RDF Triples. | def parseSheet(self):
self.log.info("Parsing {0} rows and {1} columns.".format(self.rowns,self.colns))
self.column_dimensions = {}
self.property_dimensions = {}
self.row_dimensions = {}
self.rowhierarchy = {}
# Get dictionary of annotations
self.annotati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_workbook_2007(maldoc):\n\n # Read in the 2007+ cells.\n color_print.output('g', \"Analyzing Excel 2007+ file ...\")\n workbook_info = XLM.excel2007.read_excel_2007_XLM(maldoc) \n color_print.output('g', \"Extracted XLM from ZIP archive.\")\n if (workbook_info is None):\n return (... | [
"0.59065926",
"0.588335",
"0.5851833",
"0.58396024",
"0.57515866",
"0.57357067",
"0.5698196",
"0.5622286",
"0.5601682",
"0.5598388",
"0.5592947",
"0.5533867",
"0.54799414",
"0.54638106",
"0.5462083",
"0.5449317",
"0.54294676",
"0.53984255",
"0.53801996",
"0.5378331",
"0.53173... | 0.5996458 | 0 |
Create relevant triples for the cell marked as HierarchicalRowHeader (i, j are row and column) | def parseHierarchicalRowHeader(self, i, j) :
# Use the rowhierarchy to create a unique qname for the cell's contents,
# give the source_cell's original value as extra argument
self.log.debug("Parsing HierarchicalRowHeader")
# Add all the values
for (index, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateRowHierarchy(self, i, j) :\n if (self.isEmpty(i,j) or str(self.source_cell.value).lower().strip() == 'id.') :\n # If the cell is empty, and a HierarchicalRowHeader, add the value of the row header above it.\n # If the cell above is not in the rowhierarchy, don't do anything.\... | [
"0.65490097",
"0.6294752",
"0.594738",
"0.59043705",
"0.57500565",
"0.57479346",
"0.57423884",
"0.57275605",
"0.5715262",
"0.56237084",
"0.5617685",
"0.5605162",
"0.5578194",
"0.55193824",
"0.5493202",
"0.5471666",
"0.5447898",
"0.54384774",
"0.5399843",
"0.53924745",
"0.5382... | 0.77270657 | 0 |
Create relevant triples for the cell marked as RowHeader (i, j are row and column) | def parseRowHeader(self, i, j) :
rowHeaderValue = ""
# Don't attach the cell value to the namespace if it's already a URI
isURI = urlparse(str(self.source_cell.value))
if isURI.scheme and isURI.netloc:
rowHeaderValue = URIRef(self.source_cell.value)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parseHierarchicalRowHeader(self, i, j) :\n \n # Use the rowhierarchy to create a unique qname for the cell's contents, \n # give the source_cell's original value as extra argument\n self.log.debug(\"Parsing HierarchicalRowHeader\")\n \n # Add all the values\n ... | [
"0.65384173",
"0.6428634",
"0.62268245",
"0.6196706",
"0.60129696",
"0.5934677",
"0.5929354",
"0.5860375",
"0.5848651",
"0.582546",
"0.5752896",
"0.57145184",
"0.5701042",
"0.56515646",
"0.5624343",
"0.5594867",
"0.557267",
"0.55643606",
"0.5546426",
"0.5532326",
"0.55153096"... | 0.651021 | 1 |
Create relevant triples for the cell marked as Header (i, j are row and column) | def parseColHeader(self, i, j) :
cell_content = self.processString(self.source_cell.value)
if self.isEmpty(i,j):
if self.insideMergeBox(i,j):
k, l = self.getMergeBoxCoord(i,j)
# If we are in a vertical merge box, skip adding the dimension
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_table(self):\n table_str = self.header_row\n row_lbls, col_lbls = self.get_idxvals()\n for r,rlbl in enumerate(row_lbls):\n row_data = [self.data[rlbl,clbl] for clbl in col_lbls]\n table_str += self.construct_row(r, row_data)\n \n return ta... | [
"0.617691",
"0.6162402",
"0.6132254",
"0.60185426",
"0.5913192",
"0.5805475",
"0.5729024",
"0.57240564",
"0.57084984",
"0.56882006",
"0.567843",
"0.56647724",
"0.5646249",
"0.56307137",
"0.5625876",
"0.5589763",
"0.55401385",
"0.55369973",
"0.5511337",
"0.5482087",
"0.5474257... | 0.61814195 | 0 |
Create relevant triples for the cell marked as Property (i, j are row and column) | def parseRowProperty(self, i, j) :
if self.isEmpty(i,j):
if self.insideMergeBox(i,j):
k, l = self.getMergeBoxCoord(i,j)
self.source_cell_value_qname = self.addValue(self.r_sheet.cell(k,l).value)
else:
return
else:
self.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_cell_property(**kwargs):\n\n GR = glo.global_results()\n\n p = copy.copy(params)\n for key,val in kwargs.items():\n setattr(p,key,val)\n\n counter = 0\n fignum = 1\n if p.gal_index == 'all':\n for gal_index in range(GR.N_gal):\n\n if counter... | [
"0.59597266",
"0.5798212",
"0.5689155",
"0.5662074",
"0.5509147",
"0.5433768",
"0.5403682",
"0.5354711",
"0.5354367",
"0.52252835",
"0.52039206",
"0.51522255",
"0.51293564",
"0.5127747",
"0.5106118",
"0.51053613",
"0.5096017",
"0.5090393",
"0.5088328",
"0.50702417",
"0.505578... | 0.6471484 | 0 |
Create relevant triples for the cell marked as Title (i, j are row and column) | def parseTitle(self, i, j) :
self.graph.add((self.namespaces['scope'][self.sheet_qname],
self.namespaces['tablink']['title'],
Literal(self.source_cell.value)))
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_cells(self) -> None:\n for i in range(15):\n for j in range(15):\n c = Cell(x=i, y=j)\n c.answer = self.puzzle.solution[j*self.width+i]\n self.cells[(j, i)] = c # row, col",
"def make_cell(dim, color, text, pos):\n text = SVG(\"text... | [
"0.5752521",
"0.5618874",
"0.5594066",
"0.55346483",
"0.54468024",
"0.5362363",
"0.5276663",
"0.5273043",
"0.5271772",
"0.5265556",
"0.5264578",
"0.5219525",
"0.5181345",
"0.5177485",
"0.51762134",
"0.51750475",
"0.51648974",
"0.5153127",
"0.51320815",
"0.51295865",
"0.512116... | 0.5880317 | 0 |
Create relevant triples for the cell marked as Data (i, j are row and column) | def parseData(self, i,j) :
if self.isEmpty(i,j) and self.config.get('dataCell', 'implicitZeros') == '0':
return
# Use the fully qualified name of the cell for the resource name
observation = self.namespaces['scope'][self.source_cell_qname]
# It's an observa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triples(self):\n _, c = self.get_column(0)\n headers = self.headers()\n\n vert = 0\n for y in c:\n for x in headers[1:]:\n _, col = self.get_column(x)\n yield x, y, col[vert]\n vert += 1",
"def _maketriples_all(self):\n nh... | [
"0.6395268",
"0.6097674",
"0.6011352",
"0.6008751",
"0.5926637",
"0.5872956",
"0.5804833",
"0.57685137",
"0.5703892",
"0.558489",
"0.5566948",
"0.5514906",
"0.544173",
"0.5409082",
"0.53761554",
"0.5367287",
"0.5358765",
"0.5353787",
"0.5283858",
"0.52688724",
"0.5259786",
... | 0.6157402 | 1 |
Create relevant triples for the annotation attached to cell (i, j) | def parseAnnotation(self, i, j) :
if self.config.get('annotations', 'model') == 'oa':
# Create triples according to Open Annotation model
body = BNode()
self.annotationGraph.add((self.annotationNamespaces['scope'][self.source_cell_qname],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triples():",
"def cell_edges(self):",
"def _maketriples_all(self):\n nholes = self.ctrs.shape[0]\n tlist = []\n for i in range(nholes):\n for j in range(nholes):\n for k in range(nholes):\n if i < j and j < k:\n tlist.... | [
"0.59439474",
"0.57840616",
"0.5771213",
"0.5651306",
"0.55747366",
"0.5536669",
"0.5526513",
"0.5453578",
"0.5389024",
"0.5381066",
"0.5360514",
"0.53128767",
"0.5279125",
"0.52303",
"0.52081484",
"0.51737696",
"0.51633644",
"0.5160572",
"0.51496154",
"0.5141213",
"0.5119964... | 0.6424114 | 0 |
return True/False Accepts a list of number. Check each of them for pairwise primality against the last number in the list. Presumably the numbers other than the last have been checked together already as they were added to the group | def pair_check_last(pgroup):
if len(pgroup) < 2:
return True #only one number, we're all good
p2 = pgroup[-1]
for p1 in pgroup[:-1]:
# concatenate the two numbers
x = concatenate_number(p1,p2)
y = concatenate_number(p2,p1)
if not is_prime(x) or not is_prime(y):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toate_elementele_prime(lst):\n for x in lst:\n if nr_prim(x) is False:\n return False\n return True",
"def pairwise_coprime(listing: list):\n\n assert isinstance(listing, list)\n\n size = len(listing)\n\n for i in range(0, size - 1):\n for j in range(i + 1, size):\n ... | [
"0.7255272",
"0.65309936",
"0.6473677",
"0.64144915",
"0.63442236",
"0.63309944",
"0.6329136",
"0.6321939",
"0.6257557",
"0.6256556",
"0.6254843",
"0.6244247",
"0.6143883",
"0.6110097",
"0.60926336",
"0.607919",
"0.6078543",
"0.6038998",
"0.6021289",
"0.6016878",
"0.60090774"... | 0.73921317 | 0 |
Factory function to create a Scanner Object. Creates the appropriate Scanner based on the type of "function". | def Scanner(function, *args, **kwargs):
if SCons.Util.is_Dict(function):
return Selector(function, *args, **kwargs)
return ScannerBase(function, *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_scanner(self, fp):\n\n # define some pattern constructs\n letter = plex.Range('azAZ')\n digit = plex.Range('09')\n id = letter + plex.Rep(letter | digit)\n\n bool_values = plex.NoCase(plex.Str('true', 'false', 't', 'f', '0', '1'))\n operator = plex.Str('and', 'o... | [
"0.5235107",
"0.508695",
"0.4857713",
"0.48354968",
"0.48309183",
"0.4793647",
"0.4658142",
"0.46433085",
"0.45872793",
"0.45799643",
"0.45500925",
"0.45473775",
"0.4500285",
"0.4478512",
"0.44592196",
"0.44550812",
"0.44539836",
"0.44417617",
"0.44364035",
"0.44027957",
"0.4... | 0.725456 | 0 |
Construct a new scanner object given a scanner function. | def __init__(
self,
function,
name="NONE",
argument=_null,
skeys=_null,
path_function=None,
# Node.FS.Base so that, by default, it's okay for a
# scanner to return a Dir, File or Entry.
node_class=SCons.Node.FS.Base,
node_factory=None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Scanner(function, *args, **kwargs):\n if SCons.Util.is_Dict(function):\n return Selector(function, *args, **kwargs)\n\n return ScannerBase(function, *args, **kwargs)",
"def generic_scan(self, scanning_function, scan_values):\n self._scan_task = lambda: (scanning_function(value) for value ... | [
"0.7244033",
"0.57468677",
"0.57457054",
"0.5470237",
"0.54092604",
"0.52280784",
"0.51564944",
"0.5155334",
"0.5099691",
"0.50587845",
"0.49932528",
"0.4953749",
"0.4951547",
"0.49447927",
"0.49344972",
"0.49334335",
"0.4932754",
"0.49186698",
"0.4914585",
"0.4897359",
"0.48... | 0.59241885 | 1 |
Add a skey to the list of skeys | def add_skey(self, skey):
self.skeys.append(skey) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _newKey(self, key):\n self._testKeySubNsAdd()\n self._getKeyList().append(key)",
"def add_key(self, key_list: list) -> None:\n\n for key, funct, desc in key_list:\n # Force keys to be lowercase\n key = key.lower()\n \n self.key_functs[key] = fu... | [
"0.6918046",
"0.68153",
"0.67764807",
"0.6521519",
"0.64393306",
"0.6381378",
"0.6304096",
"0.6279466",
"0.62740725",
"0.6228384",
"0.6181732",
"0.6176246",
"0.6136221",
"0.6125423",
"0.6107211",
"0.60862434",
"0.60614914",
"0.6036131",
"0.602362",
"0.6017402",
"0.6014589",
... | 0.8900067 | 0 |
A zombie contaminate an entity (a human) | def contaminate_human(self, zombie, entity, contagion):
zombie.remove_contagion()
self._entities['humans'].remove(entity) # First, remove from humans list
entity.create_zombie(zombie._team, contagion) # Create the zombie
self.add_zombie(entity) # Add the zombie to correct lists | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_zombie(self, entity):\n if entity not in self._entities['all']:\n self._entities['all'].append(entity)\n self._entities['zombies'].append(entity)\n self._entities[entity._team]['zombies'].append(entity)\n entity.set_id(self._entities[entity._team]['id'])\n self... | [
"0.65786755",
"0.6414622",
"0.6244318",
"0.6160534",
"0.6101022",
"0.5848172",
"0.5807426",
"0.5714068",
"0.5696216",
"0.5650056",
"0.5601324",
"0.5570709",
"0.55606973",
"0.5534239",
"0.5518104",
"0.5503926",
"0.5461295",
"0.5445497",
"0.5431379",
"0.542859",
"0.54199785",
... | 0.7457176 | 0 |
if _berzerk == 0, return True, otherwise False and decrement _berzerk | def explode_berzerk(self):
if self._berzerk == 0:
return True
else:
self._berzerk -= 1
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __bool__(self):\n return self.balance > 0",
"def bust(person):\n if person.total > GOAL_TOTAL() and person.aceCount == 0:\n return True\n elif person.total > GOAL_TOTAL() and person.aceCount > 0:\n adjust_ace(person)\n return person.total > GOAL_TOTAL()\n else: # person... | [
"0.6348729",
"0.6312768",
"0.62008715",
"0.61842895",
"0.6080119",
"0.60605335",
"0.6056995",
"0.59416884",
"0.58878094",
"0.58724326",
"0.58027655",
"0.57933015",
"0.57500744",
"0.5739855",
"0.5727855",
"0.5693709",
"0.5666006",
"0.56546545",
"0.563878",
"0.5620981",
"0.5615... | 0.8668914 | 0 |
Save the chosen inline result. | def handle_chosen_inline_result(bot, update, session, user):
print('yey')
result = update.chosen_inline_result
[search_id, file_id] = result.result_id.split(':')
inline_search = session.query(InlineSearch).get(search_id)
inline_search.sticker_file_id = file_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self):\r\n return self.format_inline('SAVE')",
"def save_result(self):\n self.print_to_console()",
"def save_results(self, instagram_results):",
"def save():",
"def save(self, output, data):",
"def save(self):\n # TODO (Pierre): code",
"def save(self, output, data):\n ... | [
"0.6735525",
"0.62600577",
"0.61059755",
"0.58987725",
"0.5868327",
"0.58610654",
"0.5859027",
"0.58146185",
"0.5678531",
"0.5619963",
"0.5616627",
"0.55837095",
"0.55716276",
"0.5530707",
"0.5530707",
"0.5530707",
"0.5530707",
"0.5530707",
"0.55018866",
"0.5454901",
"0.54505... | 0.6425206 | 1 |
Generate Docker packager context for templates | def _generate_template_context(arguments: PackagingResourceArguments,
manifest: OdahuProjectManifest,
output_folder: str) -> DockerTemplateContext:
logging.info('Building context for template')
return DockerTemplateContext(
model_name=manife... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_templates(self):\n\n # dockerfile\n try:\n t = self.templates.get_template(\n 'docker/dockerfiles/{}.dockerfile.template'.format(self.repo)\n )\n except TemplateNotFound:\n t = self.templates.get_template(\n 'docker/dock... | [
"0.6282052",
"0.61933947",
"0.6136679",
"0.60558534",
"0.58784723",
"0.5858421",
"0.58169395",
"0.5723731",
"0.56796557",
"0.5674595",
"0.5632834",
"0.56223804",
"0.5598952",
"0.5592088",
"0.5563634",
"0.5544418",
"0.55120486",
"0.5495992",
"0.5495983",
"0.5478548",
"0.546537... | 0.74108833 | 0 |
contact BigCommerce to get a list of all statuses | def statuses(self):
big = BigCommerceAPI()
response = big.get('orderstatuses')
return response.text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_book_statuses() -> list:\n return data.get_book_statuses()",
"def statuses(self):\n return self._get_paged(\"statuses\")",
"async def getstatuses(self, ctx):\n final_list = \"\"\n statuses = await ex.get_bot_statuses()\n if statuses is not None:\n for status in... | [
"0.70530266",
"0.6975715",
"0.6951591",
"0.6940131",
"0.6810279",
"0.6785142",
"0.65524304",
"0.65246916",
"0.6490896",
"0.6191409",
"0.6190848",
"0.6127102",
"0.61073303",
"0.6101589",
"0.6101589",
"0.6099395",
"0.6067096",
"0.60656",
"0.60287863",
"0.6015986",
"0.60054404",... | 0.73402935 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.