query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Creates a pandas dataframe from the data and column names associated with the class variable. | def create_dataframe(self):
data = self.extract_data()
col_names = self.extract_column_names()
self.df = pd.DataFrame(data, columns = col_names)
return self.df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_data_frame(self):\n names = []\n names.extend(self.SETTABLE_PARAM_NAMES)\n names.extend(self.COLLECTABLE_PARAM_NAMES)\n return pd.DataFrame(data=self.data, columns=names)",
"def data_frame(query, columns):\n def make_row(x):\n return dict([(c, getattr(x, c)) for c i... | [
"0.6693102",
"0.6586259",
"0.65547717",
"0.64970237",
"0.64557904",
"0.6428715",
"0.6419291",
"0.6386291",
"0.63816786",
"0.6330894",
"0.6303226",
"0.6252114",
"0.6244337",
"0.6217172",
"0.62071204",
"0.6169929",
"0.6162403",
"0.61296916",
"0.61290145",
"0.61274123",
"0.61075... | 0.7357284 | 0 |
Appends access methods to class for children in the YANG module. Returns the name of sub if it is a container or notification, an empty string if sub is a list, None otherwise. Uses mutual recursion with generate_class. For this function to work, self.java_class must be defined. sub A data model subtree statement, chil... | def generate_child(self, sub):
field = None
add = self.java_class.append_access_method # XXX: add is a function
if sub.keyword in context.yangelement_stmts:
pkg = self.package + '.' + self.n2
child_generator = ClassGenerator(stmt=sub, package=pkg,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_sub(self, sub):\n self._add_object('sub', sub)",
"def subcommand(cls, name, subapp = None):\r\n def wrapper(subapp):\r\n attrname = \"_subcommand_%s\" % (subapp if isinstance(subapp, str) else subapp.__name__,)\r\n setattr(cls, attrname, Subcommand(name, subapp))\r\n ... | [
"0.51847345",
"0.48107767",
"0.47868058",
"0.47373044",
"0.47108123",
"0.46632832",
"0.45960143",
"0.4578345",
"0.45675522",
"0.45602587",
"0.45519704",
"0.45503882",
"0.45017233",
"0.44574514",
"0.4424194",
"0.4419591",
"0.4348572",
"0.4340007",
"0.43277156",
"0.43066555",
"... | 0.64113224 | 0 |
Function returns dictionary with only subset of data which are useful, while correcting the keys into desired format | def create_dictionary(full_dict, wanted_keys,correct_keys):
return {keyparse(correct_keys,wanted_key): full_dict[wanted_key] for wanted_key in wanted_keys} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_data(self):\n list_key, list_value = self.key_value_data()\n value_list = []\n key_list = ['index', 'date', 'country', 'province/state', 'confirmed', 'deaths', 'recovered']\n list_key.pop(0)\n list_key.insert(0, \"index\")\n for i, item in enumerate(list_key):\n... | [
"0.6518861",
"0.65177107",
"0.6323523",
"0.6309233",
"0.62227815",
"0.62189144",
"0.6181418",
"0.6166213",
"0.61218774",
"0.6084451",
"0.60338527",
"0.5908436",
"0.58987516",
"0.58629614",
"0.5820233",
"0.5812317",
"0.57999164",
"0.57896584",
"0.57700706",
"0.5679636",
"0.562... | 0.5517489 | 31 |
example.yml is expected to have 5 match errors inside. | def test_example(default_rules_collection):
result = Runner(default_rules_collection, 'examples/example.yml', [], [], []).run()
assert len(result) == 5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_yaml_discovery_plugin_scan_exceptions():\n yamldp = YAMLDiscoveryPlugin()\n package = Package(\n \"valid_package\", os.path.join(os.path.dirname(__file__), \"valid_package\")\n )\n exceptions = Exceptions(os.path.join(os.path.dirname(__file__), \"exceptions.yaml\"))\n yamldp.scan(pac... | [
"0.61882156",
"0.60608864",
"0.6047736",
"0.60242116",
"0.5989433",
"0.59809554",
"0.59336317",
"0.59208727",
"0.5900725",
"0.58777887",
"0.5843581",
"0.58148545",
"0.57800573",
"0.57614946",
"0.57503533",
"0.57493174",
"0.57481146",
"0.5734358",
"0.5717724",
"0.5700237",
"0.... | 0.62486887 | 0 |
[pad_char] pad_len + input | def decode_pad(self, input_list, max_len = 0, pad_char = '#', start_char = '@'):
output_list = []
if(max_len == 0) :
max_len = self.sent_max_len
for input in input_list :
if (len(input) > max_len - 1):
output_list.append([start_char] + input[0:max_len-1])... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(input_sequence, length, pad_char):\n\n # If input_sequence is a string, convert to to an explicit list\n if isinstance(input_sequence, str):\n input_sequence = list(input_sequence)\n\n # If the input_sequence is the correct length, return it\n if len(input_sequence) =... | [
"0.7498386",
"0.748163",
"0.7460856",
"0.72966564",
"0.7233444",
"0.7222854",
"0.7207041",
"0.71805966",
"0.7102764",
"0.70925474",
"0.70872235",
"0.7052684",
"0.7041959",
"0.703103",
"0.7019523",
"0.7019083",
"0.70056343",
"0.69916326",
"0.6984308",
"0.690786",
"0.69059575",... | 0.6544156 | 41 |
return node id of netconf | def _find_netconf_node_id(self, nn_id, wf_ver = None):
# make query string (use raw query only when cate is too complicated)
query_list = []
query_list.append("SELECT NI.NN_WF_NODE_ID ")
query_list.append("FROM MASTER_NN_VER_WFLIST_INFO WV JOIN MASTER_NN_WF_STATE_INFO WS ")
q... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_net_node_id(self):\n return self.node_id",
"def node_id(self) -> str:\n return pulumi.get(self, \"node_id\")",
"def node_id(self) -> str:\n return pulumi.get(self, \"node_id\")",
"def node_id(self) -> str:\n return pulumi.get(self, \"node_id\")",
"def node_id(self) -> st... | [
"0.79908085",
"0.7590218",
"0.7590218",
"0.7590218",
"0.7590218",
"0.7387977",
"0.7162073",
"0.7146532",
"0.71061444",
"0.7101659",
"0.7101659",
"0.7101659",
"0.7098659",
"0.7080783",
"0.7065327",
"0.7001951",
"0.69214886",
"0.69214886",
"0.68165684",
"0.6718708",
"0.66475594... | 0.72194993 | 6 |
pad chars for prediction | def _pad_predict_input(self, input_tuple, word_len):
try :
pad_size = word_len - (len(input_tuple) + 1)
if(pad_size >= 0 ) :
input_tuple = pad_size * [('#', '')] + input_tuple[0: word_len -1] + [('SF', '')]
else :
input_tuple = input_tuple[0: w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(data, bs):\n return data + (bs - len(data) % bs) * chr(bs - len(data) % bs)",
"def add_padding(text: torch.Tensor, model: FFPOSTagger) -> torch.Tensor:\n pad_token = model.text_field.pad_token\n pad_index = model.text_field.vocab.stoi[pad_token]\n \n # Problem 2b: Fill in your code here.\n... | [
"0.69187796",
"0.6713625",
"0.66714185",
"0.6461251",
"0.6435037",
"0.64349437",
"0.6402029",
"0.6360433",
"0.6346233",
"0.63222384",
"0.6291191",
"0.6271198",
"0.62675977",
"0.6214075",
"0.61836696",
"0.61836696",
"0.6175468",
"0.61741346",
"0.6151885",
"0.6135651",
"0.60910... | 0.67629826 | 1 |
Get battery's capacity, rate of self discharge, charging and discharging efficiency. | def getNominalValues(self):
return (self.capacity, self.self_discharge,
self.eta_charge, self.eta_discharge) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_battery_consumption(self):\n\n last_position = [self.start_points[d] for d in range(self.nb_drone)]\n d = 0\n start = self.start_points[d]\n battery = 0\n i = 0\n limit = 0\n while i < len(self.state):\n if limit + self.mapper.paths[(last_position... | [
"0.7192539",
"0.70939326",
"0.7027286",
"0.7027286",
"0.70222414",
"0.70134604",
"0.68441176",
"0.6833908",
"0.6827725",
"0.6761469",
"0.6727717",
"0.6694167",
"0.6667752",
"0.66673225",
"0.6572604",
"0.65457994",
"0.6543411",
"0.6543411",
"0.65313715",
"0.6530903",
"0.652222... | 0.0 | -1 |
Get all words from the specified node on down. If called with the root node passed in, returns all words in the dictionary. | def get_words(self, node, all_words=[]): # pylint: disable=W0102
for a_node in node.letters.keys():
all_words = self.get_words(node.letters[a_node], all_words)
if node.word and node.word not in all_words:
all_words.append(node.word)
return all_words | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_all_words(self, node=None, prefix=\"\", words=[]):\n current_node = node or self.root\n\n for key, child_node in current_node.children.items():\n if key == '*':\n words.append(prefix)\n else:\n self.collect_all_words(child_node, prefix +... | [
"0.7330477",
"0.7156045",
"0.69985026",
"0.6780019",
"0.59101534",
"0.5821193",
"0.57990515",
"0.57753706",
"0.5591234",
"0.5558004",
"0.5508782",
"0.55064386",
"0.5477181",
"0.5473291",
"0.54217273",
"0.5403756",
"0.5385819",
"0.53518593",
"0.53513974",
"0.53513974",
"0.5345... | 0.7589044 | 0 |
Build a network that maps state > action values. | def forward(self, state):
out = state
for layer in self.fc_layers[:-1]:
out = F.relu(layer(out))
out = self.fc_layers[-1](out)
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _network_template(self, state):\n weights_initializer = slim.variance_scaling_initializer(\n factor=1.0 / np.sqrt(3.0), mode='FAN_IN', uniform=True)\n\n net = tf.cast(state, tf.float32)\n net = tf.subtract(net, tf.reduce_min(net))\n net = tf.div(net, tf.reduce_max(net))\n net = slim.conv2... | [
"0.63946366",
"0.63886064",
"0.63507026",
"0.6328887",
"0.6328887",
"0.63190526",
"0.62626165",
"0.6228537",
"0.6205531",
"0.61980116",
"0.61628056",
"0.6102542",
"0.6077717",
"0.6031706",
"0.60232824",
"0.59831923",
"0.59382755",
"0.5907368",
"0.5839515",
"0.5820617",
"0.582... | 0.0 | -1 |
Return a child of given (queue) logger, tagged with module name. | def get_child_logger(logger, sub_module_name):
assert(logger.module_name)
sublogger = logger.getChild(sub_module_name)
sublogger.module_name = logger.module_name + "." + sub_module_name
sublogger.name = sublogger.module_name
tagger = TaggerFilter("MODULE", sublogger.module_name)
sublogger.addFil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queue_logger(queue, module_name, module_id, level, filter=None):\n h = logging.handlers.QueueHandler(queue)\n logging.getLogger().addHandler(h)\n\n logger = logging.getLogger(module_id)\n logger.module_name = module_name\n tagger = TaggerFilter(\"MODULE\", module_name)\n logger.addFilter(... | [
"0.6445505",
"0.6398214",
"0.63238156",
"0.62693435",
"0.62693435",
"0.614859",
"0.6078771",
"0.58132726",
"0.58132726",
"0.57943386",
"0.5717279",
"0.56774276",
"0.56761247",
"0.5674491",
"0.5640895",
"0.56056625",
"0.5599139",
"0.558149",
"0.5574449",
"0.5570513",
"0.556897... | 0.7168101 | 0 |
Tests if string "s" is a number. | def is_number(s):
try: float(s)
except ValueError: return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_number(self, s):\n try: float(s) \n except ValueError: return False\n return True",
"def is_number(s):\n try:\n if str(s).startswith('0'):\n return False\n float(s)\n return True\n except ValueError:\n return False",
"def is_number(self, ... | [
"0.8418437",
"0.8379724",
"0.837964",
"0.82775223",
"0.82753766",
"0.82662165",
"0.82633597",
"0.82633597",
"0.82633597",
"0.82633597",
"0.82633597",
"0.82633597",
"0.82633597",
"0.823854",
"0.82196575",
"0.8044274",
"0.78372145",
"0.7818132",
"0.7771662",
"0.7672151",
"0.765... | 0.8223184 | 14 |
Return the socket file path | def sockfile(self):
sockdir = self.settings and self.settings['qtubes.vde_socks'] or '/tmp'
sockpath = self.sock if path.isabs(self.sock) else path.join(
sockdir, self.sock)
return sockpath | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_socket_path(self):\n\n return self._socket_path",
"def __get_socket_file(self):\n # make sure the API socket exists and is a valid socket\n api_socket = self._config.get(\"api_socket\")\n try:\n st = os.stat(api_socket)\n if not stat.S_ISSOCK(st.st_mode):\n ... | [
"0.8417002",
"0.7144866",
"0.7068039",
"0.68105984",
"0.6599633",
"0.6598129",
"0.6587774",
"0.65855604",
"0.64662784",
"0.6453128",
"0.63694334",
"0.6333205",
"0.63034403",
"0.62455606",
"0.6218482",
"0.6194044",
"0.6188988",
"0.6184022",
"0.61528444",
"0.61387116",
"0.61199... | 0.83411527 | 1 |
Get the date in the format YearMonthDay (e.g. 20201202) n days ago | def n_days_ago(n_days):
n_days_ago = datetime.datetime.now()-datetime.timedelta(days=n_days)
return n_days_ago.strftime("%Y-%m-%d") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def days_ago(n):\n old_date = datetime.datetime.now() - datetime.timedelta(days=n)\n return fmt(old_date.year) + fmt(old_date.month) + fmt(old_date.day)",
"def beforeNday(n, timestr=None):\r\n if not timestr: timestr = time.strftime(\"%Y-%m-%d\", time.localtime())\r\n date = datetime.datetime.strptim... | [
"0.7817646",
"0.64310575",
"0.61657125",
"0.61521846",
"0.60009503",
"0.5827824",
"0.5733195",
"0.5721107",
"0.5691295",
"0.5663122",
"0.5659899",
"0.564576",
"0.56443125",
"0.56218016",
"0.5607879",
"0.56021863",
"0.5598709",
"0.5589283",
"0.558179",
"0.5557193",
"0.5517686"... | 0.7245857 | 1 |
Get the inital total balance of all validators of a date. The date has to be in the format %Y%m%d (e.g. 20201202) | def get_initial_balance_of_date(date):
num_validators = len(my_validators.split(","))
total = 0
c.execute("""SELECT
balance
FROM
validators
WHERE
DATE(timestamp) = ?
LIMIT
?""", ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_balance(self, date):\n amount_paid = Payment.get_paid_amount(self.loan_id, date)\n return self._total_value - amount_paid",
"def _compute_account_initial_balance(self, accounts, date_from, grouped_by_account=False):\n mapping = {\n 'balance': \"COALESCE(SUM(debit),0) - COA... | [
"0.5580964",
"0.52893436",
"0.52893436",
"0.518571",
"0.51247895",
"0.50992817",
"0.5040229",
"0.5021642",
"0.49666306",
"0.49549457",
"0.49483582",
"0.4939092",
"0.49205384",
"0.48531845",
"0.48487732",
"0.4845927",
"0.4844045",
"0.48398677",
"0.48230278",
"0.48175472",
"0.4... | 0.83054274 | 0 |
If this field is set, this is the unique id identifying the source of this resource. | def source_unique_id(self) -> str:
return pulumi.get(self, "source_unique_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_id(self):\n return self._source_id",
"def source_id(self):\n return self._source_id",
"def source_resource_id(self) -> Optional[str]:\n return pulumi.get(self, \"source_resource_id\")",
"def source_resource_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"sour... | [
"0.8242812",
"0.8242812",
"0.7828271",
"0.7781144",
"0.7742231",
"0.76453835",
"0.7584625",
"0.7518945",
"0.7427745",
"0.72932446",
"0.7195926",
"0.70792747",
"0.69613045",
"0.6920678",
"0.6862668",
"0.6846547",
"0.67403895",
"0.6715253",
"0.67085785",
"0.6630888",
"0.6616856... | 0.81231 | 2 |
ResourceId of the disk encryption set associated to Confidential VM supported disk encrypted with customer managed key | def secure_vm_disk_encryption_set_id(self) -> Optional[str]:
return pulumi.get(self, "secure_vm_disk_encryption_set_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disk_encryption_set_id(self) -> Optional[str]:\n return pulumi.get(self, \"disk_encryption_set_id\")",
"def disk_encryption_key(self) -> Optional['outputs.KeyVaultAndSecretReferenceResponse']:\n return pulumi.get(self, \"disk_encryption_key\")",
"def disk_encryptions(self) -> pulumi.Output[Op... | [
"0.7440864",
"0.7010443",
"0.6147932",
"0.6128239",
"0.6128239",
"0.5884815",
"0.58606005",
"0.566312",
"0.5607355",
"0.55317235",
"0.5444707",
"0.53924894",
"0.5375966",
"0.5364846",
"0.53424823",
"0.5320506",
"0.52994174",
"0.52683246",
"0.5245214",
"0.5240457",
"0.52396685... | 0.7364604 | 1 |
The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. | def __init__(__self__, *,
tier: str,
name: Optional[str] = None):
pulumi.set(__self__, "tier", tier)
if name is not None:
pulumi.set(__self__, "name", name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sku_name(self) -> str:\n return pulumi.get(self, \"sku_name\")",
"def sku(self) -> str:\n return pulumi.get(self, \"sku\")",
"def sku(self) -> Optional[str]:\n return pulumi.get(self, \"sku\")",
"def vm_sku_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"vm_sku_n... | [
"0.8066565",
"0.76675105",
"0.73525214",
"0.7070269",
"0.70390785",
"0.70296764",
"0.6994647",
"0.695811",
"0.695811",
"0.6908001",
"0.6908001",
"0.6777364",
"0.6777364",
"0.6777364",
"0.66832244",
"0.6592213",
"0.6592213",
"0.6509949",
"0.6374704",
"0.6309006",
"0.62778294",... | 0.0 | -1 |
ResourceId of the disk encryption set to use for enabling encryption at rest. | def disk_encryption_set_id(self) -> Optional[str]:
return pulumi.get(self, "disk_encryption_set_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def secure_vm_disk_encryption_set_id(self) -> Optional[str]:\n return pulumi.get(self, \"secure_vm_disk_encryption_set_id\")",
"def disk_encryption_key(self) -> Optional['outputs.KeyVaultAndSecretReferenceResponse']:\n return pulumi.get(self, \"disk_encryption_key\")",
"def associated_set_storage... | [
"0.7103155",
"0.6011504",
"0.55220217",
"0.5463096",
"0.5463096",
"0.5463096",
"0.54502416",
"0.54255164",
"0.5325652",
"0.5325652",
"0.52738816",
"0.52697426",
"0.52680814",
"0.5212455",
"0.5212455",
"0.5212455",
"0.5212455",
"0.5212455",
"0.51954144",
"0.5085321",
"0.504197... | 0.72980267 | 0 |
The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. | def __init__(__self__, *,
principal_id: str,
tenant_id: str,
type: Optional[str] = None,
user_assigned_identities: Optional[Mapping[str, 'outputs.UserAssignedIdentitiesResponseUserAssignedIdentities']] = None):
pulumi.set(__self__, "principal_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disk_encryption_set_id(self) -> Optional[str]:\n return pulumi.get(self, \"disk_encryption_set_id\")",
"def managed_identity(self) -> Optional[pulumi.Input['AccountEncryptionManagedIdentityArgs']]:\n return pulumi.get(self, \"managed_identity\")",
"def managed_identity(self) -> Optional[pulum... | [
"0.734225",
"0.72906536",
"0.7200173",
"0.7051155",
"0.6618556",
"0.6527936",
"0.6446703",
"0.63939327",
"0.6265255",
"0.6233526",
"0.6145301",
"0.6071108",
"0.60577595",
"0.60577595",
"0.6057473",
"0.60484695",
"0.60315526",
"0.59669363",
"0.59595484",
"0.5938045",
"0.593804... | 0.0 | -1 |
The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the xmsidentityprincipalid header in the PUT request if the resource has a systemAssigned(implicit) identity | def principal_id(self) -> str:
return pulumi.get(self, "principal_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_id(self) -> str:\n return pulumi.get(self, \"object_id\")",
"def object_id(self) -> str:\n return pulumi.get(self, \"object_id\")",
"def object_id(self) -> str:\n return pulumi.get(self, \"object_id\")",
"def object_id(self) -> str:\n return pulumi.get(self, \"object_id... | [
"0.68534917",
"0.68534917",
"0.68534917",
"0.68534917",
"0.68534917",
"0.66299736",
"0.6544208",
"0.6534978",
"0.6534978",
"0.6534978",
"0.6534978",
"0.6534978",
"0.6534978",
"0.6534978",
"0.6534978",
"0.6534978",
"0.65301794",
"0.65146214",
"0.63985604",
"0.62548584",
"0.624... | 0.60411865 | 43 |
The tenant id of the Managed Identity Resource. This will be sent to the RP from ARM via the xmsclienttenantid header in the PUT request if the resource has a systemAssigned(implicit) identity | def tenant_id(self) -> str:
return pulumi.get(self, "tenant_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tenant_id(self) -> Optional[str]:\n return pulumi.get(self, \"tenant_id\")",
"def tenant_id(self) -> Optional[str]:\n return pulumi.get(self, \"tenant_id\")",
"def tenant_id(self) -> Optional[str]:\n return pulumi.get(self, \"tenant_id\")",
"def tenant_id(self) -> Optional[str]:\n ... | [
"0.68714225",
"0.68714225",
"0.68711686",
"0.6870643",
"0.6870643",
"0.6870643",
"0.6870643",
"0.6870643",
"0.6870643",
"0.6870643",
"0.6870643",
"0.6870643",
"0.6870643",
"0.6870643",
"0.6870643",
"0.6870643",
"0.6870578",
"0.68239534",
"0.66443324",
"0.66443324",
"0.6644332... | 0.7138232 | 14 |
The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys. | def type(self) -> Optional[str]:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity_type(self) -> Optional[pulumi.Input['CmkIdentityType']]:\n return pulumi.get(self, \"identity_type\")",
"def identity_type(self) -> Optional[pulumi.Input[Union[str, 'CmkIdentityType']]]:\n return pulumi.get(self, \"identity_type\")",
"def disk_encryption_set_id(self) -> Optional[str]... | [
"0.6609064",
"0.6521782",
"0.63707805",
"0.6291998",
"0.6147107",
"0.6042622",
"0.5987596",
"0.5834811",
"0.5834811",
"0.56671125",
"0.5599198",
"0.55549896",
"0.5407972",
"0.5407972",
"0.5372933",
"0.5349569",
"0.53385925",
"0.52966934",
"0.5265651",
"0.5260442",
"0.5234354"... | 0.0 | -1 |
Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. | def enabled(self) -> bool:
return pulumi.get(self, "enabled") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle_encryption(self):\n value = not self.encryption\n msg = ChangeSettingsRequest(\"encryption\", value)\n sendmsg(self.socket, msg)\n (rid, msg) = recvmsg(self.socket)\n if rid != MsgType.ChangeSettingsResponse:\n return False\n self.encryption = value\n... | [
"0.65139693",
"0.6163395",
"0.61560357",
"0.5733723",
"0.56316614",
"0.55811423",
"0.5550076",
"0.54744273",
"0.54744273",
"0.5429366",
"0.53695345",
"0.53084093",
"0.5181353",
"0.51136863",
"0.50992775",
"0.50992775",
"0.5030163",
"0.5019979",
"0.4995351",
"0.49691558",
"0.4... | 0.0 | -1 |
Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption. | def encryption_settings_version(self) -> Optional[str]:
return pulumi.get(self, "encryption_settings_version") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"encrypt_type\")",
"def disk_type(self) -> ConfigDetail:\n return self._disk_type",
"def get_encryption_type_number(self, enctype):\n return encryption_type_number(enctype)",
"def disk_encryptions(self) -> ... | [
"0.6469047",
"0.6206455",
"0.614049",
"0.6083234",
"0.60763437",
"0.60378546",
"0.60378546",
"0.6031672",
"0.5997026",
"0.5990745",
"0.5990745",
"0.5893297",
"0.58619756",
"0.58619756",
"0.5838522",
"0.5828401",
"0.5761963",
"0.5760769",
"0.5739596",
"0.5711155",
"0.5702655",... | 0.5824092 | 16 |
Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. | def key_encryption_key(self) -> Optional['outputs.KeyVaultAndKeyReferenceResponse']:
return pulumi.get(self, "key_encryption_key") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_encryption_key_identity(self) -> Optional[pulumi.Input['ClusterPropertiesKeyEncryptionKeyIdentityArgs']]:\n return pulumi.get(self, \"key_encryption_key_identity\")",
"def key_encryption_key_identity(self) -> Optional[pulumi.Input['CustomerManagedKeyEncryptionPropertiesKeyEncryptionKeyIdentityArgs... | [
"0.6399964",
"0.6350824",
"0.6271461",
"0.6271461",
"0.62489164",
"0.62260145",
"0.608724",
"0.6073998",
"0.5982236",
"0.5981999",
"0.5971733",
"0.5947391",
"0.59319085",
"0.5919278",
"0.5876062",
"0.58595717",
"0.58",
"0.56119865",
"0.5514396",
"0.5454225",
"0.54455405",
"... | 0.7028438 | 0 |
Fully versioned Key Url pointing to a key in KeyVault. Version segment of the Url is required regardless of rotationToLatestKeyVersionEnabled value. | def key_url(self) -> str:
return pulumi.get(self, "key_url") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_url(key):\n return f\"{current_app.config.get('S3_HOSTNAME')}/{S3.get_bucket_for_file_key(key)}/{key}\"",
"def get_key(cls, url):\n digest = md5(url.encode()).hexdigest()\n return f\"u/{digest[:cls.key_length]}\"",
"def keyvault_uri(self) -> Optional[str]:\n kv_uri = se... | [
"0.6182463",
"0.6099788",
"0.60942096",
"0.60529435",
"0.6039938",
"0.6039938",
"0.60256845",
"0.59712917",
"0.5949195",
"0.5945554",
"0.5934126",
"0.5905744",
"0.5892142",
"0.5876144",
"0.5834402",
"0.5834402",
"0.5829113",
"0.5818236",
"0.57820475",
"0.57667416",
"0.5765143... | 0.7261742 | 1 |
Resource id of the KeyVault containing the key or secret. This property is optional and cannot be used if the KeyVault subscription is not the same as the Disk Encryption Set subscription. | def source_vault(self) -> Optional['outputs.SourceVaultResponse']:
return pulumi.get(self, "source_vault") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_vault_id(self) -> Optional[str]:\n return pulumi.get(self, \"key_vault_id\")",
"def key_vault_id(self) -> str:\n return pulumi.get(self, \"key_vault_id\")",
"def key_vault_id(self) -> str:\n return pulumi.get(self, \"key_vault_id\")",
"def key_vault_key_id(self) -> Optional[pulum... | [
"0.7657039",
"0.74500155",
"0.7448311",
"0.71842086",
"0.71842086",
"0.70963514",
"0.6955791",
"0.6955791",
"0.6955791",
"0.6955791",
"0.6955791",
"0.6955791",
"0.6955791",
"0.6955791",
"0.69192874",
"0.6764578",
"0.6764578",
"0.6764578",
"0.6764578",
"0.6764578",
"0.6764578"... | 0.0 | -1 |
Resource id of the KeyVault containing the key or secret | def source_vault(self) -> 'outputs.SourceVaultResponse':
return pulumi.get(self, "source_vault") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_vault_id(self) -> str:\n return pulumi.get(self, \"key_vault_id\")",
"def key_vault_id(self) -> str:\n return pulumi.get(self, \"key_vault_id\")",
"def key_vault_id(self) -> Optional[str]:\n return pulumi.get(self, \"key_vault_id\")",
"def key_vault_key_id(self) -> pulumi.Output[... | [
"0.79741853",
"0.7973271",
"0.7661042",
"0.7260473",
"0.7234491",
"0.7234491",
"0.7130827",
"0.7130827",
"0.7130827",
"0.7130827",
"0.7130827",
"0.6939571",
"0.6939571",
"0.6939571",
"0.6939571",
"0.6939571",
"0.6939571",
"0.6939571",
"0.6939571",
"0.68144643",
"0.6813749",
... | 0.0 | -1 |
Resource id of the KeyVault containing the key or secret | def source_vault(self) -> 'outputs.SourceVaultResponse':
return pulumi.get(self, "source_vault") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_vault_id(self) -> str:\n return pulumi.get(self, \"key_vault_id\")",
"def key_vault_id(self) -> str:\n return pulumi.get(self, \"key_vault_id\")",
"def key_vault_id(self) -> Optional[str]:\n return pulumi.get(self, \"key_vault_id\")",
"def key_vault_key_id(self) -> pulumi.Output[... | [
"0.7973037",
"0.79721135",
"0.76602906",
"0.7259446",
"0.72333",
"0.72333",
"0.71293813",
"0.71293813",
"0.71293813",
"0.71293813",
"0.71293813",
"0.69385916",
"0.69385916",
"0.69385916",
"0.69385916",
"0.69385916",
"0.69385916",
"0.69385916",
"0.69385916",
"0.6812787",
"0.68... | 0.0 | -1 |
The provisioning state of the private endpoint connection resource. | def provisioning_state(self) -> str:
return pulumi.get(self, "provisioning_state") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private_link_service_connection_state(self) -> 'outputs.PrivateLinkServiceConnectionStatePropertyResponse':\n return pulumi.get(self, \"private_link_service_connection_state\")",
"def private_link_service_connection_state(self) -> 'outputs.PrivateLinkServiceConnectionStateResponse':\n return pu... | [
"0.688958",
"0.68424946",
"0.68424946",
"0.67840075",
"0.6756772",
"0.6656034",
"0.6656034",
"0.6656034",
"0.6656034",
"0.6656034",
"0.6656034",
"0.6656034",
"0.6656034",
"0.6656034",
"0.6656034",
"0.6656034",
"0.6656034",
"0.6656034",
"0.6656034",
"0.6656034",
"0.65973026",
... | 0.6708338 | 22 |
Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. | def status(self) -> Optional[str]:
return pulumi.get(self, "status") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n\n return self.comm_handler.is_alive()",
"def check_connection(self):\n return self.exchange.is_open()",
"def check_connection(self):\n return self.exchange.is_open()",
"def status(self):\n connection = self.connection()\n\n # the connection instance was ... | [
"0.65682167",
"0.6428554",
"0.6428554",
"0.63785017",
"0.6277189",
"0.6269522",
"0.6194424",
"0.6189775",
"0.6180857",
"0.61433977",
"0.61382276",
"0.6105541",
"0.608689",
"0.60792524",
"0.60106933",
"0.5998386",
"0.59918106",
"0.5951276",
"0.5951276",
"0.59432834",
"0.593528... | 0.0 | -1 |
Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. | def product(self) -> str:
return pulumi.get(self, "product") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product(self, product):\n\n self._product = product",
"def product(self, product):\n\n self._product = product",
"def click_product_photo(self) -> None:\n self._driver.find_element(*LocatorsProductPage.PHOTO).click()",
"def add_product_image(self, product_id, url, priority):\n ... | [
"0.6024698",
"0.6024698",
"0.5835141",
"0.582764",
"0.5801435",
"0.57127935",
"0.56445545",
"0.5636868",
"0.5562603",
"0.55273354",
"0.5526851",
"0.5526184",
"0.54957294",
"0.54844266",
"0.5417627",
"0.5403321",
"0.5391664",
"0.5355225",
"0.53294367",
"0.5309331",
"0.5287949"... | 0.5808402 | 5 |
The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot | def __init__(__self__, *,
tier: str,
name: Optional[str] = None):
pulumi.set(__self__, "tier", tier)
if name is not None:
pulumi.set(__self__, "name", name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sku_name(self) -> str:\n return pulumi.get(self, \"sku_name\")",
"def sku(self) -> str:\n return pulumi.get(self, \"sku\")",
"def sku(self) -> Optional[str]:\n return pulumi.get(self, \"sku\")",
"def sku(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"sku\")... | [
"0.7964049",
"0.765494",
"0.7640391",
"0.7334931",
"0.7329208",
"0.7329208",
"0.71154034",
"0.69953823",
"0.69953823",
"0.69595575",
"0.69289875",
"0.6928593",
"0.6807006",
"0.6807006",
"0.6807006",
"0.6784282",
"0.66933167",
"0.6660625",
"0.66543293",
"0.66543293",
"0.66012"... | 0.0 | -1 |
CPU architecture supported by an OS disk. | def architecture(self) -> Optional[str]:
return pulumi.get(self, "architecture") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def os_architecture(self):\n return self._os_architecture",
"def host_architecture(self):\n return self._host_architecture",
"def architecture(self):\n return self.config[\"architecture\"].lower()",
"def getarch(self):\n arch = \"unknown\"\n bits = 32\n out = self.execut... | [
"0.73276246",
"0.7207078",
"0.71109486",
"0.71086997",
"0.7101419",
"0.69768256",
"0.68540406",
"0.6738304",
"0.6729444",
"0.67221797",
"0.6685286",
"0.6684585",
"0.6653653",
"0.65996224",
"0.65494686",
"0.6481555",
"0.6367822",
"0.63590926",
"0.63570166",
"0.6322366",
"0.627... | 0.6298347 | 20 |
The client id of user assigned identity. | def client_id(self) -> str:
return pulumi.get(self, "client_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_id(self) -> Any:\n return pulumi.get(self, \"client_id\")",
"def client_id(self) -> Any:\n return pulumi.get(self, \"client_id\")",
"def client_id(self) -> Any:\n return pulumi.get(self, \"client_id\")",
"def client_id(self) -> Any:\n return pulumi.get(self, \"client_id... | [
"0.8532204",
"0.8532204",
"0.8532204",
"0.8532204",
"0.8532204"
] | 0.0 | -1 |
The principal id of user assigned identity. | def principal_id(self) -> str:
return pulumi.get(self, "principal_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def principal_id(self) -> Optional[str]:\n return pulumi.get(self, \"principal_id\")",
"def principal_id(self) -> Optional[str]:\n return pulumi.get(self, \"principal_id\")",
"def principal_id(self) -> Optional[str]:\n return pulumi.get(self, \"principal_id\")",
"def principal_id(self) -... | [
"0.8560814",
"0.8560814",
"0.8559605",
"0.8559605",
"0.8559605",
"0.8559605",
"0.8559605",
"0.8559605",
"0.8559605",
"0.8559605",
"0.8559605",
"0.85594076",
"0.85594076",
"0.85594076",
"0.85594076",
"0.82570195",
"0.82570195",
"0.8241308",
"0.7947902",
"0.76903385",
"0.761222... | 0.8872615 | 13 |
Creates a 2D Numpy array view for a given SDL surface. This function casts the surface pixels to a 2D Numpy array view, providing read and write access to the underlying surface. If the source surface is RLEaccelerated, it will be locked automatically when the view is created | def pixels2d(source, transpose=True):
sf, sz, shape, dtype, strides = _ndarray_prep(source, "pixels2d", ndim=2)
if SDL_MUSTLOCK(sf):
SDL_LockSurface(sf)
pxbuf = ctypes.cast(sf.pixels, ctypes.POINTER(ctypes.c_ubyte * sz))
arr = SurfaceArray(
shape, dtype, pxbuf.contents, 0, strides, "C",... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def surface_to_ndarray(source, ndim=3):\n if ndim not in [2, 3]:\n err = \"Can only convert surfaces to 2D or 3D arrays (got {0}).\"\n raise ValueError(err.format(ndim))\n funcname = \"surface_to_array\"\n sf, sz, shape, dtype, strides = _ndarray_prep(source, funcname, ndim)\n was_unlocke... | [
"0.6715227",
"0.6439919",
"0.5899816",
"0.54848593",
"0.54797226",
"0.54578155",
"0.5446588",
"0.54437566",
"0.5419765",
"0.5399871",
"0.53717136",
"0.5352147",
"0.53063023",
"0.5295301",
"0.5276294",
"0.5232571",
"0.52051455",
"0.5183312",
"0.516387",
"0.5141149",
"0.5105447... | 0.6625707 | 1 |
Does given dict of attibvals match with self data? >>> db = DbProfile('MP', 'RDxETL', 'prod', 'usfshwssql077') Is it dev etl? >>> print db.match_attrib(dict(env='dev', dbname='RDxETL')) False Is it MP app prod etl on usfshwssql077? >>> print db.match_attrib(dict(app='MP', env='prod', dbname='RDxETL', boxname='usfshwssq... | def match_attrib(self, aDict):
for k, v in aDict.iteritems() :
if not (vars(self)[k] == v) :
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matchattrs(specimen, desired):\n for name, value in desired.items():\n name = name.rstrip('_').replace('_', '-')\n if value is MISSING:\n if name in specimen:\n return 0\n else:\n if not (name in specimen and matchcontent(specimen[name], value)):\n ... | [
"0.6193644",
"0.6037636",
"0.5969355",
"0.5948418",
"0.59177065",
"0.59048367",
"0.58105516",
"0.57891107",
"0.5658175",
"0.56172",
"0.56039476",
"0.5598394",
"0.55914146",
"0.55871594",
"0.5581847",
"0.55381626",
"0.5508449",
"0.5494549",
"0.54857063",
"0.5478932",
"0.547424... | 0.7550907 | 0 |
Converts a dense representation of model decoded output into human readable, using a mapping from indices to labels. | def dense_to_human_readable(dense_repr: Sequence[Sequence[int]], index_to_label: Dict[int, str]) -> List[List[str]]:
transcripts = []
for dense_r in dense_repr:
non_empty_phonemes = [phn_i for phn_i in dense_r if phn_i != 0]
transcript = [index_to_label[index] for index in non_empty_phonemes]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode(self, output_dict: Dict[str, torch.Tensor]) -> Dict[str, torch.Tensor]:\n predict = output_dict[\"predict\"]\n # argmax_indices = np.argmax(predict, axis=-1)\n labels = [self.vocab.get_token_from_index(x, namespace=\"labels\")\n for x in predict]\n output_dic... | [
"0.6567911",
"0.612723",
"0.59623754",
"0.5881409",
"0.58732253",
"0.5805699",
"0.5799938",
"0.5736477",
"0.57304823",
"0.5703607",
"0.56296337",
"0.55392903",
"0.55179894",
"0.5517013",
"0.5494933",
"0.5480892",
"0.5470096",
"0.546909",
"0.54636306",
"0.5421558",
"0.5412144"... | 0.6709607 | 0 |
r"""Call the list operations method over HTTP. | def __call__(
self,
request: operations_pb2.ListOperationsRequest,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operations_pb2.ListOperationsResponse:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(self, *args, **kwargs):\n kwargs['methods'] = ['GET']\n return self.flexible_route('/', *args, **kwargs)",
"def get(self, request, *args, **kwargs):\r\n return self.list(request, *args, **kwargs)",
"def get(self, request, *args, **kwargs):\r\n return self.list(request, *args, **kwa... | [
"0.74813336",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
"0.7384019",
... | 0.0 | -1 |
Test Operator representation string property. | def test_rep(self):
op = Operator(self.rand_matrix(2, 2))
self.assertEqual(op.rep, 'Operator') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operator_string(self):\n return self._operator_string",
"def test_str(self):\n \n term = MinimalOboTerm()\n term.parse(\"id: ABC:002\")\n term.parse(\"name: child_A\")\n result = str(term)\n self.assertTrue(\"ABC\" in result)\n self.assertFalse(\"child_... | [
"0.7271958",
"0.6269821",
"0.6212002",
"0.61917204",
"0.61502296",
"0.6150123",
"0.6127241",
"0.6039207",
"0.60209024",
"0.6012034",
"0.5978762",
"0.59726757",
"0.59581167",
"0.59581167",
"0.59581167",
"0.59581167",
"0.59581167",
"0.59581167",
"0.59568644",
"0.59522045",
"0.5... | 0.0 | -1 |
Test Operator representation string property. | def test_data(self):
mat = self.rand_matrix(2, 2)
op = Operator(mat)
self.assertAllClose(mat, op.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operator_string(self):\n return self._operator_string",
"def test_str(self):\n \n term = MinimalOboTerm()\n term.parse(\"id: ABC:002\")\n term.parse(\"name: child_A\")\n result = str(term)\n self.assertTrue(\"ABC\" in result)\n self.assertFalse(\"child_... | [
"0.7271958",
"0.6269821",
"0.6212002",
"0.61917204",
"0.61502296",
"0.6150123",
"0.6127241",
"0.6039207",
"0.60209024",
"0.6012034",
"0.5978762",
"0.59726757",
"0.59581167",
"0.59581167",
"0.59581167",
"0.59581167",
"0.59581167",
"0.59581167",
"0.59568644",
"0.59522045",
"0.5... | 0.0 | -1 |
Perform an HTTP DELETE request for a given url. Returns the response object. | def delete(self, url, headers=None):
return self._request('DELETE', url, headers=headers) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self, url: str, **kwargs: Any) -> Response:\n return self.request(\"DELETE\", url, **kwargs)",
"def _delete(self, url):\n r = requests.delete(self._api_prefix + url, headers=self.headers, auth=self.auth, allow_redirects=False,)\n return self._action(r)",
"async def _delete_reque... | [
"0.8502721",
"0.8212742",
"0.81409293",
"0.8018686",
"0.78853446",
"0.7860362",
"0.7852779",
"0.7824349",
"0.78125983",
"0.7798474",
"0.7646816",
"0.7621143",
"0.7575383",
"0.7542325",
"0.7463533",
"0.73788863",
"0.7165297",
"0.71016383",
"0.6963758",
"0.6943299",
"0.68309355... | 0.83863515 | 1 |
Tests the use of constants.STOP_AT_END_OF_GRAPH as a stop depth. | def test_graph_wide_traversal(self):
nodes = [self.gdb.nodes.create() for i in range(10)]
# Chain them into a linked list
last = None
for n in nodes:
if last is not None:
last.relationships.create("Knows", n)
last = n
# Toss in a di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(data, depth):\n labels = set()\n for point in data:\n labels.add(point.label)\n if len(labels) <= 1 or depth >= 10 or imp(data) < 0.3:\n return True\n return False",
"def test_right_stop_1(g, v):\n assert right_stop(g) == v",
"def test_right_stop_2(g, v):\n assert right... | [
"0.6732601",
"0.6264546",
"0.6102869",
"0.5791698",
"0.5767333",
"0.57588077",
"0.5675465",
"0.5554551",
"0.5477849",
"0.54508907",
"0.54344076",
"0.54051894",
"0.5358886",
"0.5343331",
"0.5319558",
"0.5314924",
"0.5292108",
"0.5292036",
"0.52858126",
"0.52829826",
"0.5266574... | 0.50249714 | 44 |
Inverse transform is impossible, just identity to avoid errors. | def test_inverse_transform(self):
t = r.SelectTransformer()
df_in = create_df_all()
df_out = t.inverse_transform(df_in)
self.assertTrue(df_in.equals(df_out)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inverse_transform(self, X):\n ...",
"def inverse(self):\n return Transform(matrix=numpy.linalg.inv(self.matrix))",
"def inverse(self):\n pass",
"def _inverse(self):\n\t\trotation_matrix = self.pose_mat[:3,:3]\n\t\ttranslation_vector = self.pose_mat[:3,3]\n\t\t\n\t\trot = np.transpose... | [
"0.8274291",
"0.7931224",
"0.79137254",
"0.7905067",
"0.78986984",
"0.78986984",
"0.7869401",
"0.7867279",
"0.7853986",
"0.7835712",
"0.77984357",
"0.77984357",
"0.7649894",
"0.75801545",
"0.75379914",
"0.74451464",
"0.7404155",
"0.7383431",
"0.73396546",
"0.73133004",
"0.724... | 0.0 | -1 |
Inverse transform is impossible, we cannot create columns. To avoid an error in the pipeline (nonexisting inverse transform method), check that the inverse transform returns df. | def test_inverse_transform(self):
t = r.DropTransformer()
df_in = create_df_all()
df_out = t.inverse_transform(df_in)
self.assertTrue(df_in.equals(df_out)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_inverse_transform(self):\n\n t = r.SelectTransformer()\n df_in = create_df_all()\n df_out = t.inverse_transform(df_in)\n self.assertTrue(df_in.equals(df_out))",
"def test_inverse_transform(self):\n\n t = r.ColumnGroupsTransformer()\n t._transform_group = MagicMo... | [
"0.7700167",
"0.7299445",
"0.7107593",
"0.7074537",
"0.6972632",
"0.6968574",
"0.6951024",
"0.69441533",
"0.6929526",
"0.6918751",
"0.68990386",
"0.68774706",
"0.6870205",
"0.6866043",
"0.685567",
"0.68406075",
"0.6806999",
"0.67833257",
"0.6775489",
"0.676047",
"0.6687286",
... | 0.76690084 | 1 |
Check the name of the columns after applying onehot encoding. We are not taking into account the order of the columns for this test. | def test_onehot_columns_names(self):
df1 = create_df_cat()
t = r.recipipe() + r.onehot()
df2 = t.fit_transform(df1)
expected = ["color=red", "color=blue"]
self.assertCountEqual(df2.columns, expected) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_onehot_columns_names_underscore(self):\n\n df1 = create_df_cat()\n df1.columns = [\"my_color\"]\n t = r.recipipe() + r.onehot()\n df2 = t.fit_transform(df1)\n expected = [\"my_color=red\", \"my_color=blue\"]\n self.assertCountEqual(df2.columns, expected)",
"def ... | [
"0.75955015",
"0.7537789",
"0.72216797",
"0.7120989",
"0.70718354",
"0.702167",
"0.69440484",
"0.69411427",
"0.6879036",
"0.68660754",
"0.68332577",
"0.6783821",
"0.6726288",
"0.6688963",
"0.66168016",
"0.6601387",
"0.65993977",
"0.65836966",
"0.64580435",
"0.64493126",
"0.63... | 0.7812749 | 0 |
Check the values of a column after applying onehot encoding. The order of the resulting columns should be first the blue color and second the red color (alphabetically sorted). This test does not check the column names, only the values. | def test_onehot_columns_values(self):
df1 = create_df_cat()
t = r.recipipe() + r.onehot()
df2 = t.fit_transform(df1)
# Ignore the column names, we assign a new ones.
df2.columns = ["color_blue", "color_red"]
expected1 = pd.DataFrame({
"color_blue": [0., 1, 0]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(df, col):\n\n df_final = pd.get_dummies(data=df, columns=col, drop_first=True)\n\n return(df_final)",
"def test_onehot_columns_names_and_values(self):\n\n df1 = create_df_cat()\n t = r.recipipe() + r.onehot()\n df2 = t.fit_transform(df1)\n expected = pd.DataFr... | [
"0.7697663",
"0.755715",
"0.7219282",
"0.7160354",
"0.7121797",
"0.7092605",
"0.7050425",
"0.69689155",
"0.6907134",
"0.68967474",
"0.6884571",
"0.6881263",
"0.6870469",
"0.68606186",
"0.6843079",
"0.6842017",
"0.68363",
"0.67957795",
"0.67692673",
"0.6750431",
"0.67452455",
... | 0.7647291 | 1 |
Check the output dataframe after applying onehot encoding. For passing this test the order of the resulting columns does not matter. | def test_onehot_columns_names_and_values(self):
df1 = create_df_cat()
t = r.recipipe() + r.onehot()
df2 = t.fit_transform(df1)
expected = pd.DataFrame({
"color=red": [1., 0, 1],
"color=blue": [0., 1, 0]
})
self.assertTrue(expected.eq(df2).all().al... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_onehottransform(self):\n transformed = self.transformer.fit_transform(self.test_df)\n expected = pd.DataFrame({\n 'c_a': [1.0, 0.0, 0.0],\n 'c_b': [0.0, 1.0, 0.0],\n 'c_c': [0.0, 0.0, 1.0]\n })\n self.assertTrue(transformed.equals(expected))",
... | [
"0.8153413",
"0.7921281",
"0.76103455",
"0.76055336",
"0.74492633",
"0.741917",
"0.74123996",
"0.73908085",
"0.7309887",
"0.729502",
"0.7259803",
"0.72411245",
"0.7211655",
"0.7202879",
"0.71855783",
"0.71644527",
"0.7154855",
"0.7136916",
"0.71246076",
"0.70627946",
"0.70327... | 0.7794561 | 2 |
Test onehot over dataframes with more than 2 category columns. The output dataframe should contain the columns in the same order. In this example, first all the gender onehot columns and second all the color columns. As before, the onehot columns of one column should be ordered alphabetically. | def test_onehot_two_columns(self):
df1 = create_df_cat2()
t = r.recipipe() + r.onehot()
df2 = t.fit_transform(df1)
expected = pd.DataFrame({
"gender=female": [1., 0, 0],
"gender=male": [0., 1, 1],
"color=blue": [0., 1, 0],
"color=red": [1.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_onehot_one_of_two_columns_first(self):\n\n df1 = create_df_cat2()\n # Check that the fixture df is in the expected order.\n self.assertListEqual(list(df1.columns), [\"gender\", \"color\"])\n\n t = r.recipipe() + r.onehot([\"gender\"])\n df2 = t.fit_transform(df1)\n ... | [
"0.81869775",
"0.8095416",
"0.79238254",
"0.78378385",
"0.78010875",
"0.77830386",
"0.7761437",
"0.76790977",
"0.7437498",
"0.7419118",
"0.7281379",
"0.7192756",
"0.71919316",
"0.71277523",
"0.7121197",
"0.7047245",
"0.6984468",
"0.6966838",
"0.6955604",
"0.68731874",
"0.6801... | 0.78098685 | 4 |
Apply onehot only to one column, the last one on the input df. The nononehotencoded column should be in the output dataframe. | def test_onehot_one_of_two_columns_last(self):
df1 = create_df_cat2()
t = r.recipipe() + r.onehot(["color"])
df2 = t.fit_transform(df1)
expected = pd.DataFrame({
"gender": ["female", "male", "male"],
"color=blue": [0., 1, 0],
"color=red": [1., 0, 1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(df, col):\n\n df_final = pd.get_dummies(data=df, columns=col, drop_first=True)\n\n return(df_final)",
"def one_hot(df, cols):\n for each in cols:\n dummies = pd.get_dummies(df[each], prefix=each, drop_first=False)\n del df[each]\n df = pd.concat([df, dummies], axi... | [
"0.8399947",
"0.8038773",
"0.8018331",
"0.7989123",
"0.79673916",
"0.79244167",
"0.79243493",
"0.79013175",
"0.78609896",
"0.77836686",
"0.77710843",
"0.77612865",
"0.77590907",
"0.7754545",
"0.7692417",
"0.769233",
"0.7614837",
"0.75920695",
"0.73752624",
"0.7352555",
"0.727... | 0.68280107 | 69 |
Apply onehot only to one column, the first one on the input df. The nononehotencoded column should be in the output dataframe and exactly in the same order. | def test_onehot_one_of_two_columns_first(self):
df1 = create_df_cat2()
# Check that the fixture df is in the expected order.
self.assertListEqual(list(df1.columns), ["gender", "color"])
t = r.recipipe() + r.onehot(["gender"])
df2 = t.fit_transform(df1)
expected = pd.Dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(df, col):\n\n df_final = pd.get_dummies(data=df, columns=col, drop_first=True)\n\n return(df_final)",
"def one_hot(df, cols):\n for each in cols:\n dummies = pd.get_dummies(df[each], prefix=each, drop_first=False)\n del df[each]\n df = pd.concat([df, dummies], axi... | [
"0.8410364",
"0.8032313",
"0.8014018",
"0.79862624",
"0.7983934",
"0.78942335",
"0.78849876",
"0.78590846",
"0.78528583",
"0.7834907",
"0.782543",
"0.774534",
"0.77207017",
"0.7705775",
"0.7678825",
"0.7663122",
"0.76179",
"0.7567312",
"0.7350757",
"0.73216355",
"0.7294903",
... | 0.6864048 | 66 |
Apply onehot to two columns, once at a time. | def test_onehot_two_columns_two_steps(self):
df1 = create_df_cat2()
t = r.recipipe() + r.onehot(["color"]) + r.onehot(["gender"])
df2 = t.fit_transform(df1)
expected = pd.DataFrame({
"gender=female": [1., 0, 0],
"gender=male": [0., 1, 1],
"color=blue"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(df, cols):\n for each in cols:\n dummies = pd.get_dummies(df[each], prefix=each, drop_first=False)\n df = pd.concat([df, dummies], axis=1)\n return df",
"def one_hot(df, cols):\n for each in cols:\n dummies = pd.get_dummies(df[each], prefix=each, drop_first=False)\n ... | [
"0.7432456",
"0.7287664",
"0.7070082",
"0.7033292",
"0.7033292",
"0.7003652",
"0.69910336",
"0.6990016",
"0.69745415",
"0.6972289",
"0.6904031",
"0.68927044",
"0.6801017",
"0.67986614",
"0.6796304",
"0.67829835",
"0.6782209",
"0.6776913",
"0.67636067",
"0.67625904",
"0.675143... | 0.6775011 | 18 |
Apply onehot to two columns at the same time. The order of the output columns is given by the input dataset, not by the order of the list passed to the one hot transformer. | def test_onehot_two_columns_one_step(self):
df1 = create_df_cat2()
t = r.recipipe() + r.onehot(["color", "gender"])
df2 = t.fit_transform(df1)
expected = pd.DataFrame({
"gender=female": [1., 0, 0],
"gender=male": [0., 1, 1],
"color=blue": [0., 1, 0],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(df, cols):\n for each in cols:\n dummies = pd.get_dummies(df[each], prefix=each, drop_first=False)\n df = pd.concat([df, dummies], axis=1)\n return df",
"def one_hot(df, cols):\n for each in cols:\n dummies = pd.get_dummies(df[each], prefix=each, drop_first=False)\n ... | [
"0.71575844",
"0.70190024",
"0.7012535",
"0.6957706",
"0.6833267",
"0.6826406",
"0.68047893",
"0.6789309",
"0.6773795",
"0.6771978",
"0.6770275",
"0.6768243",
"0.67591906",
"0.6747074",
"0.6731411",
"0.6717655",
"0.6717655",
"0.66702294",
"0.6598438",
"0.6583383",
"0.6580081"... | 0.6908447 | 4 |
Check that onehot allows the use of variablelength params. | def test_variable_args(self):
df1 = create_df_cat2()
t = r.recipipe() + r.onehot("color", "gender")
df2 = t.fit_transform(df1)
expected = ["gender=female", "gender=male",
"color=blue", "color=red"]
columns = list(df2.columns)
self.assertEqual(columns,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(a, actions):\n assert 1 == a.shape[-1]\n return (a == t.arange(actions, device=a.device)).to(dtype=t.float)",
"def one_hot(idx, length):\n one_hot = np.zeros(length, dtype=np.bool)\n one_hot[idx] = True\n return one_hot",
"def _one_hot(x, k, dtype=numpy.float32):\n return numpy.arra... | [
"0.62113154",
"0.6198895",
"0.6114842",
"0.60327595",
"0.5985939",
"0.5972682",
"0.58940375",
"0.5684207",
"0.55863404",
"0.5574542",
"0.55549",
"0.5551475",
"0.5543769",
"0.5530157",
"0.55227923",
"0.55187994",
"0.551121",
"0.55109",
"0.55064636",
"0.5505437",
"0.55051035",
... | 0.5255344 | 61 |
Evaluates the density at position x | def __call__ ( self, x ):
out = np.zeros ( x.shape[0], 'd' )
for j in xrange ( self.jmax ):
out += self.b[j]*self.Phi(j, self.scale*(x-self.x0) )
return np.clip ( out/self.scale/self.Z, 0, 1e10 ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def density(self, x):\n raise NotImplementedError",
"def _estimate_density(self, x):\n\n self.density_, self.bins_ = np.histogram(x, bins=10, density=True)",
"def density():\n\tpass",
"def densityRatio(self, x, y, i):\n return 1.0",
"def pdf(self, x):\n\n # Evaluate in standard sp... | [
"0.8273108",
"0.7248483",
"0.7035851",
"0.70215434",
"0.6622168",
"0.65660644",
"0.6516826",
"0.64608413",
"0.64114505",
"0.6340927",
"0.6327453",
"0.6303643",
"0.62612736",
"0.62564605",
"0.62417674",
"0.6229003",
"0.6206961",
"0.617002",
"0.6138083",
"0.6134631",
"0.6123515... | 0.0 | -1 |
Returns a view of a project by sending the relevant params to the time view. | def project(request, project):
return time(request, project=project) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getView(self):\n return getMultiAdapter((self, self.REQUEST), name='project_view')",
"def view_project(project_name):\n\n # None if no page with page_name exists\n project = Project.query.filter_by(user_id=current_user.id, name=project_name).first()\n posts = [post for post in project.posts]\... | [
"0.6583954",
"0.6335881",
"0.6249708",
"0.6098499",
"0.6083511",
"0.6055367",
"0.60501575",
"0.6008119",
"0.5993358",
"0.5964591",
"0.59214187",
"0.58848876",
"0.5879995",
"0.58503246",
"0.5799234",
"0.57651764",
"0.5666592",
"0.5666375",
"0.56661314",
"0.56562436",
"0.563425... | 0.7114203 | 0 |
Returns a view of a month by sending the relevant params to the time view. | def month(request, month):
year, month = [int(x) for x in month.split("-")]
start = datetime(year, month, 1)
end = datetime(year, month, monthrange(year, month)[1]) + timedelta(days=1)
return time(request, start=start, end=end, as_month=start) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def month(request, year, month):\n return HttpResponse(\"Month\")",
"def month_table(request, year=None, month=None):\n today = datetime.now()\n if year:\n year = int(year)\n else:\n year = today.year\n \n if month:\n month = int(month)\n else:\n month = today... | [
"0.7043262",
"0.66807896",
"0.66755223",
"0.6662235",
"0.63859916",
"0.6146809",
"0.60907125",
"0.6052622",
"0.60303366",
"0.6011272",
"0.5948102",
"0.594505",
"0.591632",
"0.59156215",
"0.5855615",
"0.5855504",
"0.58348507",
"0.576731",
"0.574464",
"0.5735997",
"0.57328314",... | 0.673714 | 1 |
The view that sends all projects, sorted by the user's custom sort order. | def projects(request):
projects = Project.by_user_order(request.user)
return render(request, "projects.html", {"projects": projects}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n\n projects = Project.query.filter_by(user_id=current_user.id).order_by(desc(Project.created)).all()\n return render_template('index.html', projects=projects)",
"def myProjects(request):\n\n projects = Project.objects.order_by('-upload_date')\n projects = projects.filter(user_id=request... | [
"0.7392009",
"0.7059676",
"0.6959546",
"0.6849591",
"0.6767853",
"0.6765224",
"0.6752109",
"0.6667029",
"0.6657111",
"0.665276",
"0.65674394",
"0.6547628",
"0.6414472",
"0.6406146",
"0.6400832",
"0.6399097",
"0.639258",
"0.63629943",
"0.63347024",
"0.6328977",
"0.6322197",
... | 0.8111947 | 0 |
convert given image to grayscale image (if needed) and resize to desired height | def prepareImg(img, height):
assert img.ndim in (2, 3)
if img.ndim == 3:
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
h = img.shape[0]
factor = height / h
return cv2.resize(img, dsize=None, fx=factor, fy=factor) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale_image(image):\n\timage = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)\n\tsize = max(image.shape)\n\timage = np.pad(image, (size, size), 'constant', constant_values=(0,0))\n\timage = cv2.resize(image, (100,100))\n\timage = np.reshape(image, (1,10000))\n\treturn image",
"def gray_scale(image):\n return cv2... | [
"0.72206676",
"0.7017505",
"0.6971828",
"0.68715817",
"0.6863891",
"0.6822472",
"0.68073016",
"0.6776609",
"0.6759428",
"0.67584425",
"0.67123705",
"0.66600436",
"0.6632716",
"0.66269064",
"0.6618522",
"0.66081953",
"0.6576944",
"0.65665483",
"0.65603894",
"0.65374935",
"0.65... | 0.70393604 | 1 |
Set the description field on save. | def save(self, *args, **kwargs):
self.meta_description = strip_tags(self.meta_description)
super(MetaData, self).save(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_description(self, description):\n\t\tself.description = description",
"def set_description(self, description):\n self.description = description",
"def set_description(self, description):\n self.description = description",
"def updateDescription(self, descr):\n self.description = ... | [
"0.8074231",
"0.8003818",
"0.8003818",
"0.7910847",
"0.7858154",
"0.78104496",
"0.78104496",
"0.77971333",
"0.7770459",
"0.7760964",
"0.7758888",
"0.77263165",
"0.77263165",
"0.77263165",
"0.77263165",
"0.77263165",
"0.77263165",
"0.77263165",
"0.77263165",
"0.77263165",
"0.7... | 0.7353922 | 97 |
Accessor for the optional ``_meta_title`` field, which returns the string version of the instance if not provided. | def meta_title(self):
return self._meta_title or str(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_title(self):\n return self.get('title', 'NA')",
"def get_title(self):\n return self.display_title and self.title or \"\"",
"def title(self):\n if \"title\" in self._prop_dict:\n return self._prop_dict[\"title\"]\n else:\n return None",
"def title(self... | [
"0.7832949",
"0.77472633",
"0.76909184",
"0.76909184",
"0.76492417",
"0.76434165",
"0.76122963",
"0.7579101",
"0.75481874",
"0.75481874",
"0.75481874",
"0.75384414",
"0.7525104",
"0.7511715",
"0.75091094",
"0.7498454",
"0.7470559",
"0.7464935",
"0.7464935",
"0.7464935",
"0.74... | 0.8484698 | 0 |
Convert time in seconds to time in hours, minutes and seconds e.g. 10239 > (2, 50, 39) | def sec_to_hm(t):
t = int(t)
s = t % 60
t //= 60
m = t % 60
t //= 60
return t, m, s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_conversion(time_seconds):\n hours, remainder = divmod(time_seconds, 3600)\n minutes, seconds = divmod(remainder, 60)\n return hours, minutes, seconds",
"def to_secs(hours,minutes,seconds):\n sec_hour = hours * 60 * 60\n sec_minutes = minutes * 60\n return math.floor(sec_hour + sec_minu... | [
"0.81191146",
"0.7640591",
"0.7632835",
"0.76193166",
"0.7502073",
"0.7497482",
"0.74712586",
"0.74525636",
"0.7418753",
"0.74161965",
"0.73599845",
"0.7332086",
"0.72204643",
"0.72200966",
"0.7165043",
"0.7148393",
"0.7104678",
"0.70995677",
"0.70980495",
"0.7097526",
"0.701... | 0.71317875 | 16 |
Convert time in seconds to a nice string e.g. 10239 > '02h50m39s' | def sec_to_hm_str(t):
h, m, s = sec_to_hm(t)
return "{:02d}h{:02d}m{:02d}s".format(h, m, s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sec_to_str(t):\n return \"%d:%02d:%02d.%03d\" % \\\n reduce(lambda ll, b: divmod(ll[0], b) + ll[1:],\n [(t*1000,), 1000, 60, 60])",
"def time_string(seconds):\n if seconds < 0:\n return \"--\"\n units = [(60*60*24, \"d\"), (60*60, \"h\"), (60, \"m\"), (1, \"s\")]\n pa... | [
"0.83219635",
"0.8040843",
"0.79773885",
"0.7948836",
"0.7902252",
"0.78919053",
"0.78874123",
"0.78773373",
"0.7854949",
"0.7805371",
"0.77381843",
"0.77374536",
"0.7725006",
"0.77181756",
"0.770272",
"0.7690899",
"0.7672688",
"0.7647946",
"0.7637997",
"0.7637191",
"0.763059... | 0.7139656 | 61 |
Returns x and y arrays containing the histogram values for the current image. For an explanation of the return format, see numpy.histogram(). The step argument causes pixels to be skipped when computing the histogram to save time. If step is 'auto', then a step is chosen such that the analyzed data has dimensions rough... | def getHistogram(self, bins='auto', step='auto', targetImageSize=None, targetHistogramSize=500, **kwds):
if self.image is None:
return None, None
if not targetImageSize: targetImageSize = min(200, self.image.shape[0], self.image.shape[1])
if step == 'auto':
step = (np.ceil(self.image.shape... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calcHistogramRange(cls, imgArr, step='auto', targetImageSize=200):\n if imgArr is None or imgArr.size == 0:\n return None, None\n\n if step == 'auto':\n step = (max(1, int(np.ceil(imgArr.shape[0] / targetImageSize))),\n max(1, int(np.ceil(imgArr.shape[1] ... | [
"0.6709116",
"0.6677706",
"0.6158801",
"0.6133089",
"0.6131912",
"0.60467035",
"0.5906064",
"0.58199733",
"0.58035094",
"0.5786652",
"0.5757194",
"0.57490593",
"0.5715812",
"0.5707866",
"0.5658791",
"0.56197846",
"0.55811316",
"0.5574642",
"0.55520177",
"0.5536638",
"0.550268... | 0.78740644 | 0 |
check returns dataframe object, with valid and invalid inputs | def test_(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate(data_frame, info_str=\"\"):\n def isnotfinite(x):\n try:\n return ~np.isfinite(x)\n except TypeError: # most likely string\n try:\n return np.zeros(x.shape, dtype=bool)\n except AttributeError: # single entry\n return n... | [
"0.7438797",
"0.7305141",
"0.7092107",
"0.6865985",
"0.68479395",
"0.67942613",
"0.6708529",
"0.67046654",
"0.6661155",
"0.66545355",
"0.6577104",
"0.6500634",
"0.6499774",
"0.64732563",
"0.6418822",
"0.6418735",
"0.64179003",
"0.6413014",
"0.64126956",
"0.64108735",
"0.63846... | 0.0 | -1 |
Get color of plant for current stage and environment dependant conditions. Return RGB color vector tuple of (int,int,int)). | def get_new_color(self):
new_red = self.color[0]
new_green = self.color[1]
if self.color_step[0] > 0:
new_red = min(self.color[0] + self.color_step[0], self.stopping_color[0])
elif self.color_step[0] < 0:
new_red = max(self.color[0] + self.color_step[0], self.sto... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color(self):\n red = self.main.energy * 255\n green = xmath.int(self.main.gravity * 108)\n blue = xmath.int(self.main.gravity * 108)\n return (red, green, blue)",
"def get_color(self) -> tuple:\n return self._color",
"def getBrickColor(self):\n\t\tcolor = self.colorSensor... | [
"0.6927715",
"0.68282616",
"0.68000954",
"0.67039746",
"0.669501",
"0.66794795",
"0.6640512",
"0.65811384",
"0.652193",
"0.64124763",
"0.6387776",
"0.63857526",
"0.6358401",
"0.6351107",
"0.6334585",
"0.6327959",
"0.6266543",
"0.625327",
"0.62421834",
"0.62329984",
"0.6230125... | 0.60552114 | 38 |
Creates a transforming executor backed by a given target executor. | def __init__(self, transformation_fn, target_executor):
py_typecheck.check_callable(transformation_fn)
py_typecheck.check_type(target_executor, executor_base.Executor)
self._transformation_fn = transformation_fn
self._target_executor = target_executor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_executor(self, create=1):\n try:\n executor = self.executor\n except AttributeError:\n if not create:\n raise\n try:\n act = self.builder.action\n except AttributeError:\n executor = SCons.Executor.Null(t... | [
"0.6150054",
"0.590533",
"0.55897886",
"0.54605836",
"0.5442683",
"0.54118794",
"0.5383449",
"0.5245466",
"0.5245466",
"0.52060467",
"0.51945716",
"0.5152722",
"0.5144539",
"0.5109817",
"0.5088337",
"0.49971977",
"0.49941367",
"0.49898285",
"0.49400875",
"0.49321252",
"0.4905... | 0.67046493 | 0 |
Returns x ^ 1 (mod p) | def inverse_mod(x, p):
return power(x, p-2, p) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pow_mod(power, p):\r\n e = power % (p - 1)\r\n return pow(10, e, p)",
"def modp(n: int, p: int):\n#[SOLUTION]\n ret = 1\n for i in range(n):\n ret = (2 * ret) % p\n return ret",
"def mod_inv(x, P):\n return exp(x, P - 2, P)",
"def __call__(self, x):\n p = type(self).p\n ... | [
"0.76260966",
"0.76158524",
"0.74006855",
"0.7287133",
"0.7267831",
"0.72177553",
"0.7165601",
"0.7101778",
"0.7049677",
"0.70430654",
"0.6926122",
"0.69070965",
"0.69030833",
"0.6884992",
"0.6880694",
"0.68681836",
"0.6816582",
"0.6769727",
"0.6759013",
"0.6711621",
"0.67088... | 0.8283508 | 0 |
Log Errors caused by Updates. | def error(update, context):
logger.warning('Update "%s" caused error "%s"', update, context.error) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(update, context):\n\tlogger.warning('Update \"%s\" caused error \"%s\"', update, context.error)",
"def error(update, context):\n\tlogger.warning('Update \"%s\" caused error \"%s\"', update, context.error)",
"def error(self, update, context):\n self.logger.warning('Update \"%s\" caused error \"... | [
"0.7895345",
"0.7895345",
"0.78250974",
"0.7786856",
"0.77852345",
"0.77852345",
"0.7735361",
"0.7719849",
"0.7709868",
"0.77047676",
"0.7656704",
"0.7654856",
"0.7651028",
"0.7646397",
"0.7637174",
"0.76122314",
"0.7567072",
"0.7566618",
"0.7552811",
"0.75410044",
"0.7541004... | 0.7746668 | 28 |
Return the state attributes. | def extra_state_attributes(self):
attrs: dict[str, Any] = {}
attrs["ventilationRemainingTime"] = self._system.ventilationRemainingTime
attrs["ventilatingUntilTime"] = self._system.ventilatingUntilTime
attrs["diagVentilationRuntime"] = self._system.diagVentilationRuntime
return at... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_attributes(self):\n return self.state_attr",
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def device_state_attributes(self):\n\t\treturn self._attributes",
"def device_state_attributes(self):\n\t\treturn se... | [
"0.90660733",
"0.8953404",
"0.8953404",
"0.84512126",
"0.8404328",
"0.8334551",
"0.8334551",
"0.8326927",
"0.8289349",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.... | 0.7540462 | 69 |
Return the state attributes. | def extra_state_attributes(self):
return {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_attributes(self):\n return self.state_attr",
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def device_state_attributes(self):\n\t\treturn self._attributes",
"def device_state_attributes(self):\n\t\treturn se... | [
"0.90660733",
"0.8953404",
"0.8953404",
"0.84512126",
"0.8404328",
"0.8334551",
"0.8334551",
"0.8326927",
"0.8289349",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.... | 0.7593805 | 65 |
This tests the get request and assert the response code is 200 The request has succeeded | def test_home_route_get():
rv = app.test_client().get('/')
assert rv.status_code == 200
assert b'<h1>Welcome to the site</h1>' in rv.data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get(self):\n self.assertEqual(200, self.resp.status_code)",
"def test_get(self):\n self.assertEqual(200, self.resp.status_code)",
"def test_get(self):\n self.assertEqual(200, self.resp.status_code)",
"def test_get(self):\n self.assertEqual(200, self.resp.status_code)",
... | [
"0.8820726",
"0.8820726",
"0.8820726",
"0.8820726",
"0.8820726",
"0.8820726",
"0.8820726",
"0.8820726",
"0.8820726",
"0.8820726",
"0.8820726",
"0.8820726",
"0.86488616",
"0.86488616",
"0.86488616",
"0.8454995",
"0.8444663",
"0.84366226",
"0.84366226",
"0.813927",
"0.80233675"... | 0.0 | -1 |
This is another test checking if the response is 200 for the endpoint /search. The request has succeeded | def test_search_route_get():
rv = app.test_client().get('/search')
assert rv.status_code == 200
assert b'<h2>Search for stocks</h2>' in rv.data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_search(self):\n\n response = self.client.get(reverse('result'), {'query': \"Alice's Adventures in Wonderland\"})\n query = Response.response_front()\n self.assertJSONEqual(response.content,query)",
"def test_search_status_code(self):\n response = self.client.get(reverse('cook... | [
"0.785996",
"0.7853713",
"0.778064",
"0.74925554",
"0.74813426",
"0.74813426",
"0.74813426",
"0.74813426",
"0.74813426",
"0.74813426",
"0.74813426",
"0.74813426",
"0.74813426",
"0.74813426",
"0.74813426",
"0.74813426",
"0.74310577",
"0.7409383",
"0.7406887",
"0.7406887",
"0.7... | 0.7202474 | 27 |
One particular instantiation of the curriculum for GAILA Phase 1. | def build_gaila_phase_2_curriculum(
num_samples: Optional[int],
num_noise_objects: Optional[int],
language_generator: LanguageGenerator[
HighLevelSemanticsSituation, LinearizedDependencyTree
],
use_path_instead_of_goal: bool = False,
) -> Sequence[Phase1InstanceGroup]:
return list(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.kappa=0.35\n self.sigma=0.5/100\n self.theta = -0.52/100\n self.dt = 0.01\n self.r0 = -0.52/100\n return",
"def initialize(context):\r\n \r\n algo.attach_pipeline(make_pipeline(), 'long_short_equity_template')\r\n\r\n # Attach the pipe... | [
"0.5821657",
"0.56982535",
"0.54612094",
"0.54490995",
"0.544214",
"0.54403406",
"0.5422469",
"0.5411123",
"0.5375866",
"0.5365399",
"0.5304383",
"0.52938735",
"0.52836955",
"0.528044",
"0.52697897",
"0.52383757",
"0.5230127",
"0.5228163",
"0.52176905",
"0.5216651",
"0.520449... | 0.6558783 | 0 |
Verify that nonproject docs are properly filtered and excluded. | def test_non_project_docs(self):
docs = project_docs.pull_project_docs_data(EXAMPLE_NON_PROJECT_DOCS)
self.assertEqual(len(docs), 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_exclude_localized_document(self):\n docs, _ = documents_for(\n locale=\"de\", topics=[self.bookmarks_d], current_document=self.doc1_localized\n )\n self.assertEqual(len(docs), 0)",
"def test_exclude_pages(tmp_path):\n # theme set to 'material' with 'locale' set to 'de'... | [
"0.6854676",
"0.6651385",
"0.63559234",
"0.6301304",
"0.6130417",
"0.6044512",
"0.60344565",
"0.60038024",
"0.59753186",
"0.59724903",
"0.59165055",
"0.5897662",
"0.58751416",
"0.5872393",
"0.5870832",
"0.5867468",
"0.58589983",
"0.5849141",
"0.58253026",
"0.58055574",
"0.580... | 0.7600683 | 0 |
Log Errors caused by Updates. | def error(bot, update, error):
logger.warning('Update "%s" caused error "%s"', update, error) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(update, context):\n\tlogger.warning('Update \"%s\" caused error \"%s\"', update, context.error)",
"def error(update, context):\n\tlogger.warning('Update \"%s\" caused error \"%s\"', update, context.error)",
"def error(self, update, context):\n self.logger.warning('Update \"%s\" caused error \"... | [
"0.7895998",
"0.7895998",
"0.78257465",
"0.77876204",
"0.77857095",
"0.77857095",
"0.77470577",
"0.77470577",
"0.77470577",
"0.77470577",
"0.77470577",
"0.77470577",
"0.77470577",
"0.77470577",
"0.77470577",
"0.77470577",
"0.77470577",
"0.77470577",
"0.77470577",
"0.77470577",
... | 0.75340605 | 65 |
The number of seconds between two numpy.datetime64 elements. | def get_seconds(dt1, dt2, precision='us'):
if precision == 's':
scale = 1
elif precision == 'ms':
scale = 1e-3
elif precision == 'us':
scale = 1e-6
elif precision == 'ns':
scale = 1e-9
else:
raise ValueError('unrecognized precision {}'.format(precision))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seconds_between_two_dates(t1, t2):\n r = (t1 - t2)\n r = r.days * 86400 + r.seconds\n debug2('bin.seconds_between_two_dates: r={}'.format(r))\n return r",
"def test__seconds_between_datetimes(self):\n\n result = time_between_datetimes\n expected = 14782233\n\n self.assertEqua... | [
"0.73732996",
"0.68861216",
"0.67954576",
"0.67401177",
"0.6566447",
"0.64963233",
"0.6436488",
"0.643459",
"0.6327967",
"0.6307896",
"0.618112",
"0.6177915",
"0.6169515",
"0.60809416",
"0.6037995",
"0.60351515",
"0.59561646",
"0.5942805",
"0.5904979",
"0.58771205",
"0.585613... | 0.6966656 | 1 |
Find the bounding boxes for all the glass items matching a config. This yields (targetname, min, max, normal, config) tuples. | def find_glass_items(config, vmf: VMF) -> Iterator[Tuple[str, Vec, Vec, Vec, dict]]:
# targetname -> min, max, normal, config
glass_items: dict[str, tuple[Vec, Vec, Vec, dict]] = {}
for inst in vmf.by_class['func_instance']:
try:
conf = config[inst['file'].casefold()]
except KeyE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bounding_boxes(self):\n all_mins, all_maxes = [], []\n for points in self.points_list():\n cur_mins = points.min(dim=0)[0]\n cur_maxes = points.max(dim=0)[0]\n all_mins.append(cur_mins)\n all_maxes.append(cur_maxes)\n all_mins = torch.stack(a... | [
"0.6345348",
"0.6341608",
"0.61237806",
"0.58856386",
"0.5826133",
"0.57866114",
"0.57856894",
"0.57525903",
"0.5704832",
"0.56965816",
"0.56634307",
"0.56595886",
"0.56577337",
"0.5638647",
"0.56257033",
"0.56249064",
"0.5606469",
"0.5600726",
"0.55639386",
"0.5561043",
"0.5... | 0.7553051 | 0 |
Render website's home page. | def home():
return render_template('home.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n return render_template('homepage.html')",
"def home():\n\treturn render_template('home.html')",
"def home():\n return render_template(\n 'home.html',\n title='Home Page',\n )",
"def home():\r\n return render_template('home.html')",
"def home():\r\n return render_t... | [
"0.85791856",
"0.85713065",
"0.8499555",
"0.84895504",
"0.84842074",
"0.8465808",
"0.8462945",
"0.8430134",
"0.8396612",
"0.8396612",
"0.8385129",
"0.83715045",
"0.8360931",
"0.8355036",
"0.8355036",
"0.8343941",
"0.8341506",
"0.83411145",
"0.8340763",
"0.8340763",
"0.8340763... | 0.83374727 | 32 |
Render the website's about page. | def about():
return render_template('about.html', name="Mary Jane") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template(\"about.html\")",
"def about():\n logger.info(\"About page accessed\")\n return render_template('about.html')",
"def about():\n about_template = templates_lookup.get_template('about.html')\n return about_template.render(active_page='about')",
"def abou... | [
"0.8787005",
"0.864869",
"0.8647346",
"0.86089456",
"0.8584501",
"0.85151047",
"0.849101",
"0.849101",
"0.84472877",
"0.84472877",
"0.84446555",
"0.84436053",
"0.8429574",
"0.8429574",
"0.842485",
"0.842485",
"0.842485",
"0.842485",
"0.842485",
"0.842485",
"0.842485",
"0.84... | 0.7685011 | 92 |
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes. | def add_header(response):
response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'
response.headers['Cache-Control'] = 'public, max-age=600'
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_header (response):\n response.headers['X-UA-Compatible']= 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=0'\n return response",
"def add_header(response):\r\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\r\n response.headers['Cache-Control'] = 'public... | [
"0.82201487",
"0.81953955",
"0.81629556",
"0.81629556",
"0.81629556",
"0.81629556",
"0.81629556",
"0.81629556",
"0.81629556",
"0.81629556",
"0.81629556",
"0.81629556",
"0.81629556",
"0.81629556",
"0.81629556",
"0.81629556",
"0.81629556",
"0.81629556",
"0.81629556",
"0.81629556"... | 0.8222136 | 3 |
Median Absolute Deviation (MAD) along given axis of an array. | def mad(a, normalize=True, axis=0):
a = np.asarray(a)
if axis is None:
# Calculate the MAD over the entire array
a = np.ravel(a)
axis = 0
c = scipy.stats.norm.ppf(3 / 4.) if normalize else 1
center = np.apply_over_axes(np.nanmedian, a, axis)
return np.nanmedian((np.fabs(a - c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mad(a, axis=None):\n med = np.median(a, axis=axis) # Median along given axis\n if axis is None:\n umed = med # med is a scalar\n else:\n umed = np.expand_dims(med, axis) # Bring back the vanished axis\n mad = np.median(np.absolute(a ... | [
"0.80264866",
"0.79633486",
"0.79506886",
"0.76751614",
"0.75864357",
"0.7585752",
"0.74629277",
"0.71845895",
"0.6915498",
"0.6901489",
"0.68912154",
"0.6880493",
"0.66040736",
"0.6563407",
"0.65604806",
"0.64805037",
"0.6365214",
"0.63353544",
"0.63225245",
"0.6311917",
"0.... | 0.7441965 | 7 |
Load a csv file as a dataframe | def load_data(filename: str, **kwargs) -> pd.DataFrame:
df = pd.read_csv(filename, **kwargs)
logger.info('Se han cargado los datos correctamente.')
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(csv):\n df = pd.read_csv(csv, sep=',', error_bad_lines=False)\n return df",
"def load_csv_as_dataframe(csv_file):\n rows, first_header = read_csv_file(csv_file)\n df = pd.DataFrame(data=rows, columns=first_header)\n return df",
"def load_csv_file(csv_path):\n csv = CSVLoader(csv... | [
"0.81811136",
"0.8103719",
"0.80908036",
"0.805943",
"0.80341333",
"0.7868506",
"0.7830047",
"0.7783465",
"0.77732253",
"0.7752858",
"0.77044207",
"0.7703035",
"0.7676431",
"0.76566976",
"0.76306003",
"0.7630484",
"0.7607399",
"0.7584398",
"0.7569358",
"0.7546767",
"0.7538544... | 0.76157665 | 16 |
export a dataframe to a csv file | def export_data(df: pd.DataFrame, path: str, with_header: bool = False):
logger.info('El archivo se ha exportado como un csv satisfactoriamente.')
if with_header:
return df.to_csv(path, sep=';', index=False, header=True)
else:
return df.to_csv(path, sep=';', index=False, header=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_csv(df: pd.DataFrame, output_data_path: str):\n os.makedirs(os.path.dirname(output_data_path), exist_ok=True)\n df.to_csv(output_data_path)",
"def to_csv(self, *args: Any, **kwargs: Any) -> None:\n df = self.to_data_frame()\n df.to_csv(*args, **kwargs)",
"def export_csv(self, fil... | [
"0.8144751",
"0.8143701",
"0.8138167",
"0.8116362",
"0.8083781",
"0.8036502",
"0.8028797",
"0.7999955",
"0.799629",
"0.7947882",
"0.7944239",
"0.79250616",
"0.7916105",
"0.78826874",
"0.7822191",
"0.78159744",
"0.7815263",
"0.77858627",
"0.77331233",
"0.7713796",
"0.77122074"... | 0.78244305 | 14 |
Decode an image from string. Return 3 channels. | def read_float(path, channel=3, itype='jpg', is_linear=False):
image_string = tf.io.read_file(path)
if itype == 'jpg':
image = tf.image.decode_jpeg(image_string, channels=channel)
elif itype == 'png':
image = tf.image.decode_png(image_string, channels=channel)
image = tf.image.convert_image_dtype(image,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imdecode(string: str) -> np.ndarray:\n return cv2.imdecode(np.fromstring(string, np.uint8), cv2.IMREAD_COLOR)[:, :, ::-1]",
"def decode_image(self, image_data):\n image = self._session.run(self._decode,\n feed_dict={self._decode_data: image_data})\n if len(im... | [
"0.75503063",
"0.6534284",
"0.63151383",
"0.62144333",
"0.6175627",
"0.5970136",
"0.5951798",
"0.59480906",
"0.59364593",
"0.591703",
"0.5897274",
"0.5894333",
"0.5857589",
"0.5827963",
"0.58154553",
"0.58103323",
"0.58043295",
"0.5790941",
"0.5771603",
"0.5752896",
"0.572822... | 0.0 | -1 |
Customized image resizing op. | def resize_image(image, new_sizeh=None, new_sizew=None, rsz=None):
with tf.name_scope('resize_image'):
if new_sizeh is None:
height = tf.cast(tf.shape(image)[0], tf.float32)
width = tf.cast(tf.shape(image)[1], tf.float32)
new_sizeh = tf.cast(height * rsz, tf.int32)
new_sizew = tf.cast(widt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize(self, *args):\n return _yarp.Image_resize(self, *args)",
"def rescale(img):\n return resize(img)",
"def Resize(*args, **kwargs):\n return _core_.Image_Resize(*args, **kwargs)",
"def img_resize(img, size):\n\n newsize = resize(img.size, size)\n newsize = (int(newsize[0]), int... | [
"0.74654776",
"0.7209974",
"0.71002126",
"0.6894762",
"0.6889848",
"0.6885761",
"0.6870875",
"0.68289095",
"0.6792328",
"0.67879796",
"0.6775912",
"0.67625886",
"0.67502517",
"0.6726272",
"0.67197645",
"0.66881114",
"0.6669305",
"0.66603017",
"0.6659204",
"0.66575974",
"0.664... | 0.7036339 | 3 |
Apply spatiallyvarying blur to an image. Using pyramid to approximate for efficiency | def apply_spatially_varying_blur(image, blur_size=2, blurtype='disk'):
pyramid = create_pyramid(image, blur_size=blur_size, blurtype=blurtype)
image_blurred = apply_pyramid_blend(pyramid)
return image_blurred | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blur(image):\r\n \r\n def tripleSum (p1, p2):\r\n return (p1[0]+p2[0], p1[1]+p2[1], p1[2]+p2[2])\r\n \r\n new=copy(image)\r\n width, height =image.size\r\n for y in range(1, height-1):\r\n for x in range(1, width-1):\r\n oldP=image.getpixel((x,y))\r\n left=... | [
"0.737298",
"0.7146246",
"0.69287753",
"0.6924045",
"0.6914444",
"0.68898946",
"0.6884347",
"0.68786067",
"0.6850612",
"0.68225545",
"0.68176425",
"0.66541433",
"0.66350967",
"0.66083664",
"0.65640575",
"0.65518856",
"0.6549458",
"0.65401894",
"0.65319794",
"0.65047556",
"0.6... | 0.8187525 | 0 |
Linear interpolation between a and b using weight x. | def lerp(a, b, x):
return a + x * (b - a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interpolate_linear(a,b,u):\n return vectorops.madd(a,vectorops.sub(b,a),u)",
"def _lin(x: float, a: Flt, b: Flt) -> Flt:\n return (a * x) + b",
"def Lerp(x, a, b):\n lerped = a.Scaled(1.0-x)\n lerped.add(b.Scaled(x))\n return lerped",
"def linear_interpolation(\n x_start: 'Cell',\n ... | [
"0.70314527",
"0.69816744",
"0.6924217",
"0.68439096",
"0.6695672",
"0.66803986",
"0.663083",
"0.6621179",
"0.6562445",
"0.65309197",
"0.65178794",
"0.65098155",
"0.6460462",
"0.6435695",
"0.6402239",
"0.64010566",
"0.63775206",
"0.63246524",
"0.630186",
"0.6235365",
"0.61847... | 0.6548462 | 9 |
Render a shadow mask using silhouette image. The sihouette image is first augmented by applying random rotation and tiling. Then used to render a shadow mask by applying spatiallyvarying blur. | def render_silhouette_mask(silhouette, size, segmentation=None):
with tf.name_scope('render_silhouette'):
silhouette.shape.assert_has_rank(3)
tf.compat.v1.assert_equal(silhouette.shape[2], 1)
degree = tf.random.uniform(shape=(), minval=0, maxval=360, dtype=tf.float32)
silhouette_rot = tf.contrib.image... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_shadow_from_mask(mask, segmentation=None):\n mask = tf.expand_dims(mask, 2)\n disc_filter_sz = tf.random.uniform(\n shape=(), minval=1, maxval=_MAX_BLUR_SIGMA, dtype=tf.int32)\n mask_blurred = tf.cond(\n tf.greater(tf.random.uniform([]),\n tf.constant(_SV_SIGMA)), lambda: ap... | [
"0.75559896",
"0.64650714",
"0.64638776",
"0.627483",
"0.62720263",
"0.6205333",
"0.5743431",
"0.5734251",
"0.57025415",
"0.57000834",
"0.5662766",
"0.5661221",
"0.56220305",
"0.55637485",
"0.55159706",
"0.5491965",
"0.5465372",
"0.5442043",
"0.5434886",
"0.5323912",
"0.53155... | 0.73970383 | 1 |
Randomly apply geometric augmentation. | def apply_geometric_augmentation(image):
processed_images = tf.image.random_flip_left_right(image)
return processed_images | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomAugmentation(self):\n\n random_aug = iaa.KeepSizeByResize(children = iaa.Sequential([\n self.padding(padding_percentage = (0.5)),\n iaa.Sometimes(self.prob_aug, self.sum_to_pixels()),\n iaa.Sometimes(self.prob_aug, self.hue_sat_transformation()),\n iaa.S... | [
"0.71607435",
"0.6726499",
"0.6726499",
"0.64721084",
"0.645267",
"0.6320346",
"0.6245447",
"0.6124067",
"0.5976074",
"0.5974473",
"0.5943712",
"0.58922493",
"0.5831653",
"0.5811184",
"0.5805618",
"0.57711315",
"0.57551533",
"0.57457006",
"0.57390773",
"0.5700898",
"0.5696512... | 0.6483428 | 3 |
Compute and return the daily return values. | def compute_daily_returns(df):
daily=df.copy()
daily[1:]=(df[1:]/df[:-1].values)-1
daily.ix[0,:]=0
return daily | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def daily_returns(df, start_date, end_date):\n\n # Get the Total Return for this date-range.\n tot_ret = df[TOTAL_RETURN][start_date:end_date]\n\n # Calculate the daily returns assuming we have daily data.\n daily_ret = tot_ret.shift(-1) / tot_ret\n\n return daily_ret",
"def compute_daily_returns(... | [
"0.75868565",
"0.7474695",
"0.7403421",
"0.6923475",
"0.685118",
"0.6271917",
"0.62255514",
"0.6217935",
"0.6164483",
"0.6129367",
"0.6124959",
"0.60752356",
"0.60442704",
"0.6021335",
"0.5928722",
"0.5918354",
"0.5910972",
"0.5906665",
"0.5871441",
"0.5859528",
"0.58214563",... | 0.7536565 | 1 |
Returns the Gaussian kernel matrix of two matrices of vectors elementwise. | def gaussian_kernel(tensor_a, tensor_b, gamma, debug_print=False):
# bin formula
a_inputs = tf.shape(tensor_a)[0]
b_inputs = tf.shape(tensor_b)[0]
#G = sp.outer(X1.multiply(X1).sum(axis=0), sp.ones(X2.shape[1]))
G = tf.transpose(tf.tile(tf.expand_dims(tf.reduce_sum(tf.mul(tensor_a, tensor_a), reduct... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussianKernelGramMatrix(X1, X2, K_function=gaussianKernel, sigma=0.1):\n\n gram_matrix = np.zeros((X1.shape[0], X2.shape[0]))\n for i, x1 in enumerate(X1):\n for j, x2 in enumerate(X2):\n gram_matrix[i, j] = K_function(x1, x2, sigma)\n return gram_matrix",
"def gaussian_kernel(x1,... | [
"0.739741",
"0.71976465",
"0.7016135",
"0.6929785",
"0.6735783",
"0.67107576",
"0.653243",
"0.6403864",
"0.6361539",
"0.6289877",
"0.62874013",
"0.62825215",
"0.6249074",
"0.6209614",
"0.6173011",
"0.6164831",
"0.61433995",
"0.6137843",
"0.61034316",
"0.6072697",
"0.60211",
... | 0.6072666 | 20 |
Set up Sun sensor platform. | async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
sun: Sun = hass.data[DOMAIN]
async_add_entities(
[SunSensor(sun, description, entry.entry_id) for description in SENSOR_TYPES]
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sun(self, sun):\n\n self._sun = sun",
"def initHardware(self):\n # Setting up the GPIO pin to which the SoundSensor is connected:\n GPIO.setmode(GPIO.BCM)\n GPIO.setup(self._port_sounddetector, GPIO.IN)\n # Set a filter for an event trigger on the SoundDetector port.\n # We want to get ... | [
"0.6552485",
"0.64525634",
"0.6439401",
"0.6428031",
"0.63302195",
"0.62852573",
"0.61847246",
"0.6163793",
"0.6141104",
"0.5933049",
"0.5910648",
"0.5865059",
"0.5864488",
"0.5851612",
"0.58409184",
"0.5829814",
"0.58261013",
"0.5820403",
"0.58044815",
"0.5800503",
"0.578731... | 0.5835502 | 15 |
This method sets the labels for the current weather | def __set_current_data(self, data: dict) -> None:
self.__gui.labelCity.setText(data["city"])
self.__gui.labelCurrentTemperature.setText(FormatDataHelper.format_temp(data["current"]["temp"]))
self.__gui.labelCurrentAdditionalInfo.setText("{}: {}".format(data["current"]["weather"][0]["main"],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_weather(self):\n pass",
"def answerLabel():\n answer_Weather = answerList1\n label3['text'] = answer_Weather[0]",
"def update_labels(self, new_labels):\r\n self.labels = new_labels.copy()\r\n self.set_mask(self.working_mask)",
"def __set_general_information(self, data: d... | [
"0.6632302",
"0.65836984",
"0.652719",
"0.6508064",
"0.6359809",
"0.6359809",
"0.6359809",
"0.6359809",
"0.62913835",
"0.6261517",
"0.6261517",
"0.6255904",
"0.62354034",
"0.6230238",
"0.6129508",
"0.6087365",
"0.60579044",
"0.60216874",
"0.60006374",
"0.59454995",
"0.5927678... | 0.65701497 | 2 |
The Riemannian exponential is the addition in the Minkowski space. | def exp(self, tangent_vec, base_point):
tangent_vec = gs.to_ndarray(tangent_vec, to_ndim=2)
base_point = gs.to_ndarray(base_point, to_ndim=2)
return base_point + tangent_vec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exponential(x):\n return K.exp(x)",
"def em(x):\n return math.exp(x)-1",
"def localE(self):\n dotProd = 0\n dotProd = sum(((i-j)/self.r12)*((i/self.r1)-(j/self.r2)) for i,j in zip(self.re1,self.re2))\n denom = 1/(1+self.alpha*self.r12)\n return -4+self.alpha*(denom+denom**2+... | [
"0.6880866",
"0.66119933",
"0.6336828",
"0.6254862",
"0.624031",
"0.6213313",
"0.61643374",
"0.6149956",
"0.61361057",
"0.604669",
"0.603929",
"0.59789306",
"0.5966338",
"0.5953339",
"0.5947353",
"0.5933286",
"0.5922998",
"0.5919035",
"0.59060246",
"0.5902911",
"0.5889397",
... | 0.0 | -1 |
Whether a NApp is enabled or not on this controller. | def is_enabled(self, napp_uri):
napp = NApp.create_from_uri(napp_uri)
return napp in self.list_enabled() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enabled(self) -> bool:\n return pulumi.get(self, \"enabled\")",
"def enabled(self) -> bool:\n return pulumi.get(self, \"enabled\")",
"def enabled(self) -> bool:\n return pulumi.get(self, \"enabled\")",
"def enabled(self) -> bool:\n return pulumi.get(self, \"enabled\")",
"def... | [
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"0.7234415",
"... | 0.73327416 | 0 |
Check that dates are correctly disallowed when autocreating a new reporting period. | def test_disallowed_dates_safe_dates(self):
safe_end_dates = [(2011, 9, 28), (2011, 10, 2), (2016, 9, 29),
(2016, 10, 3)]
ct_existing_rps = len(hours.models.ReportingPeriod.objects.all())
for i in safe_end_dates:
self.reporting_period.end_date = datetime.date(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_disallowed_dates_not_safe_dates(self):\n not_safe_end_dates = [(2015, 10, 2), (2015, 9, 30), (2014, 10, 2),\n (2014, 9, 30)]\n ct_existing_rps = len(hours.models.ReportingPeriod.objects.all())\n for i in not_safe_end_dates:\n self.reporting_period.end_date = date... | [
"0.7765133",
"0.773806",
"0.6969693",
"0.69293153",
"0.6913585",
"0.6744557",
"0.6715226",
"0.65386987",
"0.6524735",
"0.65130955",
"0.648991",
"0.64888173",
"0.64747316",
"0.6473874",
"0.64616036",
"0.64432585",
"0.6440823",
"0.6439839",
"0.64384633",
"0.63971734",
"0.634184... | 0.7848046 | 0 |
Check that dates are correctly allowed when autocreating a new reporting period. | def test_disallowed_dates_not_safe_dates(self):
not_safe_end_dates = [(2015, 10, 2), (2015, 9, 30), (2014, 10, 2),
(2014, 9, 30)]
ct_existing_rps = len(hours.models.ReportingPeriod.objects.all())
for i in not_safe_end_dates:
self.reporting_period.end_date = datetime.date(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_disallowed_dates_safe_dates(self):\n safe_end_dates = [(2011, 9, 28), (2011, 10, 2), (2016, 9, 29),\n (2016, 10, 3)]\n ct_existing_rps = len(hours.models.ReportingPeriod.objects.all())\n for i in safe_end_dates:\n self.reporting_period.end_date = datetime.date(\n... | [
"0.77411395",
"0.76350677",
"0.7076914",
"0.6982971",
"0.6905002",
"0.68688583",
"0.6752478",
"0.6717375",
"0.6696272",
"0.6682081",
"0.664204",
"0.65533817",
"0.6540911",
"0.6515169",
"0.64847547",
"0.6473187",
"0.64713264",
"0.64648926",
"0.64049625",
"0.6378172",
"0.636014... | 0.762092 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.