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 |
|---|---|---|---|---|---|---|
getTypeCode(QualitativeSpecies self) > int Returns the libSBML type code of this object instance. LibSBML attaches an identifying code to every kind of SBML object. These are integer constants known as SBML type codes. The names of all the codes begin with the characters SBML_. In the Python language interface for libS... | def getTypeCode(self):
return _libsbml.QualitativeSpecies_getTypeCode(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTypeCode(self):\n return _libsbml.SpeciesType_getTypeCode(self)",
"def getTypeCode(self):\n return _libsbml.Species_getTypeCode(self)",
"def getTypeCode(self):\n return _libsbml.MultiSpeciesType_getTypeCode(self)",
"def getTypeCode(self):\n return _libsbml.SpeciesFeature_ge... | [
"0.8251385",
"0.8247352",
"0.8087497",
"0.79567975",
"0.79506785",
"0.7949319",
"0.7899568",
"0.7867925",
"0.77477974",
"0.7728114",
"0.77254426",
"0.7717585",
"0.76441765",
"0.76347905",
"0.76263064",
"0.7622636",
"0.7614503",
"0.76040506",
"0.75972956",
"0.75581706",
"0.752... | 0.85061026 | 0 |
hasRequiredAttributes(QualitativeSpecies self) > bool Predicate returning True if all the required attributes for this QualitativeSpecies object have been set. | def hasRequiredAttributes(self):
return _libsbml.QualitativeSpecies_hasRequiredAttributes(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hasRequiredAttributes(self):\n return _libsbml.Species_hasRequiredAttributes(self)",
"def hasRequiredAttributes(self):\n return _libsbml.SpeciesFeature_hasRequiredAttributes(self)",
"def hasRequiredAttributes(self):\n return _libsbml.SpeciesType_hasRequiredAttributes(self)",
"def has... | [
"0.860422",
"0.85223645",
"0.84621537",
"0.84177667",
"0.8362702",
"0.83540666",
"0.83475584",
"0.82773226",
"0.8272791",
"0.8173641",
"0.81686926",
"0.8131315",
"0.8058912",
"0.7934115",
"0.79225075",
"0.7831877",
"0.7810732",
"0.77291375",
"0.77176726",
"0.7695203",
"0.7693... | 0.8923338 | 0 |
clone(ListOfQualitativeSpecies self) > ListOfQualitativeSpecies Creates and returns a deep copy of this ListOfQualitativeSpecies object. Returns a (deep) copy of this ListOfQualitativeSpecies object. | def clone(self):
return _libsbml.ListOfQualitativeSpecies_clone(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone(self):\n return _libsbml.ListOfSpecies_clone(self)",
"def clone(self):\n return _libsbml.QualitativeSpecies_clone(self)",
"def clone(self):\n return _libsbml.ListOfSpeciesFeatures_clone(self)",
"def clone(self):\n return _libsbml.ListOfSpeciesReferences_clone(self)",
"... | [
"0.76562405",
"0.7554891",
"0.7160993",
"0.7119521",
"0.70692575",
"0.70397156",
"0.7019618",
"0.7012707",
"0.6976716",
"0.68573844",
"0.67186207",
"0.6603359",
"0.65384465",
"0.64883965",
"0.6472298",
"0.6389098",
"0.6355467",
"0.63220584",
"0.6249311",
"0.62133384",
"0.6193... | 0.8432315 | 0 |
getElementName(ListOfQualitativeSpecies self) > string Returns the XML name of this object. Returns the name of this element. | def getElementName(self):
return _libsbml.ListOfQualitativeSpecies_getElementName(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getElementName(self):\n return _libsbml.QualitativeSpecies_getElementName(self)",
"def getElementName(self):\n return _libsbml.ListOfSpecies_getElementName(self)",
"def getElementName(self):\n return _libsbml.Species_getElementName(self)",
"def getElementName(self):\n return _... | [
"0.85334176",
"0.8158498",
"0.78705055",
"0.77157575",
"0.76700205",
"0.7668395",
"0.7658522",
"0.7633921",
"0.76130384",
"0.75604624",
"0.7534809",
"0.7489012",
"0.7484668",
"0.745665",
"0.7420302",
"0.73884135",
"0.73517525",
"0.73475116",
"0.7276028",
"0.7275495",
"0.72632... | 0.8742324 | 0 |
getItemTypeCode(ListOfQualitativeSpecies self) > int Returns the libSBML type code for the SBML objects contained in this ListOf object. LibSBML attaches an identifying code to every kind of SBML object. These are integer constants known as SBML type codes. The names of all the codes begin with the characters SBML_. In... | def getItemTypeCode(self):
return _libsbml.ListOfQualitativeSpecies_getItemTypeCode(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getItemTypeCode(self):\n return _libsbml.ListOfSpecies_getItemTypeCode(self)",
"def getItemTypeCode(self):\n return _libsbml.ListOfSpeciesTypes_getItemTypeCode(self)",
"def getItemTypeCode(self):\n return _libsbml.ListOfMultiSpeciesTypes_getItemTypeCode(self)",
"def getItemTypeCode(s... | [
"0.80146945",
"0.78744626",
"0.78301936",
"0.78231925",
"0.78177917",
"0.78089106",
"0.78074944",
"0.7802479",
"0.7757668",
"0.7685364",
"0.7602395",
"0.7579034",
"0.74475634",
"0.74388653",
"0.7433956",
"0.74077785",
"0.7267485",
"0.717973",
"0.7098809",
"0.70866084",
"0.705... | 0.8202222 | 0 |
clone(Transition self) > Transition Creates and returns a deep copy of this Transition object. Returns a (deep) copy of this Transition object. | def clone(self):
return _libsbml.Transition_clone(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone(self):\n return _libsbml.ListOfTransitions_clone(self)",
"def __copy__(self):\n new = FSMTransition(self.from_state, self.to_state,\n self.word_in, self.word_out)\n if hasattr(self, 'hook'):\n new.hook = self.hook\n return new",
"def _... | [
"0.7048559",
"0.69650126",
"0.6479733",
"0.6337103",
"0.60895276",
"0.6074381",
"0.60228485",
"0.59947073",
"0.5965081",
"0.59405947",
"0.59304005",
"0.5927561",
"0.5882452",
"0.5863257",
"0.58559644",
"0.5851744",
"0.5850176",
"0.5850176",
"0.5850176",
"0.5850176",
"0.582992... | 0.860008 | 0 |
getId(Transition self) > string Returns the value of the 'id' attribute of this Transition. | def getId(self):
return _libsbml.Transition_getId(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setId(self, *args):\n return _libsbml.Transition_setId(self, *args)",
"def GetId(self):\n return int(self.id)",
"def id(self) -> str:\n return self._id # type: ignore[return-value]",
"def get_id(self) -> int:\n return self.id",
"def get_id(self) -> int:\n return self... | [
"0.74237436",
"0.6904805",
"0.6894639",
"0.68606645",
"0.68606645",
"0.6834948",
"0.6834948",
"0.6834948",
"0.6834948",
"0.6834948",
"0.6834948",
"0.68245584",
"0.6818507",
"0.6818507",
"0.6818507",
"0.6818507",
"0.6818507",
"0.6818507",
"0.6818507",
"0.6818507",
"0.6818507",... | 0.820247 | 0 |
isSetName(Transition self) > bool Predicate returning True or False depending on whether this Transition's 'name' attribute has been set. In SBML Level 3 Version 2, the 'id' and 'name' attributes were moved to SBase directly, instead of being defined individually for many (but not all) objects. Libsbml has for a long t... | def isSetName(self):
return _libsbml.Transition_isSetName(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isSetName(self):\n return _libsbml.Member_isSetName(self)",
"def isSetName(self):\n return _libsbml.Reaction_isSetName(self)",
"def isSetName(self):\n return _libsbml.SBase_isSetName(self)",
"def isSetName(self):\n return _libsbml.FluxObjective_isSetName(self)",
"def isSetNa... | [
"0.67383605",
"0.66731083",
"0.6624895",
"0.6608308",
"0.6579199",
"0.6569098",
"0.6558112",
"0.6516113",
"0.648315",
"0.6477541",
"0.6473446",
"0.6465638",
"0.6452295",
"0.6445679",
"0.64412665",
"0.643871",
"0.6410269",
"0.6399704",
"0.6318528",
"0.63145757",
"0.62940204",
... | 0.7601228 | 0 |
setId(Transition self, string sid) > int Sets the value of the 'id' attribute of this Transition. The string 'sid' is copied. The identifier given by an object's 'id' attribute value is used to identify the object within the SBML model definition. Other objects can refer to the component using this identifier. The data... | def setId(self, *args):
return _libsbml.Transition_setId(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setId(self, *args):\n return _libsbml.SBase_setId(self, *args)",
"def set_id(self, id):\n self.id = id\n print(\"self id = \" + str(self.id))",
"def setID(self, id):\r\n raise NotImplementedError(\"must be implemented in subclass\")",
"def set_id(self, id_=None):\n if i... | [
"0.68760395",
"0.68598914",
"0.683563",
"0.6570218",
"0.6497931",
"0.6479229",
"0.64336324",
"0.63743883",
"0.6364148",
"0.6364148",
"0.6364148",
"0.6364148",
"0.6364148",
"0.6364148",
"0.6364148",
"0.6364148",
"0.6364148",
"0.6364148",
"0.6364148",
"0.6364148",
"0.63522434",... | 0.77705353 | 0 |
setName(Transition self, string name) > int Sets the value of the 'name' attribute of this Transition. The string in 'name' is copied. Parameter 'name' is the new name for the SBML object. Returns integer value indicating success/failure of the function. | def setName(self, *args):
return _libsbml.Transition_setName(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\r\n self.stream.set_node_name(self.node, name)",
"def SetName(self, name):\n self.name = name",
"def setName(self, name):\n self._name = name",
"def setName(self, name):\n self._name = name",
"def setName(self, name): \n\n self._name = nam... | [
"0.69756985",
"0.6974969",
"0.6965173",
"0.6965173",
"0.69582146",
"0.6932883",
"0.69185954",
"0.69185954",
"0.6916161",
"0.690448",
"0.689656",
"0.68894917",
"0.68894917",
"0.68894917",
"0.68894917",
"0.68894917",
"0.6887909",
"0.68640345",
"0.685682",
"0.685682",
"0.6843486... | 0.797329 | 0 |
unsetId(Transition self) > int Unsets the value of the 'id' attribute of this Transition. The identifier given by an object's 'id' attribute value is used to identify the object within the SBML model definition. Other objects can refer to the component using this identifier. The data type of 'id' is always SId or a typ... | def unsetId(self):
return _libsbml.Transition_unsetId(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsetId(self):\n return _libsbml.SBase_unsetId(self)",
"def unsetId(self):\n return _libsbml.ASTNode_unsetId(self)",
"def unsetId(self):\n return _libsbml.Member_unsetId(self)",
"def unsetId(self):\n return _libsbml.Input_unsetId(self)",
"def unsetId(self):\n return _... | [
"0.7629414",
"0.75805134",
"0.74475867",
"0.74366283",
"0.7345892",
"0.7296333",
"0.7289495",
"0.7288196",
"0.72756195",
"0.7273904",
"0.721918",
"0.715144",
"0.70863324",
"0.7023124",
"0.700994",
"0.6883152",
"0.6824954",
"0.67849654",
"0.6664465",
"0.6658345",
"0.6608633",
... | 0.86325556 | 0 |
getListOfInputs(Transition self) > ListOfInputs getListOfInputs(Transition self) > ListOfInputs Returns the 'ListOfInputs' in this Transition object. Returns the 'ListOfInputs' attribute of this Transition. | def getListOfInputs(self, *args):
return _libsbml.Transition_getListOfInputs(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_inputs(self) -> List[NodeValue]:\n\n return self.inputs_",
"def get(self, *args):\n return _libsbml.ListOfInputs_get(self, *args)",
"def get_inputs(self):\n return self.attributes[\"inputs\"]",
"def get_inputs(self):\n return self.inputs",
"def inputs(self):\n return ... | [
"0.69746196",
"0.6914608",
"0.6798783",
"0.67723864",
"0.66993994",
"0.65777624",
"0.65777624",
"0.65777624",
"0.6480712",
"0.64686453",
"0.64686453",
"0.64686453",
"0.64133877",
"0.64050984",
"0.6326125",
"0.6303814",
"0.62650186",
"0.62650186",
"0.61280954",
"0.6070932",
"0... | 0.8016023 | 0 |
createInput(Transition self) > Input Creates a new Input object, adds it to this Transition's ListOfInputs and returns the Input object created. Returns a new Input object instance. See also addInput(). | def createInput(self):
return _libsbml.Transition_createInput(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addInput(self, *args):\n return _libsbml.Transition_addInput(self, *args)",
"def CreateInput(self, name=None, type=None, data=None):\n\n\n inp = self._input_registry.Create(name, type, data)\n\n self._inputs.append(inp)\n\n return inp",
"def get_input(self, input_number: int) ->... | [
"0.66809946",
"0.6655563",
"0.66089517",
"0.6497645",
"0.6441029",
"0.6155117",
"0.57621574",
"0.56098604",
"0.55702794",
"0.55483264",
"0.55355835",
"0.5519544",
"0.5413748",
"0.536221",
"0.5327338",
"0.5290095",
"0.5246129",
"0.5240196",
"0.52277184",
"0.51911414",
"0.51686... | 0.8289853 | 0 |
getListOfOutputs(Transition self) > ListOfOutputs getListOfOutputs(Transition self) > ListOfOutputs Returns the 'ListOfOutputs' in this Transition object. Returns the 'ListOfOutputs' attribute of this Transition. | def getListOfOutputs(self, *args):
return _libsbml.Transition_getListOfOutputs(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _list_outputs(self):\n \n outputs = self._outputs().get()\n return outputs",
"def get(self, *args):\n return _libsbml.ListOfOutputs_get(self, *args)",
"def list_outputs(self):\n resp = self._api.list_task_outputs(self._job, self.id)\n\n if resp.success:\n ... | [
"0.7521194",
"0.7397343",
"0.7102305",
"0.6921169",
"0.6864974",
"0.6863769",
"0.6863769",
"0.6825181",
"0.6794145",
"0.67781526",
"0.6596359",
"0.6510843",
"0.64720386",
"0.64579785",
"0.6445766",
"0.6429861",
"0.642267",
"0.6324402",
"0.6323935",
"0.63239247",
"0.6296784",
... | 0.82703495 | 0 |
getNumOutputs(Transition self) > unsigned int Get the number of Output objects in this Transition. Returns the number of Output objects in this Transition. | def getNumOutputs(self):
return _libsbml.Transition_getNumOutputs(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nOutputs(self):\n\n\t\treturn self._nOutputs",
"def outputs_count(self):\n return len(self._output_nodes_map.keys())",
"def get_num_outputs(self):\n return len(self.outputs)",
"def n_outputs(self):\n return self.__n_outputs",
"def n_outputs(self):\n return len(self.output_na... | [
"0.8460902",
"0.8410829",
"0.8185859",
"0.80816513",
"0.8006691",
"0.78336716",
"0.78336716",
"0.7112034",
"0.69995874",
"0.6847163",
"0.66057867",
"0.656833",
"0.64816064",
"0.64731747",
"0.645177",
"0.64312434",
"0.64247984",
"0.64025754",
"0.6383962",
"0.6383962",
"0.63679... | 0.89779866 | 0 |
getFunctionTerm(Transition self, unsigned int n) > FunctionTerm getFunctionTerm(Transition self, unsigned int n) > FunctionTerm getFunctionTerm(Transition self, string sid) > FunctionTerm getFunctionTerm(Transition self, string sid) > FunctionTerm This method has multiple variants they differ in the arguments they acce... | def getFunctionTerm(self, *args):
return _libsbml.Transition_getFunctionTerm(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createFunctionTerm(self):\n return _libsbml.Transition_createFunctionTerm(self)",
"def addFunctionTerm(self, *args):\n return _libsbml.Transition_addFunctionTerm(self, *args)",
"def getNumFunctionTerms(self):\n return _libsbml.Transition_getNumFunctionTerms(self)",
"def getListOfFunc... | [
"0.71109694",
"0.6406682",
"0.6106254",
"0.5887159",
"0.58579034",
"0.55904484",
"0.544042",
"0.5415978",
"0.5381254",
"0.53041226",
"0.5294753",
"0.52806544",
"0.52806544",
"0.52806544",
"0.52583617",
"0.5254769",
"0.5200843",
"0.5197566",
"0.5197566",
"0.5197566",
"0.519756... | 0.82475716 | 0 |
createFunctionTerm(Transition self) > FunctionTerm Creates a new FunctionTerm object, adds it to this Transition's ListOfFunctionTerms and returns the FunctionTerm object created. Returns a new FunctionTerm object instance. See also addFunctionTerm(). | def createFunctionTerm(self):
return _libsbml.Transition_createFunctionTerm(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addFunctionTerm(self, *args):\n return _libsbml.Transition_addFunctionTerm(self, *args)",
"def getFunctionTerm(self, *args):\n return _libsbml.Transition_getFunctionTerm(self, *args)",
"def clone(self):\n return _libsbml.FunctionTerm_clone(self)",
"def removeFunctionTerm(self, *args)... | [
"0.73322326",
"0.6765505",
"0.62010753",
"0.5593921",
"0.5465504",
"0.5457215",
"0.52048385",
"0.515488",
"0.51468724",
"0.51292837",
"0.50860506",
"0.5002205",
"0.4973273",
"0.4968532",
"0.49347126",
"0.49202448",
"0.490759",
"0.48877886",
"0.48698157",
"0.48212153",
"0.4801... | 0.846328 | 0 |
isSetDefaultTerm(Transition self) > bool Predicate returning True if the defaultTerm for this Transition object has been set. Returns a boolean value indicating whether the defaultTerm child for this object has been defined. | def isSetDefaultTerm(self):
return _libsbml.Transition_isSetDefaultTerm(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isSetDefaultTerm(self):\n return _libsbml.ListOfFunctionTerms_isSetDefaultTerm(self)",
"def has_default(self):\r\n return self._default is not None",
"def has_default(self):\r\n return self.default is not None",
"def is_default(self) -> Optional[bool]:\n return pulumi.get(self... | [
"0.76273715",
"0.65225154",
"0.6514688",
"0.6491337",
"0.6470991",
"0.6430947",
"0.64165163",
"0.6396289",
"0.63824016",
"0.6349205",
"0.63160247",
"0.63160247",
"0.63160247",
"0.63160247",
"0.63160247",
"0.62792915",
"0.62296736",
"0.61656517",
"0.6150262",
"0.60961556",
"0.... | 0.8224956 | 0 |
getTypeCode(Transition self) > int Returns the libSBML type code of this object instance. LibSBML attaches an identifying code to every kind of SBML object. These are integer constants known as SBML type codes. The names of all the codes begin with the characters SBML_. In the Python language interface for libSBML, the... | def getTypeCode(self):
return _libsbml.Transition_getTypeCode(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTypeCode(self):\n return _libsbml.SBase_getTypeCode(self)",
"def getTypeCode(self):\n return _libsbml.ReplacedBy_getTypeCode(self)",
"def getTypeCode(self):\n return _libsbml.SBMLDocument_getTypeCode(self)",
"def getTypeCode(self):\n return _libsbml.Input_getTypeCode(self)"... | [
"0.78776795",
"0.7782219",
"0.7752227",
"0.77072734",
"0.768522",
"0.7605301",
"0.7588753",
"0.75823456",
"0.7543863",
"0.7527292",
"0.74826694",
"0.7444413",
"0.7427995",
"0.74114794",
"0.7410463",
"0.74084616",
"0.7349176",
"0.73347723",
"0.7324062",
"0.731108",
"0.7268764"... | 0.8074 | 0 |
hasRequiredElements(Transition self) > bool Predicate returning True if all the required attributes for this Transition object have been set. | def hasRequiredElements(self):
return _libsbml.Transition_hasRequiredElements(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hasRequiredElements(self):\n return _libsbml.Delay_hasRequiredElements(self)",
"def hasRequiredElements(self):\n return _libsbml.Rule_hasRequiredElements(self)",
"def hasRequiredElements(self):\n return _libsbml.Constraint_hasRequiredElements(self)",
"def hasRequiredElements(self):\n... | [
"0.77914745",
"0.77813303",
"0.7723501",
"0.76616764",
"0.7658418",
"0.7645384",
"0.7638971",
"0.7630445",
"0.7628171",
"0.7594989",
"0.7582519",
"0.7576642",
"0.75669146",
"0.7556233",
"0.7356625",
"0.7301993",
"0.7287939",
"0.7254287",
"0.7237651",
"0.71805006",
"0.71627843... | 0.85880977 | 0 |
clone(ListOfTransitions self) > ListOfTransitions Creates and returns a deep copy of this ListOfTransitions object. Returns a (deep) copy of this ListOfTransitions object. | def clone(self):
return _libsbml.ListOfTransitions_clone(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone(self):\n return _libsbml.Transition_clone(self)",
"def clone(self):\n return _libsbml.ListOfFluxObjectives_clone(self)",
"def copy(self) -> 'List':\n return self.__class__(self)",
"def clone(self):\n return _libsbml.ListOf_clone(self)",
"def copy(self):\n return... | [
"0.66907054",
"0.625216",
"0.62396264",
"0.6233905",
"0.6137185",
"0.6099419",
"0.6075079",
"0.60481083",
"0.58673954",
"0.585498",
"0.5770725",
"0.5744001",
"0.57271415",
"0.57197493",
"0.5680404",
"0.56747115",
"0.5663376",
"0.5640572",
"0.563307",
"0.56320447",
"0.56259364... | 0.8372183 | 0 |
getItemTypeCode(ListOfTransitions self) > int Returns the libSBML type code for the SBML objects contained in this ListOf object. LibSBML attaches an identifying code to every kind of SBML object. These are integer constants known as SBML type codes. The names of all the codes begin with the characters SBML_. In the Py... | def getItemTypeCode(self):
return _libsbml.ListOfTransitions_getItemTypeCode(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getItemTypeCode(self):\n return _libsbml.ListOfFluxObjectives_getItemTypeCode(self)",
"def getItemTypeCode(self):\n return _libsbml.ListOfObjectives_getItemTypeCode(self)",
"def getItemTypeCode(self):\n return _libsbml.ListOf_getItemTypeCode(self)",
"def getItemTypeCode(self):\n ... | [
"0.7403588",
"0.7285337",
"0.7108098",
"0.70300823",
"0.69624597",
"0.6945965",
"0.69313174",
"0.6861014",
"0.6853256",
"0.68479353",
"0.6846705",
"0.6820073",
"0.6812404",
"0.6793734",
"0.6783731",
"0.6771943",
"0.6745153",
"0.6736872",
"0.6730012",
"0.6725979",
"0.67024875"... | 0.7819964 | 0 |
UP/DOWN adjust speed, LEFT/RIGHT adjust rotation. | def pressed_key(self, key, dt):
if key == LEFT:
self.rotation -= spaceship_rotation(dt)
if key == RIGHT:
self.rotation += spaceship_rotation(dt)
if key == DOWN:
self.x_speed -= spaceship_acceleration_x(dt, self.rotation)
self.y_speed -= spaceship_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate(self,direction, speed=50):\n if direction == 1: \n self.leftMotor.run(Adafruit_MotorHAT.FORWARD)\n self.rightMotor.run(Adafruit_MotorHAT.BACKWARD)\n self.leftMotor.setSpeed(speed)\n self.rightMotor.setSpeed(speed)\n ... | [
"0.70217246",
"0.6880916",
"0.6753426",
"0.67186064",
"0.6671654",
"0.66642505",
"0.66642505",
"0.66640073",
"0.6640485",
"0.66120416",
"0.65488607",
"0.65102357",
"0.6493072",
"0.6467202",
"0.6442547",
"0.64065146",
"0.6388626",
"0.6323877",
"0.63225955",
"0.6320269",
"0.631... | 0.0 | -1 |
Activation Function for Each Perceptron | def activation_func(x):
a = -1
return 1/(1+np.exp(-a*x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perceptron_output(weights, bias, x):\n return step_function(dot(weights, x) + bias)",
"def activation_function(X):\n\tz = np.sum(w*x+b)\n\treturn z",
"def forward(W,X):\n return activation_func(np.dot(add_bias(X),W))",
"def pre_activation(features, weights, bias):\n # this is a dot product betwe... | [
"0.73425955",
"0.7264135",
"0.7223451",
"0.69351465",
"0.68756175",
"0.6848483",
"0.6830605",
"0.68207896",
"0.68114215",
"0.67897695",
"0.6789001",
"0.6781715",
"0.6757851",
"0.6757651",
"0.6710885",
"0.6703036",
"0.66887414",
"0.66662556",
"0.66520673",
"0.661821",
"0.66075... | 0.6667949 | 17 |
Compute softmax values for each sets of scores in x. | def softmax(x):
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7796294",
"0.7760558",
"0.7759004",
"0.77567077",
"0.76577055",
"0.76577055",
"0.76577055",
"0.76577055",
"0.7585655",
"0.743143",
"0.7407772",
"0.73941606",
"0.7358175",
"0.73174125",
"0.72689486",
"0.72623265",
"0.72614294",
"0.7256868",
"0.723019",
"0.7214918",
"0.72017... | 0.7127943 | 29 |
Code from Stack Overflow's thread 2D gaussian mask should give the same result as MATLAB's fspecial('gaussian',[shape],[sigma]) | def gauss_2d(shape=(3, 3), sigma=0.5):
m, n = [(ss - 1.) / 2. for ss in shape]
y, x = np.ogrid[-m:m + 1, -n:n + 1]
h = np.exp(-(x * x + y * y) / (2. * sigma * sigma))
h[h < np.finfo(h.dtype).eps * h.max()] = 0
sumh = h.sum()
if sumh != 0:
h /= sumh
return h | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fspecial_gaussian(shape=(3, 3), sigma=0.5):\n m, n = [(ss - 1.) / 2. for ss in shape]\n y, x = np.ogrid[-m:m + 1, -n:n + 1]\n h = np.exp(-(x * x + y * y) / (2. * sigma * sigma))\n h[h < np.finfo(h.dtype).eps * h.max()] = 0\n sumh = h.sum()\n if sumh != 0:\n h /= sumh\n return h",
... | [
"0.78782064",
"0.7834169",
"0.7259054",
"0.7125134",
"0.7015823",
"0.69773746",
"0.6972445",
"0.6864296",
"0.6864296",
"0.6855983",
"0.6816055",
"0.6783478",
"0.67776567",
"0.67624396",
"0.67597914",
"0.67268157",
"0.6701529",
"0.66928536",
"0.66527605",
"0.6613911",
"0.66111... | 0.6393613 | 36 |
Test verifying a non existing user. | def test_verify_non_existing_user(self):
data = {'rank_id': 1}
res = self.post(url='/verify/5', data=data, role='admin')
self.assertEqual(res.status_code, 401)
self.assertException(res, exc.EntryNotFound) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dont_create_user(self):\n self.assertFalse(User.objects.exists())",
"def test_nonexistent_user(self):\n nonexistent_username = \"nonexistent user\"\n self.retired_username = get_retired_username_by_username(nonexistent_username)\n data = {'username': nonexistent_username}\n ... | [
"0.81458473",
"0.7884479",
"0.78288144",
"0.78160477",
"0.76620656",
"0.75730705",
"0.756474",
"0.75563854",
"0.7539326",
"0.7537266",
"0.75151426",
"0.7484877",
"0.7477552",
"0.74619895",
"0.7366272",
"0.7358068",
"0.7348639",
"0.73446965",
"0.7339952",
"0.73183036",
"0.7300... | 0.7929797 | 1 |
Test verifying a user with an invalid rank_id. | def test_verify_non_existing_rank(self):
data = {'rank_id': 5}
res = self.post(url='/verify/4', data=data, role='admin')
self.assertEqual(res.status_code, 401)
self.assertException(res, exc.EntryNotFound) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_verify_non_existing_user(self):\n data = {'rank_id': 1}\n res = self.post(url='/verify/5', data=data, role='admin')\n self.assertEqual(res.status_code, 401)\n self.assertException(res, exc.EntryNotFound)",
"def _validate_rank(self, rank):\n if rank <= 0 or rank > self.... | [
"0.74525654",
"0.71842206",
"0.6718205",
"0.6461874",
"0.6258897",
"0.6218057",
"0.619879",
"0.6192426",
"0.6150947",
"0.61441946",
"0.61361325",
"0.6096373",
"0.60889053",
"0.6054368",
"0.6034396",
"0.5988692",
"0.5936365",
"0.5936318",
"0.59353435",
"0.5922913",
"0.58857226... | 0.76008564 | 0 |
Store the accumulated protocolWork from the NCMC simulation as property. | def protocolWork(self):
return self._ncfile.variables['protocolWork'][:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_protocolWork(self, stuff):\n #if u.is_quantity(stuff): stuff = stuff.value_in_unit(u.picoseconds)\n self._ncfile.variables['protocolWork'][self._last_protocolWork_frame] = float(stuff)\n self._last_protocolWork_frame += 1\n self.flush()",
"def add_protocolWork(self, stuff):\n ... | [
"0.6089553",
"0.6089553",
"0.55942667",
"0.5482047",
"0.54427",
"0.5438839",
"0.5417248",
"0.5416209",
"0.54119",
"0.5341371",
"0.5340415",
"0.53246653",
"0.5299486",
"0.51867133",
"0.51744264",
"0.51731217",
"0.51650435",
"0.5161273",
"0.51575994",
"0.51504743",
"0.513528",
... | 0.66935384 | 1 |
merge dicts into one | def merge(*dicts, **kwargs):
dicts = list(dicts)
dicts.append(kwargs)
return {key: value for d in dicts for key, value in d.items()} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_dicts(listDicts) :\n return dict(itertools.chain.from_iterable([x.items() for x in listDicts]))",
"def merge_n_dictionnaries(dicts):\n result = dicts[0]\n for i in range(1, len(dicts)):\n result = merge_2_dictionnaries(result, dicts[i])\n return result",
"def _join_dicts(dicts):\n ... | [
"0.7543492",
"0.74627084",
"0.7460546",
"0.7458084",
"0.737823",
"0.73721856",
"0.7329645",
"0.7329645",
"0.7319564",
"0.7300281",
"0.72677267",
"0.71997815",
"0.718603",
"0.718603",
"0.718603",
"0.7177635",
"0.71723264",
"0.70969254",
"0.70934707",
"0.7089759",
"0.70712316",... | 0.69600236 | 31 |
Gets the identicon's background color. This is always ``(240, 240, 240)``. Returns | def get_background(self):
return (240, 240, 240) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def background_color(self):\n return Color(self.GetBackground())",
"def GetBackgroundColour(self):\r\n\r\n return self._colBack",
"def background_color(self):\n return self._item.get(\"background_color\")",
"def get_color(self):\n return self._item.get(\"background_color\")",
"d... | [
"0.7511939",
"0.7456058",
"0.7314573",
"0.7280483",
"0.7231165",
"0.7182514",
"0.7153408",
"0.70779043",
"0.69972265",
"0.69626456",
"0.69260746",
"0.6821578",
"0.66291624",
"0.6589044",
"0.6553535",
"0.6462201",
"0.64592594",
"0.6451741",
"0.64432764",
"0.64292485",
"0.64285... | 0.7186307 | 5 |
Inserts this instance to database. | def add(self):
db.session.add(self)
db.session.commit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self):\n db.session.add(self)\n db.session.commit()",
"def insert(self):\n db.session.add(self)\n db.session.commit()",
"def insert(self):\n db.session.add(self)\n db.session.commit()",
"def insert(self):\n self.getDbRecord().insert()\n\n ret... | [
"0.8379246",
"0.8379246",
"0.8379246",
"0.8309824",
"0.7947078",
"0.7262382",
"0.7262382",
"0.7262382",
"0.7262382",
"0.72435963",
"0.7178349",
"0.7152083",
"0.71086925",
"0.6976029",
"0.69699895",
"0.689734",
"0.68734336",
"0.6870762",
"0.68559706",
"0.68295825",
"0.68295825... | 0.66123724 | 41 |
Returns a QuerySet instance with the ordering changed. | def order_by(self, *field_names):
assert self.query.can_filter(), \
"Cannot reorder a query once a slice has been taken."
clone = self._clone()
for field_name in field_names:
clone.query.order_by.append(field_name)
return clone | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reversed(self):\n return QuerySet(reversed(list(self)))",
"def queryset(self, ordering=None):\r\n qs = self.model._default_manager.get_query_set()\r\n if not ordering:\r\n ordering = self.ordering or () # otherwise we might try to *None, which is bad ;)\r\n if ordering... | [
"0.69883853",
"0.66274416",
"0.6597759",
"0.6495579",
"0.6489131",
"0.6410641",
"0.6388595",
"0.6246408",
"0.62038666",
"0.6185582",
"0.6114024",
"0.61105955",
"0.6004379",
"0.5984811",
"0.598277",
"0.59225583",
"0.59209746",
"0.5900335",
"0.58950555",
"0.5862968",
"0.5839227... | 0.5801905 | 23 |
Sets the status of this TodoProblemDetails. | def status(self, status):
self._status = status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_status(self, status):\n self.status = status",
"def set_status(self, status):\n self.status = status",
"def set_status(self, status):\n self.status = status",
"def status(self, status: str):\n allowed_values = [\"done\", \"late\", \"in progress\", \"to do\"] # noqa: E501\... | [
"0.70532095",
"0.70532095",
"0.70532095",
"0.69528145",
"0.68590045",
"0.68590045",
"0.68590045",
"0.68590045",
"0.68590045",
"0.68590045",
"0.68590045",
"0.68537647",
"0.6812735",
"0.68075496",
"0.6797693",
"0.6783434",
"0.67801934",
"0.67546487",
"0.67546487",
"0.6753434",
... | 0.6816693 | 18 |
Sets the problem_name of this TodoProblemDetails. | def problem_name(self, problem_name):
self._problem_name = problem_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_name(self, task_name):\n\n self._task_name = task_name",
"def _setTaskName(self, taskName):\n self._taskName = taskName\n self._progressChangedNotifier.notify(self)",
"async def setprob(self, ctx, problem_name=None):\n if problem_name:\n if not await problem_exis... | [
"0.6322532",
"0.6072212",
"0.6015277",
"0.5956337",
"0.5952094",
"0.59302473",
"0.5843181",
"0.57839",
"0.5779711",
"0.5779711",
"0.57721674",
"0.57702947",
"0.57659245",
"0.5748801",
"0.5720652",
"0.57107884",
"0.5702784",
"0.5702784",
"0.5702784",
"0.5702784",
"0.5702784",
... | 0.8055107 | 0 |
Sets the problem_redirect of this TodoProblemDetails. | def problem_redirect(self, problem_redirect):
self._problem_redirect = problem_redirect | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def problem_url(self, problem_url):\n\n self._problem_url = problem_url",
"def redirect(self, route):\n\n self.redirect_url = route\n return self",
"def redirectTo(self, route):\n\n self.redirect_route = route\n return self",
"def problem(self, problem):\n\n self._pr... | [
"0.6374198",
"0.60572743",
"0.60467345",
"0.57393324",
"0.5706305",
"0.54519796",
"0.5405565",
"0.5282454",
"0.52240443",
"0.51667506",
"0.51350343",
"0.5040451",
"0.5020366",
"0.49834427",
"0.4957646",
"0.49505037",
"0.49481413",
"0.4851089",
"0.48496646",
"0.48475447",
"0.4... | 0.81795365 | 0 |
Sets the contest_url of this TodoProblemDetails. | def contest_url(self, contest_url):
self._contest_url = contest_url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_url(self, url):\n self.url = url",
"def story_url(self, story_url):\n\n self._story_url = story_url",
"def set_url(self, url):\n if url is not None:\n self.url = url",
"def set_url(self, url):\n self.data['url'] = url",
"def contest_code(self, contest_code):\n... | [
"0.5783804",
"0.5731882",
"0.5729589",
"0.55476093",
"0.5534821",
"0.5422698",
"0.5407414",
"0.5378597",
"0.5309112",
"0.5295724",
"0.52693576",
"0.52502847",
"0.5243468",
"0.52183235",
"0.52183235",
"0.52183235",
"0.52183235",
"0.52183235",
"0.52183235",
"0.52183235",
"0.521... | 0.79646844 | 0 |
Sets the problem_url of this TodoProblemDetails. | def problem_url(self, problem_url):
self._problem_url = problem_url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_url(self, url):\n if url is not None:\n self.url = url",
"def problem(self, problem):\n\n self._problem = problem",
"def set_url(self, url):\n self.url = url",
"def set_url(self, url):\n self.data['url'] = url",
"def problem_type(self, problem_type):\n ... | [
"0.5969682",
"0.59095395",
"0.5888751",
"0.57255715",
"0.5711132",
"0.5648805",
"0.56294847",
"0.560347",
"0.56010604",
"0.55548644",
"0.5508379",
"0.5485384",
"0.5445561",
"0.5437808",
"0.5370707",
"0.53493965",
"0.53493965",
"0.53493965",
"0.53493965",
"0.53493965",
"0.5349... | 0.8043132 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, TodoProblemDetails):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8089139",
"0.8089139",
"0.8054507",
"0.79827213",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
"0.79669285",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Verify the provided password and compare it with the stored hash of the password. | def verify_password(self, hash, password):
try:
PasswordHasher().verify(hash, password)
return True
except:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_password(self, password):\n return check_password_hash(self.password_hash, password)",
"def verify_password(saved_password, password):\n return check_password_hash(saved_password, password)",
"def verify_password(self, password):\n self.password_hash = generate_password_hash(passwor... | [
"0.85142237",
"0.84267616",
"0.83220947",
"0.8289739",
"0.8289739",
"0.8289739",
"0.8289739",
"0.8289739",
"0.8289739",
"0.8289739",
"0.823403",
"0.8212859",
"0.81417745",
"0.8121094",
"0.8014549",
"0.7977284",
"0.7942766",
"0.7942766",
"0.7942766",
"0.7942766",
"0.79370826",... | 0.8124361 | 13 |
Xavier initialization of network weights | def xavier_init(fan_in=None, fan_out=None, shape=None, constant=1):
if fan_in is None:
fan_in = shape[0]
fan_out = shape[1]
# https://stackoverflow.com/questions/33640581/how-to-do-xavier-initialization-on-tensorflow
low = -constant*np.sqrt(6.0/(fan_in + fan_out))
high = constant*np.sqrt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_weights(self):\n nn.init.xavier_normal_(self.out.weight)",
"def init_weight(self):\r\n xavier_init(self.output_proj, distribution='uniform', bias=0.)",
"def initialize_weights_xavier(self):\n\t\tself.weights = [np.random.uniform(-1/sqrt(size1), 1/sqrt(size1)) for size1, size2 in zip(sel... | [
"0.8129632",
"0.8015472",
"0.7956181",
"0.7529412",
"0.7290586",
"0.717985",
"0.7132147",
"0.69870454",
"0.69868577",
"0.69820243",
"0.6976076",
"0.6973984",
"0.6950588",
"0.6943784",
"0.6942138",
"0.69342655",
"0.69187987",
"0.69155324",
"0.69155324",
"0.69155324",
"0.690602... | 0.0 | -1 |
r"""Constructor of Multi Head Trainer for 2D, 3D low resolution and 3D full resolution nnUNets. | def __init__(self, split, task, plans_file, fold, output_folder=None, dataset_directory=None, batch_dice=True, stage=None,
unpack_data=True, deterministic=True, fp16=False, save_interval=5, already_trained_on=None, use_progress=True,
identifier=default_plans_identifier, extension='mult... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, nheads, d_model):\n super(MultiheadAttention, self).__init__()\n assert d_model % nheads == 0\n self.d_head = d_model // nheads\n self.nheads = nheads\n self.Q_fc = nn.Linear(d_model, d_model, bias=False)\n self.K_fc = nn.Linear(d_model, d_model, bias=Fa... | [
"0.6918508",
"0.67867",
"0.65673274",
"0.6549341",
"0.65054846",
"0.6494171",
"0.6456656",
"0.6450057",
"0.6405999",
"0.6285344",
"0.6285344",
"0.6285344",
"0.6223747",
"0.6218996",
"0.6188725",
"0.61747676",
"0.61704606",
"0.6106765",
"0.60583067",
"0.605025",
"0.6038778",
... | 0.0 | -1 |
r"""Extend Initialization of Network > Load pretrained model (specified to setup the network). Optimizer and lr initialization is still the same, since only the network is different. | def initialize_network(self):
if self.trainer is None:
# -- Initialize from beginning and start training, since no model is provided -- #
super().initialize_network() # --> This updates the corresponding variables automatically since we inherit this class
# -- Cr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_setup(self, init_lr):\n param_list = []\n for name, param in self.model.named_parameters():\n if param.requires_grad:\n param_list.append(param)\n\n self.optimizer = torch.optim.AdamW(\n param_list, lr=init_lr, eps=1e-6)\n\n self.optim... | [
"0.71775836",
"0.7028879",
"0.69993883",
"0.6999253",
"0.69055337",
"0.6900174",
"0.6808384",
"0.67884606",
"0.6755014",
"0.66788363",
"0.66271555",
"0.6616813",
"0.6616403",
"0.66097695",
"0.6586435",
"0.6578308",
"0.6560204",
"0.65573496",
"0.6544166",
"0.6543308",
"0.65330... | 0.7168424 | 1 |
Converts a string to a date object using OpenERP's | def str_to_date(str):
if not str:
return str
return datetime.datetime.strptime(str, DEFAULT_SERVER_DATE_FORMAT).date() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _str_to_date(self, date):\n return datetools.date_parser(date)",
"def string_to_date(string):\n params = string.strip().split('-')\n year = int(params[0])\n month = int(params[1])\n day = int(params[2])\n d = date(year, month, day)\n return d",
"def string_t... | [
"0.7751836",
"0.7658776",
"0.7102966",
"0.70924515",
"0.7084004",
"0.7058837",
"0.7044514",
"0.70337605",
"0.7004457",
"0.6971969",
"0.6955923",
"0.69370085",
"0.69331855",
"0.69143385",
"0.6877719",
"0.68756396",
"0.6851621",
"0.685023",
"0.6838319",
"0.6832923",
"0.6777204"... | 0.6993415 | 9 |
Converts a datetime object to a string using OpenERP's | def datetime_to_str(obj):
if not obj:
return False
return obj.strftime(DEFAULT_SERVER_DATETIME_FORMAT) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date2str(datetime_object):\n if datetime_object is None:\n return 'None'\n return datetime_object.strftime('%Y-%m-%dT%H:%M:%S.%f')[0:-3]",
"def datetime_to_str(obj):\n return obj.strftime(\"%Y-%m-%d %H:%M:%S\")",
"def date_to_str(obj: \"date\") -> str:\n return obj.isoformat(... | [
"0.7750214",
"0.76534635",
"0.7212458",
"0.7205821",
"0.71779615",
"0.71779615",
"0.7047597",
"0.70062435",
"0.6993167",
"0.69752777",
"0.6958231",
"0.69299895",
"0.683752",
"0.68333226",
"0.6777542",
"0.6714331",
"0.66922086",
"0.66616064",
"0.6640302",
"0.66257703",
"0.6611... | 0.73813194 | 2 |
Converts a time object to a string using OpenERP's | def time_to_str(obj):
if not obj:
return False
return obj.strftime(DEFAULT_SERVER_TIME_FORMAT) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _time_str(self):\n try:\n if not self._time:\n raise ValueError\n format_ = '%a, %d %b %Y %H:%M:%S'\n return datetime.fromtimestamp(float(self._time)).strftime(format_)\n except ValueError:\n return plastic_date()",
"def datetime_to_str... | [
"0.77952826",
"0.72639066",
"0.7176525",
"0.7107734",
"0.7030132",
"0.7016365",
"0.7001557",
"0.6988381",
"0.6948741",
"0.6909228",
"0.6864506",
"0.68634456",
"0.6859248",
"0.68505025",
"0.68352133",
"0.6824694",
"0.68227565",
"0.68195784",
"0.6808449",
"0.6803754",
"0.680050... | 0.74581957 | 1 |
Check is file has one of the allowed file extensions. Return boolean based on check. | def allowed_file_type(file_name):
return file_name.lower().endswith(ALLOWED_FILE_TYPES) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_file(filename, allowed_extension):\n return '.' in filename and get_file_ext(filename) in allowed_extension",
"def has_file_allowed_extension(filename, extensions):\n return filename.lower().endswith(extensions)",
"def has_file_allowed_extension(filename, extensions):\n return filename.low... | [
"0.8442337",
"0.8338324",
"0.8338324",
"0.8265545",
"0.8252094",
"0.8233084",
"0.8216736",
"0.81986946",
"0.81986946",
"0.81449884",
"0.8142131",
"0.81217545",
"0.8111897",
"0.80983746",
"0.80919373",
"0.807865",
"0.8060355",
"0.80403304",
"0.80403304",
"0.80403304",
"0.80403... | 0.67487097 | 94 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.7448925 | 55 |
Returns labels used to train this model | def getClasses(self):
return self._call_java("getClasses") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_labels(self):\n return self._train_labels",
"def get_train_labels(self):\n raise NotImplementedError",
"def get_labels(self):\n return self.labels",
"def get_labels(model):\n return model._labels",
"def get_labels(model):\n return model._labels",
"def get_labe... | [
"0.8705226",
"0.86291057",
"0.7924576",
"0.7916059",
"0.7916059",
"0.7916059",
"0.7916059",
"0.7865575",
"0.786164",
"0.78021544",
"0.7787805",
"0.7783922",
"0.7760148",
"0.7736087",
"0.7736087",
"0.7736087",
"0.7736087",
"0.7736087",
"0.7736087",
"0.7675578",
"0.7665254",
... | 0.0 | -1 |
Sets configProto from tensorflow, serialized into byte array. | def setConfigProtoBytes(self, b):
return self._set(configProtoBytes=b) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setConfigProtoBytes(self, v):\n return self._set(configProtoBytes=v)",
"def make_config_proto(c):\n # tensorflow config\n use_gpu = os.environ.get('use_gpu', c.get('tf.config.use_gpu', c.get('use_gpu', 1)))\n cfg = tf.ConfigProto(device_count={'GPU': use_gpu})\n\n # scan config for tf conf... | [
"0.75618696",
"0.6219305",
"0.6167628",
"0.59814763",
"0.59055257",
"0.5844697",
"0.5599306",
"0.55863786",
"0.5412146",
"0.53233427",
"0.5217989",
"0.52129155",
"0.51678354",
"0.51494646",
"0.50938296",
"0.5053427",
"0.50138324",
"0.49860623",
"0.4972503",
"0.49635026",
"0.4... | 0.7518328 | 2 |
Test the creation of a Project via the session. | def testSessionCreate(self):
success = False
project = None
try:
project = self.session.create_project()
success = True
except Exception:
pass
self.failUnless(success)
self.failIf(project is None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_project(client, session, tokens):\n response = client.post(\n \"/projects\",\n json={\n \"name\": \"New Project\",\n \"organizations\": [],\n \"teams\": [],\n \"users\": [],\n },\n headers={\"Authorization\": f\"Bearer {toke... | [
"0.8087661",
"0.79817945",
"0.79817945",
"0.79817945",
"0.7976308",
"0.7901544",
"0.78132814",
"0.77980816",
"0.77633697",
"0.75648457",
"0.7557826",
"0.75232416",
"0.73946667",
"0.73385066",
"0.7217217",
"0.7205738",
"0.71969014",
"0.71700495",
"0.7155406",
"0.7134814",
"0.7... | 0.8764776 | 0 |
Test the name property. | def testName(self):
project = self.session.create_project()
self.util.stringTypeTest(self, project, "name")
self.util.stringPropertyTest(self, project, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_name(self):\n self.assertTrue(type(x.name) == str)",
"def test_name_property(self):\n v1 = versions.Version(version='1.2.3', name='foo')\n expected = 'foo'\n\n self.assertEqual(v1.name, expected)",
"def testName(self):\n dis_meta = DiseaseMeta()\n\n self.util.... | [
"0.7994545",
"0.7621826",
"0.7574307",
"0.75134736",
"0.75109535",
"0.741161",
"0.7379381",
"0.7315784",
"0.7302214",
"0.7277098",
"0.72736675",
"0.7271381",
"0.7256727",
"0.7250427",
"0.72418636",
"0.7220323",
"0.7208508",
"0.7182417",
"0.7174923",
"0.7158955",
"0.7103506",
... | 0.673812 | 40 |
Randomly assign each node with one of the possibilities. | def random_assignment(graph, possibilities):
for node in graph.nodes.values():
node.set_value(random.choice(possibilities)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_reconfigure_nodes(graph, nodes, possibilities):\n for node in nodes:\n graph.nodes[node].set_value(random.choice(possibilities))",
"def random_reassignment(graph, possibilities):\n\n random_assignment(graph, possibilities)\n\n violating_nodes = graph.get_violations()\n\n while len(v... | [
"0.7705304",
"0.74652934",
"0.6926971",
"0.6850376",
"0.6406141",
"0.6336974",
"0.63162494",
"0.6307333",
"0.6217504",
"0.6136338",
"0.6123565",
"0.6113806",
"0.608595",
"0.6040363",
"0.6031721",
"0.6019853",
"0.6011884",
"0.59963137",
"0.5954168",
"0.59476936",
"0.5935225",
... | 0.83887595 | 0 |
Overrides the level of the workunit associated with this type. | def level(self) -> Optional[LogLevel]:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __level(self, *args, **kwargs):\n pass",
"def __change_level(self, level):\n self.level = level",
"def set_level(self, level: LogLevel):\n pass",
"def level(self, level):\n\n self._level = level",
"def level(self, level):\n\n self._level = level",
"def level(self, l... | [
"0.65246296",
"0.64246273",
"0.6412334",
"0.638968",
"0.638968",
"0.638968",
"0.6287223",
"0.610246",
"0.6096026",
"0.60865974",
"0.60865974",
"0.6045419",
"0.6045419",
"0.60013235",
"0.59939224",
"0.5962648",
"0.5948268",
"0.5895716",
"0.5893385",
"0.5882097",
"0.58613294",
... | 0.5367267 | 48 |
Average log delta across all dimensions and all the cluster centers. If delta==0, return 0. | def get_average_log_delta_for(self, layer_id: int) -> float:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_luminosity(self, delta=1e-10):\n cumsum = 0.0\n for pix in self.pixels:\n cumsum += math.log10(delta + pix.luminosity())\n\n return math.pow(10, cumsum / len(self.pixels))",
"def gmean_diff(self) -> float:\n sim_log = np.log1p(self.predicted)\n obs_log = ... | [
"0.5996375",
"0.5802132",
"0.57997656",
"0.5797845",
"0.57796764",
"0.5772513",
"0.57609594",
"0.56759727",
"0.5618109",
"0.5575377",
"0.55158836",
"0.55148536",
"0.5444871",
"0.543073",
"0.5430377",
"0.5419861",
"0.54156834",
"0.53890246",
"0.536708",
"0.53600925",
"0.535484... | 0.69746894 | 0 |
Energy function according to []_ References | def FADE_default(self):
sstream = RosettaFunctionConstructs._ATOMPAIR
sstream += "FADE -10 19 10 -15.00 0"
return sstream | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def energy_func(self):\n i = self.inl[0].to_flow()\n o = self.outl[0].to_flow()\n\n T_m = (T_mix_ph(i, T0=self.inl[0].T.val_SI) +\n T_mix_ph(o, T0=self.outl[0].T.val_SI)) / 2\n\n iam = (\n 1 - self.iam_1.val * abs(self.aoi.val) -\n self.iam_2.val * se... | [
"0.76506364",
"0.7497268",
"0.74596876",
"0.7440959",
"0.71913916",
"0.70887977",
"0.6903451",
"0.67944735",
"0.6757206",
"0.6731307",
"0.66994965",
"0.66961646",
"0.6688668",
"0.66857535",
"0.66834426",
"0.6651441",
"0.66068006",
"0.6594028",
"0.657098",
"0.6560724",
"0.6533... | 0.0 | -1 |
Simple sigmoidal energy function | def SIGMOID_default(self):
sstream = RosettaFunctionConstructs._ATOMPAIR
sstream += "SIGMOID 8.00 1.00 #ContactMap: {raw_score: >4.3f}"
return sstream | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(x):\n return 1 / (1 - (power(e,-x)))",
"def sigmoid(x):\n return 1 / (1 + (e**(-x))) #changed the '-' to a '+' because it didnt work otherwise\n #return 1 / (1 + math.exp(-x))",
"def sigmoid(x):\n\treturn 1 / (1 + m.exp(-x))",
"def sigmoid(z):\n \n return 1 / (1 + np.exp(-z))#your... | [
"0.81669986",
"0.8047057",
"0.78933895",
"0.7865807",
"0.78475046",
"0.78469366",
"0.7843386",
"0.7778656",
"0.7778656",
"0.7778656",
"0.7778656",
"0.7778656",
"0.7778656",
"0.7772941",
"0.7772941",
"0.7771082",
"0.7770494",
"0.77696574",
"0.7759712",
"0.7759712",
"0.7758329"... | 0.0 | -1 |
Generates a random secret exponent. | def random_secret_exponent(curve_order):
random_256bit_hex_string = binascii.hexlify(get_entropy(32))
random_256bit_int = int(random_256bit_hex_string, 16)
int_secret_exponent = fit_number_in_range(random_256bit_int, 1, curve_order)
return int_secret_exponent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gensalt():\n return hexlify(os.urandom(24)).decode()",
"def generate_secret_number(self):\n self.secret_number = randint(0, self.difficulty)\n # print(f\"secret_number = {self.secret_number}\")",
"def gen_secret_key(n: int) -> int:\n while True:\n key = int.from_bytes(os.urandom(... | [
"0.6889959",
"0.68769747",
"0.6801493",
"0.6767172",
"0.6739017",
"0.66013587",
"0.6596757",
"0.6590718",
"0.654077",
"0.64977396",
"0.64585954",
"0.64392424",
"0.64184386",
"0.635305",
"0.6329544",
"0.6327848",
"0.63217914",
"0.6311663",
"0.6299145",
"0.6293521",
"0.6280097"... | 0.7819022 | 0 |
dnpdata Class __init__ method | def __init__(self, values=np.r_[[]], coords=[], dims=[], attrs={}, procList=[]):
super().__init__(values, dims, coords, attrs)
self.version = version
self.proc_attrs = []
self.max_print_attrs = 5
self.print_values = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _constructor(self):\n return dnpdata_collection",
"def __init__(self, dat):\n self.data = dat",
"def __init__(self):\n self.__dataset = None",
"def __init__(self, dataset):\n self._dataset = dataset",
"def __init__(self, dataset: Dataset):\n self.dataset = dataset",
... | [
"0.76289505",
"0.7488709",
"0.7458188",
"0.7394061",
"0.7223884",
"0.7140759",
"0.7131533",
"0.7108258",
"0.7108258",
"0.7108258",
"0.7108258",
"0.7053772",
"0.7053772",
"0.7053772",
"0.70001334",
"0.69647884",
"0.695802",
"0.694586",
"0.69083166",
"0.6903328",
"0.6902484",
... | 0.0 | -1 |
String representation of dnpdata object | def __str__(self):
string = "values:\n\t"
string += " x ".join(map(str, self.shape))
string += " {} ({})\n".format(type(self.values).__name__, self.values.dtype)
if self.print_values is True:
string += str(self.values) + "\n"
string += "dims:\n\t"
string ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n DataND_str = \"\"\n # Get the properties inherited from Data\n DataND_str += super(DataND, self).__str__() + linesep\n if len(self.axes) == 0:\n DataND_str += \"axes = []\"\n for ii in range(len(self.axes)):\n DataND_str += (\n ... | [
"0.7752944",
"0.741122",
"0.7401658",
"0.7266843",
"0.71362853",
"0.70859444",
"0.70617545",
"0.70366865",
"0.69866884",
"0.69866884",
"0.69866884",
"0.69866884",
"0.69866884",
"0.6969828",
"0.69033337",
"0.69033337",
"0.6900834",
"0.6899995",
"0.6861304",
"0.68112904",
"0.67... | 0.6880022 | 18 |
Calculate the mae for vector e. | def calculate_mae(e):
return np.mean(np.abs(e)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_mae(e):\n return np.mean(np.abs(e))",
"def compute_MAE(e):\n\n return np.mean(np.abs(e))",
"def calculate_mse(e):\n return 1/2*np.mean(e.dot(e))",
"def compute_MSE(e):\n\n return 1/2*np.mean(e**2)",
"def mae(t, y):\n\treturn mean_absolute_error(t, y)",
"def _calc_Em(self):\n ... | [
"0.78438085",
"0.7680405",
"0.7196139",
"0.70768696",
"0.7018598",
"0.6979782",
"0.69670063",
"0.6869578",
"0.6775307",
"0.6516614",
"0.65108913",
"0.649046",
"0.6470475",
"0.64600694",
"0.64544326",
"0.6443077",
"0.6440041",
"0.6434383",
"0.64090824",
"0.6397034",
"0.6388613... | 0.769304 | 1 |
Helper to initialize weights and biases, via He's adaptation | def wbVars(fan_in: int, fan_out: int):
# (int, int) -> (tf.Variable, tf.Variable)
stddev = tf.cast((2 / fan_in) ** 0.5, tf.float32)
initial_w = tf.random_normal([fan_in, fan_out], stddev=stddev)
initial_b = tf.zeros([fan_out])
return (tf.Variable(initial_w, trainable=True, name="weights"),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(self):\n self._q_neuron.h(self._weights) \n self._q_neuron.x(self._weights)",
"def init_weights_(self):\n raise NotImplementedError",
"def initWeights(self):\n self.weights = []\n self.bias = []\n for i, dim in enumerate(self.dimensions[1:]):\n ... | [
"0.7310589",
"0.7262304",
"0.70127594",
"0.69739723",
"0.6965604",
"0.6942663",
"0.6898307",
"0.6889144",
"0.6885372",
"0.6867935",
"0.68667257",
"0.6839174",
"0.6808979",
"0.6779201",
"0.6772171",
"0.6768343",
"0.67404413",
"0.67374915",
"0.6737473",
"0.6731588",
"0.6730606"... | 0.0 | -1 |
Probabilistic encoder from inputs to latent distribution parameters; a.k.a. inference network q(z|x) | def forward_propagation(self, x):
# np.array -> [float, float]
feed_dict = {self.x_in: x}
return self.session.run([self.y_obtained], feed_dict=feed_dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encoder(enc_input, attn_bias, n_layer, n_head,\n d_key, d_value, d_model, d_inner_hid, pos_enc,\n preporstprocess_dropout, attention_dropout,\n relu_dropout, preprocess_cmd='n',\n postprocess_cmd='da'):\n for i in range(n_layer):\n enc_output = encoder_layer(enc_input, attn_bias, n_head,\... | [
"0.6583939",
"0.6570754",
"0.6537504",
"0.6432862",
"0.6313675",
"0.62830627",
"0.6222983",
"0.6222983",
"0.6219454",
"0.6143485",
"0.6142537",
"0.60829043",
"0.60413915",
"0.6024275",
"0.6024275",
"0.59842634",
"0.5971018",
"0.59476763",
"0.593631",
"0.5929574",
"0.5928896",... | 0.0 | -1 |
Test if the set_i2c_frequency() function raises the correct exception when passing an invalid port. | def test_invalid_port(device, port):
with pytest.raises(ValueError):
device.set_i2c_frequency(port, 100e3) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_frequency(device, frequency):\n with pytest.raises(ValueError):\n device.set_i2c_frequency(SensorBridgePort.ONE, frequency)",
"def test_valid_arguments(device, port, frequency):\n result = device.set_i2c_frequency(port, frequency)\n assert result is None",
"def __init__(self, p... | [
"0.81257576",
"0.77952427",
"0.5942179",
"0.5886052",
"0.57884014",
"0.5431735",
"0.5415755",
"0.5292437",
"0.52401817",
"0.52321595",
"0.51538855",
"0.514977",
"0.5141549",
"0.513429",
"0.50979227",
"0.50610685",
"0.5049264",
"0.50236887",
"0.502301",
"0.5013126",
"0.4985588... | 0.87952363 | 0 |
Enter an Axes instance and it will change the defaults to an opinionated version of how a simple plot should be. | def axes_set_better_defaults(ax, axes_color = '#777777', grid = False):
ax.set_axis_bgcolor((1, 1, 1))
ax.grid(grid)
for key in ax.spines.keys():
if ax.spines[key].get_visible():
ax.spines[key].set_color(axes_color)
ax.tick_params(axis = 'x', colors = axes_color)
ax.tick_params(a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _InitAxes( self ):\n self.ax = self.fig.add_subplot( 111 )",
"def set_default_plot(self, plot):\n self.default_plot = plot",
"def plot(self, ax=..., *, name=..., **kwargs):\n ...",
"def add_default_axes(plot, orientation=\"normal\", vtitle=\"\",htitle=\"\"):\n if orientation in (\"nor... | [
"0.67008847",
"0.658889",
"0.65162224",
"0.6431689",
"0.6395229",
"0.6348534",
"0.6291442",
"0.62555647",
"0.62555647",
"0.62253696",
"0.61769885",
"0.6110925",
"0.60723627",
"0.6058783",
"0.6058783",
"0.6058783",
"0.6049489",
"0.6033422",
"0.6031756",
"0.60266787",
"0.600744... | 0.601518 | 20 |
Initializes this contract _openingTime Crowdsale opening time _closingTime Crowdsale closing time _rate Number of token units a buyer gets per wei _rate Number of token units a buyer gets per wei _wallet Address where collected funds will be forwarded to _token Address of the token being sold | def __init__( _openingTime: timestamp, _closingTime: timestamp, _rate: uint256, _wallet: address, _token: address):
assert _openingTime >= block.timestamp, "The value for opening time cannot be in the past."
assert _closingTime >= _openingTime, "The closing time cannot be before opening time."
assert _rate... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, initial_amount = 0):\n self.balance = initial_amount",
"def __init__(self, owner, amount=0):\n self.owner = owner\n self.amount = amount\n self._transaction = []",
"def __init__(self, start: datetime.date, balance: float) -> None:\n Contract.__init__(self, ... | [
"0.60426396",
"0.6011799",
"0.600438",
"0.5987368",
"0.59743184",
"0.5970733",
"0.5949957",
"0.5919962",
"0.58463895",
"0.58193713",
"0.58060956",
"0.5786774",
"0.57835215",
"0.5708919",
"0.569652",
"0.5644667",
"0.5636222",
"0.56327236",
"0.5617036",
"0.5605515",
"0.5603909"... | 0.73313063 | 0 |
Given a topic name, return the topic ARN. | def build_topic_arn(topic_name):
# https://stackoverflow.com/a/37723278/1558022
sts_client = boto3.client('sts')
account_id = sts_client.get_caller_identity().get('Account')
return f'arn:aws:sns:eu-west-1:{account_id}:{topic_name}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_full_topicarn ( base_topicarn, topicname ) :\n return base_topicarn + ':' + topicname",
"def topic_arn(self) -> str:\n return self[\"Sns\"][\"TopicArn\"]",
"def topic_arn(self) -> str:\n return pulumi.get(self, \"topic_arn\")",
"def topic_arn(self) -> Optional[str]:\n return pu... | [
"0.73009723",
"0.69278306",
"0.67788595",
"0.6747467",
"0.67419624",
"0.6642041",
"0.6642041",
"0.646841",
"0.5911415",
"0.58359945",
"0.5714538",
"0.5702059",
"0.5592746",
"0.5291004",
"0.52175325",
"0.51886594",
"0.51886594",
"0.51886594",
"0.51886594",
"0.51886594",
"0.518... | 0.81616783 | 0 |
Returns siteId for the leftmost (childcontainingtype) site of the list. Note that sites marked with 'cursorSkip' will be included, however, currently no icons start with a cursorSkip site (or are ever likely to). | def firstCursorSite(self):
firstSite = self.nthCursorSite(0)
if firstSite is None: # order of the first item does not have to be 0
firstSite = self.nextTraversalSiteOrSeries(0)
if firstSite is None:
return None
if isinstance(firstSite, IconSiteSeries):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prevCursorSite(self, siteId):\n if self.isSeries(siteId):\n name, idx = splitSeriesSiteId(siteId)\n series = getattr(self, name, None)\n if series is None:\n print(\"prevCursorSite called with non-existent series name\")\n return None\n ... | [
"0.65368485",
"0.6481466",
"0.59170306",
"0.58516437",
"0.5743",
"0.570313",
"0.54787797",
"0.5460646",
"0.5419476",
"0.5412962",
"0.5372422",
"0.5352676",
"0.5341486",
"0.5326397",
"0.5322958",
"0.53188705",
"0.52698547",
"0.5264211",
"0.5227052",
"0.5136669",
"0.5114151",
... | 0.71475065 | 0 |
Return the site or series object whose cursor traversal order matches n (a series has a single index). Returns None if no site or series claims that index. An n of 1 returns the last site or series in the site list. | def nthCursorSite(self, n):
lastSiteOrder = -1
lastSite = None
for siteNames in self._typeDict.values():
for name in siteNames:
site = getattr(self, name)
if hasattr(site, 'order') and site.order is not None:
if n == -1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nextTraversalSiteOrSeries(self, orderIdx):\n for i in range(orderIdx+1, self.nextCursorTraverseOrder):\n nextSite = self.nthCursorSite(i)\n if nextSite is not None:\n return nextSite\n return None",
"def get_node_at_position(self, n):\n curr_node = se... | [
"0.7349285",
"0.6022498",
"0.59719497",
"0.5912878",
"0.5810091",
"0.5628738",
"0.56206465",
"0.556186",
"0.55203694",
"0.55035985",
"0.54970986",
"0.5437305",
"0.5397048",
"0.53904885",
"0.53764594",
"0.5366958",
"0.5360991",
"0.53120774",
"0.5301542",
"0.5278761",
"0.526530... | 0.81307805 | 0 |
Vectorized implementation of haversine distance between a given scalar lat and lon to a list of lats and lons. Assumed given in standard coordinate forms. | def haversine_dist(this_lat, this_lon, lat_vec, lon_vec):
this_lat, this_lon, lat_vec, lon_vec = map(np.radians, (this_lat, this_lon, lat_vec, lon_vec))
dlat = lat_vec - this_lat
dlon = lon_vec - this_lon
a = np.square(np.sin(dlat/2)) + np.cos(this_lat) * np.multiply(np.cos(lat_vec), np.square(np.sin(d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def haversine_np(lon1, lat1, lon2, lat2):\n\n lon1, lat1, lon2, lat2 = map(np.radians, [lon1, lat1, lon2, lat2])\n\n dlon = lon2 - lon1\n dlat = lat2 - lat1\n\n a = np.sin(dlat/2.0)**2 + np.cos(lat1) * np.cos(lat2) * np.sin(dlon/2.0)**2\n\n c = 2 * np.arcsin(np.sqrt(a))\n km = 6367 * c\n\n ret... | [
"0.7057171",
"0.66729087",
"0.6664931",
"0.66497034",
"0.6646607",
"0.66222894",
"0.6578176",
"0.65682614",
"0.6567627",
"0.65668684",
"0.6538363",
"0.65087074",
"0.6505885",
"0.6499036",
"0.64882714",
"0.64794827",
"0.64766586",
"0.6472862",
"0.6460697",
"0.6456599",
"0.6448... | 0.74437 | 0 |
This returns a boolean indicating whether a given transformation has a circular segment or not | def circular(x, f, p=lambda x: True):
y = collision_point(x, f, p)
return p(y) and x == f(y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iscircle(a):\n if isarc(a):\n start=a[1][1] \n end=a[1][2]\n ## these are special, integer values that flag a true full\n ## circle.\n if start==0 and end==360:\n return True\n else:\n return False",
"def isclockwise(self):\n s = sum((seg[1][0... | [
"0.70027095",
"0.69139457",
"0.66461337",
"0.63083166",
"0.6303921",
"0.630391",
"0.62438864",
"0.62367755",
"0.620634",
"0.61838686",
"0.61782265",
"0.6161646",
"0.6132248",
"0.61205626",
"0.60706323",
"0.59911275",
"0.59908235",
"0.5984595",
"0.59332126",
"0.5907794",
"0.59... | 0.5766834 | 38 |
Set glcolor of node to a hue random color. | def set_random_glcolor(n):
if ('gl_color' in n.knobs()
and not n['gl_color'].value()
and not n.name().startswith('_')):
color = colorsys.hsv_to_rgb(random.random(), 0.8, 1)
color = tuple(int(i * 255) for i in color)
n['gl_color'].setValue(
color[0] << 24... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setRandomColor():\n setColor(getRandomColor())",
"def mutate_color(color):\n color[random.randrange(0, 3)] = random.random() % 1\n return color",
"def random_color():\n colormode(255)\n return randint(0, 255), randint(0, 255), randint(0, 255)",
"def new_color(mutated_genome):\n index = r... | [
"0.73029774",
"0.6773414",
"0.6640427",
"0.65818864",
"0.65588254",
"0.64319676",
"0.64001983",
"0.63431877",
"0.6314167",
"0.63136643",
"0.6122788",
"0.6082949",
"0.60730535",
"0.60530394",
"0.60226333",
"0.60226333",
"0.60226333",
"0.60226333",
"0.60174155",
"0.59922516",
"... | 0.7794376 | 0 |
Load the renderer (called by ``MarkdownIt``) | def __init__(self, parser: MarkdownIt) -> None:
self.md = parser
self.rules = {
k: v
for k, v in inspect.getmembers(self, predicate=inspect.ismethod)
if k.startswith("render_") and k != "render_children"
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_renderer(rname: str, config: ConfigManager) -> Renderer:\n try:\n return getattr(importlib.import_module('plasTeX.Renderers.'+rname), 'Renderer')()\n except ImportError:\n pass\n\n for plugin in config['general']['plugins'] or []:\n try:\n return getattr(importlib.... | [
"0.6749453",
"0.6640032",
"0.645137",
"0.6209436",
"0.605781",
"0.5959909",
"0.58596087",
"0.577632",
"0.5722525",
"0.57012403",
"0.568075",
"0.56577605",
"0.55979997",
"0.54940605",
"0.54834783",
"0.54834783",
"0.54562056",
"0.54498166",
"0.5430261",
"0.54073143",
"0.5382899... | 0.0 | -1 |
Sort queryset according to given parameters. | def sort_queryset(
queryset: QuerySet, sort_by: SortInputObjectType, reversed: bool
) -> QuerySet:
sorting_direction = sort_by.direction
if reversed:
sorting_direction = REVERSED_DIRECTION[sorting_direction]
sorting_field = sort_by.field
sorting_attribute = getattr(sort_by, "attribute_id", ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_sort(self, qs):\n return qs",
"def post_sort(self, qs):\n return qs",
"def sort_queryset(queryset):\n objects = list(queryset)\n my_cmp = lambda x, y: cmp(str(x), str(y))\n objects.sort(my_cmp)\n return objects",
"def filter_and_order(cls, *args, **kwargs):\n return c... | [
"0.74685925",
"0.737549",
"0.7298822",
"0.70860773",
"0.70316",
"0.69775444",
"0.6932622",
"0.6866823",
"0.6849822",
"0.6816684",
"0.6753435",
"0.67198116",
"0.66220033",
"0.6594583",
"0.65733445",
"0.6527762",
"0.64703876",
"0.6426589",
"0.6410122",
"0.63759524",
"0.63743514... | 0.6522338 | 16 |
Sort queryset by it's default ordering. | def sort_queryset_by_default(
queryset: QuerySet, reversed: bool
) -> Tuple[QuerySet, dict]:
queryset_model = queryset.model
default_ordering = ["pk"]
if queryset_model and queryset_model._meta.ordering:
default_ordering = get_model_default_ordering(queryset_model)
ordering_fields = [field.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_by_default(self):\n self.data.sort()",
"def pre_sort(self, qs):\n return qs",
"def sort_default(self, collection: TVCollection) -> TVCollection:\n res = collection.sort(\n [\n (sort.name, -1 if sort.meta[\"default\"] == \"desc\" else 1)\n f... | [
"0.73676777",
"0.7210702",
"0.70021456",
"0.6813488",
"0.674624",
"0.66124177",
"0.65613735",
"0.6515788",
"0.63722837",
"0.6352165",
"0.632013",
"0.6293108",
"0.6254805",
"0.6253239",
"0.6234722",
"0.6212434",
"0.6199498",
"0.6122838",
"0.60580313",
"0.60580045",
"0.6006687"... | 0.73328924 | 1 |
Creates overview plots from logfiles to visualize network performance. Not required for the learning workflow. | def showcase():
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
# Optional: Varied loading process for showcases, when not done at the end of training
# directory = "results/dirname"
# checkpoint_path = directory + "/50000.pth"
# checkpoint = torch.load(checkpoint_path)
# epoch = chec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_plots(history):\n loss_vals = history['loss']\n val_loss_vals = history['val_loss']\n epochs = range(1, len(history['accuracy'])+1)\n \n f, ax = plt.subplots(nrows=1,ncols=2,figsize=(16,4))\n \n # plot losses on ax[0]\n ax[0].plot(epochs, loss_vals, color='navy',marker='o', linesty... | [
"0.6901867",
"0.69010895",
"0.68595386",
"0.6762489",
"0.6737109",
"0.670096",
"0.6698482",
"0.66684973",
"0.65730816",
"0.65308183",
"0.64183664",
"0.6404009",
"0.63960093",
"0.63594335",
"0.6350556",
"0.6348855",
"0.63392675",
"0.6273411",
"0.6270403",
"0.6245221",
"0.62323... | 0.0 | -1 |
Performans a xavier_normal initialization for the network weights and fills biases with a low start value. | def init_weights(m):
if type(m) == nn.Linear:
torch.nn.init.xavier_normal(m.weight)
m.bias.data.fill_(0.01) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_weights(self):\n nn.init.xavier_normal_(self.out.weight)",
"def initialize_weights_xavier(self):\n\t\tself.weights = [np.random.uniform(-1/sqrt(size1), 1/sqrt(size1)) for size1, size2 in zip(self.sizes[:-1], self.sizes[1:])]\n\t\tself.biases = [np.zeros([size, ]) for size in self.sizes[1:]]",
... | [
"0.788131",
"0.7141746",
"0.7116111",
"0.7045507",
"0.69763476",
"0.6961423",
"0.68967956",
"0.67628354",
"0.66590565",
"0.66407037",
"0.66288424",
"0.6560874",
"0.65478694",
"0.6542887",
"0.6542887",
"0.65003014",
"0.6496229",
"0.64929545",
"0.64728314",
"0.64556646",
"0.645... | 0.6883471 | 7 |
Show form for adding a new post. | def show_new_post_form(user_id):
user = User.query.get_or_404(user_id)
return render_template('new_post_form.html', user=user) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, request):\n form = PostForm()\n context = {\n 'form': form,\n }\n return render(request, 'blogs/new_post.html', context)",
"def get(self, request):\n form = PostForm()\n context = {\n 'form': form,\n 'success_message': ''\n ... | [
"0.76548296",
"0.76309943",
"0.7382161",
"0.7357963",
"0.7274199",
"0.71730876",
"0.71572673",
"0.7147427",
"0.7104618",
"0.70853746",
"0.7077619",
"0.70587724",
"0.70396036",
"0.70247185",
"0.69958436",
"0.69710445",
"0.6924344",
"0.6923944",
"0.68775904",
"0.676711",
"0.673... | 0.73163605 | 4 |
Adds an edge from x to y. | def addEdge(self,x,y):
self.matr[x][y] = True
self.matr[y][x] = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addEdge(self, x, y):\n self._dictOut[x].append(y)\n self._dictIn[y].append(x)",
"def addEdge(self,x,y):\n\t\tself._dictOut[x].append(y)\n\t\tself._dictIn[y].append(x)",
"def addEdge(self,x,y):\n\t\tself._dict[x].append(y)",
"def addEdge(self,x,y):\n\t\tself._matr[x][y] = True",
"def add_e... | [
"0.8675041",
"0.86119705",
"0.8501985",
"0.7975892",
"0.7673915",
"0.7508885",
"0.7497919",
"0.74526393",
"0.7385795",
"0.73561877",
"0.7346423",
"0.7339825",
"0.73347616",
"0.73232204",
"0.7283825",
"0.726679",
"0.7234456",
"0.7226534",
"0.7208905",
"0.71913904",
"0.71435726... | 0.76874816 | 4 |
Break text into list of tokens following twitter norms | def preprocess(self,text):
return preprocess.get_tokens(text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(tweet):\n tweet = \" \".join(re.split(\"[^a-zA-Z]*\", tweet.lower())).strip()\n tokens = [stemmer.stem(t) for t in tweet.split()]\n return tokens",
"def tokenize(tweet):\n tweet = \" \".join(re.split(\"[^a-zA-Z]*\", tweet.lower())).strip()\n tokens = [stemmer.stem(t) for t in tweet.sp... | [
"0.72946787",
"0.72946787",
"0.72243714",
"0.71993953",
"0.71991026",
"0.7081311",
"0.7039254",
"0.6984114",
"0.6971363",
"0.69227225",
"0.6900944",
"0.68782604",
"0.6868625",
"0.6842142",
"0.6836276",
"0.6827841",
"0.68264806",
"0.6821836",
"0.67958546",
"0.6743279",
"0.6714... | 0.0 | -1 |
Return queryset for submissions that can be shown to judge. | def get_queryset(self):
judge_qs = Judge.objects.filter(judge=self.request.user)
theme_qs = Theme.objects.filter(
contest__in=judge_qs.values('contest'),
contest__publish_date__gte=timezone.now(),
)
return (
Submission.objects.filter(
t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n judge_qs = Judge.objects.filter(judge=self.request.user)\n return Contest.objects.filter(\n pk__in=judge_qs.values('contest'),\n publish_date__gte=timezone.now(),\n )",
"def get_queryset(self):\n return Question.objects.all()",
"def ge... | [
"0.7646545",
"0.66061544",
"0.659349",
"0.65051615",
"0.648256",
"0.6408007",
"0.639505",
"0.639505",
"0.6357126",
"0.6343736",
"0.63090986",
"0.62993026",
"0.624703",
"0.624703",
"0.624703",
"0.624703",
"0.624703",
"0.624703",
"0.624703",
"0.624703",
"0.624703",
"0.624703"... | 0.7442999 | 1 |
Return queryset for contests that can be shown to judge. | def get_queryset(self):
judge_qs = Judge.objects.filter(judge=self.request.user)
return Contest.objects.filter(
pk__in=judge_qs.values('contest'),
publish_date__gte=timezone.now(),
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n return self.queryset.filter(contest__publish_date__lte=timezone.now())",
"def get_queryset(self):\n return Initiative.objects.filter(objective__perspective__description='Customer').order_by('objective')",
"def get_queryset(self):\n return Objective.objects.filter(... | [
"0.6776952",
"0.669398",
"0.6660829",
"0.65587735",
"0.65016544",
"0.6415558",
"0.6357788",
"0.63557893",
"0.6319972",
"0.6292771",
"0.6247528",
"0.619431",
"0.617995",
"0.61622137",
"0.6063249",
"0.6061872",
"0.604188",
"0.6038209",
"0.60247767",
"0.59572065",
"0.5929934",
... | 0.82787 | 0 |
Compares self and m2. An exception is raised if every atom in self is not found in m2 (but not vice versa). | def compare(self, m2):
assert self.natoms == m2.natoms
for atom1 in self.atoms:
found = False
for atom2 in m2.atoms:
if(atom1 == atom2):
found = True
break
else:
raise Exception("Atom not found! {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__ (self, other):\n if type(self) == type(other):\n return self._m == other._m\n else:\n return False",
"def __eq__(self, other):\n from numpy.linalg import norm\n from numpy import array\n\n # Upcast to an Atom\n othercomp = Atom(other)\n\n... | [
"0.631193",
"0.62953675",
"0.6193246",
"0.60645926",
"0.60645926",
"0.60645926",
"0.6060047",
"0.60476494",
"0.5991703",
"0.59828174",
"0.59721214",
"0.5967908",
"0.59624213",
"0.59576124",
"0.5954401",
"0.59319633",
"0.5926397",
"0.5926397",
"0.59217334",
"0.5894467",
"0.589... | 0.8075063 | 0 |
Add to the graph a linear layer to reduce the encoder's final FW and BW state into a single initial state for the decoder. This is needed because the encoder is bidirectional but the decoder is not. | def _reduce_states(self, fw_st, bw_st):
hidden_dim = self._hps.hidden_dim
with tf.variable_scope('reduce_final_st'):
# Define weights and biases to reduce the cell and reduce the state
w_reduce_c = tf.get_variable('w_reduce_c', [hidden_dim * 2, hidden_dim], dtype=tf.float32, initializer=self.trunc_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _encode(self):\n with tf.variable_scope('encoding'):\n self.sep_p_encodes, _ = bilstm_layer(self.p_emb, self.p_length, self.hidden_size)\n tf.get_variable_scope().reuse_variables()\n self.sep_q_encodes, _ = bilstm_layer(self.q_emb, self.q_length, self.hidden_size)\n ... | [
"0.5793266",
"0.5787024",
"0.5765326",
"0.5761775",
"0.5744888",
"0.5738587",
"0.56737465",
"0.5644539",
"0.5620787",
"0.5599413",
"0.55158037",
"0.5509107",
"0.5499129",
"0.5490315",
"0.5481689",
"0.54802823",
"0.5464274",
"0.54614335",
"0.5437958",
"0.54341227",
"0.5432976"... | 0.5563204 | 10 |
Round robin the gpu device. (Reserve last gpu for expensive op). | def _next_device(self):
if self._num_gpus == 0:
return ''
dev = '/gpu:%d' % self._cur_gpu
if self._num_gpus > 1:
self._cur_gpu = (self._cur_gpu + 1) % (self._num_gpus-1)
return dev | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move2gpu(self):\n if self.generator.backend.upper() == \"LOOPY\":\n try:\n import pyopencl as cl\n import pyopencl.array # pylint: disable=unused-variable\n from .context import queue\n except ImportError:\n raise ImportE... | [
"0.65359956",
"0.61213106",
"0.6018468",
"0.5992193",
"0.598765",
"0.59409046",
"0.59205884",
"0.5859862",
"0.5859862",
"0.5859862",
"0.58481795",
"0.58446616",
"0.58141273",
"0.5808383",
"0.57908154",
"0.57908154",
"0.5694474",
"0.5679166",
"0.56522185",
"0.5635533",
"0.5634... | 0.66941935 | 0 |
Returns the track name IGV would assign to a track with the given filename. | def _get_track_name(self, filename):
return os.path.basename(filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def track_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"track_name\")",
"def get_track_filename(self, url = None):\n track_file = urllib.urlopen(url)\n headers = track_file.info()\n track_file.close()\n return wget.filename_from_headers(headers)",
"def getTrack... | [
"0.66215706",
"0.66039604",
"0.6590844",
"0.6585565",
"0.65818244",
"0.65604174",
"0.64575106",
"0.6435807",
"0.6371623",
"0.6371156",
"0.6368299",
"0.63396114",
"0.63227695",
"0.6311559",
"0.62661374",
"0.6221353",
"0.618287",
"0.61824006",
"0.61745334",
"0.6159204",
"0.6134... | 0.8579929 | 0 |
json endpoint It returns a json representation of all the categories in the database, including their respective items array. | def categories_json():
try:
categories = session.query(Category).all()
return jsonify(categories=[category.serialize for category in categories])
except Exception as inst:
print(type(inst))
print(inst.args)
print(inst) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_categories():\n categories = session.query(Category)\n return jsonify(json_list=[i.to_json() for i in categories.all()])",
"def all_categories_handler():\n categories = getAllCategories()\n return jsonify(categories=[i.serialize for i in categories])",
"def api_category_items(category_id):\... | [
"0.84583753",
"0.8090332",
"0.80322415",
"0.798488",
"0.7976991",
"0.79394335",
"0.79370993",
"0.7929945",
"0.79207456",
"0.78978133",
"0.78930306",
"0.7852301",
"0.78226215",
"0.78072923",
"0.7798263",
"0.77888834",
"0.77840495",
"0.7774486",
"0.77282476",
"0.77220994",
"0.7... | 0.75059205 | 25 |
Returns a User object. | def get_user_info(user_id):
user = session.query(User).filter_by(id=user_id).one()
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user(self):\n if not self.is_valid():\n return None\n # error checking done in: clean_email\n # NOTE: all emails are stored in lower-case\n e = self.clean_email().lower()\n return User.objects.get(email=e)",
"def user(self, *args, **kwargs) -> User:\n ... | [
"0.7954054",
"0.79087967",
"0.7862129",
"0.77409613",
"0.77335966",
"0.7716091",
"0.7699287",
"0.7648405",
"0.76446897",
"0.76333046",
"0.7609022",
"0.7588607",
"0.7577656",
"0.7577656",
"0.757335",
"0.7572474",
"0.7570313",
"0.75398445",
"0.7526674",
"0.752285",
"0.7489314",... | 0.0 | -1 |
True if the filename's extension is one of the allowed extensions. | def allowed_file(filename):
return '.' in filename and \
filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_file_allowed_extension(filename, extensions):\n return filename.lower().endswith(extensions)",
"def has_file_allowed_extension(filename, extensions):\n return filename.lower().endswith(extensions)",
"def _valid_extension(self, filename):\n return any(filename.endswith(ext)\n ... | [
"0.8835158",
"0.8835158",
"0.88202137",
"0.88077575",
"0.8777742",
"0.8724037",
"0.8714193",
"0.86950344",
"0.86849606",
"0.86646944",
"0.8661835",
"0.8661835",
"0.86478657",
"0.86478657",
"0.8627979",
"0.8625685",
"0.8625685",
"0.8625685",
"0.8625685",
"0.8625685",
"0.862568... | 0.86955285 | 10 |
Create bin edges from bin range | def _make_bins(start, stop, step):
bin_edges = np.arange(start, stop + step, step)
return bin_edges | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_bin_edges(a, bins, range):\n # parse the overloaded bins argument\n n_equal_bins = None\n bin_edges = None\n\n if isinstance(bins, str):\n raise NotImplementedError(\n 'only integer and array bins are implemented')\n elif isinstance(bins, cupy.ndarray) or numpy.ndim(bins) ... | [
"0.76558346",
"0.74395794",
"0.71435905",
"0.70494366",
"0.69980985",
"0.69887614",
"0.69657403",
"0.6947809",
"0.6917547",
"0.68332356",
"0.669846",
"0.6655077",
"0.6628723",
"0.6566543",
"0.6538658",
"0.65189123",
"0.6509809",
"0.6475311",
"0.6474209",
"0.6448897",
"0.63816... | 0.8281137 | 0 |
Randomly selects and returns a string with a bonk action directed toward a given bonkee. | def get_bonked(self, bonkee=''):
bonk_actions = ['drops a Titan on %s',
'hadoukens %s',
'slaps %s around with a large trout',
'slaps %s around wiiIIITTTTHHH.....A HERRING!',
'bitch slaps %s',
'feed... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_random_action(self):\r\n return Action.HIT if random.random() <= 0.5 else Action.STICK",
"def _choose_action(self):\n return random.randint(0,self.num_bandits-1)",
"def DoRandomAction(self, gameState: TekkenGameState):\n actionRNG = random.randint(1, 100)\n # Anything gen... | [
"0.6597849",
"0.65204364",
"0.6383198",
"0.6322605",
"0.6169525",
"0.6148104",
"0.6137512",
"0.6095149",
"0.6073951",
"0.6073951",
"0.60733956",
"0.605924",
"0.6036984",
"0.60299575",
"0.5995653",
"0.59804094",
"0.595811",
"0.5946891",
"0.5924124",
"0.59077346",
"0.5881659",
... | 0.73346305 | 0 |
Fit all transformers, transform the data and concatenate results. | def fit_transform(self, X, y=...):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit(self, X, y=None, **fitparams):\n \n self.fitted_transformers_ = []\n for transformer in self.list_of_transformers:\n fitted_trans = clone(transformer).fit(X, y=None, **fitparams)\n self.fitted_transformers_.append(fitted_trans)\n return self",
"def fit_tr... | [
"0.76221806",
"0.73132",
"0.73040366",
"0.6642435",
"0.66272104",
"0.65552473",
"0.6473567",
"0.6451226",
"0.64335114",
"0.6373015",
"0.6358423",
"0.6297099",
"0.61956054",
"0.6177806",
"0.61677146",
"0.6158918",
"0.6149999",
"0.6107534",
"0.61002266",
"0.60928816",
"0.606575... | 0.6338204 | 11 |
Construct a ColumnTransformer from the given transformers. This is a shorthand for the ColumnTransformer constructor; it does not require, and does not permit, naming the transformers. Instead, they will be given names automatically based on their types. It also does not allow weighting with ``transformer_weights``. | def make_column_transformer(*transformers, remainder=..., sparse_threshold=..., n_jobs=..., verbose=...):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_transformer(\n self,\n transformation: str = None,\n param: dict = {},\n df=None,\n random_seed: int = 2020,\n ):\n\n if transformation in (trans_dict.keys()):\n return trans_dict[transformation]\n\n elif transformation in list(have_params... | [
"0.56633353",
"0.5586775",
"0.5405092",
"0.5350738",
"0.5216128",
"0.51977926",
"0.51348484",
"0.5087906",
"0.5038112",
"0.5034889",
"0.4935765",
"0.49228588",
"0.49009806",
"0.48567355",
"0.4850526",
"0.48415545",
"0.48282373",
"0.4800598",
"0.47978547",
"0.47884983",
"0.478... | 0.73076427 | 0 |
Reinitialize the network parameters. | def reset_parameters(self):
for item in self.components.values():
try:
item.reset_parameters()
except:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_params(self):\n self.clear()\n self._init_load_data()\n self._init_net_delay_data()",
"def resetParams(self):\n self.prediction = cons.init_pred # Classifier payoff - initialized to a constant initial payoff value\n self.error = cons.init_err # Classifier e... | [
"0.7479174",
"0.7391624",
"0.7343438",
"0.72327113",
"0.71792585",
"0.7168502",
"0.712856",
"0.7114015",
"0.7109944",
"0.6997357",
"0.69973135",
"0.69973135",
"0.69973135",
"0.6993947",
"0.69921124",
"0.6972424",
"0.6921358",
"0.68804413",
"0.6878386",
"0.6810553",
"0.6767711... | 0.6177823 | 76 |
Return dictionary with number of preceding equal numbers in array, with number as key | def get_groups(array):
groups = []
for key, group in groupby(array):
i = sum(1 for _ in group)
groups.append((int(key), i))
return groups | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_values(array):\n unique, counts = np.unique(array, return_counts=True)\n return dict(zip(unique, counts))",
"def all_non_consecutive(arr):\n return [{'i': i + 1, 'n': arr[i + 1]} for i in range(len(arr) - 1) if arr[i] + 1 != arr[i + 1]]",
"def count_elements(seq) -> dict:\n hist = {}\n ... | [
"0.6750554",
"0.6530664",
"0.648732",
"0.648732",
"0.63307625",
"0.6271431",
"0.6210487",
"0.6058165",
"0.6051989",
"0.60120606",
"0.5942181",
"0.59251666",
"0.5888807",
"0.57586086",
"0.5718137",
"0.5709141",
"0.5590306",
"0.5547408",
"0.5536681",
"0.5531436",
"0.5530345",
... | 0.57248473 | 14 |
Assuming the true value is x=0. | def change_in_cascade(groups, n):
number_of_changes = 0
wrong_changes = 0 # count number of time a cascade changes from correct to wrong by one or more individual
one_change = 0 # count if the cascade changes once by at least one individual
new_cascades = 0 # count number of times a new cascade occurs (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fun(self, x):\n if np.any(x > 0):\n return np.inf\n else:\n return 0",
"def fun(self, x):\n if np.any(x < 0):\n return np.inf\n else:\n return 0",
"def forward_pass(self, x):\n self.x = x\n return x * (x > 0)",
"def pos... | [
"0.7569908",
"0.74939495",
"0.74711776",
"0.73616",
"0.73426414",
"0.7240856",
"0.7138901",
"0.7138901",
"0.7018062",
"0.69492",
"0.693713",
"0.68660504",
"0.6803048",
"0.67427325",
"0.67427325",
"0.66797936",
"0.66567993",
"0.66551405",
"0.6602175",
"0.6525434",
"0.65116394"... | 0.0 | -1 |
Return a ISO timestamp string from a UNIX timestamp integer. | def timestamp_(tstamp: Optional[int]) -> Optional[str]:
if tstamp is None:
return None
dtm = datetime.datetime.fromtimestamp(tstamp)
return dtm.isoformat() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stamp2iso(string):\n return str(datetime.fromtimestamp(int(string)).strftime(\"%Y-%m-%dT%H:%M:%S\"))",
"def forge_timestamp(value) -> int:\n assert isinstance(value, str)\n dt = datetime.strptime(value, '%Y-%m-%dT%H:%M:%SZ')\n return calendar.timegm(dt.utctimetuple())",
"def convert_timestamp_t... | [
"0.7328208",
"0.72072613",
"0.71863276",
"0.7113892",
"0.70835096",
"0.6985063",
"0.69773257",
"0.69755185",
"0.6902196",
"0.68977755",
"0.6763622",
"0.6651133",
"0.6650753",
"0.6625467",
"0.6608415",
"0.6598664",
"0.65937406",
"0.65901726",
"0.6558049",
"0.6553366",
"0.65410... | 0.73728925 | 0 |
Fetch a user's configured timezone. | async def fetch_user_tz(self, user_id: uuid.UUID):
olson_tz = await self.fetchval(
"select timezone from users where id = $1", user_id
)
if not olson_tz:
return pytz.timezone("UTC")
return pytz.timezone(olson_tz) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_timezone():\n localTimezone = request.args.get('timezone')\n if localTimezone in pytz.all_timezones:\n return localTimezone\n else:\n raise pytz.exceptions.UnknownTimeZoneError\n userId = request.args.get('login_as')\n localTimezone = users[int(userId)]['timezone']\n if loca... | [
"0.7672164",
"0.7476108",
"0.7322465",
"0.72849256",
"0.7280725",
"0.71830446",
"0.7043752",
"0.70255935",
"0.69986963",
"0.69638455",
"0.69309574",
"0.6927439",
"0.68976176",
"0.68949145",
"0.6874735",
"0.68645424",
"0.68268514",
"0.68036103",
"0.6754741",
"0.67505187",
"0.6... | 0.7469085 | 2 |
Sets the survey_response_id of this SurveyResponseItem. | def survey_response_id(self, survey_response_id):
self._survey_response_id = survey_response_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_id(self, response_id):\n\n self._response_id = response_id",
"def survey_id(self, survey_id):\n\n self.logger.debug(\"In 'survey_id' setter.\")\n\n self._survey_id = survey_id",
"def survey_id(self, survey_id):\n\n self._survey_id = survey_id",
"def response_status_id... | [
"0.7978317",
"0.79195344",
"0.7705174",
"0.7149277",
"0.6218788",
"0.5968924",
"0.5968924",
"0.5932717",
"0.567221",
"0.56692016",
"0.56692016",
"0.5620258",
"0.5466638",
"0.5347625",
"0.53386885",
"0.53137904",
"0.5299222",
"0.5277099",
"0.5196935",
"0.51834184",
"0.51821196... | 0.8997821 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.