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 |
|---|---|---|---|---|---|---|
Given a list of ingredients from HTML form, searches for recipes that contain only these ingredients | def food_page():
fridge_ingredients = request.args.get('b', 0, type=str) #raw input from HTML form
global current_user
current_user.fridge.make_fridge(fridge_ingredients) #uses function imported from recipe_program
recipe_dictionaries = current_user.get_timed_recipes(time_global) #uses function imported from r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_recipe(ingredients):\n\n params = '+'.join(ingredients.split())\n url_search = SEARCH_URL.format(params)\n response = req.get(url_search)\n\n return response.content",
"def filter_non_ingredient(ingredient_list):\n stop_words = set(stopwords.words('english'))\n \n filt... | [
"0.7450567",
"0.6925764",
"0.6854179",
"0.681462",
"0.65662485",
"0.6338314",
"0.63351244",
"0.61868715",
"0.6160762",
"0.61457604",
"0.61334926",
"0.61065423",
"0.6079977",
"0.6076349",
"0.6063715",
"0.6055607",
"0.6018266",
"0.6015794",
"0.59557414",
"0.59201854",
"0.589096... | 0.0 | -1 |
Extract topk entities given seeds. | def get_topk_extracted_ent(self, seeds, alpha, topk):
#tf.logging.info('Start ppr')
ppr_scores = csr_personalized_pagerank(seeds, self.data.adj_mat_t_csr,
alpha)
#tf.logging.info('End ppr')
sorted_idx = np.argsort(ppr_scores)[::-1]
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tops(similarities, k):\n tops = similarities.argsort(axis=1)[:, :k].tolist()\n return tops",
"def topk(vec, k):\n vec = torch.topk(vec, k)\n return vec.view(-1).data.tolist()",
"def get_top_featured_entries(number=5):\n return list(Entry.published.filter(featured=True)[:number])",
"def... | [
"0.6067031",
"0.59501433",
"0.56342024",
"0.56280166",
"0.56253827",
"0.5582722",
"0.55795217",
"0.55525213",
"0.55328137",
"0.5528902",
"0.5520351",
"0.54736173",
"0.5471133",
"0.54636014",
"0.5440023",
"0.5429825",
"0.53809315",
"0.5375162",
"0.53751266",
"0.533664",
"0.532... | 0.6884426 | 0 |
Returns the shortest first name (str). You can assume there is only one shortest name. | def shortest_first_name(names):
names = dedup_and_title_case_names(names)
return sorted([name.split()[0] for name in names], key=len)[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortest_first_name(names):\n names = dedup_and_title_case_names(names)\n split_names = [name.split(' ') for name in names]\n first_name = [first for first, last in split_names]\n shortest = first_name[0]\n for name in first_name:\n if len(name) < len(shortest):\n shortest = na... | [
"0.8495962",
"0.8405887",
"0.8365317",
"0.81789523",
"0.78514916",
"0.7568302",
"0.7427178",
"0.7414167",
"0.741108",
"0.72852665",
"0.72852665",
"0.72852665",
"0.72852665",
"0.72852665",
"0.72852665",
"0.72852665",
"0.72852665",
"0.72852665",
"0.72852665",
"0.72852665",
"0.7... | 0.84295845 | 1 |
Test that a channel axis is added when it doesn't exist in the input | def test_channel_axis_introduction(conv1d_no_channel_axis, output_size, channel_axis):
conv_layer = Convolution((3, output_size), lambda x: 1)
output = conv_layer(conv1d_no_channel_axis)
t_axes = conv1d_no_channel_axis.axes + channel_axis
assert output.axes.is_equal_set(t_axes), ("Output axes are not in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_alternate_channel_axes(conv1d_placeholder, output_size, channel_axis):\n channel_axis.name = \"channel\"\n assert len(conv1d_placeholder.axes.find_by_name(\"channel\")) == 1\n\n conv_layer = Convolution((3, output_size), lambda x: 1)\n with pytest.raises(IncompatibleAxesError):\n conv_l... | [
"0.68041444",
"0.5978892",
"0.59068304",
"0.58510864",
"0.5820264",
"0.5708535",
"0.5601582",
"0.55839527",
"0.55391574",
"0.5538313",
"0.5525261",
"0.5506493",
"0.5473106",
"0.5469562",
"0.5443375",
"0.5383108",
"0.53624815",
"0.5343262",
"0.5339166",
"0.53092283",
"0.527701... | 0.71101326 | 0 |
Test that the dilated convolution layer output matches expected. This test compares the maximum output value to an expected max output value. The expected value is computed based on the dilation parameter. The test also checks that the output size matches the expected size based on the dilaton parameter value. | def test_dilated_conv(dilation):
image_size = 3
batch_size = 1
init_val = 0.1
conv_size = 3
pad = 3
N_filters = 1
image_channels = 3
model = Sequential([Convolution((conv_size, conv_size, N_filters),
filter_init=ConstantInit(val=init_val),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _VerifyValues(\n self,\n input_sizes=None,\n filter_sizes=None,\n strides=None,\n dilations=None,\n padding=None,\n data_format_src=\"NHWC\",\n data_format_dst=\"NHWC\",\n expected=None,\n ):\n\n total_size_1 = np.prod(input_sizes)\n ... | [
"0.64663506",
"0.6339015",
"0.6257454",
"0.61735374",
"0.6152628",
"0.61100185",
"0.60942584",
"0.60613877",
"0.6036121",
"0.5997487",
"0.591609",
"0.59005904",
"0.58983564",
"0.5894166",
"0.58659226",
"0.5855777",
"0.583677",
"0.5803536",
"0.577784",
"0.5746447",
"0.57333267... | 0.78776544 | 0 |
Store the receiver in database and return its ID. | def store(self, context, update=False):
timestamp = timeutils.utcnow(True)
self.created_at = timeutils.utcnow(True)
values = {
'id': self.id,
'name': self.name,
'type': self.type,
'user': self.user,
'project': self.project,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_receivers_id(self):\n return self.__receivers_id",
"def insert(self):\n item = self.create()\n return item.id",
"def create(cls, sender, recipient, body, timestamp=None):\n if timestamp is None:\n timestamp = datetime.datetime.utcnow()\n msg = cls(sender,... | [
"0.6423932",
"0.5876769",
"0.5797933",
"0.5710716",
"0.5706996",
"0.56506854",
"0.5634671",
"0.5573839",
"0.5572288",
"0.553507",
"0.5532543",
"0.5480858",
"0.5480858",
"0.5480858",
"0.54778296",
"0.5473655",
"0.5473655",
"0.54736364",
"0.5444757",
"0.5444757",
"0.54426414",
... | 0.69515216 | 0 |
Constructs a shortened representation of a PdObject. | def short_repr(obj: PdObject, length_guide: int = 8) -> str:
if isinstance(obj, list):
lower_length_guide = (length_guide + 1) // 2
if len(obj) > 2 * length_guide:
return "[{}, ({} more), {}]".format(
", ".join(short_repr(e, lower_length_guide) for e in obj[:length_gu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pformat(object):\r\n return PrettyPrinter().pformat(object)",
"def stringReco(obj):\n name = obj.get_name()\n name = obj._pid if (name is None) else name\n return (\"pdg: \" + name + \" E: \" + str(obj._E)\n + \" px: \" + str(obj._px) + \" py: \" + str(obj._py)\n + \" pz: \"... | [
"0.5644744",
"0.5611544",
"0.5591873",
"0.54736",
"0.54563993",
"0.53513646",
"0.53206956",
"0.53024477",
"0.52644145",
"0.5253599",
"0.5235866",
"0.52308536",
"0.5215566",
"0.52139914",
"0.5204089",
"0.51857984",
"0.5153454",
"0.5145673",
"0.51341456",
"0.5121201",
"0.511272... | 0.62185085 | 0 |
Calculate and return the illegal proposal rate of this proposal. (Proposing values outside the support of the parameter space e.g covariances < 0) Returns | def get_illegal(self):
return self.count_illegal / self.count_proposed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def penalty(self):\n assert len(self.weights) == len(self.means), \"Dimensions!\"\n out = np.exp(self.data['riskfree'] * self.data['maturity'])\n for weight, mean in zip(self.weights, self.means):\n out -= weight * np.exp(mean * self.data['maturity'])\n return (out**2).mean()... | [
"0.61560255",
"0.61219674",
"0.60336506",
"0.59619415",
"0.5867981",
"0.5866423",
"0.5817501",
"0.58053184",
"0.5801318",
"0.5792975",
"0.57858485",
"0.5781058",
"0.57493556",
"0.5713597",
"0.5710124",
"0.5701755",
"0.5694844",
"0.5671048",
"0.56675017",
"0.56662416",
"0.5652... | 0.6779935 | 0 |
Return True if the given element is in this view. | def is_element_in_view(self, element: Element) -> bool:
return self.find_element_view(element=element) is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains(self, element) -> bool:\n\n return self.__find_node(element) is not None",
"def __contains__(self, item):\n\n if self.is_view:\n return item in self._view\n return item in self._storage",
"def contains(self, element):\n pass",
"def is_element_visible(self):... | [
"0.72909355",
"0.6978362",
"0.6958688",
"0.67255217",
"0.6717766",
"0.6496774",
"0.64491296",
"0.64290804",
"0.6372613",
"0.6279521",
"0.6277805",
"0.62600285",
"0.6246147",
"0.6245345",
"0.6212836",
"0.6174918",
"0.6135724",
"0.61295",
"0.61222446",
"0.61159575",
"0.6111",
... | 0.8923193 | 0 |
Splits a column of comma separated values into their own rows with values identical to the original. | def tidy_split(df, column='Members', sep=', '):
indexes = []
new_values = []
for i, presplit in enumerate(df[column].astype(str)):
for value in presplit.split(sep):
indexes.append(i)
new_values.append(value)
new_df = df.iloc[indexes, :].copy() # the .copy() Prevents a wa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_column(df,col_name,reg_ex=',',keep=False):\n # https://stackoverflow.com/a/51680292/5847441\n df = df.select(col_name,posexplode(split(col_name,reg_ex)).alias('pos','val'))\\\n .select(col_name,concat(lit(col_name),col('pos').cast('string')).alias('name'),'val')\\\n .groupBy(col_name)... | [
"0.64203936",
"0.63070935",
"0.61441594",
"0.6137313",
"0.5952938",
"0.5780356",
"0.57425",
"0.5677074",
"0.5605468",
"0.544994",
"0.5446234",
"0.5424089",
"0.53638244",
"0.53548014",
"0.53276426",
"0.53026354",
"0.52907306",
"0.525217",
"0.5158915",
"0.51240396",
"0.510114",... | 0.66650534 | 0 |
Create a dataset from the given parameters. Note that despite the type hinting, ``domain`` is only semioptional, as a domain is required to create a | async def create_dataset(self, dataset_name: str, category: DataCategory, domain: Optional[DataDomain] = None,
**kwargs) -> bool:
# If a domain wasn't passed, generate one from the kwargs, or raise and exception if we can't
if domain is None:
data_format = kwargs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, domain_keys, require_domain=True, datasets=None):\n assert isinstance(domain_keys, list) or isinstance(domain_keys, str)\n if isinstance(domain_keys, list):\n self.domain_keys = domain_keys\n elif isinstance(domain_keys, str):\n self.domain_keys = [x fo... | [
"0.70908016",
"0.6585426",
"0.6346205",
"0.6299749",
"0.6184952",
"0.6145635",
"0.6139993",
"0.61318284",
"0.6127892",
"0.6063784",
"0.5988405",
"0.59247696",
"0.5912318",
"0.5860009",
"0.5854653",
"0.5846334",
"0.5820806",
"0.58134025",
"0.5787504",
"0.577296",
"0.57687443",... | 0.68479204 | 1 |
Return a sequence with num equally spaced items from the sequence. | def makespread(sequence, num):
length = float(len(sequence))
seq = np.array(sequence)
return seq[np.ceil(np.arange(num) * length / num).astype(int)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def takespread(sequence, num):\n length = float(len(sequence))\n for i in range(num):\n yield sequence[int(np.ceil(i * length / num))]",
"def takespread(sequence, num):\n length = float(len(sequence))\n for i in range(num):\n yield sequence[int(ceil(i * length / num))]",
"def select_e... | [
"0.7079229",
"0.69849604",
"0.6554045",
"0.6446533",
"0.62521",
"0.62231594",
"0.62126434",
"0.6150865",
"0.61437947",
"0.6142398",
"0.6108911",
"0.60950077",
"0.6078426",
"0.6029814",
"0.6026212",
"0.6003211",
"0.60010767",
"0.59927523",
"0.59927523",
"0.5981187",
"0.5978597... | 0.6889098 | 2 |
Gets a QuerySet of current objects related to ``objs`` via the relation ``related``. | def related_objects(self, related, objs):
from versions.models import Versionable
related_model = related.related_model
if issubclass(related_model, Versionable):
qs = related_model.objects.current
else:
qs = related_model._base_manager.all()
return qs.us... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def related_objects(self, related_model, related_fields, objs):\n predicate = reduce(operator.or_, (\n query_utils.Q(**{'%s__in' % related_field.name: objs})\n for related_field in related_fields\n ))\n return related_model._default_manager.using(self.using).filter(\n ... | [
"0.7643895",
"0.6433926",
"0.62799156",
"0.61716324",
"0.60885555",
"0.5964254",
"0.5934872",
"0.58134305",
"0.5811461",
"0.5781093",
"0.57791954",
"0.57010734",
"0.5631755",
"0.55931336",
"0.55913925",
"0.55770904",
"0.5536853",
"0.55321735",
"0.5504152",
"0.5481324",
"0.544... | 0.8107112 | 0 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.7448925 | 82 |
Compute the softmax nonlinear activation function. | def softmax(inputs):
probs = np.exp(inputs)
# print(probs.shape)
# t = np.sum(probs, axis=0)
# print(t.shape)
probs /= np.sum(probs, axis=0)[np.newaxis,:]
return probs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x): \n return np.exp(x) / np.sum(np.exp(x), axis=0)",
"def softmax(x):\n \"\"\"\"\"\"\n return exp(x) / sum(exp(x), axis=0)",
"def softmax(x):\n return np.exp(x) / np.sum(np.exp(x), axis=1, keepdims=True)",
"def softmax(x):\n #pass # TODO: Compute and return softm... | [
"0.7768352",
"0.77541727",
"0.7747371",
"0.7738893",
"0.7731587",
"0.77270156",
"0.77237934",
"0.77237934",
"0.77237934",
"0.77237934",
"0.77237934",
"0.77237934",
"0.77237934",
"0.77237934",
"0.77112085",
"0.7711048",
"0.7692442",
"0.76765347",
"0.7640326",
"0.7640326",
"0.7... | 0.0 | -1 |
Return the route_path() of this instance. | def href(self, request) -> str:
return request.route_path(self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_path(self):\n\n return self._path",
"def get_path(self):\n return self.path",
"def path( self ) :\n\n return( self.__path )",
"def __get_path(self):\n return self.path",
"def get_path(self) -> Optional[str]:\n return self.path",
"def get_full_path(self):\n ... | [
"0.7054861",
"0.6987979",
"0.68065697",
"0.6733239",
"0.6719479",
"0.6718167",
"0.66832066",
"0.66832066",
"0.66832066",
"0.66832066",
"0.6546281",
"0.65282416",
"0.6494544",
"0.6460639",
"0.64459836",
"0.64312774",
"0.64189124",
"0.64189124",
"0.6403246",
"0.6403246",
"0.640... | 0.6670355 | 10 |
sign(x) = 1 when x >=0, sign(x) = 1 when x < 0 | def sign(x):
if x >= 0:
return 1
else:
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign(x):\n if x >= 0:\n return 1\n return -1",
"def sign(a):\n return (a > 0) - (a < 0)",
"def sign(a) :\n return (a>0) - (a<0)",
"def sign(num: float):\n return 1 if num >= 0 else -1",
"def sign(x):\n if x < 0.0:\n sign = -1\n elif x == 0.0:\n sign = 0... | [
"0.8934227",
"0.8589877",
"0.8557983",
"0.84978384",
"0.8455169",
"0.82966465",
"0.8226261",
"0.8218827",
"0.80557597",
"0.7960639",
"0.77862436",
"0.7741318",
"0.76713824",
"0.74776924",
"0.74519736",
"0.74350107",
"0.73274165",
"0.73155457",
"0.72797954",
"0.7140799",
"0.70... | 0.89466614 | 0 |
vector dot product, return a scalar x and y are two vectors with same length | def vector_dot(x, y):
if(len(x) != len(y)):
raise ValueError("vector lengths differ")
else:
# return x1*y1+x2*y2+...xn*yn
return sum([x[i] * y[i] for i in range(len(x))]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vec_dot(x, y):\r\n return sum(a * b for a, b in zip(x, y))",
"def naive_vector_dot(x, y):\n assert len(x.shape) == 1\n assert len(y.shape) == 1\n assert x.shape[0] == y.shape[0]\n\n z = 0\n for i in range(x.shape[0]):\n z += x[i] * y[i]\n return z",
"def vector_dot(v1,v2):\n re... | [
"0.86098886",
"0.83120406",
"0.8255133",
"0.8179656",
"0.80700606",
"0.7998463",
"0.79642713",
"0.79305995",
"0.7897161",
"0.78932184",
"0.78799474",
"0.787511",
"0.78657234",
"0.7834769",
"0.7806407",
"0.7790224",
"0.7761924",
"0.7682441",
"0.767671",
"0.7645681",
"0.7637908... | 0.8495939 | 1 |
vector cross product, return a vector x and y are two vectors with same length returned vector z is the same length as well this time only with dim=3 | def vector_cross(x, y):
if(len(x) != len(y)):
raise ValueError("vector lengths differ")
elif(len(x) > 3):
raise ValueError("vector is more than 3D")
else:
s = [x[1] * y[2] - x[2] * y[1],
x[2] * y[0] - x[0] * y[2],
x[0] * y[1] - x[1] * y[0]]
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross(vec1, vec2):\n result = np.zeros(3)\n return cross_(vec1, vec2, result)",
"def cross(x, y):\n x = x.reshape(3)\n y = y.reshape(3)\n z = np.cross(x, y)\n z = z.reshape((3, 1))\n return z",
"def vec_cross(a,b):\r\n return [a[1] * b[2] - a[2] * b[1],\r\n a[2] * b[0] - a[0]... | [
"0.76212597",
"0.74925447",
"0.73110324",
"0.7152654",
"0.7140053",
"0.71354425",
"0.7123215",
"0.71210593",
"0.70858693",
"0.7048258",
"0.70462084",
"0.7012079",
"0.69709086",
"0.69547546",
"0.6936852",
"0.69079554",
"0.6902274",
"0.68876064",
"0.6840153",
"0.6813516",
"0.67... | 0.76472753 | 0 |
Implements a polynomial learning rate of the form (1/nw) | def polynomial_learning_rate(n, w=0.5):
assert n > 0, "Make sure the number of times a state action pair has been observed is always greater than 0 before calling polynomial_learning_rate"
return 1./n**w | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate(self, t):\n # return self.init_learning_rate * (1 - t)\n return self.init_learning_rate / (1 + t)\n # return self.init_learning_rate * exp(-t)\n # return self.init_learning_rate * (.005 / self.init_learning_rate) ** t",
"def exponentialLearningRate(base):\n def fu... | [
"0.6654315",
"0.66402304",
"0.6613906",
"0.6513235",
"0.64861625",
"0.64501995",
"0.63714004",
"0.6363292",
"0.63441026",
"0.62656987",
"0.62390316",
"0.62067163",
"0.62067163",
"0.62005514",
"0.616968",
"0.61533827",
"0.6133514",
"0.6133514",
"0.6092227",
"0.6049452",
"0.604... | 0.8037298 | 0 |
Helper to create an initialized Variable with weight decay. Note that the Variable is initialized with a xavier initialization. A weight decay is added only if one is specified. | def _variable_with_weight_decay(name, shape, wd = 0.0):
var = _variable_on_cpu(name, shape, tf.contrib.layers.xavier_initializer())
# print("change var")
# var = tf.Variable(tf.truncated_normal(shape, mean= 0.0, stddev = 1.0), name = name)
if wd != 0.0:
weight_decay = tf.mul(tf.nn.l2_loss(var), ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _variable_with_weight_decay(name, shape, stddev, wd, use_xavier=True):\n if use_xavier:\n # initializer = tf.contrib.layers.xavier_initializer()\n initializer = tf.initializers.glorot_uniform()\n else:\n initializer = tf.truncated_normal_initializer(stddev=stddev)\n var = _variable_on_cpu(name, sha... | [
"0.7241202",
"0.71975875",
"0.71188027",
"0.70638335",
"0.7054658",
"0.7011236",
"0.68975306",
"0.68917346",
"0.6887726",
"0.6880515",
"0.6873685",
"0.6873685",
"0.6855851",
"0.6807256",
"0.67553926",
"0.67351",
"0.62675095",
"0.62666804",
"0.6203097",
"0.61477965",
"0.612937... | 0.7084271 | 3 |
Removes stopwords taken from NLTK website. | def remove_stopwords(text):
stopwords = ["i", "me", "my", "myself", "we", "our", "ours", "ourselves", "you", "your", "yours", "yourself", "yourselves", "he", "him", "his", "himself", "she", "her", "hers", "herself", "it", "its", "itself", "they", "them", "their", "theirs", "themselves", "what", "which", "who", "who... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)",
"def remove_stopwords(words):\n stopwords = nltk.corpus.stopwor... | [
"0.82163674",
"0.77724355",
"0.77685404",
"0.7766371",
"0.7763976",
"0.7762143",
"0.7725843",
"0.7725843",
"0.7725843",
"0.7725843",
"0.77016556",
"0.7701282",
"0.7697452",
"0.76888573",
"0.7688342",
"0.7681032",
"0.763926",
"0.7639205",
"0.7629822",
"0.7618348",
"0.7607955",... | 0.7593453 | 24 |
Get all the sources of tokenized text we have in a language. | def language_text_sources(lang):
return [
DATA + "/tokenized/{source}/{lang}.txt".format(source=source, lang=lang)
for source in LANGUAGE_SOURCES[lang]
if source in FULL_TEXT_SOURCES
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_languages(self):\r\n \r\n # tokenize, clean and filter document tokens \r\n toks = [re.sub(r'[^a-zA-Z]','', tok.text.lower().strip()) for tok in self.doc]\r\n toks = [tok for tok in toks if len(tok)>1 and tok in LANGUAGES]\r\n toks = sorted(set(toks))\r\n ... | [
"0.6808751",
"0.6602341",
"0.65438026",
"0.6541259",
"0.6345355",
"0.6345355",
"0.62279546",
"0.61624664",
"0.6071694",
"0.6071694",
"0.6071694",
"0.6071694",
"0.60606",
"0.6059048",
"0.5987303",
"0.59685606",
"0.593609",
"0.5931265",
"0.5897387",
"0.58759075",
"0.5802738",
... | 0.79785043 | 0 |
Retourne True si le personnage est noyable, False sinon. | def noyable(self):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __bool__(self):\n return self.__nonzero__()",
"def __nonzero__(self):\r\n return bool(assert_(self.obj, 'not %r' % self.obj))",
"def is_donor(self):\n return True",
"def __bool__(self):\n return self is TRUE",
"def __bool__(self):\n return not self.undefine",
"def _... | [
"0.6540811",
"0.65173805",
"0.6504292",
"0.6462654",
"0.6444503",
"0.64119697",
"0.635402",
"0.63263655",
"0.6298532",
"0.6295683",
"0.6285922",
"0.6284034",
"0.6282235",
"0.6278732",
"0.6273903",
"0.6253428",
"0.62380856",
"0.6231243",
"0.6231243",
"0.6210731",
"0.6136528",
... | 0.7022764 | 0 |
Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`. | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None):
bsz, src_len = mask.size()
tgt_len = tgt_len if tgt_len is not None else src_len
expanded_mask = mask[:, None, None, :].expand(bsz, 1, tgt_len, src_len).to(dtype)
inverted_mask = 1.0 - expanded_mask
return in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_attn_mask(inp, inp_len, dtype=tf.float32):\n with tf.name_scope(\"encoder_mask\"):\n mask = tf.sequence_mask(inp_len, dtype=dtype, maxlen=tf.shape(inp)[1])\n return mask[:, None, None, :]",
"def attention_mask(model, x):\n config = model.config\n input_mask = model.inputs[\"input_... | [
"0.6627125",
"0.64431953",
"0.6341481",
"0.61793864",
"0.61158055",
"0.6070189",
"0.6019167",
"0.5995747",
"0.5981831",
"0.59229624",
"0.58860606",
"0.58100045",
"0.58093405",
"0.578635",
"0.5784919",
"0.57751375",
"0.5711562",
"0.5703085",
"0.570291",
"0.57000095",
"0.563281... | 0.62160057 | 3 |
Returns the displacement texture, storing the 3D Displacement in the RGB channels | def get_displacement_texture(self):
return self.displacement_tex | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rgb_image(self):\n z3 = self.z[:,:,newaxis]\n return z3 * self.c",
"def GetOutTextureCoord(self):\n ...",
"def ci(x, y, z):\n\n return (x * 16 + z) * CHUNK_HEIGHT + y",
"def GetInTextureCoord(self):\n ...",
"def rgb_to_xyz(image: tf.Tensor) -> tf.Tensor:\n r, g, b = tf... | [
"0.57808304",
"0.5724655",
"0.5575158",
"0.55007845",
"0.5495631",
"0.5442849",
"0.53449386",
"0.53127766",
"0.52633506",
"0.5257021",
"0.52545923",
"0.52391744",
"0.5231013",
"0.5198924",
"0.51982945",
"0.51770604",
"0.51602405",
"0.51500976",
"0.5144836",
"0.51301616",
"0.5... | 0.7183238 | 0 |
Returns the normal texture, storing the normal in world space in the RGB channels | def get_normal_texture(self):
return self.normal_tex | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_normal(self):\n c, s = np.cos(self.eangles), np.sin(self.eangles)\n r = np.array([[c, -s], [s, c]])\n u = np.array([1, 0])\n return np.dot(r, u)",
"def normal(self, uv):\n res = GeomLProp_SLProps(self.surface(), uv[0], uv[1], 1, 1e-9)\n if not res.IsNormalDefined... | [
"0.6566784",
"0.6541615",
"0.6512049",
"0.64429337",
"0.6339668",
"0.6276351",
"0.6200656",
"0.6118488",
"0.61088574",
"0.607771",
"0.60631305",
"0.6046111",
"0.6028556",
"0.60196614",
"0.60163665",
"0.5973171",
"0.5903069",
"0.5851999",
"0.58481455",
"0.57989216",
"0.5756422... | 0.78915715 | 0 |
Convert (x, y) coordinates to raster column and row indices based on the affine transformation of the raster. | def xy_to_rowcol(x, y, affine):
# affine might be an Affine object, might be 3x3 array or
# 9-element vector. Let's first make damn sure is a 9-element
# vector
aff_array = numpy.array(affine).reshape(9)
# now be damn sure we have an Affine object, and reverse it to
# go from coordinates to ind... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pixel2coord(self, x, y):\n # NEED TO CHANGE TO USE INVERSE TRANSFORM COEFFS\n # partly taken from Sean Gillies \"affine.py\"\n a,b,c,d,e,f = self.coordspace_transform\n det = a*e - b*d\n idet = 1 / float(det)\n ra = e * idet\n rb = -b * idet\n rd = -d * i... | [
"0.7161936",
"0.6930285",
"0.6911302",
"0.6767629",
"0.6755321",
"0.6702426",
"0.6593449",
"0.6577924",
"0.65381414",
"0.64958143",
"0.6494961",
"0.6420091",
"0.6297772",
"0.62835073",
"0.62815624",
"0.62698585",
"0.6257687",
"0.62332827",
"0.61786354",
"0.61742276",
"0.61528... | 0.720692 | 0 |
Please make sure that `df` has been filtered percentile wise To do that, use filter_percentile method | def clustering_dbscan(self, df, conc_attr, eps=10, min_samples=2):
X = df[["latitude", "longitude"]].values
wt = df[conc_attr].values
metric = "haversine"
algorithm = "ball_tree"
min_samples = 2
eps = eps/6371
# without weight DBSCAN
clustering = DBSCAN(eps=10/6371, min_samples=2, algorithm=algorithm,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_percentile(df, col, up=95, down=5):\n pup = np.percentile(df[col].values, up)\n pdw = np.percentile(df[col].values, down)\n\n s = (df[col]<pup) & (df[col]>pdw)\n df2 = df[s]\n\n return df2",
"def filter_query_with_percentile(percentile, queryset):\n # filter on percentile when user r... | [
"0.78571683",
"0.7292044",
"0.72590977",
"0.68510187",
"0.6358147",
"0.6341053",
"0.63344765",
"0.61990696",
"0.6165741",
"0.615586",
"0.6101218",
"0.6096214",
"0.6054992",
"0.6054992",
"0.6024836",
"0.6017268",
"0.601104",
"0.600272",
"0.6002209",
"0.599252",
"0.59753734",
... | 0.0 | -1 |
Initializes flowcell statistic report. | def __init__(self,config,sample_keys=None,number=None,key=int(-1),flowcell=None,input_dir=None,base_output_dir=None,output_dir=None,date=strftime("%Y%m%d",localtime()),time=strftime("%H:%M:%S",localtime()),process_name='flowcell_report',complete_file=None,**kwargs):
if flowcell is None:
flowcell = F... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_reporter(self):\n self._reporter.open(mode='w')\n self._reporter.write_thermodynamic_states(self._thermodynamic_states,\n self._unsampled_states)\n\n # Store run metadata and ReplicaExchange options.\n self._store_options(... | [
"0.64887726",
"0.63885176",
"0.6234261",
"0.6205661",
"0.6133604",
"0.6078629",
"0.6061767",
"0.6043574",
"0.6007101",
"0.5986759",
"0.59836006",
"0.5968505",
"0.59307855",
"0.5928769",
"0.59180045",
"0.5911938",
"0.5896176",
"0.5877347",
"0.58597475",
"0.58466077",
"0.581950... | 0.56822574 | 30 |
DP Calculate the maximum total length of the fence that can be painted without allowing any two artists' work to overlap. | def max_total_length(murals):
if not murals:
return 0
no_overlap = []
for mural in murals:
if mural[1] <= murals[0][0] or mural[0] >= murals[0][1]:
no_overlap.append(mural)
value = murals[0][1] - murals[0][0]
del murals[0]
return max(value + max_total_length(no_over... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_length(self):\n return AtomMath.length(self.atom1.position - self.atom2.position)",
"def edge_length(self):\n if self.edge_length_l is not None:\n return self.edge_length_l\n else:\n self.edge_length_l = (2 * self.radius * math.sin(math.pi / self.vert_count))\n... | [
"0.63357764",
"0.6172923",
"0.61541736",
"0.6139254",
"0.61103475",
"0.6040113",
"0.60374016",
"0.60359704",
"0.597216",
"0.5969269",
"0.5934595",
"0.59330595",
"0.58951724",
"0.5864641",
"0.585913",
"0.5847961",
"0.58305764",
"0.5827366",
"0.5827093",
"0.5824737",
"0.5824531... | 0.5762756 | 22 |
Returns a list of variables managed by this object. | def get_vars(self):
return [self.mu, self.var] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variables(self):\n return self._.vars",
"def get_variables(self):\n\t\treturn self.variables",
"def variables(self):\n return self._variables",
"def variables(self):\n return {u for u in self if u.type == 'var'}",
"def get_variables(self):\n return self.variables",
"def li... | [
"0.8642703",
"0.8473419",
"0.84646976",
"0.8429478",
"0.84256244",
"0.83732164",
"0.8336629",
"0.82757443",
"0.8256269",
"0.8236937",
"0.8182239",
"0.8157605",
"0.8078099",
"0.79914516",
"0.79724437",
"0.7954486",
"0.79525644",
"0.79498386",
"0.78894144",
"0.7888765",
"0.7880... | 0.7937009 | 18 |
Generates all kmers of size k for a string s and store them in a set | def kmer_set(s, k):
kmer = set([])
n = len(s)
#n-k+1 is the available range of values or probablities.
for x in range(0, n - k + 1):
kmer.add(s[x:x + k])
return kmer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clump_forming_kmers(string, k, l, t):\n clumpFormingKmers = set()\n # Initial counts of k-mers within length l window starting from the first\n # chracter of the string.\n counts = Counter([kmer for i, kmer in enumerate_kmers(string[:l], k)])\n clumpFormingKmers = add_clump_forming_kmers(counts,... | [
"0.76189435",
"0.7363111",
"0.6979085",
"0.6867179",
"0.6815722",
"0.67906415",
"0.67450863",
"0.6658662",
"0.66486514",
"0.66284275",
"0.6626568",
"0.6619437",
"0.6613662",
"0.64602196",
"0.6456886",
"0.64392704",
"0.6331464",
"0.6325849",
"0.63245183",
"0.6272226",
"0.62616... | 0.76864225 | 0 |
Truncate the coefficients upto the given threshold | def truncate(coeffs, threshold=99):
sortedindex = np.argsort(np.abs(coeffs))[::-1]
Ncoeff = coeffs.shape[-1]
cutoff = np.int(np.round(Ncoeff*threshold/100.))
# print "Keeping %2.0f %% (N=%s) of the biggest coefficients"%(threshold,cutoff)
coeffs_trunc = coeffs.copy() ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def truncate(self, precision) :\n precision = self.parent().action().filter(precision)\n nprec = min(self.precision(), precision)\n\n ncoefficients = dict( (ch, copy(self.__coefficients[ch]))\n for ch in self.__coefficients )\n return EquivariantMonoidPower... | [
"0.64514995",
"0.6273887",
"0.6269911",
"0.62587625",
"0.61372244",
"0.6091238",
"0.6072903",
"0.5973585",
"0.5852989",
"0.5852989",
"0.5834595",
"0.5436423",
"0.540269",
"0.5387345",
"0.5347651",
"0.5327133",
"0.53194124",
"0.5311541",
"0.53010476",
"0.52519625",
"0.524019",... | 0.82398957 | 0 |
Validates the field and returns True or False. `self.errors` will contain any errors raised during validation. This is usually only called by `Form.validate`. Subfields shouldn't override this, but rather override either `pre_validate`, `post_validate` or both, depending on needs. | async def _field_validate(self, form, extra_validators=()):
self.errors = list(self.process_errors)
stop_validation = False
# Call pre_validate
try:
# Await if a coroutine
res = self.pre_validate(form)
if inspect.isawaitable(res):
res = await(res)
except StopVal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(self):\n\n if self.validate_all_fields():\n return True\n return False",
"def validate(self):\n return self.validator.validate(self.fields)",
"def validate(self):\n if self.id == None:\n return False\n return self.validator.validate(self.fie... | [
"0.7482887",
"0.7340466",
"0.7098373",
"0.6966863",
"0.6826062",
"0.68239903",
"0.6790077",
"0.67772603",
"0.6690308",
"0.66501015",
"0.66279197",
"0.6606551",
"0.6576976",
"0.65420115",
"0.6461654",
"0.6451994",
"0.6381507",
"0.6364916",
"0.63434017",
"0.6339148",
"0.6332983... | 0.6116695 | 41 |
This function linearly increases the perlayer momentum to a predefined ceiling over a set amount of epochs. | def temper_momentum(self, epoch):
if epoch == 0:
return
self.momentums = [
x + y for x, y in zip(self.momentums, self.momentum_temper_rates)
]
for i, param_group in enumerate(self.optimizer.param_groups):
param_group['momentum'] = self.momentums[i] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linear_decay(epoch: int, total_num_updates: int) -> float:\n return 1 - (epoch / float(total_num_updates))",
"def _internal_adjust_learning_rate_pyramid(epoch):\n lr = base_lr * (0.1 ** (epoch // (max_epoch * 0.5))) * (0.1 ** (epoch // (max_epoch * 0.75)))\n return lr",
"def momentum_with_... | [
"0.65823615",
"0.64823323",
"0.62928027",
"0.60715187",
"0.60255474",
"0.602073",
"0.60084313",
"0.59955114",
"0.59843445",
"0.5981576",
"0.5970706",
"0.5969533",
"0.59523624",
"0.5949384",
"0.5948987",
"0.59192854",
"0.59192854",
"0.59128803",
"0.5909585",
"0.5884095",
"0.58... | 0.5680063 | 67 |
This function linearly decays the perlayer lr over a set amount of epochs. | def decay_lr(self):
self.scheduler.step()
for i, param_group in enumerate(self.optimizer.param_groups):
self.lrs[i] = param_group['lr'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _internal_adjust_learning_rate_pyramid(epoch):\n lr = base_lr * (0.1 ** (epoch // (max_epoch * 0.5))) * (0.1 ** (epoch // (max_epoch * 0.75)))\n return lr",
"def lr_schedule(epoch):\r\n lr = 1e-3\r\n if epoch > 180:\r\n lr *= 0.5e-3\r\n elif epoch > 160:\r\n lr *= 1e-3\r\... | [
"0.77847385",
"0.76670074",
"0.76423895",
"0.76423895",
"0.76423895",
"0.76423895",
"0.76047313",
"0.7574088",
"0.75406116",
"0.753134",
"0.7524865",
"0.75063384",
"0.7491736",
"0.74604315",
"0.74192005",
"0.73771524",
"0.73596483",
"0.73521155",
"0.7347699",
"0.7335724",
"0.... | 0.0 | -1 |
Use this to do things like strip off EX at the end of the name, turn 'Bob' into 'Dark Confidant', etc. | def canonical_name(self, name):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sanitizeName(name):\n\n name = name.lower() # lower.\n name = name.replace('.','') # remove periods.\n name = name.replace('-','') # remove dashes.\n name = name.replace(\"'\",'') # remove apostrophies.\n # return it.\n return name",
"def standard_name_remapper(orig_name):\n # Remov... | [
"0.6861182",
"0.68468434",
"0.68080723",
"0.67064315",
"0.67064315",
"0.67064315",
"0.6674636",
"0.6672139",
"0.66402537",
"0.6621842",
"0.6604548",
"0.659963",
"0.65968686",
"0.65703255",
"0.65581053",
"0.6545451",
"0.6533998",
"0.6511444",
"0.64766306",
"0.6454707",
"0.6450... | 0.0 | -1 |
Return a scoped session (according to SQLAlchemy docs, this returns always the same object within a thread, and a different object in a different thread. Moreover, since we update the scopedsessionclass upon forking, also forks have different session objects. | def get_scoped_session():
if scopedsessionclass is None:
s = None
else:
s = scopedsessionclass()
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_session():\n session = scoped_session(sessionmaker(bind=engine))\n return session",
"def get_session():\n return scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine))",
"def get_scoped_session():\n scoped_session = SESSION()\n try:\n yield scoped_session\n ... | [
"0.7187179",
"0.71814144",
"0.710347",
"0.7078379",
"0.7068919",
"0.6859953",
"0.67099005",
"0.67088383",
"0.6662891",
"0.6648465",
"0.6634474",
"0.6613667",
"0.6585746",
"0.658351",
"0.65781957",
"0.65781957",
"0.6575925",
"0.6549415",
"0.65426534",
"0.65316164",
"0.65285134... | 0.7503224 | 0 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('\nHello! Let\'s explore some US bikeshare data!')
# TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
city = input("Which city would you like to explore new york city, chicago or washington? \n ").lower().strip()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.6672178",
"0.65358925",
"0.64600855",
"0.6373334",
"0.63493216",
"0.6310637",
"0.62873024",
"0.6259576",
"0.6230648",
"0.6212208",
"0.6205637",
"0.6182021",
"0.61714137",
"0.6169872",
"0.6159728",
"0.61591697",
"0.61540914",
"0.6145264",
"0.61325365",
"0.61055607",
"0.6103... | 0.57750356 | 67 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
df = pd.read_csv(CITY_DATA[city])
df['Start Time'] = pd.to_datetime(df['Start Time'])
df['month'] = df['Start Time'].dt.month
df['day_of_week'] = df['Start Time'].dt.weekday_name
df['End Time'] = pd.to_datetime(df['End Time'])
# filter by month
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.81320685",
"0.8108889",
"0.8045821",
"0.8042514",
"0.80090284",
"0.80071104",
"0.79991937",
"0.7998333",
"0.7988789",
"0.79737365",
"0.79610896",
"0.7956163",
"0.7947432",
"0.79463065",
"0.7908287",
"0.7908229",
"0.7904569",
"0.7900715",
"0.78930074",
"0.7889219",
"0.78825... | 0.797905 | 9 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
# TO DO: display the most common month
print("Most common month is ", df['month'].mode()[0])
# TO DO: display the most common day of week
print("Most common day of week is ", df['day_of... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80247396",
"0.80233026",
"0.7915788",
"0.78266186",
"0.7822246",
"0.78143597",
"0.77659196",
"0.7740343",
"0.773628",
"0.77344066",
"0.76867086",
"0.7668633",
"0.7651731",
"0.7644636",
"0.76399267",
"0.76367253",
"0.7625196",
"0.7623158",
"0.7612803",
"0.76002145",
"0.7583... | 0.7574127 | 22 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# TO DO: display most commonly used start station
print("Most commonly start station : ", df['Start Station'].mode()[0])
# TO DO: display most commonly used end station
print("Most comm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815675",
"0.7662213",
"0.7553417",
"0.74914914",
"0.74748665",
"0.7446617",
"0.7428588",
"0.74237514",
"0.74177027",
"0.7400495",
"0.7387161",
"0.7385634",
"0.73647535",
"0.735934",
"0.73566747",
"0.73548365",
"0.7351854",
"0.7351274",
"0.735057",
"0.73421645",
"0.7340198... | 0.71288455 | 60 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# TO DO: display total travel time
print("Total travel time:", df['Trip Duration'].sum())
# TO DO: display mean travel time
print("Total mean travel time: ", df['Trip Duration'].mean())
print("\nTh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.7908032",
"0.79055744",
"0.7900715",
"0.7891682",
"0.78894734",
"0.7886722",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664... | 0.7854893 | 27 |
Converts the given data frame into a list of lists. When the `row` paremeter is given with a value >= 0, only that row is extracted as list from the data frame. | def as_list(df: pandas.DataFrame, row=-1) -> list:
if df is None:
return []
if row >= 0:
rec = []
for col in range(0, 13):
rec.append(df.iat[row, col])
return rec
recs = []
for row in range(df.shape[0]):
recs.append(as_list(df, row=row)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataframe_to_list(df: pandas.DataFrame) -> list:\n return json.loads(df.to_json(orient=\"records\"))",
"def column_to_list(data, index):\n return [line[index] for line in data]",
"def rows_from_data (data):\n return data.tolist() # use numpy.ndarray conversion function",
"def ... | [
"0.6662499",
"0.6641174",
"0.6313694",
"0.6297723",
"0.62273407",
"0.6145791",
"0.60353565",
"0.60344374",
"0.6024161",
"0.60228693",
"0.59896314",
"0.59687847",
"0.59476876",
"0.5942627",
"0.592644",
"0.58992493",
"0.5875752",
"0.58308697",
"0.58127946",
"0.5726091",
"0.5696... | 0.83004636 | 0 |
basic test to facilitate db setup | def test_sample_type(self):
self.assertEqual(self.test_sample.sampleType, 'TUMOUR') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dummydb_basic(self):\n db = DummyDB()",
"def setUp(self):\n db.create_all()",
"def setUp(self):\n\n app.config.from_object(config['testing'])\n db.create_all()",
"def setUp(self):\n self.a = backend.dbconnection.DBConnect()",
"def setUp(self):\n init_db()\... | [
"0.8709945",
"0.81639904",
"0.8133525",
"0.80585164",
"0.7992021",
"0.79575616",
"0.79575616",
"0.79575616",
"0.7955161",
"0.79402524",
"0.78764087",
"0.78567004",
"0.7828247",
"0.78238297",
"0.78132236",
"0.7788099",
"0.7788089",
"0.77863306",
"0.77846915",
"0.7784647",
"0.7... | 0.0 | -1 |
basic test to facilitate db setup | def test_sample_date(self):
self.assertEqual(self.test_sample.date, '2018-08-02 22:32:23') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dummydb_basic(self):\n db = DummyDB()",
"def setUp(self):\n db.create_all()",
"def setUp(self):\n\n app.config.from_object(config['testing'])\n db.create_all()",
"def setUp(self):\n self.a = backend.dbconnection.DBConnect()",
"def setUp(self):\n init_db()\... | [
"0.8709945",
"0.81639904",
"0.8133525",
"0.80585164",
"0.7992021",
"0.79575616",
"0.79575616",
"0.79575616",
"0.7955161",
"0.79402524",
"0.78764087",
"0.78567004",
"0.7828247",
"0.78238297",
"0.78132236",
"0.7788099",
"0.7788089",
"0.77863306",
"0.77846915",
"0.7784647",
"0.7... | 0.0 | -1 |
basic test to facilitate db setup | def test_sample_quality(self):
self.assertEqual(self.test_sample.quality, 'medium') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dummydb_basic(self):\n db = DummyDB()",
"def setUp(self):\n db.create_all()",
"def setUp(self):\n\n app.config.from_object(config['testing'])\n db.create_all()",
"def setUp(self):\n self.a = backend.dbconnection.DBConnect()",
"def setUp(self):\n init_db()\... | [
"0.8709945",
"0.81639904",
"0.8133525",
"0.80585164",
"0.7992021",
"0.79575616",
"0.79575616",
"0.79575616",
"0.7955161",
"0.79402524",
"0.78764087",
"0.78567004",
"0.7828247",
"0.78238297",
"0.78132236",
"0.7788099",
"0.7788089",
"0.77863306",
"0.77846915",
"0.7784647",
"0.7... | 0.0 | -1 |
Instantiate the class with data. this class gets called from a PptxTable. | def __init__(self, data):
self.data = data
self.columns = Columns(data)
self.rows = Rows(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n _snap.TTableRow_swiginit(self, _snap.new_TTableRow())",
"def __init__(self, table):\n\n self.table = table\n\n ## Lots of shortcutting\n # \"Connection\"\n self.client = self.table.db.client\n\n # Table object\n self.worksheet = self.table.wo... | [
"0.7175044",
"0.7061784",
"0.688019",
"0.687335",
"0.68206704",
"0.68206704",
"0.68206704",
"0.68206704",
"0.68206704",
"0.68206704",
"0.68206704",
"0.68206704",
"0.68206704",
"0.68206704",
"0.68206704",
"0.6778853",
"0.66937035",
"0.6593775",
"0.6545444",
"0.6529477",
"0.652... | 0.7786698 | 0 |
Converges the keys for the n items received, performing the sum operation with all the values of the same key and returning a joined dictionary | def reduce_task(*items):
merged = dict()
keys = set().union(*items)
for key in keys:
merged[key] = sum([x.get(key, 0) for x in items])
return merged | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sum_over_dicts(total_n_grams: Dict[int, Tensor], n_grams: Dict[int, Tensor]) ->Dict[int, Tensor]:\n for n in n_grams:\n total_n_grams[n] += n_grams[n]\n return total_n_grams",
"def test_reduce_sum_keys(self):\n dictionary = {\n 1: { 2: {}, 3: {} },\n ... | [
"0.6865543",
"0.650365",
"0.6031485",
"0.5964637",
"0.5924674",
"0.5908167",
"0.5882371",
"0.58400947",
"0.58325106",
"0.5811396",
"0.57497364",
"0.57354355",
"0.5723935",
"0.5708992",
"0.568129",
"0.5678631",
"0.56552064",
"0.5654967",
"0.5622168",
"0.5618621",
"0.561248",
... | 0.62753576 | 2 |
Given the path from the current working directory (cwd) to a root directory, and a path from that root directory to some file, derives the path from the cwd to that file. | def from_cwd(root, path):
return normpath(join(root, normpath(path))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cwd_in_path():\n ...",
"def file_path(file_name, path):\n return path.rstrip('\\/') + \"/{0}\".format(file_name) if path else os.getcwd() + \"/{0}\".format(file_name)",
"def relative_path(root_dir, dirpath, f):\n full = os.path.join(dirpath, f)\n if not root_dir:\n return full\n if no... | [
"0.7066784",
"0.6979399",
"0.68085057",
"0.6724433",
"0.6708733",
"0.66995543",
"0.663998",
"0.66332114",
"0.6588345",
"0.6575982",
"0.652172",
"0.643652",
"0.6431836",
"0.6407975",
"0.6388555",
"0.63809216",
"0.6373353",
"0.63663834",
"0.6355308",
"0.6333472",
"0.632867",
... | 0.77983445 | 0 |
Whether the given string is composed entirely of space characters. | def is_blank(text):
all([c.isspace() for c in text]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_whitespace(string):\n temp = string.split()\n return len(temp) > 1",
"def has_whitespaces(string):\n if not isinstance(string, STRTYPE):\n print(str(string) + \" (\" + str(type(string)) + \") is not a string!\")\n return False\n has_ws = False\n for char in string:\n h... | [
"0.82716453",
"0.7889526",
"0.76030177",
"0.757423",
"0.75695306",
"0.75018394",
"0.7483149",
"0.7222355",
"0.71320814",
"0.708367",
"0.69815606",
"0.68495876",
"0.68402535",
"0.67882246",
"0.6773613",
"0.6749679",
"0.6746255",
"0.66398174",
"0.66205674",
"0.6573165",
"0.6555... | 0.74663687 | 7 |
Returns the intent of the message, as defined by the Intent class | def get_intent(msg):
if re.search(MapController.MAP_REGEX, msg.content) and client.user.id in msg.raw_mentions:
return Intent.MAP
elif re.match(Controller.KEY_REGEX, msg.content):
return Intent.DIRECT
else:
return Intent.NONE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _intent(self) -> MessageIntent:\r\n pass",
"def handle(self, message: discord.Message, intent: Intent) -> Optional[str]:\n pass",
"def get_intent_action(self, intent_keyword):\n pass",
"def open_intent_envelope(message):\n intent_dict = message.data\n return Intent(intent_dict.... | [
"0.7623119",
"0.6905368",
"0.6655187",
"0.65414625",
"0.63272935",
"0.61630195",
"0.61426914",
"0.6030031",
"0.5988024",
"0.5958836",
"0.5771847",
"0.56992733",
"0.5698487",
"0.561783",
"0.54841554",
"0.5475818",
"0.54735065",
"0.5444824",
"0.5429536",
"0.5429536",
"0.5413568... | 0.72745353 | 1 |
Get the id of this map controller | def get_id(self):
if self.mlat:
return f'm{-self.mlat}_{self.mlng}'
else:
return f'{-self.clat}_{self.clng}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route_map_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"route_map_id\")",
"def route_map_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"route_map_id\")",
"def depmap_id(self) -> str:\n return self._depmap_id",
"def getId(self):\n return self... | [
"0.72842723",
"0.70707583",
"0.6837728",
"0.6825516",
"0.67583865",
"0.67583865",
"0.67583865",
"0.67583865",
"0.6735228",
"0.6735228",
"0.6735228",
"0.6735228",
"0.6735228",
"0.6735228",
"0.6735228",
"0.6735228",
"0.6735228",
"0.6735228",
"0.6735228",
"0.6735228",
"0.6735228... | 0.0 | -1 |
Perform stateful initialization before fitting. This function is for initialization that does not depend on the data, but still requires some processing and therefore should not happen in __init__. Examples include initialization of optimizers, construction of NeuralNetwork layers (if it can be done without knowledge o... | def _pre_fit(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialisation(self):\n self.create_variables()\n self.create_placeholders()\n self.build_model()\n self.reset_lr(None, True)\n self.build_loss()\n self.initialised = True",
"def initialize(self):\n LOG.info(\"Initializing Model.\")\n self.model = self.... | [
"0.76265585",
"0.7314912",
"0.720167",
"0.70615774",
"0.69451797",
"0.691867",
"0.68875957",
"0.68585646",
"0.6845803",
"0.67859983",
"0.67645854",
"0.67483974",
"0.6729417",
"0.66961324",
"0.66904867",
"0.66830915",
"0.66508514",
"0.6648",
"0.66455895",
"0.66382176",
"0.6632... | 0.6731057 | 12 |
Return the init parameters for an attribute. This extends the ``get_params_for`` function from skorch to inject custom module parameters. This allows us to pass parameters that do not directly correspond to parameters of this estimator while also sticking to the scikitlearn estimator API. Overriding this function is pr... | def get_params_for(self, prefix):
params = super().get_params_for(prefix)
if prefix == "module":
# Explicitly set parameters override the default values.
defaults = self._get_extra_module_parameters()
defaults.update(params)
return defaults
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getInitParams(self):\n paramDict = super().getInitParams()\n paramDict['p'] = self.p\n return paramDict",
"def getInitParams(self):\n paramDict = Distribution.getInitParams(self)\n paramDict['strategy'] = self.strategy\n paramDict['nPoints'] = self.nPoints\n return paramDict",
"def get... | [
"0.65362924",
"0.6531523",
"0.65000147",
"0.65000147",
"0.6471994",
"0.6424887",
"0.63971287",
"0.6379458",
"0.6364574",
"0.63484323",
"0.6333891",
"0.6327582",
"0.6262605",
"0.62387484",
"0.6233585",
"0.61732525",
"0.61732525",
"0.6169874",
"0.61388874",
"0.6054147",
"0.5940... | 0.58375794 | 24 |
Returns the agents' neighbors from its environments. | def neighbors(self, env=None, distance=1, **kwargs):
if env:
if isinstance(env, (list, tuple)):
envs = [self._find_env(en) for en in env]
else:
return self._find_env(env).neighbors(
self, distance=distance, **kwargs)
elif len(se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neighbors(self):\n return self._neighbors",
"def get_neighbors(self):\n return self.neighbors",
"def get_neighbors(self):\n return self.neighbors",
"def get_neighbors(self):\n return self.neighbors",
"def get_neighbors(self):\n return self.neighbors",
"def neighbors... | [
"0.7029478",
"0.69849086",
"0.69849086",
"0.69849086",
"0.69849086",
"0.6956161",
"0.6903547",
"0.6894783",
"0.67666906",
"0.6735697",
"0.6616413",
"0.6603485",
"0.65937454",
"0.6580956",
"0.65605927",
"0.6545098",
"0.6528773",
"0.6499415",
"0.6493673",
"0.6465558",
"0.634310... | 0.7019928 | 1 |
Returns a deep copy of the Property instance. The clone attempts to | def clone(self):
def deep_copy(value):
try:
if hasattr(value, 'clone'):
value.clone()
except Exception:
pass
try:
json.loads(json.dumps(value))
except Exception:
pass
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone(self):\n clone = super(Property, self).clone()\n clone.fget = self.fget\n clone.fset = self.fset\n clone.cached = self.cached\n return clone",
"def copy(self):\n return properties.copy(self)",
"def clone(self):\n return _libsbml.ConversionProperties_cl... | [
"0.8501719",
"0.7826852",
"0.7311905",
"0.7284388",
"0.7240796",
"0.72003424",
"0.72003424",
"0.72003424",
"0.72003424",
"0.71516335",
"0.71035564",
"0.706953",
"0.7067994",
"0.7059914",
"0.6995763",
"0.6975141",
"0.6956973",
"0.6949359",
"0.6930484",
"0.68937236",
"0.688537"... | 0.8122834 | 1 |
Create the organized store with items arranged by aisle uses a single list and a dictionary Assuming N items in inventory and G items in grocery_list Students don't implement it this way, I was having fun seeing how concise I could be (at the expense of understandability and efficiency) | def organize(inventory, grocery_list, exists=set()):
lst = sorted(inventory, key=lambda x : x.aisle) #sort by aisle - O(N*logN)
aisles = [[] for y in lst if not exist_test(y.aisle, exists)] #create unique aisles only - O(N)
[aisles[y.aisle].append(y.grocery) for y in lst if y.grocery in grocery_list] #append groc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fancy_inventory_menu_items(life, show_equipped=True, show_containers=True, check_hands=False, matches=None):\n\t_inventory = []\n\t_inventory_items = 0\n\t_equipped_items = []\n\t_storage = {}\n\t\n\t#TODO: Time it would take to remove\n\tfor item_uid in life['inventory']:\n\t\tif show_equipped and item_is... | [
"0.6024047",
"0.5998682",
"0.5844901",
"0.5823991",
"0.56893134",
"0.5671859",
"0.55562484",
"0.5544263",
"0.5521425",
"0.5519689",
"0.5516972",
"0.5503798",
"0.54968417",
"0.54603326",
"0.5442683",
"0.5417788",
"0.5361586",
"0.5347583",
"0.53425723",
"0.5332526",
"0.5311254"... | 0.7104384 | 0 |
A hook to the home page Context | def home(request):
template = 'index.html'
return render(request,template) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home(self, *args, **kwargs):\n pass",
"def _home(self, op, context):\n self.page = \"HOME\"\n return {'FINISHED'}",
"def home(context, request):\n return {}",
"def home(request):\n # if request.user.is_authenticated():\n # return redirect('/fastapp')\n return context()... | [
"0.73858535",
"0.71361005",
"0.6944438",
"0.66858155",
"0.6647531",
"0.65809596",
"0.6568705",
"0.64961594",
"0.649494",
"0.6463605",
"0.64530367",
"0.64331245",
"0.6420558",
"0.6402942",
"0.6382065",
"0.63791776",
"0.6376593",
"0.6370196",
"0.6330374",
"0.6319156",
"0.631630... | 0.0 | -1 |
Returns an iterator over all words in "text" | def tokenized_text(text: Text):
words = nltk.word_tokenize(text)
return (w.lower().strip() for w in words if ONLY_LETTER_WORDS.match(w)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _words(self):\n regex = r'\\b\\w+\\b'\n for word in re.findall(regex, self.text):\n yield word",
"def get_words(text):\n return re.compile('\\w+').findall(text)",
"def words(self, text):\n return re.findall(r'\\w+', text)",
"def split_text(self, text):\n\n for ma... | [
"0.7876382",
"0.77580315",
"0.77133614",
"0.77027535",
"0.722049",
"0.70725226",
"0.7047197",
"0.70101225",
"0.67893445",
"0.6782731",
"0.6749469",
"0.6733867",
"0.6719985",
"0.66881514",
"0.66686654",
"0.6655805",
"0.6610849",
"0.6587802",
"0.6580478",
"0.65765685",
"0.65634... | 0.64756715 | 27 |
Returns a list of tuples with hashtags and counts | def getHashTags(self, fromDate, toDate):
return self.session.query(Tweet.text).\
filter('text like \'%#%\'').\
filter(Tweet.created_at > fromDate).\
filter(Tweet.created_at < toDate).all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getHashtagsAndMentions(tweets):\n hashtags = Counter()\n mentions = Counter()\n plain = Counter()\n\n pattern = re.compile(r\"[^#@\\w'-]+\")\n\n for t in tweets:\n words = pattern.split(t.message)\n for word in words:\n # Ignore null strings caused by split characters at... | [
"0.7285111",
"0.7012925",
"0.68448496",
"0.6812783",
"0.6778561",
"0.6395302",
"0.6285859",
"0.623535",
"0.62299263",
"0.6222173",
"0.6209409",
"0.620047",
"0.6192568",
"0.6163961",
"0.6100687",
"0.60955125",
"0.6074586",
"0.6063243",
"0.6040972",
"0.6012963",
"0.5990756",
... | 0.0 | -1 |
Returns a list of tuples with hashtags and counts | def getTweets(self, fromDate, toDate):
return self.session.query(Tweet.text).\
filter(Tweet.created_at > fromDate).\
filter(Tweet.created_at < toDate).all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getHashtagsAndMentions(tweets):\n hashtags = Counter()\n mentions = Counter()\n plain = Counter()\n\n pattern = re.compile(r\"[^#@\\w'-]+\")\n\n for t in tweets:\n words = pattern.split(t.message)\n for word in words:\n # Ignore null strings caused by split characters at... | [
"0.7285111",
"0.7012925",
"0.68448496",
"0.6812783",
"0.6778561",
"0.6395302",
"0.6285859",
"0.623535",
"0.62299263",
"0.6222173",
"0.6209409",
"0.620047",
"0.6192568",
"0.6163961",
"0.6100687",
"0.60955125",
"0.6074586",
"0.6063243",
"0.6040972",
"0.6012963",
"0.5990756",
... | 0.0 | -1 |
Calculate the Hamming distance between two bit strings | def hamming2(s1, s2):
assert len(s1) == len(s2)
return sum(c1 != c2 for c1, c2 in zip(s1, s2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hamming_distance(input1, input2):\n if len(input1) != len(input2):\n raise ValueError('Length of input1 and input2 are not equal.')\n input1 = hex_decode(hex_encode(input1))\n input2 = hex_decode(hex_encode(input2))\n # the general strategy here is to xor the two strings together\n # and ... | [
"0.86581886",
"0.8609805",
"0.83848983",
"0.8360063",
"0.83254594",
"0.8282518",
"0.81959116",
"0.815917",
"0.8092042",
"0.8089088",
"0.80491406",
"0.8044223",
"0.8043047",
"0.8019958",
"0.8018021",
"0.8009184",
"0.7942804",
"0.7872873",
"0.782325",
"0.77714366",
"0.77687335"... | 0.7611312 | 23 |
Bool, true if branch is the default branch for the project. | def default(self) -> bool:
return pulumi.get(self, "default") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_branch(self) -> str:\n return pulumi.get(self, \"default_branch\")",
"def master_branch(branch_name):\n\n if branch_name in MASTER_BRANCHES:\n return True\n\n return False",
"def _is_branch(self, reference_name):\n return reference_name.startswith(\"refs/heads/\") or refe... | [
"0.6986105",
"0.693015",
"0.68578935",
"0.66695845",
"0.6556435",
"0.65081894",
"0.6494147",
"0.6494147",
"0.6494147",
"0.6457432",
"0.6409059",
"0.6338145",
"0.6326562",
"0.6321522",
"0.6258638",
"0.6242325",
"0.6227051",
"0.6227051",
"0.6227051",
"0.6227051",
"0.6227051",
... | 0.63698107 | 11 |
Bool, true if the branch has been merged into it's parent. | def merged(self) -> bool:
return pulumi.get(self, "merged") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_ancestor(ancestor, parent):\n try:\n subprocess.check_call([\"git\", \"merge-base\", \"--is-ancestor\", ancestor, parent],)\n return True\n except subprocess.CalledProcessError:\n return False",
"def has_parent(self):\n return self.parent != None",
"def is_merged(self):... | [
"0.7075676",
"0.6833406",
"0.67890143",
"0.6764371",
"0.6726826",
"0.66487074",
"0.6493714",
"0.6418102",
"0.6346954",
"0.6315968",
"0.6226936",
"0.61832917",
"0.616234",
"0.6160166",
"0.61332786",
"0.611147",
"0.6098897",
"0.60797226",
"0.6055989",
"0.60341156",
"0.6023276",... | 0.68772745 | 1 |
Tests for class `RegionDimensionsSphere`. | def test_RegionDimensionsSphere_extractFromLineOldVersion(self):
regionDimensions = RegionDimensions.RegionDimensionsSphere()
numberParameters = 4
self.assertEquals(numberParameters, len(regionDimensions._keys))
line = "500.000000 500.000000 300.000000 300.000000"
regi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sphere(self):\n fun = get_problem('sphere', self.dimension)\n self.assertEqual(fun(self.array), 0.0)",
"def testSphereRadius(self):\n sp = nigel.SphereSelection(nb, radius=10)\n self.assertEqual(sp.n, 9)",
"def testSphereOrigin(self):\n sp = nigel.SphereSelection(nb,... | [
"0.7409547",
"0.73903996",
"0.7046658",
"0.69355893",
"0.68253917",
"0.6764054",
"0.67381215",
"0.6562068",
"0.62761146",
"0.6246008",
"0.6185566",
"0.6173907",
"0.61715746",
"0.61471164",
"0.6050073",
"0.5990708",
"0.59559196",
"0.59052056",
"0.5898389",
"0.5895007",
"0.5891... | 0.6216632 | 10 |
Tests for class `RegionDimensionsSphere`. | def test_RegionDimensionsSphere_extractFromLinesWithKey(self):
regionDimensions = RegionDimensions.RegionDimensionsSphere()
numberParameters = 4
self.assertEquals(numberParameters, len(regionDimensions._keys))
line = "RegionParameters=500.000000 500.000000 300.000000 300.000000... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sphere(self):\n fun = get_problem('sphere', self.dimension)\n self.assertEqual(fun(self.array), 0.0)",
"def testSphereRadius(self):\n sp = nigel.SphereSelection(nb, radius=10)\n self.assertEqual(sp.n, 9)",
"def testSphereOrigin(self):\n sp = nigel.SphereSelection(nb,... | [
"0.7409547",
"0.73903996",
"0.7046658",
"0.69355893",
"0.68253917",
"0.6764054",
"0.67381215",
"0.62761146",
"0.6246008",
"0.6216632",
"0.6185566",
"0.6173907",
"0.61715746",
"0.61471164",
"0.6050073",
"0.5990708",
"0.59559196",
"0.59052056",
"0.5898389",
"0.5895007",
"0.5891... | 0.6562068 | 7 |
Tests for class `RegionDimensionsSphere`. | def test_RegionDimensionsSphere_createLineOldVersion(self):
lineRef = "500.000000 500.000000 300.000000 300.000000"
regionDimensions = RegionDimensions.RegionDimensionsSphere()
regionDimensions.positionX = 500.0
regionDimensions.positionY = 500.0
regionDimensions.positio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sphere(self):\n fun = get_problem('sphere', self.dimension)\n self.assertEqual(fun(self.array), 0.0)",
"def testSphereRadius(self):\n sp = nigel.SphereSelection(nb, radius=10)\n self.assertEqual(sp.n, 9)",
"def testSphereOrigin(self):\n sp = nigel.SphereSelection(nb,... | [
"0.7409547",
"0.73903996",
"0.7046658",
"0.69355893",
"0.68253917",
"0.6764054",
"0.67381215",
"0.6562068",
"0.62761146",
"0.6246008",
"0.6216632",
"0.6185566",
"0.6173907",
"0.61715746",
"0.61471164",
"0.6050073",
"0.5990708",
"0.59559196",
"0.59052056",
"0.5898389",
"0.5895... | 0.53342104 | 72 |
Tests for class `RegionDimensionsSphere`. | def test_RegionDimensionsSphere_createLineWithKey(self):
lineRef = "RegionParameters=500.000000 500.000000 300.000000 300.000000"
regionDimensions = RegionDimensions.RegionDimensionsSphere()
regionDimensions.positionX = 500.0
regionDimensions.positionY = 500.0
regionDime... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sphere(self):\n fun = get_problem('sphere', self.dimension)\n self.assertEqual(fun(self.array), 0.0)",
"def testSphereRadius(self):\n sp = nigel.SphereSelection(nb, radius=10)\n self.assertEqual(sp.n, 9)",
"def testSphereOrigin(self):\n sp = nigel.SphereSelection(nb,... | [
"0.7409547",
"0.73903996",
"0.7046658",
"0.69355893",
"0.68253917",
"0.6764054",
"0.67381215",
"0.6562068",
"0.62761146",
"0.6246008",
"0.6216632",
"0.6185566",
"0.6173907",
"0.61715746",
"0.61471164",
"0.6050073",
"0.5990708",
"0.59559196",
"0.59052056",
"0.5898389",
"0.5895... | 0.58479017 | 25 |
Initialize with real y, predicted y, and probabilities y_proba should be a single column vector. | def __init__(self, clf, y_real, y_pred, y_proba):
self.clf = clf
self.y_real = y_real
self.y_pred = y_pred
self.y_proba = y_proba | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict_proba(self, X_test):\n if self._fitted is False:\n raise NotFittedError\n if X_test.shape[1] != self.theta.shape[0]:\n X_test = np.hstack((np.ones((X_test.shape[0], 1)), X_test))\n y_proba = self._sigmoid(X_test @ self.theta)\n return y_proba",
"def p... | [
"0.69407153",
"0.6790847",
"0.67209333",
"0.6692591",
"0.66359365",
"0.6487533",
"0.644551",
"0.6431803",
"0.6424399",
"0.63853794",
"0.63811916",
"0.6367134",
"0.63636446",
"0.6331281",
"0.63171285",
"0.62952566",
"0.62726724",
"0.62540257",
"0.62525856",
"0.61847705",
"0.61... | 0.6847743 | 1 |
The test duration in seconds. | def duration(self):
self._duration = self.lib.iperf_get_test_duration(self._test)
return self._duration | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration(self) -> int:\n return 0",
"def duration(self):\n pass",
"def duration(self):\n pass",
"def get_duration(self):\n try:\n if self.is_skipped:\n return \"00:00\"\n assert self.start_time\n assert self.stop_time\n ... | [
"0.7883373",
"0.7750263",
"0.7750263",
"0.7678744",
"0.7383673",
"0.7330992",
"0.7328771",
"0.7282695",
"0.7278623",
"0.72580075",
"0.7154214",
"0.7146179",
"0.7112877",
"0.71073246",
"0.708255",
"0.707991",
"0.7078312",
"0.7054944",
"0.7027199",
"0.69971526",
"0.6994351",
... | 0.8444397 | 0 |
GetString(n) > String Returns the label of the item with the given index. | def 取项目文本(self, n): # real signature unknown; restored from __doc__
return self.GetString(n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetString(self, index):\n \n return self.choices[index].GetLabel()",
"def get_label(self, index, key=\"Name\"):\n return eval(self.names[key][index])",
"def label_from_index(self, index):\n assert self.labels is not None, \"Labels not processed\"\n return self.labels[inde... | [
"0.757612",
"0.72174156",
"0.671362",
"0.66893935",
"0.6440017",
"0.6387719",
"0.6372429",
"0.6310176",
"0.6171957",
"0.6150542",
"0.6073155",
"0.5996782",
"0.59937876",
"0.5969363",
"0.59649146",
"0.59624845",
"0.5953992",
"0.5946173",
"0.59319806",
"0.59280974",
"0.5923146"... | 0.61306494 | 10 |
Return a list of all primes less than n | def sieve(n):
#All even numbers except 2 are not primes
primes = [False, False, True] + [True, False] * (n / 2)
#Start with 3
p = 3
while p*p <= n:
if primes[p]:
#p is prime, cross off all multiples of p, starting at the square
#of p since all smaller multiples hav... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primes(n):\n return [i for i in xrange(1, n + 1) if mr_prime(i)]",
"def list_primes(n):\n primeList = []\n for i in range(n):\n if is_prime(i):\n primeList.append(i)\n return primeList",
"def generate_prime_less_than_n(n):\n\tif n <= 1:\n\t\treturn []\n\tlist_of_primes = [2]\n\tfor i in range... | [
"0.86042696",
"0.8369213",
"0.82889706",
"0.8250212",
"0.81855386",
"0.81599945",
"0.8057329",
"0.805507",
"0.8004981",
"0.7979233",
"0.7955313",
"0.78772587",
"0.78654575",
"0.78598934",
"0.78583056",
"0.7814833",
"0.78013843",
"0.7751896",
"0.7719229",
"0.76897174",
"0.7654... | 0.7220014 | 50 |
Returns the total for the given tenant. | def get_total(self, **kwargs):
LOG.warning('WARNING: /v1/report/total/ endpoint is deprecated, '
'please use /v1/report/summary instead.')
authorized_args = [
'begin', 'end', 'tenant_id', 'service', 'all_tenants']
url = self.get_url('total', kwargs, authorized_arg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table_total(self):\n total = 0.00\n\n for customer in self.customers:\n total = total + customer.get_total()\n\n return total",
"def get_total_paid(self):\n return sum(self.paid)",
"def get_total(self):\n\n base_price = 5\n total = (1 + int(self.tax)) * ... | [
"0.62531126",
"0.6162233",
"0.61108077",
"0.60956305",
"0.6016143",
"0.5912477",
"0.5870869",
"0.5847878",
"0.5786993",
"0.57543814",
"0.57539463",
"0.5750175",
"0.57361287",
"0.57264996",
"0.5717916",
"0.5709568",
"0.5695177",
"0.5694699",
"0.5693841",
"0.56890893",
"0.56671... | 0.6835537 | 0 |
Get the rightmost subtree. Returns Max value in tree | def getMaxValue(self):
if self.right is None:
return self.data
return self.right.getMaxValue() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_maximum_value(self):\n if self.root: \n self.max_val = self.root.value\n else:\n return 'No tree found'\n def inner(root):\n if root.left:\n inner(root.left)\n\n if root.right:\n inner(root.right)\n\n if self.max_val < root.value:\n self.max_val = roo... | [
"0.8557654",
"0.8473722",
"0.82796377",
"0.8257174",
"0.825662",
"0.81699663",
"0.8079723",
"0.799689",
"0.7985184",
"0.7966924",
"0.79573554",
"0.7938735",
"0.79376626",
"0.7892704",
"0.7860829",
"0.7827642",
"0.77914673",
"0.7748221",
"0.7746624",
"0.7744519",
"0.7728751",
... | 0.77943695 | 16 |
Get the leftmost subtree. Returns Min value in tree. | def getMinValue(self):
if self.left is None:
return self.data
return self.left.getMinValue() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findMin(self):\n curr = self\n while curr.hasLeftChild():\n curr = curr.leftChild\n return curr",
"def get_min(self):\n\t\tif self.left:\n\t\t\treturn self.left.get_min()\n\t\treturn self.value",
"def min(self):\n node = self\n while node.left:\n nod... | [
"0.82564294",
"0.823352",
"0.81775767",
"0.80998373",
"0.8041522",
"0.8033412",
"0.80095875",
"0.7989185",
"0.7925415",
"0.7885453",
"0.77749646",
"0.7765609",
"0.77551806",
"0.7677062",
"0.7657029",
"0.76159257",
"0.7600756",
"0.76004016",
"0.7528457",
"0.7445298",
"0.744504... | 0.8080847 | 4 |
Returns the angle from point_1 on a circle to point_2 on a circle. Circle is centered at the origin. Angle is positive if point_2 is counterclockwise from point_1 Angle is negative if point_2 is clockwise from point_1 | def _angle_between(self, point_1, point_2):
angle_1 = math.atan2(point_1.y, point_1.x)
angle_2 = math.atan2(point_2.y, point_2.x)
return angles.shortest_angular_distance(angle_1, angle_2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle(point1, point2):\n return atan2(point2.y() - point1.y(), point2.x() - point1.x())",
"def _get_angle(point1, point2):\n ydelta = point2[0] - point1[0]\n xdelta = point2[1] - point1[1]\n if xdelta == 0:\n hypot = np.sqrt(xdelta ** 2 + ydelta ** 2)\n theta... | [
"0.80957276",
"0.7915116",
"0.78434145",
"0.7817022",
"0.76840395",
"0.7630344",
"0.75476015",
"0.7397519",
"0.7338723",
"0.7332764",
"0.72714704",
"0.7244359",
"0.7223806",
"0.72077715",
"0.7201296",
"0.72001654",
"0.7196317",
"0.71613544",
"0.714921",
"0.7147866",
"0.713809... | 0.73542243 | 8 |
Sort tags in view from left to right (by their x position in the camera frame). Removes/ignores tags close enough in the camera to likely be a block in the claw. | def _sort_tags_left_to_right(self, detections, id=0):
BLOCK_IN_CLAW_DIST = 0.22 # meters
sorted_detections = []
for detection in detections:
if (detection.id == id and
detection.pose.pose.position.z > BLOCK_IN_CLAW_DIST):
sorted_detections.append... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sort_home_tags_nearest_center(self, detections):\n sorted_detections = []\n\n for detection in detections:\n if detection.id == 256:\n sorted_detections.append(detection)\n\n return sorted(sorted_detections,\n key=lambda x: abs(x.pose.pose.po... | [
"0.5948881",
"0.59211606",
"0.5505296",
"0.54796255",
"0.5224809",
"0.51409453",
"0.51296383",
"0.51185745",
"0.507329",
"0.5059373",
"0.50522685",
"0.5020326",
"0.49868953",
"0.4957405",
"0.4956648",
"0.4945304",
"0.49099445",
"0.49099445",
"0.49007258",
"0.48856413",
"0.488... | 0.68595314 | 0 |
Turn right, then left, then back to start heading. Helps to clear and mark the map if in a difficult spot. | def clear(self, angle, ignore=Obstacle.IS_SONAR, reset_heading=True,
throw=False):
start_heading = self.swarmie.get_odom_location().get_pose().theta
ignore |= Obstacle.SONAR_BLOCK # always ignore this one too
# Planner._clear() uses Swarmie.set_heading(), which doesn't have
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn(self, is_right):\n if is_right:\n self.heading.rotate(1)\n else:\n self.heading.rotate(-1)",
"def right(self):\n if self.head.heading() != LEFT and self.last_direction != LEFT:\n self.head.setheading(RIGHT)",
"def left(self):\n if self.head.heading() != R... | [
"0.68991685",
"0.68686086",
"0.6739887",
"0.67155945",
"0.66476077",
"0.65854007",
"0.65796304",
"0.65705436",
"0.65462583",
"0.65273607",
"0.65066653",
"0.6468951",
"0.64657867",
"0.6435298",
"0.64075226",
"0.6393533",
"0.6376692",
"0.6362955",
"0.63578445",
"0.6320066",
"0.... | 0.0 | -1 |
Shoot a ray from an origin point in a given direction and find the first place it intersects a mesh, if anywhere. | def mesh_ray_collision(mesh: jnp.ndarray, origin: jnp.ndarray, direction: jnp.ndarray):
collides, positions, distances = jax.vmap(
lambda t: _triangle_ray_collision(t, origin, direction)
)(mesh)
idx = jnp.argmin(jnp.where(collides, distances, jnp.inf))
return (
jnp.any(collides),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersects(self, ray):\n theta = 45\n H = 512\n W = 512\n A = self.origin\n B = Point(W, A.y, A.z)\n C = Point(B.x, (int)(H * math.sin(theta * math.pi / 180)), (int)(H * math.cos(math.pi * theta / 180)))\n D = Point(A.x, (int)(H * math.sin(theta * math.pi / 180)... | [
"0.6328977",
"0.6311272",
"0.63029695",
"0.61903316",
"0.6177152",
"0.61375874",
"0.60943496",
"0.60207874",
"0.59388417",
"0.5893612",
"0.58412987",
"0.57528913",
"0.5724966",
"0.5704529",
"0.5689389",
"0.567179",
"0.56663096",
"0.56171393",
"0.5606271",
"0.5578516",
"0.5575... | 0.7033451 | 0 |
Given a file path, it returns the parent directory of that file. | def get_pardir(file):
return os.path.dirname(file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_parent_dir(path):\n return os.path.dirname(path)",
"def parent_dir_path(path):\n return absolute_path(os.path.dirname(path))",
"def get_parent_dir(path):\n\n return os.path.abspath(os.path.join(path, os.pardir))",
"def get_parent(path):\n\n # security check\n parent = os.path.dirname(pat... | [
"0.8710049",
"0.8671962",
"0.84711546",
"0.84562033",
"0.81613225",
"0.8111954",
"0.7666267",
"0.76561385",
"0.7514874",
"0.7380682",
"0.7348119",
"0.7208113",
"0.70832604",
"0.70509714",
"0.69705814",
"0.6908172",
"0.6890457",
"0.6850834",
"0.67569923",
"0.6633027",
"0.66175... | 0.6757264 | 18 |
Takes a file path and returns the contents of that file as a string. | def file2str(file):
with open(file, "r") as textFile:
return textFile.read() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_to_string(path_to_file):\n\t\twith open(path_to_file, 'r') as f:\n\t\t\tcontent = f.read()\n\t\treturn content",
"def read_file(path): #TODO implementme, handling paths more intelligently\n f = open(path, \"r\")\n string = f.read()\n f.close()\n return string",
"def ReadFileIntoString(file... | [
"0.83179075",
"0.8151047",
"0.8134509",
"0.8105471",
"0.80002606",
"0.79376936",
"0.78909034",
"0.78593415",
"0.78361714",
"0.7832416",
"0.78220797",
"0.7774392",
"0.77467716",
"0.7731549",
"0.77003115",
"0.76696384",
"0.7668756",
"0.76412374",
"0.76294947",
"0.75795716",
"0.... | 0.77455384 | 13 |
Get the length of the dataset. | def __len__(self):
return len(self.list_sample) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length(self) -> int:\n return len(self.data)",
"def __len__(self):\n return self._dataset.size(dirs=self._dirs)",
"def getLen(self):\n return len(self.data)",
"def length(self):\n return len(self.data)",
"def length(self):\n return len(self.data)",
"def length(self)... | [
"0.81695807",
"0.8132053",
"0.8120344",
"0.8113011",
"0.8113011",
"0.8113011",
"0.8095",
"0.8090324",
"0.8017467",
"0.79916984",
"0.79916984",
"0.79916984",
"0.79916984",
"0.7965216",
"0.7940359",
"0.7929157",
"0.79088104",
"0.78975385",
"0.78951997",
"0.7878114",
"0.78751826... | 0.0 | -1 |
Displays a custom error page when returning a 404 error | def display_404(error):
return render_template('/error.html'), 404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error():\n return render_template(\"404.html\")",
"def not_found(e):\n return render_template(\"errors/404.html\"), 404",
"def error_404(error):\n return '404 Error'",
"def not_found_error(error):\n return render_template('errors/404.html'), 404",
"def page_not_found():\n return render_t... | [
"0.86492556",
"0.85913444",
"0.8580295",
"0.854521",
"0.85064226",
"0.8480788",
"0.8473789",
"0.84674686",
"0.8443625",
"0.8435984",
"0.8434157",
"0.8430222",
"0.84054524",
"0.8401293",
"0.8397243",
"0.8393867",
"0.839259",
"0.839259",
"0.83886766",
"0.83642703",
"0.83563656"... | 0.8704343 | 0 |
Displays a custom error page when returning a 404 error | def display_401(error):
return render_template('/error401.html'), 401 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_404(error):\n return render_template('/error.html'), 404",
"def error():\n return render_template(\"404.html\")",
"def not_found(e):\n return render_template(\"errors/404.html\"), 404",
"def error_404(error):\n return '404 Error'",
"def not_found_error(error):\n return render_tem... | [
"0.8704343",
"0.86492556",
"0.85913444",
"0.8580295",
"0.854521",
"0.85064226",
"0.8480788",
"0.8473789",
"0.84674686",
"0.8443625",
"0.8435984",
"0.8434157",
"0.8430222",
"0.84054524",
"0.8401293",
"0.8397243",
"0.8393867",
"0.839259",
"0.839259",
"0.83886766",
"0.83642703",... | 0.0 | -1 |
Returns the lengths of all edges in a triangulation. | def get_edge_lengths(points: np.ndarray, triangles: np.ndarray) -> np.ndarray:
edges, _ = get_edges(triangles)
return np.linalg.norm(np.diff(points[edges], axis=1), axis=2).squeeze() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def EdgeLengths(self,which_edges='boundary'):\n\n assert self.points is not None\n assert self.element_type is not None\n\n\n lengths = None\n if which_edges == 'boundary':\n if self.edges is None:\n self.GetBoundaryEdges()\n\n edge_coords = self.poi... | [
"0.73203355",
"0.71601605",
"0.7129149",
"0.7090104",
"0.6865497",
"0.68333477",
"0.6777454",
"0.67209166",
"0.6678222",
"0.66413075",
"0.661965",
"0.65952957",
"0.65821904",
"0.65669715",
"0.6552667",
"0.65479076",
"0.6495845",
"0.640232",
"0.6400356",
"0.63793975",
"0.63614... | 0.6831387 | 6 |
Calculates the area of each triangle. | def triangle_areas(points: np.ndarray, triangles: np.ndarray) -> np.ndarray:
xy = points[triangles]
# s1 = xy[:, 2, :] - xy[:, 1, :]
# s2 = xy[:, 0, :] - xy[:, 2, :]
# s3 = xy[:, 1, :] - xy[:, 0, :]
# which can be simplified to
# s = xy[:, [2, 0, 1]] - xy[:, [1, 2, 0]] # 3D
s = xy[:, [2, 0]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def area(triangles):\n # sides of the triangle\n sides = great_circle_distance(triangles,\n numpy.roll(triangles, 1, axis=1))\n\n assert numpy.all(sides >= 0.)\n\n # s = (a + b + c) / 2.\n s = (numpy.sum(sides, axis=1) / 2.)\n\n # tan(s... | [
"0.8150476",
"0.7862507",
"0.7856542",
"0.7823651",
"0.7814551",
"0.7719481",
"0.7691595",
"0.76806235",
"0.7627593",
"0.7575206",
"0.7548901",
"0.75445074",
"0.7516754",
"0.7482324",
"0.7421109",
"0.7374413",
"0.72843087",
"0.72584736",
"0.7204859",
"0.71738887",
"0.7155678"... | 0.61381984 | 100 |
Checks whether `node_a` is an instance of the same type as `node_b`, or if either `node_a`/`node_b` is a type and the other is an instance of that type. This is used in subgraph matching to allow the subgraph pattern to be either a graph of instantiated nodes, or node types. | def type_or_class_match(node_a, node_b):
if isinstance(node_b['node'], type):
return issubclass(type(node_a['node']), node_b['node'])
elif isinstance(node_a['node'], type):
return issubclass(type(node_b['node']), node_a['node'])
elif isinstance(node_b['node'], xf.PatternNode):
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def same_type(one, two):\n\n return isinstance(one, type(two))",
"def type_match(graph_node, pattern_node):\n if isinstance(pattern_node['node'], xf.PatternNode):\n return isinstance(graph_node['node'], pattern_node['node'].node)\n return isinstance(graph_node['node'], type(pattern_node['node']))... | [
"0.7246985",
"0.6875418",
"0.6746393",
"0.66509914",
"0.6645413",
"0.64153445",
"0.63544613",
"0.6354311",
"0.6345268",
"0.6345268",
"0.6300346",
"0.6269791",
"0.6268452",
"0.6268452",
"0.626733",
"0.62422216",
"0.62378544",
"0.623251",
"0.6231513",
"0.62188184",
"0.62145805"... | 0.8616503 | 0 |
The name given to the new Role. | def label(self) -> pulumi.Input[str]:
return pulumi.get(self, "label") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autoname(self):\n\t\tself.name = self.role_profile",
"def __init__(self, role):\n self.name = role",
"def role(self) -> str:\n\n assert self.data is not None\n return self.data[\"role\"][\"name\"]",
"def get_name(self):\n return '-'.join(self._name_parts +\n ... | [
"0.76014084",
"0.7298675",
"0.7211555",
"0.7203234",
"0.6998517",
"0.68832964",
"0.6824219",
"0.6820696",
"0.6746396",
"0.66966844",
"0.6526202",
"0.65143645",
"0.6481994",
"0.64733917",
"0.64610755",
"0.63807106",
"0.6351706",
"0.6329996",
"0.6323037",
"0.63158435",
"0.63076... | 0.0 | -1 |
The name given to the new Role. | def label(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "label") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autoname(self):\n\t\tself.name = self.role_profile",
"def __init__(self, role):\n self.name = role",
"def role(self) -> str:\n\n assert self.data is not None\n return self.data[\"role\"][\"name\"]",
"def get_name(self):\n return '-'.join(self._name_parts +\n ... | [
"0.76014084",
"0.7298675",
"0.7211555",
"0.7203234",
"0.6998517",
"0.68832964",
"0.6824219",
"0.6820696",
"0.6746396",
"0.66966844",
"0.6526202",
"0.65143645",
"0.6481994",
"0.64733917",
"0.64610755",
"0.63807106",
"0.6351706",
"0.6329996",
"0.6323037",
"0.63158435",
"0.63076... | 0.0 | -1 |
The name given to the new Role. | def label(self) -> pulumi.Output[str]:
return pulumi.get(self, "label") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autoname(self):\n\t\tself.name = self.role_profile",
"def __init__(self, role):\n self.name = role",
"def role(self) -> str:\n\n assert self.data is not None\n return self.data[\"role\"][\"name\"]",
"def get_name(self):\n return '-'.join(self._name_parts +\n ... | [
"0.76014084",
"0.7298675",
"0.7211555",
"0.7203234",
"0.6998517",
"0.68832964",
"0.6824219",
"0.6820696",
"0.6746396",
"0.66966844",
"0.6526202",
"0.65143645",
"0.6481994",
"0.64733917",
"0.64610755",
"0.63807106",
"0.6351706",
"0.6329996",
"0.6323037",
"0.63158435",
"0.63076... | 0.0 | -1 |
Create an onehot tensor | def _onehot_labels(self,
labels,
n_classes,
axis=-1):
onehot_labels = tf.one_hot(
tf.squeeze(labels),
depth=n_classes,
axis=axis)
return onehot_labels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_onehot(tensor, labels=10):\n one_hot = np.zeros((tensor.shape[0], labels))\n one_hot[range(tensor.shape[0]), tensor.astype(int)] = 1.\n return one_hot",
"def one_hot(labels, dim):\n batch_size = labels.size(0)\n out = torch.zeros(batch_size, dim)\n out[np.arange(batch_size), labels.sque... | [
"0.8210468",
"0.8201671",
"0.8077205",
"0.805354",
"0.7989695",
"0.7980231",
"0.79696697",
"0.7950092",
"0.7950092",
"0.7948467",
"0.7912533",
"0.79025644",
"0.78822047",
"0.7878681",
"0.7878665",
"0.7847643",
"0.7840364",
"0.7837447",
"0.78366977",
"0.78201234",
"0.77968866"... | 0.7188955 | 92 |
Turn on the scene. | def run(self) -> None:
self._hass.turn_on('scene.{0}'.format(self._args['scene'])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_on(self) -> None:\n self._state = self._player.turn_on()",
"def turnOn(self):\n self.off = False\n self.turnOnAnimation()",
"def turn_on(self, **kwargs: Any) -> None:\n self._set_light(ON_STATE)",
"def turn_on(self, **kwargs):\n self._state = True\n\n # Make... | [
"0.71402043",
"0.71132696",
"0.70279604",
"0.6954936",
"0.68721765",
"0.68652636",
"0.68229365",
"0.67939657",
"0.67710656",
"0.6735029",
"0.6730508",
"0.6596266",
"0.65804565",
"0.6536582",
"0.6518706",
"0.6516858",
"0.64804995",
"0.64552146",
"0.6397112",
"0.63840973",
"0.6... | 0.7613048 | 0 |
Set the security system. | def run(self) -> None:
self._hass.security_manager.set_alarm(
self._hass.security_manager.AlarmStates[self._args['state']]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def security(self, security):\n\n self._security = security",
"def security(self, security: ModelDeploymentSecurityConfig):\n\n self._security = security",
"def system(self, system):\n\n self._system = system",
"def system(self, system):\n\n self._system = system",
"def set_secu... | [
"0.70384496",
"0.6453808",
"0.63437",
"0.63437",
"0.630204",
"0.6263157",
"0.6199377",
"0.61934114",
"0.608844",
"0.5802159",
"0.5754248",
"0.57243806",
"0.56770456",
"0.5674967",
"0.56644505",
"0.56538695",
"0.56399906",
"0.5632406",
"0.5590807",
"0.5584901",
"0.55318826",
... | 0.0 | -1 |
Set the text of this label. | def set_text(self, txt):
self.value = txt
# Signal to the application that we need to resize this widget
self.chsize() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_text(self, text):\n self._label.setText(text)",
"def setText(self, text):\n assert self.isLabel(text)\n self._text = text",
"def set_text(self, text: str) -> Label:\n self.setText(text)\n return self",
"def set_label_text(self, text: str) -> None:\n self._lab... | [
"0.8881065",
"0.8824003",
"0.8666323",
"0.86477816",
"0.857802",
"0.8477054",
"0.8196709",
"0.81731737",
"0.8168305",
"0.81428933",
"0.8101899",
"0.80970854",
"0.80940205",
"0.7839607",
"0.7772613",
"0.7733791",
"0.77274406",
"0.7669161",
"0.7621147",
"0.75899833",
"0.7570886... | 0.7170519 | 44 |
Does Non Max Suppression given bboxes | def non_max_suppression(bboxes, iou_threshold, threshold, box_format="corners"):
# 49 x 6
assert type(bboxes) == list
# print(bboxes)
bboxes = [box for box in bboxes if box[1] > threshold]
bboxes = sorted(bboxes, key=lambda x: x[1], reverse=True)
bboxes_after_nms = []
# print(bboxes)
w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iou_suppression(cnt_box, yolo_box, max_threshold, min_threshold):\n all_boxes = []\n pre_bboxes = yolo_box\n bboxes = cnt_box\n for i in range(len(pre_bboxes)):\n max_flag = 0\n min_flag = 0\n for j in range(len(bboxes)):\n\n (pre_x1, pre_y1) = (pre_bboxes[i][0], pre... | [
"0.7150832",
"0.7069101",
"0.68712294",
"0.6653853",
"0.65888387",
"0.65339005",
"0.64546716",
"0.6423793",
"0.6404525",
"0.63950497",
"0.6346387",
"0.6314987",
"0.63059807",
"0.62732834",
"0.62166923",
"0.61743283",
"0.607827",
"0.60195446",
"0.5984185",
"0.5977257",
"0.5976... | 0.7529759 | 0 |
Plots predicted bounding boxes on the image | def plot_image(image, boxes, class_dic, frame_n):
im = np.array(image)
print(im.shape)
height, width, _ = im.shape
# Create figure and axes
# fig, ax = plt.subplots(1)
# # Display the image
# ax.imshow(im)
fig = plt.figure()
ax = fig.add_subplot(111, aspect='auto')
ax.set_axis_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_pred_gt_boxes(image_outname, img, boxes, labels, scores, image_name=None, figsize=(15,15)):\n fig, (ax1, ax2) = plt.subplots(nrows=1, ncols=2, figsize=figsize)\n if image_name is not None:\n fig.suptitle(image_name)\n if isinstance(img, torch.Tensor):\n img = img.numpy().squeeze().t... | [
"0.7221695",
"0.70395166",
"0.7036144",
"0.6970583",
"0.6917753",
"0.68724614",
"0.6755849",
"0.668966",
"0.66610396",
"0.66610396",
"0.6622663",
"0.65560836",
"0.6545348",
"0.6522647",
"0.6512622",
"0.6504384",
"0.65015507",
"0.6500133",
"0.6486647",
"0.64641434",
"0.6451028... | 0.69319826 | 4 |
purity of density matrix | def purity(den_mat):
return (np.trace(
np.dot(den_mat, den_mat)
)).real | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_density(matrix):\n return matrix.getnnz() / (matrix.shape[0] * matrix.shape[1])",
"def density(self):\n return self.nnz/self.dim",
"def density_ch(tensor):\n return 1 - sparsity_ch(tensor)",
"def density(self):\n return self.nnz / self.size",
"def density_2D(tensor):\n return... | [
"0.73438895",
"0.7259086",
"0.7160841",
"0.7130563",
"0.7040095",
"0.69233084",
"0.68869364",
"0.6794914",
"0.6713435",
"0.66814655",
"0.6661546",
"0.66090053",
"0.65904367",
"0.65904367",
"0.65904367",
"0.6590174",
"0.6567534",
"0.65476596",
"0.6528517",
"0.65232694",
"0.651... | 0.68341416 | 7 |
Adds the study to the user's wish list. Establishes a wish lists relationship between a study and a user. | def get(self,**kwargs):
# obtain parameters
parser = reqparse.RequestParser(bundle_errors=True)
#parser.add_argument("user_id", type=str, required=True, help="The user ID of the wish lister is a String.")
parser.add_argument("study_id", type=int, required=True,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_wish_list(self, user_id, caption):\n with self.connection:\n return self.cursor.execute(\"INSERT INTO 'wish_list' (`user_id`, `wish_list`) VALUES(?,?)\", (user_id,caption))",
"def addSessionToWishlist(self, request):\n return self._addSessionToWishlist(request)",
"def _addSe... | [
"0.70670515",
"0.63541037",
"0.6194152",
"0.612041",
"0.59016776",
"0.57341015",
"0.5707533",
"0.5693885",
"0.5649836",
"0.54972154",
"0.5446288",
"0.5422339",
"0.540463",
"0.5375156",
"0.53356314",
"0.53030115",
"0.5291971",
"0.52887017",
"0.5284084",
"0.5254901",
"0.5238905... | 0.56657994 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.