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 |
|---|---|---|---|---|---|---|
Generates the name of the output notebook | def step_notebook_output_path(self, notebook) -> str:
return ("/home/jovyan/work/notebook_run/" +
os.path.basename(notebook).replace(".ipynb", "") + "_" +
self._timestamp_now() +
self.user_id() +
".ipynb") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outname(self,sctn):\n return '%s_%s.html'%(self.basename,sctn)",
"def output_name(self) -> str:\n return jsii.get(self, \"outputName\")",
"def full_name(self):\n return \"output.%s\" % self.name",
"def outputname(self, identifier):\n return self._outprefix+str(identifier)+\".\... | [
"0.6912127",
"0.69111377",
"0.6830666",
"0.67487735",
"0.6703478",
"0.65781707",
"0.6429554",
"0.6416294",
"0.63986546",
"0.63986546",
"0.6380309",
"0.6371911",
"0.6300438",
"0.6278509",
"0.62301755",
"0.6226171",
"0.620066",
"0.61854964",
"0.61803436",
"0.6104374",
"0.610423... | 0.72246855 | 0 |
Returns the value associated with the field for the currently focused step. | def step_field(self, field):
if self.has_step_field(field):
return self._step[field]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getValue(self):\n return self.field.currentText()",
"def getValue(self):\n return self.field.text()",
"def getValue(self):\n return self.field.value()",
"def getValue(self):\n return self.field.value()",
"def field(self):\r\n return self.value",
"def get_value(self)... | [
"0.77168536",
"0.7346782",
"0.7289523",
"0.7289523",
"0.7219875",
"0.67124605",
"0.67105424",
"0.6613293",
"0.65951777",
"0.6558827",
"0.65448",
"0.65448",
"0.65448",
"0.653574",
"0.653574",
"0.6495681",
"0.64810866",
"0.6475203",
"0.6474982",
"0.6473029",
"0.6473029",
"0.6... | 0.7076527 | 5 |
Tests if the currently focused dag has a configuration value for the field. | def has_dag_field(self, field) -> bool:
if not self._dag:
return False
return field in self._dag | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_config_has(self, field) -> bool:\n if not self.app_config():\n return False\n return field in self.app_config()",
"def has_value(self):\n return hasattr(self, '_value')",
"def has_step_field(self, field) -> bool:\n if not self._step:\n return False\n ... | [
"0.633657",
"0.5884592",
"0.5875328",
"0.58658224",
"0.5738727",
"0.57200885",
"0.5664927",
"0.5644",
"0.5631143",
"0.55797493",
"0.5547941",
"0.553927",
"0.5534899",
"0.55345285",
"0.55145824",
"0.54523396",
"0.5362169",
"0.5359732",
"0.5330674",
"0.5312119",
"0.5292291",
... | 0.7044528 | 0 |
Returns the name of the currently focused dag | def dag_name(self):
return self._dag_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def curr_name(self):\n return self.name_stack[-1]",
"def dag_container_name(self) -> str:\n return (\n \"airflow_\" +\n self.dag_name().replace(\".\", \"_\")\n )",
"def getFocusedWindowName(self):\n window = self.getFocusedWindow()\n if window:\n ... | [
"0.6573771",
"0.6545596",
"0.6349406",
"0.62389857",
"0.61083335",
"0.606388",
"0.6044449",
"0.60174674",
"0.59485626",
"0.5923473",
"0.59231025",
"0.5902407",
"0.58860207",
"0.58673334",
"0.58648527",
"0.5863148",
"0.5854715",
"0.58341604",
"0.58251375",
"0.57939565",
"0.576... | 0.79782134 | 0 |
Read data as pandas and return a dictionary of time series data Returns | def get_data(self):
all_data = OrderedDict()
projects = [Path(proj) for proj in glob(str(self.data_path.joinpath("*"))) if Path(proj).is_dir()]
for project in projects:
files = []
# Read all csv files and save them as a list in files
for ver in ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n return self.time_series_data[:]",
"def load_pandas():\n data = _get_data()\n return du.process_pandas(data, endog_idx=0)",
"def load_pandas():\n data = _get_data()\n return du.process_pandas(data, endog_idx=0)",
"def read_delsys_csv(filename: str) -> Dict[str, Dict[str... | [
"0.6656976",
"0.6585921",
"0.6585921",
"0.6430523",
"0.64139915",
"0.6304706",
"0.6289664",
"0.6285732",
"0.6272197",
"0.6197879",
"0.6196443",
"0.61629874",
"0.6136104",
"0.60826707",
"0.60605145",
"0.6034377",
"0.60306877",
"0.60089225",
"0.59919506",
"0.59754366",
"0.59554... | 0.0 | -1 |
Sets the learning rate to the initial LR decayed by 10 every 30 epochs | def adjust_learning_rate(optimizer, epochs, base_lr):
lr = base_lr * (0.01 ** (epochs//5))
print('Learning Rate decreased to {}'.format(lr))
for param_group in optimizer.state_dict()['param_groups']:
param_group['lr'] = lr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr",
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l... | [
"0.7913536",
"0.7906521",
"0.7849834",
"0.777524",
"0.77338326",
"0.77306354",
"0.7722718",
"0.77224237",
"0.771982",
"0.77092624",
"0.7693604",
"0.76742035",
"0.7665748",
"0.7665748",
"0.7665748",
"0.7655329",
"0.76419765",
"0.76399755",
"0.7637868",
"0.7626077",
"0.76247585... | 0.0 | -1 |
Validate that the requesting user owns the given device. | def validate(self, data):
request = self.context['request']
data.setdefault('user', request.user)
data.setdefault('device_user_token', None)
if not request.user.is_authenticated():
raise serializers.ValidationError('user is not logged in.')
try:
self.ins... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_owner(model, request):\n auth_token = request.headers.get('Authentication-Token')\n user = _token_loader(auth_token)\n if model.owner != user:\n abort(401)",
"def check_owner(data=None, **kw):\n if data and 'owner_id' in data and not data['owner_id'] == current_user.id:\n r... | [
"0.659432",
"0.623764",
"0.6065538",
"0.59675324",
"0.59260863",
"0.5800791",
"0.5775725",
"0.57568",
"0.56459993",
"0.5626685",
"0.5557078",
"0.5549214",
"0.55457175",
"0.5507297",
"0.549282",
"0.54610646",
"0.5445591",
"0.542236",
"0.5390482",
"0.53854966",
"0.537791",
"0... | 0.58596563 | 5 |
Return the name of the sensor. | def name(self):
if ( self._typeSensor == _production):
name = "myEnedis.%s.production" %(self._myDataSensorEnedis.get_PDL_ID())
else:
name = "myEnedis.%s" %(self._myDataSensorEnedis.get_PDL_ID())
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._sensor.name",
"def get_sensor_name(self):\n return self.data[1]",
"def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'",
"def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso... | [
"0.91896784",
"0.9168378",
"0.890185",
"0.8770976",
"0.8511273",
"0.8479953",
"0.844435",
"0.8299758",
"0.8186503",
"0.8105667",
"0.8079737",
"0.8066149",
"0.8049647",
"0.7700968",
"0.7612295",
"0.7611456",
"0.7600605",
"0.7600605",
"0.7600605",
"0.75392073",
"0.75166553",
... | 0.71017295 | 28 |
Return the unit of measurement of this entity, if any. | def unit_of_measurement(self):
return self._unit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_of_measurement(self):\n return self._metadata[1]",
"def unit_of_measurement(self):\n if self._coordinator.data:\n return self._coordinator.data['unit']\n return None",
"def unit_of_measurement(self):\n return self._unit_of_measurement",
"def unit_of_measurement... | [
"0.8565862",
"0.8473674",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.843327",
"0.83701795",
"0.8368336",
"0.8334028",
"0.82777756",
"0.8239642",
... | 0.8477338 | 6 |
Return the state attributes. | def device_state_attributes(self):
return self._attributes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_attributes(self):\... | [
"0.8953404",
"0.8953404",
"0.85239846",
"0.8366765",
"0.8366765",
"0.8363429",
"0.83362615",
"0.8334551",
"0.8310377",
"0.8292682",
"0.8289349",
"0.8289349",
"0.8273077",
"0.82236886",
"0.8223562",
"0.8205066",
"0.8184393",
"0.81659013",
"0.8102565",
"0.8064994",
"0.8064994",... | 0.82871646 | 15 |
Return True if we have the necessary metadata about the table and its columns needed for fetching and plotting data for the given sensor type, otherwise False. | def is_valid_sensor_type(sensor_type_id):
return (
get_table_by_sensor_type(sensor_type_id) is not None
and get_columns_by_sensor_type(sensor_type_id) is not None
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_metadata(self):\n sql = f\"SELECT COUNT(*) FROM {constants.TABLES}\"\n if self.dbcnx.execute(sql).fetchone()[0] == 0:\n return False # No metadata; skip.\n sql = f\"SELECT name FROM {constants.TABLES}\"\n tables1 = [r[0] for r in self.dbcnx.execute(sql)]\n s... | [
"0.6601616",
"0.6300214",
"0.61152565",
"0.6111068",
"0.60540915",
"0.6046029",
"0.6040615",
"0.6003534",
"0.59972876",
"0.59852564",
"0.5952623",
"0.59405315",
"0.59124994",
"0.58496916",
"0.5806248",
"0.58007795",
"0.57875365",
"0.5784923",
"0.57731324",
"0.57640713",
"0.57... | 0.62254745 | 2 |
transform_ngrams method performs a ngram tokenization based on the self.ngrams defined, if self.ngrams is equal to 1 it'll return the word list as is since there's nothing to do to it. | def transform_ngrams(self, words):
return words if self.n_grams == 1 else [self.connector.join(words[i:i + self.n_grams]) for i in range(len(words) - self.n_grams + 1)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_ngrams(sent, n):\n\t\n\t# EXAMPLES \n\t# > word_ngrams(tokenize('hello world'), 1)\n\t# [('hello',), ('world',)]\n\t# > word_ngrams(tokenize('hello world'), 2)\n\t# [('<s>', 'hello'), ('hello', 'world'), ('world', '</s>')]\n\n\t# YOUR CODE HERE\n\ttokenized_sent = tokenize(sent)\n\tif n != 1:\n\t\ttokeniz... | [
"0.7315621",
"0.72339004",
"0.72071725",
"0.7127765",
"0.71184033",
"0.7086975",
"0.70695",
"0.70262855",
"0.6993649",
"0.6977622",
"0.6850255",
"0.6833432",
"0.6814614",
"0.6802238",
"0.67310554",
"0.67102724",
"0.67041683",
"0.6689319",
"0.6653465",
"0.66430074",
"0.6640510... | 0.800618 | 0 |
Return sample of transitions uniformly from the buffer if buffer is large enough for the given batch size. Sample is a named tuple of transition where the elements are torch tensor. | def sample(self, batchsize):
# randomly sample transitions
random_sample = randsample(self.queue, batchsize)
# zip
zipped = [ torch.from_numpy( np.asarray(arr).astype(np.float32) ).float() for arr in zip(*random_sample) ]
sample = Transition( zipped[0], zipped[1].unsqueeze_(-1).l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample(self, batch_size):\n # get the sum of priorities\n priority_sum = self.sum_tree.get_sum_priority()\n # sample priorities \n priorities_to_sample = np.random.uniform(0, priority_sum, batch_size)\n # get the indexes of replays\n sample_idxes = [self.sum_tree.get(x... | [
"0.75186974",
"0.72215515",
"0.72215515",
"0.6890673",
"0.6853146",
"0.6834639",
"0.68141925",
"0.6780606",
"0.66818506",
"0.6676063",
"0.66648406",
"0.6664166",
"0.66348034",
"0.65925187",
"0.65837175",
"0.65837175",
"0.6573256",
"0.65675837",
"0.6496065",
"0.6482939",
"0.64... | 0.7828738 | 0 |
Return true if the tableau card is face up. Face up cards on the tableau are the cards that haven't been removed yet and aren't covered from below by other cards. They can be moved to the waste pile if they are one rank above or below the waste card. | def is_face_up(self, tableau_index):
if self.tableau[tableau_index] is None:
return False
child_indexes = State.CHILD_INDEXES[tableau_index]
return all((self.tableau[i] is None for i in child_indexes)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isGameOver(self):\n for i in range(self.rows):\n for j in range(self.columns):\n if self.grid[i][j].face == 'down':\n return False\n #if here then all cards must be face up\n return True",
"def __update_col_facedown(self, col):\n all_is... | [
"0.68464917",
"0.6571055",
"0.61815757",
"0.6041941",
"0.5931337",
"0.58817625",
"0.5849747",
"0.5807592",
"0.5725518",
"0.5654216",
"0.55885166",
"0.5561696",
"0.553718",
"0.55167353",
"0.5487364",
"0.54541904",
"0.5437851",
"0.540566",
"0.5404966",
"0.5392615",
"0.53780425"... | 0.6942468 | 0 |
Return true if there are no more tableau cards remaining. | def is_tableau_empty(self):
return all(self.tableau[i] is None for i in range(28)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_cards(self):\n return self.hand.len() > 0",
"def is_few_remaining(self) -> bool:\n return self.on_hand <= self.warn_limit",
"def still_in_hand(self):\n return len(self.hand.cards)!=0",
"def isFull(self) -> bool:\n return self.count == self.capacity",
"def isFull(self) ->... | [
"0.69879216",
"0.6961193",
"0.6927591",
"0.6920883",
"0.6920883",
"0.6919638",
"0.6879705",
"0.68379253",
"0.68319124",
"0.68288004",
"0.68288004",
"0.67916346",
"0.6747794",
"0.66916144",
"0.6649566",
"0.66407216",
"0.65979266",
"0.65090024",
"0.64314383",
"0.6396719",
"0.63... | 0.6210364 | 35 |
Method to standardize a name. Standardize takes a string name representation and sequentially enforces rules (using rules.py utility functions). | def standardize(self, name: str) -> str:
clean_name = name
for rule in rules.RULES:
clean_name = rule(clean_name)
return clean_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _FormalizeName(cls, name):\n name = name.replace(\"_\", \"-\").lower()\n name = name[:cls.NAME_LENGTH_LIMIT]\n if name[-1] == \"-\":\n name = name[:-1] + cls.REPLACER\n return name",
"def normalize_name(cls, name):\n\t\treturn ' '.join(name.lower().strip().split())",
... | [
"0.6997477",
"0.69225377",
"0.69225377",
"0.69225377",
"0.6884975",
"0.68363",
"0.68205446",
"0.655233",
"0.6526048",
"0.65222824",
"0.6458359",
"0.6422997",
"0.64148015",
"0.6409994",
"0.6405911",
"0.63721883",
"0.635065",
"0.634594",
"0.63453424",
"0.6330475",
"0.63251185",... | 0.8185549 | 0 |
r""" Generate a Latex string for this polynomial. | def latex_str(self):
k = dimension(self.vertices)
try:
len(self.coeff[0])
coeff_strs = [str_number_array(c, latex=True) for c in self.coeff]
basis_strs = bernstein_basis_latex_compact(self.r, k)
return str_dot_product(coeff_strs, basis_strs)
except... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self) -> str:\n polynomial = \"\"\n for i in range(self.degree, -1, -1):\n if self.coefficients[i] == 0:\n continue\n elif self.coefficients[i] > 0:\n if polynomial:\n polynomial += \" + \"\n else:\n ... | [
"0.7531606",
"0.74144715",
"0.7197297",
"0.717149",
"0.69959235",
"0.69943374",
"0.6988189",
"0.6907715",
"0.6880895",
"0.6773107",
"0.6731237",
"0.67160827",
"0.66875154",
"0.6657712",
"0.665531",
"0.6582512",
"0.6463456",
"0.646276",
"0.6421205",
"0.6421205",
"0.6405542",
... | 0.74596596 | 1 |
r""" Generate a Latex string for this polynomial, where each basis function has been expanded in the monomial basis. | def latex_str_expanded(self):
try:
len(self.coeff[0])
coeff_strs = [str_number_array(c, latex=True) for c in self.coeff]
basis_strs = bernstein_basis_simplex_latex(self.r, self.vertices)
for i in range(len(basis_strs)):
if len(basis_strs[i]) > 3:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self) -> str:\n polynomial = \"\"\n for i in range(self.degree, -1, -1):\n if self.coefficients[i] == 0:\n continue\n elif self.coefficients[i] > 0:\n if polynomial:\n polynomial += \" + \"\n else:\n ... | [
"0.7111181",
"0.6992302",
"0.6929129",
"0.6854676",
"0.6705311",
"0.6557352",
"0.65218335",
"0.65011555",
"0.64985365",
"0.64926213",
"0.6481688",
"0.64638996",
"0.6462432",
"0.6389068",
"0.63285744",
"0.63215214",
"0.6314778",
"0.62807596",
"0.624424",
"0.624424",
"0.6227594... | 0.7399 | 0 |
r""" Generate Latex string for a Bernstein basis polynomial on an ndimensional simplex T, where n is equal to the length of nu. | def bernstein_basis_fn_simplex_latex(nu, r, vertices):
return bernstein_basis_fn_simplex(nu, r, vertices).to_monomial_basis().latex_str() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_basis(n):\n\treturn ' '.join('e{}'.format(i) for i in range(n))",
"def unique_identifier_bernstein_basis_simplex(vertices):\n from polynomials_on_simplices.generic_tools.code_generation_utils import CodeWriter\n identifier = CodeWriter()\n identifier.wl(\"Bernstein(\")\n identifier.inc_indent... | [
"0.6881511",
"0.6783569",
"0.6775094",
"0.6775094",
"0.6598179",
"0.6362153",
"0.6275768",
"0.6222643",
"0.60899323",
"0.60557127",
"0.58976865",
"0.58730906",
"0.5832814",
"0.58267266",
"0.57783717",
"0.5705496",
"0.56766385",
"0.5655232",
"0.5592996",
"0.55916816",
"0.55674... | 0.73876697 | 0 |
Renders the home page. | def home(request):
cart = Cart(request)
products = Product.objects.order_by('-created')[:3]
last = Blog.objects.order_by('-posted')[:3]
assert isinstance(request, HttpRequest)
return render(
request,
'app/index.html',
{
'title':'СТО',
'cart': cart,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n\n return render_template('home_page.html')",
"def home():\n\n return render_template(\"home.html\")",
"def home():\n return render_template('home.html')",
"def home():\n return render_template('home.html')",
"def ... | [
"0.85574406",
"0.853399",
"0.8351404",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.827363",
"... | 0.0 | -1 |
Renders the about page. | def about(request):
cart = Cart(request)
assert isinstance(request, HttpRequest)
return render(
request,
'app/about.html',
{
'cart': cart,
'title':'Автосервис Локнянский район',
'message':'Вас приветствует компания «СТО»!',
'year':datetime... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Renders the about page. | def videopost(request):
cart = Cart(request)
assert isinstance(request, HttpRequest)
return render(
request,
'app/videopost.html',
{
'title':'Видео',
'cart': cart,
'message':'Приятного просмотра!',
'year':datetime.now().year,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Renders the about page. | def test():
return render_template(
'test.html',
title='Test',
time=datetime.now(),
message='test your model',
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Renders the about page. | def browser():
return render_template(
'browser.html',
title='Browser',
time=datetime.now(),
message='search for knowladge',
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Renders the about page. | def signin():
return render_template(
'signin.html',
title='Signin',
time=datetime.now(),
message='only for administrator'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Renders the about page. | def signup():
return render_template(
'signup.html',
title='Signup',
time=datetime.now(),
message='not aviliable'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Renders the about page. | def about():
return render_template(
'about.html',
title='About',
time=datetime.now(),
message='about me'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.8239194 | 21 |
Loads and reads a yaml configuration file | def load_yaml_config(config_path):
with open(config_path, 'r') as user_config_file:
return yaml.load(user_config_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_cfg(filepath=\"./config.yaml\"):\n with open(filepath, \"r\") as f:\n return yaml.load(f, Loader=yaml.FullLoader)",
"def load_config(path):\n return yaml.load(open('config.yaml', 'r'), Loader=yaml.SafeLoader)",
"def load_config():\n proj_dir = os.path.dirname(os.path.abspath(__file__))... | [
"0.8253691",
"0.8227152",
"0.8189073",
"0.81550354",
"0.8107381",
"0.8095432",
"0.8077228",
"0.8075745",
"0.8044924",
"0.80416363",
"0.7991479",
"0.7972011",
"0.79596174",
"0.7934281",
"0.7908818",
"0.7891146",
"0.78899914",
"0.7869296",
"0.7855025",
"0.7845873",
"0.7839812",... | 0.790493 | 15 |
__init__ method instantiation of size | def __init__(self, size=0):
self.__size = size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, size):\n self.size = size",
"def __init__(self, size):\n self.size = size",
"def __init__(self, size):\n self.__size = size",
"def __init__(self, size):\n self.__size = size",
"def __init__(self, size):\n self.__size = size",
"def __init__(self, size:... | [
"0.8872378",
"0.8872378",
"0.88716817",
"0.88716817",
"0.88716817",
"0.868926",
"0.85915357",
"0.8540644",
"0.847417",
"0.84606385",
"0.8458912",
"0.83769894",
"0.83666134",
"0.8359665",
"0.83457243",
"0.8252775",
"0.8000456",
"0.7993251",
"0.7911812",
"0.77864283",
"0.777426... | 0.8926031 | 0 |
The set of arguments for constructing a ProfileHttp resource. | def __init__(__self__, *,
name: pulumi.Input[str],
accept_xff: Optional[pulumi.Input[str]] = None,
app_service: Optional[pulumi.Input[str]] = None,
basic_auth_realm: Optional[pulumi.Input[str]] = None,
defaults_from: Optional[pulumi.In... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: ProfileHttpArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n args: OAuthArgs,\n opts: Optional[... | [
"0.76145476",
"0.5805028",
"0.566194",
"0.5653855",
"0.5653855",
"0.5638899",
"0.56004924",
"0.5568422",
"0.5568422",
"0.556269",
"0.55502343",
"0.5498857",
"0.54807425",
"0.54516083",
"0.54516083",
"0.5431023",
"0.5424911",
"0.54103386",
"0.5408017",
"0.53971875",
"0.5394972... | 0.0 | -1 |
Utility to deserialize a ParamSchema from JSON. Currently, we only JSONserialize when the module specification has an explicit `param_schema`. This is rare, and [20210412] we want to remove this feature entirely. TODO when `param_schema` is gone, nix this class. This feature is for compatibility with old modules; and s... | def parse(json_value: Dict[str, Jsonish]) -> ParamSchema:
return _parse_kwargs(**json_value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_schema(schema_obj, json_format='DEVICE_RESOURCE', compact=True):\n\n json_format = getattr(json_utils.JsonFormat, json_format)\n\n if isinstance(schema_obj, schema.Trait):\n json_dict = json_utils.trait_as_json(schema_obj, json_format)\n else:\n raise Exception('Invalid object passed to json_sche... | [
"0.5757803",
"0.55419505",
"0.55040157",
"0.548355",
"0.5440311",
"0.5424075",
"0.53926855",
"0.5376262",
"0.5331298",
"0.5321268",
"0.5286813",
"0.5277585",
"0.52547145",
"0.5252292",
"0.51834023",
"0.5164146",
"0.5155698",
"0.50901926",
"0.5050827",
"0.5043471",
"0.5043451"... | 0.63841665 | 0 |
Loads all the activities from the file into the list of activities. Returns the list of activities. | def activities_list(self):
self.__load_activities_from_file_into_memory()
return self._activities_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_activities_list(self):\n self.__load_activities_from_file_into_memory()\n return super().get_all_activities_list()",
"def load_exported_activities() -> List[DiscoveredActivities]:\n activities = []\n activities.extend(discover_actions(\"chaosgcp.gke.nodepool.actions\"))\n activ... | [
"0.79852253",
"0.6559405",
"0.6496666",
"0.6353258",
"0.6102368",
"0.5991136",
"0.5942763",
"0.5929151",
"0.58657825",
"0.580026",
"0.57811517",
"0.57716656",
"0.56928277",
"0.5680871",
"0.5629954",
"0.5613225",
"0.5603758",
"0.56012964",
"0.56006277",
"0.557708",
"0.55625767... | 0.8247419 | 0 |
Loads all the activities from the file into the list of activities. Returns the complete list of activities. | def get_all_activities_list(self):
self.__load_activities_from_file_into_memory()
return super().get_all_activities_list() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activities_list(self):\n self.__load_activities_from_file_into_memory()\n return self._activities_list",
"def load_exported_activities() -> List[DiscoveredActivities]:\n activities = []\n activities.extend(discover_actions(\"chaosgcp.gke.nodepool.actions\"))\n activities.extend(discove... | [
"0.8267145",
"0.6617499",
"0.6548952",
"0.6380001",
"0.6094993",
"0.60769653",
"0.6066585",
"0.6002582",
"0.59016114",
"0.5855836",
"0.5802925",
"0.5746933",
"0.57140315",
"0.571402",
"0.5648419",
"0.5644593",
"0.5631852",
"0.5625704",
"0.55841",
"0.5580204",
"0.5568014",
"... | 0.80676174 | 1 |
Setter for the list of persons. Raises PersonRepositoryError if the new value of the list of persons is actually not a list or if the list does not contain objects of type Person. | def person_list(self, new_persons_list):
self._person_list = new_persons_list
self.__save_persons_from_memory_to_file() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_persons(self, persons: List[Person]):\n self.person_list.model().set_person_list(persons)",
"def set_people(self, people: list):\n self._people = people",
"def add_people(self, people_list):\n\n for person in people_list:\n self.add_person(person)",
"def get_persons(se... | [
"0.7826249",
"0.65931576",
"0.5316461",
"0.5237074",
"0.50628424",
"0.50080156",
"0.49597588",
"0.49585736",
"0.4921812",
"0.48459816",
"0.48397595",
"0.48379147",
"0.47306326",
"0.47130105",
"0.47052866",
"0.47015065",
"0.46710578",
"0.46566114",
"0.46376997",
"0.46320295",
... | 0.64686096 | 2 |
returns the birthdate as a datetime.date() object if possible this expects a specific format for the birthday ex '09 apr 1999' so may not be robust, could use dateutil.parser instead but slower and would introduce another dependency | def birthdate_date(self):
bday = self.birthdate
if bday:
dt = datetime.datetime.strptime(
bday,
"%d %b %Y") # not sure if this format even complies with spec
# dt = dateutil.parser.parse(bday) # this will guess at a bunch of different formats
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_birth_date(number):\n number = compact(number)\n year = int(number[0:2]) + 1900\n month = int(number[2:4])\n day = int(number[4:6])\n if month > 40:\n year += 100\n month -= 40\n elif month > 20:\n year -= 100\n month -= 20\n try:\n return datetime.da... | [
"0.81020385",
"0.7319195",
"0.71593773",
"0.7023016",
"0.70085293",
"0.68448037",
"0.65789187",
"0.6516955",
"0.6509355",
"0.65059084",
"0.64694095",
"0.6439416",
"0.6386427",
"0.6352316",
"0.63108397",
"0.6302468",
"0.62832075",
"0.6279401",
"0.62697566",
"0.6230386",
"0.621... | 0.82082915 | 0 |
Hash password on the fly. | def encrypt_password(password,salt=None):
if salt is None:
salt = os.urandom(8) #64 bits
assert 8 == len(salt)
assert isinstance(salt,str)
if isinstance(password,unicode):
password = password.encode('UTF-8')
assert isinstance(password,str)
result = password
for i in xrange(10):
result = HMAC(result,sal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_password(self, password):\n self.password_hash = generate_password_hash(password)",
"def hash_password(self):\n self.__password = self.str_to_hash(self.__password)",
"def hash_password(self, password):\n self.password = pwd_context.encrypt(password)",
"def hash_passwd(password, ... | [
"0.8297606",
"0.82832325",
"0.82337004",
"0.81127435",
"0.79989094",
"0.7891337",
"0.7885906",
"0.7885229",
"0.77582955",
"0.77339685",
"0.7717322",
"0.7690775",
"0.7681501",
"0.76435494",
"0.7574917",
"0.7568411",
"0.7549169",
"0.75351477",
"0.75259656",
"0.75126886",
"0.748... | 0.0 | -1 |
Test if other is a ``Nothing`` | def __eq__(self, other: Any) -> bool:
return isinstance(other, Nothing) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_none(obj):\n return obj is None",
"def assert_is_not_none(self, obj):\n if obj is None:\n raise AssertionError('unexpectedly None')",
"def isnone(cls, lhs, rhs):\n if rhs:\n return lhs is None\n else:\n return lhs is not None",
"def assert_is_no... | [
"0.6790961",
"0.6775323",
"0.67354625",
"0.66912407",
"0.66064835",
"0.66064835",
"0.6525707",
"0.6316487",
"0.62589484",
"0.6171513",
"0.61665356",
"0.61387193",
"0.6116199",
"0.60748184",
"0.60035574",
"0.5997523",
"0.597476",
"0.5972445",
"0.5958383",
"0.5921005",
"0.59158... | 0.750822 | 0 |
Map each in element in ``iterable`` to an `Maybe` by applying ``f``, combine the elements by ``and_then`` from left to right and collect the results | def for_each(f: Callable[[A], Maybe[B]], iterable: Iterable[A]
) -> Maybe[Iterable[B]]:
return cast(Maybe[Iterable[B]], map_m_(Just, f, iterable)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_(f: Callable[[A], Maybe[bool]], iterable: Iterable[A]\n ) -> Maybe[Iterable[A]]:\n return cast(Maybe[Iterable[A]], filter_m_(Just, f, iterable))",
"def sync_filter(func, *iterables):\n return tuple(zip(*tuple(i for i in zip(*iterables) if func(*i)))) or ((),) * len(\n iterables... | [
"0.683531",
"0.6570869",
"0.6216111",
"0.6079412",
"0.60599786",
"0.6024615",
"0.58602774",
"0.5830167",
"0.5804551",
"0.57812166",
"0.5747188",
"0.5741817",
"0.56621706",
"0.5630761",
"0.5627643",
"0.559376",
"0.55421543",
"0.5523191",
"0.5519378",
"0.55009633",
"0.5491813",... | 0.7214548 | 0 |
Evaluate each `Maybe` in `iterable` from left to right and collect the results | def gather(iterable: Iterable[Maybe[A]]) -> Maybe[Iterable[A]]:
return cast(Maybe[Iterable[A]], sequence_(Just, iterable)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def for_each(f: Callable[[A], Maybe[B]], iterable: Iterable[A]\n ) -> Maybe[Iterable[B]]:\n return cast(Maybe[Iterable[B]], map_m_(Just, f, iterable))",
"def zip_strict(*iterables) -> Iterator[Tuple[Any, ...]]:\n for values in itertools.zip_longest(*iterables, fillvalue=_NO_VALUE):\n if ... | [
"0.62100303",
"0.61878884",
"0.60121775",
"0.5865769",
"0.57884717",
"0.564262",
"0.5507848",
"0.5414224",
"0.5388569",
"0.53844273",
"0.53824294",
"0.5363936",
"0.53018177",
"0.5269423",
"0.52642286",
"0.5236355",
"0.52169913",
"0.52123004",
"0.521062",
"0.52056295",
"0.5187... | 0.6700187 | 0 |
Map each element in ``iterable`` by applying ``f``, filter the results by the value returned by ``f`` and combine from left to right. | def filter_(f: Callable[[A], Maybe[bool]], iterable: Iterable[A]
) -> Maybe[Iterable[A]]:
return cast(Maybe[Iterable[A]], filter_m_(Just, f, iterable)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map(iterable, function):\n for x in iterable:\n yield function(x)",
"def map(function, iterable):\n\n return [function(x) for x in iterable]",
"def eager_map(func, iterable):\n for _ in map(func, iterable):\n continue",
"def custom_filter(function, iterable):\n map_list = []\n\n... | [
"0.7251455",
"0.7175117",
"0.7020224",
"0.6756686",
"0.6678618",
"0.6609626",
"0.65993476",
"0.64596534",
"0.6458392",
"0.6432338",
"0.6424503",
"0.6323302",
"0.63195395",
"0.628959",
"0.62732714",
"0.62570184",
"0.62494874",
"0.6245453",
"0.6239287",
"0.62167114",
"0.6206598... | 0.6460645 | 7 |
Returns the area of the intersection of rect1 and rect2. | def rect_overlap(rect1, rect2):
a_x1, a_y1 = rect1[0], rect1[1]
a_x2, a_y2 = (rect1[0] + rect1[2], rect1[1] + rect1[3])
b_x1, b_y1 = rect2[0], rect2[1]
b_x2, b_y2 = (rect2[0] + rect2[2], rect2[1] + rect2[3])
x_overlap = max(0, min(a_x2, b_x2) - max(a_x1, b_x1))
y_overlap = max(0, min(a_y2, b_y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersection(self, rect1, rect2):\n x_overlap = max(0, min(rect1[2], rect2[2]) - max(rect1[0], rect2[0]));\n y_overlap = max(0, min(rect1[3], rect2[3]) - max(rect1[1], rect2[1]));\n overlapArea = x_overlap * y_overlap;\n return overlapArea",
"def rectangle_area(side1, side2):\n ... | [
"0.87367576",
"0.7633097",
"0.73273516",
"0.7185483",
"0.71412265",
"0.7139906",
"0.7107129",
"0.708203",
"0.69787174",
"0.6974816",
"0.68132764",
"0.6762367",
"0.67407554",
"0.67233235",
"0.6720328",
"0.6706742",
"0.66955537",
"0.66910744",
"0.6682125",
"0.66679966",
"0.6600... | 0.71903694 | 3 |
Count the street segments in a graph. | def street_segment_count(Gu):
if nx.is_directed(Gu): # pragma: no cover
msg = "`Gu` must be undirected"
raise ValueError(msg)
return len(Gu.edges) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSegmentCount(self) -> int:\n ...",
"def streets_per_node(G):\n spn = dict(nx.get_node_attributes(G, \"street_count\"))\n if set(spn) != set(G.nodes):\n utils.log(\"Graph nodes changed since `street_count`s were calculated\", level=lg.WARN)\n return spn",
"def intersection_count(G=... | [
"0.71917665",
"0.6890167",
"0.67987233",
"0.67634314",
"0.6593176",
"0.6588408",
"0.6393734",
"0.6276597",
"0.62207896",
"0.61719656",
"0.6150089",
"0.61224663",
"0.61148417",
"0.6110462",
"0.60974544",
"0.60961956",
"0.60575265",
"0.603176",
"0.60223925",
"0.5987696",
"0.596... | 0.816311 | 0 |
Calculate graph's total edge length. | def edge_length_total(G):
return sum(d["length"] for u, v, d in G.edges(data=True)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_edge_length(e1, e2):\n return cumulative_edge_length(e1) + cumulative_edge_length(e2)",
"def edge_count(self):\r\n return int(sum(self.degree(node) for node in range(self.size))/2)",
"def edge_length(self):\n if self.edge_length_l is not None:\n return self.edge_le... | [
"0.80897945",
"0.7964335",
"0.7924461",
"0.77279925",
"0.7690008",
"0.7684863",
"0.7575776",
"0.7561272",
"0.7500546",
"0.74950117",
"0.7481418",
"0.7456864",
"0.7322643",
"0.7253831",
"0.72487533",
"0.7241834",
"0.7218384",
"0.71834904",
"0.7152275",
"0.71451384",
"0.7084773... | 0.8605104 | 0 |
Count how many physical street segments connect to each node in a graph. This function uses an undirected representation of the graph and special handling of selfloops to accurately count physical streets rather than | def count_streets_per_node(G, nodes=None):
if nodes is None:
nodes = G.nodes
# get one copy of each self-loop edge, because bi-directional self-loops
# appear twice in the undirected graph (u,v,0 and u,v,1 where u=v), but
# one-way self-loops will appear only once
Gu = G.to_undirected(recip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def street_segment_count(Gu):\n if nx.is_directed(Gu): # pragma: no cover\n msg = \"`Gu` must be undirected\"\n raise ValueError(msg)\n return len(Gu.edges)",
"def streets_per_node(G):\n spn = dict(nx.get_node_attributes(G, \"street_count\"))\n if set(spn) != set(G.nodes):\n uti... | [
"0.7726195",
"0.72637564",
"0.653957",
"0.648862",
"0.6440568",
"0.62407386",
"0.62299365",
"0.6229824",
"0.6099914",
"0.607879",
"0.59639335",
"0.59526366",
"0.59492844",
"0.59490424",
"0.5944075",
"0.5924882",
"0.58913624",
"0.5878114",
"0.5855811",
"0.58346117",
"0.5823304... | 0.77666306 | 0 |
Set a log level on multiple loggers. | def set_loggers_level(names, level=logging.CRITICAL):
for item in names:
logging.getLogger(item).setLevel(level) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_log_level(loggers=[\"vaex\"], level=logging.DEBUG):\n for logger in loggers:\n logging.getLogger(logger).setLevel(level)",
"def setLevel(level:int)->None:\n for logger in loggers:\n logger.setLevel(level)",
"def set_level(log_or_name, level):\n if isinstance(log_or_name, str):\n ... | [
"0.7988111",
"0.7885556",
"0.7546036",
"0.7409401",
"0.73701704",
"0.727431",
"0.7135809",
"0.7076048",
"0.702882",
"0.70092934",
"0.70003825",
"0.6798814",
"0.6768105",
"0.67616075",
"0.674776",
"0.67422724",
"0.6732747",
"0.6716366",
"0.66200304",
"0.6588882",
"0.65873796",... | 0.72892696 | 5 |
Whether the member has paid within 12 months of start_date anniversary | def paid(self):
try:
start_date = self.member_membership.start_date
except AttributeError:
# not available
start_date = None
try:
paid_date = self.member_membership.membership_paid
except AttributeError:
# not available
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def membership_valid(self):\n\n today = date.today()\n\n if self.dues_paid is None:\n return False\n\n months = 12 if self.dues_paid_year else 6\n dues_due = datetime.combine(self.dues_paid, datetime.min.time()) + relativedelta(months=+months)\n dues_due = dues_due.date()\n\n return dues_due... | [
"0.6783928",
"0.58685315",
"0.5664983",
"0.5652392",
"0.5620663",
"0.5554445",
"0.54436195",
"0.54180926",
"0.5393099",
"0.5381219",
"0.53556484",
"0.5354",
"0.52991396",
"0.5234744",
"0.5201317",
"0.5196411",
"0.5190209",
"0.5185595",
"0.51814294",
"0.5179355",
"0.5177061",
... | 0.6628632 | 1 |
Creates color object from hex value | def setHex ( self, hex ):
#self.reset()
hex = hex.lower().lstrip('#')
if len(hex) < 2:
hex = hex[0]*6
if len(hex) < 6:
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]
rgb = []
for i in range(0, 6, 2):
rgb.append( int( hex[i:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def HexColor(val):\n if isinstance(val, str):\n val = int(val, 16)\n factor = 1.0 / 255\n return Color(factor * ((val >> 16) & 0xFF), factor * ((val >> 8) & 0xFF), factor * (val & 0xFF))",
"def string_to_color(s):\n if type(s) is not str:\n raise TypeError(\"s must be a string\")\n\n ... | [
"0.74645686",
"0.68058974",
"0.6786588",
"0.6782743",
"0.67674017",
"0.6748794",
"0.67076916",
"0.670755",
"0.6706262",
"0.6690976",
"0.6681837",
"0.6665455",
"0.6657626",
"0.6605599",
"0.6584813",
"0.65503466",
"0.6514325",
"0.6509743",
"0.6492112",
"0.64762527",
"0.64592874... | 0.6095297 | 63 |
Modifies alpha value of Colz object | def setAlpha ( self, newalpha ):
if isinstance( newalpha, int ):
raise ValueError('Expects a float value in the [ 0.0 - 1.0 ] range!')
if newalpha > 1.0:
newalpha = 1.0
if newalpha < 0.0:
newalpha = 0.0
self.a = newalpha
self.hsla[3] = newalph... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_alpha(self, alpha=1.0):\r\n self.unif[17] = alpha",
"def alpha(self):\n return self._alpha",
"def alpha(self):\n return self._alpha",
"def alpha(self):\n return self._alpha",
"def alphahighz(self, z):\n return self.alphaMe(3.8,self.r_vect[0],self.alpha0_vect[0]) - 0.0... | [
"0.7291084",
"0.64543456",
"0.64543456",
"0.64543456",
"0.64412254",
"0.62790895",
"0.6227887",
"0.6217996",
"0.6191732",
"0.6156093",
"0.6145445",
"0.61348635",
"0.6122557",
"0.61162037",
"0.61106855",
"0.6092518",
"0.60706127",
"0.60697395",
"0.6041988",
"0.60338587",
"0.60... | 0.6459709 | 1 |
The current state of the test. | def state(self):
result = self.getResult()
return result.state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetState(self):\n return TestState.FromDictOrObject(\n self.root.state_instance.GetTestState(self.path))",
"def get_state(self):\n pass",
"def state(self):\n return self.get_state()",
"def GetState(self):\r\n \r\n return self.state",
"def get_state(self):\n ... | [
"0.7699328",
"0.76760226",
"0.75339425",
"0.7441948",
"0.7411168",
"0.7388862",
"0.7386131",
"0.7382336",
"0.7382336",
"0.7382336",
"0.73766387",
"0.73599607",
"0.7358034",
"0.73565334",
"0.73565334",
"0.7342765",
"0.7342765",
"0.73110044",
"0.7284771",
"0.7284771",
"0.728131... | 0.77714115 | 0 |
YAML constructor to parse CloudFormation intrinsics. This will return a dictionary with key being the intrinsic name | def intrinsics_multi_constructor(loader, tag_prefix, node):
# Get the actual tag name excluding the first exclamation
tag = node.tag[1:]
# Some intrinsic functions doesn't support prefix "Fn::"
prefix = "Fn::"
if tag in ["Ref", "Condition"]:
prefix = ""
cfntag = prefix + tag
if t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_intrinsics(self):\n data = self.um.read_json(\"intrinsics.json\")\n K = np.asarray(data[\"K\"])\n d = np.asarray(data[\"dist\"])\n return K, d",
"def load_extrinsics(self):\n return self.um.read_json(\"extrinsics.json\")",
"def intrinsics(self) -> 'Intrinsics':\n ... | [
"0.6100075",
"0.58797526",
"0.558503",
"0.55827683",
"0.5291809",
"0.5234966",
"0.5163385",
"0.5068605",
"0.5064009",
"0.50320727",
"0.50291413",
"0.5002577",
"0.49949342",
"0.49707824",
"0.49578145",
"0.49450013",
"0.48564067",
"0.48346075",
"0.4826982",
"0.47801146",
"0.475... | 0.6330519 | 0 |
get a img and fix it to be white shape on black background. For cv2.findcontoure | def getContours(img,iteration):
nP, IDrange = upDate(iteration)
imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
retvalth, imgthreshold = cv2.threshold(imgray, 50, 255, cv2.THRESH_BINARY)
kernel = np.ones((nP, nP), np.uint8)
imgdilation = cv2.dilate(imgthreshold, kernel, iterations=2)
contours = [... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_background(img):\n mask = np.zeros(img.shape[:2], np.uint8)\n bgdModel = np.zeros((1, 65), np.float64)\n fgdModel = np.zeros((1, 65), np.float64)\n rect = (50, 50, 450, 290)\n cv.grabCut(img, mask, rect, bgdModel, fgdModel, 5, cv.GC_INIT_WITH_RECT)\n mask2 = np.where((mask == 2)|(mask ... | [
"0.74553186",
"0.7216853",
"0.7153314",
"0.712384",
"0.6948857",
"0.6876768",
"0.6781909",
"0.6754013",
"0.6670795",
"0.66672087",
"0.65554315",
"0.6553039",
"0.65137583",
"0.6509963",
"0.6495197",
"0.6473887",
"0.6427652",
"0.6419565",
"0.6404641",
"0.63927",
"0.63850754",
... | 0.0 | -1 |
Computes a random string to be used as state or secret key. | def new_state():
return ''.join(random.choice(string.ascii_uppercase + string.digits)
for x in range(32)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateRandomString():\n return ''.join(b64encode(urandom(32)).decode('utf-8'))",
"def randkey():\n return binascii.b2a_hex(os.urandom(15))",
"def generate_key():\r\n\t\treturn ''.join(random.SystemRandom().choice(string.ascii_lowercase) for _ in range(123))",
"def _generateSecretKey():\n retur... | [
"0.8043993",
"0.7775811",
"0.77545613",
"0.770755",
"0.76712376",
"0.7539378",
"0.7502678",
"0.7500874",
"0.74869955",
"0.7471307",
"0.74634933",
"0.74394155",
"0.7387825",
"0.7370941",
"0.7322273",
"0.7304592",
"0.7223968",
"0.7206033",
"0.717198",
"0.7170669",
"0.7165698",
... | 0.7284571 | 16 |
autocomplete the Combobox, delta may be 0/1/1 to cycle through possible hits | def autocomplete(self, delta=0):
if delta: # need to delete selection otherwise we would fix the current position
self.delete(self.position, tkinter.END)
else: # set position to end so selection starts where textentry ended
self.positio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autocomplete(self, delta=0):\r\n if delta: # need to delete selection otherwise we would fix the current position\r\n self.delete(self.position, tkinter.END)\r\n else: # set position to end so selection starts where textentry ended\r\n ... | [
"0.77164525",
"0.754218",
"0.6385934",
"0.60792255",
"0.60147494",
"0.59124506",
"0.5826263",
"0.5823474",
"0.58233815",
"0.5812261",
"0.5788605",
"0.575753",
"0.57353824",
"0.5664817",
"0.55787563",
"0.55611646",
"0.5520945",
"0.55146486",
"0.5480999",
"0.54611045",
"0.54479... | 0.77404076 | 0 |
Return the device state attributes. | def extra_state_attributes(self):
attrs = {
"device_id": self._device_id,
"is_smart_program": self._program.get("is_smart_program", False),
"frequency": self._program.get("frequency"),
"start_times": self._program.get("start_times"),
"budget": self._p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\r\n return self._attributes",
"def device_state_attributes(self):\n return self._attrs",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self... | [
"0.93173087",
"0.9245708",
"0.92207897",
"0.92147964",
"0.92147964",
"0.9210798",
"0.9210798",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
"0.91909975",
... | 0.7659658 | 84 |
Turn the switch off. | async def async_turn_off(self, **kwargs: Any) -> None:
await self._set_state(False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self, **kwargs):\n self.smartplug.turn_off()",
"def off_switch(self):\n self._switch_callback = None",
"def turn_off(self):\n self.handleCommand(1)\n self._state = STATE_OFF",
"def turn_off(self, **kwargs):\n set_sonoff_state(self._host, \"off\")\n self.... | [
"0.870139",
"0.867637",
"0.85906535",
"0.8523712",
"0.84588856",
"0.84180963",
"0.8404447",
"0.8398465",
"0.8375364",
"0.83491224",
"0.83192796",
"0.82949907",
"0.8277566",
"0.81680954",
"0.8155346",
"0.8112255",
"0.8091075",
"0.8072859",
"0.8058921",
"0.8058517",
"0.8041678"... | 0.73486954 | 69 |
Turns off the switch and stops watering. | async def stop_watering(self):
station_payload = []
self._is_on = False
await self._send_station_message(station_payload) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self):\n self._interrupt_flash()\n if self.on:\n GPIO.output(self.pin, GPIO.LOW)\n self.on = False",
"def turn_off(self):\n GPIO.output(self.gpio, False) # turn off light",
"def switch_off(self):\n if threading.current_thread() != self._blinking_t... | [
"0.803842",
"0.7973545",
"0.79087275",
"0.78886795",
"0.78565776",
"0.7816946",
"0.78160167",
"0.7814353",
"0.770318",
"0.7674458",
"0.7651748",
"0.76347125",
"0.7630959",
"0.7621588",
"0.7567996",
"0.75316113",
"0.75139046",
"0.74987125",
"0.74708235",
"0.746868",
"0.7452892... | 0.7483791 | 18 |
Turn the switch off. | async def async_turn_off(self, **kwargs: Any) -> None:
await self.stop_watering() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self, **kwargs):\n self.smartplug.turn_off()",
"def off_switch(self):\n self._switch_callback = None",
"def turn_off(self):\n self.handleCommand(1)\n self._state = STATE_OFF",
"def turn_off(self, **kwargs):\n set_sonoff_state(self._host, \"off\")\n self.... | [
"0.870139",
"0.867637",
"0.85906535",
"0.8523712",
"0.84588856",
"0.84180963",
"0.8404447",
"0.8398465",
"0.8375364",
"0.83491224",
"0.83192796",
"0.82949907",
"0.8277566",
"0.81680954",
"0.8155346",
"0.8112255",
"0.8091075",
"0.8072859",
"0.8058921",
"0.8058517",
"0.8041678"... | 0.0 | -1 |
Turn the switch off. | async def async_turn_off(self, **kwargs: Any) -> None:
self._is_on = False
await self.disable_rain_delay() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self, **kwargs):\n self.smartplug.turn_off()",
"def off_switch(self):\n self._switch_callback = None",
"def turn_off(self):\n self.handleCommand(1)\n self._state = STATE_OFF",
"def turn_off(self, **kwargs):\n set_sonoff_state(self._host, \"off\")\n self.... | [
"0.870139",
"0.867637",
"0.85906535",
"0.8523712",
"0.84588856",
"0.84180963",
"0.8404447",
"0.8398465",
"0.8375364",
"0.83491224",
"0.83192796",
"0.82949907",
"0.8277566",
"0.81680954",
"0.8155346",
"0.8112255",
"0.8091075",
"0.8072859",
"0.8058921",
"0.8058517",
"0.8041678"... | 0.71220154 | 97 |
Shift `bits` in direction `dir_` `times` times. | def shift(bits: int, dir_: str, times: int = 1) -> int:
dir_ = dir_.lower()
res = bits
if "n" in dir_:
res <<= 8 * times
if "e" in dir_:
# wall is a bit mask that ensures bits aren't shifted beyond where
# they are meant to go
wall = not_(reduce(op.or_, (W_EDGE >> shift_ ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dilate(bits: int, dir_: str, times: int = 1) -> int:\n for _ in range(times):\n bits |= shift(bits, dir_)\n return bits",
"def shift(self, direction):\n direct, pos = tuple(direction)\n\n board = {'L': self.rows, 'R': self.rows, 'D': self.cols, 'U': self.cols}[direct]\n boar... | [
"0.78796357",
"0.5864915",
"0.5784788",
"0.5684395",
"0.5665376",
"0.5651093",
"0.5631796",
"0.56232446",
"0.55871636",
"0.5498323",
"0.5447118",
"0.5446885",
"0.5436304",
"0.54155725",
"0.5392669",
"0.5372359",
"0.533412",
"0.53151447",
"0.53129715",
"0.52641565",
"0.5210433... | 0.77216744 | 1 |
Testing function for get_valid_pagination_args with different possible arguments | def test_get_valid_pagination_args():
# Normal case for page 0 and per page 10
assert utils.get_valid_pagination_args(
{"pageIndex": 0, "pageSize": 10}) == (0, 10, 0, 10)
# Normal case for page 5 and per page 15
assert utils.get_valid_pagination_args(
{"pageIndex": 5, "pageSize": 15}) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_pagination(self):\n self.check_pagination()",
"def validate_common_arguments(args: Dict) -> dict:\n page = arg_to_number(args.get(\"page\", 0))\n if (page is None) or (page < 0):\n raise ValueError(ERR_MSG[\"PAGE\"])\n args['page'] = page\n\n limit = arg_to_number(args.get(\"li... | [
"0.7295281",
"0.6634801",
"0.66194624",
"0.6559157",
"0.6533973",
"0.6460649",
"0.64065206",
"0.63259715",
"0.61040294",
"0.6054383",
"0.6054383",
"0.6054383",
"0.6054383",
"0.6054383",
"0.6054383",
"0.6054383",
"0.6054383",
"0.6054383",
"0.6054383",
"0.6054383",
"0.6054383",... | 0.8751833 | 0 |
Convert sparse matrix to tuple representation. | def sparse_to_tuple(sparse_mx):
def to_tuple(mx):
if not sp.isspmatrix_coo(mx):
mx = mx.tocoo()
coords = np.vstack((mx.row, mx.col)).transpose()
values = mx.data
shape = mx.shape
return coords, values, shape
if isinstance(sparse_mx, list):
for i in ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sparse_to_tuple(sparse_mx):\n def to_tuple(mx):\n if not sp.isspmatrix_coo(mx):\n mx = mx.tocoo()\n coords = np.vstack((mx.row, mx.col)).transpose()\n values = mx.data\n shape = mx.shape\n return coords, values, shape",
"def sparse_to_tuple(sparse_mx):\r\n ... | [
"0.85870504",
"0.82527",
"0.82527",
"0.8091624",
"0.7986327",
"0.602773",
"0.59843755",
"0.5971062",
"0.59706587",
"0.59447116",
"0.59443593",
"0.5910293",
"0.5910293",
"0.5910293",
"0.5910293",
"0.5910293",
"0.58940256",
"0.58499134",
"0.5845008",
"0.577404",
"0.5689886",
... | 0.82655305 | 5 |
Symmetrically normalize adjacency matrix. | def normalize_adj(adj):
adj = sp.coo_matrix(adj)
rowsum = np.array(adj.sum(1))
d_inv_sqrt = np.power(rowsum, -0.5).flatten()
d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.
d_mat_inv_sqrt = sp.diags(d_inv_sqrt)
return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt).tocoo() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_adj(adj):\n\n rowsum = np.array(adj.sum(1))\n d_inv_sqrt = np.power(rowsum, -0.5).flatten()\n d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.\n d_mat_inv_sqrt = np.diag(d_inv_sqrt)\n return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt)",
"def normalize_adj(adj):\r\n adj = sp.coo_m... | [
"0.788518",
"0.7691616",
"0.759434",
"0.7566608",
"0.7335597",
"0.730491",
"0.72684425",
"0.688461",
"0.68616927",
"0.686005",
"0.6832041",
"0.682895",
"0.6750887",
"0.6750057",
"0.67278",
"0.66282207",
"0.6616473",
"0.64879745",
"0.6486613",
"0.63610464",
"0.63610464",
"0.... | 0.7698141 | 6 |
Adds a Button called 'Next' to the layout. When pressed, sends the current results and fetches another task. | def add_NextButton(self):
next_button = Button(text="Next", font_size ="20sp", background_color =(1, 1, 1, 1), color =(1, 1, 1, 1), size =(32, 32), size_hint =(.3, .3)) #, pos =(300, 250)
next_button.bind(on_release = lambda a : self.next_button_handler())
self.layout.add_widget(next_button) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_next_clicked(self):\r\n self.signal_step.emit()",
"def on_btPageNext_clicked(self, widget, data=None):\n\n self.page += 1\n self.part = 1\n self.refresh()",
"async def next(self, button: discord.ui.Button, interaction: discord.Interaction) -> None:\n if self.cursor >= ... | [
"0.6829444",
"0.6791629",
"0.6732026",
"0.66747457",
"0.6666796",
"0.6624469",
"0.6510423",
"0.6506904",
"0.6459566",
"0.6439079",
"0.62949294",
"0.62445337",
"0.6235646",
"0.6193814",
"0.6193635",
"0.61923295",
"0.6184566",
"0.61814576",
"0.61694854",
"0.6146451",
"0.6116720... | 0.6563806 | 6 |
Return dictionary of args serializers to models field. | def fields(self):
_fields = {
i: attrgetter(i) for i in ('pf_type', 'label',)
}
_fields['host'] = self.get_safely_instance_partial(Host, 'host')
return _fields | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jsonable(self, *args, **options):\n d = {}\n for field_name, field in self.schema.normal_fields.items():\n field_val = getattr(self, field_name, None)\n field_val = field.jsonable(self, field_val)\n if field_val is not None:\n d[field_name] = field_... | [
"0.6769626",
"0.6739905",
"0.62569773",
"0.6239226",
"0.6220744",
"0.6170683",
"0.6151614",
"0.61083317",
"0.6080227",
"0.60666424",
"0.6013546",
"0.59526306",
"0.5924315",
"0.5895032",
"0.58899844",
"0.5860346",
"0.58501863",
"0.5846399",
"0.581099",
"0.58000547",
"0.5775692... | 0.0 | -1 |
Get full name (concatenation of first and last names). | def name(self):
return "%s %s" % (self.first_name, self.last_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_full_name(self):\n return self.name+self.last_name",
"def get_full_name(self):\n return self.last_name + self.first_name",
"def get_full_name(self):\n\t\tfull_name = '%s %s' % (self.first_name, self.last_name)\n\t\treturn full_name.strip()",
"def get_full_name(self):\r\n full_nam... | [
"0.9061696",
"0.90596145",
"0.90218693",
"0.8951538",
"0.8951538",
"0.8942685",
"0.8942685",
"0.8942685",
"0.8942685",
"0.8942685",
"0.8942685",
"0.8942685",
"0.8942685",
"0.8942685",
"0.8942685",
"0.8942685",
"0.8942685",
"0.8942685",
"0.8942685",
"0.8942685",
"0.8942685",
... | 0.8038327 | 100 |
Returns a schedule for day. | def _process_schedule(self, day):
schedule = []
for lesson in day:
while len(schedule) + 1 < lesson.order:
# Pad empty lessons
schedule.append(None)
if not len(schedule) == lesson.order:
# One teacher can take two groups at once
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_schedule(self, day, week):\n return self.schedule['schedule'][day][week]",
"def schedule_for_day(self, day, schedule_id=None):\n q = Lesson.query_current(schedule_id)\n q = q.filter(Lesson.day == day).\\\n filter(Lesson.group_id == self.id)\n\n return self._proces... | [
"0.7715069",
"0.75153375",
"0.7382073",
"0.7046179",
"0.70079297",
"0.6951373",
"0.67109233",
"0.66361743",
"0.66265196",
"0.6553121",
"0.64756924",
"0.6443371",
"0.63792485",
"0.6359789",
"0.63507396",
"0.6341506",
"0.6289653",
"0.6287913",
"0.6257238",
"0.62227875",
"0.6222... | 0.55925107 | 58 |
Get educator's schedule for given day. | def schedule_for_day(self, day, schedule_id=None):
lessons = self.lessons_for_day(day, schedule_id, eager=True)
return self._process_schedule(lessons) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_schedule(self, day, week):\n return self.schedule['schedule'][day][week]",
"def schedule_for_day(self, day, schedule_id=None):\n q = Lesson.query_current(schedule_id)\n q = q.filter(Lesson.day == day).\\\n filter(Lesson.group_id == self.id)\n\n return self._proces... | [
"0.7642473",
"0.7551102",
"0.7041133",
"0.64226025",
"0.6293076",
"0.6278404",
"0.6174834",
"0.6054983",
"0.59705925",
"0.5970406",
"0.5914594",
"0.5848147",
"0.5843318",
"0.57548594",
"0.5743789",
"0.5734476",
"0.56963277",
"0.56947154",
"0.5678987",
"0.5664778",
"0.5623758"... | 0.7577669 | 1 |
Return full group name (with index). | def full_name(self, year=None):
return "%d%s" % (self.index(year), self.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group_name(self):\n return self.groupname",
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def group_name(self):\n\n return self._group_name",
"def name(self):\n return f\"{self._group.friendly_name} {GROUP_SUFFIX}\"",
"def get_group_label(gro... | [
"0.76945674",
"0.7601838",
"0.7388015",
"0.73792833",
"0.73335826",
"0.725512",
"0.7232735",
"0.7181677",
"0.7125148",
"0.7116798",
"0.6987131",
"0.69694066",
"0.6933606",
"0.69314396",
"0.69141597",
"0.6901219",
"0.68615675",
"0.68615675",
"0.6859057",
"0.6858987",
"0.684188... | 0.59435165 | 92 |
Get schedule for specific day. | def schedule_for_day(self, day, schedule_id=None):
q = Lesson.query_current(schedule_id)
q = q.filter(Lesson.day == day).\
filter(Lesson.group_id == self.id)
return self._process_schedule(q.all()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_schedule(self, day, week):\n return self.schedule['schedule'][day][week]",
"def schedule_for_day(self, day, schedule_id=None):\n lessons = self.lessons_for_day(day, schedule_id, eager=True)\n return self._process_schedule(lessons)",
"def day(self):\n try:\n return... | [
"0.83514565",
"0.78399163",
"0.7238279",
"0.69318163",
"0.66742676",
"0.654242",
"0.64926195",
"0.64662904",
"0.6449742",
"0.6438249",
"0.63102865",
"0.62651086",
"0.6123177",
"0.6025575",
"0.60232943",
"0.6014741",
"0.59642124",
"0.594865",
"0.59472585",
"0.5910248",
"0.5898... | 0.7957521 | 1 |
Get the part of the group. | def part(self):
if self.first_part and self.second_part:
return None
elif self.first_part:
return 1
elif self.second_part:
return 2
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getGroup(self):\n\t\treturn self.Group",
"def get_group(self):\n\t\treturn self.variables.get('group')",
"def get_group(self, group, intg):\n return self.data[intg, group, :, :]",
"def get_group(self):\n return self._group",
"def get_group(self) -> Optional[str]:\n return self.grou... | [
"0.69818497",
"0.6804674",
"0.67759013",
"0.6689713",
"0.6687045",
"0.6659735",
"0.6659735",
"0.6659735",
"0.65363485",
"0.64723027",
"0.63504833",
"0.63306534",
"0.62337816",
"0.62337816",
"0.62337816",
"0.62274945",
"0.62102747",
"0.61907065",
"0.61804974",
"0.61763936",
"0... | 0.0 | -1 |
check different columns of the 2 dataframes | def compare_dfs(df1: pd.DataFrame, df2: pd.DataFrame) -> list:
# columns only exist in df1
df1_only = list(set(df1.columns) - set(df2.columns))
# columns only exist in df2
df2_only = list(set(df2.columns) - set(df1.columns))
print(df1_only, "\nTotal: ", len(df1_only), "columns\n")
print(df2_only... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkcolumnstest(chosen_columns, chosen_df):\n if not all([item in chosen_columns for item in chosen_df.columns]):\n raise ValueError('Columns do not match')",
"def _check_xy(x: DataFrame, y: DataFrame) -> None:\n if x.shape[1] != y.shape[1]:\n raise ValueError(\n \"not compati... | [
"0.68894875",
"0.6848513",
"0.68411577",
"0.6791011",
"0.6705647",
"0.6620264",
"0.6579515",
"0.6568998",
"0.6493299",
"0.64753973",
"0.6438232",
"0.63630307",
"0.6354558",
"0.629007",
"0.62693506",
"0.61886144",
"0.61874616",
"0.61739635",
"0.61648905",
"0.61572355",
"0.6132... | 0.69747686 | 0 |
Create dataframe that has only quantitative data | def create_quanti_df(df: pd.DataFrame) -> pd.DataFrame:
# create a dictionary that contains datatype of each column
dtypeDict = dict(df.dtypes)
# create a list of column names that contains only quantitative data
quanti_cols = [
key
for key, value in dtypeDict.items()
if value =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_quali_df(df: pd.DataFrame) -> pd.DataFrame:\n\n # create a dictionary that contains datatype of each column\n dtypeDict = dict(df.dtypes)\n # create a list of column names that contains only quantitative data\n quali_cols = [key for key, value in dtypeDict.items() if value == \"object\"]\n ... | [
"0.6787713",
"0.670307",
"0.6138079",
"0.6002758",
"0.60014874",
"0.5995199",
"0.59887767",
"0.59843624",
"0.59818614",
"0.5977802",
"0.5968149",
"0.59641045",
"0.59383124",
"0.58882725",
"0.586543",
"0.5846243",
"0.58450353",
"0.58431244",
"0.58418024",
"0.58363",
"0.5819183... | 0.75262725 | 0 |
Print out number of unique values for each column of a dataframe | def check_unique(df):
print("Number of unique values for each column")
print("=======================================")
# print number of unique values of each column
for col in df.columns:
print(f"{col}: {df[col].nunique()}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_values(df):\n cols = list(df.columns)\n\n for col in cols:\n uniques = (df[col]).unique()\n print(f\"{len(uniques)} unique items in {col}: {df[col].loc[0]},{df[col].loc[1]}, {df[col].loc[2]}...\")",
"def same_num_of_unique_val(df):\n value_count =dict()\n for col in df.column... | [
"0.83644676",
"0.771267",
"0.7696803",
"0.76832294",
"0.7631341",
"0.74646574",
"0.73702365",
"0.73239774",
"0.7048549",
"0.70347005",
"0.7018269",
"0.700703",
"0.6939346",
"0.6928336",
"0.67912245",
"0.6770684",
"0.6726835",
"0.671193",
"0.6696467",
"0.6551561",
"0.6540874",... | 0.88164943 | 0 |
Plot boxplot of a dataframe | def plot_boxplots(
df: pd.DataFrame, drop_cols: list = None, sub_col=3, figsize: tuple = (18, 26)
):
# drop unnecessary columns
if drop_cols:
df = df.drop(drop_cols, axis=1)
# keep only quantitative features
df = create_quanti_df(df)
print(f"Number of quantitaive columns: {df.shape[1]}"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_box(df, column_name):\n df.boxplot(column=column_name)\n plt.show()",
"def plot_boxplot(df):\n\n\t# if graph is being plotted use this style\n\tplt.style.use('seaborn-darkgrid')\n\n\t# create a horizontal boxplot with title and axes of infant mortality\n\tboxplot = df.boxplot(column='Infant mortal... | [
"0.8140125",
"0.78918487",
"0.7698957",
"0.7368724",
"0.73659617",
"0.72590137",
"0.7157707",
"0.7069666",
"0.70694333",
"0.6834175",
"0.6801373",
"0.67951524",
"0.67751324",
"0.6738054",
"0.67107713",
"0.6677679",
"0.66530263",
"0.664959",
"0.6582403",
"0.6581334",
"0.654197... | 0.7279647 | 5 |
Count and rank the frequency of each value of a categorical variable. Then plot it with barplot | def plot_barplot(
df: pd.DataFrame,
feature: str,
length: int = None,
cutoff: float = None,
figsize: tuple = (5, 10),
ticksize: int = 15,
) -> pd.DataFrame:
# count each category within the feature
count = df.groupby(f"{feature}")[f"{feature}"].count().sort_values(ascending=False)
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compte(df):\n\n df.value_counts()[:100].plot(kind='bar')\n plt.show()",
"def plot_counts(axis, series, title):\n axis.set_title(title)\n value_counts = series.value_counts().sort_index()\n\n value_counts /= float(value_counts.sum())\n value_counts.plot(kind='bar', ax=axis)",
"def value_co... | [
"0.73600036",
"0.71333355",
"0.71076524",
"0.67058563",
"0.66754234",
"0.6530218",
"0.6474065",
"0.64172834",
"0.641179",
"0.6382746",
"0.63466567",
"0.6336603",
"0.6300422",
"0.6279303",
"0.62791264",
"0.627515",
"0.6264902",
"0.6231516",
"0.6223711",
"0.62204754",
"0.616661... | 0.5689102 | 47 |
Plot boxplots against categories on the yaxis | def plot_category_boxplots(
df: pd.DataFrame,
figsize: tuple,
length: int = None,
method: str = None,
) -> sns.boxplot:
# check if the method input is valid
if method not in ["median", "mean", "quantile75", None]:
print("Not a valid method.")
print("Valid methods are 'median', '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_box_plots(categorical_var, numerical_var):\n\n sns.boxplot(x=categorical_var, y=numerical_var, palette=\"Set2\")\n\n plt.show()",
"def check_outliers(df, col, cat):\n \n if len(cat) == 0:\n boxplot = df.boxplot(column=[col], rot = 90)\n else:\n for c in cat:\n ... | [
"0.7198301",
"0.6912547",
"0.68759024",
"0.67865825",
"0.6695712",
"0.66458017",
"0.6633652",
"0.66281545",
"0.6624742",
"0.65165323",
"0.65058464",
"0.64393204",
"0.64198315",
"0.6378181",
"0.63450295",
"0.63449323",
"0.62835264",
"0.62769586",
"0.62718046",
"0.62319934",
"0... | 0.62814236 | 17 |
Returns a tuple of datetime objects (month_start,month_end) given a year and month. Both params are strings because we want month to be a two digit month representation and python doesn't handle leading zeros in integers as we want. | def month_bounds(year, month):
year = int(year)
month = int(month)
month_start = datetime.strptime('%s,%s,1' % (year, month),'%Y,%m,%d')
# days_in_month returns a tuple(weekday, days) where
# weekday is the eekday the month starts on and days is the number of days in the month
days_in_month = ca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calendar_month(year, month):\n start = datetime.datetime(year, month, 1)\n if month == 12:\n end = datetime.datetime(year+1, 1, 1)\n else:\n end = datetime.datetime(year, month+1, 1)\n print(start)\n print(end)\n return start, end",
"def get_sta... | [
"0.7634696",
"0.76304144",
"0.71417826",
"0.67175126",
"0.67165595",
"0.65233415",
"0.65025055",
"0.638896",
"0.6304235",
"0.63005614",
"0.622599",
"0.61403906",
"0.6123548",
"0.6087696",
"0.60673636",
"0.6021755",
"0.60140574",
"0.6009565",
"0.5971921",
"0.59598935",
"0.5876... | 0.73562527 | 2 |
Formats and returns val using the unit of the range. | def format_val(self, val: float) -> str:
val_conv = val / UNITS[self._unit]
return f"{val_conv:.3f} {self._unit}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_converter(val, from_u, to_u):\n\tconverter = {'b':0, 'k':1, 'm':2, 'g':3, 't':4}\n\tif converter[from_u] < converter[to_u]:\n\t\tval = float(val)\n\t\tfor _ in range(converter[to_u] - converter[from_u]):\n\t\t\tval = val/1024\n\telse:\n\t\tfor _ in range(converter[from_u] - converter[to_u]):\n\t\t\tval = ... | [
"0.6347474",
"0.6329657",
"0.6279132",
"0.6279132",
"0.6131024",
"0.5957639",
"0.59384274",
"0.59254414",
"0.59254414",
"0.5923719",
"0.5890728",
"0.5881954",
"0.5875318",
"0.5855457",
"0.5846786",
"0.58400136",
"0.58085686",
"0.577812",
"0.57773274",
"0.5772047",
"0.57489",
... | 0.7421121 | 0 |
Delete an analysis category. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def analysis_category_delete(self, web_id, **kwargs):
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.analysis_category_delete_with_http_info(web_id, **kwargs)
else:
(data) = self.analysis_category_delete_with_http_info(web_id, **kwargs)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analysis_category_delete_with_http_info(self, web_id, **kwargs):\n\n all_params = ['web_id']\n all_params.append('callback')\n all_params.append('_return_http_data_only')\n all_params.append('_preload_content')\n all_params.append('_request_timeout')\n\n params = local... | [
"0.66588604",
"0.6596033",
"0.6303246",
"0.622409",
"0.61126953",
"0.6066363",
"0.60534406",
"0.60407317",
"0.59831995",
"0.5978769",
"0.5977984",
"0.5889893",
"0.5785629",
"0.57368094",
"0.5686076",
"0.556693",
"0.5533083",
"0.55276155",
"0.5519127",
"0.55131334",
"0.5498202... | 0.71706176 | 0 |
Delete an analysis category. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def analysis_category_delete_with_http_info(self, web_id, **kwargs):
all_params = ['web_id']
all_params.append('callback')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analysis_category_delete(self, web_id, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('callback'):\n return self.analysis_category_delete_with_http_info(web_id, **kwargs)\n else:\n (data) = self.analysis_category_delete_with_http_info(web_id, **k... | [
"0.7169129",
"0.65942246",
"0.63024086",
"0.6227023",
"0.61102283",
"0.6068499",
"0.6051406",
"0.604271",
"0.59854287",
"0.59798014",
"0.59790194",
"0.58880204",
"0.5786963",
"0.5738996",
"0.5688634",
"0.556628",
"0.55339193",
"0.5528064",
"0.5521257",
"0.55161417",
"0.549800... | 0.6660367 | 1 |
Update an analysis category by replacing items in its definition. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def analysis_category_update(self, web_id, category, **kwargs):
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.analysis_category_update_with_http_info(web_id, category, **kwargs)
else:
(data) = self.analysis_category_update_with_http_info(w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analysis_category_update_with_http_info(self, web_id, category, **kwargs):\n\n all_params = ['web_id', 'category']\n all_params.append('callback')\n all_params.append('_return_http_data_only')\n all_params.append('_preload_content')\n all_params.append('_request_timeout')\n\n... | [
"0.664882",
"0.5906659",
"0.5740694",
"0.55674475",
"0.55484873",
"0.5530745",
"0.5528104",
"0.5436587",
"0.5375652",
"0.5364754",
"0.5359994",
"0.53377837",
"0.53377837",
"0.53377837",
"0.53377837",
"0.53377837",
"0.5329789",
"0.5254712",
"0.52500826",
"0.5221348",
"0.517735... | 0.6526883 | 1 |
Update an analysis category by replacing items in its definition. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def analysis_category_update_with_http_info(self, web_id, category, **kwargs):
all_params = ['web_id', 'category']
all_params.append('callback')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
param... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analysis_category_update(self, web_id, category, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('callback'):\n return self.analysis_category_update_with_http_info(web_id, category, **kwargs)\n else:\n (data) = self.analysis_category_update_with_h... | [
"0.6526883",
"0.5906659",
"0.5740694",
"0.55674475",
"0.55484873",
"0.5530745",
"0.5528104",
"0.5436587",
"0.5375652",
"0.5364754",
"0.5359994",
"0.53377837",
"0.53377837",
"0.53377837",
"0.53377837",
"0.53377837",
"0.5329789",
"0.5254712",
"0.52500826",
"0.5221348",
"0.51773... | 0.664882 | 0 |
Initialize vocabulary from file. | def initialize_vocabulary(vocabulary_path):
if gfile.Exists(vocabulary_path):
rev_vocab = []
with gfile.GFile(vocabulary_path, mode="rb") as f:
rev_vocab.extend(f.readlines())
rev_vocab = [line.strip() for line in rev_vocab]
vocab = dict([(x, y) for (y, x) in enumerate(re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_vocabulary():\n global vocabulary_list, vocabulary_dict\n vocabulary_list = []\n vocabulary_dict = {}\n\n with open(_VOCABULARY_PATH, 'r') as f:\n for index, line in enumerate(f):\n line = line.strip()\n vocabulary_dict[line] = index\n vocabulary_list.ap... | [
"0.77525496",
"0.76920307",
"0.76315725",
"0.7592861",
"0.75801814",
"0.75644326",
"0.744741",
"0.7426106",
"0.7416072",
"0.71661425",
"0.71474075",
"0.7117412",
"0.70894724",
"0.7076142",
"0.7025968",
"0.6955337",
"0.69535863",
"0.6949669",
"0.69139093",
"0.69139093",
"0.690... | 0.7466838 | 7 |
Tokenize data file and turn into tokenids using given vocabulary file. This function loads data linebyline from data_path, calls the above sentence_to_token_ids, and saves the result to target_path. See comment for sentence_to_token_ids on the details of tokenids format. | def data_to_token_ids(data_path, target_path, vocabulary_path):
if not gfile.Exists(target_path):
print("Tokenizing data in %s" % data_path)
vocab, _ = initialize_vocabulary(vocabulary_path)
with gfile.GFile(data_path, mode="rb") as data_file:
with gfile.GFile(target_path, mode="... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_to_token_ids(data_path, target_path, vocabulary_path,\n tokenizer=None, normalize_digits=True):\n if not gfile.Exists(target_path):\n print(\"Tokenizing data in %s\" % data_path)\n vocab, _ = data_utils.initialize_vocabulary(vocabulary_path)\n with gfile.GFile(... | [
"0.8453559",
"0.8449823",
"0.83864534",
"0.8367132",
"0.8280898",
"0.8103142",
"0.73657805",
"0.72659",
"0.7235941",
"0.7133287",
"0.7092234",
"0.7088257",
"0.7088257",
"0.70580244",
"0.70380616",
"0.6946874",
"0.6746566",
"0.6729334",
"0.6647847",
"0.65564847",
"0.6436242",
... | 0.8816068 | 0 |
Returns the name of the class only, not the package + name | def get_entity_name() -> str:
return "NewsItemEntity" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_name(cls):\n return cls.__name__",
"def class_name(cls):\n return cls.__name__",
"def full_classname(cls: type) -> str:\n return ClassImporter.full_classname(cls)",
"def f_get_class_name(self):\n return self.__class__.__name__",
"def className(self):\n namevalue = self.... | [
"0.83586776",
"0.83586776",
"0.82367796",
"0.82359266",
"0.8226964",
"0.8163673",
"0.8158031",
"0.8149154",
"0.81412977",
"0.8083111",
"0.8068616",
"0.79109645",
"0.7784179",
"0.77207184",
"0.77097476",
"0.77014583",
"0.7693734",
"0.7689245",
"0.76702446",
"0.7644121",
"0.754... | 0.0 | -1 |
Get the dataset type. | def __get_dataset_type(dataset):
op_type = None
if isinstance(dataset, de.ShuffleDataset):
op_type = OpName.SHUFFLE
elif isinstance(dataset, de.MindDataset):
op_type = OpName.MINDRECORD
elif isinstance(dataset, de.BatchDataset):
op_type = OpName.BATCH
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDataSetType(self):\n return self.__data_set_type__",
"def data_type():\n return DataTypeUtil.getDTypeForName(DataTypeUtil.getDtypeFromContext())",
"def type(self) -> DataType:\n return self._type",
"def datatype(self):\n # datatype is type of first dataarg\n return self[... | [
"0.8655763",
"0.7992788",
"0.7770117",
"0.77262974",
"0.7708873",
"0.76988584",
"0.76988584",
"0.76988584",
"0.7662641",
"0.76333755",
"0.7611371",
"0.74511653",
"0.7382031",
"0.7368521",
"0.72974986",
"0.7233958",
"0.718911",
"0.7168877",
"0.7162799",
"0.70589256",
"0.703210... | 0.7647859 | 9 |
convert size int into readable string (Bytes) | def fmt(num):
for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
if abs(num) < 1024.0:
return '{0:7.2f} {1}B'.format(num, unit)
num /= 1024.0
return '{0:.2f}YiB'.format(num) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humanbytes(size):\n # https://stackoverflow.com/a/49361727/4723940\n if not size:\n return \"\"\n # 2 ** 10 = 1024\n power = 2**10\n raised_to_pow = 0\n dict_power_n = {0: \"\", 1: \"Ki\", 2: \"Mi\", 3: \"Gi\", 4: \"Ti\"}\n while size > power:\n size /= power\n raised_... | [
"0.80423987",
"0.7956511",
"0.76628673",
"0.7594332",
"0.75543565",
"0.75409937",
"0.75152415",
"0.74774325",
"0.74344766",
"0.73909307",
"0.73641306",
"0.73598915",
"0.73509854",
"0.73184323",
"0.73033726",
"0.7301947",
"0.72792214",
"0.72565633",
"0.71801907",
"0.7141067",
... | 0.0 | -1 |
Transform some img representation into a numpy array | def standardize_args(img):
if isinstance(img, np.ndarray):
pass
elif isinstance(img, Image.Image):
img = np.array(img)
else:
# Assume its something path/str-like
img = cv2.imread(str(img))
img[..., :3] = img[..., :3][..., ::-1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_from_img(image):\n return np.array(image)",
"def img_to_array(img, path=True):\n global width, height\n\n if path:\n img = Image.open(img)\n img_arr = np.array(img) / 255.0\n img_arr = img_arr.reshape(width, height, channels)\n \n return img_arr",
"def image_to_array(self,... | [
"0.79193175",
"0.77199835",
"0.76690245",
"0.7631758",
"0.74856997",
"0.73657405",
"0.715153",
"0.7106477",
"0.7100685",
"0.7084136",
"0.70418984",
"0.70070887",
"0.70030445",
"0.69930863",
"0.6964962",
"0.6933764",
"0.6918962",
"0.68880767",
"0.68838996",
"0.68570954",
"0.68... | 0.0 | -1 |
Apply activation on current layer | def apply_activation(self, tens):
if(self.activation == "ReLU"): # pylint: disable=no-else-return
return tf.nn.relu(tens)
elif(self.activation == "Leaky_ReLU"):
return tf.nn.leaky_relu(tens)
elif(self.activation == "Tanh"):
return tf.nn.tanh(tens)
elif(self.activation == "Sigmoid"):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_layer_activation(x):\n return x",
"def activate(self, input_layer, funcname=None):\n if isinstance(funcname, tuple):\n funcname = funcname[0]\n params = funcname[1:]\n if funcname is None:\n funcname = self.activation_func\n if funcname == 'LINE... | [
"0.7669725",
"0.7291756",
"0.6783112",
"0.6765618",
"0.6649252",
"0.66390026",
"0.6635049",
"0.6628963",
"0.6602787",
"0.66017324",
"0.6559534",
"0.6517468",
"0.6509912",
"0.6475084",
"0.6475084",
"0.64560694",
"0.64264786",
"0.63983756",
"0.6392709",
"0.6392709",
"0.63841766... | 0.6855014 | 2 |
Get average of each element in a vector list. | def vector_mean(vectors):
n = len(vectors)
return scalar_multiply(1 / n, vector_sum(vectors)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_average(vec_list):\r\n return np.sum(vec_list, axis = 0)/len(vec_list)",
"def average_vectors(vectors_list):\n return np.mean(vectors_list, axis=0)",
"def avg(list):\n return sum(list) / len(list)",
"def avg(lst: list):\n return sum(lst) / len(lst)",
"def average(lst):\n return s... | [
"0.8778111",
"0.82573926",
"0.7977214",
"0.7940798",
"0.7934565",
"0.7916716",
"0.7879446",
"0.78209776",
"0.7801524",
"0.7800641",
"0.776494",
"0.7746185",
"0.7652803",
"0.76178604",
"0.7566096",
"0.7544931",
"0.75303566",
"0.7527679",
"0.7527679",
"0.751511",
"0.748485",
... | 0.72147834 | 36 |
Dot product of a vector. | def dot_product(v, w):
return sum(v_i * w_i for v_i, w_i in zip(v, w)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vector_dot(v1,v2):\n return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z)",
"def dot(self, vec):\n if not isinstance(vec, self.__class__):\n raise TypeError('Dot product operand must be a vector')\n return np.dot(self, vec)",
"def vec_dot(v1,v2):\r\n \r\n return np.dot(v1,... | [
"0.83529234",
"0.82917535",
"0.8287802",
"0.8178226",
"0.8165758",
"0.81551445",
"0.81111765",
"0.8100678",
"0.8088475",
"0.80638814",
"0.8026452",
"0.8015521",
"0.7995084",
"0.7990663",
"0.798664",
"0.79550636",
"0.7948448",
"0.79011446",
"0.78758484",
"0.7856333",
"0.783196... | 0.7217665 | 61 |
Translates the MongoDB dictionary format into the format that's expected by the application. | def from_mongo(data):
if not data:
return None
data['id'] = str(data['_id'])
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_mongo(self, value):\n return self.to_python(value)",
"def transform_bson(self, value):\n return value",
"def test_dict_to_doc_and_doc_to_dict():\n document = Document(DICT)\n dicts = document.to_dict()\n document = Document(dicts)\n conll = [[sentence.split(\"\\t\") for sentenc... | [
"0.57829136",
"0.5649236",
"0.5603873",
"0.5455426",
"0.5447861",
"0.53788936",
"0.5354751",
"0.53406113",
"0.53303427",
"0.5301875",
"0.5271327",
"0.52547693",
"0.52531767",
"0.5241927",
"0.5230358",
"0.5217875",
"0.52107805",
"0.5175416",
"0.51635545",
"0.5108134",
"0.51069... | 0.52079165 | 17 |
Sets the id of this Service. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id):\n self.__id = id",
"def SetId(self, id):\n self.id = int(id)",
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.data['id'] = id",
"def setID(self, id):\n self._id = id\n return self.callRemote('setID', id)",
"def id... | [
"0.790679",
"0.7877304",
"0.78467727",
"0.77119493",
"0.75807077",
"0.75544685",
"0.7527379",
"0.7527379",
"0.7527379",
"0.7520122",
"0.748693",
"0.748693",
"0.748693",
"0.748693",
"0.748693",
"0.748693",
"0.748693",
"0.748693",
"0.748693",
"0.748693",
"0.7466564",
"0.74665... | 0.73835045 | 83 |
Sets the type of this Service. | def type(self, type):
allowed_values = ["service", "pickup", "delivery"] # noqa: E501
if type not in allowed_values:
raise ValueError(
"Invalid value for `type` ({0}), must be one of {1}" # noqa: E501
.format(type, allowed_values)
)
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n self._type = type",
"def type(self, type: str):\n\n self._type = type",
"def type(self, type):\n\n self._type = type",
"def type(self, type):\n\n ... | [
"0.79738075",
"0.79738075",
"0.7915099",
"0.7595325",
"0.73748773",
"0.73748773",
"0.73748773",
"0.73748773",
"0.73748773",
"0.73748773",
"0.73748773",
"0.73748773",
"0.73748773",
"0.73748773",
"0.73748773",
"0.73748773",
"0.73748773",
"0.73748773",
"0.73748773",
"0.73748773",
... | 0.7493142 | 4 |
Sets the name of this Service. | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name: str):\n self._name = name",
"def set_name(self, name):\n self._name = name",
"def SetName(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name)... | [
"0.8186699",
"0.8147029",
"0.8138115",
"0.8091112",
"0.8091112",
"0.8091112",
"0.8091112",
"0.8091112",
"0.80555105",
"0.80555105",
"0.8021498",
"0.7997871",
"0.7972443",
"0.79695237",
"0.7922265",
"0.7910269",
"0.77766925",
"0.77766925",
"0.77733123",
"0.77733123",
"0.773850... | 0.0 | -1 |
Sets the preparation_time of this Service. | def preparation_time(self, preparation_time):
self._preparation_time = preparation_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_startTime(self, startTime):\n self.startTime = mktime(startTime)",
"def start_time(self, start_time):\n\n self._start_time = start_time",
"def start_time(self, start_time):\n\n self._start_time = start_time",
"def start_time(self, start_time):\n\n self._start_time = start_... | [
"0.59095925",
"0.58044386",
"0.58044386",
"0.58044386",
"0.58044386",
"0.58044386",
"0.5801364",
"0.5801364",
"0.5711525",
"0.57006353",
"0.5567384",
"0.55437523",
"0.5486357",
"0.54310644",
"0.5398722",
"0.53580236",
"0.53157383",
"0.52742666",
"0.51947594",
"0.5186621",
"0.... | 0.88701296 | 0 |
Sets the time_windows of this Service. | def time_windows(self, time_windows):
self._time_windows = time_windows | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_windows(self, date_windows):\n\n self._date_windows = date_windows",
"def windows(self, windows):\n\n self._windows = windows",
"def setTimeUnits(self, *args):\n return _libsbml.KineticLaw_setTimeUnits(self, *args)",
"def setTimeUnits(self, *args):\n return _libsbml.Event... | [
"0.6362365",
"0.581707",
"0.5633491",
"0.5571724",
"0.5543102",
"0.55132043",
"0.54960006",
"0.5169062",
"0.5161619",
"0.5109396",
"0.5088747",
"0.508181",
"0.5035249",
"0.5023071",
"0.50040764",
"0.49979436",
"0.4928521",
"0.49122813",
"0.48907137",
"0.48781702",
"0.48757547... | 0.7998597 | 0 |
Sets the allowed_vehicles of this Service. | def allowed_vehicles(self, allowed_vehicles):
self._allowed_vehicles = allowed_vehicles | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disallowed_vehicles(self, disallowed_vehicles):\n\n self._disallowed_vehicles = disallowed_vehicles",
"def disallowed_vehicles(self, disallowed_vehicles):\n\n self._disallowed_vehicles = disallowed_vehicles",
"def vehicle(self, vehicle: Vehicle) -> None:\n self.controlled_vehicles = [v... | [
"0.8086139",
"0.8086139",
"0.630401",
"0.56023186",
"0.55442107",
"0.5479765",
"0.54399025",
"0.52993906",
"0.52801025",
"0.5153166",
"0.50900704",
"0.5084263",
"0.5084263",
"0.50435716",
"0.5019797",
"0.50028473",
"0.49678433",
"0.49333933",
"0.49119717",
"0.48445362",
"0.47... | 0.8965602 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Service):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.