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 |
|---|---|---|---|---|---|---|
Return a dict describing specific share_type. | def share_type_get(context, id, inactive=False, expected_fields=None):
return _share_type_get(context, id,
inactive=inactive,
expected_fields=expected_fields) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def share_type(self) -> str:\n return pulumi.get(self, \"share_type\")",
"def show(self, request, share_group_type, brief=False):\n group_specs = share_group_type.get('group_specs', {})\n trimmed = {\n 'id': share_group_type.get('id'),\n 'name': share_group_type.get('na... | [
"0.7599542",
"0.63352895",
"0.5867481",
"0.58611745",
"0.5775167",
"0.5661621",
"0.55869496",
"0.552379",
"0.5515766",
"0.54465795",
"0.5338959",
"0.53073204",
"0.5298667",
"0.5298667",
"0.5296755",
"0.5286627",
"0.5221658",
"0.5210798",
"0.51772636",
"0.5171201",
"0.5157234"... | 0.53623205 | 10 |
Return a dict describing specific share_type. | def share_type_get_by_name(context, name):
return _share_type_get_by_name(context, name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def share_type(self) -> str:\n return pulumi.get(self, \"share_type\")",
"def show(self, request, share_group_type, brief=False):\n group_specs = share_group_type.get('group_specs', {})\n trimmed = {\n 'id': share_group_type.get('id'),\n 'name': share_group_type.get('na... | [
"0.7599542",
"0.63352895",
"0.5867481",
"0.58611745",
"0.5661621",
"0.55869496",
"0.552379",
"0.5515766",
"0.54465795",
"0.53623205",
"0.5338959",
"0.53073204",
"0.5298667",
"0.5298667",
"0.5296755",
"0.5286627",
"0.5221658",
"0.5210798",
"0.51772636",
"0.5171201",
"0.5157234... | 0.5775167 | 4 |
Returns a dict describing all share group types with name as key. | def share_group_type_get_all(context, inactive=False, filters=None):
filters = filters or {}
read_deleted = "yes" if inactive else "no"
query = _share_group_type_get_query(context, read_deleted=read_deleted)
if 'is_public' in filters and filters['is_public'] is not None:
the_filter = [models.Sh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def share_group_type_get_by_name(context, name):\n return _share_group_type_get_by_name(context, name)",
"def get_group_types(self):\r\n pass",
"def index(self, request, share_group_types):\n share_group_types_list = [\n self.show(request, share_group_type, True)\n for sh... | [
"0.6792551",
"0.64913136",
"0.61399317",
"0.5866723",
"0.570285",
"0.564245",
"0.56116456",
"0.55353177",
"0.55273086",
"0.5479436",
"0.5473836",
"0.5473627",
"0.5461394",
"0.54133433",
"0.5397936",
"0.5382075",
"0.5370627",
"0.5366472",
"0.5350147",
"0.52961946",
"0.52433825... | 0.6167982 | 2 |
Return a dict describing specific share group type. | def share_group_type_get(context, type_id, inactive=False,
expected_fields=None):
return _share_group_type_get(
context,
type_id,
inactive=inactive,
expected_fields=expected_fields,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show(self, request, share_group_type, brief=False):\n group_specs = share_group_type.get('group_specs', {})\n trimmed = {\n 'id': share_group_type.get('id'),\n 'name': share_group_type.get('name'),\n 'is_public': share_group_type.get('is_public'),\n 'gr... | [
"0.66086686",
"0.63793206",
"0.63682157",
"0.6267899",
"0.57734114",
"0.5747441",
"0.5690068",
"0.5605911",
"0.54958236",
"0.537018",
"0.5324498",
"0.5298473",
"0.52555925",
"0.5245522",
"0.52417976",
"0.5225783",
"0.52123576",
"0.5156781",
"0.51498306",
"0.5142712",
"0.51270... | 0.6000374 | 4 |
Return a dict describing specific share group type. | def share_group_type_get_by_name(context, name):
return _share_group_type_get_by_name(context, name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show(self, request, share_group_type, brief=False):\n group_specs = share_group_type.get('group_specs', {})\n trimmed = {\n 'id': share_group_type.get('id'),\n 'name': share_group_type.get('name'),\n 'is_public': share_group_type.get('is_public'),\n 'gr... | [
"0.66086686",
"0.63682157",
"0.6267899",
"0.6000374",
"0.57734114",
"0.5747441",
"0.5690068",
"0.5605911",
"0.54958236",
"0.537018",
"0.5324498",
"0.5298473",
"0.52555925",
"0.5245522",
"0.52417976",
"0.5225783",
"0.52123576",
"0.5156781",
"0.51498306",
"0.5142712",
"0.512709... | 0.63793206 | 1 |
Linear growth function D(z) = ( P(k_ls, z) / P(k_ls, 0) )^(1 / 2) where k_ls is a largescale mode. | def D(z):
k=0.01 #Our choice of large-scale mode
mPk=cosmo.pk(k,z)
mPk_norm=cosmo.pk(k,0) #Normalize at z=0
D=np.sqrt(mPk/mPk_norm)
return D | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dL(n):\n\n\t#[TODO]: allow evaluation at 0\n\tif (n==0):\n\t\treturn lambda x: 0.0\n\n\telif (n==1):\n\t\treturn lambda x: 1.0\n\n\telse:\n\t\treturn lambda x: (n/(x**2-1.0))*(x*L(n)(x)-L(n-1)(x))",
"def growth_factor_scale_independent(self, z):\n z = np.atleast_1d(z)\n nz = len(z)\n #i... | [
"0.6580644",
"0.64123625",
"0.63065654",
"0.6275439",
"0.6245346",
"0.6227368",
"0.62014604",
"0.6199757",
"0.6151309",
"0.6131798",
"0.60738975",
"0.6067908",
"0.6066276",
"0.60455626",
"0.60241914",
"0.6024054",
"0.6013475",
"0.5996553",
"0.5969095",
"0.595429",
"0.595327",... | 0.57514256 | 40 |
Returns the last event code. | def get_last_event(self):
return self.last_event_code | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getLastCode(self):\r\n codePtr = (c_ubyte * IR_MAX_CODE_DATA_LENGTH)(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)\r\n dataLength = c_int(IR_MAX_CODE_DATA_LENGTH)\r\n bitCount = c_int()\r\n \r\n try:\r\n result = PhidgetLibrary.getDll().CPhidgetIR_getLastCode(self.handle, codeP... | [
"0.70872533",
"0.6814062",
"0.66867954",
"0.66867954",
"0.66867954",
"0.66867954",
"0.6582909",
"0.65352017",
"0.6501769",
"0.6501769",
"0.6501769",
"0.6501769",
"0.6387225",
"0.63770485",
"0.63770485",
"0.62900376",
"0.6274337",
"0.62576896",
"0.6233677",
"0.62091607",
"0.61... | 0.88466984 | 0 |
Extracts the alarm type of the last event. | def parse_alarm_type(self):
alarm_type = -1
if self.last_event_code == DEFS.EF_ALARM:
alarm_type = struct.unpack('<I', self.last_payload_data[0:4])[0]
return alarm_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def getAlarmType(self):\n alarm_type = await self.director.getItemVariableValue(\n self.item_id, \"ALARM_TYPE\"\n )\n return alarm_type",
"def parse_duress_alarm(self):\n alarm_type = -1\n sn = -1\n match_type = -1\n if self.last_event_code == DEF... | [
"0.7393886",
"0.69021285",
"0.6724789",
"0.6363997",
"0.6363997",
"0.6309759",
"0.6280452",
"0.6211571",
"0.6059114",
"0.60540503",
"0.60424227",
"0.5948542",
"0.5940614",
"0.580431",
"0.5768554",
"0.57658416",
"0.5725203",
"0.57034737",
"0.558573",
"0.5576005",
"0.5549473",
... | 0.8178578 | 0 |
Don't populate the QuerySet's cache. | def __deepcopy__(self, memo):
obj = self.__class__()
for k, v in self.__dict__.items():
if k == '_result_cache':
obj.__dict__[k] = None
else:
obj.__dict__[k] = copy.deepcopy(v, memo)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fullcache(self):\n query = {\n \"%s__id\" % self._model: self._objid,\n \"attribute__db_model__iexact\": self._model,\n \"attribute__db_attrtype\": self._attrtype,\n }\n attrs = [\n conn.attribute\n for conn in getattr(self.obj, self.... | [
"0.6475921",
"0.6308672",
"0.62823236",
"0.62717575",
"0.62304044",
"0.6227015",
"0.61912537",
"0.61886054",
"0.61069995",
"0.60589886",
"0.60519135",
"0.6036331",
"0.6032814",
"0.60161376",
"0.6011281",
"0.5991524",
"0.59568286",
"0.59504896",
"0.59284705",
"0.5924011",
"0.5... | 0.0 | -1 |
Return a copy of the current QuerySet that's ready for another operation. | def _chain(self, **kwargs):
obj = self._clone()
obj.__dict__.update(kwargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n if self.queryset is not None:\n queryset = self.queryset\n if hasattr(queryset, '_clone'):\n queryset = queryset._clone()\n elif self.model is not None:\n queryset = self.model._default_manager.all()\n else:\n ... | [
"0.7090652",
"0.70511615",
"0.6928036",
"0.691252",
"0.6898833",
"0.68871284",
"0.67980456",
"0.6774404",
"0.67098683",
"0.6682485",
"0.66766816",
"0.6661091",
"0.661568",
"0.660246",
"0.65837824",
"0.6581859",
"0.65266323",
"0.6508839",
"0.65077555",
"0.6479006",
"0.6446153"... | 0.0 | -1 |
Return a copy of the current QuerySet. A lightweight alternative to deepcopy(). | def _clone(self):
return QueryList(self.model,
query=self._query,
order_by=self._order_by,
limit=self._limit,
offset=self._offset,
fields=self._fields,
links_to_n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return type(self)(*self.__queries, op=self.__op)",
"def copy(self):\n options = {\n 'op': self.__op,\n 'caseSensitive': self.__caseSensitive,\n 'value': copy.copy(self.__value),\n 'inverted': self.__inverted,\n 'functions': co... | [
"0.74110913",
"0.72840685",
"0.7283737",
"0.72821987",
"0.7264214",
"0.7071942",
"0.7017681",
"0.69670343",
"0.69670343",
"0.69670343",
"0.69670343",
"0.69670343",
"0.69670343",
"0.69670343",
"0.69670343",
"0.69670343",
"0.69670343",
"0.69670343",
"0.69670343",
"0.69670343",
... | 0.70115393 | 7 |
Adjust the limits on the rows retrieved. Use low/high to set these, as it makes it more Pythonic to read and write. When the SQL query is created, convert them to the appropriate offset and limit values. Apply any limits passed in here to the existing constraints. Add low to the current low value and clamp both to any ... | def set_limits(self, low=None, high=None):
if high is not None:
if self.high_mark is not None:
self.high_mark = min(self.high_mark, self.low_mark + high)
else:
self.high_mark = self.low_mark + high
if low is not None:
if self.high_mark ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _apply_limits(self):\n for col_name, max_value in self._limits.items():\n if col_name in self._hybrid_meta.columns:\n self._hybrid_meta[col_name].clip(upper=max_value, inplace=True)\n else:\n self.__warn_missing_col(col_name, action='limit')",
"def a... | [
"0.62210375",
"0.59097433",
"0.5792181",
"0.57671666",
"0.57112795",
"0.56369674",
"0.5627255",
"0.5558155",
"0.543625",
"0.54253334",
"0.54031134",
"0.5391999",
"0.5361049",
"0.5333344",
"0.5331543",
"0.53310806",
"0.5326317",
"0.5275779",
"0.52720326",
"0.5271781",
"0.52681... | 0.63579476 | 0 |
Filter this QueryList, returning a new QueryList, as in filter(), but excluding the entries that match the query. | def exclude(self, **query):
if self._query != '':
query = '(%s) AND NOT (%s)' % (self._query, self._build_query(**query))
else:
query = 'NOT (%s)' % self._build_query(**query)
return QueryList(self.model,
query,
order_by... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(self, **query):\n\n if self._query != '':\n query = '(%s) AND (%s)' % (self._query, self._build_query(**query))\n else:\n query = self._build_query(**query)\n\n return QueryList(self.model,\n query,\n order_by=sel... | [
"0.79003847",
"0.7094461",
"0.66947204",
"0.6634113",
"0.6564429",
"0.647687",
"0.6426813",
"0.63923943",
"0.6365282",
"0.6237791",
"0.62324643",
"0.6174498",
"0.61565644",
"0.6104605",
"0.60476923",
"0.6038955",
"0.60336846",
"0.5976058",
"0.5963154",
"0.59194475",
"0.591237... | 0.7761336 | 1 |
Return copy of the field with the new name. | def renamed(self, name: typing.Optional[str]) -> 'Field':
return self if name == self.name else Field(self.kind, name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def give_field(self, name):\n return self.field(name).toPyObject()",
"def copy(self, name=None):\n new = copy.copy(self)\n new.d = copy.copy(self.d)\n new.name = name if name is not None else self.name\n return new",
"def copy(self, default=None):\n default = dict(defa... | [
"0.7090274",
"0.66059613",
"0.6490267",
"0.63923573",
"0.6383547",
"0.63811684",
"0.6325064",
"0.6307568",
"0.6263589",
"0.6248117",
"0.62465984",
"0.6097921",
"0.6085514",
"0.60813636",
"0.60787356",
"0.6038967",
"0.6035843",
"0.59756297",
"0.59595245",
"0.58703417",
"0.5850... | 0.68656135 | 1 |
Computes p. x1 with config distance from p. A and p. x2 with the same distance from p. B. Distance is loaded from config file. Returns None if AB <= that distance (as there's no place for robot maneuvers). | def compute_x1_x2_points(point_a: list, point_b: list, nav: navigation.GPSComputing, logger: utility.Logger):
cur_vec_dist = nav.get_distance(point_a, point_b)
# check if moving vector is too small for maneuvers
if config.MANEUVER_START_DISTANCE * 2 >= cur_vec_dist:
msg = "No place for maneuvers; ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_pbc(cls, config_1, config_2):\n\t\tsorted_data_1 = (config_1.data).sort_values('item')\n\t\tsorted_data_2 = (config_2.data).sort_values('item')\n\t\tbox_dim_1 = config_1.box_dim\n\t\tbox_dim_2 = config_2.box_dim\n\t\ti = 0\n\t\ttotal_distance = 0.0\n\t\tfor index, row in sorted_data_1.iterrows():\n\t\... | [
"0.66381794",
"0.617281",
"0.58285266",
"0.57187575",
"0.56790584",
"0.56317234",
"0.53393227",
"0.53291076",
"0.5327568",
"0.5301465",
"0.5267077",
"0.52484405",
"0.524449",
"0.52416414",
"0.51963055",
"0.5195393",
"0.51694584",
"0.51693875",
"0.516669",
"0.5157362",
"0.5147... | 0.534594 | 6 |
Computes and returns two points on given vector [A, B], where vector [A, X1] = distance, vector [X2, B] = distance | def compute_x1_x2(point_a, point_b, distance, nav: navigation.GPSComputing):
ab_dist = nav.get_distance(point_a, point_b)
if ab_dist < distance:
raise ValueError("Size of AB vector (" + str(ab_dist) + ") should be greater than a given distance: " +
str(distance))
x1 = nav... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vector_between_points(a, b):\n vector_1 = Vector(*a)\n vector_2 = Vector(*b)\n return vector_1 - vector_2",
"def distance_point_point(a, b):\n ab = subtract_vectors(b, a)\n return length_vector(ab)",
"def distance(point_a, point_b):\r\n a_to_b = math.hypot(point_b[0] - point_a[0], point_b... | [
"0.76617485",
"0.74546736",
"0.7388262",
"0.7366128",
"0.73539203",
"0.7295383",
"0.72493315",
"0.7209389",
"0.7199148",
"0.71976787",
"0.7189215",
"0.7186095",
"0.7178589",
"0.71508855",
"0.7110661",
"0.7108085",
"0.7104073",
"0.7094865",
"0.7076874",
"0.7063726",
"0.7061779... | 0.7502885 | 1 |
Gets an empty aligned structure with a packing value of 4 that can be use to create the model's data type. dataTypeManager the data type manager to associate with the structure. categoryPath the structure's category path. structureName the structure's name. the aligned pack(4) structure. | def getAlignedPack4Structure(dataTypeManager: ghidra.program.model.data.DataTypeManager, categoryPath: ghidra.program.model.data.CategoryPath, structureName: unicode) -> ghidra.program.model.data.StructureDataType:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAlignedPack8Structure(dataTypeManager: ghidra.program.model.data.DataTypeManager, categoryPath: ghidra.program.model.data.CategoryPath, structureName: unicode) -> ghidra.program.model.data.StructureDataType:\n ...",
"def get_structure(self, **kwargs):\n return self._structure",
"def get_st... | [
"0.7446103",
"0.5049815",
"0.48233858",
"0.4769579",
"0.46262047",
"0.45964888",
"0.45918387",
"0.4561696",
"0.4544193",
"0.44985858",
"0.44958323",
"0.44935697",
"0.4490168",
"0.4490168",
"0.4490168",
"0.4490168",
"0.4450999",
"0.4350186",
"0.43330878",
"0.42613146",
"0.4223... | 0.7960039 | 0 |
Gets an empty aligned structure with a packing value of 8 that can be use to create the model's data type. dataTypeManager the data type manager to associate with the structure. categoryPath the structure's category path. structureName the structure's name. the aligned pack(8) structure. | def getAlignedPack8Structure(dataTypeManager: ghidra.program.model.data.DataTypeManager, categoryPath: ghidra.program.model.data.CategoryPath, structureName: unicode) -> ghidra.program.model.data.StructureDataType:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAlignedPack4Structure(dataTypeManager: ghidra.program.model.data.DataTypeManager, categoryPath: ghidra.program.model.data.CategoryPath, structureName: unicode) -> ghidra.program.model.data.StructureDataType:\n ...",
"def get_structure(self, **kwargs):\n return self._structure",
"def get_st... | [
"0.76764196",
"0.49147797",
"0.49060437",
"0.4871426",
"0.4722001",
"0.46295336",
"0.461999",
"0.45808893",
"0.4550806",
"0.4456972",
"0.44509262",
"0.44235793",
"0.4393205",
"0.4367509",
"0.43475193",
"0.43469542",
"0.43312076",
"0.43190336",
"0.43190336",
"0.43190336",
"0.4... | 0.7889895 | 0 |
Return a date X months in the past. | def get_pervious_date(months_in_past):
pervious_date = date.today() + relativedelta(months=-months_in_past)
return str(pervious_date) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_month():\n return datetime.now() + relativedelta(months=-1)",
"def get_month_end(x: Optional[Date] = None) -> Date:\n return (x or get_today()).replace(day=1) + relativedelta(months=+1, days=-1)",
"def subtract_months(date, months):\n if months < 0:\n months = abs(months)\n date_x =... | [
"0.71932787",
"0.6477231",
"0.6298433",
"0.6267914",
"0.6209666",
"0.6145608",
"0.61429936",
"0.61170304",
"0.60558724",
"0.6045815",
"0.6026042",
"0.593681",
"0.58584225",
"0.5852549",
"0.57860035",
"0.5760181",
"0.56883526",
"0.5645845",
"0.5607323",
"0.55803835",
"0.547705... | 0.652372 | 1 |
Move list of gradient tensor lists to agent device. | def _gradients_to_device(self, gradients):
device_gradients = []
for grad_list in gradients:
device_gradients.append([param.to(self.agent.device) for param in grad_list])
return device_gradients | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _send_gradients(gradients, dst):\n\n _send(len(gradients), dst)\n for i in gradients:\n dimensions = [int(d) for d in i.shape]\n _send(len(dimensions),dst)\n _send(dimensions,dst)\n param = to_device(i)\n dist.send(param,dst)\n del param \n torch.cuda.empt... | [
"0.62932837",
"0.57849365",
"0.5573537",
"0.5458746",
"0.54105365",
"0.540124",
"0.540124",
"0.5385235",
"0.53768885",
"0.5370238",
"0.5367811",
"0.536342",
"0.5362825",
"0.5358634",
"0.53300595",
"0.5325076",
"0.5290385",
"0.5286284",
"0.5286284",
"0.5284234",
"0.52820593",
... | 0.6817869 | 0 |
Returns whether or not the object is a wildcard. That is, whether or not the object is an instance of Symbol whose string value is exactly equal to the '' character. | def is_wildcard(obj):
return isinstance(obj, Symbol) and obj == Symbol('*') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_simple_symbol(obj):\n return is_symbol(obj) and not is_wildcard(obj)",
"def is_symbol(obj):\n return isinstance(obj, Symbol)",
"def _is_wildcard_match(s, wildcard):\n\n wildcard = wildcard.strip()\n glob_pat = re.compile(r'\\*(:(?P<type>\\w+))?$')\n m = glob_pat.match(wildcard)\n ... | [
"0.81351817",
"0.7313727",
"0.6644093",
"0.629271",
"0.6195242",
"0.6001063",
"0.5986664",
"0.5955236",
"0.5950538",
"0.5897223",
"0.58886915",
"0.5851654",
"0.5846684",
"0.5733313",
"0.57141876",
"0.567706",
"0.5664564",
"0.5651824",
"0.5619864",
"0.55806094",
"0.5563681",
... | 0.88054055 | 0 |
Returns whether or not the object is an instance of the Symbol class. is_symbol(obj) is equivalent to isinstance(obj, Symbol). | def is_symbol(obj):
return isinstance(obj, Symbol) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_simple_symbol(obj):\n return is_symbol(obj) and not is_wildcard(obj)",
"def has_symbol(self, sym):\n return self.symbols.has_key(sym)",
"def is_other_symbol(self, symbol: str) -> bool:\n return symbol in self.other_symbols",
"def isSymbolInContext(self, symbol):\n if ( symbol i... | [
"0.7020286",
"0.6403257",
"0.63280565",
"0.63114697",
"0.62745965",
"0.60521406",
"0.5919178",
"0.5891422",
"0.5774428",
"0.57662183",
"0.57316804",
"0.5718075",
"0.5685631",
"0.5654627",
"0.5637617",
"0.5636153",
"0.56105983",
"0.55659103",
"0.5523737",
"0.5512596",
"0.54929... | 0.8900646 | 0 |
Get all node outputs and return it | def get_node_outputs(node_path):
item = ix.get_item(node_path)
obj_array = ix.api.OfItemArray(1)
obj_array[0] = item
item_outputs = ix.api.OfItemVector()
ix.application.get_factory().get_items_outputs(obj_array, item_outputs, False)
node_outputs = []
for item_ in range(item_outputs.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_node_outputs(node: Node):\n return [port.node for port in get_node_output_ports(node)]",
"def get_outputs(self):\n return self.outputs",
"def test_get_node_outputs(self):\n pass",
"def outputs(self):\r\n return self._outputs",
"def get_outputs(self):\n return self.att... | [
"0.81554884",
"0.7594553",
"0.75542086",
"0.75207025",
"0.7517441",
"0.7503022",
"0.7467006",
"0.74604404",
"0.7332443",
"0.7332443",
"0.73242325",
"0.7284201",
"0.72552294",
"0.72087234",
"0.71353775",
"0.71193033",
"0.70677793",
"0.7053968",
"0.7039275",
"0.7039275",
"0.703... | 0.7385833 | 8 |
Divide the first input by the second, returning a floating point. | def divide(numbers):
quot = numbers[0]
for i in numbers[1:]:
quot = quot / i
return quot | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def divide(num1, num2):\n return float(num1) / float(num2)",
"def division(self, first_value, second_value):\n return first_value / second_value",
"def divide(num1, num2):\n quotient = num1 / float(num2)\n return quotient",
"def divide(number_1, number_2):\n return int(number_1) / float(nu... | [
"0.80836076",
"0.7970918",
"0.7775157",
"0.765765",
"0.75643843",
"0.75231135",
"0.74639845",
"0.74322265",
"0.7423643",
"0.7413171",
"0.7399229",
"0.73723745",
"0.73317844",
"0.7268539",
"0.7233531",
"0.7221742",
"0.7208287",
"0.7107382",
"0.7107382",
"0.7100351",
"0.7081105... | 0.0 | -1 |
Compare data between this record and another (Django model equality only checks that the class is the same) | def _data_equality(self, other):
if self.__class__ is not other.__class__:
raise ValueError('Both classes must be the same')
for field in self._meta.fields:
if getattr(self, field.name, None) != getattr(other, field.name, None):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other) -> bool:\n return (\n isinstance(other, DataModel)\n and self.name == other.name\n and self.attributes == other.attributes\n )",
"def __eq__(self, other: 'StorageRecord') -> bool:\n\n return self.type == other.type and self.id == other... | [
"0.73651606",
"0.7303754",
"0.7283452",
"0.7255152",
"0.7254032",
"0.72129214",
"0.71676755",
"0.715344",
"0.7116822",
"0.71017516",
"0.706823",
"0.70618784",
"0.7053987",
"0.7041721",
"0.7038312",
"0.70206404",
"0.70022327",
"0.6968617",
"0.6925679",
"0.6915004",
"0.6910557"... | 0.7479162 | 0 |
Returns a constant representing the type of the current command. | def command_type(self):
t = self.current_command.split(' ')[0]
if t in commands.get('arithmetic'):
return 'C_ARITHMETIC'
if t not in commands:
raise ValueError('{} is an invalid command type.'.format(t))
return commands.get(t) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_type(self):\n return self._command_type",
"def command_type(self) -> int:\n cur_inst = self._cur()\n if \"push\" in cur_inst:\n return C_PUSH\n elif \"pop\" in cur_inst:\n return C_POP\n elif \"if\" in cur_inst:\n return C_IF\n ... | [
"0.8275591",
"0.8222573",
"0.79069614",
"0.72575396",
"0.71974343",
"0.7033374",
"0.7033374",
"0.7033374",
"0.7033374",
"0.7033374",
"0.7033374",
"0.7033374",
"0.7033374",
"0.7033374",
"0.7033374",
"0.7033374",
"0.7033374",
"0.7033374",
"0.7033374",
"0.7033374",
"0.7033374",
... | 0.850283 | 0 |
returns indexes of all occurrences of motif in dna. | def find_motif(dna:str, motif: str, zero_based=True):
index = 0
result = []
while index >=0:
index = dna.find(motif, index)
if index >=0:
result.append(index)
index += 1
return _helper_for_non_zero_based(result, zero_based) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def occ_indices(self):\n indices = []\n for index,item in enumerate(self):\n if item==1:\n indices.append(index)\n return indices",
"def motif_enumeration(dnas, k, d):\n assert (all(is_dna(dna) for dna in dnas))\n patterns = set()\n for kmer in get_all_kmer... | [
"0.6612105",
"0.64466435",
"0.63014555",
"0.6216831",
"0.60944647",
"0.60843",
"0.60066473",
"0.5974978",
"0.58784235",
"0.58391285",
"0.5795017",
"0.57695556",
"0.5678596",
"0.5656694",
"0.5647883",
"0.5626788",
"0.56123906",
"0.56033146",
"0.5590153",
"0.55546653",
"0.55389... | 0.5891269 | 8 |
For a fixed positive integer k, order all possible kmers taken from an underlying alphabet lexicographically. Then the kmer composition of a string S can be represented by an array A for which A[m] denotes the number of times that the mth kmer (with respect to the lexicographic order) appears in s. | def kmers_composition(dna: str, k: int, alphabet: str = "ACGT"):
dna = Counter(string_to_kmers(dna, k))
for k_mer in enumerate_kmers(alphabet, k):
yield dna[k_mer] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kmers(sequence, alphabet, k):\n mers = (''.join(c) for c in windowed(k, sequence))\n return [mer for mer in mers if all(base in set(alphabet) for base in mer)]",
"def count_kmers(dna: str, k: int, alphabet: str = \"ACGT\"):\n c = Counter(dna[i:i + k] for i in range(len(dna) - k + 1))\n result = ... | [
"0.75062704",
"0.74459386",
"0.71144664",
"0.6991651",
"0.69721043",
"0.69626737",
"0.695381",
"0.69414175",
"0.68969774",
"0.6876552",
"0.68704784",
"0.6858864",
"0.68567955",
"0.6826441",
"0.67877966",
"0.6680244",
"0.6612075",
"0.6591452",
"0.65776825",
"0.65644974",
"0.64... | 0.7214759 | 2 |
Initialize DeepSAD encoder weights with the autoencoder's one. INPUT | None OUTPUT | None | def init_network_weights_from_pretrain(self):
net_dict = self.net.state_dict()
ae_net_dict = self.ae_net.state_dict()
# filter elements of the AE out to keep only those matching DeepSAD's one
ae_net_dict = {k: v for k, v in ae_net_dict.items() if k in net_dict}
# Update the DeepS... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, params, model, name=\"ds2_encoder\", mode='train'):\n super(DeepSpeech2Encoder, self).__init__(params, model, name, mode)",
"def init_weights(self, pretrained=None):\n\n super(EncoderDecoder_gan, self).init_weights(pretrained)\n self.backbone.init_weights(pretrained=pretrained... | [
"0.6440839",
"0.63771695",
"0.6293131",
"0.62732196",
"0.6245427",
"0.6227336",
"0.622177",
"0.6186515",
"0.6179984",
"0.6178436",
"0.61672604",
"0.6159272",
"0.6152302",
"0.6121841",
"0.61204666",
"0.61204666",
"0.61204666",
"0.60775226",
"0.60748845",
"0.6058753",
"0.604593... | 0.6255361 | 4 |
Given a list of lists of acceptable numbers for each position in a row of an array, create every possible row, and return an iterator that returns chunks of every possible row up to chunk_dim, iterating dimensions higher than chunk_dim. This probably doesn't need to be called directly, and may have a _ added in the fut... | def values_chunked(items, endtype, chunk_dim=10):
ilengths = [len(x) for x in items]
n = len(items)
items = [np.array(x) for x in items]
if n > chunk_dim:
p = n - chunk_dim
q = chunk_dim
outer = itertools.product(*(items[0:p]))
else:
p = 0
q = n
def o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yield_chunks(arr, chunk_size):\r\n larr = len(arr)\r\n if larr < chunk_size:\r\n raise ValueError(\"The array length (%d) must be larger than the chunk size (%d)\" % (len(arr), chunk_size))\r\n\r\n cursor = 0\r\n while cursor < larr:\r\n next_cursor = min(cursor + chunk_size, larr)\r\... | [
"0.64305043",
"0.6417426",
"0.64121103",
"0.6371807",
"0.63549274",
"0.62645894",
"0.6186762",
"0.6114411",
"0.6108148",
"0.60908043",
"0.60823673",
"0.5991931",
"0.59647363",
"0.59569263",
"0.5924548",
"0.58766437",
"0.5861701",
"0.5821831",
"0.58052593",
"0.57884896",
"0.57... | 0.7435005 | 0 |
The function of energy with respect to k. | def band_energy(k,t=1.0,e0=0.2,a=1.0):
return e0-t*np.exp(1j*k*a)-t*np.exp(-1j*k*a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def energyK(k):\r\n C1 = 9.7846113e-07\r\n C2 = 12.263868e0 \r\n E = (-1.0 + np.sqrt(1.0 + 4.0 * C1 * C2**2 * k**2))/(2.0 * C1)\r\n return E",
"def get_E(J,k):\n E = -2 * J * np.cos(k) # energyeigenvalue \n return E",
"def energy_func(self):\n i = self.inl[0].to_flow()\n ... | [
"0.87192756",
"0.7800329",
"0.73046273",
"0.72421783",
"0.71629363",
"0.707317",
"0.7021051",
"0.697529",
"0.6894514",
"0.68761",
"0.6796847",
"0.6771052",
"0.67512006",
"0.6749028",
"0.67354774",
"0.6713395",
"0.66902846",
"0.6671225",
"0.664271",
"0.6610011",
"0.6588637",
... | 0.72235274 | 4 |
Build a Request object for the specified user. | def _get_request(self, user=None):
if user is None:
user = self.honor_user
request = Request(self.request_factory.get('/'))
request.user = user
return request | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_request_for_user(user):\r\n\r\n request = RequestFactory()\r\n request.user = user\r\n request.META = {}\r\n request.is_secure = lambda: True\r\n request.get_host = lambda: \"edx.org\"\r\n return request",
"def get_request(self, path='', data=None, user=None, **kwargs):\n request... | [
"0.7835019",
"0.66991776",
"0.6477771",
"0.64524674",
"0.6374441",
"0.62567466",
"0.6233184",
"0.6127998",
"0.6104313",
"0.60953337",
"0.6068585",
"0.6031104",
"0.59862304",
"0.5937616",
"0.5911396",
"0.590447",
"0.590447",
"0.5854125",
"0.5850629",
"0.58036214",
"0.580108",
... | 0.8407432 | 0 |
Return a dict of Spider Queues keyed by project name | def get_spider_queues(config):
dbs_dir = config.get('dbs_dir', 'dbs')
if not os.path.exists(dbs_dir):
os.makedirs(dbs_dir)
d = {}
for project in get_project_list(config):
db_path = os.path.join(dbs_dir, '%s.db' % project)
d[project] = SqliteSpiderQueue(db_path)
return d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_queues():\n url = urlparse(Config.RABBIT_MQ_URL)\n response = requests.get(f'http://{url.hostname}:{15672}/api/queues?columns=name,messages,'\\\n 'messages_ready,messages_unacknowledged',\n auth=(url.username, url.password))\n\n tasks = dict()... | [
"0.68999964",
"0.68014383",
"0.67017436",
"0.66192055",
"0.6599958",
"0.6599958",
"0.6599958",
"0.6599958",
"0.6599958",
"0.6599958",
"0.6599958",
"0.6599958",
"0.6599958",
"0.64772177",
"0.6428108",
"0.6382445",
"0.63523173",
"0.62893635",
"0.62885916",
"0.6259909",
"0.62314... | 0.6984439 | 0 |
This class will help make quick buttons for use with pygame. If 0 is passed into type of button a text button will be made and if a 1 is passed a picture button will be made. The fileortext variable will hold the file name for a picture button or the text to be displayed for a text button. The position variable is the ... | def __init__(self, type_of_button, fileortext, position, midpoint = False, resize = False,fontsize = 36,surface = None):
pygame.sprite.Sprite.__init__(self)
pygame.font.init()
basicfont = pygame.font.Font(None,fontsize)
#Create a text button
if type_of_button == 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, type_of_button, file_or_text, position, midpoint = False, surface = None, **kargs):\n\n # Initialize pygame font and sprite class\n pygame.sprite.Sprite.__init__(self)\n pygame.font.init()\n\n # Unpack the **kargs dictionary into the possible inputs (resize,\n ... | [
"0.7461778",
"0.67816806",
"0.65595084",
"0.6458496",
"0.64234996",
"0.638749",
"0.63419926",
"0.6317025",
"0.62537736",
"0.62516385",
"0.62156427",
"0.6156585",
"0.6126772",
"0.60974205",
"0.60925597",
"0.60789645",
"0.60567236",
"0.60269135",
"0.6008236",
"0.5999021",
"0.59... | 0.7874842 | 0 |
Edit a slash tag's name. | async def slashtag_edit_name(
self, ctx: commands.Context, tag: GuildTagConverter, *, name: TagName(check_global=False)
):
await ctx.send(await tag.edit_name(name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_name(self,new_name):\n self.name = new_name",
"def new_tag_name(self, new_tag_name):\n\n self._new_tag_name = new_tag_name",
"def set_name(self, newname=\"\"):\n self.name = newname",
"def set_name(self, name):\r\n self.stream.set_node_name(self.node, name)",
"def on_pat... | [
"0.6494492",
"0.64555067",
"0.6439629",
"0.63739395",
"0.63311136",
"0.63185096",
"0.63185096",
"0.62848604",
"0.62419856",
"0.62264603",
"0.6212275",
"0.6196641",
"0.6091271",
"0.6073004",
"0.6073004",
"0.60563886",
"0.6053764",
"0.6046871",
"0.6023389",
"0.59926856",
"0.598... | 0.74819034 | 0 |
An iterator splits an amount into several parts, each of which has the length of m. | def islice(n, m):
npiece = int(math.ceil(1.0*n/m))
for i in range(npiece):
if (i+1)*m > n:
yield i, i*m, n
else:
yield i, i*m, (i+1)*m | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks(parts, n):\n for i in range(0, len(parts), n):\n yield parts[i:i+n]",
"def slice(n, m):\n chunks = []\n for piece in islice(n, m):\n chunks.append(piece)\n return chunks",
"def split_chunks(item_list, num_items_in_list):\n for item in range(0, len(ite... | [
"0.6542471",
"0.6506472",
"0.6496692",
"0.6483424",
"0.64685035",
"0.63786733",
"0.6370102",
"0.63678414",
"0.6362699",
"0.6355375",
"0.63548356",
"0.633793",
"0.6317005",
"0.6296236",
"0.6274113",
"0.6266828",
"0.6257481",
"0.624306",
"0.6239139",
"0.6236345",
"0.6232894",
... | 0.6872864 | 0 |
An iterator to return slices from the list, each slice has m elements except for the last one. | def islicel(l, m):
for i, start, end in islice(len(l), m):
yield i, l[start:end] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slice(n, m):\n chunks = []\n for piece in islice(n, m):\n chunks.append(piece)\n return chunks",
"def slice(list, point):\n index = list.index(point)\n slices = []\n \n slices.append(list[:index])\n slices.append(list[index + 1:])\n \n return slices",
"def get_... | [
"0.68872637",
"0.626404",
"0.61958575",
"0.60737896",
"0.6066185",
"0.59549165",
"0.59495926",
"0.5947317",
"0.5947317",
"0.5920774",
"0.59115535",
"0.5903008",
"0.57301456",
"0.57153434",
"0.569097",
"0.56835",
"0.5675845",
"0.56756884",
"0.56749094",
"0.5672304",
"0.5663476... | 0.6551134 | 1 |
Computes a 2D gaussian with given amplitude, shape and width (sigma) | def Gaussian2D(Amp, Shape, Sig):
Sig = np.array(Sig)
# If one or both of the shape values are zero replace it by 6*sigma
Shape += (Shape == np.zeros(2)) * np.ceil(3 * Sig).astype('int')
# Decrease even shape values by 1
Shape -= (Shape % 2 == 0)
# Calculate the center of the shape
G_Center =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GaussianKernel(sigma: float = 1., width: int = 0):\n assert not ((width is None or width == 0) and\n (sigma is None or sigma == 0)), \\\n \"GaussianKernel :: both sigma ({}) & width ({}) are not valid\".format(\n sigma, width)\n\n if width is None or width == 0:\n widt... | [
"0.7387339",
"0.73824966",
"0.73824966",
"0.7270704",
"0.72094446",
"0.7175132",
"0.7175132",
"0.7168737",
"0.7162812",
"0.7161739",
"0.7161739",
"0.7161739",
"0.7151552",
"0.7138109",
"0.7119096",
"0.7118733",
"0.7117452",
"0.71069586",
"0.70740443",
"0.70672196",
"0.7063182... | 0.6855499 | 28 |
Compute a 2D Gabor with given Amplitude, Shape, Width(Sig) Orientation in degree(theta) and Frequency (freq). | def Gabor(Amp, Shape, Sig, theta, freq):
# convert degree to radians
theta = theta * np.pi / 180
Sig = np.array(Sig)
halfSDsq = 1.0 / (2 * Sig**2)
# If one or both of the shape values are zero replace it by 6*sigma
Shape += (Shape == np.zeros(2)) * np.ceil(3 * Sig).astype('int')
# Decrease e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gabor2d(sigma, wfreq, worient, wphase, size, normalize=True):\n gabor = ig.Gabor(frequency=wfreq * size, xdensity=size, ydensity=size, size=2 * sigma / size,\n orientation=worient, phase=wphase)()\n assert gabor.ndim == 2\n if normalize:\n gabor -= gabor.mean()\n # no... | [
"0.69917357",
"0.6480823",
"0.61004615",
"0.59439504",
"0.58956945",
"0.57923347",
"0.5742281",
"0.5642932",
"0.5592973",
"0.5562071",
"0.5505029",
"0.54941016",
"0.5186223",
"0.5176627",
"0.51197445",
"0.5082349",
"0.5032866",
"0.4956454",
"0.49563268",
"0.495399",
"0.495198... | 0.757519 | 0 |
Defines a normal probability density function | def normpdf(x, mu, sigma):
return np.exp(-0.5 * ((x - mu) / sigma)**2) / (np.sqrt(2.0 * np.pi) * sigma) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normal_pdf(x: torch.Tensor) -> torch.Tensor:\n return torch.exp(-(x ** 2 / 2)) / np.sqrt(2 * np.pi)",
"def density_normal_dist(x):\n return ONE_OVER_SQRT_OF_TWO_PI * exp(-0.5 * x * x)",
"def probability_density(self, X):\n raise NotImplementedError",
"def density(self, arg):\n mean = ... | [
"0.73356533",
"0.7297555",
"0.71308076",
"0.7024182",
"0.70115614",
"0.69803166",
"0.6896581",
"0.6776388",
"0.6759862",
"0.67322785",
"0.6718365",
"0.67058164",
"0.6680472",
"0.665767",
"0.66371816",
"0.6587286",
"0.65871996",
"0.6580138",
"0.6573981",
"0.6566531",
"0.656290... | 0.6708862 | 11 |
Student has taken no courses, so "You cannot take this course, sorry!" is printed. | def test_000(self):
user_input = ["0","0","0"]
with patch("builtins.input", side_effect=user_input) as input_call:
with patch("sys.stdout", new=StringIO()) as output:
import attempt
self.assertEqual(output.getvalue().strip(),"You cannot take this course, sorry... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _warn_no_students(self):\n message = \"<tr><h2>No student records were found</h2></tr>\"\n self.add_element(message,True,0,True)",
"def student_login(student):\n # print menu for student\n student.menu_message()\n student.defined_available_courses()\n try:\n choice = int(inpu... | [
"0.69237",
"0.66526484",
"0.64372486",
"0.63614833",
"0.6322705",
"0.6193712",
"0.60132754",
"0.5995453",
"0.59564424",
"0.5903507",
"0.58906984",
"0.5887398",
"0.588161",
"0.58514154",
"0.5850983",
"0.58472073",
"0.58376896",
"0.5830959",
"0.5824117",
"0.5821328",
"0.5795893... | 0.0 | -1 |
Student has taken all courses, so "You cannot take this course, sorry!" is printed. | def test_111(self):
user_input = ["1","1","1"]
with patch("builtins.input", side_effect=user_input) as input_call:
with patch("sys.stdout", new=StringIO()) as output:
import attempt
self.assertEqual(output.getvalue().strip(),"You cannot take this course, sorry... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def student_login(student):\n # print menu for student\n student.menu_message()\n student.defined_available_courses()\n try:\n choice = int(input('your choice:'))\n except ValueError:\n print('invalid input,enter a number . \\n')\n logging.exception('invalid input in student men... | [
"0.6597954",
"0.64875907",
"0.6428737",
"0.63385856",
"0.62879235",
"0.6257371",
"0.6234762",
"0.6216322",
"0.59275943",
"0.59040415",
"0.58372396",
"0.58268785",
"0.57806635",
"0.5730845",
"0.5700277",
"0.56732756",
"0.55938274",
"0.5590067",
"0.5587118",
"0.55851644",
"0.55... | 0.0 | -1 |
Creates and saves a User with the given username, email and password. | def create_user(self, email, password=None, **extra_fields):
now = timezone.now()
if not email:
raise ValueError('The given email must be set')
email = UserManager.normalize_email(email)
user = self.model(email=email,
is_staff=False, is_active=True, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se... | [
"0.8601672",
"0.8470303",
"0.8463139",
"0.8417917",
"0.8413951",
"0.83923566",
"0.8346417",
"0.834563",
"0.8314972",
"0.8306569",
"0.82889265",
"0.8277474",
"0.82709104",
"0.82577616",
"0.8213184",
"0.8198332",
"0.81761587",
"0.8172245",
"0.81636524",
"0.8162862",
"0.81372786... | 0.0 | -1 |
(Output) The name of the Model that this is the deployment of. Note that the Model may be in a different location than the DeployedModel's Endpoint. | def model(self) -> Optional[str]:
return pulumi.get(self, "model") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model(self) -> Optional['outputs.DeploymentModelResponse']:\n return pulumi.get(self, \"model\")",
"def get_model_name(self) -> str:\n return self._get_string(openvr.Prop_RenderModelName_String)",
"def getName(self):\n return _libsbml.Model_getName(self)",
"def getName(self):\n ... | [
"0.71407163",
"0.71154666",
"0.6966224",
"0.6927814",
"0.69123375",
"0.6821943",
"0.6785734",
"0.6775902",
"0.6709338",
"0.67058367",
"0.66923493",
"0.66833335",
"0.66772515",
"0.6658171",
"0.66105855",
"0.65918887",
"0.6495176",
"0.64900225",
"0.6441959",
"0.6407599",
"0.636... | 0.6656615 | 14 |
(Output) The maximum number of replicas this DeployedModel may be deployed on when the traffic against it increases. If the requested value is too large, the deployment will error, but if deployment succeeds then the ability to scale the model to that many replicas is guaranteed (barring service outages). If traffic ag... | def max_replica_count(self) -> Optional[int]:
return pulumi.get(self, "max_replica_count") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_replicas(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"max_replicas\")",
"def max_replicas(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"max_replicas\")",
"def scale_max_capacity(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self,... | [
"0.7056256",
"0.7056256",
"0.6690706",
"0.6690706",
"0.6480917",
"0.62453926",
"0.62453926",
"0.62453926",
"0.6236377",
"0.6236377",
"0.61656934",
"0.6163212",
"0.6132034",
"0.6132034",
"0.6132034",
"0.6132034",
"0.6132034",
"0.60781157",
"0.60757804",
"0.60757804",
"0.607578... | 0.60916865 | 17 |
(Output) The minimum number of replicas this DeployedModel will be always deployed on. If traffic against it increases, it may dynamically be deployed onto more replicas up to max_replica_count, and as traffic decreases, some of these extra replicas may be freed. If the requested value is too large, the deployment will... | def min_replica_count(self) -> Optional[int]:
return pulumi.get(self, "min_replica_count") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_replicas(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"min_replicas\")",
"def min_replicas(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"min_replicas\")",
"def max_replicas(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"max... | [
"0.7508751",
"0.7508751",
"0.7411863",
"0.7411863",
"0.6895296",
"0.68854624",
"0.68854624",
"0.68854624",
"0.68854624",
"0.68854624",
"0.6716816",
"0.6716816",
"0.66684175",
"0.66684175",
"0.63475144",
"0.61625963",
"0.6150354",
"0.6046371",
"0.6046371",
"0.6046371",
"0.6032... | 0.7095892 | 5 |
(Output) The maximum number of replicas this DeployedModel may be deployed on when the traffic against it increases. If the requested value is too large, the deployment will error, but if deployment succeeds then the ability to scale the model to that many replicas is guaranteed (barring service outages). If traffic ag... | def max_replica_count(self) -> Optional[int]:
return pulumi.get(self, "max_replica_count") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_replicas(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"max_replicas\")",
"def max_replicas(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"max_replicas\")",
"def scale_max_capacity(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self,... | [
"0.7056256",
"0.7056256",
"0.6690706",
"0.6690706",
"0.6480917",
"0.62453926",
"0.62453926",
"0.62453926",
"0.6236377",
"0.6236377",
"0.61656934",
"0.6163212",
"0.6132034",
"0.6132034",
"0.6132034",
"0.6132034",
"0.6132034",
"0.60781157",
"0.60757804",
"0.60757804",
"0.607578... | 0.60916865 | 18 |
(Output) The minimum number of replicas this DeployedModel will be always deployed on. If traffic against it increases, it may dynamically be deployed onto more replicas up to max_replica_count, and as traffic decreases, some of these extra replicas may be freed. If the requested value is too large, the deployment will... | def min_replica_count(self) -> Optional[int]:
return pulumi.get(self, "min_replica_count") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_replicas(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"min_replicas\")",
"def min_replicas(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"min_replicas\")",
"def max_replicas(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"max... | [
"0.7508751",
"0.7508751",
"0.7411863",
"0.7411863",
"0.6895296",
"0.68854624",
"0.68854624",
"0.68854624",
"0.68854624",
"0.68854624",
"0.6716816",
"0.6716816",
"0.66684175",
"0.66684175",
"0.63475144",
"0.61625963",
"0.6150354",
"0.6046371",
"0.6046371",
"0.6046371",
"0.6032... | 0.7095892 | 4 |
Threshold for categorical features of anomaly detection. This is shared by all types of Featurestore Monitoring for categorical features (i.e. Features with type (Feature.ValueType) BOOL or STRING). Structure is documented below. | def categorical_threshold_config(self) -> Optional['outputs.AiFeatureStoreEntityTypeMonitoringConfigCategoricalThresholdConfig']:
return pulumi.get(self, "categorical_threshold_config") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def threshold(self) -> Union[float, TensorType]:\n return self._threshold",
"def getThreshold(self): # real signature unknown; restored from __doc__\n pass",
"def threshold(self,thresholdValue):\n # TO DO\n pass",
"def hardClassify(self, inputValue):\n inputCopy = inputValu... | [
"0.6163239",
"0.6037393",
"0.60317224",
"0.5874441",
"0.5812058",
"0.57571775",
"0.56553113",
"0.56553113",
"0.56553113",
"0.56553113",
"0.56553113",
"0.5636506",
"0.55469763",
"0.55447644",
"0.5541901",
"0.5541901",
"0.5541901",
"0.5539747",
"0.5532412",
"0.55205786",
"0.548... | 0.7283648 | 0 |
Configuration of the snapshot analysis based monitoring pipeline running interval. The value indicates number of days. The default value is 1. If both FeaturestoreMonitoringConfig.SnapshotAnalysis.monitoring_interval_days and [FeaturestoreMonitoringConfig.SnapshotAnalysis.monitoring_interval][] are set when creating/up... | def monitoring_interval_days(self) -> Optional[int]:
return pulumi.get(self, "monitoring_interval_days") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_interval_of_checking(self):\n return int(self.config['interval_of_checking'])",
"def interval_days(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"interval_days\")",
"def get_monitor_interval(self):\n return self.conf['icmp_check_interval']",
"def interval(self) -> int:\n... | [
"0.60848975",
"0.59510577",
"0.5878463",
"0.57894045",
"0.5702657",
"0.5635878",
"0.56317383",
"0.56317383",
"0.5597539",
"0.5518396",
"0.5516382",
"0.54733485",
"0.5398819",
"0.5323451",
"0.53196293",
"0.5295319",
"0.5278675",
"0.5250219",
"0.5247607",
"0.52265936",
"0.52181... | 0.6810528 | 0 |
(Output) The number of shards in the Index. | def shards_count(self) -> Optional[int]:
return pulumi.get(self, "shards_count") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_shards(self) -> int:\n return pulumi.get(self, \"num_shards\")",
"def num_shards(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"num_shards\")",
"def num_shards(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"num_shards\")",
"def num_shards(se... | [
"0.8597112",
"0.8376237",
"0.8021096",
"0.8021096",
"0.79807305",
"0.79358083",
"0.7326213",
"0.7325733",
"0.7052293",
"0.6808236",
"0.6759522",
"0.66922385",
"0.66661346",
"0.66447186",
"0.6542838",
"0.6509921",
"0.6509904",
"0.6481764",
"0.6481764",
"0.6372627",
"0.63474303... | 0.8300914 | 2 |
(Output) The disk utilization of the MetadataStore in bytes. | def disk_utilization_bytes(self) -> Optional[str]:
return pulumi.get(self, "disk_utilization_bytes") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_storage(self):\n return self._total_storage",
"def disk_time(self):\n if self.has_fetch:\n return self.shuffle_write_time + self.local_read_time\n return self.shuffle_write_time",
"def memory_utilization(self) -> float:\r\n return self._memory_utilization",
"def disk():\n ... | [
"0.75016767",
"0.717652",
"0.71555567",
"0.70219904",
"0.7013955",
"0.6950667",
"0.69078463",
"0.67587894",
"0.67234427",
"0.6705195",
"0.669828",
"0.66558844",
"0.6640314",
"0.6606764",
"0.6606764",
"0.6590565",
"0.6590309",
"0.65792227",
"0.6574143",
"0.6520738",
"0.6514932... | 0.6990849 | 5 |
Returns a list of all arrays that can be either lazyevaluated or lazy loaded from an auxiliary file. | def all_keys(self):
return self.derivable_keys() + self.loadable_keys() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lookup_arrays(read_from_flat_files=False, from_pickle=False):\n if from_pickle:\n year_arr = pickle.load(open(variables.tables_dict[\"year_arr\"], \"rb\"))\n hierlevel_arr = pickle.load(open(variables.tables_dict[\"hierlevel_arr\"], \"rb\"))\n entitytype_arr = pickle.load(open(varia... | [
"0.60166943",
"0.5777454",
"0.55223316",
"0.55197364",
"0.54613453",
"0.5456929",
"0.5449557",
"0.54344374",
"0.54343784",
"0.54299295",
"0.5424692",
"0.54128134",
"0.539869",
"0.539869",
"0.5354552",
"0.53441554",
"0.53395915",
"0.5320659",
"0.53112346",
"0.5297883",
"0.5282... | 0.0 | -1 |
Return list of arrays which are not accessible from this view, but can be accessed from familyspecific subviews. If fam is not None, only those keys applying to the specific family will be returned (equivalent to self.fam.keys()). | def family_keys(self, fam=None):
if fam is not None:
return [x for x in self._family_arrays if fam in self._family_arrays[x]]
else:
return list(self._family_arrays.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadable_keys(self, fam=None):\n return []",
"def fully_hidden_arrays(self):\n hidden = []\n for m in self.masks():\n invalid = self.get_property(m, '_no_valid_items')\n if invalid: hidden.append(m)\n return hidden",
"def _get_family_array(self, name, fam, ... | [
"0.6068476",
"0.5989365",
"0.58064836",
"0.5592187",
"0.5524069",
"0.5474847",
"0.54691327",
"0.53304887",
"0.5292448",
"0.5259779",
"0.52563334",
"0.5178611",
"0.51424056",
"0.51102406",
"0.5074123",
"0.5065405",
"0.5046724",
"0.5007036",
"0.4998092",
"0.49871323",
"0.498705... | 0.72001946 | 0 |
Create a single snapshotlevel array of dimension len(self) x ndim, with a given numpy dtype. | def _create_array(self, array_name, ndim=1, dtype=None, zeros=True, derived=False, shared=None):
# Does this actually correspond to a slice into a 3D array?
NDname = self._array_name_1D_to_ND(array_name)
if NDname:
self._create_array(
NDname, ndim=3, dtype=dtype, zer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def astype(self, dtype: DtypeLike, copy=True) -> JaggedArray:\n res = self.copy() if copy else self\n res.data = self.data.astype(dtype)\n return res",
"def astype(self, dtype):\n return NoneArray",
"def __array__(self):\n return np.zeros(self.shape, self.dtype)",
"def dtype():... | [
"0.61263275",
"0.58989716",
"0.57424986",
"0.5683519",
"0.56485397",
"0.55858314",
"0.5527379",
"0.55104697",
"0.5495939",
"0.54853165",
"0.54511434",
"0.54469484",
"0.54371333",
"0.54250985",
"0.5414449",
"0.5413471",
"0.5402492",
"0.53998214",
"0.53991395",
"0.53783685",
"0... | 0.0 | -1 |
Raises a ValueError if the specified array name is connected to a familyspecific array | def _assert_not_family_array(self, name):
if name in self.family_keys():
raise KeyError("Array " + name + " is a family-level property") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_common(ndarray, name):\n\tvalidate_ndarray(ndarray,(np.float, np.int), (2,) , name)",
"def test_invalid_array_shape(self, parse_input_mocked_metadata):\n with pytest.raises(\n BlackbirdSyntaxError, match=r\"has declared shape \\(1, 2\\) but actual shape \\(2, 2\\)\"\n ):\n ... | [
"0.6585522",
"0.6201416",
"0.61361086",
"0.58061606",
"0.57660615",
"0.5718109",
"0.5715192",
"0.57044804",
"0.56661445",
"0.5613152",
"0.5555368",
"0.5532416",
"0.55134916",
"0.55134916",
"0.54120916",
"0.54103076",
"0.53998625",
"0.5397738",
"0.53939176",
"0.53915477",
"0.5... | 0.7000895 | 0 |
Equality test for Snapshots. Returns true if both sides of the == operator point to the same data. | def __eq__(self, other):
if self is other:
return True
return hash(self) == hash(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not isinstance(other, KgSnapshot):\n return False\n\n return self.to_dict() == other.to_dict()",
"def __eq__(self, other):\n if not isinstance(other, VersionedFlowSnapshot):\n return False\n\n return self.__dict__ == other.__dict__",... | [
"0.72511035",
"0.71241313",
"0.6831682",
"0.6813047",
"0.67219853",
"0.66664606",
"0.6651688",
"0.6649824",
"0.6642423",
"0.66148645",
"0.66079915",
"0.65961444",
"0.657657",
"0.6573907",
"0.6573474",
"0.6496613",
"0.64905727",
"0.6481121",
"0.6436963",
"0.6422273",
"0.641493... | 0.0 | -1 |
Create a convolutional neural network in Keras. | def neural_network():
model = Sequential()
model.add(Conv2D(64, kernel_size=3, activation="relu", input_shape=(28, 28, 1)))
model.add(Conv2D(64, kernel_size=3, activation="relu"))
model.add(Flatten())
model.add(Dense(10, activation="softmax"))
model.compile(optimizer='adam', loss='categorical_cr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keras_functional_conv_net():\n inputs = tf.keras.layers.Input(shape=(28, 28, 3))\n x = tf.keras.layers.Conv2D(4, kernel_size=3, activation=None)(inputs)\n x = tf.keras.layers.BatchNormalization()(x)\n x = tf.keras.layers.Activation(\"relu\")(x)\n x = tf.keras.layers.Conv2D(16, kernel_size=3, act... | [
"0.71908593",
"0.7171818",
"0.711938",
"0.70571816",
"0.70363504",
"0.7019456",
"0.700951",
"0.6985045",
"0.69754595",
"0.68223673",
"0.6740792",
"0.673829",
"0.6729583",
"0.6729394",
"0.66554105",
"0.66264874",
"0.6610747",
"0.660811",
"0.65901375",
"0.65899765",
"0.65848416... | 0.7107047 | 3 |
Starts the event loop in a background thread. Call this once, after having set the callback. | def start(self):
# ioloop.install()
threading.Thread(target=self.loop.start).start()
time.sleep(1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start(self):\n\n if self.thread is None:\n self.thread = threading.Thread(\n target=self.__run__,\n daemon=True,\n )\n\n self.thread.start()\n LOGGER.debug(\n \"Starting thread `%s` for event loop `%s`.\",\n ... | [
"0.72152513",
"0.7156715",
"0.7023523",
"0.6946306",
"0.6859181",
"0.68249494",
"0.6805075",
"0.67608225",
"0.67407274",
"0.67236245",
"0.67031795",
"0.6695872",
"0.6655568",
"0.66227686",
"0.6617621",
"0.65983605",
"0.65649545",
"0.6562542",
"0.6543894",
"0.651025",
"0.64978... | 0.66525507 | 13 |
Returns a color based on the values relation to the threshold. This function is used for values that should be BELOW their threshold | def below_threshold(threshold, current_value):
if current_value < threshold:
return "#00B760"
if current_value > threshold:
return "#E3170A"
return "#030027" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def above_threshold(threshold, current_value):\n if current_value > threshold:\n return \"#00B760\"\n if current_value < threshold:\n return \"#E3170A\"\n return \"#030027\"",
"def color_vals(val, threshl=[0.15, 0.30, 0.50]):\n colormap = ['red', 'black', 'blue', 'green']\n color = c... | [
"0.7875011",
"0.7702289",
"0.7086759",
"0.6828672",
"0.6771988",
"0.65653104",
"0.65444994",
"0.64483154",
"0.63596004",
"0.6340811",
"0.63175076",
"0.6299747",
"0.6285677",
"0.62761015",
"0.6242259",
"0.6241801",
"0.6215207",
"0.6207995",
"0.61932796",
"0.617672",
"0.6172157... | 0.7889745 | 0 |
Returns a color based on the values relation to the threshold. This function is used for values that should be ABOVE their threshold | def above_threshold(threshold, current_value):
if current_value > threshold:
return "#00B760"
if current_value < threshold:
return "#E3170A"
return "#030027" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_vals(val, threshl=[0.15, 0.30, 0.50]):\n colormap = ['red', 'black', 'blue', 'green']\n color = colormap[-1]\n for i, thresh in enumerate(threshl):\n if val < thresh:\n color = colormap[i]\n break\n return 'color: %s' % color",
"def below_threshold(threshold, cu... | [
"0.77617455",
"0.7662723",
"0.7181357",
"0.70052296",
"0.697193",
"0.65460813",
"0.65221775",
"0.6491421",
"0.6430508",
"0.6373075",
"0.6329456",
"0.63180685",
"0.63142127",
"0.6289456",
"0.62621367",
"0.6261919",
"0.6254287",
"0.62533677",
"0.6222501",
"0.62175155",
"0.61994... | 0.7659612 | 2 |
Returns a color based on the values relation to the threshold. | def indicator_color(threshold=None, current_value=0, polarity="above"):
if threshold is None:
return "#030027"
if polarity == "above":
return above_threshold(threshold, current_value)
else:
return below_threshold(threshold, current_value)
return "#030027" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_vals(val, threshl=[0.15, 0.30, 0.50]):\n colormap = ['red', 'black', 'blue', 'green']\n color = colormap[-1]\n for i, thresh in enumerate(threshl):\n if val < thresh:\n color = colormap[i]\n break\n return 'color: %s' % color",
"def below_threshold(threshold, cu... | [
"0.7740759",
"0.7238951",
"0.7236351",
"0.71221405",
"0.70865196",
"0.66542476",
"0.66358674",
"0.6501625",
"0.6485751",
"0.64745367",
"0.6418809",
"0.63826823",
"0.6337265",
"0.6292546",
"0.6281394",
"0.62789446",
"0.62734765",
"0.62688196",
"0.62597525",
"0.6198434",
"0.618... | 0.6485406 | 9 |
Moves start date and end date to beginning of month or quarter and end of month for month frequency. | def update_dates(start_date, end_date, freq):
if (freq == "MS") or (freq == "M"):
try:
start_date = start_date.split("/")
end_date = end_date.split("/")
except AttributeError:
start_date = [start_date.month, start_date.day, start_date.year]
end_date = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def per_month(start: datetime, end: datetime, n: int = 1):\n curr = start.replace(day=1, hour=0, minute=0, second=0, microsecond=0)\n while curr < end:\n curr_end = add_month(curr, n)\n yield curr, curr_end\n curr = curr_end",
"def quarter_from_month(month: int) -> int:\n return ((m... | [
"0.6074931",
"0.57252175",
"0.56405985",
"0.55110717",
"0.5488063",
"0.5316465",
"0.5289674",
"0.5274166",
"0.52719074",
"0.5269806",
"0.52644217",
"0.52201253",
"0.5204464",
"0.5159162",
"0.5154041",
"0.51273346",
"0.51174223",
"0.50975233",
"0.5086071",
"0.5069482",
"0.5061... | 0.6354174 | 0 |
Check if block_hash is valid hash of block and satisfies the difficulty criteria. | def is_valid_proof(cls, block, block_hash):
return (block_hash.startswith('0' * Blockchain.difficulty) and
block_hash == block.compute_hash()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_proof(self, block, block_hash): \n return (block_hash.startswith('0' * Blockchain.difficulty) and block_hash == compute_hash())",
"def is_valid_proof(self, block, block_hash):\r\n return (block_hash.startswith('0' * Blockchain.difficulty) and\r\n block_hash == block.comp... | [
"0.8460987",
"0.7990351",
"0.7812581",
"0.74181527",
"0.7333979",
"0.704419",
"0.68969727",
"0.6725546",
"0.65998924",
"0.65482736",
"0.6509975",
"0.6479108",
"0.6452117",
"0.6441145",
"0.6415044",
"0.63940567",
"0.63907415",
"0.6357215",
"0.63562655",
"0.63505995",
"0.634084... | 0.7978347 | 3 |
Close the database file | def __close(self):
with self.__db_lock:
if self.__open:
self.__connection.close()
self.__open = False
return self.__open | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_db(self):\n with nostderr():\n tb.file._open_files.close_all()",
"def _close_database(self):\n assert self._conn is not None\n logging.info(\"Closing file {!r}.\".format(self._filename))\n self._cursor.close()\n self._cursor = None\n self._conn.close... | [
"0.82409686",
"0.81996",
"0.78845775",
"0.7807006",
"0.78062415",
"0.77242815",
"0.7680746",
"0.7678744",
"0.76216644",
"0.76216644",
"0.76216644",
"0.7613369",
"0.76075757",
"0.7583613",
"0.75806653",
"0.7580107",
"0.7525938",
"0.75067097",
"0.746617",
"0.7452759",
"0.744790... | 0.0 | -1 |
Get whether this instance is configured for YouTube. | def enabled(self) -> bool:
return bool(self._enabled and self._api_key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isYouTube(self):\n if 'youtube' in self.link.split('.'):\n return True\n return None",
"def youtube(self):\n return self._youtube",
"def has_configuration_set():\r\n return getattr(settings, \"MICROSITE_CONFIGURATION\", False)",
"async def is_configured(hass: HomeAssist... | [
"0.80103546",
"0.692692",
"0.62943894",
"0.6093786",
"0.5958041",
"0.595515",
"0.5916155",
"0.5900882",
"0.58797526",
"0.587928",
"0.58653986",
"0.5810753",
"0.5740859",
"0.5734932",
"0.57308847",
"0.5728856",
"0.5719946",
"0.571829",
"0.5717711",
"0.5683413",
"0.566348",
"... | 0.0 | -1 |
Define layers for a vanilla rnn encoder | def __init__(self, vocab_size, embedding_size, output_size):
super(VanillaEncoder, self).__init__()
self.vocab_size = vocab_size
self.embedding = nn.Embedding(vocab_size, embedding_size)
self.gru = nn.GRU(embedding_size, output_size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _define_encoder(self):\n self.encoder = nn.Sequential(nn.Conv2d(in_channels=3, out_channels=32, kernel_size=4, stride=2, padding=1), # B, 32, 32, 32\n nn.SELU(),\n nn.Conv2d(32, 32, 4, 2, 1), # B, 32, 16, 16\n ... | [
"0.7218295",
"0.71548826",
"0.6907792",
"0.66667175",
"0.65487325",
"0.6534074",
"0.6520071",
"0.647997",
"0.64723253",
"0.6469614",
"0.64522153",
"0.6433063",
"0.64292246",
"0.6428599",
"0.64261454",
"0.64033186",
"0.6395273",
"0.63338053",
"0.6322398",
"0.63109756",
"0.6310... | 0.58499426 | 93 |
An object representing a claim of resources against a project. | def __init__(self, resource_name, project_id, quantity=None):
if not isinstance(resource_name, six.string_types):
msg = 'resource_name must be a string type.'
raise ValueError(msg)
if not isinstance(project_id, six.string_types):
msg = 'project_id must be a string t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _project(request, key):\n context = request.context\n if not context.project_id:\n raise exceptions.QuotaMissingTenant()\n return {key: {key + '_id': context.project_id}}",
"def __init__(self, claim, callback=None, verify=True):\n\n if not isinstance(claim, ProjectClaim... | [
"0.55102587",
"0.55063325",
"0.5286427",
"0.5277571",
"0.52081895",
"0.5186674",
"0.51638544",
"0.5161905",
"0.50738865",
"0.5060906",
"0.5047299",
"0.49975672",
"0.49283865",
"0.49181616",
"0.49103752",
"0.4887211",
"0.48772344",
"0.4865495",
"0.48583177",
"0.4820312",
"0.48... | 0.45662633 | 48 |
Convert a timestamp on a given day to solve time in seconds | def to_relative_seconds(day_number, timestamp):
dec_1 = datetime(YEAR, 12, 1)
return timestamp - (dec_1 + timedelta(days=day_number - 1)).timestamp() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def daysToSeconds(dayInt):\n return dayInt * 24 * 60 * 60",
"def timestamp2sec(timestamp):\n return (int(timestamp.seconds) + 60 * int(timestamp.minutes) + 3600 * int(timestamp.hours) + float(int(timestamp.hours) / 1000))",
"def TAIDaySecsToUTCDaySecs(day, second):\n leap_seconds, num_seconds = LeapInfo... | [
"0.7459889",
"0.7064998",
"0.6608774",
"0.6582516",
"0.6541453",
"0.65300155",
"0.6516943",
"0.64841455",
"0.64418566",
"0.63841456",
"0.635666",
"0.62980616",
"0.6297445",
"0.6291617",
"0.62494034",
"0.6245113",
"0.62210494",
"0.62179834",
"0.6212406",
"0.6182421",
"0.617536... | 0.69512653 | 2 |
Return a dict without the children key | def full(self):
tmp = {}
for key in self.__slots__:
attribute = getattr(self, key)
if key == self.__children_key:
continue
tmp.update({key: attribute})
tmp['id'] = str(self.id)
return tmp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_children(self):\n if self._child_val is not None:\n return {self._child_key: self._child_val}\n if self._children is not None:\n return dict(self._children)\n return {}",
"def drop_keys(d):\n if isinstance(d, dict):\n return {\n k: drop_keys... | [
"0.71705484",
"0.6830898",
"0.67962587",
"0.67641264",
"0.66926014",
"0.652607",
"0.6460729",
"0.6367047",
"0.635467",
"0.6302084",
"0.6239786",
"0.62372214",
"0.61961526",
"0.61488897",
"0.6121729",
"0.60791755",
"0.60651517",
"0.60415614",
"0.60289466",
"0.6011406",
"0.6003... | 0.6490757 | 6 |
Test case for website_companies_create | def test_website_companies_create(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_company_3(self):\n companies_data = [\n {\n \"_id\": \"sbucks\",\n \"headquarters\": \"Seattle\",\n \"name\": \"Starbucks Inc.\",\n },\n {\n \"_id\": \"salesforce\",\n \"headquarters\"... | [
"0.78889275",
"0.78552085",
"0.7838216",
"0.7832079",
"0.7598919",
"0.7500478",
"0.7415962",
"0.739124",
"0.73179173",
"0.7315105",
"0.71302235",
"0.68628573",
"0.6797418",
"0.67958254",
"0.66097873",
"0.658609",
"0.65119064",
"0.6498701",
"0.64006543",
"0.6350173",
"0.633796... | 0.9450464 | 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(CurvedPolygonArray, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.header is None:
self.header = std_msgs.msg.Header()
if self.polygons is None:
self.poly... | {
"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.77936935",
"0.77195734",
"0.77195734",
"0.76861507",
"0.76260346",
"0.7563092",
"0.7439089",
"0.74163747",
"0.73512906",
"0.73076564",
"0.72798854",
"0.72372425",
"0.7226609",
"0.7223668",
"0.7223668",
"0.7218618",
"0.7210883",
"0.7210883",
"0.7210883",
"0.7210883",
"0.721... | 0.0 | -1 |
y(x) = 1 + 0.3 x_1 0.6 x_2^2 0.2 x_3^3 + 0.5 x_4^4 | def y(x):
x1, x2, x3, x4 = x[:, 0], x[:, 1], x[:, 2], x[:, 3]
return 1 + 0.3 * x1 - 0.6 * x2 ** 2 - 0.2 * x3 ** 3 + 0.5 * x4 ** 4 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y01(x):\r\n # return pini*((special.gamma(k1+p1))/(special.gamma(k1)*special.gamma(p1))*((x/l)**(k1-1))*(1-(x/l))**(p1-1))/7.3572\r\n return 1/100*x*epsilon*1/q*1e21\r\n # return 1e13*1/sigma*np.sqrt(2*np.pi) * np.exp(-np.power(x - u, 2.) / (2 * np.power(sigma, 2.)))-1e15*1/sigma\r",
"def y(x,xi):\n... | [
"0.74768984",
"0.725826",
"0.71797264",
"0.69124043",
"0.6834919",
"0.67976296",
"0.67495626",
"0.67370164",
"0.66645175",
"0.664725",
"0.664076",
"0.6605168",
"0.65920573",
"0.65889454",
"0.6569426",
"0.6552351",
"0.65365696",
"0.6488637",
"0.64844",
"0.6474556",
"0.6471102"... | 0.8541395 | 0 |
Columns can be specified as index numbers or as names. If a column name is given, this function dereferences it into a numeric column index. | def resolve_ref(self, document):
if isinstance(self.source, int):
return self.source
else:
try:
return document.title_xref[self.source.lower()]
except KeyError:
raise Exception("Could not find column '%s' in document %s. Possible column... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ColumnIndex(self, name):\n assert name in self.name_to_index\n return self.name_to_index[name]",
"def column_index(self, column_name: str) -> int:\n return self._column_indices[column_name]",
"def get_column_index(self, colName):\n\t\treturn self._columns[colName]",
"def __getitem__(... | [
"0.6709418",
"0.6622653",
"0.64784133",
"0.64111966",
"0.62133867",
"0.6205118",
"0.59665024",
"0.59552413",
"0.5909727",
"0.58679",
"0.5801821",
"0.57263327",
"0.5704366",
"0.57015187",
"0.5698665",
"0.568817",
"0.5653054",
"0.5648641",
"0.5632458",
"0.5606075",
"0.5600827",... | 0.0 | -1 |
Load a graph_def file. | def load_graph_def(filename):
input_graph_def = tf.GraphDef()
with gfile.FastGFile(filename, 'rb') as file:
data = file.read()
input_graph_def.ParseFromString(data)
return input_graph_def | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_graph(filename):\n with tf.gfile.GFile(filename, 'rb') as f:\n graph_def = tf.GraphDef()\n graph_def.ParseFromString(f.read())\n tf.import_graph_def(graph_def, name='')",
"def load_graph(filename):\n\twith tf.gfile.FastGFile(filename, 'rb') as f:\n\t\tgraph_def = tf.GraphDef()\n\... | [
"0.77791077",
"0.772469",
"0.7708441",
"0.7708441",
"0.74539286",
"0.7166545",
"0.711777",
"0.7054602",
"0.69580567",
"0.6955133",
"0.6947933",
"0.68586904",
"0.6852421",
"0.6826778",
"0.6712433",
"0.6535193",
"0.6528048",
"0.6504243",
"0.6477264",
"0.6404583",
"0.6361239",
... | 0.79076785 | 0 |
Wrap a TensorFlow metric into a partial function which can be passed to Keras models. | def adapt_tf_streaming_metric_for_keras(tf_metric, name,
preprocss_fn=None, postprocess_fn=None,
**kwargs):
# Inspired from snipped by Ruzhitskiy Bogdan
# (https://github.com/keras-team/keras/issues/6050#issuecomment-329996505)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_to_eval_metric(metric_fn):\n def problem_metric_fn(*args):\n \"\"\"Returns an aggregation of the metric_fn's returned values.\"\"\"\n (scores, weights) = metric_fn(*args)\n\n # The tf.metrics.mean function assures correct aggregation.\n return tf.compat.v1.metrics.mean(scores, weights)\n ... | [
"0.6450321",
"0.62930983",
"0.6228844",
"0.6202285",
"0.60720766",
"0.6029865",
"0.59937805",
"0.5922919",
"0.58412105",
"0.58281446",
"0.57562524",
"0.568088",
"0.5644555",
"0.5630956",
"0.55809534",
"0.5526803",
"0.5526355",
"0.55105627",
"0.5489007",
"0.5489007",
"0.54825"... | 0.64439774 | 1 |
Wrap a TF metric, instantiating hidden variables + updating hidden states | def metric(y_true, y_pred):
# First we define the metric operation:
value, update_op = tf_metric(y_true, y_pred, **kwargs)
# It is possible that the metric is relying on some local variables,
# that we should then initialize them:
initialize_variables()
# Finally, we f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self._graph = tf.Graph()\n self._session = tf.compat.v1.Session(graph=self._graph)\n\n # This lock is for multi-threaded contexts where multiple threads\n # share the same EvalSavedModel.\n #\n # Locking is required in the case where there are multiple threads using\n # ... | [
"0.6193265",
"0.5954331",
"0.5902938",
"0.5762818",
"0.5742934",
"0.57412314",
"0.5716037",
"0.5691054",
"0.56803465",
"0.5580592",
"0.5576953",
"0.5551268",
"0.55406743",
"0.55161154",
"0.5507251",
"0.55045563",
"0.54919016",
"0.5487411",
"0.54864246",
"0.546494",
"0.546494"... | 0.5901993 | 3 |
Return a IoU metric function for Keras models. | def mean_iou_metric(num_classes, ignore_value=255):
def preprocess_for_mean_iou(y_true, y_pred):
# Like for other metrics/losses, we remove the values for the ignored class(es):
y_true, y_pred = prepare_data_for_segmentation_loss(y_true, y_pred,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def def_mean_iou(y_true, y_pred):\n # get number of labels to calculate IoU for\n num_labels = backend.int_shape(y_pred)[-1]\n # initialize a variable to store total IoU in\n mean_iou = backend.variable(0)\n \n class_iou_dict = {}\n # iterate over labels to calculate IoU for\n for label in ... | [
"0.62444675",
"0.61789",
"0.59774834",
"0.5854049",
"0.57565826",
"0.5642995",
"0.5625411",
"0.54656625",
"0.5462043",
"0.54559314",
"0.5423436",
"0.5341904",
"0.5274526",
"0.5271674",
"0.5225282",
"0.5222251",
"0.52107733",
"0.5176854",
"0.5151249",
"0.51154757",
"0.5059061"... | 0.5803085 | 4 |
Converts ASCII characters received to a float Creates a string from ASCII characters received in data chunk Converts this string to a float and returns float | def format_data(self)->float:
try:
formatted = chr(self.data[0])
for i in range(1, len(self.data)):
formatted = formatted + (chr(self.data[i]))
return str(formatted)
except ValueError as e:
print(e)
except TypeEr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def float_from_string(data):\n return float(maybe_number(data))",
"def _to_float(self, s: str) -> float:\n return int(s[:-1]) / 1e9 if s.endswith('n') else float(s[:-1])",
"def read_float(v):\n if v.strip() == '':\n return 0.\n try:\n return float(v)\n except ValueError:\n ... | [
"0.7467962",
"0.6974417",
"0.6946216",
"0.68561536",
"0.6669242",
"0.66605496",
"0.6647796",
"0.66294116",
"0.66055477",
"0.6565194",
"0.6559072",
"0.6557913",
"0.6554412",
"0.6490464",
"0.64644873",
"0.64625555",
"0.64550054",
"0.6425147",
"0.64090383",
"0.63834125",
"0.6366... | 0.66349024 | 7 |
Create summaries for tensorboard. | def _create_summaries(self, decoder_output, features, labels=None):
with tf.name_scope("create_summaries"):
max_outputs = self.params['max_outputs']
# input images
image = features['image']
tf.summary.image(self._sname('image'), image, max_outputs)
if self.mode == ModeKeys.TRAIN:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_summaries(self):\n\n self.summaries['loss'] = tf.summary.scalar('loss', self.loss)\n\n self.summaries['0_inputs_outputs'] = \\\n tf.summary.image('0_inputs_outputs', tf.concat([\n tf.expand_dims(tf.expand_dims(tf.stack(self.inputs, axis=-1), axis=0), axis=-1),\n ... | [
"0.7866837",
"0.7670679",
"0.734843",
"0.73308146",
"0.73308146",
"0.7111576",
"0.698586",
"0.692212",
"0.68102527",
"0.67941546",
"0.6733548",
"0.66962945",
"0.6556457",
"0.6438858",
"0.6420054",
"0.6327292",
"0.6323271",
"0.6321295",
"0.63055164",
"0.6268392",
"0.626474",
... | 0.6341487 | 15 |
String of peer data. | def __str__(self):
return ', '.join([self.peer_ip, str(self.state), str(self.pieces), str(self.port)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getString(self):\n return \"\".join(self.data)",
"def rawdata(self) -> str:\n return self._data",
"def raw_data(self) -> str:\n return self._raw_data",
"def raw_data(self) -> str:\n return self._raw_data",
"def as_str(self) -> str:\n if isinstance(self.data, str):\n ... | [
"0.7191371",
"0.70483476",
"0.698151",
"0.698151",
"0.67512465",
"0.67045146",
"0.66809744",
"0.66758525",
"0.6642146",
"0.66395336",
"0.66261816",
"0.66159266",
"0.6559948",
"0.6559948",
"0.6559948",
"0.6559948",
"0.6559948",
"0.65586615",
"0.65428185",
"0.6501711",
"0.64997... | 0.61496216 | 37 |
Check Conv2D scale out of range error. | def test_conv2d_out_of_range_scale():
np.random.seed(0)
input_sc = 1024
kernel_sc = 1024
output_sc = 1
model, _ = _get_model(
(1, 4, 4, 4),
1,
1,
0,
input_sc,
0,
kernel_sc,
0,
output_sc,
"none",
(1, 1),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_sizes(self, space):\n my_dimension = self.get_total_dimension()\n other_dimension = space.get_total_dimension()\n if my_dimension != other_dimension:\n if isinstance(space, Conv2DSpace):\n if my_dimension * space.shape[0] !=\\\n other... | [
"0.6317615",
"0.62058914",
"0.6170105",
"0.60474324",
"0.5866946",
"0.58645874",
"0.5818894",
"0.58152574",
"0.57420796",
"0.57210886",
"0.57097375",
"0.5656907",
"0.5641257",
"0.55728155",
"0.5535942",
"0.553489",
"0.5514729",
"0.5514667",
"0.551341",
"0.55102754",
"0.550770... | 0.77076834 | 0 |
View decorator that catches ObjectDoesNotExist exceptions and returns a 404 HttpResponse. | def handle_nonexistence(view):
def decorated_view(*args, **kwargs):
try:
result = view(*args, **kwargs)
except ObjectDoesNotExist:
return HttpResponse("Object not found", status=404)
return result
return decorated_view | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view(obj, request):\n return HTTPNotFound()",
"def not_found(*args, **kwargs):\n return HttpResponseBehaviour(HttpResponse, status=404, *args, **kwargs)",
"def does_not_exist_decorator(function):\n def wrapped(self, request, pk):\n try:\n return function(self, request, pk)\n ... | [
"0.8010767",
"0.7458294",
"0.739739",
"0.7309831",
"0.72938985",
"0.7230448",
"0.71405756",
"0.7082089",
"0.7051239",
"0.7024535",
"0.6962517",
"0.69476753",
"0.683699",
"0.6832156",
"0.67715216",
"0.6765425",
"0.67570794",
"0.67432296",
"0.6724413",
"0.6670817",
"0.6603459",... | 0.8922439 | 0 |
Requests with wrong xtoken parameter. | def test_wrong_pwmerchactive_update_11(self, _authorization):
user1.headers['x-token'] = user1.headers['x-token'] + '1'
user1.pwmerchactive(method='update', params={'m_lid': user1.merchant1.lid, 'payway': 'visamc', 'is_active': True})
assert user1.resp_pwmerchactive == {'code': -32034, 'data': {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request(self, token):\n pass",
"def test_wrong_token(self):\n wrong_token = \"1\"*64\n expected_result = \"You have to give your token\"\n resp = SearchTest.client.get('/api/search/',{\"token\":wrong_token,\"search_string\":\"Umut\"})\n self.assertEqual(json.loads(resp.cont... | [
"0.6698403",
"0.63237596",
"0.62631524",
"0.61119986",
"0.6102831",
"0.60615206",
"0.5958202",
"0.59007865",
"0.58674127",
"0.58491606",
"0.58477473",
"0.58326393",
"0.57885826",
"0.57633305",
"0.5745354",
"0.5745226",
"0.56676394",
"0.56487596",
"0.5644198",
"0.56332684",
"0... | 0.0 | -1 |
Requests with NONE xtoken parameter. | def test_wrong_pwmerchactive_update_12(self, _authorization):
user1.headers['x-token'] = None
user1.pwmerchactive(method='update', params={'m_lid': user1.merchant1.lid, 'payway': 'visamc', 'is_active': True})
assert user1.resp_pwmerchactive == {'code': -32012, 'data': {'field': 'x-token', 'reaso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request(self, token):\n pass",
"def test_falsepositive_no_token_passed(client):\n g.test_authorized_for = []\n res = client.get(\"/v0/falsepositive?fp=splunk_82998ef6bb3db9dff3dsfdsfsdc\")\n assert res.status == \"500 INTERNAL SERVER ERROR\"",
"def unauthorized_token(self):\n scope =... | [
"0.64633083",
"0.62042487",
"0.619624",
"0.6160699",
"0.60490936",
"0.6048648",
"0.6048648",
"0.5980123",
"0.5880537",
"0.58082926",
"0.57502276",
"0.57061076",
"0.56770885",
"0.56516266",
"0.56364024",
"0.5602018",
"0.5587482",
"0.5576026",
"0.55576223",
"0.5548565",
"0.5526... | 0.0 | -1 |
Given an observed signal, decompose it into component signals corresponding to the state space models. The return value "means" is a list, indexed in the same way as the component ssms, in which each entry is an array, of length equal to the activation time for that component, containing the mean observations from the ... | def component_means(self, z):
# pre-allocate space by initializing each component to its prior mean.
# This is only really relevant if a component starts before time 0, in
# which case those unobserved timesteps will never be updated and so
# will remain at the prior mean.
means... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect_signal_by_mean(self):\n \n estimated_signal = []\n \n for mu in self.prox_mu:\n obj_list = np.abs(mu - np.array(self.constellation))\n estimated_signal.append(self.constellation[np.argmin(obj_list)])\n return estimated_signal",
"def decompose(s... | [
"0.5970154",
"0.5559659",
"0.5433129",
"0.5429857",
"0.5294867",
"0.5215967",
"0.5131873",
"0.51118237",
"0.5108953",
"0.5040359",
"0.50064975",
"0.49057356",
"0.4900128",
"0.48790053",
"0.48566237",
"0.48442557",
"0.48438776",
"0.48411015",
"0.48270077",
"0.4815442",
"0.4813... | 0.68908525 | 0 |
method read_lines Reads n lines of a text file. | def read_lines(filename="", nb_lines=0):
line_count = 0
with open(filename, mode='r', encoding='utf-8') as f:
for lines in f:
line_count += 1
with open(filename, mode='r', encoding='utf-8') as f:
if nb_lines <= 0 or nb_lines >= line_count:
result = f.read()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_lines(filename=\"\", nb_lines=0):\n number_of_lines = __import__('1-number_of_lines').number_of_lines\n count = 0\n num_file_lines = number_of_lines(filename)\n with open(filename, mode='r', encoding=\"utf=8\") as myFile:\n if nb_lines <= 0 or nb_lines >= num_file_lines:\n pr... | [
"0.7268344",
"0.71354854",
"0.7106047",
"0.7105588",
"0.7063013",
"0.7024116",
"0.7004697",
"0.69662595",
"0.692473",
"0.6881333",
"0.6861654",
"0.6811",
"0.67794925",
"0.67581856",
"0.6752288",
"0.66426194",
"0.66404617",
"0.65971303",
"0.6594355",
"0.6573439",
"0.65631616",... | 0.7201658 | 1 |
Returns the incoming and outgoing signals of the trace step. | def GetSignals(cls):
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signals(self):\n if self._current_inputs is None:\n raise RuntimeError(\n 'Internal Error: The current inputs have not been properly '\n 'generated. First call features_and_labels, then call signals.')\n signals = self._current_inputs['signals']\n self._current_inputs = None\n ... | [
"0.6562377",
"0.6494185",
"0.6203407",
"0.61020756",
"0.6059595",
"0.57539916",
"0.56604606",
"0.5464868",
"0.54622394",
"0.54430753",
"0.5384836",
"0.53760666",
"0.52864325",
"0.52855504",
"0.527248",
"0.5258856",
"0.5238557",
"0.51790494",
"0.5157555",
"0.51270163",
"0.5106... | 0.6369334 | 2 |
Spectate wolfchat or deadchat. | def spectate(var, wrapper, message):
spectate_chat(var, wrapper, message, is_fspectate=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fspectate(var, wrapper, message):\n spectate_chat(var, wrapper, message, is_fspectate=True)",
"def speak(self):\n print(\"meow!\")",
"def talk(self):\n print('Meow!')",
"def whisper(sock, user, msg):\r\n chat(sock, \"/w {} {}\".format(user, msg))",
"def send_chat(self, text, sender,... | [
"0.6346055",
"0.6216687",
"0.61955804",
"0.610677",
"0.6104843",
"0.60742223",
"0.5984449",
"0.59701616",
"0.5920163",
"0.5911504",
"0.5904558",
"0.58960944",
"0.58530426",
"0.58404297",
"0.5830531",
"0.58299553",
"0.58089155",
"0.57721525",
"0.57511353",
"0.57092166",
"0.570... | 0.71327454 | 0 |
Spectate wolfchat or deadchat. | def fspectate(var, wrapper, message):
spectate_chat(var, wrapper, message, is_fspectate=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spectate(var, wrapper, message):\n spectate_chat(var, wrapper, message, is_fspectate=False)",
"def speak(self):\n print(\"meow!\")",
"def talk(self):\n print('Meow!')",
"def whisper(sock, user, msg):\r\n chat(sock, \"/w {} {}\".format(user, msg))",
"def send_chat(self, text, sender,... | [
"0.71334726",
"0.621718",
"0.61961",
"0.6106861",
"0.6104521",
"0.6074134",
"0.5984058",
"0.59705645",
"0.59206975",
"0.5912107",
"0.590466",
"0.5896434",
"0.5852908",
"0.5841366",
"0.5830875",
"0.58302695",
"0.5809067",
"0.5772693",
"0.5751408",
"0.57087713",
"0.5707982",
... | 0.63472015 | 1 |
Initializes exchanger with the host and port of this node. nodes_addresses list of (host, port) other nodes addresses. | def __init__(self, nodes_manager):
self.lock_to_exchange = Lock()
self.lock_to_return = Lock()
self.nodes_manager = nodes_manager
#start server thread
self.server_thread = ServerThread(self.nodes_manager.get_self_address()[0],
self.nodes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, node_number, all_nodes):\n self.self_host = 'localhost'\n self.base_port = 5000\n self.self_port = self.base_port + node_number\n self.other_nodes = [(self.self_host, p)\n for p in range(self.base_port + 1, self.base_port + all_nodes + 1)\n ... | [
"0.5877478",
"0.5725055",
"0.56731623",
"0.56109583",
"0.5599481",
"0.55772084",
"0.5532085",
"0.5445767",
"0.54003644",
"0.53673726",
"0.52791685",
"0.5248636",
"0.5170874",
"0.5167395",
"0.51551306",
"0.5151565",
"0.5132089",
"0.5106507",
"0.50530463",
"0.5046945",
"0.50469... | 0.51693046 | 13 |
__init__ This is a constructor function for the gym environment. This function initializes the environment with all the necessary variables such as observation space, action space and the arena dimensions. It also connects to Pybullet. | def __init__(self, direct=1):
if not direct:
self.physicsClient = p.connect(p.GUI)
else:
self.physicsClient = p.connect(p.DIRECT)
#The max_dist variables define the size of the arena
#n defines the number of agents in the world.
self.max_dist_x = 4
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, env):\n gym.Wrapper.__init__(self, env)",
"def __init__(self, env):\n gym.Wrapper.__init__(self, env)",
"def __init__(self, env):\n self.env = env\n # set up observation space\n high = np.inf\n low = -high\n\n obs_spec = env.observation_spec()... | [
"0.76031476",
"0.76031476",
"0.7523095",
"0.726487",
"0.7221525",
"0.7202453",
"0.71900094",
"0.71826565",
"0.7170464",
"0.71256644",
"0.71191764",
"0.71191764",
"0.7107657",
"0.7098821",
"0.7098821",
"0.70655084",
"0.70484686",
"0.70380527",
"0.70356023",
"0.7030139",
"0.703... | 0.6170483 | 82 |
Negative test for check validation on entering an existing email | def test_registration_entering_an_existing_email(self):
print('========================================================================')
print('Negative test for check validation on entering an existing email')
#Load Registrtion page
self.reg_page.open_registration_page()
d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_email(self, email):\n if email.data != current_user.email:\n user = User.query.filter_by(email=email.data).first()\n if user:\n raise ValidationError('That email already exists. Please choose another email.')",
"def validate_email(self, email):\n us... | [
"0.8014481",
"0.80072707",
"0.7917731",
"0.7905062",
"0.7887719",
"0.78371507",
"0.77891135",
"0.7768274",
"0.7748482",
"0.7738046",
"0.7729739",
"0.7729498",
"0.7729498",
"0.7725908",
"0.76466626",
"0.760168",
"0.759047",
"0.75794166",
"0.75684464",
"0.7548612",
"0.75468975"... | 0.0 | -1 |
GET requests for the EmailTemplate object. | def _get(self, object='emailTemplate', path=None, params=None):
if params is None:
params = {}
result = self.client.get(object=object, path=path, params=params)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get(self, object_name='emailTemplate', path=None, params=None):\n if params is None:\n params = {}\n response = self.client.get(object_name=object_name, path=path, params=params)\n return response",
"def get(self, method):\n\t\ttemplate = self.get_argument(\"template\", None)... | [
"0.7830836",
"0.6613497",
"0.63831586",
"0.63410205",
"0.6307178",
"0.6302931",
"0.6258569",
"0.6096029",
"0.6084098",
"0.6007324",
"0.59788764",
"0.5958852",
"0.59221536",
"0.5910061",
"0.5910061",
"0.5910061",
"0.5910061",
"0.5910061",
"0.5893301",
"0.5852802",
"0.5852802",... | 0.7543157 | 1 |
This returns the Robot instance at Index location in the robots list. | def GetRobot(self, Index): # return requested robot
return self.__robotList[Index] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def robot(self):\n return equipment_module.Equipment(self._get_attr('robot_id'))",
"def robot(self):\n return equipment_module.Equipment(\n self._get_attr('extraction_robot_id'))",
"def findByIndex(self, obj_index):\n return self.registry.findByIndex(obj_index)",
"def select_o... | [
"0.6019267",
"0.5841748",
"0.5735032",
"0.56471235",
"0.56186324",
"0.55972165",
"0.55972165",
"0.55389047",
"0.5483078",
"0.5483078",
"0.53771985",
"0.53771985",
"0.537505",
"0.5368251",
"0.52839214",
"0.5233336",
"0.5229995",
"0.5204781",
"0.5157226",
"0.5149218",
"0.513845... | 0.84175014 | 0 |
Add the object to the current DB session | def new(self, obj):
if obj:
self.__session.add(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, obj):\n self.getSession().add(obj)\n self.commit() # paranoially\n return obj",
"def add(self, obj):\n self.session.add(obj)",
"def add(self, object):\n self.lock.acquire()\n self.__Session.add(object)\n self.__Session.commit(... | [
"0.845853",
"0.8108774",
"0.79950076",
"0.7909001",
"0.7909001",
"0.7806451",
"0.7806451",
"0.7806451",
"0.7806451",
"0.7806451",
"0.7806451",
"0.7806451",
"0.7806451",
"0.77238256",
"0.7680321",
"0.7680321",
"0.7605768",
"0.7537908",
"0.7531723",
"0.7531723",
"0.7531723",
... | 0.76688427 | 17 |
Take a text as input and insert space before every uppercase letter. | def sep_upper(text):
new_text = ""
for letter in text:
if letter.isupper():
new_text += " " + letter
else:
new_text += letter
return new_text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capify(text):\n return text[0].upper() + text[1:]",
"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.79375243",
"0.78663856",
"0.7640557",
"0.74669224",
"0.73612046",
"0.72520375",
"0.7221301",
"0.71751356",
"0.71203965",
"0.7108606",
"0.7100158",
"0.70674396",
"0.69983584",
"0.6985538",
"0.69455665",
"0.6945064",
"0.6861432",
"0.6848866",
"0.6829068",
"0.6806665",
"0.677... | 0.7936654 | 1 |
Check if tag is in Authorization Cache. | async def is_tag_authorized(self, id_tag: str) -> bool:
return next((tag["status"] == "Accepted" for tag in self.__cached_tags if tag["id"] == id_tag), False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_cache(self):\n return os.path.exists(self._cache_key)",
"def isCacheable(self, segments, request):\n\t\treturn False",
"def _cache_has(self, metric_name):\n with self._lock:\n return metric_name in self.__cache",
"def _may_cache(self, request, response=None):\n # an... | [
"0.6342695",
"0.6159578",
"0.6061159",
"0.6017732",
"0.60021174",
"0.5965611",
"0.59326124",
"0.5929982",
"0.5929024",
"0.5898565",
"0.5893441",
"0.58602566",
"0.58588696",
"0.5828897",
"0.5804853",
"0.5765502",
"0.5714091",
"0.5669254",
"0.5640751",
"0.56387115",
"0.56301486... | 0.6468681 | 0 |
Update the list with new authentication tags. | async def update_cached_tags(self, tag_list: list):
if not self.__is_cache_supported:
return
tasks = []
for tag in tag_list:
tasks.append(self.update_tag_info(tag["id"], tag["id_tag_info"]))
await asyncio.gather(*tasks) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateTag(self, authenticationToken, tag):\r\n pass",
"def listTags(self, authenticationToken):\r\n pass",
"def update_tags(self, tags, **kwargs):\n request = RequestMiddleware.get_request()\n is_admin = request.user and request.user.is_admin\n # Keep all tags that start with pf:... | [
"0.66152817",
"0.6482847",
"0.6285277",
"0.60566837",
"0.60436326",
"0.60231286",
"0.5927126",
"0.59223205",
"0.5845996",
"0.5762815",
"0.566292",
"0.566292",
"0.566292",
"0.56616503",
"0.565309",
"0.56256855",
"0.5553762",
"0.555119",
"0.555119",
"0.555119",
"0.555119",
"0... | 0.60190004 | 6 |
Keep only the topk rows of grads. | def keep_partial_grad(grad, topk):
assert topk < grad.size(0)
grad.data[topk:].zero_()
return grad | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def k_truss(G, k):\n H = G.copy()\n\n n_dropped = 1\n while n_dropped > 0:\n n_dropped = 0\n to_drop = []\n seen = set()\n for u in H:\n nbrs_u = set(H[u])\n seen.add(u)\n new_nbrs = [v for v in nbrs_u if v not in seen]\n for v in new... | [
"0.62399876",
"0.61997133",
"0.59955543",
"0.5953879",
"0.5789937",
"0.5632634",
"0.55939144",
"0.5585566",
"0.55632806",
"0.5535749",
"0.55344725",
"0.5514266",
"0.5441128",
"0.5437223",
"0.5433779",
"0.5425325",
"0.54184663",
"0.53951067",
"0.53744555",
"0.53595495",
"0.529... | 0.5277698 | 26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.