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 |
|---|---|---|---|---|---|---|
Convert the sof file to an rbf file. | def gen_rbf(working_dir, target_system):
log_msg = "Generating rbf file"
# Command uses -m FPP for the fast passive parallel which ends up being equivalent to passive parallel x16
cmd = f"cd {working_dir}/output_files && {QUARTUS_BIN_DIR}quartus_cpf -c -m FPP {target_system}.sof {target_system}.rbf"
log... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_from_file(self, path, file_name, path_to_xml):\n\n # Match prefix to RBD type\n type_prefix = file_name[:2].upper()\n self.__rbd_type = MAP_RBD_TYPE[type_prefix]\n\n # Get date from file name\n file_name_date = file_name[2:].split(\".\")\n\n if len(file_name_da... | [
"0.5527742",
"0.5426892",
"0.54131085",
"0.540764",
"0.5325548",
"0.5290419",
"0.5276711",
"0.52184325",
"0.5189796",
"0.5157613",
"0.51223093",
"0.51211697",
"0.51206297",
"0.5115384",
"0.5090208",
"0.5070756",
"0.50682986",
"0.50670725",
"0.50634104",
"0.5057316",
"0.505593... | 0.6122628 | 0 |
Execute quartus workflow to create a system, project, compiles it, and convert the output file to an RBF. | def execute_quartus_workflow(target_system, custom_components, sys_clock_rate_hz, working_dir=""):
init_logging()
target = None
if(target_system == "audiomini"):
target = Audiomini
elif(target_system == "reflex"):
target = Reflex
elif(target_system == "audioblade"):
target =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeProject(\n self,\n projectFilePath,\n files,\n constraints,\n part,\n generics,\n workingDirectory,\n entity\n ):\n log.info('Creating project file for Quartus...')\n # Import the quartus TCL project module\n projectFileString ... | [
"0.6187596",
"0.59366596",
"0.59350306",
"0.59029156",
"0.5881408",
"0.5865779",
"0.5853959",
"0.5849708",
"0.5829477",
"0.5822153",
"0.575698",
"0.5698947",
"0.568428",
"0.5673495",
"0.5660085",
"0.5660085",
"0.5660085",
"0.5657106",
"0.5656693",
"0.5621947",
"0.56022",
"0... | 0.6893998 | 0 |
This is passed a set of NII images, their PNG equilvalents, and an html base path, and then it generates the metadata needed | def generate_scanset_metadata( image_set_dictionary, html_base_path, session_id ):
cur_subj_info = {}
"""need to think through the data structure a bit more.... but can always adjust later """
cur_subj_info['session_id'] = session_id
#cur_subj_info['img_id'] = counter
cur_subj_info['subject_id'] = session_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_metadata_imagedata(metadata, out_filebase, i):\n metadata['FITSImageFilename'] = [out_filebase + FITS_EXT]\n metadata['PNGImageFileName'] = [out_filebase + PNG_EXT]\n metadata['PNGThumbNailFileName'] = [out_filebase + '_tnail' + PNG_EXT]\n\n image_keys = [\"IntegrationTime\", \"RightAscensi... | [
"0.6272349",
"0.6246689",
"0.6148742",
"0.61255157",
"0.6047819",
"0.60324687",
"0.58982563",
"0.5879673",
"0.5852035",
"0.58246547",
"0.58059406",
"0.57948786",
"0.5718799",
"0.5671328",
"0.5644622",
"0.56365746",
"0.56350064",
"0.56334466",
"0.56260616",
"0.5606971",
"0.560... | 0.69061834 | 0 |
`members` is an indicator map of integers in {0,...,n 1}, indicating whether or not they have been selected. This returns the length of the longest sequence of consecutive selected integers, allowing for wrapping around the end of the list. | def longest_consecutive_run(members, n):
try:
# first false element, so that when the loop ends we know we're at the
# end of a run
start = next(ind for ind, m in enumerate(members) if not m)
except StopIteration:
return n
longest_run = current_run = 0
for i in range(n):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def member_count(self):\n return len(self.members)",
"def getSize(self):\n return reduce(max, [m.getSize() for m in self.members])",
"def getNumMembers(self):\n return _libsbml.ListOfMembers_getNumMembers(self)",
"def _find_members(self, given_members):\n if len(list(self.points))... | [
"0.57456607",
"0.56201494",
"0.552606",
"0.54941535",
"0.53692347",
"0.5237222",
"0.51946807",
"0.5190037",
"0.5180802",
"0.5156791",
"0.5028969",
"0.5020251",
"0.49830306",
"0.49090585",
"0.48956454",
"0.48665679",
"0.48633596",
"0.48231372",
"0.48231372",
"0.48110732",
"0.4... | 0.6687962 | 0 |
Efficiently calculate proportions, but also print out every combination for testing purposes. | def main():
for combination in indicated_combinations(7, 3):
print("{}: {}".format("".join(map(str, combination)),
(longest_consecutive_run(combination, 7))))
run_lengths = Counter(longest_consecutive_run(combination, 7)
for combination in indicated_combinations... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total(proportions):\n final = {}\n for i in proportions:\n if i in running_total:\n final[i] = proportions[i] * running_total[i]\n print(final)\n else:\n final[i] = 0\n print(final)\n\n total_sum = sum(final.values())\n return total_sum",
... | [
"0.63919544",
"0.61692196",
"0.60967034",
"0.59410363",
"0.5927594",
"0.5893252",
"0.5852905",
"0.5852494",
"0.5845556",
"0.58452123",
"0.5837388",
"0.58056396",
"0.580003",
"0.57816267",
"0.57695234",
"0.5729784",
"0.56627595",
"0.5627432",
"0.5620827",
"0.56184983",
"0.5618... | 0.70586395 | 0 |
This API call is used by clients to generate a transient unique identifier (device_id stored on client) which ties the device to a persistent voter_id (mapped together and stored on the server). | def device_id_generate_view(request): # deviceIdGenerate
voter_device_id = generate_voter_device_id() # Stored in cookie elsewhere
if 'test' not in sys.argv:
logger.debug("apis_v1/views.py, device_id_generate-voter_device_id: {voter_device_id}".format(
voter_device_id=voter_device_id))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_id(self):\n return self.device_id",
"def device_id(self):\n return self.unique_id",
"def generate_device_id():\n\n # TODO this is awful, makes me sad, but for now also makes demoing\n # easier We might want to look into an auto-configuration feature for\n # devices... | [
"0.5992226",
"0.59693384",
"0.59448224",
"0.5916292",
"0.58905965",
"0.58840346",
"0.57598627",
"0.5751196",
"0.5751196",
"0.5723132",
"0.56740403",
"0.56451935",
"0.5619523",
"0.5612395",
"0.5514415",
"0.5513794",
"0.5510547",
"0.55095315",
"0.55070895",
"0.5503767",
"0.5501... | 0.6220008 | 0 |
This API call is used by clients to add a Firebase Cloud Messaging token ~ FCB Token to the device_id record. FCM Tokens are generated by Google's Firebase Cloud Messaging service, and are unique for every device. FCM Tokens allow the cloud messaging service to send messages (Notifications) to individual devices. | def device_store_firebase_fcm_token_view(request): # deviceStoreFirebaseCloudMessagingToken
voter_device_id = get_voter_device_id(request) # We standardize how we take in the voter_device_id
# cloud_messaging.test_msg_to_my_phone()
if positive_value_exists(voter_device_id):
voter_device_id = get... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_token():\n token = request.json.get('token')\n deviceId = request.json.get('deviceId')\n\n user = User.query.filter_by(token=token).first()\n device = DevicesNotificationHandlers.query.filter_by(user_id=user.id).first()\n\n if device is None:\n # Device doesn't exist for that user cr... | [
"0.68186164",
"0.6304515",
"0.6223961",
"0.59679323",
"0.5880343",
"0.5607849",
"0.54607797",
"0.54607797",
"0.5411109",
"0.54030186",
"0.53483415",
"0.5308932",
"0.5228625",
"0.52245146",
"0.518855",
"0.5184873",
"0.51721525",
"0.51710486",
"0.51545304",
"0.5134717",
"0.5088... | 0.67771614 | 1 |
This function tokenizes the input string into words. Words are delimited by any character other than az, AZ, or 09. Input parameter is a string value named myBlob Return value for the function is a list named words having various individual words | def tokenize_into_words(myblob):
set_constraint = re.compile(r'[^a-zA-Z0-9]')
tokenize_to_text = set_constraint.split(myblob) # The blob is spilt into words and the given constraints are applied
words = [word for word in tokenize_to_text if word]
return words | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize_wordchars(lines):\n return",
"def tokenize_words(line):\n return",
"def split_words(value: str) -> List[str]:\n words: List[str] = []\n buffer: List[str] = []\n previous = None\n\n def flush():\n if buffer:\n words.append(\"\".join(buffer))\n buffer.c... | [
"0.67992646",
"0.66997206",
"0.666949",
"0.6655788",
"0.65895283",
"0.6552675",
"0.65470886",
"0.65334576",
"0.65188324",
"0.6510504",
"0.650512",
"0.6438312",
"0.6413835",
"0.6398799",
"0.6393677",
"0.6379444",
"0.635739",
"0.6348406",
"0.6345524",
"0.63408345",
"0.6327856",... | 0.85862476 | 0 |
This function counts the total number of unique words in a list of words. Input parameter is a list of strings named words. Return value for the function is a dictionary named total_count__of_words | def count_unique_words(words):
total_count__of_words = {} # Defining a Dictionary
for word in words:
if word.lower() in total_count__of_words: # As mentioned in the requirements checking for case insensitive matching
total_count__of_words[word.lower()] += 1
else:
tota... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(words):\n word_count = {}\n num_words = 0\n unique_words = 0\n for word in words:\n num_words += 1\n if word_count.has_key(word):\n word_count[word] += 1\n else:\n word_count[word] = 1\n unique_words += 1\n word_count[\"total\"] = num_w... | [
"0.8347935",
"0.7685116",
"0.76714516",
"0.75586385",
"0.75226676",
"0.7478183",
"0.7390423",
"0.7383353",
"0.72977513",
"0.72761124",
"0.726074",
"0.7229416",
"0.7225797",
"0.72211355",
"0.7212261",
"0.7200024",
"0.7178056",
"0.7166821",
"0.7146676",
"0.7143388",
"0.7087314"... | 0.84510267 | 0 |
This function returns the most frequent words from the dictionary and sorts them by decreasing value of their counts Input parameters are a dictionary named total_count__of_words and n (Integer value) Return value is a list comprising of (word of string type, total count of integer type) | def display_top_n_words(total_count__of_words, n): # Considering n=10 here as specified in the requirements
return sorted(total_count__of_words.items(), key=lambda i: i[1], reverse=True)[:n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_top_n_words(word_list, n):\n word_counts = dict()\n\n for word in word_list:\n freq = word_counts.get(word, 1)\n word_counts[word] = freq + 1\n\n ordered_by_frequency = sorted(word_counts, key=word_counts.get, reverse=True)\n\n return ordered_by_frequency[0:n]",
"def get_top_n_w... | [
"0.80428505",
"0.7895537",
"0.78642637",
"0.78605986",
"0.7850885",
"0.78356206",
"0.7766449",
"0.77244157",
"0.76808304",
"0.7669837",
"0.76002157",
"0.7522508",
"0.74986",
"0.74507254",
"0.74499804",
"0.73692155",
"0.7356767",
"0.7237825",
"0.7235489",
"0.7233807",
"0.71814... | 0.79177636 | 1 |
Send a protocol message. | def send_protocol_message(self, msg):
self.conn.send(msg + "\0") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send(self, msg):\n pass",
"def send(self, msg):\n pass",
"def send(self, msg):\n pass",
"def send(self, message):\n pass",
"def send(self, msg: str):\n\t\tself.client.send(msg.encode())",
"def sendChatMessage(self, msg):\n self.transport.write(msg)",
"def send(mes... | [
"0.7368058",
"0.7368058",
"0.7368058",
"0.72825855",
"0.7132242",
"0.70801",
"0.7056209",
"0.7051402",
"0.70470774",
"0.7037163",
"0.70317113",
"0.70256835",
"0.70253325",
"0.6992118",
"0.69509435",
"0.6950814",
"0.69372773",
"0.6921525",
"0.6899694",
"0.6897017",
"0.6888101"... | 0.8353058 | 0 |
Retrieves an item from the table row using a column name as an index. If the column is missing and required, an exception is raised. If the missing column is optional, not exception is raised and no warning is issued. If the missing column is neither required nor optional, a warning is issued. | def __getitem__(self, colname):
colname = colname.lower()
if colname in self.data:
return self.data[colname]
else:
if colname in self.required:
raise ColumnNameError(
'A required column, "' + colname + '", was missing.',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, index):\r\n if isinstance(index, int):\r\n try:\r\n return next(islice(self.iterall(), index, index + 1))\r\n except StopIteration:\r\n raise IndexError\r\n elif isinstance(index, six.string_types):\r\n for column in... | [
"0.7188624",
"0.7022914",
"0.6900678",
"0.68834275",
"0.6455199",
"0.6262405",
"0.6198789",
"0.6187595",
"0.61815387",
"0.6136272",
"0.60536766",
"0.60478914",
"0.59997255",
"0.59918386",
"0.59743917",
"0.595873",
"0.5942922",
"0.59264857",
"0.59230554",
"0.5899779",
"0.58987... | 0.75014544 | 0 |
Sets the column names that are required in the input CSV file. If one or more of these columns are missing, an exception will be thrown. | def setRequiredColumns(self, colnames):
# Make sure all column names are lower case so comparisons in _TableRow
# are not case sensitive. From a modularity standpoint, this should be
# done in _TableRow, but it is more efficient to do it here, since the
# conversion need be done only on... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_column_names(self, cols):\n self.stdout.write('Verifying CSV header')\n csv_cols = set(cols)\n if self.required_csv_columns <= csv_cols:\n return True\n else:\n missing_cols = set(self.required_csv_columns).difference(csv_cols)\n raise Valid... | [
"0.7347033",
"0.6625051",
"0.65196013",
"0.630105",
"0.6254292",
"0.617943",
"0.61749446",
"0.61672455",
"0.6156906",
"0.61555696",
"0.61454135",
"0.6115721",
"0.610193",
"0.6095778",
"0.60830265",
"0.6026419",
"0.5986834",
"0.594816",
"0.58882225",
"0.5881691",
"0.58423406",... | 0.72575843 | 1 |
Sets the column names that are optional in the input CSV file. If one or more of these columns are missing, no exception will be thrown and no warning will be issued. Access to missing columns that are neither required nor optional will result in a warning being issued. To specify that all nonrequired columns are optio... | def setOptionalColumns(self, colnames):
# Make sure all column names are lower case so comparisons in _TableRow
# are not case sensitive. From a modularity standpoint, this should be
# done in _TableRow, but it is more efficient to do it here, since the
# conversion need be done only on... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setRequiredColumns(self, colnames):\n # Make sure all column names are lower case so comparisons in _TableRow\n # are not case sensitive. From a modularity standpoint, this should be\n # done in _TableRow, but it is more efficient to do it here, since the\n # conversion need be don... | [
"0.65928024",
"0.64266706",
"0.6385368",
"0.60022235",
"0.58509713",
"0.5742815",
"0.57218516",
"0.5713587",
"0.5686693",
"0.5584674",
"0.5580623",
"0.5493597",
"0.54716647",
"0.5455155",
"0.5444114",
"0.5410559",
"0.5403131",
"0.5348812",
"0.5348389",
"0.5328392",
"0.5267851... | 0.76574177 | 0 |
Sets default values for one or more columns. If a nonrequired column is missing, the default value will be returned. An empty string ('') is the default default value. | def setDefaultValues(self, defaultvals):
# Add lower-case versions of all column names to the dictionary to
# ensure that comparisions in _TableRow are not case sensitive. From a
# modularity standpoint, this should be done in _TableRow, but it is
# more efficient to do it here rather t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_values_as_needed(self):\n if self.verbose:\n click.echo('Updating required default values')\n for field in ARGUMENTS_DEFAULT_VALUES:\n if self.__class__.__name__ in ARGUMENTS_DEFAULT_VALUES[field][1]:\n self.data[field] = ARGUMENTS_DEFAULT_VALUES[f... | [
"0.6490255",
"0.64806205",
"0.637042",
"0.62180704",
"0.61946034",
"0.6187734",
"0.6168072",
"0.605824",
"0.5781991",
"0.57378626",
"0.5736657",
"0.5708585",
"0.559138",
"0.55867636",
"0.5549939",
"0.545841",
"0.5446433",
"0.5420867",
"0.54127294",
"0.5396827",
"0.5390741",
... | 0.6536581 | 0 |
Retrieves a table from the source document according to an integer index. Must be implemented by child classes. | def getTableByIndex(self, index):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_table(self, site_index, table, session_index=''):\n assert site_index in siteinfo.site_ids, AssertionError('Invalid site {0}'\n 'Please select from the following sites {1}'\n .... | [
"0.6416631",
"0.6150278",
"0.6150278",
"0.6022671",
"0.59624594",
"0.5867003",
"0.58553344",
"0.58553344",
"0.57866806",
"0.5783195",
"0.57679427",
"0.5749294",
"0.5557491",
"0.554438",
"0.5512963",
"0.5478259",
"0.5416845",
"0.54158986",
"0.53867245",
"0.5386083",
"0.5382721... | 0.75034213 | 0 |
Credit deliverer account for its delivery (simulated) | def credit_deliverer():
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def charge_credit_card(amount,save_to_cim=False):\n\n # Create a merchantAuthenticationType object with authentication details\n # retrieved from the constants file\n merchantAuth = apicontractsv1.merchantAuthenticationType()\n merchantAuth.name = CONSTANTS.apiLoginId\n merchantAuth.transactionKey =... | [
"0.6248183",
"0.6216263",
"0.6062878",
"0.60272276",
"0.5962362",
"0.59167963",
"0.58919203",
"0.5830167",
"0.5723288",
"0.56793565",
"0.5677979",
"0.5677636",
"0.5666006",
"0.5637373",
"0.56277984",
"0.5619927",
"0.5611901",
"0.56091636",
"0.5578273",
"0.5551082",
"0.5526631... | 0.70062166 | 0 |
Kafka Ordering Topic Producer as thread worker Get messages from a shared mq queue.Queue | def kafka_ordering_producer_worker(mq: queue.Queue):
global app_config
# Client
producer = KafkaProducer(bootstrap_servers=bootstrap_servers,
value_serializer=lambda item: json.dumps(item).encode('utf-8'))
while not t_stop_event.is_set():
try:
if mq.qsi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kafka_ordering_consumer_worker(mq: queue.Queue):\n global app_config\n\n # Client\n consumer = KafkaConsumer('ordering',\n bootstrap_servers=bootstrap_servers,\n value_deserializer=lambda item: json.loads(item.decode('utf-8')))\n\n while not t... | [
"0.76208484",
"0.63753676",
"0.60358584",
"0.5999825",
"0.5957936",
"0.5944693",
"0.59164405",
"0.5892575",
"0.58696926",
"0.5848723",
"0.58282316",
"0.570228",
"0.56996846",
"0.56481713",
"0.5588357",
"0.5576523",
"0.55621034",
"0.55191225",
"0.5495073",
"0.5495073",
"0.5492... | 0.79887104 | 0 |
Kafka Ordering Topic Consumer as thread worker | def kafka_ordering_consumer_worker(mq: queue.Queue):
global app_config
# Client
consumer = KafkaConsumer('ordering',
bootstrap_servers=bootstrap_servers,
value_deserializer=lambda item: json.loads(item.decode('utf-8')))
while not t_stop_event.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kafka_ordering_producer_worker(mq: queue.Queue):\n global app_config\n\n # Client\n producer = KafkaProducer(bootstrap_servers=bootstrap_servers,\n value_serializer=lambda item: json.dumps(item).encode('utf-8'))\n\n while not t_stop_event.is_set():\n try:\n ... | [
"0.65461224",
"0.6034095",
"0.59629554",
"0.5851769",
"0.58438575",
"0.5832637",
"0.5716817",
"0.56504816",
"0.5545219",
"0.5526763",
"0.55084866",
"0.55013734",
"0.55009586",
"0.54947346",
"0.54716414",
"0.54710066",
"0.54423887",
"0.5426972",
"0.54220915",
"0.5421651",
"0.5... | 0.7117551 | 0 |
Kafka Payment Topic Consumer as thread worker | def kafka_payment_consumer_worker(mq: queue.Queue):
global app_config
# Client
consumer = KafkaConsumer('payment',
bootstrap_servers=bootstrap_servers,
value_deserializer=lambda item: json.loads(item.decode('utf-8')))
while not t_stop_event.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribeConsumer(consumer):",
"def stress_test_consumer():\n consumer = kafka_manager.get_kafka_consumer()\n for message in consumer:\n message_content = json.loads(message.value.decode())\n message_topic = message.topic\n print(\"received:\")\n print(message_topic)\n ... | [
"0.6391188",
"0.63009906",
"0.616582",
"0.61614764",
"0.61027217",
"0.5998529",
"0.597766",
"0.5972912",
"0.59177846",
"0.5895183",
"0.58941704",
"0.5893983",
"0.5893276",
"0.58728796",
"0.58186674",
"0.5791373",
"0.57665217",
"0.5702994",
"0.569525",
"0.568234",
"0.56744134"... | 0.742334 | 0 |
Return a dictionary mapping each name in `fields` to the sequence of values seen for that field in the given file. | def get_fields(csv_file, fields):
result = OrderedDict()
for field in fields:
result[field] = []
with open(csv_file) as f:
reader = csv.DictReader(f)
for row in reader:
for field in fields:
result[field].append(row[field])
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_fields(fname):\n \n all = 0\n fields = set()\n for r in read_zbl_records( open(fname, 'r')):\n all+=1\n for field in r.iterkeys():\n fields.add(field)\n return all, fields",
"def _make_field_map(fields):\n field_map = {}\n for field in fields:\n ... | [
"0.5758521",
"0.5739197",
"0.5675925",
"0.5663115",
"0.53921586",
"0.538752",
"0.5386532",
"0.5362478",
"0.5325645",
"0.524918",
"0.524828",
"0.5231989",
"0.52131206",
"0.5196644",
"0.5179504",
"0.51094043",
"0.5091822",
"0.5077243",
"0.5074709",
"0.5062698",
"0.5042187",
"... | 0.61735135 | 0 |
Plot the given data. Expect to receive a dict mapping experiment names to results. Each result is itself a dict mapping a type of data to a sequence of values. Each experiment has a different colour, and each type of data has a different line style. | def plot(data, colours, line_styles):
plt.style.use("seaborn-poster") # See also seaborn-talk and seaborn-paper.
plt.grid(axis="y", linestyle="-", color="#d8dcd6")
for name, experiment in data.items():
for label, series in experiment.items():
epochs = range(1, len(series) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_data(data):\n\n # Get number of options in the data\n n_options = np.sum(data.columns.str.startswith(\"Q_\"))\n options = range(n_options)\n\n # Set up the figure\n n_panels = 3 + n_options # choice, reward, Q_i / p_r_i, state\n fig, axs = plt.subplots(\n n_panels, 1, figsize=cm2... | [
"0.69556856",
"0.67111295",
"0.6419152",
"0.6324564",
"0.6312454",
"0.6298279",
"0.6297926",
"0.6288202",
"0.62433845",
"0.619844",
"0.61854297",
"0.6152548",
"0.61467457",
"0.6124558",
"0.61241513",
"0.6118146",
"0.6112948",
"0.6093528",
"0.60668004",
"0.60638356",
"0.601418... | 0.7039951 | 0 |
Extract the convolution type from the name of the log file. Assumes the log file has been created using this tool. | def get_conv_type(filename):
for conv_type in structured.conv2d_types.keys():
if conv_type in filename:
return conv_type
else:
log.error("Couldn't detect convolution type of", filename)
exit(1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_file_type(input_file):\r\n file_info, error = subprocess.Popen([settings.FILE, input_file], stdout=subprocess.PIPE).communicate()\r\n\r\n file_type = file_info.decode(\"utf-8\").split()[1]\r\n\r\n if file_type == \"tcpdump\":\r\n return \"pcap\"\r\n elif file_type == \"pcap-ng\":\r... | [
"0.5579709",
"0.5567336",
"0.54831654",
"0.5470968",
"0.536477",
"0.5362669",
"0.5325084",
"0.52873605",
"0.52286816",
"0.518095",
"0.51737994",
"0.51653296",
"0.5158996",
"0.51573",
"0.5145008",
"0.5113098",
"0.50996023",
"0.507877",
"0.5072822",
"0.5072228",
"0.5051709",
... | 0.72116363 | 0 |
Return the fraction of truth localizations that have a measured localization within X pixels (in the XY plane). truth_i3 A readinsight3.I3Reader object with the ground truth localizations. measured_i3 A readinsight3.I3Reader object with the found localizations. tolerance The search radius in pixels. | def recallFraction(truth_i3, measured_i3, tolerance):
if (measured_i3.getNumberMolecules() == 0):
return [0, truth_i3.getNumberMolecules()]
recalled_locs = 0
total_locs = 0
for i in range(truth_i3.getNumberFrames()):
t_locs = truth_i3.getMoleculesInFrame(i+1)
m_locs = measur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def noiseFraction(truth_i3, measured_i3, tolerance):\n if (measured_i3.getNumberMolecules() == 0):\n return [0, truth_i3.getNumberMolecules()]\n \n noise_locs = 0\n total_locs = 0\n for i in range(truth_i3.getNumberFrames()):\n t_locs = truth_i3.getMoleculesInFrame(i+1)\n m_locs... | [
"0.55394995",
"0.49726897",
"0.49128905",
"0.48943862",
"0.47494882",
"0.46193847",
"0.4540697",
"0.4490073",
"0.44729406",
"0.44689858",
"0.44102895",
"0.44041342",
"0.43853974",
"0.43728712",
"0.43644682",
"0.43106475",
"0.4252977",
"0.42459446",
"0.42421347",
"0.4215356",
... | 0.5636924 | 0 |
adds the given checker to the inputed collumn at the first available row | def add_checker(self, checker, col):
assert(checker == 'X' or checker == 'O')
assert(0 <= col < self.width)
row = self.height -1
while True:
if self.slots[row][col] == ' ':
self.slots[row][col] = checker
break
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_checker (self, checker, row, col):\r\n assert(checker == 'X' or checker == 'O')\r\n assert(row >= 0 and row < self.width)\r\n assert(col >= 0 and col < self.width)\r\n assert(self.grid[row][col] == ' ')\r\n\r\n self.grid[row][col] = checker\r\n self.num_checkers +=... | [
"0.701109",
"0.6312927",
"0.59861284",
"0.5341808",
"0.5267972",
"0.5137286",
"0.5034912",
"0.50330794",
"0.5013285",
"0.49708983",
"0.4922321",
"0.4887951",
"0.48689392",
"0.48425603",
"0.4828871",
"0.48216313",
"0.4800471",
"0.479168",
"0.4762371",
"0.47537065",
"0.47506526... | 0.7188232 | 0 |
takes in a string of column numbers and places alternating checkers in those columns of the called Board object, starting with 'X'. | def add_checkers(self, colunms):
checker = 'X' # start by playing 'X'
for col_str in colunms:
col = int(col_str)
if 0 <= col < self.width:
self.add_checker(checker, col)
# switch to the other checker
if checker == 'X':
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkColumns( self ):\n\n for x in list(range(0,3)):\n firstVal = self.__grid[x]\n secondVal = self.__grid[x+3]\n thirdVal = self.__grid[x+6]\n\n compiledVal = str(firstVal) + str(secondVal) + str(thirdVal)\n\n if 'xx' in compiledVal.lower():\n ... | [
"0.645601",
"0.64072096",
"0.63852787",
"0.6358677",
"0.6355891",
"0.6308092",
"0.6300739",
"0.62406564",
"0.6233944",
"0.61697906",
"0.61486644",
"0.60493004",
"0.59774137",
"0.59426564",
"0.5920311",
"0.5917592",
"0.5906073",
"0.5837072",
"0.5815866",
"0.578438",
"0.5779902... | 0.7216757 | 0 |
removes the top checker from a collumn | def remove_checker(self, col):
for r in range(self.height):
if self.slots[r][col] != ' ':
self.slots[r][col] = ' '
break | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_checker(self, square):\n\n logger.debug(u'remove_checker({})'.format(square))\n\n checker = self.get_checker(square)\n logger.debug(u'remove_checker(): checker={}'.format(checker))\n\n row, column = square\n self.squares[row][column] = None\n\n if checker.color ... | [
"0.6204524",
"0.6063949",
"0.5943303",
"0.57992095",
"0.5774086",
"0.5684145",
"0.56837916",
"0.56601685",
"0.56009245",
"0.55751055",
"0.5534024",
"0.5502348",
"0.5484649",
"0.54815906",
"0.54156744",
"0.5407456",
"0.5395742",
"0.5393944",
"0.5387122",
"0.5384701",
"0.538432... | 0.69292873 | 0 |
Checks for a horizontal win for the specified checker. | def is_horizontal_win(self, checker):
for row in range(self.height):
for col in range(self.width - 3):
# Check if the next four columns in this row
# contain the specified checker.
if self.slots[row][col] == checker and \
self.slots[row... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_horizontal_win(self, checker):\r\n for row in range(self.height):\r\n for col in range(self.width - self.win_condition + 1):\r\n # Analyze every horizontal group of win_condition checkers \r\n # (eg. every horizontal group of 3 checkers if the winning \r\n ... | [
"0.8475751",
"0.75420666",
"0.7541664",
"0.7304467",
"0.7141276",
"0.69144017",
"0.67547977",
"0.65705204",
"0.6443217",
"0.644084",
"0.63808894",
"0.6277144",
"0.61765814",
"0.6124978",
"0.61043036",
"0.5979645",
"0.5958528",
"0.5944859",
"0.5874294",
"0.5866",
"0.5834969",
... | 0.8442273 | 1 |
checks for a vertical win for the specified checker | def is_vertical_win(self, checker):
for row in range(self.height-3):
for col in range(self.width):
if self.slots[row][col] == checker and \
self.slots[row+1][col] == checker and \
self.slots[row+2][col] == checker and \
self.slots[row+3... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_vertical_win(self, checker):\r\n for col in range(self.width):\r\n for row in range(self.height - self.win_condition + 1):\r\n # Analyze every vertical group of win_condition checkers \r\n # (eg. every vertical group of 3 checkers if the winning \r\n ... | [
"0.82297105",
"0.7194167",
"0.70685995",
"0.687523",
"0.67992294",
"0.67986345",
"0.66416425",
"0.6635996",
"0.6503124",
"0.649775",
"0.6443789",
"0.6401017",
"0.63991785",
"0.6316091",
"0.6219272",
"0.61940634",
"0.61931694",
"0.6181501",
"0.6170082",
"0.61471134",
"0.614243... | 0.8199552 | 1 |
checks for a down diagonal win for the specified checker | def is_down_diagonal_win(self, checker):
for row in range(self.height-3):
for col in range(self.width-3):
if self.slots[row][col] == checker and \
self.slots[row+1][col+1] == checker and \
self.slots[row+2][col+2] == checker and \
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_down_diagonal_win(self, checker):\r\n for row in range(self.height - self.win_condition + 1):\r\n for col in range(self.width - self.win_condition + 1):\r\n num_checkers = 0\r\n for i in range(self.win_condition):\r\n if self.grid[row + i][c... | [
"0.85551935",
"0.7764578",
"0.7757468",
"0.6898027",
"0.6763648",
"0.67517036",
"0.6748932",
"0.6608227",
"0.6473795",
"0.6456486",
"0.64543426",
"0.6445009",
"0.6296316",
"0.62957096",
"0.62945104",
"0.627157",
"0.6265318",
"0.625828",
"0.62454444",
"0.6241306",
"0.621789",
... | 0.853235 | 1 |
checks for a up diagonal win for the specified checker | def is_up_diagonal_win(self, checker):
for row in range(3, self.height):
for col in range(self.width-3):
if self.slots[row][col] == checker and \
self.slots[row-1][col+1] == checker and \
self.slots[row-2][col+2] == checker and \
self.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_up_diagonal_win(self, checker):\r\n for row in range(self.height - self.win_condition + 1):\r\n for col in range(self.width - self.win_condition + 1):\r\n num_checkers = 0\r\n for i in range(self.win_condition):\r\n if self.grid[self.height ... | [
"0.8451084",
"0.807679",
"0.7958671",
"0.69099075",
"0.67758054",
"0.6768401",
"0.6691957",
"0.66039085",
"0.65465",
"0.64895284",
"0.64646685",
"0.6425706",
"0.63969225",
"0.6389838",
"0.6361167",
"0.63590616",
"0.63329864",
"0.63180697",
"0.6310362",
"0.63064355",
"0.628510... | 0.83870214 | 1 |
Joint pairs which defines the pairs of joint to be swapped when the image is flipped horizontally. | def joint_pairs(self):
return [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], #17 body keypoints
[20-3, 23-3], [21-3, 24-3], [22-3, 25-3], [26-3, 42-3], [27-3, 41-3], [28-3, 40-3], [29-3, 39-3], [30-3, 38-3],
[31-3, 37-3], [32-3, 36-3], [33-3, 35-3], [43-3, 52-3], [44-3,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def joint_pairs(self):\n return ((1, 4), (2, 5), (3, 6), (14, 11), (15, 12), (16, 13))",
"def get_flip_paris(self):\n # the same names in union and actual\n flip_pair_names = [['rank', 'lank'], ['rkne', 'lkne'], ['rhip', 'lhip'],\n ['rwri', 'lwri'], ['relb', 'lelb'], ['rsho', 'lsh... | [
"0.68822443",
"0.65470254",
"0.6051815",
"0.57137436",
"0.56843126",
"0.5623211",
"0.5614786",
"0.55623996",
"0.55575967",
"0.54953533",
"0.54756796",
"0.54527175",
"0.54323506",
"0.5426223",
"0.54169637",
"0.53801167",
"0.5361496",
"0.53608465",
"0.53471905",
"0.53354126",
"... | 0.66545373 | 1 |
Test standin functions when optional dependencies not installed. | def test_optional_deps_functions():
with pytest.raises(ModuleNotFoundError, match="No module named 'scipy.integrate'"):
quad()
with pytest.raises(ModuleNotFoundError, match="No module named 'scipy.special'"):
ellipkinc()
with pytest.raises(ModuleNotFoundError, match="No module named 'scipy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_defining_only_and_defer_fails(self):",
"def test_require():",
"def test_is_installed():\n assert _is_installed('coverage') is True # regular dependency\n assert _is_installed('pytest') is True # dev dependency\n assert _is_installed('missing') is False # missing dependency",
"def test_em... | [
"0.6981021",
"0.6908298",
"0.6887193",
"0.6791281",
"0.6582555",
"0.65768164",
"0.6528886",
"0.6490111",
"0.6409488",
"0.64059025",
"0.6383104",
"0.63241565",
"0.62897694",
"0.62661767",
"0.6229047",
"0.62274164",
"0.6214505",
"0.6197828",
"0.61898196",
"0.616065",
"0.6125769... | 0.7722589 | 0 |
Test method ``.clone()`` changing a(many) Parameter(s). | def test_clone_change_param(self, cosmo):
super().test_clone_change_param(cosmo)
# don't change any values
kwargs = cosmo._init_arguments.copy()
kwargs.pop("name", None) # make sure not setting name
c = cosmo.clone(**kwargs)
assert c.__class__ == cosmo.__class__
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_clone_change_param(self, cosmo):\n pass",
"def test_clone_change_param(self, cosmo):\n super().test_clone_change_param(cosmo)\n\n # `w` params\n c = cosmo.clone(wp=0.1, wa=0.2, zp=14)\n assert c.wp == 0.1\n assert c.wa == 0.2\n assert c.zp == 14\n ... | [
"0.8125969",
"0.72381425",
"0.7209277",
"0.7200387",
"0.7192322",
"0.7174743",
"0.716787",
"0.71103036",
"0.70194757",
"0.69819623",
"0.67902327",
"0.6767942",
"0.6762643",
"0.6689772",
"0.6676703",
"0.6609183",
"0.65721214",
"0.6493423",
"0.6448174",
"0.6412509",
"0.64088106... | 0.7770919 | 1 |
Test that efunc and inv_efunc give inverse values. Here they just fail b/c no ``w(z)`` or no scipy. | def test_efunc_vs_invefunc(self, cosmo):
exception = NotImplementedError if HAS_SCIPY else ModuleNotFoundError
with pytest.raises(exception):
cosmo.efunc(0.5)
with pytest.raises(exception):
cosmo.inv_efunc(0.5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_efunc_vs_invefunc(self, cosmo):\n # super().test_efunc_vs_invefunc(cosmo) # NOT b/c abstract `w(z)`\n z0 = 0.5\n z = np.array([0.5, 1.0, 2.0, 5.0])\n\n assert np.allclose(cosmo.efunc(z0), 1.0 / cosmo.inv_efunc(z0))\n assert np.allclose(cosmo.efunc(z), 1.0 / cosmo.inv_ef... | [
"0.7890261",
"0.7080308",
"0.6889527",
"0.6646146",
"0.6566635",
"0.6435949",
"0.6311177",
"0.6235184",
"0.61690646",
"0.61581445",
"0.61157507",
"0.6061637",
"0.60344326",
"0.5980069",
"0.59242916",
"0.58938485",
"0.58800644",
"0.5846071",
"0.5811623",
"0.5717176",
"0.571470... | 0.71144277 | 1 |
Test that ``efunc`` and ``inv_efunc`` give inverse values. Note that the test doesn't need scipy because it doesn't need to call ``de_density_scale``. | def test_efunc_vs_invefunc(self, cosmo):
# super().test_efunc_vs_invefunc(cosmo) # NOT b/c abstract `w(z)`
z0 = 0.5
z = np.array([0.5, 1.0, 2.0, 5.0])
assert np.allclose(cosmo.efunc(z0), 1.0 / cosmo.inv_efunc(z0))
assert np.allclose(cosmo.efunc(z), 1.0 / cosmo.inv_efunc(z)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_functional_inverse(self, dim):\n M = np.random.rand(dim, dim)\n assert np.all(M == symplectic.xxpp_to_xpxp(symplectic.xpxp_to_xxpp(M)))\n assert np.all(M == symplectic.xpxp_to_xxpp(symplectic.xxpp_to_xpxp(M)))\n\n v = np.random.rand(dim)\n assert np.all(v == symplectic.x... | [
"0.66463166",
"0.6500714",
"0.64839894",
"0.63668597",
"0.6349195",
"0.63291985",
"0.6208798",
"0.6199499",
"0.6169278",
"0.6076301",
"0.60553354",
"0.6033999",
"0.5983441",
"0.5863279",
"0.5856949",
"0.5811135",
"0.5805494",
"0.57997894",
"0.57126814",
"0.5700566",
"0.568843... | 0.72528183 | 0 |
Initialize the list widget with frames, ordered as selected (by rank or chronological). Set the colors of each item according to its current inclusion / exclusion state. | def fill_list_widget(self):
# Initialize the inclusion / exclusion state of frames in the frame list.
self.listWidget.clear()
for i in range(self.frames.number_original):
if self.frame_ordering == "quality":
frame_number = self.quality_sorted_indices[i]
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, parent_gui, configuration, frames, rank_frames, stacked_image_log_file,\n signal_finished):\n\n super(FrameSelectorWidget, self).__init__(parent_gui)\n self.setupUi(self)\n\n # Keep references to upper level objects.\n self.parent_gui = parent_gui\n ... | [
"0.6630403",
"0.6483833",
"0.6057721",
"0.5943925",
"0.58269835",
"0.57062906",
"0.5705208",
"0.56819993",
"0.5659318",
"0.5651651",
"0.5650738",
"0.5612487",
"0.56008047",
"0.55448633",
"0.5529478",
"0.5521577",
"0.5509715",
"0.5502198",
"0.5449513",
"0.54010904",
"0.5381477... | 0.76915705 | 0 |
If a list item or a range of items is selected, store the items and corresponding indices. Synchronize the frame slider and frame viewer with the the current list position. | def select_items(self):
self.listWidget.currentItem().setSelected(True)
self.items_selected = self.listWidget.selectedItems()
if self.frame_ordering == "quality":
self.indices_selected = [self.quality_sorted_indices[self.listWidget.row(item)] for item
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_list_view(self):\n # Clear the list/tree view.\n self.list_view.clear()\n\n # Find all the selected things in Maya.\n selected = cmds.ls(selection=True)\n\n # For each of the selected things, create a widget item.\n for thing in selected:\n item = QtG... | [
"0.6517475",
"0.63286334",
"0.61527413",
"0.6122694",
"0.6122694",
"0.60176677",
"0.60037297",
"0.59304726",
"0.5848764",
"0.5721963",
"0.56616825",
"0.5614458",
"0.5600244",
"0.5535597",
"0.55272675",
"0.5493485",
"0.54869366",
"0.54790074",
"0.54730886",
"0.5458102",
"0.545... | 0.7628076 | 0 |
Set the frame slider to the value currently selected in the listWidget. Update the photo displayed in the viewer. | def synchronize_slider(self):
# Block slider signals to avoid a shortcut.
self.slider_frames.blockSignals(True)
if self.frame_ordering == "quality":
self.quality_index = self.listWidget.currentRow()
self.frame_index = self.quality_sorted_indices[self.quality_index]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slider_frames_changed(self):\n\n # Again, please note the difference between indexing and GUI displays.\n index = self.slider_frames.value() - 1\n\n # Differentiate between frame ordering (by quality or chronologically).\n if self.frame_ordering == \"quality\":\n self.fra... | [
"0.72701055",
"0.65237004",
"0.6417526",
"0.6236954",
"0.6131823",
"0.6086754",
"0.60802937",
"0.592214",
"0.58400404",
"0.58363193",
"0.5808125",
"0.5762982",
"0.57409304",
"0.57107794",
"0.5682651",
"0.56776845",
"0.5677224",
"0.56740886",
"0.5672128",
"0.56516427",
"0.5628... | 0.69378626 | 1 |
This eventFilter is listening for events on the listWidget. List items can be marked as included / excluded by either using a context menu, by pressing the "+" or "" buttons, or by pressing the keyboard keys "+" or "". | def eventFilter(self, source, event):
if source is self.listWidget:
# Open a context menu with two choices. Depending on the user's choice, either
# trigger the "use_triggered" or "not_use_triggered" method below.
if event.type() == QtCore.QEvent.ContextMenu:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eventFilter(self, qobject, event):\n return False",
"def eventFilter(self, edit, event):\n if event.type() == QEvent.KeyPress:\n return bool(self._filter_keyPressEvent(event))\n elif event.type() == QEvent.MouseButtonPress:\n return bool(self._filter_mousePressEvent... | [
"0.6614795",
"0.6175755",
"0.6153679",
"0.613961",
"0.5931225",
"0.57709044",
"0.5766732",
"0.56649834",
"0.5656981",
"0.55341333",
"0.5429198",
"0.53743684",
"0.5363388",
"0.53528816",
"0.53475535",
"0.534388",
"0.53289413",
"0.52719826",
"0.52691936",
"0.5239659",
"0.523931... | 0.72124714 | 0 |
The user has selected a list item or a range of items to be included in the stacking workflow. Change the appearance of the list entry, update the "index_included" values for the corresponding frames, and reload the image of the current index. The latter step is important to update the overlay mark in the upper left im... | def use_triggered(self):
self.select_items()
if self.items_selected:
for index, item in enumerate(self.items_selected):
index_selected = self.indices_selected[index]
frame_selected = index_selected + 1
item.setText("Frame %i included" % frame_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slider_frames_changed(self):\n\n # Again, please note the difference between indexing and GUI displays.\n index = self.slider_frames.value() - 1\n\n # Differentiate between frame ordering (by quality or chronologically).\n if self.frame_ordering == \"quality\":\n self.fra... | [
"0.5824378",
"0.57666624",
"0.56093246",
"0.5254578",
"0.5233445",
"0.519611",
"0.5181915",
"0.51439756",
"0.51321197",
"0.5125083",
"0.5113142",
"0.5053346",
"0.5053346",
"0.503507",
"0.5024666",
"0.4995334",
"0.4989617",
"0.4979572",
"0.4949013",
"0.49473757",
"0.49178648",... | 0.6638902 | 0 |
The frames slider is changed by the user. Update the frame in the viewer and scroll the frame list to show the current frame index. | def slider_frames_changed(self):
# Again, please note the difference between indexing and GUI displays.
index = self.slider_frames.value() - 1
# Differentiate between frame ordering (by quality or chronologically).
if self.frame_ordering == "quality":
self.frame_index = sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def synchronize_slider(self):\n\n # Block slider signals to avoid a shortcut.\n self.slider_frames.blockSignals(True)\n\n if self.frame_ordering == \"quality\":\n self.quality_index = self.listWidget.currentRow()\n self.frame_index = self.quality_sorted_indices[self.quali... | [
"0.6824271",
"0.6740895",
"0.63300794",
"0.62711793",
"0.6066415",
"0.606354",
"0.60312027",
"0.6014083",
"0.5989991",
"0.5945634",
"0.5935722",
"0.5935722",
"0.59174144",
"0.5910007",
"0.5835481",
"0.5811807",
"0.5765911",
"0.5761225",
"0.57441515",
"0.57351494",
"0.5717456"... | 0.83098435 | 0 |
When the frame player is running, it periodically checks this variable. If it is set to False, the player stops. | def pushbutton_stop_clicked(self):
if self.frame_player.run_player:
self.frame_player.run_player = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shooting(self):\r\n return not self.stopped",
"def __bool__(self):\n return not self._stopped",
"def stop_running(self):\n self.running = False",
"def have_i_lost(self):\n if self.life_points <= 0:\n self.running = False",
"def pauseCheck(self):\n while (se... | [
"0.69098455",
"0.6495498",
"0.6430902",
"0.64104456",
"0.6408235",
"0.64047945",
"0.6397965",
"0.63936555",
"0.63936555",
"0.63646036",
"0.6350674",
"0.6294373",
"0.6265726",
"0.62640435",
"0.62640435",
"0.62640435",
"0.62640435",
"0.62640435",
"0.62640375",
"0.62505734",
"0.... | 0.67456377 | 1 |
On exit from the frame viewer, update the selection status of all frames and send a completion signal. | def done(self):
# Check if the status of frames has changed.
indices_included = []
indices_excluded = []
for index in range(self.frames.number_original):
if self.index_included[index] and not self.frames.index_included[index]:
indices_included.append(index)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hook_frame_unselected(self):",
"def ExitAllFrames():\r\n pass",
"def endExperiment(self):\n if __debug__:\n log.debug('Attempting to update execution buttons: end.')\n for frame in self.frames:\n frame.notifyStatus('none-running')",
"def hook_frame_selected(self... | [
"0.6717194",
"0.6424416",
"0.63058114",
"0.6151629",
"0.59620136",
"0.5956939",
"0.5838827",
"0.58281744",
"0.57945913",
"0.5671687",
"0.5658958",
"0.5656099",
"0.5617771",
"0.5562765",
"0.55529684",
"0.5552913",
"0.55136687",
"0.5489545",
"0.54518265",
"0.54506075",
"0.54394... | 0.65856093 | 1 |
This function sets the 5 frequencies of nuclei at the instance's magnetic field, | def set_freq_relaxation(self):
self.num_omega=5
self.omega=np.zeros(self.num_omega)
iOmH = 3 ; # indexing for the frequencies.
iOmX = 1 ; #
# First determine the frequencies omega and J from given inputs.
self.omega[iOmH] = -1.0*self.gH.gamma*self.B_0*self.time_fact
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _configure_frequencies(self) -> None:\n i = 3\n while i < len(self._lora_frequencies):\n self.set_ch_parameters(i, self._lora_frequencies[i], 0, 5, True)\n i += 1\n self.set_ch_parameters(i, 868800000, 7, 7, True)",
"def set_frequency(self, f=1e9):\r\n _debug... | [
"0.62399256",
"0.60756135",
"0.6022752",
"0.595749",
"0.59194195",
"0.59194195",
"0.58938724",
"0.5843758",
"0.56905913",
"0.5676409",
"0.56343997",
"0.5608071",
"0.56036687",
"0.5583101",
"0.5560843",
"0.55163354",
"0.5490149",
"0.546278",
"0.543363",
"0.5425998",
"0.5415682... | 0.62357897 | 1 |
Taking Eq. 4 of Ghose, Fushman and Cowburn (2001), calculate rho from R1, R2, and NOE directly, rather than from the spectral density J(omega). This is used to convert experimental measurements to rho. rvec is the triple of (R1, R2, NOE) Error is known to be bad. | def calculate_rho_from_relaxation(self, rvec, drvec=[] ):
if drvec==[]:
R1=rvec[0] ; R2=rvec[1] ; NOE=rvec[2]
HF = -0.2*(self.gX.gamma/self.gH.gamma)*(1-NOE)*R1
R1p = R1 - 7.0*(0.921/0.87)**2.0*HF
R2p = R2 - 6.5*(0.955/0.87)**2.0*HF
return 4.0/3.0*R1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_rho_from_relaxation(gamma_H, gamma_N, R1, R2, NOE):\n HF = -0.2*(gamma_N/gamma_H)*(1-NOE)*R1\n R1p = R1 - 7.0*(0.921/0.87)**2.0*HF\n R2p = R2 - 6.5*(0.955/0.87)**2.0*HF\n\n return 4.0/3.0*R1p/(2.0*R2p-R1p)",
"def rho(x,y):\n return np.sqrt(x**2+y**2)",
"def mass_radius_relation__(... | [
"0.6813476",
"0.6241262",
"0.61841756",
"0.61622566",
"0.60892856",
"0.60372007",
"0.58410823",
"0.58299387",
"0.576509",
"0.5764118",
"0.57385874",
"0.5646643",
"0.5596641",
"0.5595435",
"0.55114925",
"0.5502694",
"0.5461825",
"0.54543835",
"0.5444955",
"0.5428953",
"0.54274... | 0.8024778 | 0 |
Computes the 5 fullanisotropic Dcoefficients associated with the D_rot ellipsoid. Also returns 'delta' required for the corresponding A_coefficient computation, if required. | def D_coefficients_ellipsoid(D, bDoDelta=False):
Diso= ( D[0] + D[1] + D[2] )/3.0
D2 = ( D[0]*D[1] + D[0]*D[2] + D[1]*D[2] )/3.0
fact1= sqrt(Diso**2 - D2**2)
D_J=np.zeros(5)
D_J[0]= 4*D[0] + D[1] + D[2]
D_J[1]= D[0] + 4*D[1] + D[2]
D_J[2]= D[0] + D[1] + 4*D[2]
D_J[3]= 6*Diso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Drep(self):\n sinE = np.sin(self.E())\n cosE = np.cos(self.E())\n return -self.alpha()*sinE+(self.beta()+self.GAMMA)*cosE",
"def A_coefficients_ellipsoid(v, DD, bDDisDelta=False):\n #v can be given as an array with X/Y/Z cartesian dimensions being the last.\n #\"\"\"\n if bDDisD... | [
"0.61321187",
"0.59146684",
"0.5878253",
"0.5745102",
"0.5726916",
"0.565671",
"0.56180733",
"0.5583207",
"0.55740184",
"0.55553406",
"0.55213094",
"0.5516989",
"0.5470312",
"0.5464892",
"0.5463423",
"0.545799",
"0.5435152",
"0.54258174",
"0.53702444",
"0.53350055",
"0.532164... | 0.68221754 | 0 |
Computes the 5 sullanisotropic Acoefficients associated with orientation of the vector w.r.t. to the D_rot ellipsoid. DD is given either as the DRot elements or its 'delta' transformation for direct use. | def A_coefficients_ellipsoid(v, DD, bDDisDelta=False):
#v can be given as an array with X/Y/Z cartesian dimensions being the last.
#"""
if bDDisDelta:
delta=DD
else:
delta=Ddelta_ellipsoid(dd)
#v=_sanitise_v(v)
#v2=np.square(v)
#v4=np.square(v2)
#fact2=np.multiply(0.75,np... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def D_coefficients_ellipsoid(D, bDoDelta=False):\n Diso= ( D[0] + D[1] + D[2] )/3.0\n D2 = ( D[0]*D[1] + D[0]*D[2] + D[1]*D[2] )/3.0\n fact1= sqrt(Diso**2 - D2**2)\n D_J=np.zeros(5)\n D_J[0]= 4*D[0] + D[1] + D[2]\n D_J[1]= D[0] + 4*D[1] + D[2]\n D_J[2]= D[0] + D[1] + 4*D[2]\n D... | [
"0.6027063",
"0.57143575",
"0.5345302",
"0.5345302",
"0.5345226",
"0.5230334",
"0.5228498",
"0.5221577",
"0.5220205",
"0.52117825",
"0.5196648",
"0.51822114",
"0.5173828",
"0.51726335",
"0.5159354",
"0.51265126",
"0.5126051",
"0.5105326",
"0.5102546",
"0.5081157",
"0.5080835"... | 0.60273725 | 0 |
Lowest level operation. J = Sum_i components for each om. Return dimensions (N_om) for one vector A_j, and (N_Aj,N_om) otherwise. | def _do_Jsum(om, A_J, D_J):
Dmat=npufunc.Jomega.outer(D_J,om)
return np.einsum('...j,jk',A_J,Dmat) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dimension_reduction(X, k=10):\n cov = cov_generation(X)\n eig, eigv, _, _ = jacobi_loop(cov)\n sort_args = np.argsort(np.abs(eig))[::-1]\n projection_matrix = eigv[sort_args][:, :k]\n reduce_x = np.dot(X, projection_matrix)\n \n return projection_matrix, reduce_x",
"def M(self,i,j):\n ... | [
"0.5710219",
"0.5608693",
"0.557427",
"0.5543832",
"0.54027766",
"0.53835285",
"0.5311174",
"0.529464",
"0.52919006",
"0.52903855",
"0.52794844",
"0.5279337",
"0.5273943",
"0.52678376",
"0.52537984",
"0.5243717",
"0.52368623",
"0.52353984",
"0.5221249",
"0.5208128",
"0.519450... | 0.61300105 | 0 |
This calculats the J value for combining an isotropic global tumbling with a fitted internal autocorrelation C(t), where C(t) = S2 + Sum{ consts[i] exp ( t/tau[i] } thus this allows fits to multiple time constants in C(t). | def J_combine_isotropic_exp_decayN(om, tau_iso, S2, consts, taus):
k = (1.0/tau_iso)+(1.0/np.array(taus))
ndecay=len(consts) ; noms =len(om)
Jmat = np.zeros( (ndecay+1, noms ) )
Jmat[0]= S2*tau_iso/(1.+(om*tau_iso)**2.)
for i in range(ndecay):
Jmat[i+1] = consts[i]*k[i] /(k[i]**2.+om**2.)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_ion_J(self):\n \n if np.isnan(self.gr):\n return\n\n self.__calc_CoagS() # s-1\n \n dp1 = self.dp_lim[0]*1e-9 # meters\n dp2 = self.dp_lim[1]*1e-9 # meters\n \n # Time axis is the same for every data\n time = self.ion1_time*1.157e5 ... | [
"0.641588",
"0.63016844",
"0.613705",
"0.611856",
"0.6027436",
"0.6020212",
"0.59792376",
"0.5969957",
"0.5911631",
"0.58839965",
"0.5852644",
"0.58484495",
"0.5810889",
"0.5802088",
"0.5775718",
"0.5775204",
"0.5774849",
"0.5774416",
"0.57395285",
"0.57323253",
"0.5725825",
... | 0.65795314 | 0 |
Taking Eq. 4 of Ghose, Fushman and Cowburn (2001), calculate rho from R1, R2, and NOE directly, rather than from the spectral density J(omega). THis is used to convert experimental measurements to rho. | def calculate_rho_from_relaxation(gamma_H, gamma_N, R1, R2, NOE):
HF = -0.2*(gamma_N/gamma_H)*(1-NOE)*R1
R1p = R1 - 7.0*(0.921/0.87)**2.0*HF
R2p = R2 - 6.5*(0.955/0.87)**2.0*HF
return 4.0/3.0*R1p/(2.0*R2p-R1p) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rho(x,y):\n return np.sqrt(x**2+y**2)",
"def parse_rho(m1, m2, config):\n f = open(in_name(m1, m2, config), 'r')\n \n # Skip to the mixed rho correlator section.\n # This assumes it is the first RHO* entry. !!\n x = f.readline()\n while x:\n if re.match('correlator:\\s+RHO', x):\n... | [
"0.68708086",
"0.6852992",
"0.67497236",
"0.6615914",
"0.65912217",
"0.65757865",
"0.64970076",
"0.64397234",
"0.64192426",
"0.64161104",
"0.6386884",
"0.6338961",
"0.62951666",
"0.6258891",
"0.62081283",
"0.6120734",
"0.6109946",
"0.6100421",
"0.6099531",
"0.6073087",
"0.602... | 0.80711687 | 0 |
find y(xi) by splitting x in half repeatedly until the x is found. | def interpolate_point(xi, x, y):
num_pts = len(x)
if num_pts%2==0:
#Even
i_h2 = num_pts/2
i_h1 = num_pts/2 - 1
if x[i_h2] < xi:
return interpolate_point(xi, x[i_h2:], y[0:i_h2:])
elif x[i_h1] > xi:
return interpolate_point(xi, x[0:i_h1], y[0:i_h1])... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_best_split(self, x, y):\n\n # check cornor case: all same x\n n = y.size\n\n if all(x == x[0]):\n return (0, amin(x) - self.eps)\n\n sort_index = argsort(x)\n x_sorted = x[sort_index]\n y_sorted = y[sort_index]\n\n # build potential split index a... | [
"0.61319524",
"0.60320896",
"0.60287595",
"0.5929179",
"0.589848",
"0.58922136",
"0.5848711",
"0.57793593",
"0.57323915",
"0.567752",
"0.56736445",
"0.56143486",
"0.5607043",
"0.55825126",
"0.5581373",
"0.5577562",
"0.55704385",
"0.55609626",
"0.5530971",
"0.5527044",
"0.5510... | 0.60998356 | 1 |
Given a position within the source text, move the position past the skippable stuff (whitespace and comments). | def process_skippable(self, pos):
newlines = []
done = False
while not done:
# Strip any leading whitespace
ws = self.whitespace_match.match(self.src, pos=pos)
if ws:
# The span of a match from regex is (startidx, after_idx), so our new positio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip(self):\n input = self.source\n startLine = self.line\n\n # Whether this is the first called as happen on start parsing a file (eat leading comments/white space)\n startOfFile = self.cursor is 0\n \n indent = \"\"\n \n while (True):\n if le... | [
"0.5965501",
"0.58361757",
"0.5736452",
"0.5723455",
"0.5681045",
"0.5670457",
"0.5604237",
"0.5506461",
"0.54953766",
"0.5471466",
"0.5447499",
"0.54395866",
"0.5433639",
"0.5351415",
"0.5320247",
"0.5318359",
"0.5314718",
"0.5290182",
"0.5273834",
"0.5247407",
"0.5231391",
... | 0.6873459 | 0 |
Given a position within the source text, and the lexical goal, this returns the next token. | def token(self, pos: int, goal: "LexerCore.Goal" = InputElementRegExp) -> Optional[Token]:
newlines = []
while 1:
pos, nls = self.process_skippable(pos)
newlines.extend(nls)
# Check for common tokens (IdentifierName, Punctuator, NumericLiteral, StringLiteral, Templat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_token(self):\n\t\t\n\t\tif self.pos > len(self.text)-1:\n\t\t\treturn Token(EOF, None)\n\t\t\t\n\t\tcurrent_char = self.text[self.pos]\n\t\t\n\t\tif current_char.isdigit() or current_char.isalpha():",
"def get_next_token(self):\n while self.current_char is not None:\n if self.current_char.is... | [
"0.7023609",
"0.66966116",
"0.6659978",
"0.6625183",
"0.64954317",
"0.64628935",
"0.6395311",
"0.639026",
"0.63893944",
"0.6372422",
"0.6344388",
"0.6293111",
"0.62931097",
"0.62825733",
"0.6231358",
"0.6224479",
"0.62024003",
"0.61900914",
"0.6161045",
"0.6149184",
"0.613918... | 0.68984026 | 1 |
Reset the Character object. | def _reset(self):
self.characterID = None
self.myName = u'' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self.EOF = False\n self.current_position = -1\n self.current_char = \"\"\n self._next_char()",
"def reset(self):\n self._keyCode = \"\"\n self._keyCodeCount = 0\n self._keyCodeTime = 0.0",
"def reset(self):\n self._stat = CardMeta()",
... | [
"0.7129643",
"0.6941273",
"0.6652144",
"0.6642882",
"0.6642733",
"0.6536966",
"0.6529067",
"0.64776677",
"0.64664334",
"0.6459223",
"0.64419657",
"0.64219844",
"0.6399832",
"0.6326062",
"0.63081366",
"0.6306918",
"0.6294044",
"0.6292267",
"0.628733",
"0.6266475",
"0.62326366"... | 0.7493668 | 0 |
The Character is "false" if the self.data does not contain a name. | def __nonzero__(self):
# XXX: check the name and the characterID?
if self.data.get('name'): return 1
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_name(self):\n return self.unpack_word(0x2) != 0",
"def has_ascii_name(self):\n return self.unpack_word(0x10) & 1 == 1",
"def is_named(self):\n return self._name != \"\"",
"def has_name_data(self):\n\n matches = set(self.broader_tags()) & LANGUAGES_WITH_NAME_DATA\n r... | [
"0.68924284",
"0.6734916",
"0.6635937",
"0.65906084",
"0.64795727",
"0.643622",
"0.63792413",
"0.6378379",
"0.636715",
"0.63221276",
"0.6321745",
"0.62450135",
"0.6176524",
"0.61372274",
"0.61087155",
"0.60998607",
"0.6054378",
"0.60481435",
"0.59773386",
"0.59672993",
"0.592... | 0.7693617 | 0 |
Return true if two character have the same name and/or characterID. | def isSameName(self, other):
if not isinstance(other, self.__class__):
return 0
if self.data.has_key('name') and \
other.data.has_key('name') and \
build_name(self.data, canonical=0) == \
build_name(other.data, canonical=0):
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def same_player(self, other):\n return self.name == other.name \\\n and self.color == other.color",
"def __nonzero__(self):\n # XXX: check the name and the characterID?\n if self.data.get('name'): return 1\n return 0",
"def map_chars_one_to_one(text_1: str, text_2: str) -... | [
"0.6348416",
"0.6182375",
"0.59606755",
"0.59465003",
"0.5883518",
"0.5875053",
"0.5841419",
"0.5834784",
"0.5820533",
"0.58115435",
"0.5804585",
"0.5781953",
"0.5764276",
"0.5754819",
"0.5740753",
"0.57344013",
"0.57318974",
"0.5731404",
"0.5708305",
"0.56895524",
"0.5685953... | 0.7092753 | 0 |
Return a deep copy of a Character instance. | def __deepcopy__(self, memo):
c = Character(name=u'', characterID=self.characterID,
myName=self.myName, myID=self.myID,
data=deepcopy(self.data, memo),
notes=self.notes, accessSystem=self.accessSystem,
titlesRefs=deepcopy(self.title... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self) -> 'Rune':\n return self.__copy__()",
"def copy(self) -> 'Rune':\n return self.__copy__()",
"def copy(self) -> 'Cell':\n new = Cell(self.letter)\n new.player = self.player\n return new",
"def copy(self):\n return LetterBag(self.string())",
"def copy(... | [
"0.70646316",
"0.70646316",
"0.6972674",
"0.64444566",
"0.63464975",
"0.6324347",
"0.6317154",
"0.62851924",
"0.6243672",
"0.62268496",
"0.6195071",
"0.6195071",
"0.6195071",
"0.6195071",
"0.6191595",
"0.6176384",
"0.6176384",
"0.6176384",
"0.6176384",
"0.6176384",
"0.6176384... | 0.741937 | 0 |
Return a string with a prettyprinted summary for the character. | def summary(self):
if not self: return u''
s = u'Character\n=====\nName: %s\n' % \
self.get('name', u'')
bio = self.get('biography')
if bio:
s += u'Biography: %s\n' % bio[0]
filmo = self.get('filmography')
if filmo:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def card_format(card):\n pretty_output = '%s pts: %d powers: %s' % (\n card['name'],\n card['points'],\n ', '.join(card['powers'])\n )\n pretty_output += ' desc: %s' % card['description']\n return pretty_output",
"def summary_string(self) -> str:",
"def pretty_print(self):\n ... | [
"0.68844765",
"0.6829726",
"0.67719597",
"0.65829027",
"0.64302903",
"0.64010054",
"0.6389372",
"0.6342128",
"0.6337281",
"0.63023543",
"0.62737685",
"0.6273045",
"0.6159241",
"0.6136479",
"0.61172915",
"0.60744596",
"0.60701406",
"0.60353655",
"0.60302764",
"0.60201794",
"0.... | 0.72295326 | 0 |
Compute log(\sum_i exp(Z_i)) for some array Z. | def log_sum_exp(Z):
return np.max(Z) + np.log(np.sum(np.exp(Z - np.max(Z)))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logistic_function(z):\n\tg = 1/(1+np.exp(-z))\n\t#g = np.exp(z)/(1+np.exp(z))\n\treturn g",
"def log_sum_exp(x):\n # TF ordering\n axis = len(x.shape) - 1\n m = paddle.max(x, axis=axis)\n m2 = paddle.max(x, axis=axis, keepdim=True)\n return m + paddle.log(paddle.sum(paddle.exp(x - m2), axis=ax... | [
"0.72955406",
"0.70000017",
"0.69763386",
"0.6947724",
"0.6854341",
"0.6854341",
"0.68434733",
"0.6835322",
"0.6835322",
"0.68340427",
"0.68242425",
"0.67890185",
"0.678535",
"0.67170584",
"0.67069113",
"0.6685326",
"0.6638205",
"0.6539537",
"0.6538283",
"0.653539",
"0.648778... | 0.853284 | 0 |
Get local output level. This method returns either the local logger level set when calling initialize, or if that was not set then the logger level set in the Initializer configuration. | def get_output_level(self):
outlvl = self._local_logger_level
if outlvl is None:
outlvl = self.config.output_level
return outlvl | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_logging_level(self):\n return self.logging_level",
"def log_level(self) -> LogLevel:\n if self.is_quiet:\n return LogLevel.NONE\n return LogLevel(self.logger.getEffectiveLevel())",
"def getLogLevel() -> Optional[int]:\n\n if not logger.disabled:\n return logger... | [
"0.68613553",
"0.6751319",
"0.67467946",
"0.6674586",
"0.66413873",
"0.64126235",
"0.63684386",
"0.6364565",
"0.6358256",
"0.6274128",
"0.620987",
"0.6177266",
"0.60777044",
"0.6032914",
"0.6021324",
"0.60062045",
"0.5992274",
"0.5992274",
"0.5970048",
"0.5932795",
"0.5932795... | 0.8477695 | 0 |
Get logger for model by name | def get_logger(self, model):
return idaeslog.getInitLogger(model.name, self.get_output_level()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_logger(self, name):\n if not isinstance(name, six.string_types):\n name = \"{}.{}\".format(name.__class__.__module__, name.__class__.__name__)\n\n return self.logger_store.setdefault(name, Logger(name=name,\n threshold=Logger.... | [
"0.6952764",
"0.69304234",
"0.68946254",
"0.6881045",
"0.6794648",
"0.6742655",
"0.66486526",
"0.6626241",
"0.66104627",
"0.65845174",
"0.6569233",
"0.65558904",
"0.65271574",
"0.6481553",
"0.64617985",
"0.6425426",
"0.6407206",
"0.6355982",
"0.63219905",
"0.6281164",
"0.6253... | 0.7379882 | 0 |
Load initial guesses for variables into model. | def load_initial_guesses(
self,
model: Block,
initial_guesses: dict = None,
json_file: str = None,
exception_on_fixed: bool = True,
):
if initial_guesses is not None and json_file is not None:
self._update_summary(model, "status", InitializationStatus.Erro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_values_from_dict(self, model, initial_guesses, exception_on_fixed=True):\n for c, v in initial_guesses.items():\n component = model.find_component(c)\n\n if component is None:\n raise ValueError(f\"Could not find a component with name {c}.\")\n elif ... | [
"0.6671641",
"0.61924034",
"0.5992019",
"0.5985517",
"0.59494156",
"0.58406943",
"0.5836965",
"0.5778865",
"0.57338053",
"0.5673871",
"0.5663914",
"0.5649715",
"0.56127286",
"0.5589895",
"0.55575335",
"0.5555286",
"0.55508673",
"0.5525157",
"0.55086994",
"0.5499414",
"0.54987... | 0.65234804 | 1 |
Call to model.fix_initialization_states method. Method will pass if fix_initialization_states not found. | def fix_initialization_states(self, model: Block):
try:
model.fix_initialization_states()
except AttributeError:
_log.info_high(
f"Model {model.name} does not have a fix_initialization_states method - attempting to continue."
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_state(self):\n raise NotImplementedError()",
"def make_initial_state(self):\n pass",
"def update_init_roberta_model_state(state):\n for k in list(state.keys()):\n if \".lm_head.\" in k or \"version\" in k:\n del state[k]\n continue\n # remove 'enc... | [
"0.60903317",
"0.6048628",
"0.6010022",
"0.59616935",
"0.5958297",
"0.588881",
"0.58776253",
"0.5783208",
"0.5778024",
"0.5760076",
"0.5727407",
"0.57107013",
"0.5688813",
"0.56834584",
"0.56704235",
"0.5650357",
"0.56231874",
"0.56120837",
"0.55744636",
"0.55637395",
"0.5562... | 0.8445122 | 0 |
Check for satisfied degrees of freedom before running initialization. | def precheck(self, model: Block):
dof = degrees_of_freedom(model)
self._update_summary(model, "DoF", dof)
if not dof == 0:
self._update_summary(model, "status", InitializationStatus.DoF)
raise InitializationError(
f"Degrees of freedom for {model.name} were... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_initialized(self):\n check_is_fitted(self, 'estimators_')",
"def _check_if_fitted(self):\n if self.covar_module is None:\n raise RuntimeError(\n \"Model has not been fitted. You need to call \"\n \"`fit_fully_bayesian_model_nuts` to fit the model.... | [
"0.65600634",
"0.6085064",
"0.5951477",
"0.58697414",
"0.58098865",
"0.58022845",
"0.57933855",
"0.57644194",
"0.5752037",
"0.5752037",
"0.57224774",
"0.5704171",
"0.5688848",
"0.5670319",
"0.5663479",
"0.5662074",
"0.5658692",
"0.56577915",
"0.5655149",
"0.56197435",
"0.5610... | 0.7627506 | 0 |
Restore model state to that stored in self.initial_state. | def restore_model_state(self, model: Block):
if model in self.initial_state:
from_json(model, sd=self.initial_state[model], wts=StoreState)
else:
self._update_summary(model, "status", InitializationStatus.Error)
raise ValueError("No initial state stored.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_states(self):\n self.model.reset_states()",
"def reset(self):\n self.set_state(self._initial_state)",
"def reset(self):\n self._current_state = self._initial_state\n return self._current_state",
"def restore_state(self, state):\n state_ref = self.ale.decodeState(s... | [
"0.7463039",
"0.73698086",
"0.7294601",
"0.71570307",
"0.7149184",
"0.7149184",
"0.7149184",
"0.703696",
"0.69934034",
"0.6952096",
"0.6935206",
"0.6890805",
"0.68177515",
"0.680695",
"0.6728974",
"0.6728974",
"0.6728974",
"0.6728974",
"0.6728974",
"0.6728974",
"0.6728974",
... | 0.77374345 | 0 |
Check the model has been converged after initialization. If a results_obj is provided, this will be checked using check_optimal_termination, otherwise this will walk all constraints in the model and check that they are within tolerance (set via the Initializer constraint_tolerance config argument). | def postcheck(
self, model: Block, results_obj: dict = None, exclude_unused_vars: bool = False
):
if results_obj is not None:
self._update_summary(
model, "solver_status", check_optimal_termination(results_obj)
)
if not self.summary[model]["solver... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_termination(self):\r\n \r\n # First check if we are doing termination based on running time\r\n if (self.options.time_limit):\r\n self.time = time.clock - self.time_start\r\n if (self.time >= self.options.maxtime):\r\n self.term_reason = 'Exceeded... | [
"0.64677495",
"0.60787463",
"0.6001517",
"0.5968454",
"0.5924611",
"0.5815148",
"0.5712931",
"0.5706732",
"0.56934834",
"0.5683677",
"0.5659341",
"0.5563105",
"0.5530446",
"0.5530446",
"0.5530446",
"0.54894197",
"0.54824215",
"0.54554915",
"0.5454288",
"0.54298395",
"0.541383... | 0.7315091 | 0 |
Initialize plugin model. This activates the Block and then calls self.initialize(plugin). Derived Initializers should overload this as required. | def plugin_initialize(
self, plugin: Block, initial_guesses: dict = None, json_file: str = None
):
plugin.activate()
return self.initialize(
plugin, initial_guesses=initial_guesses, json_file=json_file
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialization_routine(\n self, model: Block, plugin_initializer_args: dict = None, **kwargs\n ):\n if plugin_initializer_args is None:\n plugin_initializer_args = {}\n\n # Get logger\n _log = self.get_logger(model)\n\n # Prepare plug-ins for initialization\n ... | [
"0.6874891",
"0.6682307",
"0.5883919",
"0.5877841",
"0.58740544",
"0.5835134",
"0.5765257",
"0.5687902",
"0.5669311",
"0.5596282",
"0.557334",
"0.5551101",
"0.5511413",
"0.55072176",
"0.5499874",
"0.5482202",
"0.54780114",
"0.5472675",
"0.5472218",
"0.5449242",
"0.5438165",
... | 0.72037184 | 0 |
Final clean up of plugins after initialization. This method does nothing. Derived Initializers should overload this as required. | def plugin_finalize(self, plugin): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finalize(self):\n self.__doing('finalize')\n self.__do_if_not_done('load_plugins')\n\n if self.env.env_confdir is not None:\n if self.env.env_confdir == self.env.confdir:\n logger.info(\n \"IPA_CONFDIR env sets confdir to '%s'.\", self.env.confd... | [
"0.7482418",
"0.7108377",
"0.7081181",
"0.6945339",
"0.69210577",
"0.68133867",
"0.6780905",
"0.67394626",
"0.6724235",
"0.66824204",
"0.6681981",
"0.66816956",
"0.66302985",
"0.6612456",
"0.6597826",
"0.6574676",
"0.6526968",
"0.6524534",
"0.6492212",
"0.648746",
"0.64322007... | 0.7406372 | 1 |
Internal method to iterate through items in initial_guesses and set value if Var and not fixed. | def _load_values_from_dict(self, model, initial_guesses, exception_on_fixed=True):
for c, v in initial_guesses.items():
component = model.find_component(c)
if component is None:
raise ValueError(f"Could not find a component with name {c}.")
elif not isinstanc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_guesses(self, guesses):\r\n # Global remaining_guesses\r\n self.remaining_guesses = guesses\r\n return guesses",
"def enter_guess(self, guess): \n if ((guess in self._subset_strings) and \n (guess not in self._guessed_strings)):\n guess_idx = self.... | [
"0.6091279",
"0.58874017",
"0.5592305",
"0.5406554",
"0.5084206",
"0.5040215",
"0.50126666",
"0.5008027",
"0.49579498",
"0.48226994",
"0.482156",
"0.48148453",
"0.4812735",
"0.48053303",
"0.4800593",
"0.47960588",
"0.47935754",
"0.4788327",
"0.47850582",
"0.47850582",
"0.4775... | 0.6755397 | 0 |
Define an Initializer for a give submodel or type of submodel. | def add_submodel_initializer(self, submodel: Block, initializer: InitializerBase):
self.submodel_initializers[submodel] = initializer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_submodel_initializer(self, submodel: Block):\n initializer = None\n\n if submodel in self.submodel_initializers:\n # First look for specific model instance\n initializer = self.submodel_initializers[submodel]\n elif type(submodel) in self.submodel_initializers:\n ... | [
"0.6426244",
"0.64261687",
"0.635945",
"0.6279699",
"0.6187232",
"0.61862755",
"0.61537915",
"0.61479694",
"0.61479694",
"0.6130952",
"0.59425503",
"0.5898714",
"0.58950526",
"0.5859792",
"0.58473164",
"0.5814983",
"0.5814983",
"0.5814983",
"0.5814983",
"0.5814983",
"0.580968... | 0.7289638 | 0 |
Lookup Initializer object to use for specified submodel. | def get_submodel_initializer(self, submodel: Block):
initializer = None
if submodel in self.submodel_initializers:
# First look for specific model instance
initializer = self.submodel_initializers[submodel]
elif type(submodel) in self.submodel_initializers:
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_submodel_initializer(self, submodel: Block, initializer: InitializerBase):\n self.submodel_initializers[submodel] = initializer",
"def initialize_submodels(\n self, model, plugin_initializer_args, sub_initializers, **kwargs\n ):\n results = None\n\n for sm in model.initiali... | [
"0.629494",
"0.5802114",
"0.5800888",
"0.57619977",
"0.5754108",
"0.57298976",
"0.5724407",
"0.56774044",
"0.5644273",
"0.56226116",
"0.553986",
"0.5491268",
"0.5477824",
"0.5432277",
"0.53928787",
"0.53355855",
"0.53018427",
"0.52391964",
"0.52306396",
"0.5213364",
"0.520368... | 0.7764551 | 0 |
Prepare plugins for initialization. Iterates through model.initialization_order and collects Initializer objects for each plugin and calls plugin_prepare for each. | def prepare_plugins(self, model, plugin_initializer_args):
sub_initializers = {}
plugin_initializer_args = dict(plugin_initializer_args)
for sm in model.initialization_order:
if sm is not model:
# Get initializers for plug-ins
sub_initializers[sm] = se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_submodels(\n self, model, plugin_initializer_args, sub_initializers, **kwargs\n ):\n results = None\n\n for sm in model.initialization_order:\n if sm is model:\n results = self.initialize_main_model(model, **kwargs)\n else:\n ... | [
"0.68100077",
"0.6809256",
"0.67983544",
"0.64523816",
"0.6307488",
"0.6283127",
"0.6108611",
"0.60500896",
"0.60385036",
"0.60322785",
"0.5999322",
"0.597252",
"0.59653",
"0.5938263",
"0.59014755",
"0.5869463",
"0.5843773",
"0.5834095",
"0.5808623",
"0.56833565",
"0.5677707"... | 0.8387937 | 0 |
Initialize submodels in order defined by model.initialization_order. For the main model, self.initialize_main_model is called. For plugins, plugin_initialize is called from the associated Initializer. | def initialize_submodels(
self, model, plugin_initializer_args, sub_initializers, **kwargs
):
results = None
for sm in model.initialization_order:
if sm is model:
results = self.initialize_main_model(model, **kwargs)
else:
sub_initiali... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialization_routine(\n self, model: Block, plugin_initializer_args: dict = None, **kwargs\n ):\n if plugin_initializer_args is None:\n plugin_initializer_args = {}\n\n # Get logger\n _log = self.get_logger(model)\n\n # Prepare plug-ins for initialization\n ... | [
"0.74508595",
"0.7074342",
"0.6436593",
"0.6341464",
"0.62201107",
"0.61871785",
"0.61871785",
"0.594857",
"0.58714",
"0.584179",
"0.5809016",
"0.57807004",
"0.57758343",
"0.57562464",
"0.57443553",
"0.57188904",
"0.5692898",
"0.5679516",
"0.56247205",
"0.5560791",
"0.5528951... | 0.8328823 | 0 |
Call solver on full model. If no plugins are present, just return results from previous solve step (main model). | def solve_full_model(self, model, results):
# Check to see if there are any plug-ins
if len(model.initialization_order) > 1:
# Solve model with plugins
solve_log = idaeslog.getSolveLogger(
model.name, self.get_output_level(), tag="unit"
)
w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __solve(self) -> None:\n pyo.TransformationFactory(\"contrib.detect_fixed_vars\").apply_to(self.model) # type: ignore\n pyo.TransformationFactory(\"contrib.deactivate_trivial_constraints\").apply_to(self.model) # type: ignore\n\n # initialise the solver object\n self._logger.debug... | [
"0.711272",
"0.70809186",
"0.70591027",
"0.6930304",
"0.66766673",
"0.6653112",
"0.6308992",
"0.62406087",
"0.6193913",
"0.6191389",
"0.6129742",
"0.6097311",
"0.6086057",
"0.6021383",
"0.60102415",
"0.6007275",
"0.5997927",
"0.59831387",
"0.5982925",
"0.59791017",
"0.5949739... | 0.79959255 | 0 |
Postinitialization cleanup of plugins. Iterates through model.initialization_order in reverse and calls plugin_cleanup method from the associated Initializer for each plugin. | def cleanup(self, model, plugin_initializer_args, sub_initializers):
for sm in reversed(model.initialization_order):
if sm is not model:
sub_initializers[sm].plugin_finalize(sm, **plugin_initializer_args[sm]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def teardown(self):\n rc = self.rc\n try:\n for plugin in self.plugins:\n plugin.teardown(rc)\n except Exception as e:\n self.exit(e)",
"def finalize(self):\n self.__doing('finalize')\n self.__do_if_not_done('load_plugins')\n\n if sel... | [
"0.6950858",
"0.66364586",
"0.6626165",
"0.6557975",
"0.6492456",
"0.6297401",
"0.6237969",
"0.623676",
"0.61058164",
"0.60622215",
"0.6032286",
"0.6028387",
"0.6002659",
"0.6002472",
"0.5995111",
"0.59737",
"0.59604675",
"0.5957223",
"0.59560215",
"0.5952454",
"0.5885989",
... | 0.84008473 | 0 |
Attempt to login the user. If the login succeeds, self.user is set to an instance of Presenter or Student depending on the credentials of the user, and the onSuccess callback is called. If the login fails, self.user remains None and onFailure is called. | def Login(self, username, password, onSuccess, onFailure):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login(self):\n input_username = self.username_var.get()\n input_password = self.password_entry.get()\n\n db = self.pager_frame.master_root.db # gets database obj from main root of application\n user_type = ('Staff', 'Student')[int(self.is_student)]\n logging.debug(f'A {user_... | [
"0.6657932",
"0.6501256",
"0.6465317",
"0.6278057",
"0.6245187",
"0.6220882",
"0.62021846",
"0.61970085",
"0.61649793",
"0.6159411",
"0.6137209",
"0.6111138",
"0.60743433",
"0.6068651",
"0.60638374",
"0.60437953",
"0.6039024",
"0.603127",
"0.5977069",
"0.5951739",
"0.59363973... | 0.6866096 | 0 |
Initialize the Layer Manager's model. | def SetUpLayerManager(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_model(self):\n pass",
"def init_model(self):\n pass",
"def _init_layers(self):\n self._init_predictor()\n if self.use_edge_fusion:\n self._init_edge_module()",
"def init_model(self):\n cxnlib.CXNNetInitModel(self.handle)",
"def initialize(self, m... | [
"0.7288466",
"0.7279331",
"0.7026693",
"0.7020394",
"0.6874338",
"0.65884787",
"0.6567816",
"0.6567816",
"0.64982116",
"0.64774096",
"0.64710635",
"0.64489335",
"0.64408183",
"0.6439161",
"0.637311",
"0.63661605",
"0.6364058",
"0.63477635",
"0.63448393",
"0.6319277",
"0.63047... | 0.76564676 | 0 |
Not for public use; copies `data` to `NAME_STACK_DATA` | def absorb_name_stack_data(self, data: Deque):
if data:
return evolve(self, NAME_STACK_DATA=[*data])
return self | {
"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.appendleft(data)\n self.SP = self.STACK[0]",
"def push(self, data):\n self.__stack.append(data)",
"def push(self, data):\n\n # OVERVIEW\n ... | [
"0.6529193",
"0.63378465",
"0.6104222",
"0.58066344",
"0.56321555",
"0.5585421",
"0.5511527",
"0.5440438",
"0.54381055",
"0.53543466",
"0.5348693",
"0.5339414",
"0.5269237",
"0.5241079",
"0.5220368",
"0.5217764",
"0.51999074",
"0.5149044",
"0.5139487",
"0.51354986",
"0.512542... | 0.70040596 | 0 |
For a given RNA, get the p values for all proteins by negative binomial. | def pval_at_rna_by_nbinom(
self, pos_dict_of_counts: Mapping[str, List], neg_vals_at_rna: np.array, gene_and_type,
log_if_values_above=1E9,
log_values=False, which='per_read',
verbose=False):
if len(neg_vals_at_rna) == 0:
return None
log_scale_high_value = (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_binom_pro(pro,n0):\n res = stats.binom.pmf(range(n0+1), n0, 1/2.0)\n a = 0\n for i in range(n0+1):\n a = a + res[i]\n if a>=pro: \n return i",
"def calculate_pvalues(\n self, which='per_read', log_values=False, \n log_if_values_above=1E9, apply_bh_adjust... | [
"0.64295244",
"0.61206096",
"0.6092632",
"0.5937054",
"0.5915439",
"0.5897987",
"0.5843961",
"0.57824105",
"0.57793957",
"0.5767617",
"0.5760822",
"0.5756754",
"0.5744418",
"0.5713776",
"0.5706442",
"0.5702385",
"0.5693384",
"0.5687943",
"0.5681183",
"0.56736696",
"0.5654586"... | 0.625052 | 1 |
Function to convert between doi, pmid (and PMC) either using prespecified mappings or using the PubMed API For reproducibility reasons, the script loads by default (load_pmid parameter) a saved doi > pmid mapping from a csv specified in load_loc, i.e. does not go through PubMed to do the conversions. If that is desired... | def convert_id(df, id_in, id_out, chunklength, timer, load_loc, save_loc=None, load_pmid=True,
mail_ad='placeholder', tool='id_converter'):
import time
import requests
import pandas as pd
import numpy as np
pubmedURL = 'https://www.ncbi.nlm.nih.gov/pmc/utils/idconv/v1.0/?tool=' + to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_document_id(doc_id, id_type='PMC'):\n doc_id = str(doc_id)\n if id_type == 'PMC':\n doc_id = 'PMC%s' % doc_id\n pmc = doc_id\n convert_link = 'http://www.ncbi.nlm.nih.gov/pmc/utils/idconv/v1.0/?tool=my_tool&email=my_email@example.com&ids=%s' % doc_id\n elif id_type in ['PM... | [
"0.6533775",
"0.56744987",
"0.536468",
"0.5313841",
"0.5206514",
"0.51905096",
"0.51601493",
"0.5155215",
"0.5116576",
"0.51015043",
"0.5081539",
"0.4965216",
"0.49161193",
"0.49100566",
"0.49095988",
"0.49090877",
"0.48659292",
"0.48567694",
"0.48451492",
"0.48085907",
"0.48... | 0.8406995 | 0 |
Test case for create_client | def test_create_client(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_client_create(self):\n pass",
"def create_client(self) -> None:\n pass",
"def test_client_create(self, mock_input, mock_pass):\n # Patch username and password.\n mock_input.return_value = \"user\"\n mock_pass.return_value = \"pass\"\n\n # Instantiate Agave object ... | [
"0.9006332",
"0.8730021",
"0.79921216",
"0.7981903",
"0.7936929",
"0.78399014",
"0.75352085",
"0.74762934",
"0.745891",
"0.7451234",
"0.7429486",
"0.7401617",
"0.7239401",
"0.72148645",
"0.7164479",
"0.71080774",
"0.7077719",
"0.7053888",
"0.70452255",
"0.70040774",
"0.698839... | 0.9204078 | 0 |
Test case for delete_client | def test_delete_client(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_o_auth_client(self):\n pass",
"def test_client_nationlity_delete(self):\n pass",
"def test_05_delete_client(self):\n try:\n for k, v in self.test_data.items():\n client = Client()\n test_str = v.split(',')\n client.use... | [
"0.8503204",
"0.84344566",
"0.8302422",
"0.81243575",
"0.80508804",
"0.78585076",
"0.7808288",
"0.77607673",
"0.77386457",
"0.77030754",
"0.7619175",
"0.75693274",
"0.7558176",
"0.7546563",
"0.74971133",
"0.7458603",
"0.7448384",
"0.7389743",
"0.73770237",
"0.73521173",
"0.73... | 0.93888295 | 0 |
Test case for get_client | def test_get_client(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_client_retrieve(self):\n pass",
"def test_create_client(self):\n pass",
"def testclient():\n base_url = PARAMS.get(\"url\") + \"/v2\"\n client = Client(\n base_url=base_url,\n headers={\n \"Authorization\": f\"GenieKey {PARAMS.get('token')}\",\n }\n ... | [
"0.84132427",
"0.7832136",
"0.78242594",
"0.77925164",
"0.7764797",
"0.774107",
"0.7625849",
"0.7403347",
"0.74001014",
"0.7387426",
"0.73268086",
"0.73163444",
"0.73055863",
"0.7282642",
"0.7215969",
"0.7198754",
"0.716757",
"0.7138998",
"0.71297807",
"0.7121249",
"0.7117647... | 0.92399555 | 0 |
Test case for list_clients | def test_list_clients(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_client_list(self):\n pass",
"def test_list_clients(oauth_client, response):\n response.get(\"https://api.mollie.com/v2/clients\", \"clients_list\")\n\n clients = oauth_client.clients.list()\n assert_list_object(clients, Client)",
"def test_list_o_auth_client(self):\n pass",
"d... | [
"0.8937596",
"0.81697905",
"0.7780347",
"0.7686964",
"0.7668267",
"0.7450121",
"0.7423524",
"0.7326716",
"0.73110116",
"0.72992104",
"0.7282571",
"0.72709304",
"0.71463716",
"0.7133669",
"0.712464",
"0.70969963",
"0.7089075",
"0.7062791",
"0.70331645",
"0.7029423",
"0.6988904... | 0.93727785 | 0 |
Test case for update_client | def test_update_client(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_client_update(self):\n pass",
"def test_client_partial_update(self):\n pass",
"def test_update_client(self):\n url = '/api/v1/pediatras/{}/'.format(self.app_client.id)\n\n data = {\n \"name\": \"Ernesto\"\n }\n\n request = self.client.pa... | [
"0.9318723",
"0.8183573",
"0.8037375",
"0.80077857",
"0.79106164",
"0.7766291",
"0.7766291",
"0.7766291",
"0.7725542",
"0.76679635",
"0.7640765",
"0.76001585",
"0.7496819",
"0.7427638",
"0.7393602",
"0.7380255",
"0.73440796",
"0.73436975",
"0.72158194",
"0.7184189",
"0.715664... | 0.93742025 | 0 |
Is portfolio create new returning a Portfolio instance? | def test_01_portfolio_create_new(self):
p = Portfolio.create_new(slug="test",
description="Portfolio to be used in JPMorgan tests",
user="automated unit tester",)
self.assertTrue(isinstance(p, Portfolio),
msg="Port... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_portfolio_object(self):\n return self.__get_portfolio_object(self.portfolio_name, self.portfolio_user)",
"def portfolio(self):\n self.update_portfolio()\n return self._immutable_portfolio",
"def __get_portfolio_object(self, name, user):\n portfolio = self.__get_object_portfo... | [
"0.69571006",
"0.6532318",
"0.63471985",
"0.63249826",
"0.62462574",
"0.62244266",
"0.6179947",
"0.6164025",
"0.6070407",
"0.59342664",
"0.59342664",
"0.58543706",
"0.5839788",
"0.562951",
"0.55373865",
"0.54709566",
"0.53455853",
"0.53301656",
"0.53194016",
"0.52552277",
"0.... | 0.80883825 | 0 |
Is portfolio get all returning a list of Portfolio instances? | def test_02_portfolio_get_all(self):
self.assertTrue(isinstance(Portfolio.get_all(), list),
msg="Portfolio is NOT returning a list of all instances")
print("Portfolio get_all method is returning the following list: {}".format(
Portfolio.get_all(),
)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def portfolio(self):\n self.update_portfolio()\n return self._immutable_portfolio",
"def test_06_get_all_portfolio_transactions(self):\n p = Portfolio.get_portfolio_by_slug(\"test\")\n t = Transaction.get_transactions(p)\n self.assertTrue(isinstance(t, list),\n ... | [
"0.7062169",
"0.69397235",
"0.6546505",
"0.63734484",
"0.62883407",
"0.6234493",
"0.6177684",
"0.616726",
"0.6156453",
"0.59769446",
"0.59720457",
"0.5965514",
"0.5940291",
"0.5923666",
"0.58675176",
"0.5859177",
"0.58466095",
"0.58249974",
"0.5822161",
"0.57810724",
"0.57732... | 0.812841 | 0 |
Is portfolio get portfolio by slug returning an assertive instance? | def test_03_portfolio_get_specific_instance_by_slug(self):
self.assertEqual(Portfolio.get_portfolio_by_slug("test"), Portfolio.get_all()[0],
msg="Portfolio is NOT returning a valid instance for a specific slug")
print("Portfolio get_portfolio_by_slug method is returning the foll... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_portfolio_object(self):\n return self.__get_portfolio_object(self.portfolio_name, self.portfolio_user)",
"def test_01_portfolio_create_new(self):\n p = Portfolio.create_new(slug=\"test\",\n description=\"Portfolio to be used in JPMorgan tests\",\n ... | [
"0.6215108",
"0.5978676",
"0.58473897",
"0.57700115",
"0.5726963",
"0.57000434",
"0.55958045",
"0.53932124",
"0.53825146",
"0.5365526",
"0.53056324",
"0.52813023",
"0.5233755",
"0.5200715",
"0.515977",
"0.51488817",
"0.50816894",
"0.5074766",
"0.50515527",
"0.50394213",
"0.49... | 0.8413518 | 0 |
Is TransactionCost insert cost returning a valid instance? | def test_04_insert_costs(self):
c_stock = TransactionCost.insert_new_cost(
TRANSACTION_TYPE_STOCK, TRANSACTION_COST_FIXED, 5
)
c_bond = TransactionCost.insert_new_cost(
TRANSACTION_TYPE_BOND, TRANSACTION_COST_VARIABLE, 0.01/100
)
c_cash = TransactionCost.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, insert_cost=1, deletion_cost=1, subst_cost=1):\r\n self._insert_cost = insert_cost\r\n self._deletion_cost = deletion_cost\r\n self._subst_cost = subst_cost",
"def AddCost(Cost):\n\n logs.logger.debug(\"Start to add Cost object to the database.\")\n try:\n ses... | [
"0.57979393",
"0.5793369",
"0.5746544",
"0.573895",
"0.56320035",
"0.5601088",
"0.5589543",
"0.5554807",
"0.5519123",
"0.5435289",
"0.54059434",
"0.5400722",
"0.5385601",
"0.5362255",
"0.53588873",
"0.5353385",
"0.5317272",
"0.5300611",
"0.5287781",
"0.5277058",
"0.5270405",
... | 0.71924794 | 0 |
Is transaction creating valid buy stock objects? | def test_05_transaction_create_buy_stock(self):
portfolio = Portfolio.get_portfolio_by_slug("test")
user = "automated unit tester"
buy_stock_aapl = Transaction.buy_stock(
portfolio=portfolio,
asset="AAPL",
t_currency=TRANSACTION_CURRENCY_USD,
amou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_11_transaction_create_sell_stock(self):\n portfolio = Portfolio.get_portfolio_by_slug(\"test\")\n user = \"automated unit tester\"\n\n sell_stock_aapl = Transaction.sell_stock(\n portfolio=portfolio,\n asset=\"AAPL\",\n t_currency=TRANSACTION_CURRENCY_... | [
"0.709348",
"0.66812366",
"0.66609544",
"0.6531835",
"0.6470836",
"0.64498705",
"0.6413328",
"0.63544303",
"0.6354271",
"0.6331898",
"0.63080424",
"0.62990516",
"0.6272735",
"0.6260375",
"0.62559885",
"0.6236233",
"0.616995",
"0.6160542",
"0.61408144",
"0.6095268",
"0.6088327... | 0.7457215 | 0 |
Is portfolio get transactions returning a list of Transaction instances? | def test_06_get_all_portfolio_transactions(self):
p = Portfolio.get_portfolio_by_slug("test")
t = Transaction.get_transactions(p)
self.assertTrue(isinstance(t, list),
msg="Transaction is NOT returning a list of all transaction instances")
print("Transaction get tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transactions(self):\n return self._call_account_method(\n 'transactions'\n )",
"def test_08_transaction_assets_of_portfolio(self):\n p = Portfolio.get_portfolio_by_slug(\"test\")\n t = Transaction.get_transaction_assets(p)\n self.assertTrue(isinstance(t, list),\n... | [
"0.7266499",
"0.7171786",
"0.6987297",
"0.6985378",
"0.69811076",
"0.6967683",
"0.6940571",
"0.672812",
"0.6685774",
"0.66452223",
"0.6630823",
"0.66017336",
"0.6571563",
"0.65117025",
"0.6505758",
"0.6462696",
"0.64080906",
"0.640309",
"0.63928014",
"0.6375936",
"0.6334757",... | 0.8448458 | 0 |
Is portfolio get transaction types returning an unique list of Transaction types? | def test_07_transaction_types_of_portfolio(self):
p = Portfolio.get_portfolio_by_slug("test")
t = Transaction.get_transaction_types(p)
self.assertTrue(isinstance(t, list),
msg="Transaction is NOT returning a list of unique transaction types")
print("Transaction ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_transaction_types(self):\n pass",
"def test_06_get_all_portfolio_transactions(self):\n p = Portfolio.get_portfolio_by_slug(\"test\")\n t = Transaction.get_transactions(p)\n self.assertTrue(isinstance(t, list),\n msg=\"Transaction is NOT returning a ... | [
"0.73395324",
"0.67146444",
"0.6412036",
"0.6251709",
"0.5947732",
"0.5897284",
"0.57378894",
"0.5715273",
"0.5647476",
"0.5642911",
"0.5624476",
"0.5601469",
"0.5577717",
"0.5553984",
"0.5520436",
"0.5472153",
"0.5452188",
"0.5397503",
"0.5397229",
"0.5367599",
"0.5352137",
... | 0.833102 | 0 |
Is portfolio get transaction assets returning an unique list of Transaction assets? | def test_08_transaction_assets_of_portfolio(self):
p = Portfolio.get_portfolio_by_slug("test")
t = Transaction.get_transaction_assets(p)
self.assertTrue(isinstance(t, list),
msg="Transaction is NOT returning a list of unique transaction assets")
print("Transaction... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_09_transactions_by_asset(self):\n p = Portfolio.get_portfolio_by_slug(\"test\")\n user = \"automated unit tester\"\n\n buy_stock_ibm = Transaction.buy_stock(\n portfolio=p,\n asset=\"IBM\",\n t_currency=TRANSACTION_CURRENCY_USD,\n amount=32,... | [
"0.69945604",
"0.694181",
"0.6821842",
"0.6712087",
"0.6373541",
"0.63606733",
"0.6324977",
"0.60800743",
"0.605254",
"0.6031225",
"0.5916209",
"0.58847517",
"0.58741885",
"0.5818111",
"0.5714047",
"0.5686146",
"0.5644342",
"0.56390864",
"0.56340545",
"0.56191",
"0.56149846",... | 0.85128826 | 0 |
Is portfolio get transactions by asset returning a list of Transactions? | def test_09_transactions_by_asset(self):
p = Portfolio.get_portfolio_by_slug("test")
user = "automated unit tester"
buy_stock_ibm = Transaction.buy_stock(
portfolio=p,
asset="IBM",
t_currency=TRANSACTION_CURRENCY_USD,
amount=32,
unit_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_08_transaction_assets_of_portfolio(self):\n p = Portfolio.get_portfolio_by_slug(\"test\")\n t = Transaction.get_transaction_assets(p)\n self.assertTrue(isinstance(t, list),\n msg=\"Transaction is NOT returning a list of unique transaction assets\")\n prin... | [
"0.7884124",
"0.75701594",
"0.6596491",
"0.6386773",
"0.63495964",
"0.62921685",
"0.62614506",
"0.61750096",
"0.6090789",
"0.60896486",
"0.60391206",
"0.6009348",
"0.6002427",
"0.5961729",
"0.59453547",
"0.5912782",
"0.58792007",
"0.5861768",
"0.5806336",
"0.5805966",
"0.5804... | 0.7743377 | 1 |
Is transaction creating valid sell stock objects? | def test_11_transaction_create_sell_stock(self):
portfolio = Portfolio.get_portfolio_by_slug("test")
user = "automated unit tester"
sell_stock_aapl = Transaction.sell_stock(
portfolio=portfolio,
asset="AAPL",
t_currency=TRANSACTION_CURRENCY_USD,
a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_05_transaction_create_buy_stock(self):\n portfolio = Portfolio.get_portfolio_by_slug(\"test\")\n user = \"automated unit tester\"\n\n buy_stock_aapl = Transaction.buy_stock(\n portfolio=portfolio,\n asset=\"AAPL\",\n t_currency=TRANSACTION_CURRENCY_USD... | [
"0.7060973",
"0.67914975",
"0.6668381",
"0.6651207",
"0.6565465",
"0.6488926",
"0.6485289",
"0.64154625",
"0.6414133",
"0.64030004",
"0.6399078",
"0.6254049",
"0.6251921",
"0.6211261",
"0.6197272",
"0.6175949",
"0.617211",
"0.6150157",
"0.6148582",
"0.61446077",
"0.6142203",
... | 0.74735564 | 0 |
Is Price insert asset price returning a valid instance? | def test_13_insert_bond_prices(self):
p_alitalia = Price.insert_new_price("ALITALIA", 119000)
p_samsung = Price.insert_new_price("SAMSUNG", 104000)
self.assertTrue(isinstance(p_alitalia, Price),
msg="Price is NOT returning a valid inserted ALITALIA instance")
pri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_16_insert_cash_prices(self):\n p_eur = Price.update_price(\"EUR\", 1.17)\n p_usd = Price.insert_new_price(\"USD\", 0.8909)\n\n self.assertTrue(isinstance(p_eur, Price),\n msg=\"Price is NOT returning a valid inserted EUR instance\")\n print(\"Price insert... | [
"0.72719324",
"0.7001923",
"0.60355216",
"0.5901125",
"0.5876463",
"0.5852218",
"0.57698214",
"0.57485086",
"0.5696665",
"0.568756",
"0.5682882",
"0.5612596",
"0.5610175",
"0.55462766",
"0.55421",
"0.5518466",
"0.5468801",
"0.54618275",
"0.54559",
"0.5440513",
"0.5438378",
... | 0.7226011 | 1 |
Is transaction creating valid sell bond objects? | def test_14_transaction_create_sell_bonds(self):
portfolio = Portfolio.get_portfolio_by_slug("test")
user = "automated unit tester"
sell_bond_alitalia = Transaction.sell_bond(
portfolio=portfolio,
asset="ALITALIA",
t_currency=TRANSACTION_CURRENCY_USD,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_11_transaction_create_sell_stock(self):\n portfolio = Portfolio.get_portfolio_by_slug(\"test\")\n user = \"automated unit tester\"\n\n sell_stock_aapl = Transaction.sell_stock(\n portfolio=portfolio,\n asset=\"AAPL\",\n t_currency=TRANSACTION_CURRENCY_... | [
"0.63627166",
"0.619039",
"0.6143452",
"0.61264247",
"0.6096059",
"0.6003349",
"0.60031736",
"0.60018104",
"0.5999286",
"0.59597903",
"0.5932971",
"0.59178054",
"0.59178054",
"0.591276",
"0.59121937",
"0.59109414",
"0.59020644",
"0.58650994",
"0.58613867",
"0.5816735",
"0.579... | 0.71521604 | 0 |
Is Price insert asset price returning a valid instance? | def test_16_insert_cash_prices(self):
p_eur = Price.update_price("EUR", 1.17)
p_usd = Price.insert_new_price("USD", 0.8909)
self.assertTrue(isinstance(p_eur, Price),
msg="Price is NOT returning a valid inserted EUR instance")
print("Price insert EUR asset is retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_13_insert_bond_prices(self):\n p_alitalia = Price.insert_new_price(\"ALITALIA\", 119000)\n p_samsung = Price.insert_new_price(\"SAMSUNG\", 104000)\n\n self.assertTrue(isinstance(p_alitalia, Price),\n msg=\"Price is NOT returning a valid inserted ALITALIA instanc... | [
"0.7226011",
"0.7001923",
"0.60355216",
"0.5901125",
"0.5876463",
"0.5852218",
"0.57698214",
"0.57485086",
"0.5696665",
"0.568756",
"0.5682882",
"0.5612596",
"0.5610175",
"0.55462766",
"0.55421",
"0.5518466",
"0.5468801",
"0.54618275",
"0.54559",
"0.5440513",
"0.5438378",
"... | 0.72719324 | 0 |
Is Porfolio consolidation method returning a valid list of consolidated positions by asset? | def test_18_consolidate_portfolio(self):
p = Portfolio.get_portfolio_by_slug("test")
consolidations = Portfolio.consolidate_portfolio(p)
self.assertTrue(isinstance(consolidations, list),
msg="Portfolio is NOT returning a valid consolidated list")
print("Portfolio ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_08_transaction_assets_of_portfolio(self):\n p = Portfolio.get_portfolio_by_slug(\"test\")\n t = Transaction.get_transaction_assets(p)\n self.assertTrue(isinstance(t, list),\n msg=\"Transaction is NOT returning a list of unique transaction assets\")\n prin... | [
"0.5566565",
"0.5235757",
"0.50899225",
"0.50683314",
"0.49882042",
"0.4927551",
"0.492257",
"0.4889809",
"0.48793107",
"0.47880775",
"0.47880775",
"0.47703537",
"0.4757794",
"0.4743291",
"0.47356924",
"0.47334537",
"0.4732884",
"0.47202784",
"0.47197035",
"0.47161207",
"0.47... | 0.67808294 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.