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 |
|---|---|---|---|---|---|---|
The number of seconds that has elapsed since the step started running if the step is still running. Or, if the step has already finished running, the amount of time that elapsed during the last execution of the step. | def elapsed_time(self) -> float:
current_time = datetime.utcnow()
start = self.start_time or current_time
end = self.end_time or current_time
return (end - start).total_seconds() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration( self ):\n return (self.start and time.process_time()-self.start) or 0",
"def time_passed(self):\n return (datetime.now(timezone.utc) - self._time_run).total_seconds()",
"def estimated_time(self):\n self._update()\n if not self.running_mode:\n return 0 if sel... | [
"0.7802674",
"0.7697838",
"0.7586256",
"0.7486374",
"0.7444195",
"0.7377511",
"0.7369081",
"0.73648757",
"0.7350214",
"0.7323691",
"0.7319423",
"0.7310252",
"0.72868305",
"0.7265888",
"0.7223617",
"0.7210912",
"0.72100985",
"0.71675175",
"0.7148891",
"0.71476275",
"0.71425056... | 0.7163002 | 18 |
A humanreadable version of the elapsed time for the last execution of the step. The value is derived from the `ProjectStep.elapsed_time` property. | def get_elapsed_timestamp(self) -> str:
t = self.elapsed_time
minutes = int(t / 60)
seconds = int(t - (60 * minutes))
millis = int(100 * (t - int(t)))
return '{:>02d}:{:>02d}.{:<02d}'.format(minutes, seconds, millis) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elapsed(self):\n return str(datetime.datetime.now() - self.start).split('.')[0]",
"def get_time_elapsed(self):\n return self.__time_elapsed",
"def elapsed_time(self):\n return self.__elapsed_time",
"def __str__(self):\n return str(self.elapsed) + ' sec'",
"def __get_elapsed_... | [
"0.74348295",
"0.7341026",
"0.71488404",
"0.71327865",
"0.7075832",
"0.68811524",
"0.68706244",
"0.6833403",
"0.68153375",
"0.680169",
"0.67919904",
"0.6724556",
"0.67207795",
"0.666062",
"0.66344434",
"0.6619493",
"0.6612993",
"0.6610164",
"0.65931654",
"0.6574453",
"0.65721... | 0.7340715 | 2 |
The creation timestamp of the sink.This field may not be present for older sinks. | def create_time(self) -> str:
return pulumi.get(self, "create_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")",
"def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")",
"def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")",
"def creation_times... | [
"0.76058096",
"0.76058096",
"0.76058096",
"0.7508474",
"0.7460193",
"0.74237835",
"0.73722935",
"0.7352411",
"0.7214987",
"0.72008866",
"0.7140401",
"0.6901553",
"0.6901553",
"0.6901553",
"0.68743926",
"0.68743926",
"0.6860949",
"0.67897165",
"0.6770373",
"0.6754774",
"0.6754... | 0.6487352 | 48 |
The last update timestamp of the sink.This field may not be present for older sinks. | def update_time(self) -> str:
return pulumi.get(self, "update_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_update_time(self):\n return self.last_update_time",
"def last_update_time(self):\n return self._last_update_time",
"def last_update_datetime(self):\n return datetime.strptime(self.last_update, \"%Y-%m-%d %H:%M:%S.%f\")",
"def last_update_datetime(self):\n return datet... | [
"0.7420381",
"0.7400893",
"0.7301744",
"0.7301744",
"0.7283081",
"0.7251563",
"0.7251563",
"0.71741444",
"0.71671265",
"0.7112806",
"0.70771015",
"0.70703256",
"0.70314467",
"0.69901365",
"0.69297767",
"0.69297767",
"0.68884665",
"0.6873872",
"0.68640715",
"0.67941",
"0.67562... | 0.6522177 | 37 |
Optimized queryset for changelist view. | def get_queryset(self, request):
qs = super().get_queryset(request)
qs = qs.annotate(models.Count('work', distinct=True))
qs = qs.annotate(models.Count('recording', distinct=True))
return qs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, request, queryset):\n\n return queryset",
"def get_queryset(self):\r\n return self.model.objects.all()",
"def get_queryset(self):\n return self.model.objects.all()",
"def get_queryset(self):\n filter = {self.kwargs.get('field'): self.kwargs.get('constraint')... | [
"0.70606595",
"0.69933677",
"0.6967507",
"0.69492984",
"0.67478234",
"0.6718268",
"0.6718268",
"0.66655964",
"0.6621231",
"0.65900636",
"0.6575608",
"0.6543804",
"0.6543446",
"0.65210843",
"0.6512028",
"0.6469871",
"0.6452944",
"0.64510924",
"0.6393163",
"0.6378914",
"0.63767... | 0.0 | -1 |
Optimized queryset for changelist view. | def get_queryset(self, request):
qs = super().get_queryset(request)
qs = qs.annotate(
libraryrelease__count=models.Count(
'release', distinct=True,
filter=models.Q(release__cd_identifier__isnull=False)))
qs = qs.annotate(
commercialrelease_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, request, queryset):\n\n return queryset",
"def get_queryset(self):\r\n return self.model.objects.all()",
"def get_queryset(self):\n return self.model.objects.all()",
"def get_queryset(self):\n filter = {self.kwargs.get('field'): self.kwargs.get('constraint')... | [
"0.70606595",
"0.69933677",
"0.6967507",
"0.69492984",
"0.67478234",
"0.6718268",
"0.6718268",
"0.66655964",
"0.6621231",
"0.65900636",
"0.6575608",
"0.6543804",
"0.6543446",
"0.65210843",
"0.6512028",
"0.6469871",
"0.6452944",
"0.64510924",
"0.6393163",
"0.6378914",
"0.63767... | 0.0 | -1 |
Optimized queryset for changelist view. | def get_queryset(self, request):
qs = super().get_queryset(request)
qs = qs.annotate(
work__count=models.Count('release__works', distinct=True))
qs = qs.annotate(
release__count=models.Count('release__id', distinct=True))
return qs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, request, queryset):\n\n return queryset",
"def get_queryset(self):\r\n return self.model.objects.all()",
"def get_queryset(self):\n return self.model.objects.all()",
"def get_queryset(self):\n filter = {self.kwargs.get('field'): self.kwargs.get('constraint')... | [
"0.70606595",
"0.69933677",
"0.6967507",
"0.69492984",
"0.67478234",
"0.6718268",
"0.6718268",
"0.66655964",
"0.6621231",
"0.65900636",
"0.6575608",
"0.6543804",
"0.6543446",
"0.65210843",
"0.6512028",
"0.6469871",
"0.6452944",
"0.64510924",
"0.6393163",
"0.6378914",
"0.63767... | 0.0 | -1 |
Optimized queryset for changelist view. | def get_queryset(self, request):
qs = super().get_queryset(request)
qs = qs.annotate(models.Count('tracks', distinct=True))
qs = qs.annotate(models.Count('works', distinct=True))
return qs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, request, queryset):\n\n return queryset",
"def get_queryset(self):\r\n return self.model.objects.all()",
"def get_queryset(self):\n return self.model.objects.all()",
"def get_queryset(self):\n filter = {self.kwargs.get('field'): self.kwargs.get('constraint')... | [
"0.70606595",
"0.69933677",
"0.6967507",
"0.69492984",
"0.67478234",
"0.6718268",
"0.6718268",
"0.66655964",
"0.6621231",
"0.65900636",
"0.6575608",
"0.6543804",
"0.6543446",
"0.65210843",
"0.6512028",
"0.6469871",
"0.6452944",
"0.64510924",
"0.6393163",
"0.6378914",
"0.63767... | 0.0 | -1 |
Optimized queryset for changelist view. | def get_queryset(self, request):
qs = super().get_queryset(request)
qs = qs.annotate(models.Count('tracks', distinct=True))
return qs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, request, queryset):\n\n return queryset",
"def get_queryset(self):\r\n return self.model.objects.all()",
"def get_queryset(self):\n return self.model.objects.all()",
"def get_queryset(self):\n filter = {self.kwargs.get('field'): self.kwargs.get('constraint')... | [
"0.70606595",
"0.69933677",
"0.6967507",
"0.69492984",
"0.67478234",
"0.6718268",
"0.6718268",
"0.66655964",
"0.6621231",
"0.65900636",
"0.6575608",
"0.6543804",
"0.6543446",
"0.65210843",
"0.6512028",
"0.6469871",
"0.6452944",
"0.64510924",
"0.6393163",
"0.6378914",
"0.63767... | 0.0 | -1 |
Optimized queryset for changelist view. | def get_queryset(self, request):
qs = super().get_queryset(request)
qs = qs.annotate(models.Count('work', distinct=True))
return qs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, request, queryset):\n\n return queryset",
"def get_queryset(self):\r\n return self.model.objects.all()",
"def get_queryset(self):\n return self.model.objects.all()",
"def get_queryset(self):\n filter = {self.kwargs.get('field'): self.kwargs.get('constraint')... | [
"0.70606595",
"0.69933677",
"0.6967507",
"0.69492984",
"0.67478234",
"0.6718268",
"0.6718268",
"0.66655964",
"0.6621231",
"0.65900636",
"0.6575608",
"0.6543804",
"0.6543446",
"0.65210843",
"0.6512028",
"0.6469871",
"0.6452944",
"0.64510924",
"0.6393163",
"0.6378914",
"0.63767... | 0.0 | -1 |
Optimized queryset for changelist view. | def get_queryset(self, request):
qs = super().get_queryset(request)
qs = qs.prefetch_related('writerinwork_set')
qs = qs.prefetch_related('writers')
qs = qs.prefetch_related('library_release__library')
qs = qs.annotate(models.Count('cwr_exports', distinct=True))
qs = qs.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, request, queryset):\n\n return queryset",
"def get_queryset(self):\r\n return self.model.objects.all()",
"def get_queryset(self):\n return self.model.objects.all()",
"def get_queryset(self):\n filter = {self.kwargs.get('field'): self.kwargs.get('constraint')... | [
"0.70606595",
"0.69933677",
"0.6967507",
"0.69492984",
"0.67478234",
"0.6718268",
"0.6718268",
"0.66655964",
"0.6621231",
"0.65900636",
"0.6575608",
"0.6543804",
"0.6543446",
"0.65210843",
"0.6512028",
"0.6469871",
"0.6452944",
"0.64510924",
"0.6393163",
"0.6378914",
"0.63767... | 0.0 | -1 |
Set initial values for work IDs. | def get_form(self, request, obj=None, **kwargs):
form = super().get_form(request, obj, **kwargs)
if hasattr(self, 'work_ids'):
form.base_fields['works'].initial = self.work_ids
return form | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_initial_values(self):\n\n pass",
"def _set_id(self, value):\n pass",
"def _set_id(self):\n raise NotImplementedError()",
"def _setVals(self, qubit_id=0):\n self.qubit_id = qubit_id",
"def _setVals(self, ref_id: int = 0) -> None:\n self.ref_id = ref_id",
"def ini... | [
"0.63838756",
"0.5626983",
"0.55985147",
"0.55754405",
"0.55573905",
"0.5549936",
"0.5549916",
"0.55236214",
"0.5470408",
"0.5464957",
"0.54609644",
"0.53837353",
"0.5364111",
"0.5325926",
"0.52752525",
"0.52721184",
"0.52686673",
"0.52520066",
"0.52504444",
"0.5247788",
"0.5... | 0.61217713 | 1 |
Return package version as listed in `__version__` in `init.py`. | def get_version(package):
init_py = open(os.path.join(package, '__init__.py')).read()
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version_from_package() -> str:\n path = join(dirname(__file__), \"__init__.py\")\n path = normpath(abspath(path))\n with open(path) as f:\n for line in f:\n if line.startswith(\"__version__\"):\n token, version = line.split(\" = \", 1)\n version = ve... | [
"0.8488895",
"0.83906066",
"0.8386243",
"0.8380057",
"0.8378992",
"0.83693045",
"0.8357915",
"0.83578175",
"0.83562696",
"0.8076947",
"0.79735863",
"0.7939292",
"0.7892811",
"0.7892811",
"0.7892811",
"0.7802969",
"0.772123",
"0.7697026",
"0.76941913",
"0.7688442",
"0.76599205... | 0.8370639 | 10 |
test that city is a subclass of basemodel | def test_subclass(self):
self.assertIsInstance(self.city, BaseModel)
self.assertTrue(hasattr(self.city, "id"))
self.assertTrue(hasattr(self.city, "created_at"))
self.assertTrue(hasattr(self.city, "updated_at")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_inheritence(self):\n self.assertTrue(issubclass(City, BaseModel))",
"def test_inheritance(self):\n city3 = City()\n self.assertIsInstance(city3, BaseModel)\n self.assertIsInstance(city3, City)",
"def test_is_subclass(self):\n c = City()\n self.assertIsInstance... | [
"0.8854508",
"0.8677629",
"0.84322345",
"0.83302236",
"0.77094585",
"0.7189997",
"0.7145998",
"0.70157367",
"0.69717264",
"0.6920326",
"0.68921465",
"0.68817616",
"0.6878152",
"0.6832497",
"0.67862713",
"0.6707529",
"0.67006713",
"0.6682659",
"0.66786814",
"0.6633037",
"0.655... | 0.8228105 | 4 |
Mehtod to create deep equality | def __eq__(self, other):
firstnum = self.num*other.den
secondnum = self.den*other.num
return firstnum == secondnum | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deep_equals(obja, objb, isequal):\n\n objatree = wo.typedtree(obja)\n objbtree = wo.typedtree(objb)\n match = objatree == objbtree\n ok = match == isequal\n\n if ok:\n s = \"pass\"\n else:\n s = \"fail\"\n\n print(f\"{obja} == {objb} is {match} : {s}\")\n return ok",
... | [
"0.7669497",
"0.7594508",
"0.728683",
"0.7247459",
"0.7200209",
"0.7200209",
"0.7200209",
"0.7200209",
"0.7200209",
"0.7200209",
"0.7200209",
"0.7200209",
"0.7200209",
"0.7200209",
"0.7200209",
"0.7200209",
"0.7200209",
"0.7200209",
"0.7200209",
"0.7200209",
"0.7200209",
"0... | 0.0 | -1 |
Returns the Value of the Node at certain index | def value_at(self, index):
if self.empty():
return "Linked List Empty"
idx = 1
l = self.head
while l.next is not None:
if idx is index:
break
l = l.next
idx += 1
return l.data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _value_at(self, index):\n node = self._get_node_at(index)\n if node is None:\n raise IndexError('List index out of range.')\n return node.value",
"def _value_at(self, index):\n node = self._get_node_at(index)\n if node is None:\n raise IndexError('List... | [
"0.8760695",
"0.8760695",
"0.8411536",
"0.8410069",
"0.8038799",
"0.7710551",
"0.7693732",
"0.75457287",
"0.7523973",
"0.7519126",
"0.74544835",
"0.74464095",
"0.74409634",
"0.7427687",
"0.73091924",
"0.7298157",
"0.72241414",
"0.7212669",
"0.7212669",
"0.71528834",
"0.713793... | 0.7689592 | 7 |
adds a node in the front of the linked list | def push_front(self, data):
n = Node(data)
if self.empty():
self.head = n
return
l = self.head
self.head = n
n.next = l
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addFront(self, data):\n new_list = _Node(data)\n temp = self._head\n\n if self._head is None:\n self._head = new_list\n self._tail = new_list\n else:\n new_list.next = temp\n new_list.next.prev = new_list\n self._head = new_list... | [
"0.79435956",
"0.79062754",
"0.79018503",
"0.770904",
"0.770904",
"0.7680617",
"0.76622814",
"0.7533677",
"0.745268",
"0.7434043",
"0.7414779",
"0.7377841",
"0.73685306",
"0.73620886",
"0.73380136",
"0.73015785",
"0.7222717",
"0.717256",
"0.71706766",
"0.71247196",
"0.7087387... | 0.7690084 | 5 |
Returns head of the Linked List | def front(self):
if self.empty():
return "Linked List is Empty"
return self.head.data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def head(self) -> object:\n if not self._head:\n raise EmptyListException(\"The list is empty.\")\n return self._head",
"def first(self):\n if self.is_empty():\n raise Empty('list is empty')\n return self._head._next._element # front aligned with hea... | [
"0.78142667",
"0.7570546",
"0.7401346",
"0.7401346",
"0.728126",
"0.7280486",
"0.7277227",
"0.725226",
"0.71798074",
"0.70358026",
"0.7009618",
"0.6936419",
"0.69164675",
"0.69055516",
"0.6893666",
"0.6869632",
"0.6853931",
"0.68439776",
"0.68323934",
"0.6828792",
"0.68156487... | 0.6821777 | 20 |
Computes partial xderivative of input img. | def partial_x(img):
out = None
### YOUR CODE HERE
kernel = 0.5*np.array([[1,0,-1]])
out = conv(img,kernel)
### END YOUR CODE
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partial_derivative(f, x, i, epsilon = 1e-10):\n x_ = np.copy(x).astype(np.float64)\n x_[i] = x_[i] + epsilon\n value = (f(x_) - f(x)) / epsilon\n\n return value",
"def calculate_derivative_value(self, x: np.array) -> np.array:\n pass",
"def func_deriv(x,remain):\n #df_x0 = -1*remain[0... | [
"0.67712903",
"0.6501167",
"0.6485898",
"0.64442617",
"0.6436161",
"0.63960797",
"0.62391645",
"0.61663836",
"0.61452615",
"0.6144807",
"0.60673076",
"0.6062778",
"0.6030098",
"0.6023732",
"0.6019578",
"0.5996646",
"0.5991342",
"0.5978751",
"0.59690577",
"0.59690577",
"0.5946... | 0.60531056 | 12 |
Test random insert and delete. | def test_random_insert_delete():
for _ in range(0, 10):
insert_data = random.sample(range(1, 2000), 1000)
delete_data = random.sample(insert_data, 500)
tree = red_black_tree.RBTree()
for key in insert_data:
tree.insert(key=key, data=str(key))
for key in delete_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete(self):\n pass",
"def test_delete1(self):\n pass",
"async def test_delete_invalid(database,valid_data):\n test_valid_insert(database,valid_data)\n N = 10\n for idx in range(N+1,N*2):\n try:\n await database.delete(_id=idx,user_id=idx)\n assert ... | [
"0.68421745",
"0.6814112",
"0.6787218",
"0.6741631",
"0.67338127",
"0.66408277",
"0.6588561",
"0.6566808",
"0.6511061",
"0.64413196",
"0.64139",
"0.6405201",
"0.6377499",
"0.6376437",
"0.6349136",
"0.63420004",
"0.62856805",
"0.62655014",
"0.62583804",
"0.622033",
"0.6215004"... | 0.75990003 | 0 |
Asks user to specify a city, month, and a day to analyze. | def get_filters():
print('Hello! My name is Damir. 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
try:
city = input('Which city would you like to analyze data from? chicago, new york city... | {
"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.66179204",
"0.64608276",
"0.63908345",
"0.63495",
"0.63061595",
"0.62379",
"0.62069833",
"0.61961794",
"0.6171032",
"0.6130573",
"0.6113631",
"0.6099385",
"0.60975987",
"0.60892045",
"0.60516274",
"0.6042802",
"0.60328114",
"0.60287476",
"0.60271525",
"0.6025436",
"0.59918... | 0.5670383 | 85 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
try:
df = pd.read_csv(CITY_DATA[city])
df['Start Time'] = pd.to_datetime(df['Start Time'], errors='coerce')
df['End Time'] = pd.to_datetime(df['End Time'])
df['month'] = df['Start Time'].dt.month
df['day_of_week'] = df['Start Time'].dt.weekda... | {
"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.8132439",
"0.81092066",
"0.80460113",
"0.80428666",
"0.80092704",
"0.80078983",
"0.79997176",
"0.7999047",
"0.7989329",
"0.7979842",
"0.7973761",
"0.79617316",
"0.7956702",
"0.79477483",
"0.7946521",
"0.7908704",
"0.79049814",
"0.7901444",
"0.7893375",
"0.78896016",
"0.788... | 0.7908281 | 16 |
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
try:
popular_month_num = df['Start Time'].dt.month.mode()[0]
popular_month = MONTH_LIST[popular_month_num-1].title()
print('The most... | {
"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.80235124",
"0.80223495",
"0.7914819",
"0.78260994",
"0.7821642",
"0.78139323",
"0.77653635",
"0.7739615",
"0.77358055",
"0.7733576",
"0.7686211",
"0.7667902",
"0.76510555",
"0.76440334",
"0.76391727",
"0.7636328",
"0.7624661",
"0.7622607",
"0.76119757",
"0.7599401",
"0.758... | 0.7234768 | 66 |
Displays statistics on the most popular stations and trip. | def station_stats(df,city):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# TO DO: display most commonly used start station
try:
popular_start_station = df['Start Station'].mode()[0]
popular_start_station_amount = df['Start Station'].value_coun... | {
"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.0 | -1 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df, city):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# TO DO: display total travel time
try:
df['Time Delta'] = df['End Time'] - df['Start Time']
total_time_delta = df['Time Delta'].sum()
print('the total travel time was:', total... | {
"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.0 | -1 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! My name is Damir. 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
try:
city = input('Which city would you like to analyze data from? chicago, new york city... | {
"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.66718096",
"0.6536446",
"0.64608175",
"0.63732874",
"0.6349621",
"0.6310782",
"0.62876326",
"0.6260145",
"0.6230216",
"0.62113076",
"0.62061083",
"0.61823773",
"0.61707395",
"0.6170415",
"0.6160548",
"0.6158978",
"0.6154724",
"0.61454946",
"0.6130887",
"0.61055917",
"0.610... | 0.58548677 | 49 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
try:
df = pd.read_csv(CITY_DATA[city])
df['Start Time'] = pd.to_datetime(df['Start Time'], errors='coerce')
df['End Time'] = pd.to_datetime(df['End Time'])
df['month'] = df['Start Time'].dt.month
df['day_of_week'] = df['Start Time'].dt.w... | {
"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.797905",
"0.79737365",
"0.79610896",
"0.7956163",
"0.7947432",
"0.79463065",
"0.7908287",
"0.7908229",
"0.7904569",
"0.7900715",
"0.78930074",
"0.788921... | 0.7780334 | 39 |
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
try:
popular_month_num = df['Start Time'].dt.month.mode()[0]
popular_month = MONTH_LIST[popular_month_num-1].title()
print('The most... | {
"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.80235124",
"0.80223495",
"0.7914819",
"0.78260994",
"0.7821642",
"0.78139323",
"0.77653635",
"0.7739615",
"0.77358055",
"0.7733576",
"0.7686211",
"0.7667902",
"0.76510555",
"0.76440334",
"0.76391727",
"0.7636328",
"0.7624661",
"0.7622607",
"0.76119757",
"0.7599401",
"0.758... | 0.7234768 | 65 |
Displays statistics on the most popular stations and trip. | def station_stats(df,city):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# TO DO: display most commonly used start station
try:
popular_start_station = df['Start Station'].mode()[0]
popular_start_station_amount = df['Start Station'].value_coun... | {
"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.7816157",
"0.7662524",
"0.7554042",
"0.7492024",
"0.7475423",
"0.74471235",
"0.7430301",
"0.74246186",
"0.741813",
"0.7400704",
"0.7387859",
"0.73857087",
"0.7365416",
"0.73599696",
"0.73571277",
"0.73555714",
"0.73525584",
"0.7351796",
"0.735084",
"0.7342505",
"0.734093",... | 0.0 | -1 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df, city):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# TO DO: display total travel time
try:
df['Time Delta'] = df['End Time'] - df['Start Time']
total_time_delta = df['Time Delta'].sum()
print('the total travel time was:', total... | {
"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.0 | -1 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! My name is Damir. 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
try:
city = input('Which city would you like to analyze data from? chicago, new york city... | {
"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.6670955",
"0.65355206",
"0.64598334",
"0.6373697",
"0.63487226",
"0.6310236",
"0.6287051",
"0.6259993",
"0.62314963",
"0.62125754",
"0.62053525",
"0.61813915",
"0.6171331",
"0.6169096",
"0.61588687",
"0.6158631",
"0.6153347",
"0.6144922",
"0.6131542",
"0.6105515",
"0.61029... | 0.5804608 | 60 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
try:
df = pd.read_csv(CITY_DATA[city])
df['Start Time'] = pd.to_datetime(df['Start Time'], errors='coerce')
df['End Time'] = pd.to_datetime(df['End Time'])
df['month'] = df['Start Time'].dt.month
df['day_of_week'] = df['Start Time'].dt.w... | {
"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.81319666",
"0.81089365",
"0.8045794",
"0.80421233",
"0.8009013",
"0.8006819",
"0.79993606",
"0.799815",
"0.7988398",
"0.7978816",
"0.7973185",
"0.79605204",
"0.79559934",
"0.7946578",
"0.79459554",
"0.79077595",
"0.79076785",
"0.7903725",
"0.79003966",
"0.7892789",
"0.7888... | 0.77798367 | 38 |
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
try:
popular_month_num = df['Start Time'].dt.month.mode()[0]
popular_month = MONTH_LIST[popular_month_num-1].title()
print('The most... | {
"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.72357357 | 64 |
Displays statistics on the most popular stations and trip. | def station_stats(df,city):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# TO DO: display most commonly used start station
try:
popular_start_station = df['Start Station'].mode()[0]
popular_start_station_amount = df['Start Station'].value_coun... | {
"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.7816157",
"0.7662524",
"0.7554042",
"0.7492024",
"0.7475423",
"0.74471235",
"0.7430301",
"0.74246186",
"0.741813",
"0.7400704",
"0.7387859",
"0.73857087",
"0.7365416",
"0.73599696",
"0.73571277",
"0.73555714",
"0.73525584",
"0.7351796",
"0.735084",
"0.7342505",
"0.734093",... | 0.0 | -1 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df, city):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# TO DO: display total travel time
try:
df['Time Delta'] = df['End Time'] - df['Start Time']
total_time_delta = df['Time Delta'].sum()
print('the total travel time was:', total... | {
"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.8144002",
"0.8025936",
"0.80051756",
"0.7950414",
"0.7938244",
"0.7932019",
"0.7927543",
"0.79160506",
"0.7915316",
"0.79089457",
"0.79064983",
"0.7901538",
"0.7892409",
"0.7890379",
"0.7887529",
"0.78859615",
"0.78849727",
"0.7883412",
"0.78750104",
"0.7869431",
"0.786734... | 0.0 | -1 |
Get basket from request or create a new one. If user is logged in session basket gets merged into a user basket. | def get_or_create_from_request(self, request: HttpRequest) -> Tuple['Basket', bool]:
if not hasattr(request, 'session'):
request.session = {}
try:
session_basket_id = request.session[BASKET_ID_SESSION_KEY]
session_basket = self.get(id=session_basket_id, owner=None)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_basket(self, request):\n if request._basket_cache is not None:\n return request._basket_cache\n\n\n cookie_basket = self.get_cookie_basket(request)\n\n if cookie_basket:\n # Anonymous user with a basket tied to the cookie\n basket = cookie_basket\n ... | [
"0.77207947",
"0.7372341",
"0.67973304",
"0.6527075",
"0.61940205",
"0.6074896",
"0.6070478",
"0.6034448",
"0.60055405",
"0.59059364",
"0.5697016",
"0.5638296",
"0.5628024",
"0.5599381",
"0.5578504",
"0.55452347",
"0.55352515",
"0.5526266",
"0.55127966",
"0.55110615",
"0.5456... | 0.815834 | 0 |
Returns basket item count. | def count(self) -> int:
if self._cached_items is not None:
return len(self._cached_items)
return self.items.count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item_count(self):\n resp = self.app.get('/items')\n self.assertEqual(resp.status_code, status.HTTP_200_OK)\n data = json.loads(resp.data)\n return len(data)",
"def __len__(self):\n return sum(item['qty'] for item in self.basket.values()) # counts all the values of the ... | [
"0.7626551",
"0.7533444",
"0.7331775",
"0.7326534",
"0.72976536",
"0.7268994",
"0.715991",
"0.70996845",
"0.7023512",
"0.6998778",
"0.6987219",
"0.6987219",
"0.6962023",
"0.6926958",
"0.6925463",
"0.69103056",
"0.68875307",
"0.6878682",
"0.68532354",
"0.6851633",
"0.68428713"... | 0.6815846 | 23 |
Returns the total quantity of all items in a basket. | def quantity(self) -> int:
if self._cached_items is not None:
return sum([item.quantity for item in self._cached_items])
aggr = self.items.aggregate(quantity=models.Sum('quantity'))
return aggr['quantity'] or 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_quantity(self) -> int:\n total = 0\n for i in self.order_items:\n total += i.quantity\n return total",
"def total_qty(self):\n return sum(self.quantities)",
"def __len__(self):\n return sum(item['qty'] for item in self.basket.values()) # counts all the v... | [
"0.7919851",
"0.76263994",
"0.71842575",
"0.7174423",
"0.7167888",
"0.7110817",
"0.7033801",
"0.69301176",
"0.6889082",
"0.6684862",
"0.6590007",
"0.65273595",
"0.652153",
"0.6515659",
"0.65067196",
"0.6497118",
"0.6453592",
"0.6393087",
"0.620499",
"0.6198273",
"0.6177245",
... | 0.71383715 | 5 |
This will return all the active models with an easy to consume JSON | def simple_active_models(self, label=None):
# make the request to get active models from Razor
am_content = self.active_models(label)
#print json.dumps(am_content, indent=4)
# Check the status code and return appropriately
if 'response' in am_content.keys():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def models(self):\n \n # Call the Razor RESTful API to get a list of models\n headers = {'content-type': 'application/json'}\n r = requests.get(self.url + '/model', headers=headers)\n\n # Check the status code and return appropriately\n if r.status_code == 200:\n ... | [
"0.76252496",
"0.75904197",
"0.6954012",
"0.6900618",
"0.68392795",
"0.6818335",
"0.6784167",
"0.67314005",
"0.662959",
"0.659793",
"0.6573254",
"0.65546614",
"0.65488756",
"0.6543924",
"0.65324396",
"0.650513",
"0.6478326",
"0.6421939",
"0.6421939",
"0.6415112",
"0.6404571",... | 0.7398353 | 2 |
This method will return all the online broker complete servers | def broker_success(self, razor_json):
servers = []
# step through the json and gather simplified information
for item in razor_json:
if 'broker_success' in razor_json[item]['current_state']:
ready_server = {'description': razor_json[item]['description'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_servers(self) -> List[Server]:\n pass",
"def get_servers(self):\n\t\treturn self.__servers",
"def get_reachable_servers(self) -> List[Server]:\n pass",
"def get_servers():\n all_servers = []\n start = 0\n size = 100\n\n while True:\n params = {\n 'start... | [
"0.72184527",
"0.7165914",
"0.70691454",
"0.70602417",
"0.69249266",
"0.65485126",
"0.650072",
"0.645317",
"0.644556",
"0.64343196",
"0.64037097",
"0.63703746",
"0.63267624",
"0.6279317",
"0.62622035",
"0.6247003",
"0.62450415",
"0.6237214",
"0.61978495",
"0.61966014",
"0.619... | 0.5939073 | 45 |
For cleaning the space replace space by _ | def _cleanString(self, s):
s = str(re.sub(r'\([^)]*\)', '', s))
translator = str.maketrans('', '', string.punctuation)
s = s.translate(translator)
return s.strip().replace(" ", "_").lower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unscorize(s):\n return s.replace(\" \", \"_\")",
"def underscore(text):\n # return '__'+text.replace(' ','__') + '__'\n return text.replace(' ', '__')",
"def test_space_replacements(self):\n testString = sanitize(' a b c d ', '_')\n self.assertEqual(testString, '__a_b_c_d___')",
... | [
"0.80242676",
"0.7783524",
"0.76967204",
"0.7673874",
"0.75371486",
"0.7525557",
"0.7446191",
"0.74362135",
"0.73351026",
"0.73031664",
"0.71846277",
"0.71567565",
"0.71446306",
"0.7104345",
"0.70976096",
"0.7094494",
"0.7056341",
"0.70322686",
"0.7003794",
"0.6991272",
"0.69... | 0.0 | -1 |
A prepopulated store with a uniquekey requirement on the field "name". | def fixture_test_store(andy, pandy, candy):
store_ = InMemoryStore[Person](unique_keys={"name"})
store_.add(andy)
store_.add(pandy)
store_.add(candy)
yield store_ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, store):\n self.db.query(f\"\"\"\n INSERT INTO {self.table} (id, name)\n VALUES (:id, :name)\n ON DUPLICATE KEY UPDATE name = :name\n \"\"\", **vars(store))\n\n if not store.id:\n store.id = self.get(name=store.name).id\n return... | [
"0.6332145",
"0.5996839",
"0.59523803",
"0.5839743",
"0.5765455",
"0.57481533",
"0.56834847",
"0.56767225",
"0.5674454",
"0.56721956",
"0.56685156",
"0.55962837",
"0.55038404",
"0.5485419",
"0.5471714",
"0.5457102",
"0.5455449",
"0.5438032",
"0.54286665",
"0.54048485",
"0.538... | 0.5119244 | 90 |
Assert that saving an item that the store did not create raises a `NotFromStoreException`. | def test_save_item_not_from_store_raises(test_store):
sugar = Person("Sugar", age=15)
with pytest.raises(NotFromStoreException):
test_store.save(sugar) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_items_from_different_stores_do_not_mingle():\n\n my_store = InMemoryStore[Person]()\n carl = my_store.add(Person(\"Carl\", age=22))\n carl.age = 23\n\n other_store = InMemoryStore[Person]()\n with pytest.raises(NotFromStoreException):\n other_store.save(carl)\n\n my_store.save(car... | [
"0.80932206",
"0.6693182",
"0.66549426",
"0.6493662",
"0.6473891",
"0.63646144",
"0.63614845",
"0.6285036",
"0.6268964",
"0.6261587",
"0.6230347",
"0.6203305",
"0.62021",
"0.6171741",
"0.61620104",
"0.61587864",
"0.6141526",
"0.6131728",
"0.6120135",
"0.60960543",
"0.60855055... | 0.8773912 | 0 |
exclude any questions that aren't published yet | def get_queryset(self):
return Question.objects.filter(pub_date__lte=timezone.now()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n # the filter says that it only returns those w/ the pub_date\n # less or equal to timezone.now() (earlier or now)\n questions = Question.objects.filter(\n pub_date__lte=timezone.now()\n ).order_by('-pub_date')\n\n excludes = []\n for qu... | [
"0.65009534",
"0.6449258",
"0.6294944",
"0.6294944",
"0.6282573",
"0.62779695",
"0.6173223",
"0.6164126",
"0.6136216",
"0.60906893",
"0.60184664",
"0.6007451",
"0.59934664",
"0.5976536",
"0.59524435",
"0.5937415",
"0.5935725",
"0.5935725",
"0.5913496",
"0.5904687",
"0.5903289... | 0.6312912 | 14 |
Helper function for merging dicts. This functino is called in | def _merge_dicts(d1, d2):
for key, value in d2.items():
if key in d1:
if isinstance(d1[key], dict) and isinstance(value, dict):
_merge_dicts(d1[key], value)
continue
d1[key] = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dict_merge(dict1, dict2):\n combined = dict(dict1)\n combined.update(dict2)\n return combined",
"def dict_merge(dict1, dict2):\n combined = dict(dict1)\n combined.update(dict2)\n return combined",
"def merge(a: dict, b: dict) -> dict:\n return __merge(a, b)",
"def mergedict(x, y):\n ... | [
"0.7988987",
"0.7988987",
"0.7951268",
"0.7693137",
"0.7673867",
"0.76137185",
"0.755312",
"0.75056833",
"0.74898887",
"0.74727017",
"0.74454707",
"0.74454707",
"0.74454707",
"0.7436341",
"0.74020827",
"0.7392748",
"0.73777413",
"0.7370744",
"0.7369641",
"0.73585963",
"0.7323... | 0.7442475 | 13 |
a PUT requires /id | def taco_test_put_error_requires_id(self):
body = '{ "id": 400, "name": "item_new", "content": "after test update" }'
env = self.get_env('PUT', '/item', body=body)
webapi_start(env, lambda status, response_headers: self.assertEqual(status, '501')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(self,id):\r\n data = request.json\r\n return update(id=id,data=data)",
"def put(self, id):\n return None, 204",
"def put(self,request, pk =None):\n return Response({'method': 'PUT'})",
"def put(self, request, pk=None):\n\n return Response({'method': 'put'})",
"def put... | [
"0.80548733",
"0.77627206",
"0.7701576",
"0.76444036",
"0.76142126",
"0.76142126",
"0.76142126",
"0.75734186",
"0.7570122",
"0.7433508",
"0.7431656",
"0.7404354",
"0.7281861",
"0.7273932",
"0.72267747",
"0.71881646",
"0.71337616",
"0.7053422",
"0.703184",
"0.7013526",
"0.6992... | 0.7010135 | 20 |
Construct the instance of the image viewer | def __init__(self, parent, f_name, photo):
self._photo = photo
Dialog.__init__(self, parent, f_name, True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setup_new_image(self):\n\n if not self._viewer is None:\n if not self._input_image is None:\n self._viewer.SetInput(self._input_image)\n else:\n self._viewer.SetInput(self._dummy_image_source.GetOutput())\n\n ii = self._viewer.GetInput()\n ... | [
"0.70403004",
"0.69003624",
"0.6859897",
"0.6769518",
"0.67200553",
"0.6668673",
"0.6649628",
"0.65699136",
"0.65699136",
"0.65683323",
"0.65444237",
"0.65320826",
"0.6433436",
"0.64147496",
"0.63743156",
"0.630725",
"0.6302998",
"0.62894464",
"0.62827396",
"0.6276683",
"0.62... | 0.0 | -1 |
Starts the secondary thread, that handle computation loop, and the main Qt application. | def startMainLoop(self):
self.thread.start()
self.theMainLoop.emit(QtCore.SIGNAL("step()"))
self.app.exec_() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n self.thread = threading.Thread(target=self._main)\n self.thread.start()\n self.running = True",
"def startCalcThread(self):\n # 1 - create Worker and Thread inside the Form\n self.worker = calcRunner.CalculationRunner(self.params_dict)\n self.thread = QT... | [
"0.6832564",
"0.6815719",
"0.64975053",
"0.63709384",
"0.63709384",
"0.635549",
"0.63434714",
"0.6249844",
"0.6210289",
"0.6145674",
"0.61144584",
"0.61032456",
"0.610298",
"0.60843456",
"0.60604566",
"0.60121226",
"0.6004468",
"0.5997522",
"0.5988918",
"0.5967154",
"0.596267... | 0.75369143 | 0 |
Clone(itkReinitializeLevelSetImageFilterIF2 self) > itkReinitializeLevelSetImageFilterIF2_Pointer | def Clone(self) -> "itkReinitializeLevelSetImageFilterIF2_Pointer":
return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_Clone(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Clone(self) -> \"itkReinitializeLevelSetImageFilterIF3_Pointer\":\n return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_Clone(self)",
"def itkReinitializeLevelSetImageFilterIF2_cast(obj: 'itkLightObject') -> \"itkReinitializeLevelSetImageFilterIF2 *\":\n return _i... | [
"0.81310004",
"0.7620578",
"0.72376424",
"0.71736556",
"0.71703905",
"0.71452385",
"0.7109639",
"0.7104944",
"0.7101841",
"0.7068015",
"0.7049284",
"0.7027689",
"0.69853425",
"0.6971807",
"0.6945865",
"0.69312",
"0.6928766",
"0.69043064",
"0.6900146",
"0.68850875",
"0.6859674... | 0.9041241 | 0 |
SetInputNarrowBand(itkReinitializeLevelSetImageFilterIF2 self, itkVectorContainerUILSNF2 ptr) | def SetInputNarrowBand(self, ptr: 'itkVectorContainerUILSNF2') -> "void":
return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_SetInputNarrowBand(self, ptr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetInputNarrowBand(self, ptr: 'itkVectorContainerUILSNF3') -> \"void\":\n return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_SetInputNarrowBand(self, ptr)",
"def GetInputNarrowBand(self) -> \"itkVectorContainerUILSNF2_Pointer\":\n return _itkReinitializeLevel... | [
"0.8172381",
"0.810484",
"0.78519475",
"0.7597947",
"0.7532998",
"0.74397814",
"0.7280423",
"0.6992604",
"0.67985135",
"0.6665957",
"0.6468578",
"0.6441368",
"0.63854927",
"0.62770337",
"0.61883247",
"0.603406",
"0.5827909",
"0.58012456",
"0.5638025",
"0.54787445",
"0.5457276... | 0.8630356 | 0 |
GetInputNarrowBand(itkReinitializeLevelSetImageFilterIF2 self) > itkVectorContainerUILSNF2_Pointer | def GetInputNarrowBand(self) -> "itkVectorContainerUILSNF2_Pointer":
return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetInputNarrowBand(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetOutputNarrowBand(self) -> \"itkVectorContainerUILSNF2_Pointer\":\n return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetOutputNarrowBand(self)",
"def GetInputNarrowBand(self) -> \"itkVectorContainerUILSNF3_Pointer\":\n return _itkReinitializeLevelSetImage... | [
"0.85862976",
"0.84427804",
"0.8129653",
"0.7436144",
"0.7171351",
"0.69010496",
"0.68983585",
"0.68775016",
"0.66617805",
"0.65401244",
"0.63553315",
"0.6334567",
"0.6186372",
"0.61666286",
"0.6124641",
"0.6083727",
"0.6073575",
"0.60154986",
"0.5987644",
"0.5963946",
"0.588... | 0.89897615 | 0 |
GetOutputNarrowBand(itkReinitializeLevelSetImageFilterIF2 self) > itkVectorContainerUILSNF2_Pointer | def GetOutputNarrowBand(self) -> "itkVectorContainerUILSNF2_Pointer":
return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetOutputNarrowBand(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetInputNarrowBand(self) -> \"itkVectorContainerUILSNF2_Pointer\":\n return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetInputNarrowBand(self)",
"def GetOutputNarrowBand(self) -> \"itkVectorContainerUILSNF3_Pointer\":\n return _itkReinitializeLevelSetImageF... | [
"0.8336865",
"0.8227266",
"0.7664794",
"0.74500453",
"0.74274737",
"0.70477927",
"0.7042599",
"0.6907091",
"0.6771434",
"0.66338813",
"0.6609276",
"0.65812236",
"0.62964004",
"0.6248714",
"0.61686885",
"0.59798944",
"0.59084666",
"0.58854914",
"0.5812658",
"0.5785425",
"0.577... | 0.87876487 | 0 |
cast(itkLightObject obj) > itkReinitializeLevelSetImageFilterIF2 | def cast(obj: 'itkLightObject') -> "itkReinitializeLevelSetImageFilterIF2 *":
return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_cast(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itkReinitializeLevelSetImageFilterIF2_cast(obj: 'itkLightObject') -> \"itkReinitializeLevelSetImageFilterIF2 *\":\n return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_cast(obj)",
"def itkReinitializeLevelSetImageFilterIF3_cast(obj: 'itkLightObject') -> \"itkReinitialize... | [
"0.88683945",
"0.83325565",
"0.82109284",
"0.7359575",
"0.6702624",
"0.6699617",
"0.66807866",
"0.6646173",
"0.6645955",
"0.66010267",
"0.65182686",
"0.6517151",
"0.6501183",
"0.64915985",
"0.64889723",
"0.64868265",
"0.64853907",
"0.6484859",
"0.6477749",
"0.6473312",
"0.646... | 0.864554 | 1 |
New() > itkReinitializeLevelSetImageFilterIF2 Create a new object of the class itkReinitializeLevelSetImageFilterIF2 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named ... | def New(*args, **kargs):
obj = itkReinitializeLevelSetImageFilterIF2.__New_orig__()
import itkTemplate
itkTemplate.New(obj, *args, **kargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def New(*args, **kargs):\n obj = itkReinitializeLevelSetImageFilterIF3.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj",
"def New(*args, **kargs):\n obj = itkThresholdSegmentationLevelSetImageFilterIF2IF2F.__New_orig__()\n import i... | [
"0.75790936",
"0.73920316",
"0.7080354",
"0.7060129",
"0.691442",
"0.68383986",
"0.6817234",
"0.6810961",
"0.68058556",
"0.67777133",
"0.6776686",
"0.6723673",
"0.67225397",
"0.6715549",
"0.6715213",
"0.67096895",
"0.6690938",
"0.66578287",
"0.66541165",
"0.6645178",
"0.66202... | 0.8290131 | 0 |
itkReinitializeLevelSetImageFilterIF2_cast(itkLightObject obj) > itkReinitializeLevelSetImageFilterIF2 | def itkReinitializeLevelSetImageFilterIF2_cast(obj: 'itkLightObject') -> "itkReinitializeLevelSetImageFilterIF2 *":
return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_cast(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast(obj: 'itkLightObject') -> \"itkReinitializeLevelSetImageFilterIF2 *\":\n return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_cast(obj)",
"def itkReinitializeLevelSetImageFilterIF3_cast(obj: 'itkLightObject') -> \"itkReinitializeLevelSetImageFilterIF3 *\":\n r... | [
"0.8591876",
"0.8361778",
"0.79762316",
"0.76367205",
"0.66559196",
"0.6645274",
"0.6391496",
"0.63833135",
"0.6334912",
"0.6306206",
"0.63007915",
"0.62973344",
"0.62777907",
"0.6265508",
"0.62615156",
"0.62590843",
"0.62583506",
"0.6250271",
"0.61985767",
"0.6191709",
"0.61... | 0.9163907 | 0 |
Clone(itkReinitializeLevelSetImageFilterIF3 self) > itkReinitializeLevelSetImageFilterIF3_Pointer | def Clone(self) -> "itkReinitializeLevelSetImageFilterIF3_Pointer":
return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_Clone(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Clone(self) -> \"itkReinitializeLevelSetImageFilterIF2_Pointer\":\n return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_Clone(self)",
"def itkReinitializeLevelSetImageFilterIF3_cast(obj: 'itkLightObject') -> \"itkReinitializeLevelSetImageFilterIF3 *\":\n return _i... | [
"0.81057507",
"0.7605875",
"0.7320521",
"0.7295074",
"0.7271611",
"0.7251861",
"0.7184143",
"0.71639794",
"0.7142553",
"0.714041",
"0.7139541",
"0.71378195",
"0.71240383",
"0.7107056",
"0.7100625",
"0.7100489",
"0.7094122",
"0.7089931",
"0.70870805",
"0.7055594",
"0.6980442",... | 0.9018052 | 0 |
SetInputNarrowBand(itkReinitializeLevelSetImageFilterIF3 self, itkVectorContainerUILSNF3 ptr) | def SetInputNarrowBand(self, ptr: 'itkVectorContainerUILSNF3') -> "void":
return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_SetInputNarrowBand(self, ptr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetInputNarrowBand(self, ptr: 'itkVectorContainerUILSNF2') -> \"void\":\n return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_SetInputNarrowBand(self, ptr)",
"def GetInputNarrowBand(self) -> \"itkVectorContainerUILSNF3_Pointer\":\n return _itkReinitializeLevel... | [
"0.8157996",
"0.8040278",
"0.7829262",
"0.77318454",
"0.7562225",
"0.7431842",
"0.7117852",
"0.7008333",
"0.67354673",
"0.65398425",
"0.6421841",
"0.6375222",
"0.63027555",
"0.5955441",
"0.5954117",
"0.5928524",
"0.5767065",
"0.56523246",
"0.553945",
"0.5445778",
"0.5388296",... | 0.8520884 | 0 |
GetInputNarrowBand(itkReinitializeLevelSetImageFilterIF3 self) > itkVectorContainerUILSNF3_Pointer | def GetInputNarrowBand(self) -> "itkVectorContainerUILSNF3_Pointer":
return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetInputNarrowBand(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetOutputNarrowBand(self) -> \"itkVectorContainerUILSNF3_Pointer\":\n return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetOutputNarrowBand(self)",
"def GetInputNarrowBand(self) -> \"itkVectorContainerUILSNF2_Pointer\":\n return _itkReinitializeLevelSetImage... | [
"0.8573996",
"0.85304207",
"0.8047498",
"0.7382054",
"0.71949154",
"0.69587076",
"0.68173194",
"0.66712743",
"0.6442476",
"0.6409474",
"0.6316833",
"0.61697733",
"0.60869575",
"0.6070615",
"0.603338",
"0.60281515",
"0.5991409",
"0.59263265",
"0.59079105",
"0.5903094",
"0.5836... | 0.89770633 | 0 |
GetOutputNarrowBand(itkReinitializeLevelSetImageFilterIF3 self) > itkVectorContainerUILSNF3_Pointer | def GetOutputNarrowBand(self) -> "itkVectorContainerUILSNF3_Pointer":
return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetOutputNarrowBand(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetOutputNarrowBand(self) -> \"itkVectorContainerUILSNF2_Pointer\":\n return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetOutputNarrowBand(self)",
"def GetInputNarrowBand(self) -> \"itkVectorContainerUILSNF3_Pointer\":\n return _itkReinitializeLevelSetImage... | [
"0.8297296",
"0.82392144",
"0.7911563",
"0.73784393",
"0.7352486",
"0.7036863",
"0.6982081",
"0.6953438",
"0.67838436",
"0.65791035",
"0.6432079",
"0.6430458",
"0.62393945",
"0.61106807",
"0.6078845",
"0.58068776",
"0.5782435",
"0.5728526",
"0.56667805",
"0.565929",
"0.565734... | 0.87311405 | 0 |
cast(itkLightObject obj) > itkReinitializeLevelSetImageFilterIF3 | def cast(obj: 'itkLightObject') -> "itkReinitializeLevelSetImageFilterIF3 *":
return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_cast(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itkReinitializeLevelSetImageFilterIF3_cast(obj: 'itkLightObject') -> \"itkReinitializeLevelSetImageFilterIF3 *\":\n return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_cast(obj)",
"def itkReinitializeLevelSetImageFilterIF2_cast(obj: 'itkLightObject') -> \"itkReinitialize... | [
"0.8745353",
"0.8514437",
"0.8390394",
"0.72464603",
"0.6802846",
"0.67776483",
"0.67627",
"0.67442054",
"0.6735106",
"0.6709572",
"0.6671138",
"0.6645334",
"0.6644711",
"0.6641805",
"0.66363347",
"0.66353405",
"0.66305983",
"0.6619549",
"0.6568702",
"0.65583783",
"0.6550898"... | 0.85283536 | 1 |
New() > itkReinitializeLevelSetImageFilterIF3 Create a new object of the class itkReinitializeLevelSetImageFilterIF3 and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects the first non named ... | def New(*args, **kargs):
obj = itkReinitializeLevelSetImageFilterIF3.__New_orig__()
import itkTemplate
itkTemplate.New(obj, *args, **kargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def New(*args, **kargs):\n obj = itkReinitializeLevelSetImageFilterIF2.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj",
"def New(*args, **kargs):\n obj = itkThresholdSegmentationLevelSetImageFilterIF3IF3F.__New_orig__()\n import i... | [
"0.75729614",
"0.7507613",
"0.7226922",
"0.7035201",
"0.6944786",
"0.694253",
"0.6932411",
"0.6914296",
"0.69128275",
"0.6905332",
"0.68879944",
"0.68714076",
"0.6856535",
"0.68443274",
"0.6840504",
"0.681927",
"0.6817391",
"0.68036586",
"0.67989045",
"0.6797171",
"0.6791684"... | 0.8327367 | 0 |
itkReinitializeLevelSetImageFilterIF3_cast(itkLightObject obj) > itkReinitializeLevelSetImageFilterIF3 | def itkReinitializeLevelSetImageFilterIF3_cast(obj: 'itkLightObject') -> "itkReinitializeLevelSetImageFilterIF3 *":
return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_cast(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast(obj: 'itkLightObject') -> \"itkReinitializeLevelSetImageFilterIF3 *\":\n return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_cast(obj)",
"def itkReinitializeLevelSetImageFilterIF2_cast(obj: 'itkLightObject') -> \"itkReinitializeLevelSetImageFilterIF2 *\":\n r... | [
"0.85434616",
"0.8289704",
"0.78988945",
"0.7369019",
"0.66965896",
"0.66448367",
"0.6585392",
"0.656342",
"0.6551144",
"0.6550462",
"0.6547172",
"0.65390426",
"0.6537412",
"0.65050596",
"0.6498455",
"0.64956546",
"0.64773506",
"0.64720845",
"0.6471433",
"0.6468564",
"0.64596... | 0.9179431 | 0 |
Generate a string of random lower ascii characters. | def gen_random_chars(n: int = 10) -> Text:
if n < 1:
raise Exception('Number of random chars to generate has to be > 0')
return ''.join(choice(ascii_lowercase + '-_')
for i in range(n)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand_string():\n out = ''\n for _ in range(24):\n out += choice(ascii_letters)\n return out",
"def get_random_alphabetic_string():\n return get_random_string(char_choice=string.ascii_letters)",
"def generate_rnd_msg() -> str:\n\n char_num = random.randint(8,20)\n i = 0\n s = \"\... | [
"0.7819435",
"0.7741339",
"0.77341014",
"0.773297",
"0.7717065",
"0.7610039",
"0.75496924",
"0.74644053",
"0.74217993",
"0.73744494",
"0.7338954",
"0.73345727",
"0.73005676",
"0.7292493",
"0.7282727",
"0.72644925",
"0.7249076",
"0.72439766",
"0.72437125",
"0.7213209",
"0.7181... | 0.0 | -1 |
Get outer Message definition that contains this definition. | def message_definition(cls):
try:
return cls._message_definition()
except AttributeError:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outer_definition_name(cls):\n outer_definition = cls.message_definition()\n if not outer_definition:\n return util.get_package_for_module(cls.__module__)\n return outer_definition.definition_name()",
"def message_definition(self):\n try:\n return self._messag... | [
"0.7393247",
"0.7251471",
"0.7142186",
"0.7092184",
"0.67437494",
"0.6631199",
"0.6223269",
"0.60765886",
"0.59931433",
"0.59931433",
"0.5989876",
"0.59590805",
"0.5945171",
"0.5915424",
"0.5869435",
"0.5868394",
"0.5868394",
"0.5868394",
"0.5867523",
"0.586039",
"0.586039",
... | 0.7007202 | 4 |
Get the names of all unrecognized fields in this message. | def all_unrecognized_fields(self):
return list(self.__unrecognized_fields.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _field_names(self):\n return [self._sanitize_field_name(field_name)\n for field_name in self._all_fields]",
"def get_fieldnames(self):\n fieldnames = self._fields.keys()\n fieldnames.remove('time')\n fieldnames.remove('lon')\n fieldnames.remove('lat')\n ... | [
"0.6795038",
"0.6793042",
"0.66152936",
"0.6602575",
"0.65783834",
"0.65368545",
"0.65317863",
"0.650827",
"0.64828384",
"0.63843095",
"0.62309283",
"0.6070114",
"0.6069957",
"0.6059616",
"0.6026148",
"0.5999183",
"0.59974265",
"0.5997008",
"0.595233",
"0.5948969",
"0.5946761... | 0.840563 | 0 |
Equality operator. Does field by field comparison with other message. For equality, must be same type and values of all fields must be equal. Messages not required to be initialized for comparison. Does not attempt to determine equality for values that have | def __eq__(self, other):
# TODO(rafek): Implement "equivalent" which does comparisons
# taking default values in to consideration.
if self is other:
return True
if type(self) is not type(other):
return False
return self.__tags == other.__tags | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testEquality(self):\n # Comparison against enums must work.\n class MyEnum(messages.Enum):\n val1 = 1\n val2 = 2\n\n # Comparisons against nested messages must work.\n class AnotherMessage(messages.Message):\n string = messages.StringField(1)\n\n ... | [
"0.7528329",
"0.68549",
"0.6750522",
"0.6670198",
"0.66071177",
"0.64520633",
"0.642799",
"0.6425967",
"0.6374244",
"0.63637054",
"0.6341785",
"0.6339357",
"0.6334515",
"0.6309764",
"0.6281028",
"0.6265713",
"0.61949754",
"0.6194041",
"0.61587906",
"0.6155244",
"0.6137482",
... | 0.0 | -1 |
Not equals operator. Does field by field comparison with other message. For nonequality, must be different type or any value of a field must be nonequal to the same field in the other instance. Messages not required to be initialized for comparison. | def __ne__(self, other):
return not self.__eq__(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\n return not self._field1 == other._field1",
"def __ne__(self, other):\n return not_equal(self, other)",
"def __ne__(self, other):\r\n\t\treturn (self.type != other.type or self.value != other.value)",
"def ne (self, other):\n return not (self == other) ... | [
"0.73920363",
"0.6953331",
"0.6952419",
"0.688471",
"0.6874409",
"0.68594265",
"0.68367547",
"0.681067",
"0.67902994",
"0.6788979",
"0.67884564",
"0.6788185",
"0.6788185",
"0.6788185",
"0.6788185",
"0.6785564",
"0.67821234",
"0.6779233",
"0.6778848",
"0.67762107",
"0.6775098"... | 0.67792714 | 31 |
Set value on message. | def __set__(self, message_instance, value):
# Reaches in to message instance directly to assign to private tags.
if value is None:
if self.repeated:
raise ValidationError(
'May not assign None to repeated field %s' % self.name)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_message(self, value):\n self.__message = value",
"def value(self, value):\n self.set_data(value)",
"def set_value(self, value):\n self.value = str(value)",
"def set_value(self, value):\n self.value = value",
"def set_value(self, value):\n self.value = value",
"... | [
"0.7928963",
"0.734428",
"0.7116324",
"0.7107831",
"0.7107831",
"0.7107831",
"0.71054506",
"0.7034611",
"0.70327044",
"0.6990884",
"0.6974681",
"0.6974681",
"0.6974681",
"0.6974681",
"0.6974681",
"0.6974681",
"0.6969228",
"0.6961439",
"0.6943658",
"0.6897801",
"0.6848779",
... | 0.6578218 | 56 |
Validate value as assigned to field default field. Some fields may allow for delayed resolution of default types necessary in the case of circular definition references. In this case, the default value might be a place holder that is resolved when needed after all the message classes are defined. | def validate_default_element(self, value):
return self.validate_element(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_default_value(self):\n if self.has_default_value:\n if not self.is_valid_value(self.default):\n raise AttributeSchemaError(\n \"Default value '%s' is not compliant with the schema\"\n )",
"def validate_default(self, value):\n retu... | [
"0.69995",
"0.6989705",
"0.6926852",
"0.689136",
"0.6633943",
"0.6613437",
"0.6553126",
"0.6496466",
"0.648919",
"0.6488628",
"0.64637613",
"0.644795",
"0.6436274",
"0.63763326",
"0.62815917",
"0.6260841",
"0.6260841",
"0.6222233",
"0.6216768",
"0.620341",
"0.6200761",
"0.6... | 0.60134435 | 31 |
Validate default value assigned to field. | def validate_default(self, value):
return self.__validate(value, self.validate_default_element) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_default_value(self):\n if self.has_default_value:\n if not self.is_valid_value(self.default):\n raise AttributeSchemaError(\n \"Default value '%s' is not compliant with the schema\"\n )",
"def validate_default(self, value):\n retu... | [
"0.81868947",
"0.79932135",
"0.7230786",
"0.7230786",
"0.7109969",
"0.69292593",
"0.69249916",
"0.68446213",
"0.67579883",
"0.6724588",
"0.6722898",
"0.672073",
"0.6611115",
"0.6544696",
"0.6541936",
"0.65011966",
"0.6474088",
"0.6422759",
"0.6381658",
"0.63445455",
"0.631911... | 0.78467256 | 2 |
Get Message definition that contains this Field definition. | def message_definition(self):
try:
return self._message_definition()
except AttributeError:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_definition(cls):\n try:\n return cls._message_definition()\n except AttributeError:\n return None",
"def message_definition(self):\n try:\n return self._message_definition()\n except AttributeError:\n return None",
"def custom_fields_definition(se... | [
"0.80506986",
"0.7940214",
"0.66261214",
"0.644501",
"0.64029247",
"0.633313",
"0.6328373",
"0.6266494",
"0.62495345",
"0.6234803",
"0.6221234",
"0.621367",
"0.621367",
"0.6174645",
"0.61230236",
"0.61172944",
"0.61172944",
"0.6086213",
"0.6049226",
"0.60257727",
"0.593182",
... | 0.81259733 | 0 |
Set value on message. | def __set__(self, message_instance, value):
t = self.type
if isinstance(t, type) and issubclass(t, Message):
if self.repeated:
if value and isinstance(value, (list, tuple)):
value = [(t(**v) if isinstance(v, dict) else v)
for v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_message(self, value):\n self.__message = value",
"def value(self, value):\n self.set_data(value)",
"def set_value(self, value):\n self.value = str(value)",
"def set_value(self, value):\n self.value = value",
"def set_value(self, value):\n self.value = value",
"... | [
"0.7928963",
"0.734428",
"0.7116324",
"0.7107831",
"0.7107831",
"0.7107831",
"0.71054506",
"0.7034611",
"0.70327044",
"0.6990884",
"0.6974681",
"0.6974681",
"0.6974681",
"0.6974681",
"0.6974681",
"0.6974681",
"0.6969228",
"0.6961439",
"0.6943658",
"0.6897801",
"0.68432355",
... | 0.6848779 | 20 |
Underlying message type used for serialization. Will always be a subclass of Message. This is different from type which represents the python value that message_type is mapped to for use by the user. | def message_type(self):
return self.type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_type(self):\n return self._message_type",
"def message_type(self):\n return self._message_type",
"def type(self):\n if self.__type is None:\n message_type = find_definition(\n self.__type_name, self.message_definition())\n if not (message_ty... | [
"0.8226121",
"0.8226121",
"0.8218005",
"0.80171233",
"0.8002418",
"0.7743481",
"0.76956356",
"0.7551482",
"0.7444048",
"0.74251866",
"0.7390952",
"0.7390952",
"0.732974",
"0.73008704",
"0.7287583",
"0.72594357",
"0.7248621",
"0.71580803",
"0.6983605",
"0.679467",
"0.64528465"... | 0.831504 | 0 |
Validate default element of Enum field. Enum fields allow for delayed resolution of default values when the type of the field has not been resolved. The default value of a field may be a string or an integer. If the Enum type of the field has been resolved, the default value is validated against that type. | def validate_default_element(self, value):
if isinstance(value, (six.string_types, six.integer_types)):
# Validation of the value does not happen for delayed resolution
# enumerated types. Ignore if type is not yet resolved.
if self.__type:
self.__type(value)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testDefaultFields_EnumIntDelayedResolution(self):\n field = messages.EnumField(\n 'apitools.base.protorpclite.descriptor.FieldDescriptor.Label',\n 1,\n default=2)\n\n self.assertEquals(\n descriptor.FieldDescriptor.Label.REQUIRED, field.default)",
"de... | [
"0.77653104",
"0.7725556",
"0.75786275",
"0.7506559",
"0.7169045",
"0.71323603",
"0.7012498",
"0.7012498",
"0.6973622",
"0.69089925",
"0.6461298",
"0.6391953",
"0.6351793",
"0.63068247",
"0.6283055",
"0.62232494",
"0.61506903",
"0.6019939",
"0.5874156",
"0.580933",
"0.5715174... | 0.77598834 | 1 |
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant. | def precision(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1)))
precision = true_positives / (predicted_positives + K.epsilon())
return precision | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)",
"def comp... | [
"0.7490801",
"0.7288073",
"0.71588075",
"0.7153132",
"0.7066247",
"0.6985392",
"0.6966561",
"0.6955553",
"0.69132614",
"0.6832886",
"0.6818762",
"0.68100244",
"0.680567",
"0.680567",
"0.680567",
"0.680567",
"0.680567",
"0.680567",
"0.6786287",
"0.67557174",
"0.67557174",
"0... | 0.67582464 | 22 |
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected. | def recall(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
possible_positives = K.sum(K.round(K.clip(y_true, 0, 1)))
recall = true_positives / (possible_positives + K.epsilon())
return recall | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t... | [
"0.7605249",
"0.74491084",
"0.7405392",
"0.7281231",
"0.72096574",
"0.716614",
"0.71576375",
"0.7145557",
"0.7145557",
"0.7145557",
"0.7145557",
"0.7145557",
"0.7145557",
"0.71319014",
"0.7101232",
"0.70974207",
"0.70974207",
"0.70974207",
"0.70974207",
"0.70974207",
"0.70974... | 0.70628613 | 40 |
Create queryset to model objects, can be used for filtering. | def get_queryset(self):
return self.model.objects.all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n return self._queryset_class(\n model=self.model,\n using=self._db,\n hints=self._hints,\n query=CustomQuery(self.model)\n )",
"def queryset(self, request):\n qs = self.model.all_objects.get_query_set()\n ordering = ... | [
"0.6766984",
"0.66717756",
"0.6502685",
"0.65009546",
"0.6391257",
"0.62863934",
"0.6218703",
"0.6194865",
"0.61748636",
"0.6168507",
"0.6156925",
"0.6152832",
"0.61375487",
"0.6103472",
"0.60991985",
"0.60978",
"0.6089032",
"0.6083095",
"0.60637826",
"0.60590583",
"0.6056135... | 0.6205981 | 7 |
Filter out passing rows if `failing_tests` is `True`. | def should_display(self, source: TestGroupReport) -> bool:
style = self.get_style(source)
if source.category == ReportCategories.TESTSUITE:
return style.display_testsuite
elif source.category == ReportCategories.PARAMETRIZATION:
return style.display_testcase
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_totally_failed_tests(df):\n all_runs = df.group_uuid.unique()\n removed_guuids = []\n for test_run in all_runs:\n overall_status = df[(df.group_uuid == test_run) & ~get_failed_mask(df)]\n if not len(overall_status):\n df = df[df.group_uuid != test_run]\n remo... | [
"0.67074096",
"0.60216844",
"0.59125733",
"0.5762062",
"0.575366",
"0.5750559",
"0.57048166",
"0.5681357",
"0.5672835",
"0.5654499",
"0.5652389",
"0.5587599",
"0.55673957",
"0.55050063",
"0.5494197",
"0.5487263",
"0.54712754",
"0.54211193",
"0.540032",
"0.53880554",
"0.538411... | 0.0 | -1 |
i, j = random.randint(0,2), random.randint(0, 2) | def computerTurn(board):
i, j = bestMove(board)
board[i][j] = computer
pygame.time.delay(500)
updateWindow(i, j, computer) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shotgenerator():\n return random.randint(0, 9), random.randint(0, 9)",
"def randj():#could be combined with randik\n return(int(round(random.random()*1)))",
"def random_color() -> Tuple[int, int, int]:\n return randrange(0, 255), randrange(0, 255), randrange(0, 255)",
"def rand_coord(n):\n\n ... | [
"0.66288686",
"0.66178435",
"0.6505425",
"0.6408735",
"0.6402151",
"0.6313235",
"0.62942284",
"0.62725234",
"0.6269347",
"0.6257592",
"0.624643",
"0.6211064",
"0.6082181",
"0.6059201",
"0.60437405",
"0.6038521",
"0.59937686",
"0.59854525",
"0.59845704",
"0.59568757",
"0.59380... | 0.0 | -1 |
Add a fragment and/or query paramaters to a URL. New query params will be appended to exising parameters, except duplicate names, which will be replaced. | def urlparams(url_, hash=None, **query):
url = urlparse.urlparse(url_)
fragment = hash if hash is not None else url.fragment
# Use dict(parse_qsl) so we don't get lists of values.
q = url.query
query_dict = dict(urlparse.parse_qsl(smart_str(q))) if q else {}
query_dict.update((k, v) for k, v in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_query_params(original_url, **kwargs):\n scheme, netloc, path, query_string, fragment = urlsplit(original_url)\n query_params = parse_qs(query_string)\n if kwargs is not None:\n for key, value in kwargs.items():\n query_params[key] = [value]\n\n new_query_string = urlencode(... | [
"0.75657976",
"0.75657976",
"0.75255597",
"0.7269544",
"0.7214137",
"0.7206239",
"0.70351887",
"0.698488",
"0.6747803",
"0.671993",
"0.6712001",
"0.66434073",
"0.66264796",
"0.6577256",
"0.65166324",
"0.6464911",
"0.6422556",
"0.6412772",
"0.6399129",
"0.63230646",
"0.6307314... | 0.60963017 | 25 |
Url encode a path. | def urlencode(txt):
return urllib.quote_plus(txt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def urlencode(path):\n return urllib.quote_plus(path)",
"def _encode_url(full_url):\n return urllib.parse.quote(full_url, safe=\"%/:=&?~#+!$,;'@()*[]|\")",
"def encode_url(url):\n\treturn url.replace(' ', '_')",
"def _encode_url(data: str) -> str:\n return urllib.parse.quote(data, safe=\"\")",
... | [
"0.80897945",
"0.69705486",
"0.6837121",
"0.6761978",
"0.6461472",
"0.64534646",
"0.6436285",
"0.63333744",
"0.62817276",
"0.6266158",
"0.6237047",
"0.6217817",
"0.6209671",
"0.6200537",
"0.6195326",
"0.6180972",
"0.61767447",
"0.61711365",
"0.6168379",
"0.61392534",
"0.61382... | 0.602089 | 30 |
Convert a month's numeric value into its Estonian name as a string. | def get_month_name(month_no):
locale.setlocale(locale.LC_TIME, "et-EE")
return calendar.month_name[month_no] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toisomonth(month):\n mes = {'JAN': '01', 'FEV': '02', 'FEB': '02', 'MAR': '03',\n 'ABR': '04', 'APR': '04', 'MAI': '05', 'MAY': '05',\n 'JUN': '06', 'JUL': '07', 'AGO': '08', 'AUG': '08',\n 'SET': '09', 'SEP': '09', 'OUT': '10', 'OCT': '10',\n 'NOV... | [
"0.594064",
"0.58418053",
"0.5767026",
"0.5691344",
"0.5678527",
"0.56366116",
"0.56232446",
"0.5621094",
"0.5600749",
"0.5537039",
"0.5522226",
"0.5492537",
"0.5469423",
"0.5446329",
"0.5414069",
"0.5366334",
"0.52934396",
"0.5266259",
"0.51585954",
"0.51318014",
"0.5126667"... | 0.61782634 | 0 |
Drops fields from a dictionary where value is None. | def _drop_none_values(dictionary: Dict) -> Dict:
return {key: value for key, value in dictionary.items() if value is not None} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _remove_none_fields(klass, d):\n\n return dict((k, v) for k, v in d.iteritems() if v is not None)",
"def _remove_none(self, data):\r\n for key, value in data.items():\r\n if value is None or isinstance(value, forms.Field):\r\n del data[key]\r\n if isinstance... | [
"0.82623404",
"0.8083525",
"0.78917056",
"0.78674465",
"0.77446145",
"0.7578105",
"0.74640435",
"0.7463003",
"0.7361065",
"0.7318768",
"0.7155536",
"0.7145769",
"0.70666915",
"0.70599705",
"0.7056038",
"0.7021383",
"0.7008916",
"0.69078904",
"0.6845735",
"0.6836179",
"0.68120... | 0.7642924 | 5 |
Returns the Selenium Remote webdriver instance | def get_driver(self):
return self.driver | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_webdriver_instance():\n return selenium._current_browser()\n # return PageBase.get_selenium2library_instance()._current_browser()",
"def driver(self):\n from dallinger.config import get_config\n\n config = get_config()\n if not config.ready:\n config.load()\n... | [
"0.7904503",
"0.7510589",
"0.7471657",
"0.7294036",
"0.7196879",
"0.71936786",
"0.71020335",
"0.70239586",
"0.69415206",
"0.6870139",
"0.68574595",
"0.6839029",
"0.6636327",
"0.66309476",
"0.6587739",
"0.6566226",
"0.65473604",
"0.65168244",
"0.6482482",
"0.6470723",
"0.64423... | 0.67346615 | 12 |
Instantiate a falcon.API instance. | def create_api(self):
return DJinnAPI(djenkins=self.dj, pipeline_results=self.db) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, api_use=False):\n self.api_use = api_use",
"def __init__(self):\n self.config = get_config()\n self.log = get_logger(self)\n\n self.factory = SugarServerFactory(\"wss://*:5505\")\n self.factory.protocol = SugarServerProtocol\n\n self.console_factory = ... | [
"0.6643709",
"0.6594889",
"0.65727437",
"0.6571483",
"0.65524846",
"0.64856195",
"0.64292306",
"0.64088535",
"0.63738346",
"0.6365373",
"0.6350153",
"0.6307253",
"0.62830144",
"0.62576264",
"0.62507015",
"0.624698",
"0.624698",
"0.6240552",
"0.6223257",
"0.6218115",
"0.620379... | 0.6158116 | 23 |
return True if any InstanceStates present have been marked as 'modified'. | def check_modified(self) -> bool:
return bool(self._modified) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_been_modified(self):\n return self._has_been_modified",
"def is_modified(\n self, instance: object, include_collections: bool = True\n ) -> bool:\n state = object_state(instance)\n\n if not state.modified:\n return False\n\n dict_ = state.dict\n\n f... | [
"0.74784887",
"0.735443",
"0.7348484",
"0.7015803",
"0.69632894",
"0.6953965",
"0.6924642",
"0.68859047",
"0.68464684",
"0.6842415",
"0.6832818",
"0.6745052",
"0.67189074",
"0.6706047",
"0.66794306",
"0.66794306",
"0.6657477",
"0.6639282",
"0.66309035",
"0.66132003",
"0.66059... | 0.72242 | 3 |
Return a color palette with hex codes instead of RGB values. | def as_hex(self):
hex = [mpl.colors.rgb2hex(rgb) for rgb in self]
return _ColorPalette(hex) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_palette(self, as_float=True):\n if as_float:\n return self._colors\n return (self._colors * 255).round().clip(0, 255).astype(np.uint8)",
"def hex_colors(cls):\n return ['#{:02x}{:02x}{:02x}'.format(*cls._COLORS[s])\n for s in cls._STATES]",
"def get_palett... | [
"0.741834",
"0.71717864",
"0.7051476",
"0.70132935",
"0.69927025",
"0.6905208",
"0.6840367",
"0.67468154",
"0.6738194",
"0.6695964",
"0.6641201",
"0.6631731",
"0.66242725",
"0.661875",
"0.6594972",
"0.6556972",
"0.6502868",
"0.6488086",
"0.64795166",
"0.6437992",
"0.64379734"... | 0.7870899 | 0 |
Return a list of colors defining a color palette. | def color_palette(palette=None, n_colors=None, desat=None):
if palette is None:
palette = utils.get_color_cycle()
if n_colors is None:
n_colors = len(palette)
elif isinstance(palette, colors.ColorGroup):
palette = palette.colors
if n_colors is None:
n_colo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getColors():\n return ['#8c99fc', '#cacefd', '#fff1d7', '#feda98', '#fda85a', '#fc6647']",
"def extract_colors(self, palette, colors):\n return [palette[i:i + 3] for i in range(0, colors * 3, 3)]",
"def getColors():\n colors = ['#d53e4f',\n '#fc8d59',\n '#fee08b',\n ... | [
"0.81427073",
"0.8061346",
"0.793248",
"0.7537337",
"0.7430485",
"0.7430485",
"0.7409167",
"0.73690796",
"0.7365027",
"0.7271981",
"0.72279984",
"0.7191525",
"0.7191485",
"0.70682174",
"0.7057603",
"0.7051628",
"0.7048697",
"0.70431286",
"0.7040537",
"0.70391357",
"0.6935029"... | 0.6295705 | 64 |
Return discrete colors from a matplotlib palette. Note that this handles the qualitative colorbrewer palettes properly, although if you ask for more colors than a particular qualitative palette can provide you will get fewer than you are expecting. In contrast, asking for qualitative color brewer palettes | def mpl_palette(name, n_colors=6):
brewer_qual_pals = {"Accent": 8, "Dark2": 8, "Paired": 12,
"Pastel1": 9, "Pastel2": 8,
"Set1": 9, "Set2": 8, "Set3": 12}
if name.endswith("_d"):
pal = ["#333333"]
pal.extend(color_palette(name.replace("_d", "_r")... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _color_palette(n_colors=4, cmap='viridis', extrema=False):\n if extrema:\n bins = np.linspace(0, 1, n_colors)\n else:\n bins = np.linspace(0, 1, n_colors * 2 - 1 + 2)[1:-1:2]\n\n cmap = plt.get_cmap(cmap)\n palette = list(map(tuple, cmap(bins)[:, :3]))\n return palette",
"def col... | [
"0.7125829",
"0.70830077",
"0.69214034",
"0.6870049",
"0.66827005",
"0.66825163",
"0.667896",
"0.6649318",
"0.6523774",
"0.6494016",
"0.6461066",
"0.64523244",
"0.6435633",
"0.6433696",
"0.6406274",
"0.6402879",
"0.6402879",
"0.6402879",
"0.6368967",
"0.63515294",
"0.63469756... | 0.6913835 | 3 |
Make a diverging palette between two HUSL colors. If you are using the IPython notebook, you can also choose this palette | def diverging_palette(h_neg, h_pos, s=75, l=50, sep=10, n=6, center="light",
as_cmap=False):
palfunc = dark_palette if center == "dark" else light_palette
neg = palfunc((h_neg, s, l), 128 - (sep / 2), reverse=True, input="husl")
pos = palfunc((h_pos, s, l), 128 - (sep / 2), input="husl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diverging_palette_from_hex(h1, h2, as_cmap=True):\n act_h, act_s, act_l = zip(*[husl.hex_to_husl(i) for i in [h1, h2]])\n palette = diverging_palette(*act_h, s=np.mean(act_s),\n l=np.mean(act_l), as_cmap=as_cmap)\n return palette",
"def hue_palette(hues, low=32, high=2... | [
"0.70272684",
"0.66463876",
"0.6643286",
"0.6452525",
"0.6345009",
"0.62776756",
"0.62233025",
"0.614152",
"0.60752875",
"0.6068269",
"0.60671175",
"0.6037921",
"0.5989304",
"0.59642303",
"0.59634507",
"0.59556246",
"0.59531504",
"0.5947089",
"0.5939619",
"0.59345263",
"0.591... | 0.7072908 | 0 |
Make a palette that blends between a list of colors. | def blend_palette(colors, n_colors=6, as_cmap=False, input="rgb"):
colors = [_color_to_rgb(color, input) for color in colors]
name = "blend"
pal = mpl.colors.LinearSegmentedColormap.from_list(name, colors)
if not as_cmap:
pal = _ColorPalette(pal(np.linspace(0, 1, n_colors)))
return pal | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monochrome_palette(basecolor, nstops, s_range=(1, 0.3), v_range=(1, 1.3), absolute=False):\n def clip(val, varname):\n if val < 0:\n val = 0\n logger.warning(\"[monochrome_palette]: \" + varname +\n \" was smaller than 0 and was clipped.\")\n eli... | [
"0.6519797",
"0.6426455",
"0.62618047",
"0.6237339",
"0.613288",
"0.60629743",
"0.6031891",
"0.59472585",
"0.58904153",
"0.5873573",
"0.5859708",
"0.5857991",
"0.58430666",
"0.5840298",
"0.58237314",
"0.58064586",
"0.58032566",
"0.5771572",
"0.5762511",
"0.57531166",
"0.57261... | 0.76429754 | 0 |
Separate multiple consecutive emojis with spaces. In mobile chat applications, emojis are often typed consecutively without spaces inbetween. | def separate_emojis(text):
# this matches emojis which are directly preceded by non-whitespace chars
emoji_pattern = re.compile(r"(\S*?)" u"([\U00010000-\U0010ffff(\u2764\uFE0F)])")
# insert blank in front of emoji
text = re.sub(emoji_pattern, r"\1 \2", text)
# this matches emoji... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def emoji(self, ctx, *, text):\n await ctx.message.delete()\n new_msg = \"\"\n for char in text:\n if char.isalpha():\n new_msg += char_to_emoji(char) + ' '\n elif char == ' ':\n new_msg += ' '\n elif char.isspace():\n ... | [
"0.66259325",
"0.6233596",
"0.6142513",
"0.6027643",
"0.59887516",
"0.5935049",
"0.58666897",
"0.5702979",
"0.5676926",
"0.55605567",
"0.55302507",
"0.55270886",
"0.5518663",
"0.55167365",
"0.5491154",
"0.5453783",
"0.5433883",
"0.53785026",
"0.53666294",
"0.535553",
"0.53381... | 0.76290476 | 0 |
Check if this board is existing and valid. | async def check_board(self):
request = await self.api.request(STATUS_XML_PATH)
if request is False:
return False
root = etree.XML(bytes(request, encoding='utf-8'))
relay_tags = root.xpath("//*[starts-with(local-name(), 'led')]")
input_tags = root.xpath("//*[starts-w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_board(self):\n for (row, col), value in np.ndenumerate(self.final_values): # Iterate through each position\n if not self.__is_valid_value(row, col, value): # Check that the value is valid\n return False # An invalid (duplicate) value was found\n return True",... | [
"0.7520778",
"0.74383986",
"0.74174076",
"0.73917204",
"0.7312137",
"0.7196038",
"0.7191761",
"0.70423937",
"0.7028523",
"0.698455",
"0.6977753",
"0.6910683",
"0.6908011",
"0.68641967",
"0.6811573",
"0.68098134",
"0.68013924",
"0.6775926",
"0.6764357",
"0.6717336",
"0.6715197... | 0.0 | -1 |
Return all temperature states. | async def get_temps(self):
return await self.get_states_by_tag_prefix("temp", True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_states(self):\n return self._states",
"def all_states(self):\n return self._states",
"def get_all_thermals(self):\n return self._thermal_list",
"def getAllStates(self):\n return list(itertools.product(self.getAllWorldStates(), self.getAllTheta()))",
"def temperatures... | [
"0.7140723",
"0.69381505",
"0.6918242",
"0.67882574",
"0.673616",
"0.66808236",
"0.6652125",
"0.64504987",
"0.6414524",
"0.63867664",
"0.6315103",
"0.6293342",
"0.6254123",
"0.62420917",
"0.6234737",
"0.62326705",
"0.62257135",
"0.619305",
"0.6153609",
"0.6151319",
"0.6136814... | 0.7892062 | 0 |
Initializing the model parameters including weights and bias | def _init_parameter(self):
abs_val = np.sqrt(2.0 / (self.num_h + self.num_v))
W = tf.get_variable('weights', shape=(self.num_v, self.num_h),
initializer=tf.random_uniform_initializer(minval=-abs_val, maxval=abs_val))
a = tf.get_variable('visible_bias', shape=(self.num... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_parameters(self):\n stdv = 1. / math.sqrt(self.weight.data.size(1))\n self.weight.data.uniform_(-stdv, stdv)\n if self.bias is not None:\n self.bias.data.uniform_(-stdv, stdv)",
"def initialise_parameters(self):\n # Weights\n init = select_w_init(self.w_init... | [
"0.82835186",
"0.8104326",
"0.8008608",
"0.7850191",
"0.7832912",
"0.7787066",
"0.7745763",
"0.76261204",
"0.7584754",
"0.7540992",
"0.74680245",
"0.74427086",
"0.7430089",
"0.7428573",
"0.738817",
"0.738817",
"0.7380688",
"0.73416543",
"0.73391044",
"0.73323846",
"0.7321426"... | 0.7255839 | 24 |
Computing conditional probability P(v|h) | def _prob_v_given_h(self, h):
return tf.sigmoid(tf.add(self.a, tf.matmul(h, tf.transpose(self.W)))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prob_h_given_v(self, v):\n return tf.sigmoid(tf.add(self.b, tf.matmul(v, self.W)))",
"def prob4():\n#raise NotImplementedError(\"Problem 4 Incomplete\")\n h = lambda x : x[0] < -1 and x[1] > 1\n f = lambda x : stats.multivariate_normal.pdf(x,mean=np.array([0,0]),cov=np.eye(2))\n g = lambda x... | [
"0.69560045",
"0.6774935",
"0.66855866",
"0.65892315",
"0.6547395",
"0.6455749",
"0.64552754",
"0.6444555",
"0.64226663",
"0.6307906",
"0.62906694",
"0.62361306",
"0.6229128",
"0.6164281",
"0.61615676",
"0.61435294",
"0.611868",
"0.6103009",
"0.6098756",
"0.60985565",
"0.6090... | 0.7029824 | 0 |
Computing conditional probability P(h|v) | def _prob_h_given_v(self, v):
return tf.sigmoid(tf.add(self.b, tf.matmul(v, self.W))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prob_v_given_h(self, h):\n return tf.sigmoid(tf.add(self.a, tf.matmul(h, tf.transpose(self.W))))",
"def conditionalDistribution(self, d, v):\n probabilities_ts = np.ones((self.n_topic_components, self.n_sentiment_components))\n firstFactor = (self.n_ds[d] + self.alphaVec) / \\\n ... | [
"0.6957641",
"0.68463737",
"0.680359",
"0.6615206",
"0.6534881",
"0.65325207",
"0.65101624",
"0.645788",
"0.63940054",
"0.6388646",
"0.63539547",
"0.6344394",
"0.6341369",
"0.6318663",
"0.63144743",
"0.6220643",
"0.61792874",
"0.61719596",
"0.6171703",
"0.6158666",
"0.6156587... | 0.71246815 | 0 |
Return a dash definition of an HTML table for a Pandas dataframe | def make_dash_table(df):
table = []
for index, row in df.iterrows():
html_row = []
for i in range(len(row)):
html_row.append(html.Td([row[i]]))
table.append(html.Tr(html_row))
return table | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_dash_table(selection, df):\n\n df_subset = df.loc[df[\"NAME\"].isin(selection)]\n table = []\n\n for index, row in df_subset.iterrows():\n rows = []\n rows.append(html.Td([row[\"NAME\"]]))\n rows.append(html.Td([html.Img(src=row[\"IMG_URL\"])]))\n rows.append(html.Td([... | [
"0.73028404",
"0.71504134",
"0.71464837",
"0.7117",
"0.6868069",
"0.6781153",
"0.67628866",
"0.6703846",
"0.67008024",
"0.6673999",
"0.66340435",
"0.66117126",
"0.65981025",
"0.64622086",
"0.6456938",
"0.6449743",
"0.64447176",
"0.6416085",
"0.63830405",
"0.6372037",
"0.63682... | 0.7628702 | 2 |
Makes an html string from the JSON formatted sheet | def create_html_string(sheet):
html = ''
title = unicode(sheet.get('title', '')).strip()
html += '{}<br>'.format(title)
# author = ''
# html += '<em>Source Sheet by <a href="{}">{}</a><em>'
for source in sheet['sources']:
if 'text' in source:
english = unicode(source['text... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_html(obj):\n return highlight(\"json\", json.dumps(obj, sort_keys=False, indent=4))",
"def to_html(content):\n headers = content[0].keys()\n rows = (r.values() for r in content)\n return html_table(headers, rows)",
"def create_html(self):\n rows = self.check()\n htmlrows = \"\"... | [
"0.66835284",
"0.62767017",
"0.6134372",
"0.60997975",
"0.6016377",
"0.59954476",
"0.59345",
"0.59041566",
"0.5867901",
"0.5860437",
"0.58298653",
"0.5826802",
"0.5725759",
"0.56628203",
"0.5654219",
"0.56412256",
"0.563846",
"0.5623464",
"0.5617242",
"0.56169736",
"0.5570859... | 0.70021343 | 0 |
I'm the 'mandatory' property. | def mandatory(self):
return self._mandatory | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mandatory(self, mandatory):\n\n self._mandatory = mandatory",
"def mandatory(self, mandatory):\n\n self._mandatory = mandatory",
"def is_required(self):\r\n return self.default == self.NotSpecified",
"def isMandatory(self, is_set, get_value):\n\t\tif self._mandatory and not is_set(se... | [
"0.75506604",
"0.75506604",
"0.7203042",
"0.7185858",
"0.71747315",
"0.70269483",
"0.7014198",
"0.6909687",
"0.688413",
"0.6788407",
"0.6738173",
"0.6713245",
"0.6699305",
"0.6673248",
"0.6659847",
"0.66435295",
"0.66435295",
"0.66318053",
"0.66311187",
"0.6617063",
"0.658007... | 0.8318567 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.