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 |
|---|---|---|---|---|---|---|
Sets the fill_price of this BatchFuturesOrder. | def fill_price(self, fill_price):
self._fill_price = fill_price | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_price(self, price):\n assert isinstance(price, float), 'Price must be a float'\n self._price = price",
"def price(self, price: float):\n\n self._price = price",
"def fill_qty(self, fill_qty):\n\n self._fill_qty = fill_qty",
"def price(self, price):\n\n self._price =... | [
"0.65689087",
"0.65077937",
"0.64469916",
"0.6446206",
"0.6446206",
"0.6446206",
"0.6446206",
"0.6287776",
"0.6287776",
"0.6238051",
"0.6215148",
"0.6185274",
"0.6132895",
"0.61315024",
"0.60082006",
"0.59866965",
"0.59707135",
"0.58805937",
"0.57882833",
"0.5684527",
"0.5674... | 0.8497467 | 0 |
Sets the text of this BatchFuturesOrder. | def text(self, text):
self._text = text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_text(self, text):\n self.clear()\n r = self.add_run()\n r.text = _to_unicode(text)",
"def set_text(self, text):\n self.set_text_f(\"%s\", text)",
"def SetText(self, text):\r\n\r\n self._text = text",
"def set_text(self, text):\n\n self.text = text",
"def s... | [
"0.738883",
"0.73102534",
"0.7282904",
"0.72776896",
"0.72113734",
"0.71097034",
"0.7109433",
"0.6877894",
"0.68464094",
"0.67774165",
"0.67680264",
"0.67234176",
"0.66786504",
"0.6630735",
"0.66227275",
"0.6553275",
"0.6505064",
"0.64859176",
"0.6396813",
"0.63152385",
"0.63... | 0.7059112 | 11 |
Sets the tkfr of this BatchFuturesOrder. | def tkfr(self, tkfr):
self._tkfr = tkfr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fee_taf(self, fee_taf):\n\n self._fee_taf = fee_taf",
"def set_future(self, future):\r\n self._future = future",
"def set(self):\n\n raise Exception(\"Can't set frmt.\")",
"def fr(self, fr):\n\n self._fr = fr",
"def set_f(self, f):\n self.f = f\n self.refresh()... | [
"0.5249413",
"0.52169377",
"0.5205643",
"0.50446403",
"0.50440377",
"0.49556962",
"0.49090248",
"0.48828828",
"0.47640434",
"0.4741821",
"0.4730547",
"0.46186864",
"0.45995447",
"0.4579824",
"0.45171097",
"0.45045435",
"0.4496954",
"0.44920358",
"0.44658023",
"0.4457235",
"0.... | 0.73629487 | 0 |
Sets the mkfr of this BatchFuturesOrder. | def mkfr(self, mkfr):
self._mkfr = mkfr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tkfr(self, tkfr):\n\n self._tkfr = tkfr",
"def set(self):\n\n raise Exception(\"Can't set frmt.\")",
"def set_future(self, future):\r\n self._future = future",
"def mtf(self, mtf):\n\n self._mtf = mtf",
"def fr(self, fr):\n\n self._fr = fr",
"def findex(self, findex... | [
"0.5318648",
"0.49486306",
"0.48694998",
"0.48431262",
"0.47991398",
"0.46544263",
"0.46497783",
"0.4568865",
"0.45504254",
"0.4540998",
"0.45386323",
"0.44944158",
"0.44827116",
"0.44706678",
"0.44444895",
"0.44067228",
"0.43773124",
"0.43757445",
"0.4355087",
"0.4347009",
"... | 0.66274464 | 0 |
Sets the auto_size of this BatchFuturesOrder. | def auto_size(self, auto_size):
allowed_values = ["close_long", "close_short"] # noqa: E501
if self.local_vars_configuration.client_side_validation and auto_size not in allowed_values: # noqa: E501
raise ValueError(
"Invalid value for `auto_size` ({0}), must be one of {1}".... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto(self) -> 'Size':\n self.maximum = 'auto'\n return self",
"def min_auto(self) -> 'Size':\n self.minimum = 'auto'\n return self",
"def set_batch_size(self, batch_size):\n final_sz = self.full_dataset_size % batch_size\n if not self.final_batch:\n self.dataset_size ... | [
"0.657556",
"0.63142294",
"0.6037942",
"0.5843828",
"0.5719651",
"0.56144124",
"0.5605638",
"0.5605638",
"0.5605638",
"0.5605638",
"0.5605638",
"0.5571605",
"0.5564202",
"0.55581945",
"0.5496308",
"0.54906946",
"0.5369566",
"0.53652227",
"0.53251934",
"0.52507436",
"0.5241644... | 0.7379249 | 0 |
Sets the stp_id of this BatchFuturesOrder. | def stp_id(self, stp_id):
self._stp_id = stp_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_id(self, state_id):\n\n self._state_id = state_id",
"def task_id(self, task_id):\n\n self._task_id = task_id",
"def task_id(self, task_id):\n self._task_id = task_id",
"def task_id(self, task_id):\n if self.local_vars_configuration.client_side_validation and task_id is N... | [
"0.5439722",
"0.5395826",
"0.5375513",
"0.49912408",
"0.4950217",
"0.49064633",
"0.49064633",
"0.49064633",
"0.49064633",
"0.48698026",
"0.48597",
"0.4850475",
"0.48293912",
"0.47988915",
"0.47979003",
"0.47979003",
"0.47799927",
"0.4746367",
"0.47304225",
"0.47231445",
"0.47... | 0.77797455 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, BatchFuturesOrder):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, BatchFuturesOrder):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Save init mode to json file | def save_mode(self):
def save_mode_file():
name = dialog.entry.get()
self.init_modes[name] = self.save_list
with open(self.modes_file, 'wb') as fp:
json.dump(self.init_modes, fp)
self.world_alive = old_world_status[0]
self.world_setable... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_json_file(self,file_name):\n with open('saves/' + file_name + '.json', 'w') as fp:\n json.dump(self.options, fp, indent=4)",
"def reinit(self):\n self.keys = {}\n fh = open(self.path, \"w\")\n json.dump(self.keys, fh)\n fh.close()\n os.chmod(self.pa... | [
"0.6887022",
"0.68404675",
"0.67693",
"0.6658712",
"0.65835565",
"0.65712905",
"0.6562384",
"0.6555416",
"0.65441346",
"0.65335107",
"0.6529931",
"0.6524807",
"0.6503875",
"0.64891696",
"0.64891696",
"0.64891696",
"0.648137",
"0.64463985",
"0.64313436",
"0.6412618",
"0.640953... | 0.6046581 | 70 |
The id of the DOM element that contains this widget if parent is None. | def container_id(v=''):
return str(v) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_parentID(self):\n parent = Collection.find(self.resource.container)\n return parent.uuid",
"def parent_id(self):\n return self._parent_id",
"def parent_id(self):\n return self._parent_id",
"def parent_id(self) -> int:\n return self._parent_id",
"def get_parentID(s... | [
"0.70854264",
"0.7081342",
"0.7081342",
"0.6941954",
"0.69028586",
"0.68693876",
"0.68054086",
"0.68054086",
"0.67876214",
"0.6726368",
"0.66635585",
"0.6598652",
"0.65762496",
"0.65732473",
"0.64747864",
"0.64618737",
"0.6392635",
"0.63814396",
"0.6368345",
"0.6325241",
"0.6... | 0.0 | -1 |
The real (actual) size of the widget. | def actual_size(v=(0, 0)):
return v[0], v[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def widget_size(self) -> int:\n return self._widget_size",
"def size(self):\n size = self.widget.size()\n return Size(size.width(), size.height())",
"def size(self):\n return self.width",
"def size(self):\n return self.width",
"def size(self):\n return self.width",... | [
"0.8618168",
"0.8545094",
"0.780891",
"0.780891",
"0.780891",
"0.780891",
"0.780891",
"0.780891",
"0.780891",
"0.77900195",
"0.7772742",
"0.7766709",
"0.7742323",
"0.773087",
"0.76422435",
"0.7602682",
"0.7541158",
"0.75367326",
"0.75109446",
"0.7310525",
"0.72724414",
"0.7... | 0.0 | -1 |
Remove the DOM element. Called right after the child widget is removed. | def _remove_child(self, widget):
self.node.removeChild(widget.node) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_self(self):\n self.parent.remove(self.element)",
"def remove(self):\n if self._parent:\n self._parent.removeChild(self)\n else:\n self.clear()",
"def remove(self, widget):\n self.widgets.remove(widget)\n widget.destroy()",
"def remove_widget... | [
"0.7485156",
"0.7187746",
"0.7184754",
"0.6905952",
"0.67884785",
"0.6710861",
"0.6687458",
"0.66557515",
"0.66322166",
"0.6566373",
"0.6530083",
"0.6514613",
"0.6503867",
"0.6439918",
"0.64324903",
"0.63766557",
"0.6370551",
"0.6361438",
"0.63293856",
"0.6294435",
"0.6290520... | 0.85500693 | 0 |
Add a colorbar to the right of an axis. | def _add_colorbar(self, fig, ax, bounds, colormap, label=""):
import matplotlib as mpl
pos = ax.get_position()
cpos = [pos.x1 + 0.025, pos.y0 + 0.0125,
0.015, pos.height * 0.4] # this list defines (left, bottom, width, height
cax = fig.add_axes(cpos)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_colorbar(self, fig, ax, norm, colormap, label=\"\"):\n import matplotlib as mpl\n pos = ax.get_position()\n cpos = [pos.x1 + 0.025, pos.y0 + 0.0125,\n 0.015, pos.height * 0.8] # this list defines (left, bottom, width, height\n cax = fig.add_axes(cp... | [
"0.7577057",
"0.7577057",
"0.7418903",
"0.7179385",
"0.7166474",
"0.71613485",
"0.71574956",
"0.6979866",
"0.6953447",
"0.6930779",
"0.67889935",
"0.6788904",
"0.6615177",
"0.6534736",
"0.6524789",
"0.65199506",
"0.6450172",
"0.6343112",
"0.62681675",
"0.62551737",
"0.625244"... | 0.74102116 | 3 |
If `quantile` is `None`, return the quantile _rank_ of the last value of `series` wrt former series values. If `quantile` is a value between 0 and 1, return the _value_ of `series` at this quantile. If used to working with percentiles, just divide your percentile amount with 100 to obtain quantiles. | def quantile(series: Sequence, quantile: Union[None, float] = None):
if quantile is None:
try:
last, series = series[-1], series[:-1]
return np.mean(series < last)
except IndexError:
return np.nan
assert 0 <= quantile <= 1, "quantile must be within [0, 1]"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _quantile(data, quantile):\r\n index = quantile * (len(data) - 1)\r\n bottom_index = int(floor(index))\r\n top_index = int(ceil(index))\r\n\r\n difference = index - bottom_index\r\n output = (1 - difference) * \\\r\n data[bottom_index] + difference * data[top_index]\r\n\r\n return outp... | [
"0.6520899",
"0.6145551",
"0.6145551",
"0.6145551",
"0.61079895",
"0.6095731",
"0.5873301",
"0.58228385",
"0.57943034",
"0.57624453",
"0.5733412",
"0.5733412",
"0.56995964",
"0.56587195",
"0.5644355",
"0.5642954",
"0.5638669",
"0.56355345",
"0.5628076",
"0.5623091",
"0.560649... | 0.7877083 | 0 |
Apply `func` (such as an indicator) to `series`, resampled to a time frame specified by `rule`. When called from inside `backtesting.backtesting.Strategy.init`, the result (returned) series will be automatically wrapped in `backtesting.backtesting.Strategy.I` wrapper method. `rule` is a valid [Pandas offset string] ind... | def resample_apply(
rule: str,
func: Optional[Callable[..., Sequence]],
series: Union[pd.Series, pd.DataFrame, _Array],
*args,
agg: str = 'last',
**kwargs
):
if func is None:
def func(x, *_, **__):
return x
if not isinstance(series, (pd.Series... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resample( # pylint: disable=too-many-arguments\n df: DataFrame,\n rule: str,\n method: str,\n time_column: str,\n groupby_columns: Optional[Tuple[Optional[str], ...]] = None,\n fill_value: Optional[Union[float, int]] = None,\n) -> DataFrame:\n\n def _upsampling(_df: DataFrame) -> DataFram... | [
"0.594337",
"0.5805199",
"0.53954834",
"0.5369058",
"0.5094904",
"0.5033484",
"0.5027912",
"0.5024656",
"0.50126797",
"0.4890479",
"0.4886314",
"0.4790668",
"0.4790668",
"0.47272936",
"0.4701877",
"0.46794966",
"0.46776852",
"0.46546692",
"0.46399835",
"0.4631947",
"0.4620494... | 0.8047186 | 0 |
Reads either an XML document or a JSON object from environ. | def read_xml_or_json(self, environ):
atom_flag = None
encoding = None
if "CONTENT_TYPE" in environ:
request_type = params.MediaType.from_str(environ["CONTENT_TYPE"])
for r in self.AtomRanges:
if r.match_media_type(request_type):
atom_fl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_json(name, default=NO_ARGUMENT):\n value = os.environ.get(name)\n if value is None:\n if default is NO_ARGUMENT:\n return None\n else:\n return default\n try:\n value_json = json.loads(value)\n except:\n raise ValueError(f\"String `{value}` can... | [
"0.569929",
"0.53281",
"0.52944857",
"0.52831954",
"0.5206056",
"0.5181543",
"0.51783836",
"0.5177183",
"0.5144976",
"0.5114635",
"0.50724524",
"0.504457",
"0.50386524",
"0.498097",
"0.49776605",
"0.4969273",
"0.4962634",
"0.4923059",
"0.49116328",
"0.49112168",
"0.48747563",... | 0.7502383 | 0 |
Returns the best match for the Accept header. Given a list of media types, examines the Accept header and returns the best match. If there is no match then None is returned. We also handle an accept list override in the form of acceptList, e.g., parsed from the $format parameter. | def content_negotiation(self, request, environ, mtype_list):
alist = request.sys_query_options.get(core.SystemQueryOption.format,
None)
if alist is None:
if "HTTP_ACCEPT" in environ:
try:
alist = messages.Accep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _accept_strategy(self, host, port, environ, supported_content_types):\n accept = Accept(environ.get('HTTP_ACCEPT', ''))\n\n app = None\n\n # Find the best match in the Accept header\n mime_type, params = accept.best_match(supported_content_types)\n if 'version' in params:\n ... | [
"0.7609767",
"0.72352767",
"0.7204714",
"0.68856543",
"0.6858982",
"0.68290895",
"0.67379814",
"0.6703386",
"0.6695137",
"0.6658856",
"0.6606308",
"0.65931076",
"0.64771515",
"0.64253324",
"0.6400845",
"0.6302983",
"0.61780673",
"0.6176516",
"0.6062491",
"0.5933245",
"0.58545... | 0.692304 | 3 |
copies keys from d2 that doent exist in d1 into d1 | def update_ifnotin(d1, d2):
for k, v in d2.items():
if k not in d1:
d1[k] = v
return d1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_d2(d1, d2):\n val_list = [i for i in d2.keys()]\n \n for key in val_list:\n for i in range(len(d2[key])):\n try:\n val = d1[d2[key][i][2]]\n d2[key][i][2] = val\n if None in d2[key][i]:\n d2[key][i].remove(None)\n... | [
"0.72088456",
"0.68125874",
"0.6801156",
"0.6755334",
"0.6589003",
"0.65879613",
"0.6578424",
"0.64387685",
"0.6389865",
"0.63801384",
"0.63774425",
"0.63733107",
"0.6323963",
"0.63097984",
"0.6309151",
"0.63009244",
"0.6277226",
"0.62756914",
"0.62694836",
"0.626825",
"0.624... | 0.7595908 | 0 |
Returns True if arr is a string or a string array with a dtype that represents a unicode string, otherwise returns False. | def _is_unicode(arr):
if (isinstance(arr, str) or
issubclass(numpy.asarray(arr).dtype.type, str)):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_string(data):\n return len(data) and isinstance(_to_ndarray(data).flat[0], str)",
"def is_string(item: Any) -> bool:\n if isinstance(item, (bytes, bytearray, str)):\n return True\n elif (isinstance(item, (tuple, list)) and all(is_string(x) for x in item)):\n return True\n elif (isinstance(ite... | [
"0.7966714",
"0.73032117",
"0.71168894",
"0.7111482",
"0.686274",
"0.671574",
"0.66610277",
"0.6634594",
"0.6610915",
"0.6609697",
"0.65711135",
"0.6550568",
"0.654741",
"0.6530493",
"0.6523975",
"0.6523705",
"0.6522986",
"0.6350834",
"0.6295146",
"0.62918717",
"0.6276921",
... | 0.9189814 | 0 |
Helper function to cast a result back into an array with the appropriate dtype if an object array must be used as an intermediary. | def _to_bytes_or_str_array(result, output_dtype_like=None):
ret = numpy.asarray(result.tolist())
dtype = getattr(output_dtype_like, 'dtype', None)
if dtype is not None:
return ret.astype(type(dtype)(_get_num_chars(ret)), copy=False)
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_correct_dtype(obj: ndarray, required_dtype: dtype) -> ndarray:\n if obj.dtype != required_dtype:\n return obj.astype(required_dtype)\n return obj",
"def toarray(self, object_):\n\n raise NotImplementedError",
"def _asarray(a, dtype, order=None):\r\n if str(... | [
"0.7096671",
"0.6841039",
"0.6830651",
"0.6828725",
"0.66789085",
"0.64556044",
"0.6426028",
"0.6370754",
"0.63456815",
"0.63394296",
"0.6315407",
"0.6304702",
"0.6249234",
"0.62315524",
"0.6222053",
"0.61602265",
"0.6156637",
"0.6086843",
"0.6081079",
"0.60629636",
"0.604392... | 0.5883857 | 29 |
Return (x1 == x2) elementwise. Unlike `numpy.equal`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backwardcompatibility with numarray. | def equal(x1, x2):
return compare_chararrays(x1, x2, '==', True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def less_equal(x1, x2):\n return compare_chararrays(x1, x2, '<=', True)",
"def not_equal(x1, x2):\n return compare_chararrays(x1, x2, '!=', True)",
"def arrayStringsAreEqual1(self, word1: List[str], word2: List[str]) -> bool:\n word1str = ''.join(word1)\n word2str = ''.join(word2)\n ... | [
"0.7509916",
"0.7294553",
"0.6723392",
"0.65218514",
"0.6225552",
"0.60661477",
"0.6031216",
"0.6015804",
"0.60073864",
"0.5997947",
"0.5982622",
"0.59248394",
"0.588789",
"0.58679116",
"0.585102",
"0.5820265",
"0.5783995",
"0.5705827",
"0.566642",
"0.5653403",
"0.56294584",
... | 0.8008796 | 0 |
Return a copy of each string element where all tab characters are replaced by one or more spaces. | def expandtabs(a, tabsize=8):
return _to_bytes_or_str_array(
_vec_string(a, object_, 'expandtabs', (tabsize,)), a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def converttabs(text, spaces=4):\n\n return text.replace('\\t', ' ' * spaces)",
"def distillTabs(someString):\n if someString is None:\n return None\n while True:\n if someString.find('\\t\\t') == 0:\n someString = someString.replace('\\t\\t','\\t')\n continue\n ... | [
"0.71183926",
"0.65958834",
"0.620285",
"0.6186827",
"0.60230243",
"0.59868914",
"0.59636563",
"0.588255",
"0.58771384",
"0.58337706",
"0.5829873",
"0.57723075",
"0.5743903",
"0.5731502",
"0.5672966",
"0.5648179",
"0.5616224",
"0.56048214",
"0.5594087",
"0.5592536",
"0.555345... | 0.4895127 | 93 |
Returns true for each element if all characters in the string are digits and there is at least one character, false otherwise. | def isdigit(a):
return _vec_string(a, bool_, 'isdigit') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def only_numbers(string):\n for character in string[:-1]:\n if not (character.isdigit() or character in (',', ' ')): \n return False\n return True",
"def hasNumbers(inputString):\n return any(char.isdigit() for char in inputString)",
"def isNumber(string):\r\n for char in string:\... | [
"0.78533113",
"0.7561768",
"0.7475313",
"0.7440053",
"0.73669094",
"0.7201638",
"0.71519977",
"0.7132112",
"0.71114177",
"0.71021056",
"0.7024682",
"0.70234317",
"0.70116323",
"0.6942178",
"0.6839974",
"0.68116593",
"0.66650045",
"0.66237056",
"0.6609525",
"0.6604078",
"0.656... | 0.67674977 | 16 |
Returns true for each element if the element is a titlecased string and there is at least one character, false otherwise. | def istitle(a):
return _vec_string(a, bool_, 'istitle') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def any_lowercase1(s):\n\tfor c in s:\n\t\tif c.islower():\n\t\t\treturn True\n\t\telse:\n\t\t\treturn False",
"def all_caps(s):\n alphas = [c for c in s if c.isalpha()]\n if alphas == []:\n return False\n for x in alphas:\n if not x.isupper():\n return False\n return True",
... | [
"0.6941038",
"0.68716043",
"0.6780692",
"0.6780692",
"0.6512118",
"0.6399989",
"0.6380385",
"0.6357817",
"0.6357817",
"0.6357817",
"0.6355132",
"0.6309197",
"0.6285292",
"0.6258547",
"0.62567323",
"0.623165",
"0.62136436",
"0.62105006",
"0.61694354",
"0.6168388",
"0.6163217",... | 0.0 | -1 |
Return a string which is the concatenation of the strings in the sequence `seq`. | def join(sep, seq):
return _to_bytes_or_str_array(
_vec_string(sep, object_, 'join', (seq,)), seq) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seq2str(seq):\n return ','.join(map(cleanstr, seq))",
"def _get_seq_string(sequence) -> str:\n final_str = \"\"\n for seq in [sequence[i:i+60] for i in range(0, len(sequence), 60)]:\n final_str += \" \" + \" \".join(seq[i:i+10] for i in range(0, len(seq), 10)) + \"\\n\"\n\n return fina... | [
"0.69917446",
"0.69156003",
"0.63484746",
"0.6296491",
"0.62703073",
"0.62689954",
"0.6260878",
"0.6163532",
"0.61488706",
"0.6119395",
"0.61155546",
"0.60861564",
"0.608115",
"0.6074101",
"0.6059275",
"0.6044948",
"0.6010762",
"0.5994815",
"0.59882516",
"0.58637524",
"0.5823... | 0.6457387 | 2 |
Return an array with the elements of `a` leftjustified in a string of length `width`. | def ljust(a, width, fillchar=' '):
a_arr = numpy.asarray(a)
width_arr = numpy.asarray(width)
size = int(numpy.max(width_arr.flat))
if numpy.issubdtype(a_arr.dtype, numpy.bytes_):
fillchar = asbytes(fillchar)
return _vec_string(
a_arr, type(a_arr.dtype)(size), 'ljust', (width_arr, fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ljust(self, width, fillchar=' '):\n return asarray(ljust(self, width, fillchar))",
"def rjust(a, width, fillchar=' '):\n a_arr = numpy.asarray(a)\n width_arr = numpy.asarray(width)\n size = int(numpy.max(width_arr.flat))\n if numpy.issubdtype(a_arr.dtype, numpy.bytes_):\n fillchar =... | [
"0.7043984",
"0.6927092",
"0.65656453",
"0.650507",
"0.6413466",
"0.6408715",
"0.63705087",
"0.63438576",
"0.63402236",
"0.6301571",
"0.6272976",
"0.6107203",
"0.60244024",
"0.60244024",
"0.60244024",
"0.60244024",
"0.60244024",
"0.6013437",
"0.59690136",
"0.58454025",
"0.583... | 0.73811245 | 0 |
For each element in `a`, return a list of the words in the string, using `sep` as the delimiter string. | def rsplit(a, sep=None, maxsplit=None):
# This will return an array of lists of different sizes, so we
# leave it as an object array
return _vec_string(
a, object_, 'rsplit', [sep] + _clean_args(maxsplit)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split(a, sep=None, maxsplit=None):\n # This will return an array of lists of different sizes, so we\n # leave it as an object array\n return _vec_string(\n a, object_, 'split', [sep] + _clean_args(maxsplit))",
"def split_strip(input, delimiter=u','):\r\n if not input:\r\n return []\... | [
"0.6227914",
"0.6176784",
"0.6151628",
"0.61416644",
"0.60964584",
"0.6021042",
"0.6004054",
"0.58559257",
"0.58449996",
"0.583339",
"0.5772689",
"0.57500595",
"0.57454807",
"0.5717567",
"0.56444246",
"0.5623361",
"0.5617884",
"0.561691",
"0.56161356",
"0.5607101",
"0.5607101... | 0.0 | -1 |
For each element in `a`, return a list of the words in the string, using `sep` as the delimiter string. | def split(a, sep=None, maxsplit=None):
# This will return an array of lists of different sizes, so we
# leave it as an object array
return _vec_string(
a, object_, 'split', [sep] + _clean_args(maxsplit)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_strip(input, delimiter=u','):\r\n if not input:\r\n return []\r\n\r\n words = [w.strip() for w in input.split(delimiter)]\r\n return [w for w in words if w]",
"def split_by_comma_and_whitespace(a_str):\r\n return re.split(r'[\\s,]', a_str)",
"def tokenize(\n s: str, exclude: lis... | [
"0.6175783",
"0.6150606",
"0.6139819",
"0.6097065",
"0.6019408",
"0.60053664",
"0.5855007",
"0.5842084",
"0.5831188",
"0.57714456",
"0.57503814",
"0.5742755",
"0.5718715",
"0.56426924",
"0.5621288",
"0.5618435",
"0.5616384",
"0.5616018",
"0.5607548",
"0.5607548",
"0.5575949",... | 0.62272996 | 0 |
For each element in `a`, return a list of the lines in the element, breaking at line boundaries. | def splitlines(a, keepends=None):
return _vec_string(
a, object_, 'splitlines', _clean_args(keepends)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lines(a, b):\n # Declaring the a and b lists\n lineA = []\n lineB = []\n for line in a:\n lineA.append(line)\n\n for line in b:\n lineB.append(line)\n\n return []",
"def read_file_lines(afile):\n with open(afile, 'r') as f:\n lines = f.read()\n return lines.sp... | [
"0.6343864",
"0.6318174",
"0.62880236",
"0.6150436",
"0.61434174",
"0.61360204",
"0.6048654",
"0.6017373",
"0.58687353",
"0.58561",
"0.5841335",
"0.5813515",
"0.5799253",
"0.5765263",
"0.5734014",
"0.56684154",
"0.5650965",
"0.5589976",
"0.5571621",
"0.55594873",
"0.55565673"... | 0.71157223 | 0 |
For each element, return True if there are only numeric characters in the element. | def isnumeric(a):
if not _is_unicode(a):
raise TypeError("isnumeric is only available for Unicode strings and arrays")
return _vec_string(a, bool_, 'isnumeric') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def only_numbers(string):\n for character in string[:-1]:\n if not (character.isdigit() or character in (',', ' ')): \n return False\n return True",
"def isNumber(string):\r\n for char in string:\r\n charNum = ord(char)\r\n if (charNum < 48 or charNum > 57):\r\n ... | [
"0.70307505",
"0.6969218",
"0.69474757",
"0.68575186",
"0.679697",
"0.67844236",
"0.6732247",
"0.67028123",
"0.668302",
"0.66280687",
"0.66180533",
"0.66044587",
"0.65981555",
"0.65356493",
"0.6504214",
"0.64832485",
"0.64257586",
"0.6424728",
"0.6407274",
"0.63965833",
"0.63... | 0.6690595 | 8 |
Return (self == other) elementwise. See Also equal | def __eq__(self, other):
return equal(self, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n return self.element... | [
"0.83785",
"0.83785",
"0.8083074",
"0.8083074",
"0.8067659",
"0.80388385",
"0.7978107",
"0.796262",
"0.7881343",
"0.78671926",
"0.7859771",
"0.7856313",
"0.7850773",
"0.78459334",
"0.78459334",
"0.7843383",
"0.782459",
"0.78176045",
"0.7809106",
"0.77888995",
"0.77888995",
... | 0.83182645 | 2 |
Return (self != other) elementwise. See Also not_equal | def __ne__(self, other):
return not_equal(self, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\n return not self == other",
"def __ne__(self, other):\n return not self == other",
"def __ne__(self, other):\n return not self == other",
"def __ne__(self, other):\r\n return not self == other",
"def __ne__(self, other):\r\n return not self... | [
"0.8356103",
"0.8319851",
"0.8319851",
"0.8318627",
"0.8318627",
"0.8300962",
"0.8300962",
"0.8300962",
"0.8300962",
"0.8300962",
"0.8300962",
"0.8300962",
"0.8300962",
"0.8300962",
"0.8300962",
"0.8300962",
"0.8300962",
"0.8300962",
"0.8300962",
"0.8300962",
"0.8300962",
"... | 0.83294284 | 1 |
Return (self >= other) elementwise. See Also greater_equal | def __ge__(self, other):
return greater_equal(self, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ge__(self, other):\n return self.element() >= other.element()",
"def __gt__(self, other):\n return self >= other and self != other",
"def __gt__(self, other):\n return self >= other and self != other",
"def __gt__(self, other):\n return self >= other and not self <= othe... | [
"0.81039894",
"0.8084001",
"0.8084001",
"0.80728567",
"0.79933965",
"0.7870833",
"0.78633183",
"0.78371096",
"0.78363997",
"0.7809979",
"0.7778618",
"0.7713752",
"0.7695564",
"0.76186454",
"0.7610709",
"0.760211",
"0.7591801",
"0.7566062",
"0.75426847",
"0.7515614",
"0.751439... | 0.7979543 | 5 |
Return (self <= other) elementwise. See Also less_equal | def __le__(self, other):
return less_equal(self, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __le__(self, other):\n return self.element() <= other.element()",
"def __ge__(self, other):\n return other <= self",
"def __eq__(self, other):\n return self <= other and self >= other",
"def __le__(self, other):\n # self <= other <=> other >= self\n return self.runt... | [
"0.8304744",
"0.82557625",
"0.81052005",
"0.80792266",
"0.8020132",
"0.7877541",
"0.7873354",
"0.78645647",
"0.7858902",
"0.7858902",
"0.78445256",
"0.7842935",
"0.7816166",
"0.78126585",
"0.78042746",
"0.7802925",
"0.7802925",
"0.7783988",
"0.77502084",
"0.77472365",
"0.7714... | 0.82730126 | 1 |
Return (self < other) elementwise. See Also less | def __lt__(self, other):
return less(self, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n return self.element() < other.element()",
"def __lt__(self, other):\n return self.lessThan(other)",
"def __lt__(self, other):\n return self <= other and not self >= other",
"def __lt__(self, other):\n return self <= other and self != other",
"def _... | [
"0.85328865",
"0.8445823",
"0.8358106",
"0.8341501",
"0.8341501",
"0.8301288",
"0.82819813",
"0.8201047",
"0.8168915",
"0.81506443",
"0.81109184",
"0.80958414",
"0.80797833",
"0.807492",
"0.80560225",
"0.8041856",
"0.8038948",
"0.80287814",
"0.79924417",
"0.7985427",
"0.79816... | 0.8388125 | 2 |
Return the indices that sort the array lexicographically. For full documentation see `numpy.argsort`, for which this method is in fact merely a "thin wrapper." Examples >>> c = np.array(['a1b c', '1b ca', 'b ca1', 'Ca1b'], 'S5') >>> c = c.view(np.chararray); c chararray(['a1b c', '1b ca', 'b ca1', 'Ca1b'], dtype='|S5')... | def argsort(self, axis=-1, kind=None, order=None):
return self.__array__().argsort(axis, kind, order) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argsort(data, reversed=False):\n\n index = np.arange(len(data))\n key = lambda x: data[x]\n sortidx = sorted(index, key=key,reverse=reversed)\n sortidx = np.array(list(sortidx))\n return sortidx",
"def _argsort(seq):\n # http://stackoverflow.com/questions/3071415/efficient-method-to-calcula... | [
"0.65047985",
"0.6422976",
"0.63188636",
"0.62670755",
"0.62400144",
"0.6194454",
"0.57943624",
"0.57884544",
"0.57674444",
"0.5738136",
"0.5666745",
"0.55607355",
"0.5557059",
"0.55409867",
"0.5522309",
"0.54618233",
"0.54382974",
"0.5408864",
"0.54081786",
"0.52271765",
"0.... | 0.5671365 | 10 |
Return a copy of each string element where all tab characters are replaced by one or more spaces. See Also char.expandtabs | def expandtabs(self, tabsize=8):
return asarray(expandtabs(self, tabsize)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def converttabs(text, spaces=4):\n\n return text.replace('\\t', ' ' * spaces)",
"def tab2space(text, tabsize=1):\n return text.expandtabs(tabsize)",
"def distillTabs(someString):\n if someString is None:\n return None\n while True:\n if someString.find('\\t\\t') == 0:\n som... | [
"0.7422389",
"0.67966485",
"0.6702227",
"0.6592022",
"0.63332325",
"0.63141936",
"0.60228413",
"0.6021405",
"0.59502554",
"0.5941132",
"0.58949846",
"0.58574057",
"0.5846565",
"0.5794571",
"0.5775798",
"0.5774099",
"0.5728216",
"0.5600399",
"0.5598799",
"0.556683",
"0.5534603... | 0.49939102 | 66 |
Returns true for each element if all characters in the string are digits and there is at least one character, false otherwise. See Also char.isdigit | def isdigit(self):
return isdigit(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def only_numbers(string):\n for character in string[:-1]:\n if not (character.isdigit() or character in (',', ' ')): \n return False\n return True",
"def hasNumbers(inputString):\n return any(char.isdigit() for char in inputString)",
"def isNumber(string):\r\n for char in string:\... | [
"0.7732513",
"0.7610174",
"0.7431741",
"0.7327803",
"0.7207452",
"0.7116334",
"0.70109373",
"0.6970108",
"0.68902713",
"0.68804675",
"0.6866535",
"0.6864217",
"0.6799698",
"0.6798304",
"0.6785278",
"0.6759273",
"0.6687837",
"0.6679585",
"0.6609653",
"0.65738493",
"0.64952594"... | 0.5987139 | 53 |
Returns true for each element if the element is a titlecased string and there is at least one character, false otherwise. See Also char.istitle | def istitle(self):
return istitle(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_istitle__Rope(space, w_self):\n cased = False\n previous_is_cased = False\n\n iter = rope.ItemIterator(w_self._node)\n for pos in range(0, w_self._node.length()):\n ch = iter.nextchar()\n if ch.isupper():\n if previous_is_cased:\n return space.w_False\n ... | [
"0.70674455",
"0.6625902",
"0.6595639",
"0.6529429",
"0.6511004",
"0.64965606",
"0.64965606",
"0.648749",
"0.6479723",
"0.6438498",
"0.6361878",
"0.6269496",
"0.6217127",
"0.6215273",
"0.61611027",
"0.6127161",
"0.61244214",
"0.61240447",
"0.61200106",
"0.6112698",
"0.6106873... | 0.5419513 | 99 |
Return an array with the elements of `self` leftjustified in a string of length `width`. See Also char.ljust | def ljust(self, width, fillchar=' '):
return asarray(ljust(self, width, fillchar)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ljust(a, width, fillchar=' '):\n a_arr = numpy.asarray(a)\n width_arr = numpy.asarray(width)\n size = int(numpy.max(width_arr.flat))\n if numpy.issubdtype(a_arr.dtype, numpy.bytes_):\n fillchar = asbytes(fillchar)\n return _vec_string(\n a_arr, type(a_arr.dtype)(size), 'ljust', (wi... | [
"0.72176135",
"0.7098168",
"0.6750606",
"0.66644454",
"0.6612451",
"0.6596697",
"0.6327994",
"0.6303161",
"0.62641084",
"0.6258107",
"0.6242285",
"0.6109158",
"0.603986",
"0.6039585",
"0.6028544",
"0.6023879",
"0.5992693",
"0.59696305",
"0.5965873",
"0.595173",
"0.5920457",
... | 0.7976274 | 0 |
For each element in `self`, return a copy of the string with all occurrences of substring `old` replaced by `new`. See Also char.replace | def replace(self, old, new, count=None):
return asarray(replace(self, old, new, count)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def myreplace(old, new, s):\n\n s = s.split()\n s = \" \".join(s)\n\n return new.join(s.split(old))",
"def myreplace(old, new, s):\r\n if old.isspace(): # If a weird guy set \"old\" only have space(s)\r\n old = None\r\n return new.join(s.split(old))",
"def replace(self, old, new) -> Strin... | [
"0.7140363",
"0.6693934",
"0.658641",
"0.65489835",
"0.64956796",
"0.64662486",
"0.6331115",
"0.6275569",
"0.6233054",
"0.60994416",
"0.5980552",
"0.5938535",
"0.59136426",
"0.5887986",
"0.5868637",
"0.5843665",
"0.5819143",
"0.5817038",
"0.57622373",
"0.5743864",
"0.5705023"... | 0.5385032 | 33 |
Return an array with the elements of `self` rightjustified in a string of length `width`. See Also char.rjust | def rjust(self, width, fillchar=' '):
return asarray(rjust(self, width, fillchar)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ljust(self, width, fillchar=' '):\n return asarray(ljust(self, width, fillchar))",
"def rjust(a, width, fillchar=' '):\n a_arr = numpy.asarray(a)\n width_arr = numpy.asarray(width)\n size = int(numpy.max(width_arr.flat))\n if numpy.issubdtype(a_arr.dtype, numpy.bytes_):\n fillchar =... | [
"0.74029857",
"0.7173306",
"0.7038471",
"0.66472065",
"0.66196966",
"0.6259409",
"0.6234053",
"0.621299",
"0.59979856",
"0.5975219",
"0.5958487",
"0.59245026",
"0.58871484",
"0.5883636",
"0.5862282",
"0.58371276",
"0.581589",
"0.5814881",
"0.580915",
"0.57382166",
"0.57382166... | 0.77756715 | 0 |
Return an array with the elements of `self` converted to uppercase. See Also char.upper | def upper(self):
return asarray(upper(self)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capitalize(self):\n return asarray(capitalize(self))",
"def change_to_uppercase(arg_list):\n result = []\n\n for element_list in arg_list:\n result.append(element_list.upper())\n\n return result",
"def upper(self):\n if not self._upper_string:\n self._upper_string =... | [
"0.7749284",
"0.6852509",
"0.67583764",
"0.657437",
"0.6479573",
"0.64703065",
"0.6420857",
"0.64024675",
"0.63715565",
"0.63638675",
"0.62712586",
"0.60145324",
"0.60024774",
"0.59689105",
"0.59485763",
"0.59357965",
"0.59317786",
"0.5884544",
"0.58455884",
"0.584461",
"0.58... | 0.7853501 | 0 |
For each element in `self`, return True if there are only numeric characters in the element. See Also char.isnumeric | def isnumeric(self):
return isnumeric(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_numeric(self) -> bool:\n return False",
"def is_name_mostly_numeric(self) -> bool:\n app_no_punc = self.app_name_no_punc()\n\n try:\n int(app_no_punc)\n return True\n except ValueError:\n pass\n\n alphabetic_chars = 0\n for char in... | [
"0.6806881",
"0.67419815",
"0.6643586",
"0.66338474",
"0.663281",
"0.66325986",
"0.6598145",
"0.65546954",
"0.65250516",
"0.65207386",
"0.65206975",
"0.6515477",
"0.65025306",
"0.646047",
"0.64571553",
"0.644892",
"0.6385377",
"0.6372136",
"0.6322396",
"0.62826014",
"0.627679... | 0.7178055 | 0 |
For each element in `self`, return True if there are only decimal characters in the element. See Also char.isdecimal | def isdecimal(self):
return isdecimal(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_decimal(s):\n if len(s) is 0:\n return False\n for c in s:\n if c not in ImageLoader.decimal_set:\n return False\n return True",
"def isdecimal(a): \n if not _is_unicode(a):\n raise TypeError(\n \"isdecimal is only available fo... | [
"0.74820995",
"0.6623495",
"0.6560578",
"0.6421966",
"0.6197398",
"0.612383",
"0.6110045",
"0.6065796",
"0.5946977",
"0.5914447",
"0.59090704",
"0.59006554",
"0.58717793",
"0.579248",
"0.5771743",
"0.57602406",
"0.5719818",
"0.5675546",
"0.5636648",
"0.5629216",
"0.5617922",
... | 0.7213087 | 1 |
Test that SRBs move the craft, and run out of fuel. | def test_srbs(self):
with PhysicsEngineHarness('tests/habitat.json') as physics_engine:
t0 = 1
t1 = 5
physics_engine.handle_requests(
[common.Request(ident=common.Request.IGNITE_SRBS)],
requested_t=t0)
initial = physics_engine.get_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_move_over_terrain(self):\n # move over Water (0 extra)\n b1 = board.Board(self.small_ter)\n start = np.array((0, 1), dtype='int')\n k1 = knight.Knight(b1, start)\n # set move choice\n move_choice = 1\n # determine move validity and cost\n (cost... | [
"0.67601323",
"0.6623755",
"0.65073687",
"0.64953923",
"0.649527",
"0.64837956",
"0.6453559",
"0.6399947",
"0.63883835",
"0.637876",
"0.63641274",
"0.63507104",
"0.63409126",
"0.6315346",
"0.6220188",
"0.62106204",
"0.6199223",
"0.6174865",
"0.61497515",
"0.6146699",
"0.61451... | 0.5743264 | 85 |
Add data vector `X[i]` to component `k`. If `k` is `K`, then a new component is added. No checks are performed to make sure that `X[i]` is not already assigned to another component. | def add_item(self, i, k):
if k == self.K:
self.K += 1
self.m_N_numerators[k, :] = self.prior.k_0*self.prior.m_0
self.S_N_partials[k, :] = self.prior.S_0 + self.prior.k_0*self._cached_prior_square_m_0
self.m_N_numerators[k, :] += self.X[i]
self.S_N_partials[k, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_memory_x(self, x_k):\n self.mem_x[self.mem_idx, :] = x_k",
"def append_data(self, k:str, data) -> None:\n if k not in self.fp.keys():\n raise ValueError('No dataset %s in internal data' % str(k))\n if self.data_ptr[k] > self.size[k]:\n raise ValueError('Maxim... | [
"0.6305053",
"0.5841529",
"0.5568043",
"0.55220383",
"0.5491832",
"0.5472362",
"0.543726",
"0.54337496",
"0.5401342",
"0.5378995",
"0.5355455",
"0.53222597",
"0.53222597",
"0.53222597",
"0.531311",
"0.52850926",
"0.5284119",
"0.5268935",
"0.52541417",
"0.5247794",
"0.5239126"... | 0.6661089 | 0 |
Return the value of the log of the product of the univariate Student's t PDFs at `X[i]`. | def _log_prod_students_t(self, i, mu, log_prod_var, inv_var, v):
delta = self.X[i, :] - mu
return (
self.D * (
self._cached_gammaln_by_2[v + 1] - self._cached_gammaln_by_2[v]
- 0.5*self._cached_log_v[v] - 0.5*self._cached_log_pi
)
-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logpdf(self, X) -> np.ndarray:\n return self.dist.logpdf(self.inv_trans(X))",
"def logpdf(self, X) -> np.ndarray:\n comp_logpdfs = [np.reshape(comp.logpdf(X), [-1, 1]) for comp in self.components]\n logpdfs = np.hstack(comp_logpdfs)\n result = logsumexp(logpdfs, axis=1, b=self.coe... | [
"0.73996794",
"0.72871464",
"0.71131086",
"0.71131086",
"0.70695525",
"0.7025632",
"0.69100636",
"0.68624103",
"0.65969235",
"0.65141135",
"0.64902365",
"0.6476452",
"0.64598167",
"0.6434644",
"0.64293134",
"0.63856643",
"0.63855886",
"0.63820535",
"0.6379934",
"0.6372338",
"... | 0.71608895 | 2 |
Returns a list whose elements are the separate terms in document. Something of a hack, but for the simple documents we're using, it's okay. Note that we casefold when we tokenize, i.e., we lowercase everything. | def tokenize(document):
terms = document.lower().split()
space = ' '
return [term.strip(characters) for term in terms if term not in space] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_terms(document):\n q = get_mapped(document)\n tokens = tockenizer(q)\n terms = analizer(tokens)\n\n return terms",
"def tokenize(document):\n words = nltk.word_tokenize(document)\n # tokenize files into a list of words\n return [\n word.lower() for word in words\n # fil... | [
"0.76705617",
"0.7257853",
"0.7257321",
"0.7238248",
"0.72243047",
"0.7107971",
"0.70512325",
"0.70141673",
"0.70008624",
"0.69705045",
"0.6957619",
"0.69490683",
"0.69383264",
"0.68765837",
"0.68337864",
"0.6739288",
"0.67356414",
"0.669961",
"0.6683654",
"0.6679387",
"0.664... | 0.77325976 | 0 |
Iterates over nonoverlapping list of 'n' consecutive elements (python equivalent of each_slices). The last element might be smaller. | def iterslices(iterable, n, pad_last=False, pad_value=None):
current = []
for a in iterable:
current.append(a)
if len(current) == n:
yield current
current = []
if current:
if pad_last:
current += [pad_value] * (n-len(current))
yield current | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_n(sequence: Sequence[T], n: int) -> List[T]:\n\t\n\tfor i in range(len(sequence) - (n-1)):\n\t\tyield sequence[i:i+n]",
"def chunks(l, n):\n for i in range(0, n):\n yield l[i::n]",
"def chunks(l: List, n: int):\n for i in range(0, len(l), n):\n yield l[i : i... | [
"0.73084015",
"0.7209659",
"0.715213",
"0.715213",
"0.71037626",
"0.70655525",
"0.70639044",
"0.7059356",
"0.7053247",
"0.70493114",
"0.7047632",
"0.70423347",
"0.7039255",
"0.7039255",
"0.70105356",
"0.6986326",
"0.6981029",
"0.6980161",
"0.6980161",
"0.6980028",
"0.69751346... | 0.7619225 | 0 |
Sets the web_log_id of this WebLogItem. | def web_log_id(self, web_log_id):
self._web_log_id = web_log_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def web_id(self, web_id):\n\n self._web_id = web_id",
"def web_site_id(self, web_site_id):\n\n self._web_site_id = web_site_id",
"def web_section_id(self, web_section_id):\n\n self._web_section_id = web_section_id",
"def item_web_url(self, item_web_url):\n\n self._item_web_url = i... | [
"0.72772175",
"0.6780549",
"0.5887708",
"0.5755763",
"0.5576034",
"0.5507558",
"0.5507558",
"0.535682",
"0.53004086",
"0.505792",
"0.4921419",
"0.4921419",
"0.4919863",
"0.49113163",
"0.48896873",
"0.4817204",
"0.47949544",
"0.4771764",
"0.47317952",
"0.46474653",
"0.46381494... | 0.87703234 | 0 |
Sets the machine_name of this WebLogItem. | def machine_name(self, machine_name):
if machine_name is not None and len(machine_name) > 100:
raise ValueError("Invalid value for `machine_name`, length must be less than or equal to `100`") # noqa: E501
self._machine_name = machine_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setMachineName(self, name):\n if type(name) != str:\n return None\n self.description.setName(name)",
"def machine_name(self) -> str:\n return pulumi.get(self, \"machine_name\")",
"def machine_name(self) -> str:\n return pulumi.get(self, \"machine_name\")",
"def mach... | [
"0.7471434",
"0.6228557",
"0.6228557",
"0.5828472",
"0.5828472",
"0.58051664",
"0.58051664",
"0.574799",
"0.5739208",
"0.5655175",
"0.564087",
"0.5431581",
"0.5396255",
"0.53213334",
"0.5317432",
"0.52834547",
"0.52506065",
"0.5245235",
"0.52264035",
"0.52010256",
"0.51988864... | 0.74086404 | 1 |
Sets the entry_id of this WebLogItem. | def entry_id(self, entry_id):
self._entry_id = entry_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thread_id(self, thread_id):\n\n self._thread_id = thread_id",
"def thread_id(self, thread_id):\n\n self._thread_id = thread_id",
"def thread_id(self, thread_id):\n\n self._thread_id = thread_id",
"def setEntry(self, entry):\n assert self.entry is None, \"An entry was already s... | [
"0.60288566",
"0.60288566",
"0.60288566",
"0.58862317",
"0.58845866",
"0.5864405",
"0.5833399",
"0.57429564",
"0.57429564",
"0.5613247",
"0.56121963",
"0.55841726",
"0.5542967",
"0.5542967",
"0.55245876",
"0.5493822",
"0.5464202",
"0.5444797",
"0.5435358",
"0.54323107",
"0.54... | 0.83543396 | 1 |
Sets the active_users of this WebLogItem. | def active_users(self, active_users):
self._active_users = active_users | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users(self, users):\n\n self._users = users",
"def users(self, users):\n\n self._users = users",
"def users(self, users):\n\n self._users = users",
"def active_users(self, *args, **kwargs):\r\n return self._get('ActiveUsers', *args, **kwargs)",
"def logged_in_users(self, log... | [
"0.616837",
"0.616837",
"0.616837",
"0.60524994",
"0.59288585",
"0.58198667",
"0.5634061",
"0.5630524",
"0.55776834",
"0.55689317",
"0.5467311",
"0.5465469",
"0.5433245",
"0.54018503",
"0.53679186",
"0.5351684",
"0.5351684",
"0.5351684",
"0.5351684",
"0.5349999",
"0.5324025",... | 0.8045006 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, WebLogItem):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Supplies a basic Flask app with a graphene schema mounted inside the flasql view at /graphql. | def app():
app = create_app(schema=create_schema())
with app.test_request_context():
yield app | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_rest_app(config=base_config):\n app = Flask(__name__, template_folder=\"templates\", static_folder=\"static\")\n app.config.from_object(config)\n register_extensions(app)\n register_blueprints(app)\n\n @app.route('/', methods=['GET'])\n def index():\n \"\"\"Returns the applicati... | [
"0.621361",
"0.6202036",
"0.61454356",
"0.61091685",
"0.60560554",
"0.6045897",
"0.5990806",
"0.5989298",
"0.59627146",
"0.59084016",
"0.5867595",
"0.5822282",
"0.580273",
"0.58010894",
"0.5788795",
"0.57814556",
"0.5764773",
"0.5756709",
"0.57322145",
"0.57193893",
"0.571815... | 0.61777014 | 2 |
Returns the width of the media player | def getPlayerWidth(self):
context = aq_inner(self.context)
return context.getWidth() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def video_width(self):\n return self._el._parent.execute_script(\"return arguments[0].videoWidth\", self._el)",
"def video_width(self):\n return self._el._parent.execute_script(\"return arguments[0].videoWidth\", self._el)",
"def video_playback_width(self):\n # type: () -> int\n ret... | [
"0.813535",
"0.813535",
"0.79287934",
"0.7513053",
"0.7396114",
"0.7338204",
"0.7319346",
"0.7295444",
"0.7295444",
"0.7295444",
"0.72888047",
"0.72852385",
"0.72852385",
"0.72852385",
"0.72852385",
"0.7273083",
"0.7205518",
"0.7187752",
"0.71673703",
"0.71673703",
"0.7149738... | 0.832979 | 0 |
Returns the height of the media player | def getPlayerHeight(self):
context = aq_inner(self.context)
if context.getAudiomode():
return 24
else:
return context.getHeight() + 24 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def video_height(self):\n return self._el._parent.execute_script(\"return arguments[0].videoHeight\", self._el)",
"def video_height(self):\n return self._el._parent.execute_script(\"return arguments[0].videoHeight\", self._el)",
"def video_playback_height(self):\n # type: () -> int\n ... | [
"0.8335271",
"0.8335271",
"0.8015489",
"0.7978224",
"0.74621356",
"0.74273276",
"0.73141116",
"0.7269054",
"0.7240647",
"0.72005314",
"0.71803",
"0.71556836",
"0.71556836",
"0.71556836",
"0.7139502",
"0.7139502",
"0.7139502",
"0.7139502",
"0.71201456",
"0.71201456",
"0.704636... | 0.8112369 | 2 |
Unroll a batch of sequences, i.e. flatten batch and sequence dimension. (Used for loss computation) | def _unroll_sequence_batch(self, batch):
shape = batch.shape
if len(shape) == 3: # Model output
return batch.view(shape[0]*shape[1], shape[2])
elif len(shape) == 2: # Target labels
return batch.view(shape[0]*shape[1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fold_unroll(cell, fold, length, inputs, begin_state=None, layout='NTC'):\n cell.reset()\n\n inputs, _, F, batch_size = _format_sequence(length, inputs, layout, False)\n begin_state = _get_begin_state(cell, F, begin_state, inputs, batch_size)\n\n states = begin_state\n outputs = []\n for i in ... | [
"0.6740898",
"0.65447414",
"0.6513062",
"0.635172",
"0.635172",
"0.62510717",
"0.62439674",
"0.62399924",
"0.62311876",
"0.62060153",
"0.61889553",
"0.6172056",
"0.6158164",
"0.61539364",
"0.6123136",
"0.6115137",
"0.60707927",
"0.6044811",
"0.6044811",
"0.60425323",
"0.60014... | 0.7917433 | 0 |
Save checkpoint for the specified epoch number. If is_best is True, also save current checkpoint as 'model_best.pth'. | def _save_checkpoint(self, epoch, is_best=False):
arch = type(self.model).__name__
state = {
'arch': arch,
'epoch': epoch,
'state_dict': self.model.state_dict(),
'optimizer': self.optimizer.state_dict(),
'config': self.config
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_checkpoint(state, is_best, epoch, args, filename='checkpoint.pth'):\n if not os.path.exists(args.save_folder):\n os.makedirs(args.save_folder)\n filename = args.save_folder + str(epoch) + '_' + filename\n torch.save(state, filename)\n if is_best:\n shutil.copyfile(filename, args.... | [
"0.8539403",
"0.84266627",
"0.8362118",
"0.8283222",
"0.8244089",
"0.82274926",
"0.8217209",
"0.80957633",
"0.8085324",
"0.8037687",
"0.800268",
"0.7965901",
"0.7947712",
"0.79226893",
"0.79162663",
"0.7911913",
"0.78826475",
"0.7874946",
"0.7864674",
"0.7786618",
"0.77285564... | 0.8834462 | 0 |
Do not return anything, modify rooms inplace instead. | def wallsAndGates(self, rooms: List[List[int]]) -> None:
offsets = [[0,1],[1,0],[0,-1],[-1,0]]
size = [len(rooms), len(rooms[0])]
q = []
for i in range(len(rooms)):
for j in range(len(rooms[i])):
if rooms[i][j] == 0:
q.append([i,j])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rooms(self, rooms):\n\n self._rooms = rooms",
"def _add_rooms(self):\r\n rooms = self.model.get_all_rooms()\r\n\r\n for room in rooms:\r\n self._add_room(room)",
"def rooms(*args):\n send.system_message('\\n'.join(rooms()))",
"def all_rooms(self):\n pass",
... | [
"0.67922723",
"0.6150443",
"0.5985418",
"0.59520423",
"0.5938853",
"0.5910455",
"0.5802791",
"0.5788961",
"0.57677865",
"0.56960684",
"0.56584203",
"0.56518275",
"0.5649922",
"0.56375164",
"0.5580176",
"0.5570199",
"0.5540112",
"0.5534412",
"0.5534412",
"0.5529608",
"0.549605... | 0.53502834 | 36 |
Return dictionary of bbox | def get_bbox(x,y, buffer=0.):
return dict(left=np.min(x),
right=np.max(x),
bottom=np.min(y),
top=np.max(y)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getbbox(self):\n pass",
"def bbox(self):\n return self._bbox",
"def bbox(self):\n return self.get_bounding_box()",
"def bbox(self):\n bbox = self.get_bounding_box()\n if bbox is None:\n bbox = ((0, 0), (0, 0))\n return np.array(bbox)",
"def bbox2fiel... | [
"0.76412326",
"0.7323698",
"0.7322006",
"0.72095543",
"0.7132405",
"0.71319735",
"0.7007611",
"0.70063585",
"0.70063585",
"0.69595045",
"0.69220793",
"0.6917276",
"0.69009686",
"0.6869985",
"0.68652064",
"0.68622583",
"0.6846119",
"0.6809936",
"0.68038726",
"0.6795248",
"0.67... | 0.7554435 | 1 |
Extract the smallest bounding box from a mask | def smallest_bounding_box(msk):
x, y, z = np.where(msk > 0)
corner = np.array([x.min(), y.min(), z.min()])
size = np.array([x.max() + 1, y.max() + 1, z.max() + 1])
return corner, size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def smallest_bounding_box(msk):\n x, y, z = np.where(msk > 10)\n corner = np.array([x.min(), y.min(), z.min()])\n size = np.array([x.max() + 1, y.max() + 1, z.max() + 1])\n return corner, size",
"def mask_to_bbox(mask):\n xs = np.where(np.sum(mask, axis=0) > 0)[0]\n ys = np.where(np.sum(mask, a... | [
"0.7624876",
"0.7230303",
"0.7098378",
"0.69976777",
"0.6939646",
"0.6922342",
"0.69192773",
"0.68058246",
"0.6802908",
"0.67974967",
"0.6774587",
"0.6640921",
"0.66126287",
"0.6612228",
"0.6589775",
"0.65189314",
"0.64820874",
"0.644539",
"0.64409256",
"0.6437819",
"0.642982... | 0.77130044 | 1 |
Returns a random word. | def randomWord(wordList):
return random.choice(wordList) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_word(self):\n pass",
"def return_word():\n wordlist = load_words()\n word = random.choice(wordlist)\n return word",
"def get_word():\n word=words_dict[randrange(0,len(words_dict))]\n return word",
"def get_word():\n word=words_dict[randrange(0,len(words_dict))]\n re... | [
"0.88615733",
"0.8597407",
"0.85261667",
"0.85261667",
"0.85261667",
"0.84640265",
"0.8324689",
"0.8243119",
"0.8160317",
"0.8080931",
"0.803451",
"0.7998791",
"0.7992949",
"0.78472656",
"0.77283627",
"0.7725877",
"0.77045876",
"0.76605856",
"0.7627101",
"0.7570928",
"0.75480... | 0.81857026 | 10 |
Test the get request with a collection parameter | def test_collection_filtering(self):
# Create a collection
entries = Entry.objects.filter(id__in=(1, 5, 10, 15))
collection = CollectionFactory(entries=entries)
# Get a valid collection
params = {"collection": collection.id}
self._test_filtering(**params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_collection(self):\n pass",
"def test_sqlquery_resource_collection_get(self, login, web_request, context):\n service = SQLQueryService(context, web_request)\n response = service.collection_get()\n assert 'data' in response\n assert 'pagination' in response",
"def ... | [
"0.7843733",
"0.7257336",
"0.718152",
"0.714491",
"0.7008334",
"0.6728784",
"0.6694924",
"0.665027",
"0.6625752",
"0.66209954",
"0.6569023",
"0.6511248",
"0.65063363",
"0.64756125",
"0.6459046",
"0.6399147",
"0.6387948",
"0.6383114",
"0.63583875",
"0.63534075",
"0.6328062",
... | 0.6770182 | 5 |
Routes opens the designated window for the user | def router(self, num):
self.newWindow = tk.Toplevel(self.master)
if num == 1:
self.app = FiveFunc(self.newWindow)
elif num == 3:
self.app = StatFunc(self.newWindow)
elif num == 4:
self.app = ManGraph(self.newWindow)
elif num == 5:
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _open_window(self):\r\n\t\t# Creating the window\r\n\t\tself._window = Window(self, Locations.RESTAL)",
"def open_restaurant(self):\n msg = self.name + \" is open. Come on in!\"\n print(\"\\n\" + msg)",
"def show(self, window):\r\n\r\n return",
"def on_OpenExplorer_clicked(self):\n ... | [
"0.7549119",
"0.62864166",
"0.62739664",
"0.6272578",
"0.6265829",
"0.62173176",
"0.62087905",
"0.61563367",
"0.6099234",
"0.60819525",
"0.60745025",
"0.6071393",
"0.60440695",
"0.6018352",
"0.6006456",
"0.6000093",
"0.59931594",
"0.5968254",
"0.5928682",
"0.5903403",
"0.5882... | 0.6421511 | 1 |
Send a message to Slack. If self.slack_webhook is not set, the message is only logged in the logger with loglevel INFO. If self.slack_channel is not set, the default channel of the webhook is used. | def log_to_slack(self, message):
log.info(f'MC: {message}')
if not hasattr(self, 'slack_webhook'):
log.info(f'MC: Not logging to slack because slack_webhook is not '
f'defined.')
return
try:
payload = {"text": message}
if hasat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_slack(self, message):\n self.slack_client.api_call('chat.postMessage', channel=self.slack_channel, text=message, username=self.username, icon_emoji=self.slack_icon_emoji)\n print(\"Slack Notification sent\")",
"def send_message(self, message, channel=None):\n if channel is None:\n ... | [
"0.7703384",
"0.72871554",
"0.7159838",
"0.6824066",
"0.6756946",
"0.6705088",
"0.63765514",
"0.63729423",
"0.63176805",
"0.6258126",
"0.62530535",
"0.6237889",
"0.6206803",
"0.61999",
"0.6078251",
"0.60490096",
"0.59679675",
"0.5954792",
"0.59319335",
"0.5898765",
"0.5859944... | 0.7442679 | 1 |
How many nodes can be painted on a tree, assuming that no adjacent nodes can be colored and the root's state is painted (true or false) | def max_coloring(root, painted):
# Using Python bool coercion, True = 1, False = 0
if cache[root][painted] != -1:
return cache[root][painted]
if painted:
babies = [max_coloring(u, painted=False) for u in children[root]]
cache[root][painted] = 1 + sum(babies)
else:
babies ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_nodes(self):\n if self.is_empty():\n return 0\n elif self.is_leaf():\n return 1\n else:\n if self.get_left():\n if self.get_right():\n return 1 + self.get_left().count_nodes() + self.get_right().count_nodes()\n ... | [
"0.769694",
"0.7479256",
"0.7346389",
"0.72400683",
"0.71986175",
"0.7108546",
"0.7058728",
"0.7036648",
"0.70276934",
"0.702475",
"0.6899905",
"0.689268",
"0.68744963",
"0.6844234",
"0.68255436",
"0.6807381",
"0.68009776",
"0.6793788",
"0.6774721",
"0.67479014",
"0.66995245"... | 0.0 | -1 |
takes list as a input and returns the copy of the list using list comprehension | def list_copy(l: List[Any]) -> List[Any]:
return [item for item in l] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_list(list):\n listcopy = []\n for item in list:\n listcopy.append(item)\n return listcopy",
"def flat_list(list_: list) -> list:\n return [item for sublist in list_ for item in sublist]",
"def compress_list(src_list):\n return [item for item in src_list if item]",
"def deep... | [
"0.7411996",
"0.72238374",
"0.7077029",
"0.707486",
"0.6986126",
"0.6915285",
"0.6892424",
"0.66372645",
"0.6634844",
"0.66341704",
"0.6626084",
"0.65542775",
"0.6505839",
"0.6495717",
"0.64610016",
"0.64485997",
"0.64353365",
"0.64019006",
"0.6385644",
"0.6347571",
"0.634102... | 0.7829286 | 0 |
r"""Split channels (dimension 2) into multiple heads, becomes dimension 1). Must ensure ``x.shape[1]`` can be divided by num_heads. | def _split_heads(self, x: torch.Tensor) -> torch.Tensor:
depth = x.size(-1)
split_x = torch.reshape(x, (
x.size(0), x.size(1),
self._hparams.num_heads, depth // self._hparams.num_heads))
return split_x.permute((0, 2, 1, 3)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_heads(x, num_heads):\n sz = x.size()\n # x -> [batch_size, length, heads, depth / num_heads]\n x = x.view(sz[0], sz[1], num_heads, sz[2] // num_heads)\n # [batch_size, length, 1, depth // num_heads] * \n heads = torch.chunk(x, num_heads, 2)\n x = []\n for i in range(num_heads):\n ... | [
"0.82614386",
"0.81451607",
"0.78986675",
"0.78886116",
"0.7718236",
"0.76721853",
"0.76210016",
"0.76210016",
"0.76210016",
"0.76210016",
"0.76210016",
"0.76210016",
"0.76210016",
"0.7608375",
"0.7540727",
"0.726374",
"0.67482615",
"0.6072764",
"0.602509",
"0.60143137",
"0.5... | 0.8438572 | 0 |
Add a scalar summary to both TF events file and StatHolder. | def add_scalar_summary(self, name, val):
self.add_summary(create_scalar_summary(name, val)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_scalar_summary(self, tensor_obj):\n name = tensor_obj.name.replace(':', '_')\n train_scalar = tf.summary.scalar('scalar/train/'+name, tensor_obj)\n self._train_summaries.append(train_scalar)\n\n val_scalar = tf.summary.scalar('scalar/validation/'+name, tensor_obj)\n self... | [
"0.7023675",
"0.6998757",
"0.68300205",
"0.68300205",
"0.68300205",
"0.6802911",
"0.6795887",
"0.67553234",
"0.6754024",
"0.6735733",
"0.66640085",
"0.66449887",
"0.6635212",
"0.65294194",
"0.6424656",
"0.6424656",
"0.6422242",
"0.63821405",
"0.63566846",
"0.6282443",
"0.6255... | 0.6724381 | 10 |
cumsum takes in a list and returns a list integers from the first list each added to the number before it | def cumsum(lst):
for i in range(1,len(lst)):
lst[i] = lst[i- 1 ] + lst[i]
return lst | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cumulative_sum(self, lis):\n new_list = []\n for i in range(len(lis)):\n if i == 0:\n new_list.append(lis[i])\n else:\n new_list.append(new_list[i-1] + lis[i])\n return new_list",
"def cumsum(L):\n for i in range(1, len(L)):\n L[i] += L[i-1]\n return L",
"def c... | [
"0.8179812",
"0.8056273",
"0.79615253",
"0.79316074",
"0.7885108",
"0.7679509",
"0.74078083",
"0.7228586",
"0.6938837",
"0.6938837",
"0.6938837",
"0.69087696",
"0.6672079",
"0.6665657",
"0.6612476",
"0.6594035",
"0.6500159",
"0.6470118",
"0.6452226",
"0.6396911",
"0.6356356",... | 0.8410762 | 0 |
Creates a new vis_list and initialises all to zero | def zero_list_rsexecute_workflow(vis_list):
def zero(vis):
if vis is not None:
zerovis = copy_visibility(vis, zero=True)
return zerovis
else:
return None
result = [rsexecute.execute(zero, pure=True, nout=1)(v) for v in vis_list]
return rsexecute.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.container = [[-1]*1000 for _ in range(1000)]",
"def __init__(self):\n self.vertList = {}\n self.vertCount = 0",
"def initialization_list_empty_nodes(self, n):\n\n for node in self.list_empty_nodes:\n node.status = 0\n node.distance_fr... | [
"0.65216297",
"0.5827182",
"0.58258694",
"0.57595444",
"0.57441336",
"0.5722497",
"0.57022184",
"0.5698555",
"0.5682786",
"0.56825805",
"0.56667554",
"0.5640081",
"0.55900246",
"0.5550005",
"0.5549612",
"0.5542487",
"0.55327433",
"0.55327433",
"0.55327433",
"0.55327433",
"0.5... | 0.5389164 | 41 |
Initialise vis to zero | def subtract_list_rsexecute_workflow(vis_list, model_vislist):
def subtract_vis(vis, model_vis):
if vis is not None and model_vis is not None:
assert vis.vis.shape == model_vis.vis.shape
subvis = copy_visibility(vis)
subvis.data['vis'][...] -= model_vis.data['vis'][.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_val(self):\r\n self.piDD = {\"[0]\": None}\r\n self.top_node = \"[0]\"\r\n self.dim = 0",
"def reset(self):\n self.vrp = np.matrix([0.5, 0.5, 1])\n self.vpn = np.matrix([0, 0, -1])\n self.vup = np.matrix([0, 1, 0])\n self.u = np.matrix([-1... | [
"0.65430075",
"0.64423335",
"0.62854856",
"0.62633216",
"0.6253321",
"0.61240476",
"0.61044306",
"0.6034534",
"0.6009091",
"0.5985747",
"0.5944535",
"0.5922485",
"0.59104985",
"0.58969736",
"0.587928",
"0.587928",
"0.5831363",
"0.5830789",
"0.5817454",
"0.5812973",
"0.5804873... | 0.0 | -1 |
Return the indices to access the main diagonal of an array. This returns a tuple of indices that can be used to access the main diagonal of an array `a` with ``a.ndim >= 2`` dimensions and shape (n, n, ..., n). For ``a.ndim = 2`` this is the usual diagonal, for ``a.ndim > 2`` this is the set of indices to access ``a[i,... | def diag_indices(n, ndim=2):
if not use_origin_backend():
return dpnp_diag_indices(n, ndim)
return call_origin(numpy.diag_indices, n, ndim) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diag_indices_from(arr):\r\n if not arr.ndim >= 2:\r\n raise ValueError(\"input array must be at least 2-d\")\r\n # For more than d=2, the strided formula is only valid for arrays with\r\n # all dimensions equal, so we check first.\r\n if not np.alltrue(np.diff(arr.shape) == 0):\r\n ra... | [
"0.7509054",
"0.7201259",
"0.6723513",
"0.6711043",
"0.6544171",
"0.6404387",
"0.6400527",
"0.6351556",
"0.60011303",
"0.59391266",
"0.58532995",
"0.5847233",
"0.57977563",
"0.5768509",
"0.57478285",
"0.5586564",
"0.55724573",
"0.5544645",
"0.5503688",
"0.54895085",
"0.546117... | 0.72843957 | 1 |
Fill the main diagonal of the given array of any dimensionality. | def fill_diagonal(x1, val, wrap=False):
x1_desc = dpnp.get_dpnp_descriptor(
x1, copy_when_strides=False, copy_when_nondefault_queue=False
)
if x1_desc:
if not dpnp.isscalar(val):
pass
elif wrap:
pass
else:
return dpnp_fill_diagonal(x1_desc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_diagonal(a, val):\r\n if a.ndim < 2:\r\n raise ValueError(\"array must be at least 2-d\")\r\n if a.ndim == 2:\r\n # Explicit, fast formula for the common case. For 2-d arrays, we\r\n # accept rectangular ones.\r\n step = a.shape[1] + 1\r\n else:\r\n # For more ... | [
"0.72042817",
"0.70015347",
"0.6184623",
"0.61286557",
"0.6121873",
"0.6121106",
"0.59764576",
"0.5896961",
"0.5860227",
"0.58451974",
"0.57844436",
"0.575592",
"0.5752201",
"0.5733814",
"0.5704479",
"0.5679554",
"0.56731564",
"0.5656351",
"0.5649483",
"0.56168133",
"0.561372... | 0.6312966 | 2 |
Return the indices for the lowertriangle of an (n, m) array. | def tril_indices(n, k=0, m=None):
if not use_origin_backend():
if (
isinstance(n, int)
and isinstance(k, int)
and (isinstance(m, int) or m is None)
):
return dpnp_tril_indices(n, k, m)
return call_origin(numpy.tril_indices, n, k, m) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _low_tri_indices(rowCount):\n for col in range(rowCount):\n for row in range(col, rowCount):\n yield (row, col)",
"def _flatten_lower_triangle(matrix):\r\n matrix = asarray(matrix)\r\n flattened = []\r\n for col_num in range(matrix.shape[1]):\r\n for row_num i... | [
"0.6632413",
"0.651317",
"0.61999875",
"0.6149673",
"0.6054602",
"0.6026888",
"0.6000603",
"0.59543365",
"0.5811206",
"0.58066785",
"0.5784669",
"0.5767507",
"0.57208514",
"0.57076603",
"0.56896436",
"0.56888974",
"0.56660885",
"0.559562",
"0.55241835",
"0.54831445",
"0.54570... | 0.574315 | 12 |
Return the indices for the lowertriangle of arr. See `tril_indices` for full details. | def tril_indices_from(x1, k=0):
x1_desc = dpnp.get_dpnp_descriptor(x1, copy_when_nondefault_queue=False)
if x1_desc:
if isinstance(k, int):
return dpnp_tril_indices_from(x1_desc, k)
return call_origin(numpy.tril_indices_from, x1, k) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tril_indices_from(arr, k=0):\r\n if not arr.ndim == 2 and arr.shape[0] == arr.shape[1]:\r\n raise ValueError(\"input array must be 2-d and square\")\r\n return tril_indices(arr.shape[0], k)",
"def tril_indices_from(arr,k=0):\r\n if not arr.ndim==2 and arr.shape[0] == arr.shape[1]:\r\n ... | [
"0.7034582",
"0.70254475",
"0.6488875",
"0.64651436",
"0.6248233",
"0.581059",
"0.5507612",
"0.5407239",
"0.53326523",
"0.52916294",
"0.52178437",
"0.52091914",
"0.51940763",
"0.51806957",
"0.5129162",
"0.5123828",
"0.5119884",
"0.5080559",
"0.5043861",
"0.50393784",
"0.50261... | 0.47562775 | 42 |
Return the indices for the lowertriangle of arr. See `tril_indices` for full details. | def triu_indices_from(x1, k=0):
x1_desc = dpnp.get_dpnp_descriptor(x1, copy_when_nondefault_queue=False)
if x1_desc:
if isinstance(k, int):
return dpnp_triu_indices_from(x1_desc, k)
return call_origin(numpy.triu_indices_from, x1, k) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tril_indices_from(arr, k=0):\r\n if not arr.ndim == 2 and arr.shape[0] == arr.shape[1]:\r\n raise ValueError(\"input array must be 2-d and square\")\r\n return tril_indices(arr.shape[0], k)",
"def tril_indices_from(arr,k=0):\r\n if not arr.ndim==2 and arr.shape[0] == arr.shape[1]:\r\n ... | [
"0.70347923",
"0.7025479",
"0.6488559",
"0.64649844",
"0.6248358",
"0.5810832",
"0.55061513",
"0.5406894",
"0.5333588",
"0.5292096",
"0.5217424",
"0.5210979",
"0.5193901",
"0.51796436",
"0.5128355",
"0.51235986",
"0.5119533",
"0.50797623",
"0.5043177",
"0.50401634",
"0.502484... | 0.4857674 | 32 |
Indent a piece of text >>> indent('foo', 2) ' foo' | def indent(txt, indent_level):
indent = " " * indent_level
return "\n".join(indent + x for x in txt.splitlines()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indent(text, indentation, width=None, pad_character=\" \"):\n\n text = pad_character * indentation + text\n length = len(text)\n if width is None or length >= width:\n return text\n else:\n return text + pad_character * (width - length)",
"def test_with_custom_indent(self):\n ... | [
"0.762066",
"0.75938344",
"0.75596863",
"0.75522655",
"0.75247884",
"0.7410682",
"0.7383349",
"0.7252793",
"0.7182894",
"0.71797156",
"0.7140565",
"0.7137154",
"0.71030474",
"0.69331497",
"0.6837189",
"0.68355626",
"0.6828428",
"0.67914003",
"0.6766136",
"0.6732986",
"0.67170... | 0.7379605 | 7 |
Map COCO label to the label as used in the network. COCO has some gaps in the order of labels. The highest label is 90, but there are 80 classes. | def coco_label_to_label(self, coco_label):
return self.coco_labels_inverse[coco_label] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_to_coco_label(self, label):\n\t\t\treturn self.coco_labels[label]",
"def label_to_coco_label(self, label):\n\t\treturn self.coco_labels[label]",
"def coco_label_to_label(self, coco_label):\n\t\treturn self.coco_labels_inverse[coco_label]",
"def encode_label(self, label: str) -> int:\n return... | [
"0.74940825",
"0.74790096",
"0.70399916",
"0.6625426",
"0.66040874",
"0.65989256",
"0.64932394",
"0.6396858",
"0.6386402",
"0.6285412",
"0.6259594",
"0.6254257",
"0.6246658",
"0.6232594",
"0.6180478",
"0.618007",
"0.61775374",
"0.61768925",
"0.61744547",
"0.6146207",
"0.61203... | 0.70501995 | 2 |
Map label as used by the network to labels as used by COCO. | def label_to_coco_label(self, label):
return self.coco_labels[label] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_to_coco_label(self, label):\n\t\treturn self.coco_labels[label]",
"def coco_label_to_label(self, coco_label):\n\t\t\treturn self.coco_labels_inverse[coco_label]",
"def convert_label(self, label, inverse=False):\n temp = label.copy()\n if inverse:\n for v, k in self.label_mapp... | [
"0.7353909",
"0.7132376",
"0.71051466",
"0.7097489",
"0.70172864",
"0.6749313",
"0.67024726",
"0.67011404",
"0.66478014",
"0.64697915",
"0.64385986",
"0.6426931",
"0.64177734",
"0.6409265",
"0.6329057",
"0.6329057",
"0.6329057",
"0.6329057",
"0.6329057",
"0.6329057",
"0.63290... | 0.7404801 | 0 |
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments. | def __init__(self, *args, **kwds):
if args or kwds:
super(ultrasnd_bump_ranges, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.sensor_FL is None:
self.sensor_FL = sensor_msgs.msg.Range()
if self.sensor_FR is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ... | [
"0.77938056",
"0.77205795",
"0.77205795",
"0.76868427",
"0.7626071",
"0.75641125",
"0.74400353",
"0.7417306",
"0.73512256",
"0.7308259",
"0.7279964",
"0.7237508",
"0.7226711",
"0.7224395",
"0.7224395",
"0.721927",
"0.72118485",
"0.72118485",
"0.72118485",
"0.72118485",
"0.721... | 0.0 | -1 |
Get the application manager >>> gaudi = appMgr() | def appMgr( *varg , **kwarg ) :
import GaudiPython.Bindings
_g = GaudiPython.Bindings.AppMgr()
if not 'LoKiSvc' in _g.ExtSvc :
logger.debug ('appMgr: add LoKiSvc into the list of services')
_g.ExtSvc += [ 'LoKiSvc']
return _g | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_app():\n return ApplicationContainer()",
"def get_app(self):\n return Application()",
"def get_app(self):\n\n app = APP\n return app",
"def create_manager(app, db):\n manager = Manager(app)\n\n manager.add_command(\"runserver\", Server())\n\n def make_shell_context():... | [
"0.7028973",
"0.69332486",
"0.6882315",
"0.6703557",
"0.66614586",
"0.664636",
"0.6642488",
"0.66126275",
"0.6611206",
"0.6591387",
"0.65472484",
"0.65364695",
"0.65059197",
"0.6473368",
"0.64588016",
"0.63930583",
"0.6366299",
"0.6326191",
"0.62882495",
"0.62799424",
"0.6262... | 0.71114546 | 0 |
Event method which fired when clicked on category button. This method change set active color to button and remove active color from last pressed. | def on_event(self, obj):
try:
self.last_category_btn._active = False
self.last_category_btn = obj
except AttributeError:
pass
obj._active = True
self.last_category_btn = obj
# Add object text to cache.
Cache.register('popup')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def category_clicked(self, b, l):\n for rd in self.row_detail_list:\n frame = rd.frame\n button = rd.button\n label = rd.label\n if button == b:\n # Change the button's bg state, on->off, off->on\n if self.button_off == b.cget('backgr... | [
"0.6826316",
"0.6171762",
"0.60939556",
"0.60360026",
"0.5866947",
"0.5815591",
"0.5683557",
"0.5679842",
"0.5603377",
"0.55978477",
"0.55851203",
"0.55566305",
"0.55518246",
"0.5510309",
"0.5502518",
"0.5496946",
"0.5493166",
"0.5476365",
"0.54399365",
"0.5432378",
"0.542118... | 0.62314457 | 1 |
Returns a list of (row, column) of the microboards that are not in progress. | def dead_boards(self):
return [(i, j) for i in range(self.SIZE) for j in range(self.SIZE)
if self.boards[i][j].state != State.IN_PROGRESS] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_boards(self):\n return [(i, j) for i in range(self.SIZE) for j in range(self.SIZE)\n if self.boards[i][j].state == State.IN_PROGRESS]",
"def available_boards(self):\n if self.state != State.IN_PROGRESS:\n return []\n if self.last_move is None:\n ... | [
"0.6932786",
"0.689234",
"0.63788104",
"0.63622457",
"0.61861163",
"0.60671705",
"0.60419524",
"0.58892214",
"0.58532095",
"0.58500224",
"0.5846342",
"0.58343816",
"0.5833571",
"0.58002704",
"0.5796479",
"0.57695395",
"0.5763258",
"0.5677295",
"0.5672112",
"0.56553423",
"0.56... | 0.74619794 | 0 |
Converts a list of positions to a list of coordinates. | def positions_to_coords(self, positions):
return [self.to_coords(px, py) for (px, py) in positions] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coords_to_positions(self, coords):\n return [self.to_position(x, y, i, j) for (x, y, i, j) in coords]",
"def convert_coords(self, coords):\n xPos = int(int(coords[0]) / 8)\n yPos = int(coords[1])\n zPos = int(int(coords[2]) / 8)\n return list(xPos, yPos, zPos)",
"def tran... | [
"0.78465486",
"0.7595234",
"0.7337049",
"0.69677883",
"0.694678",
"0.68619525",
"0.6828317",
"0.66921467",
"0.6684557",
"0.6652641",
"0.66280186",
"0.655122",
"0.6532961",
"0.65119773",
"0.6510043",
"0.65077305",
"0.6440565",
"0.6401034",
"0.63955045",
"0.6390808",
"0.6384458... | 0.8763649 | 0 |
Returns the positions of the empty squares in the (x, y) microboard. | def board_empty_positions(self, x, y):
board = self.boards[x][y]
coords = [(x, y, i, j) for (i, j) in board.empty_squares]
return self.coords_to_positions(coords) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_empty_squares(self):\n empty = []\n for row in range(self._dim):\n for col in range(self._dim):\n if self._board[row][col] == EMPTY:\n empty.append((row, col))\n return empty",
"def findEmpty(grid):\n for x in range(len(grid.board)):\n ... | [
"0.7675395",
"0.7427548",
"0.74162483",
"0.72706157",
"0.7230784",
"0.71896905",
"0.71839726",
"0.71546406",
"0.70307463",
"0.69531125",
"0.6914825",
"0.6908713",
"0.68680567",
"0.6814875",
"0.68070716",
"0.6798365",
"0.6760187",
"0.6730189",
"0.6724424",
"0.6709463",
"0.6635... | 0.8520883 | 0 |
A list of (row, column) of the boards that can currently be played. Note Depends on the last move that was made. Returns and empty list if the game has ended. | def available_boards(self):
if self.state != State.IN_PROGRESS:
return []
if self.last_move is None:
return self.active_boards
x, y = self.last_move[-2:]
if self.boards[x][y].state == State.IN_PROGRESS:
return [(x, y)]
return self.active_boards | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_moves(self):\n moves = []\n for x, y in self.available_boards:\n moves.extend([self.to_position(x, y, i, j) for (i, j)\n in self.boards[x][y].empty_squares])\n return moves",
"def board(self):\n board = []\n if self.flop:\n ... | [
"0.774374",
"0.75606424",
"0.7554614",
"0.7425093",
"0.7422024",
"0.7325879",
"0.7240538",
"0.71517295",
"0.71286005",
"0.7125563",
"0.7078192",
"0.70760834",
"0.70557404",
"0.70445454",
"0.70286703",
"0.7012792",
"0.700108",
"0.6990339",
"0.69839114",
"0.69794774",
"0.697929... | 0.79699796 | 0 |
Piecewise constant rate decay | def adjust_LR(optimizer, params, iternum):
if params.distributed and iternum<5000:
lr = params.ngpu*params.lr*(iternum/5000.) #warmup for distributed training
elif iternum<40000:
lr = params.ngpu*params.lr
elif iternum>80000:
lr = params.ngpu*params.lr/4.
else:
lr = params.ngpu*params.lr/2.
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lr_decay(step):\n return(alpha / (1 + decay_rate * step))",
"def decay(time_, max_time, coeff):\n threshold = max_time - time_\n if threshold < 0:\n threshold = 0\n return 1 + threshold * coeff / max_time",
"def learning_rate_decay(alpha, decay_rate, global_step, decay_step):... | [
"0.7184676",
"0.7151",
"0.6972033",
"0.6944004",
"0.6844918",
"0.6824816",
"0.6808663",
"0.6755175",
"0.6737918",
"0.6736758",
"0.67278385",
"0.65981436",
"0.65533",
"0.65466195",
"0.65313286",
"0.65204865",
"0.65078783",
"0.6507144",
"0.65016824",
"0.6433559",
"0.64312303",
... | 0.0 | -1 |
Returns the Channels Group name that sockets should subscribe to to get sent messages as they are generated. | def group_name(self):
return f"PrivateChatRoom-{self.id}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_name(self):\n\t\treturn \"DocumentChat-%s\" % self.id",
"def _get_peer_group_name(self):\n return self.__peer_group_name",
"def _get_peer_group_name(self):\n return self.__peer_group_name",
"def get_group_name(self):\n return self.groupname",
"def websocket_group(self):\n ... | [
"0.670286",
"0.64731055",
"0.64731055",
"0.6465609",
"0.6432694",
"0.6427493",
"0.64241916",
"0.63124985",
"0.6228399",
"0.6200603",
"0.6188457",
"0.61687344",
"0.61072105",
"0.6095847",
"0.6086761",
"0.6079826",
"0.60528266",
"0.6047977",
"0.6019547",
"0.60041517",
"0.598001... | 0.636664 | 7 |
Set up demo sensor component. | async def setup_sensor(hass):
with assert_setup_component(1, DOMAIN):
with patch(
"coinmarketcap.Market.ticker",
return_value=json.loads(load_fixture("coinmarketcap.json")),
):
await async_setup_component(hass, DOMAIN, VALID_CONFIG)
await hass.async_bl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setup_sensor ( self ):\n self.spectral = Spectral ( np.array([450, 520, 630, 770., 1550, 2090.] ),\n np.array([ 520, 600, 690, 900., 1750., 2350.] ) )",
"def _setup_sensor ( self ):\n self.spectral = Spectral ( np.array([500, 610, 780, 1580.] ),\n ... | [
"0.72778505",
"0.7264898",
"0.709196",
"0.7046888",
"0.68963224",
"0.6841064",
"0.6797749",
"0.6728898",
"0.6699166",
"0.66209054",
"0.65738267",
"0.6491785",
"0.6445568",
"0.6439169",
"0.6399313",
"0.6370208",
"0.633794",
"0.6321074",
"0.6306411",
"0.6281473",
"0.62295043",
... | 0.58558387 | 45 |
Subsets arrays of latitude/longitude based on bounding box bbox. | def spatialSubset(lat, lon, res, bbox):
if bbox is None:
i1 = 0
i2 = len(lat)-1
j1 = 0
j2 = len(lat)-1
else:
i1 = np.where(bbox[3] <= lat+res/2)[0][-1]
i2 = np.where(bbox[1] >= lat-res/2)[0][0]
j1 = np.where(bbox[0] >= lon-res/2)[0][-1]
j2 = np.whe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spatial_subset(dataset: xr.Dataset,\n bbox: Tuple[float, float, float, float]) -> xr.Dataset:\n x1, y1, x2, y2 = bbox\n gm = GridMapping.from_dataset(dataset)\n x_name, y_name = gm.xy_dim_names\n return dataset.sel({\n x_name: slice(x1, x2),\n y_name: slice(y1, y2) i... | [
"0.6847254",
"0.67195773",
"0.6355607",
"0.61254656",
"0.60867727",
"0.59469163",
"0.5942941",
"0.5810177",
"0.5789857",
"0.5778183",
"0.5774886",
"0.5773705",
"0.57532984",
"0.5749234",
"0.57249373",
"0.57244897",
"0.57038033",
"0.5684938",
"0.5673543",
"0.5670527",
"0.56559... | 0.67835903 | 1 |
Returns a handle to the open db | def open_db(self):
# if it is not open, open it.
if self.h5file.isopen is True:
return self.h5file
else:
self.h5file = tb.open_file(filename=self.filepath, mode='a')
assert self.h5file.isopen
return self.h5file | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_open():\n if not hasattr(g, 'sqlite_db'):\n g.sqlite_db = db_connect()\n return g.sqlite_db",
"def db( self ):\n #TODO: backoff\n if self._db is None:\n self._db = self._GetNewConnection()\n try:\n self._db.isolation_level\n except (Operationa... | [
"0.83070475",
"0.7636089",
"0.7461812",
"0.7460148",
"0.7375598",
"0.73638463",
"0.73577404",
"0.73568666",
"0.73568666",
"0.73388135",
"0.7320596",
"0.73168576",
"0.7314311",
"0.73073894",
"0.73073894",
"0.73073894",
"0.73073894",
"0.73073894",
"0.73073894",
"0.73073894",
"0... | 0.70266247 | 57 |
Send a message to a Slack channel | def send_message(channel, message):
slack_client = get_client()
slack_client.chat_postMessage(channel=channel, text=message, as_user=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_slack(self, message):\n self.slack_client.api_call('chat.postMessage', channel=self.slack_channel, text=message, username=self.username, icon_emoji=self.slack_icon_emoji)\n print(\"Slack Notification sent\")",
"def send_message(self, message, channel=None):\n if channel is None:\n ... | [
"0.8452188",
"0.75959665",
"0.7583485",
"0.75428313",
"0.7518934",
"0.7410864",
"0.740807",
"0.73787814",
"0.733253",
"0.7301877",
"0.7292195",
"0.72433656",
"0.72247636",
"0.71636206",
"0.70723706",
"0.70295864",
"0.701135",
"0.7007289",
"0.6955343",
"0.69254154",
"0.6881214... | 0.82427996 | 1 |
Test the usage of WAGTAILIMAGES_RENDITION_STORAGE setting. | def test_custom_rendition_backend_setting(self):
# when setting is not set, instance.get_storage() returns DefaultStorage
from django.conf import settings
bkp = settings
self.assertFalse(hasattr(settings, "WAGTAILIMAGES_RENDITION_STORAGE"))
rendition1 = self.image.get_rendition... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testDetectStorage(self):\n for container_obj in self.explorer_object.GetAllContainers():\n self.assertIsNotNone(container_obj.storage_object)\n self.assertEqual(container_obj.storage_name, self.driver)\n self.assertIsInstance(container_obj.storage_object, self.driver_class)\n\n self.asse... | [
"0.5773004",
"0.5429259",
"0.5236815",
"0.5195423",
"0.51159537",
"0.51154757",
"0.50972825",
"0.5079197",
"0.5077654",
"0.50736624",
"0.5062422",
"0.5058318",
"0.5055173",
"0.5033905",
"0.5026569",
"0.50238085",
"0.50220966",
"0.4985398",
"0.49820104",
"0.49553493",
"0.49545... | 0.6267552 | 0 |
Do not return anything, modify head inplace instead. | def reorderList(self, head: ListNode) -> None:
if not head:
return None
def reverse(head):
newnode = None
cur = head
while cur:
nextnode = cur.next
cur.next=newnode
newnode = cur
cur = nextno... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def head(self, head):\n\n self._head = head",
"def move_to_head(self, node):\n if node is self.head:\n return\n value = node.value\n self.delete(node)\n self.add_to_head(value)",
"def _move_to_head(self, node):\n self._remove_node(node)\n self._add_no... | [
"0.7218526",
"0.6802109",
"0.6732775",
"0.6622557",
"0.65217346",
"0.6466963",
"0.64551795",
"0.63585746",
"0.63523316",
"0.63093",
"0.62923217",
"0.6231313",
"0.622523",
"0.62005043",
"0.62005043",
"0.62005043",
"0.62005043",
"0.6198878",
"0.6193791",
"0.61740905",
"0.614918... | 0.5889327 | 50 |
hides the twitter sidebar | def hide_twitter(self):
# -- change the button
self.twitter_hide.config(text='twitter disabled', state='disabled')
self.twitter_hide.config(command=self.show_twitter)
self.twitter_canvas.pack_forget()
self.twitter_scrollbar.pack_forget() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide_streamlit_widgets():\n hide_streamlit_style = \"\"\"\n <style>\n #MainMenu {visibility: hidden;}\n footer {visibility: hidden;}\n </style>\n \"\"\"\n st.markdown(hide_streamlit_style, unsafe_allow_html=True)",
"def show_twitter(self):\n\n ... | [
"0.68529576",
"0.66963774",
"0.66019416",
"0.6267375",
"0.62664866",
"0.62535197",
"0.622573",
"0.6195629",
"0.618743",
"0.61666375",
"0.61114204",
"0.6073434",
"0.60277617",
"0.60094136",
"0.59928006",
"0.59812856",
"0.5971421",
"0.59464055",
"0.5944246",
"0.5917891",
"0.584... | 0.77250206 | 0 |
Formats given str to a standard capitalization where all the first letters of a word are capitalized. | def correctCasing(words):
strings = words.split(' ')
strings = [s[0].upper()+s[1:].lower() for s in strings if s]
return ' '.join(strings) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_camel(text):\r\n\toutput = \"\"\r\n\tfor i,w in enumerate(text.split(\" \")):\r\n\t\tif i > 0:\r\n\t\t\toutput += w[0].upper() + w[1:]\r\n\t\telse:\r\n\t\t\toutput += w\r\n\treturn output",
"def word_capital(text):\n if text and len(text) > 0:\n return ' '.join([s[0].upper() + s[1:] for s in... | [
"0.76766455",
"0.74730504",
"0.73742115",
"0.7327242",
"0.72558063",
"0.72036535",
"0.7159741",
"0.71288484",
"0.7050965",
"0.7030794",
"0.7025328",
"0.7011357",
"0.70083785",
"0.6992886",
"0.697988",
"0.6949886",
"0.6912652",
"0.6910061",
"0.6896121",
"0.689269",
"0.68669033... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.