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 |
|---|---|---|---|---|---|---|
This function calculates and returns the acceleration of the projectile in the y direction. It takes in its position as the only arguments This function is called by rungeKuttaOrbits function | def accelerationCalcY(x,y):
global G #glabel variables are initialised
global massEarth
return (-G*massEarth*y)/((x**2+y**2)**(3/2))# here from Newton's law of gravitation we return the acceleration on a projectile in the y direction
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accelerationCalcX(x,y):\r\n global G # the gravitational constant is initialised like this so that it can be used in this function\r\n global massEarth #the same goes for the mass of the Earth\r\n return (-G*massEarth*x)/((x**2+y**2)**(3/2)) # here from Newton's law of gravitation we return the accele... | [
"0.72341603",
"0.6672844",
"0.644247",
"0.6421138",
"0.6134269",
"0.6126715",
"0.6093111",
"0.60223216",
"0.59848374",
"0.5891617",
"0.5880014",
"0.5879183",
"0.577726",
"0.57613313",
"0.5665182",
"0.5594082",
"0.5587789",
"0.5585746",
"0.5568441",
"0.55637026",
"0.554956",
... | 0.7982147 | 0 |
This function calculates and returns the acceleration of the projectile in the x direction for part b. It performs the same task as the function above but for the y direction this only. This function is called by moonPass function | def moonCalcY(x,y,Mx,My, angle, velocityX, velocityY, massRocket, rocketForce):
global G # initialising global variables
global massEarth
global massMoon
global rocketStage
xMoon = x-Mx #here we calculate the position of the projectile relative to the moon. Ie with the centre of the moon at (0,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accelerationCalcX(x,y):\r\n global G # the gravitational constant is initialised like this so that it can be used in this function\r\n global massEarth #the same goes for the mass of the Earth\r\n return (-G*massEarth*x)/((x**2+y**2)**(3/2)) # here from Newton's law of gravitation we return the accele... | [
"0.7199217",
"0.71630937",
"0.67683756",
"0.6362245",
"0.6083082",
"0.59223694",
"0.5687629",
"0.5672643",
"0.5640631",
"0.5630404",
"0.5626732",
"0.55976063",
"0.5589999",
"0.5588611",
"0.5519784",
"0.5511293",
"0.5504897",
"0.5500797",
"0.5461975",
"0.5437691",
"0.5433538",... | 0.6179275 | 4 |
Return the view subclass used for this implementation | def viewfactory(self):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view(self):\n return self._view_class(self)",
"def get_view(self):\n return self.view",
"def get_view(self):\n from .views import default_page_view\n return (self.get_custom_view() or\n self.get_urlpattern_view() or\n default_page_view)",
"def my_... | [
"0.80432343",
"0.72993326",
"0.7179074",
"0.7052294",
"0.7002006",
"0.6985244",
"0.681428",
"0.67385596",
"0.6682467",
"0.65812206",
"0.6388516",
"0.63639754",
"0.63258916",
"0.6269671",
"0.62460923",
"0.62432194",
"0.6211297",
"0.6101324",
"0.6091942",
"0.60866314",
"0.60597... | 0.6010751 | 23 |
Set the default route to go through intf. | def setDefaultRoute( self, intf ):
self.cmd( 'ip route flush root 0/0' )
return self.cmd( 'route add default ' + intf ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_default_route_to_namespace(node, namespace, default_route):\n cmd = f\"ip netns exec {namespace} ip route add default \" \\\n f\"via {default_route}\"\n exec_cmd_no_error(node, cmd, sudo=True)",
"def setHostRoute( self, ip, intf ):\n return self.cmd( 'route add -host ' +... | [
"0.6774669",
"0.6770076",
"0.664887",
"0.6062997",
"0.599619",
"0.595429",
"0.58975947",
"0.58752805",
"0.58463943",
"0.58402807",
"0.5836372",
"0.5791792",
"0.5736922",
"0.5697862",
"0.56632996",
"0.5632258",
"0.5548598",
"0.54976135",
"0.5422293",
"0.54028916",
"0.5342135",... | 0.86951214 | 0 |
Returns the output tensor at the given index. | def get_output_tensor(interpreter, index):
output_details = interpreter.get_output_details()[index]
tensor = np.squeeze(interpreter.get_tensor(output_details["index"]))
return tensor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_output_tensor(index):\n output_details = interpreter.get_output_details()[index]\n tensor = np.squeeze(interpreter.get_tensor(output_details['index']))\n return tensor",
"def get_output_tensor(self, index):\n output_details = self.model.get_output_details()[index]\n tensor = np.squ... | [
"0.88110566",
"0.8773681",
"0.87153566",
"0.86581725",
"0.8473132",
"0.75534517",
"0.7171569",
"0.68134344",
"0.6715133",
"0.6542007",
"0.65397805",
"0.65058136",
"0.6436549",
"0.6430624",
"0.63161963",
"0.6215072",
"0.6104049",
"0.6095873",
"0.6082486",
"0.60789025",
"0.6071... | 0.8446493 | 6 |
Create an instance of RequestBrand from a dict | def from_dict(cls, obj: dict) -> RequestBrand:
if obj is None:
return None
if not isinstance(obj, dict):
return RequestBrand.parse_obj(obj)
_obj = RequestBrand.parse_obj({
"enabled": obj.get("enabled") if obj.get("enabled") is not None else False,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json(cls, json_str: str) -> RequestBrand:\n return cls.from_dict(json.loads(json_str))",
"def from_dict(cls, dikt) -> 'InstallmentRequest':\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, dikt) -> 'AllOfCreateClaimResponseClaim':\n return util.deserialize_model(di... | [
"0.7679478",
"0.5972524",
"0.5969632",
"0.5839963",
"0.579212",
"0.57508856",
"0.5745636",
"0.5735802",
"0.570862",
"0.568766",
"0.56873107",
"0.56569636",
"0.5647507",
"0.56461084",
"0.56461084",
"0.56461084",
"0.56461084",
"0.56461084",
"0.56461084",
"0.56461084",
"0.564610... | 0.8146828 | 0 |
Make a new RLAgent with the specified parameters. (RLAgent, float, float, float, int, int) > None | def __init__(self, alpha, gamma, epsilon, num_states, actions):
self.alpha = alpha
self.gamma = gamma
self.epsilon = epsilon
self.num_states = num_states
self.actions = actions
#Q is a dictionary mapping (state, action) pairs to Q values
self.Q = dict([((s, a)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_rgr(self, **kwargs):\n rgr = models.Raingaugereading.objects.create(\n LocationID=kwargs.get('aloc', self.aloc),\n LocationDescription=self.aloc.loc_name,\n deviceID=kwargs.get('adevice', self.adevice),\n SystemType='Metric',\n datetime=\"202... | [
"0.55096734",
"0.5489851",
"0.530163",
"0.5261121",
"0.5229753",
"0.5228018",
"0.52115846",
"0.51907825",
"0.51580715",
"0.5154786",
"0.5141704",
"0.51294154",
"0.5112593",
"0.5112306",
"0.5103071",
"0.50984496",
"0.50926447",
"0.50788176",
"0.5078001",
"0.5077062",
"0.505108... | 0.0 | -1 |
return the maximum reward that is attainable in the state following the current one. i.e the reward for taking the optimal action thereafter (QLearn, (int,int)) > int | def max_value (self, new_state):
##create a list to save reward information
return_list = []
##get each values from Q based on the new_state and its possible actions
for s, a in self.Q.keys():
if s == new_state:
return_list.append(self.Q[s,a]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _best_action(self, state):\n actions_rewards = list(self.Q[state].items())\n return max(actions_rewards, key=lambda x: x[1])[0]",
"def bestFutureReward(self, state):\n available_actions = Nim.availableActions(state)\n if not available_actions:\n return 0\n\n best... | [
"0.7830965",
"0.75167614",
"0.72280574",
"0.72002876",
"0.7193749",
"0.71508324",
"0.71424615",
"0.71265745",
"0.7119488",
"0.7100759",
"0.7032485",
"0.7016892",
"0.69742507",
"0.69548374",
"0.68755376",
"0.6874499",
"0.6859053",
"0.68393654",
"0.6834175",
"0.68258786",
"0.68... | 0.7414836 | 2 |
Compute geodesic distance between two coordinates | def geodesic_distance(coord1, coord2):
# convert coordinates to radians
s = math.pi * np.squeeze(np.array(coord1)) / 180
f = math.pi * np.squeeze(np.array(coord2)) / 180
delta = (f - s)/2
t = math.cos(f[0]) * math.cos(s[0]) * math.sin(delta[1])**2 + math.sin(delta[0])**2
return earth_radius() ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def geodesicDistance(A, B = geolocate(\"Colosseo\")):\n # colosseo = (41.890183, 12.492369)\n return geopy.distance.vincenty(A, B).meters",
"def calculateDistanceBetweenPoints(lat1,lon1,lat2,lon2):\n\treturn Geodesic.WGS84.Inverse(lat1,lon1, lat2, lon2)['s12']",
"def gpx_distance(lat1, lon1, lat2, lon2):... | [
"0.8040781",
"0.76826054",
"0.7614041",
"0.7522615",
"0.7473504",
"0.74703974",
"0.74609226",
"0.74029285",
"0.73929065",
"0.7370778",
"0.736628",
"0.73550165",
"0.73463356",
"0.7341979",
"0.7339803",
"0.73323673",
"0.7329245",
"0.73039186",
"0.7303546",
"0.72905797",
"0.7283... | 0.8206886 | 0 |
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments. | def __init__(self, *args, **kwds):
if args or kwds:
super(FeedbackMsg, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.name is None:
self.name = []
if self.position is None:
self.position = []
if self.veloci... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ... | [
"0.7794795",
"0.77207875",
"0.77207875",
"0.7687243",
"0.7625947",
"0.7564293",
"0.7440383",
"0.74175525",
"0.7352349",
"0.7308313",
"0.72808266",
"0.72378874",
"0.722805",
"0.7225032",
"0.7225032",
"0.7219433",
"0.72120637",
"0.72120637",
"0.72120637",
"0.72120637",
"0.72120... | 0.6605186 | 86 |
Returns drift part of operator collection. | def drift(self) -> Array:
return self._drift | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opschrift(self):\n return self._opschrift.get_waarde()",
"def time_slice(self):\n return self._time_slice",
"def exposuretime(self):\n _, = self.exposuretimes\n return _",
"def getLatestTriStimulusMeasurements(self): \n return self.tristimulus[len(self.tristimulus)-1]",
... | [
"0.56267965",
"0.5447225",
"0.5443726",
"0.5426616",
"0.53221864",
"0.5316858",
"0.5269261",
"0.5267263",
"0.52160937",
"0.5212362",
"0.52002513",
"0.52000004",
"0.5188197",
"0.51810086",
"0.51806635",
"0.5169509",
"0.51448566",
"0.5130017",
"0.51064724",
"0.51048577",
"0.510... | 0.6255158 | 0 |
r"""Initializes sparse version of DenseLindbladCollection. | def __init__(
self,
hamiltonian_operators: Union[Array, List[Operator]],
drift: Union[Array, Operator],
dissipator_operators: Optional[Union[Array, List[Operator]]] = None,
decimals: Optional[int] = 10,
):
self._hamiltonian_operators = np.empty(shape=len(hamiltonian_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_dense(self, layer):\n pass",
"def __init__(self, size):\n _PysparseMatrixFromShape.__init__(self, rows=size, cols=size, bandwidth = 1)\n ids = numerix.arange(size)\n self.put(numerix.ones(size, 'd'), ids, ids)",
"def __init__(self, mesh):\n _PysparseIdentityMatrix.__... | [
"0.66579854",
"0.6497202",
"0.6372822",
"0.6349901",
"0.6238567",
"0.6225138",
"0.6170507",
"0.614602",
"0.60978717",
"0.6092812",
"0.60588783",
"0.6017707",
"0.5980721",
"0.588104",
"0.58721834",
"0.58676046",
"0.5791371",
"0.5790613",
"0.57478",
"0.5745853",
"0.5741438",
... | 0.0 | -1 |
Create a Python instance from the given DOM node. The node tag must correspond to an element declaration in this module. | def CreateFromDOM (node, default_namespace=None):
if default_namespace is None:
default_namespace = Namespace.fallbackNamespace()
return pyxb.binding.basis.element.AnyCreateFromDOM(node, default_namespace) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateFromDOM (node, default_namespace=None):\n if default_namespace is None:\n default_namespace = Namespace.fallbackNamespace()\n return pyxb.binding.basis.element.AnyCreateFromDOM(node, _fallback_namespace=default_namespace)",
"def CreateFromDOM (node, default_namespace=None):\n if default... | [
"0.6949202",
"0.6949202",
"0.6949202",
"0.6946226",
"0.6698814",
"0.6698814",
"0.6698814",
"0.66975737",
"0.66655135",
"0.6650566",
"0.6622097",
"0.6594007",
"0.6585428",
"0.6564717",
"0.65103894",
"0.6489292",
"0.64718515",
"0.64257324",
"0.6323297",
"0.6312424",
"0.6311245"... | 0.70111525 | 5 |
This method will swap the elements in index1 and index2. | def swap(in_list: List, index1: int, index2: int) -> List:
in_list[index1], in_list[index2] = in_list[index2], in_list[index1]
return in_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap(A, index1, index2):\r\n \r\n temp = A[index1]\r\n A[index1] = A[index2]\r\n A[index2] = temp",
"def __swap(self, index_1, index_2):\n temp = self._lits[index_1]\n self._lits[index_1] = self._lits[index_2]\n self._lits[index_2] = temp",
"def __elementSwap(self,\n ... | [
"0.8186518",
"0.81637114",
"0.8062295",
"0.8040468",
"0.8008239",
"0.7883731",
"0.78536445",
"0.7778015",
"0.76299465",
"0.7587867",
"0.7157123",
"0.7131705",
"0.71264786",
"0.6966689",
"0.6966689",
"0.6952419",
"0.69396365",
"0.69360507",
"0.69190913",
"0.6914648",
"0.685035... | 0.7681684 | 8 |
Split text into list of sentences. | def split_into_sentences(s):
s = re.sub(r"\s+", " ", s)
s = re.sub(r"[\\.\\?\\!]", "\n", s)
return s.split("\n") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sentence_split(self, text):\n return split_into_sentences(text)",
"def split(text):\n doc = nlp(text)\n sentences = [x.text_with_ws for x in doc.sents]\n return sentences",
"def split_sentences(text: str) -> List[str]:\n return sent_tokenize(text)",
"def get_sentences(t... | [
"0.88153636",
"0.8775657",
"0.8704032",
"0.8609108",
"0.8492094",
"0.8371541",
"0.82318974",
"0.8141298",
"0.8125803",
"0.79511386",
"0.7819563",
"0.78083223",
"0.7782718",
"0.7710475",
"0.7690114",
"0.7607075",
"0.75983703",
"0.74884576",
"0.7450907",
"0.7350232",
"0.7345877... | 0.73575824 | 20 |
Split a sentence into list of words. | def split_into_words(s):
s = re.sub(r"\W+", " ", s)
s = re.sub(r"[_0-9]+", " ", s)
return s.split() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_split(self, sentence):\n return re.split(self.word_split_pattern, sentence)",
"def split_into_words(sentences):\n return list(sentences.split(\" \"))",
"def sentence_to_words(sentence: str) -> List[str]:\n return list(map(clean_word, sentence.split(\" \")))",
"def _split_into_words(sent... | [
"0.8525841",
"0.83239216",
"0.82957846",
"0.8187221",
"0.8187221",
"0.8154105",
"0.79631275",
"0.7685539",
"0.7630553",
"0.7622338",
"0.76149434",
"0.75853854",
"0.7567298",
"0.74862003",
"0.74179566",
"0.72903425",
"0.7266784",
"0.7244676",
"0.7236602",
"0.7182265",
"0.71387... | 0.7077573 | 25 |
Calculate the SFR surface density inside the half light radius. | def calc_SFRSD_inside_half_mass(galObj, gas_SFR, gas_m, gas_pos, halfMassR='gas'):
if halfMassR == 'gas':
half_mass_radius = galObj.radii['gas'].in_units('kpc')
elif halfMassR == 'stars':
half_mass_radius = galObj.radii['stellar_half_mass'].in_units('kpc')
extent = np.sqrt(gas_pos[:, 0]**2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def density(R, Rs, rho0, gamma_inner, gamma_outer):\n x = R/Rs\n outer_slope = (gamma_outer-gamma_inner)/2\n return rho0 / (x**gamma_inner * (1 + x ** 2) ** outer_slope)",
"def density_2d(self, x, y, Rs, rho0, gamma_inner, gamma_outer, center_x=0, center_y=0):\n x_ = x - center_x\n ... | [
"0.6771827",
"0.66627306",
"0.64252836",
"0.6356213",
"0.6310369",
"0.62590927",
"0.62516224",
"0.62510586",
"0.6151254",
"0.613005",
"0.6118389",
"0.610538",
"0.610098",
"0.60689276",
"0.604054",
"0.5988857",
"0.5985864",
"0.5961025",
"0.5905253",
"0.59052217",
"0.5878829",
... | 0.59433025 | 18 |
Calculate the gas mass surface density inside the half light radius. | def calc_gasSD_inside_half_mass(galObj, gas_m, gas_pos, halfMassR='gas'):
if halfMassR == 'gas':
half_mass_radius = galObj.radii['gas_half_mass'].in_units('kpc')
elif halfMassR == 'stars':
half_mass_radius = galObj.radii['stellar_half_mass'].in_units('kpc')
extent = np.sqrt(gas_pos[:, 0]**2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def density(self):\n return (1e-3*self.molar_mass) * self.pressure / (gas_constant * self.temperature) # kg/m^3",
"def electron_density(self):\n return N_avo * self.num_electrons * self.density / self.molar_mass",
"def debye_length_m(electron_density, electron_temperature):\n return 0.069 * np... | [
"0.74212915",
"0.6758004",
"0.6595277",
"0.6568875",
"0.6359786",
"0.6336078",
"0.6317417",
"0.63041824",
"0.62909245",
"0.6262112",
"0.62119275",
"0.61328477",
"0.6109057",
"0.6106781",
"0.60997856",
"0.6065996",
"0.6062983",
"0.6053786",
"0.60425705",
"0.597259",
"0.5952377... | 0.675021 | 2 |
Determine whether a tile is within an area. | def in_area(self, x, y):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isInArea(self, width, height, depth):\n if self.position[0] + self.radius > width / -2 and self.position[0] + self.radius < width / 2:\n if self.position[1] + self.radius > height / -2 and self.position[1] + self.radius < height / 2:\n if self.position[2] + self.radius > -depth... | [
"0.7392802",
"0.7392606",
"0.7053643",
"0.70512265",
"0.70401376",
"0.69800645",
"0.6872806",
"0.6862442",
"0.683884",
"0.6779661",
"0.67476445",
"0.67366385",
"0.6662991",
"0.6653946",
"0.6651523",
"0.6590596",
"0.6586936",
"0.65789086",
"0.6570661",
"0.6567855",
"0.656465",... | 0.6593424 | 15 |
Get the object key name in OSS, e.g., | def _get_key_name(self, name):
base_path = force_text(self.location)
final_path = urljoin(base_path + "/", name)
name = os.path.normpath(final_path.lstrip('/'))
if six.PY2:
name = name.encode('utf-8')
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def obj_key(objname):\n return OBJ_PREFIX + objname",
"def key_object_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"key_object_name\")",
"def object_key(self) -> str:\n return self._event.get('object_key')",
"def object_key(self) -> str:\n return self._values.... | [
"0.7963838",
"0.78579193",
"0.7612428",
"0.7500038",
"0.7367759",
"0.7254234",
"0.70940745",
"0.70226157",
"0.70183325",
"0.6945676",
"0.6918048",
"0.6914951",
"0.6846224",
"0.6846224",
"0.6846224",
"0.6748133",
"0.6713146",
"0.6699601",
"0.668567",
"0.6649633",
"0.66189724",... | 0.0 | -1 |
Plot the soil moisture orbit. Gives map plots and scatter. | def plot_sm_orbit(smdf, orbit_name, fieldname='Soil_Moisture', vmin=0, vmax=1, save_fig_directory=None):
logging.debug('Plotting {} orbit, field {}...'.format(orbit_name, fieldname))
fig, m, dot_size = setup_sm_plot(smdf['Latitude'].values, smdf['Longitude'].values)
if fieldname == 'Soil_Moisture':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_moons(epoch = epoch(0)):\n\tfrom PyKEP.orbit_plots import plot_planet\n\tfrom mpl_toolkits.mplot3d import Axes3D\n\timport matplotlib.pyplot as plt\n\t\n\tfig = plt.figure()\n\tax = fig.gca(projection='3d')\n\n\tplot_planet(ax,io,color = 'r', units = JR, t0 = epoch, legend=True)\n\tplot_planet(ax,europa,c... | [
"0.6935004",
"0.68583137",
"0.67280704",
"0.65847456",
"0.6573265",
"0.65687037",
"0.64142007",
"0.6413674",
"0.64013517",
"0.6376612",
"0.6351136",
"0.63484716",
"0.63195926",
"0.6277084",
"0.62593675",
"0.62387866",
"0.6185118",
"0.6158423",
"0.6128664",
"0.61141086",
"0.60... | 0.7066982 | 0 |
Check whether d1 and d2 are equal regardless of the order of list values. | def equal_project_access(d1, d2):
try:
assert len(d1.keys()) == len(d2.keys())
for project, permissions in d1.items():
assert project in d2
assert sorted(permissions) == sorted(d2[project])
except AssertionError:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def same(d1: Sequence[Any], d2: Sequence[Any]) -> bool:\n if len(d1) != len(d2):\n return False\n for i in range(len(d1)):\n if d1[i] != d2[i]:\n return False\n return True",
"def check_values_same(lst1, lst2):\n\treturn len(lst1) == len(lst2) and sorted(lst1) == sorted(lst2)",
... | [
"0.7968555",
"0.79096067",
"0.76765937",
"0.7429728",
"0.73960036",
"0.7334152",
"0.7300036",
"0.72983956",
"0.72367805",
"0.7235311",
"0.7081823",
"0.70509684",
"0.70473987",
"0.70139694",
"0.6921619",
"0.69190145",
"0.68755066",
"0.6848204",
"0.682178",
"0.68028843",
"0.678... | 0.0 | -1 |
Test that if the YAML file doesn't exist then the syncer doesn't do anything with the arborist client | def test_sync_missing_file(syncer, monkeypatch, db_session):
monkeypatch.setattr(syncer, "sync_from_local_yaml_file", "this-file-is-not-real")
with pytest.raises(FileNotFoundError):
syncer.sync()
assert syncer.arborist_client.create_resource.not_called()
assert syncer.arborist_client.create_role... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sync_incorrect_user_yaml_file(syncer, monkeypatch, db_session):\n path = os.path.join(\n os.path.dirname(os.path.realpath(__file__)), \"data/yaml/incorrect_user.yaml\"\n )\n monkeypatch.setattr(syncer, \"sync_from_local_yaml_file\", path)\n with pytest.raises(AssertionError):\n s... | [
"0.685649",
"0.66300994",
"0.6485659",
"0.644258",
"0.64357084",
"0.64008915",
"0.6371307",
"0.6369266",
"0.6366622",
"0.63307995",
"0.625126",
"0.62506944",
"0.6196918",
"0.61653817",
"0.61220896",
"0.61201334",
"0.6088404",
"0.60745054",
"0.60555875",
"0.601999",
"0.6018925... | 0.7024328 | 0 |
Test that if the YAML file doesn't exist then the syncer doesn't do anything with the arborist client | def test_sync_incorrect_user_yaml_file(syncer, monkeypatch, db_session):
path = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "data/yaml/incorrect_user.yaml"
)
monkeypatch.setattr(syncer, "sync_from_local_yaml_file", path)
with pytest.raises(AssertionError):
syncer.sync()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sync_missing_file(syncer, monkeypatch, db_session):\n monkeypatch.setattr(syncer, \"sync_from_local_yaml_file\", \"this-file-is-not-real\")\n with pytest.raises(FileNotFoundError):\n syncer.sync()\n assert syncer.arborist_client.create_resource.not_called()\n assert syncer.arborist_clie... | [
"0.7024328",
"0.66300994",
"0.6485659",
"0.644258",
"0.64357084",
"0.64008915",
"0.6371307",
"0.6369266",
"0.6366622",
"0.63307995",
"0.625126",
"0.62506944",
"0.6196918",
"0.61653817",
"0.61220896",
"0.61201334",
"0.6088404",
"0.60745054",
"0.60555875",
"0.601999",
"0.601892... | 0.685649 | 1 |
Check that the ``syncer.arborist_client`` (which is a ``MagicMock``) is called appropriately. Also test that the policies for users are created in the database correctly, and registered to the User models. | def test_update_arborist(syncer, db_session):
syncer.sync()
# These projects and permissions are collected from the syncer fixture. In
# future should refactor to make project mapping its own fixture and not
# duplicate in the tests here.
# one project is configured to point to two different arbor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n\n self.client = get_client()\n self.fake = Faker()\n self.sim = Simulate()\n\n self.generate_authorizations(10)",
"def setUp(self):\n with patch(\"bookwyrm.suggested_users.rerank_suggestions_task.delay\"), patch(\n \"bookwyrm.activitystreams.popula... | [
"0.65805334",
"0.6471511",
"0.64180225",
"0.63988686",
"0.6343122",
"0.6307082",
"0.62330174",
"0.6220955",
"0.6212527",
"0.6202211",
"0.619742",
"0.6195811",
"0.61952835",
"0.6179344",
"0.61567736",
"0.6149941",
"0.6133762",
"0.6115268",
"0.60919315",
"0.6087626",
"0.6084599... | 0.0 | -1 |
Convert a float to 64bit integer | def float_to_int_64(x):
return np.float64(x).view(np.int64) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_int_to_i64(val):\n if val > 0x7FFFFFFFFFFFFFFF:\n val -= 0x10000000000000000\n return val",
"def bin_to_float64(b):\n bf = int_to_bytes(int(b, 2), 8) # 8 bytes needed for IEEE 754 binary64.\n return struct.unpack(\">d\", bf)[0]",
"def float_to_bin64(value):\n [d] = struct.un... | [
"0.6942918",
"0.6889584",
"0.669873",
"0.6556856",
"0.6440175",
"0.63891",
"0.6360378",
"0.6333624",
"0.62157387",
"0.61884594",
"0.61860836",
"0.61694336",
"0.61260474",
"0.6114865",
"0.60392386",
"0.59791774",
"0.59192514",
"0.5894881",
"0.5893504",
"0.5890302",
"0.586931",... | 0.72442496 | 0 |
Convert a float to integer with precision prec | def float_to_int(x, prec=64):
if prec == 16: return float_to_int_16(x)
elif prec == 32: return float_to_int_32(x)
elif prec == 64: return float_to_int_64(x)
else: raise ValueError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _float2int(x: float) -> int:\n return round(x * 100)",
"def set_num_precision(number, precision, mode='int'):\n fmt = '{:.%ie}' % (precision - 1)\n value = float(fmt.format(number))\n if mode == 'int':\n return int(value)\n else:\n return value",
"def int_r(f):\n return int(np... | [
"0.7167975",
"0.6879536",
"0.6711734",
"0.6599057",
"0.64479166",
"0.63786715",
"0.6356254",
"0.62676",
"0.6264848",
"0.6208819",
"0.6200068",
"0.6175348",
"0.61597306",
"0.6158532",
"0.6128278",
"0.61098605",
"0.60939324",
"0.6079625",
"0.60612583",
"0.6056072",
"0.60408086"... | 0.77927786 | 0 |
Get the front element. | def peek(self):
return self.s1[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass",
"def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1",
"def front(self):\n return self.queue[0] if not self.empty() else None",
"def peek_front(... | [
"0.82009244",
"0.79261875",
"0.7852642",
"0.7791182",
"0.77886623",
"0.75723046",
"0.752337",
"0.7510604",
"0.7478953",
"0.7379256",
"0.7379256",
"0.734284",
"0.7323573",
"0.7320296",
"0.7291721",
"0.72772557",
"0.7269801",
"0.72657627",
"0.7253295",
"0.72355044",
"0.72213495... | 0.0 | -1 |
Returns whether the queue is empty. | def empty(self):
return not self.s1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return self.queue == []",
"def ... | [
"0.9270249",
"0.92506766",
"0.923635",
"0.923635",
"0.9155843",
"0.9098441",
"0.9095006",
"0.90922606",
"0.90731245",
"0.9053733",
"0.89205354",
"0.89137155",
"0.8877591",
"0.88436323",
"0.88436323",
"0.8835949",
"0.88038146",
"0.8758203",
"0.87577534",
"0.87310195",
"0.86462... | 0.0 | -1 |
Whether the permission allows viewing the audit log entries. | def view_audit_log(_) -> int:
return 1 << 7 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_retrieve(self, user):\n return user.has_perm('agenda.can_see')",
"def has_permission(self, request):\n\t\treturn request.user.is_active",
"def has_read_permission(request):\n return request.user.is_authenticated",
"def has_permission(self, request, view):\n return True",
"def h... | [
"0.7018155",
"0.68768364",
"0.68630093",
"0.6845447",
"0.682306",
"0.67998993",
"0.67655075",
"0.67655075",
"0.67655075",
"0.67611724",
"0.6746218",
"0.67438066",
"0.6730105",
"0.66843146",
"0.6679533",
"0.6667907",
"0.66168636",
"0.6600249",
"0.6553",
"0.65345514",
"0.652949... | 0.0 | -1 |
Whether the permission allows viewing guild insights. | def view_guild_insights(_) -> int:
return 1 << 19 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_insights_enabled(self) -> bool:\n return pulumi.get(self, \"query_insights_enabled\")",
"def cog_check(self, ctx):\r\n return ctx.author.guild_permissions.administrator",
"def cog_check(self, ctx):\r\n return ctx.author.guild_permissions.administrator",
"def cog_check(self, ctx... | [
"0.6405012",
"0.63508105",
"0.63508105",
"0.63464755",
"0.62409306",
"0.6153281",
"0.6151728",
"0.6137142",
"0.6096931",
"0.6026075",
"0.5987474",
"0.596902",
"0.596902",
"0.59451103",
"0.5873076",
"0.5866136",
"0.5866136",
"0.58479214",
"0.5831182",
"0.5815345",
"0.5815345",... | 0.6113736 | 8 |
Whether the permission allows changing own nickname. | def change_nickname(_) -> int:
return 1 << 26 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_set_nickname(string, nickname):\n if string.startswith(f\"{nickname} set the nickname for \"):\n return True\n\n if string.startswith(f\"{nickname} set his own nickname to\"):\n return True\n \n if string.startswith(f\"{nickname} set her own nickname to\"):\n return True... | [
"0.6482587",
"0.6481297",
"0.6291738",
"0.6254609",
"0.6228162",
"0.61706996",
"0.616505",
"0.61400187",
"0.61136097",
"0.6088148",
"0.60800743",
"0.60230184",
"0.5992436",
"0.59681773",
"0.5957309",
"0.59531975",
"0.5924912",
"0.5916929",
"0.5908201",
"0.59042877",
"0.588266... | 0.60834026 | 11 |
Whether the permission allows viewing the audit log entries. | def view_audit_log(_) -> int:
return 1 << 7 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_retrieve(self, user):\n return user.has_perm('agenda.can_see')",
"def has_permission(self, request):\n\t\treturn request.user.is_active",
"def has_read_permission(request):\n return request.user.is_authenticated",
"def has_permission(self, request, view):\n return True",
"def h... | [
"0.7018155",
"0.68768364",
"0.68630093",
"0.6845447",
"0.682306",
"0.67998993",
"0.67655075",
"0.67655075",
"0.67655075",
"0.67611724",
"0.6746218",
"0.67438066",
"0.6730105",
"0.66843146",
"0.6679533",
"0.6667907",
"0.66168636",
"0.6600249",
"0.6553",
"0.65345514",
"0.652949... | 0.0 | -1 |
Whether the permission allows viewing guild insights. | def view_guild_insights(_) -> int:
return 1 << 19 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_insights_enabled(self) -> bool:\n return pulumi.get(self, \"query_insights_enabled\")",
"def cog_check(self, ctx):\r\n return ctx.author.guild_permissions.administrator",
"def cog_check(self, ctx):\r\n return ctx.author.guild_permissions.administrator",
"def cog_check(self, ctx... | [
"0.6405012",
"0.63508105",
"0.63508105",
"0.63464755",
"0.62409306",
"0.6153281",
"0.6151728",
"0.6137142",
"0.6096931",
"0.6026075",
"0.5987474",
"0.596902",
"0.596902",
"0.59451103",
"0.5873076",
"0.5866136",
"0.5866136",
"0.58479214",
"0.5831182",
"0.5815345",
"0.5815345",... | 0.6113736 | 9 |
Whether the permission allows changing own nickname. | def change_nickname(_) -> int:
return 1 << 26 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_set_nickname(string, nickname):\n if string.startswith(f\"{nickname} set the nickname for \"):\n return True\n\n if string.startswith(f\"{nickname} set his own nickname to\"):\n return True\n \n if string.startswith(f\"{nickname} set her own nickname to\"):\n return True... | [
"0.6482587",
"0.6481297",
"0.6291738",
"0.6254609",
"0.6228162",
"0.61706996",
"0.616505",
"0.61400187",
"0.61136097",
"0.6088148",
"0.60800743",
"0.60230184",
"0.5992436",
"0.59681773",
"0.5957309",
"0.59531975",
"0.5924912",
"0.5916929",
"0.5908201",
"0.59042877",
"0.588266... | 0.60834026 | 10 |
test access control is superuser as user raises access control error | def test_access_control_is_superuser_as_user_raises_access_control_error(
self,
):
# Arrange
mock_request = create_mock_request(user=self.user1)
# Act # Assert
with self.assertRaises(AccessControlError):
access_control_api.is_superuser(
mock_funct... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_superuser():\n assert os.geteuid() == 0, \"Need ROOT access in order to run tests.\"",
"def testSuperUserPermission(self):\n self.login_user(self.superuser)\n response = self.client.get(self.url, self.args)\n self.assertEqual(response.status_code, 200)",
"def test_allowed_if_su... | [
"0.787466",
"0.7768381",
"0.755608",
"0.7542454",
"0.7503443",
"0.74209255",
"0.7317844",
"0.71510184",
"0.71108466",
"0.70906705",
"0.70008606",
"0.6914645",
"0.6878309",
"0.6844263",
"0.6829176",
"0.6776396",
"0.6776396",
"0.6766586",
"0.67515683",
"0.6733049",
"0.6733049",... | 0.77014107 | 2 |
test access control is superuser as super raises api error | def test_access_control_is_superuser_as_superuser_raises_api_error(self):
# Arrange
mock_request = create_mock_request(user=self.superuser)
exception = ApiError("")
# Act # Assert
with self.assertRaises(ApiError):
access_control_api.is_superuser(
mock... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testSuperUserPermission(self):\n self.login_user(self.superuser)\n response = self.client.get(self.url, self.args)\n self.assertEqual(response.status_code, 200)",
"def test_superuser_permission_with_super_user(self):\n with self.settings(MAINTENANCE_MODE_PERMISSION_PROCESSORS=(\n ... | [
"0.83144873",
"0.77594656",
"0.76845634",
"0.766991",
"0.7618787",
"0.7546837",
"0.7546837",
"0.7526855",
"0.7301689",
"0.7282134",
"0.7101978",
"0.7100674",
"0.70585656",
"0.70547795",
"0.6990732",
"0.69349694",
"0.6899662",
"0.6862754",
"0.6842934",
"0.68352413",
"0.6834773... | 0.7198798 | 10 |
test access control is superuser as super raises access control error | def test_access_control_is_superuser_as_superuser_raises_access_control_error(
self,
):
# Arrange
mock_request = create_mock_request(user=self.superuser)
access_control_error = AccessControlError("")
# Act # Assert
with self.assertRaises(AccessControlError):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testSuperUserPermission(self):\n self.login_user(self.superuser)\n response = self.client.get(self.url, self.args)\n self.assertEqual(response.status_code, 200)",
"def test_superuser():\n assert os.geteuid() == 0, \"Need ROOT access in order to run tests.\"",
"def test_superuser_per... | [
"0.7926901",
"0.78380597",
"0.7679196",
"0.7552732",
"0.7517629",
"0.7461937",
"0.74015653",
"0.7009319",
"0.6957288",
"0.6957288",
"0.6876388",
"0.6847013",
"0.680083",
"0.67896056",
"0.6775549",
"0.67653525",
"0.6695913",
"0.6695714",
"0.66938186",
"0.66831994",
"0.6678167"... | 0.7440223 | 6 |
Get spherical distance any two points given their coordinates (latitude, longitude) | def get_spherical_distance(lat1,lat2,long1,long2):
q=radians(lat2-lat1)
r=radians(long2-long1)
lat2r=radians(lat2)
lat1r=radians(lat1)
a=sin(q/2)*sin(q/2)+cos(lat1r)*cos(lat2r)*sin(r/2)*sin(r/2)
c=2*atan2(sqrt(a),sqrt(1-a))
R=6371*1000
d=R*c
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spherical_distances(x, y):\n # Compute the norms of all points, we do NOT check they actually all lie on\n # the same sphere (that's the caller's responsibility).\n \n xn = np.sqrt((x**2).sum(axis=1))\n yn = np.sqrt((y**2).sum(axis=1))\n ang_cos = np.dot(x, y.T)/(xn[:, None]*yn[None, :])\n ... | [
"0.79287094",
"0.78385377",
"0.7595353",
"0.7435804",
"0.7364662",
"0.7357647",
"0.73399687",
"0.7312062",
"0.7279686",
"0.7258058",
"0.7257607",
"0.7221853",
"0.7127854",
"0.70741135",
"0.70725614",
"0.70600396",
"0.7051796",
"0.70387834",
"0.6986964",
"0.6980361",
"0.696735... | 0.7358248 | 5 |
Retrieves the list of all State objects | def states():
states = []
for state in storage.all('State').values():
states.append(state.to_dict())
return jsonify(states) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_states(self):\n return self._states",
"def all_states():\n dict = storage.all(State)\n list = []\n for state in dict.values():\n list.append(state.to_dict())\n return jsonify(list)",
"def all_states():\n states = []\n states_values = storage.all(\"State\").values()\n... | [
"0.8137676",
"0.8114916",
"0.81053764",
"0.80541945",
"0.79778695",
"0.7974168",
"0.79698193",
"0.78558934",
"0.77833647",
"0.77445245",
"0.7663341",
"0.765244",
"0.7569619",
"0.7534709",
"0.7502574",
"0.74869597",
"0.7467144",
"0.732207",
"0.7299296",
"0.7243289",
"0.7234044... | 0.7464845 | 17 |
Return a printable representation of the straight line | def __str__(self):
lstr = ""
# String for x term
if self.a != 0:
if self.a == 1:
lstr += "x"
elif self.a == -1:
lstr += "-x"
else:
lstr += str(self.a) + "x"
# String for y term
if lstr != "": #... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_(self):\n return 'A line in the direction ' + repr(self.vector());",
"def _repr_(self):\n return 'A line in the direction ' + repr(self._representation_vector);",
"def line(points):\n return LineString(points)",
"def print_line():\n print('+ - - - - + - - - - +'),",
"def line(... | [
"0.7628414",
"0.7432426",
"0.7299545",
"0.708804",
"0.6921446",
"0.68939066",
"0.67371535",
"0.66506517",
"0.6594602",
"0.6469375",
"0.6452042",
"0.6444838",
"0.64361435",
"0.63939077",
"0.6385578",
"0.6367359",
"0.6344225",
"0.633987",
"0.6334883",
"0.62823606",
"0.62716275"... | 0.0 | -1 |
Return a printable representation of the straight line | def __repr__(self):
return str(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_(self):\n return 'A line in the direction ' + repr(self.vector());",
"def _repr_(self):\n return 'A line in the direction ' + repr(self._representation_vector);",
"def line(points):\n return LineString(points)",
"def print_line():\n print('+ - - - - + - - - - +'),",
"def line(... | [
"0.7628414",
"0.7432426",
"0.7299545",
"0.708804",
"0.6921446",
"0.68939066",
"0.67371535",
"0.66506517",
"0.6594602",
"0.6469375",
"0.6452042",
"0.6444838",
"0.64361435",
"0.63939077",
"0.6385578",
"0.6367359",
"0.6344225",
"0.633987",
"0.6334883",
"0.62823606",
"0.62716275"... | 0.0 | -1 |
Return the slope of the straight line. If the line is vertical, None is returned. | def slope(self):
if self.b == 0:
return None
else:
return (-1) * self.a/self.b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_segment_slope(segment: Tuple[Point]):\n return (\n (segment[0].y - segment[1].y) / (segment[0].x - segment[1].x)\n if (segment[0].x - segment[1].x) != 0\n else float(\"inf\")\n )",
"def slope(start, end):\n\tx1 = start[0]\n\ty1 = start[1]\n\tx2 = end[0]\n\ty2 = end[1]\n\ttop = ... | [
"0.7364191",
"0.7166937",
"0.7103884",
"0.7045604",
"0.7019451",
"0.69471735",
"0.692469",
"0.6909021",
"0.6900345",
"0.6852268",
"0.6656526",
"0.66505015",
"0.66357017",
"0.6598907",
"0.65987",
"0.6584361",
"0.65671134",
"0.6559925",
"0.6549819",
"0.6510047",
"0.6503251",
... | 0.74592346 | 0 |
Return True if L is parallel to the straight line, and False otherwise | def parallel(self, L):
return self.slope() == L.slope() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perpendicular(self, L):\n if self.slope() is None: # if the line is vertical, L must be horizontal\n return L.slope() == 0\n elif self.slope() == 0: # if the line is horizontal, L must be vertical\n return L.slope() is None\n else:\n return self.slope() ... | [
"0.7166783",
"0.7142611",
"0.6976377",
"0.69568163",
"0.6914358",
"0.68621224",
"0.68530166",
"0.68178743",
"0.6817851",
"0.6717622",
"0.6670572",
"0.6657986",
"0.66080886",
"0.6605518",
"0.657581",
"0.65120167",
"0.6476982",
"0.64696604",
"0.6432958",
"0.64147866",
"0.638021... | 0.78763753 | 0 |
Return the intersection point (a 2tuple) of L with the straight line. If the line is parallel to L, None is returned. | def intersection(self, L):
if self.slope() == L.slope():
return None
intpt_xcood = (self.c * L.b - L.c * self.b)/(self.a * L.b - L.a * self.b)
intpt_ycood = (self.c * L.a - L.c * self.a)/(self.b * L.a - L.b * self.a)
return (intpt_xcood, intpt_ycood) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersection(self, line: AbstractLine) -> Optional[AbstractPoint]:\n plane = Plane(self.__point_a,\n self.__point_b - self.__point_a,\n self.__point_c - self.__point_a)\n\n point = plane.intersection(line)\n if point is not None:\n if se... | [
"0.74953175",
"0.72366256",
"0.71736336",
"0.7018175",
"0.6921521",
"0.6889775",
"0.67568314",
"0.67477953",
"0.6587873",
"0.6492234",
"0.6457997",
"0.6406959",
"0.6392092",
"0.6383066",
"0.63744235",
"0.6335968",
"0.6276457",
"0.62747335",
"0.6262454",
"0.626192",
"0.6230714... | 0.72639793 | 1 |
Return True if the line is exactly the same as other, and False otherwise | def __eq__(self, other):
if self.slope() == None:
return other.slope() == None and self.xintercept() == other.xintercept()
return self.slope() == other.slope() and self.yintercept() == other.yintercept() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return (type(self) is type(other) and\n self.line == other.line and\n self.line_num == other.line_num and\n six.text_type(self) == six.text_type(other))",
"def __eq__(self, other):\n if not isinstance(other, Line):\n ... | [
"0.7695502",
"0.72822475",
"0.70204264",
"0.69606936",
"0.69357806",
"0.6908085",
"0.68274266",
"0.68272936",
"0.68226993",
"0.6819414",
"0.67026985",
"0.66326946",
"0.65308475",
"0.6512884",
"0.6512884",
"0.64908487",
"0.6474869",
"0.64633965",
"0.64423656",
"0.6440808",
"0.... | 0.65658975 | 12 |
Returns a list of colors used in this image. | def getcolors(self, maxcolors=256):
if self._mode in ("1", "L", "P"):
h = self._instance.histogram()
out = []
for i in range(256):
if h[i]:
out.append((h[i], i))
if len(out) > maxcolors:
return None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colors(self):\r\n\t\treturn self._colors",
"def colors(self):\n return self._colors",
"def colors(self):\n return self[\"colors\"]",
"def colors(self):\n return self[\"colors\"]",
"def colors(self):\n\t\treturn [(0, 30, 255),(0, 30, 120)]",
"def getColors():\n return ['#8c99fc... | [
"0.8379901",
"0.83687454",
"0.8225577",
"0.8225577",
"0.79351646",
"0.7840355",
"0.7629967",
"0.75167745",
"0.74948686",
"0.74545413",
"0.73670036",
"0.7218997",
"0.7200838",
"0.7198534",
"0.71145505",
"0.70901495",
"0.70362496",
"0.700691",
"0.6970793",
"0.6914166",
"0.68709... | 0.6705799 | 23 |
Returns a histogram for the image. The histogram is returned as a list of pixel counts, one for each pixel value in the source image. If the image has more than one band, the histograms for all bands are concatenated (for example, the histogram for an "RGB" image contains 768 values). A bilevel image (mode "1") is trea... | def histogram(self, mask=None, extrema=None):
uni, counts = self._getcolors()
return [l for l in counts] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe(self, image, mask=None):\n histogram = cv2.calcHist([image], [0, 1, 2], mask, self.bins, [0, 256, 0, 256, 0, 256])\n cv2.normalize(histogram, histogram)\n\n return histogram.flatten()",
"def histograms(self, *args, **kwargs):\n return _image.image_histograms(self, *args, ... | [
"0.69900167",
"0.6610396",
"0.6552293",
"0.6299862",
"0.61408544",
"0.6139109",
"0.6043549",
"0.60427636",
"0.60298526",
"0.595549",
"0.5829149",
"0.5772954",
"0.57710135",
"0.5740489",
"0.57032293",
"0.5678399",
"0.567833",
"0.56576544",
"0.56424284",
"0.559242",
"0.557964",... | 0.6618615 | 1 |
Test IO of .surf | def test_geometry():
surf_path = pjoin(data_path, "surf", "%s.%s" % ("lh", "inflated"))
coords, faces = read_geometry(surf_path)
assert_equal(0, faces.min())
assert_equal(coords.shape[0], faces.max() + 1)
# Test quad with sphere
surf_path = pjoin(data_path, "surf", "%s.%s" % ("lh", "sphere"))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_surf():\n def f(x, y):\n sin, cos = numpy.sin, numpy.cos\n return sin(x + y) + sin(2 * x - y) + cos(3 * x + 4 * y)\n\n x, y = numpy.mgrid[-7.:7.05:0.1, -5.:5.05:0.05]\n s = surf(x, y, f)\n mlab.show()\n #cs = contour_surf(x, y, f, contour_z=0)\n return",
"def test_morph_d... | [
"0.6641745",
"0.5991208",
"0.5901561",
"0.5861314",
"0.5859329",
"0.5802738",
"0.56625646",
"0.5633906",
"0.56201524",
"0.56140715",
"0.56027144",
"0.55701965",
"0.55435073",
"0.55309486",
"0.55102223",
"0.548895",
"0.54658955",
"0.5429626",
"0.538379",
"0.5362354",
"0.530977... | 0.6341031 | 1 |
This function returns whether or not an integer is a prime number. | def is_prime(n):
if n == 2:
return True
if n == 0 or n == 1 or n % 2 == 0:
return False
for i in range(3, int(math.sqrt(n))+1, 2):
if n % i == 0:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prime_number(number_):\n flag = 0\n for values in range(2, number_//2):\n if number_ % values == 0:\n flag += 1\n if flag == 1:\n return True\n else:\n return False",
"def is_prime(number):\n\t\n\tif number < 2: return False\n\telif number == 2: return True\n\te... | [
"0.7947226",
"0.7919969",
"0.7897691",
"0.7896823",
"0.7883839",
"0.7883485",
"0.78633016",
"0.78387153",
"0.7825517",
"0.78217334",
"0.7809525",
"0.779863",
"0.77765465",
"0.77666974",
"0.77520657",
"0.7750314",
"0.7729893",
"0.7708646",
"0.77006966",
"0.76898926",
"0.768205... | 0.73579645 | 69 |
This function returns the list of prime number lesser than N. | def liste_N_nb_premier(N):
liste = []
i = 0
while len(liste) < N:
if is_prime(i):
liste.append(i)
i += 1
return liste | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_primes(n):\n primeList = []\n for i in range(n):\n if is_prime(i):\n primeList.append(i)\n return primeList",
"def primes(n):\n return [i for i in xrange(1, n + 1) if mr_prime(i)]",
"def generate_prime_less_than_n(n):\n\tif n <= 1:\n\t\treturn []\n\tlist_of_primes = [2]\n\tfor i in range... | [
"0.79166585",
"0.78252643",
"0.77794",
"0.7731997",
"0.7727879",
"0.76638025",
"0.7577047",
"0.7568607",
"0.7564964",
"0.7522414",
"0.7501913",
"0.7497206",
"0.74915093",
"0.74915093",
"0.74238646",
"0.7420592",
"0.7341136",
"0.7333776",
"0.73223823",
"0.7292376",
"0.7289568"... | 0.7917129 | 0 |
This function checks whether or not a number is truncatable, ie every subnumber written by removing a front or back number is still a prime number. | def is_truncatable(nb):
nb = str(nb)
if is_prime(int(nb)):
for i in range(1, len(nb)):
if not is_prime(int(nb[i:])) or not is_prime(int(nb[:len(nb)-i])):
return False
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_truncatable(number: int):\n\n str_number = str(number)\n index = 0\n\n # Left shift:\n while index < len(str_number):\n if not is_prime(int(str_number[index:])):\n return False\n\n index += 1\n\n # Right shift:\n index = len(str_number)\n while index > 0:\n ... | [
"0.792935",
"0.6656063",
"0.64213675",
"0.63436365",
"0.62462485",
"0.6234058",
"0.6154132",
"0.61109185",
"0.6067006",
"0.6060549",
"0.6056523",
"0.60431683",
"0.60208267",
"0.6009649",
"0.5997058",
"0.59954643",
"0.59928215",
"0.597895",
"0.5948257",
"0.59479547",
"0.594297... | 0.80308694 | 0 |
Remove spaces and translate unicode specials to latin1 | def sanitize(formula):
TR_UNICODE = {u"·": u"*", u"−": u"-"}
return "".join(TR_UNICODE.get(ch, ch) for ch in formula if ch > " ") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_latin(raw_word):\n nfkd = unicodedata.normalize('NFKD', raw_word)\n lowercased = nfkd.lower()\n no_digits = DIGITS.sub('', lowercased)\n j_to_i = re.sub('j', 'i', no_digits)\n v_to_u = re.sub('v', 'u', j_to_i)\n return NONWORDS.sub('', v_to_u)",
"def clean_unicode(text):\n clea... | [
"0.71421874",
"0.6781372",
"0.67393506",
"0.67393506",
"0.67286545",
"0.6682028",
"0.6644166",
"0.6602575",
"0.6597704",
"0.65489376",
"0.6548724",
"0.65016615",
"0.6459858",
"0.6455559",
"0.6448775",
"0.64467627",
"0.64382565",
"0.64222693",
"0.63879466",
"0.6387116",
"0.638... | 0.0 | -1 |
Unfreeze all layers and compile model. | def unfreeeze_all_layers(self):
# Unfreeeze
logger.info('MODEL: Unfreeze all layers.')
for i in range(len(self.model.layers)):
self.model.layers[i].trainable = True
# Compile model
logger.info('MODEL: Compiling...')
self.model.compile(optimizer = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unfreeze(self, exclude_range=None):\n # make all layers trainable\n for i, layer in enumerate(self.model.layers):\n layer.trainable = True\n if exclude_range:\n for i, layer in enumerate(self.model.layers[:exclude_range]):\n layer.trainable = False\n ... | [
"0.7164862",
"0.67806935",
"0.6774033",
"0.6644976",
"0.66006935",
"0.6467279",
"0.641152",
"0.6242765",
"0.6199509",
"0.61263496",
"0.61039317",
"0.61007154",
"0.6037022",
"0.6014011",
"0.6011131",
"0.60053545",
"0.59933645",
"0.5969294",
"0.5949607",
"0.5898639",
"0.589004"... | 0.8383477 | 0 |
Saves predictions to directory. | def pred_dir(self, x, debug = False):
# Create prediction directory
logger.info(f'Create directory: {self.test_pred_path}')
os.makedirs(self.test_pred_path, exist_ok=True)
# Predict on all images in directory
images = os.listdir(self.test_path)
logger.info(f'Pred... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_prediction(predictions, image_file, path):\n\t\n\tsave_file = convert_file_extension_to_txt(image_file)\n\t\n\twith open(os.path.join(path, save_file), 'w') as f:\n\t\tfor prediction in predictions:\n\t\t\tf.write(str(prediction) + \"\\n\")",
"def save_predictions(model, dataset, output_dir):\n preds =... | [
"0.7638945",
"0.7585724",
"0.7561754",
"0.75069606",
"0.74189025",
"0.73354286",
"0.7246706",
"0.72437197",
"0.71777344",
"0.7129415",
"0.71254635",
"0.704427",
"0.7042271",
"0.7006051",
"0.69842076",
"0.6932538",
"0.68563694",
"0.6843282",
"0.6813247",
"0.6792387",
"0.679238... | 0.65779936 | 36 |
Given the name of a file containing jsonencoded data, this function produces the parsed version of the data in the form of a dictionary. | def dictionary_from_json_file(_json_file):
with open(_json_file) as _f:
_dict = json.load(_f)
return _dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_json_file(file_name: str) -> Dict[str, Any]:\n with open(file_name) as file:\n return json.load(file)",
"def json_from_file(name):\n with open(name) as f_p:\n return json.load(f_p)",
"def get_json(filename):\n with open(filename) as f:\n file_content = f.read()\n ... | [
"0.78915036",
"0.77267504",
"0.7374584",
"0.73657656",
"0.7251891",
"0.7238075",
"0.72184515",
"0.7202174",
"0.717965",
"0.7175924",
"0.71577185",
"0.71280855",
"0.71243805",
"0.711873",
"0.7106514",
"0.708711",
"0.7066616",
"0.7065318",
"0.70547426",
"0.7040988",
"0.7029159"... | 0.67751855 | 38 |
Given a _list of items, find the first item matching _item and return it. | def find_first_match(_list, _item):
for _list_item in _list:
if _item["pid"] == _list_item["pid"]:
return _list_item
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findItem(items: Iterable, condition):\n for item in items:\n if condition(item):\n return item",
"def first(items):\r\n return items[0]",
"def get_first_item(checklist):\r\n return checklist['items'][0]",
"def find_first(item, vec):\n for i in range(len(vec)):\n if it... | [
"0.7275993",
"0.72591126",
"0.7228444",
"0.69376737",
"0.69103163",
"0.68174595",
"0.676792",
"0.67332214",
"0.6728107",
"0.67036474",
"0.6661996",
"0.6590008",
"0.65873766",
"0.65691674",
"0.6564417",
"0.65590453",
"0.6532622",
"0.65154046",
"0.64619",
"0.64268464",
"0.64118... | 0.8330334 | 0 |
In the constructor we instantiate two nn.Linear modules and assign them as member variables. | def __init__(self, D_in, H, D_out):
super(SimpleNet, self).__init__()
self.linear1 = torch.nn.Linear(D_in, H)
self.linear2 = torch.nn.Linear(H, D_out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args):\n super(LinearND, self).__init__()\n self.fc = nn.Linear(*args)",
"def __init__(self, linear_args, activation_functions, softmax=False):\n super(NN, self).__init__()\n assert len(activation_functions) == len(linear_args) - 1\n k = len(linear_args)\n ... | [
"0.77401125",
"0.75483596",
"0.75074446",
"0.74346",
"0.7366003",
"0.7335429",
"0.73152226",
"0.7286699",
"0.7273464",
"0.72729063",
"0.72729063",
"0.7268201",
"0.72211164",
"0.72030157",
"0.7167753",
"0.7111596",
"0.7077496",
"0.7065618",
"0.7063983",
"0.7053454",
"0.7018263... | 0.72429734 | 12 |
Creates a portfolio.csv in a temporary folder for the purposes of testing. | def portfolio_csv(tmp_path):
lines = [
('symbol,units,cost\r\n'),
('APPL,100,154.23\r\n'),
('AMZN,600,1223.43\r\n'),
]
filename = tmp_path / 'portfolio.csv'
with open(filename, 'w', newline='') as file:
file.writelines(lines)
return filename | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createFakeCsv():\n \n df = pd.DataFrame([\"a\",\"b\",\"c\"])\n \n df.to_csv(path+'/fakeCSV.csv')\n \n os.rename('fakeCSV.csv','data.csv')",
"def save_csv(companies):\n print(\"Saving companies.csv...\")\n\n Path(\"output\").mkdir(parents=True, exist_ok=True)\n file_name = 'output/c... | [
"0.68402624",
"0.6277342",
"0.6077372",
"0.60722893",
"0.6070713",
"0.6005654",
"0.59951186",
"0.58781207",
"0.58582944",
"0.5818991",
"0.5788376",
"0.57453156",
"0.56600684",
"0.56543875",
"0.5624302",
"0.55937207",
"0.55902326",
"0.5582905",
"0.5578713",
"0.55742604",
"0.55... | 0.7910761 | 0 |
Returns a dictionary containing the default object values. | def get_default_object_values() -> Dict[str, AllowedDefaultValueTypes]:
# TODO(wxy): Cache this as it is accessed many times.
default_object_values: Dict[str, AllowedDefaultValueTypes] = json.loads(
constants.get_package_file_contents(
'extensions', feconf.OBJECT_DEFAULT_VALUES_EXTENSIONS_M... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defaults():\n return {}",
"def defaults() -> dict:\n pass",
"def get_defaults(self):\n default_dict = {}\n args, varargs, keyword, defaults = inspect.getargspec(self.exec_obj)\n if defaults:\n default_dict = dict(zip(args[-len(defaults):], defaults))\n r... | [
"0.82845",
"0.81463146",
"0.77948946",
"0.77923566",
"0.7525667",
"0.7336973",
"0.7329767",
"0.71799356",
"0.7150872",
"0.7110671",
"0.7105723",
"0.7102216",
"0.70912695",
"0.7058654",
"0.7022958",
"0.69993204",
"0.69076955",
"0.6859796",
"0.68507135",
"0.68495923",
"0.682812... | 0.822484 | 1 |
Method that creates app and initialize the app configurations | def create_app(config_name='development'):
app = Flask(__name__,instance_relative_config=True)
app.config.from_object(APP_CONFIG[config_name])
url = app.config.get('DATABASE_URL')
url = app.config.get('DATABASE_URL')
CORS(app, resources={r"/api/*": {"origins": "*"}})
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app(self):\r\n self.app = Flask(__name__, instance_relative_config=True)\r\n\r\n # Init the secret key of the app -it is a must for flask to run\r\n self.app.config.from_mapping(\r\n SECRET_KEY='!ZNeverSayNever116Z!',\r\n MONGODB_SETTINGS= {'host': 'mongodb://l... | [
"0.80386025",
"0.79521924",
"0.79325366",
"0.78654337",
"0.7800479",
"0.7572078",
"0.75341",
"0.75270194",
"0.7513756",
"0.7502849",
"0.749947",
"0.7467094",
"0.7457223",
"0.74485505",
"0.7429212",
"0.74254936",
"0.74204034",
"0.7359046",
"0.7331973",
"0.73210204",
"0.7305016... | 0.7011818 | 54 |
The ip whitelist. See `ip_whitelist` below. Default to creating a whitelist group with the group name "default" and security_ip_list "127.0.0.1". | def ip_whitelists(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['InstanceIpWhitelistArgs']]]]:
return pulumi.get(self, "ip_whitelists") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def whitelist_ips(self):\r\n if self.whitelist == '':\r\n return []\r\n return self.IPFilterList([addr.strip() for addr in self.whitelist.split(',')]) # pylint: disable=no-member\r",
"def ip_whitelists(self) -> pulumi.Output[Sequence['outputs.InstanceIpWhitelist']]:\n return pulu... | [
"0.73237365",
"0.7270454",
"0.6940485",
"0.65657693",
"0.65657693",
"0.6409792",
"0.6382387",
"0.6167399",
"0.6147842",
"0.61446494",
"0.59210384",
"0.5895136",
"0.5882922",
"0.58587646",
"0.57926995",
"0.57664114",
"0.5766037",
"0.57519954",
"0.56909496",
"0.56909496",
"0.56... | 0.7574016 | 0 |
The ID of the enterprise resource group to which the instance belongs. | def resource_group_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "resource_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.g... | [
"0.78312254",
"0.78312254",
"0.78083074",
"0.78083074",
"0.78083074",
"0.78083074",
"0.78083074",
"0.77259177",
"0.7649946",
"0.75031364",
"0.75031364",
"0.75031364",
"0.7498711",
"0.74577105",
"0.73796374",
"0.73736405",
"0.73736405",
"0.73736405",
"0.7360573",
"0.7331301",
... | 0.70340717 | 39 |
The vpc ID of the resource. | def vpc_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "vpc_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self... | [
"0.91380674",
"0.91380674",
"0.91380674",
"0.91380674",
"0.91380674",
"0.91380674",
"0.88352567",
"0.8824307",
"0.8824307",
"0.8824307",
"0.8824307",
"0.8824307",
"0.8824307",
"0.8824307",
"0.8824307",
"0.8824307",
"0.87890935",
"0.8723709",
"0.8695695",
"0.8695695",
"0.86956... | 0.8644934 | 28 |
The zone ID of the instance. | def zone_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "zone_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zon... | [
"0.92218256",
"0.92218256",
"0.92218256",
"0.92218256",
"0.92218256",
"0.889734",
"0.889734",
"0.889734",
"0.889734",
"0.8786313",
"0.87219924",
"0.85782444",
"0.85782444",
"0.8508472",
"0.81542605",
"0.8025494",
"0.80054116",
"0.79546607",
"0.79546607",
"0.79453546",
"0.7938... | 0.8387669 | 14 |
The ip whitelist. See `ip_whitelist` below. Default to creating a whitelist group with the group name "default" and security_ip_list "127.0.0.1". | def ip_whitelists(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['InstanceIpWhitelistArgs']]]]:
return pulumi.get(self, "ip_whitelists") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def whitelist_ips(self):\r\n if self.whitelist == '':\r\n return []\r\n return self.IPFilterList([addr.strip() for addr in self.whitelist.split(',')]) # pylint: disable=no-member\r",
"def ip_whitelists(self) -> pulumi.Output[Sequence['outputs.InstanceIpWhitelist']]:\n return pulu... | [
"0.73237365",
"0.7270454",
"0.6940485",
"0.65657693",
"0.65657693",
"0.6409792",
"0.6382387",
"0.6167399",
"0.6147842",
"0.61446494",
"0.59210384",
"0.5895136",
"0.5882922",
"0.58587646",
"0.57926995",
"0.57664114",
"0.5766037",
"0.57519954",
"0.56909496",
"0.56909496",
"0.56... | 0.7574016 | 1 |
The ID of the enterprise resource group to which the instance belongs. | def resource_group_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "resource_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.g... | [
"0.78312254",
"0.78312254",
"0.78083074",
"0.78083074",
"0.78083074",
"0.78083074",
"0.78083074",
"0.77259177",
"0.7649946",
"0.75031364",
"0.75031364",
"0.75031364",
"0.7498711",
"0.74577105",
"0.73796374",
"0.73736405",
"0.73736405",
"0.73736405",
"0.7360573",
"0.7331301",
... | 0.70340717 | 37 |
The status of the instance. | def status(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "status") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n return self.status",
"def status(self):\n return self.__status",
"def status(self):\n return self.__status",
"def status(self):\n\t\treturn self._status",
"def status(self):\r\n return self._status",
"def status(self):\r\n return self._status",
"de... | [
"0.8780504",
"0.87405765",
"0.87405765",
"0.86862075",
"0.8675898",
"0.8675898",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
... | 0.0 | -1 |
The vpc ID of the resource. | def vpc_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "vpc_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self... | [
"0.91380674",
"0.91380674",
"0.91380674",
"0.91380674",
"0.91380674",
"0.91380674",
"0.88352567",
"0.8824307",
"0.8824307",
"0.8824307",
"0.8824307",
"0.8824307",
"0.8824307",
"0.8824307",
"0.8824307",
"0.8824307",
"0.87890935",
"0.8723709",
"0.8695695",
"0.8695695",
"0.86956... | 0.8644934 | 29 |
The zone ID of the instance. | def zone_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "zone_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zon... | [
"0.92218256",
"0.92218256",
"0.92218256",
"0.92218256",
"0.92218256",
"0.889734",
"0.889734",
"0.889734",
"0.889734",
"0.8786313",
"0.87219924",
"0.85782444",
"0.85782444",
"0.8508472",
"0.81542605",
"0.8025494",
"0.80054116",
"0.79546607",
"0.79546607",
"0.79453546",
"0.7938... | 0.8387669 | 16 |
The ip whitelist. See `ip_whitelist` below. Default to creating a whitelist group with the group name "default" and security_ip_list "127.0.0.1". | def ip_whitelists(self) -> pulumi.Output[Sequence['outputs.InstanceIpWhitelist']]:
return pulumi.get(self, "ip_whitelists") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ip_whitelists(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['InstanceIpWhitelistArgs']]]]:\n return pulumi.get(self, \"ip_whitelists\")",
"def ip_whitelists(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['InstanceIpWhitelistArgs']]]]:\n return pulumi.get(self, \"ip_whitelists\")",
... | [
"0.7574016",
"0.7574016",
"0.73237365",
"0.6940485",
"0.65657693",
"0.65657693",
"0.6409792",
"0.6382387",
"0.6167399",
"0.6147842",
"0.61446494",
"0.59210384",
"0.5895136",
"0.5882922",
"0.58587646",
"0.57926995",
"0.57664114",
"0.5766037",
"0.57519954",
"0.56909496",
"0.569... | 0.7270454 | 3 |
The ID of the enterprise resource group to which the instance belongs. | def resource_group_id(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "resource_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.g... | [
"0.78312254",
"0.78312254",
"0.78083074",
"0.78083074",
"0.78083074",
"0.78083074",
"0.78083074",
"0.77259177",
"0.7649946",
"0.75031364",
"0.75031364",
"0.75031364",
"0.7498711",
"0.74577105",
"0.73796374",
"0.73736405",
"0.73736405",
"0.73736405",
"0.7360573",
"0.7331301",
... | 0.72064835 | 27 |
The status of the instance. | def status(self) -> pulumi.Output[str]:
return pulumi.get(self, "status") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n return self.status",
"def status(self):\n return self.__status",
"def status(self):\n return self.__status",
"def status(self):\n\t\treturn self._status",
"def status(self):\r\n return self._status",
"def status(self):\r\n return self._status",
"de... | [
"0.8780504",
"0.87405765",
"0.87405765",
"0.86862075",
"0.8675898",
"0.8675898",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
"0.8661256",
... | 0.8102846 | 99 |
The vpc ID of the resource. | def vpc_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "vpc_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self... | [
"0.91380674",
"0.91380674",
"0.91380674",
"0.91380674",
"0.91380674",
"0.91380674",
"0.88352567",
"0.87890935",
"0.8723709",
"0.8695695",
"0.8695695",
"0.8695695",
"0.8695695",
"0.8695695",
"0.8695695",
"0.8644934",
"0.8644934",
"0.8644934",
"0.8644934",
"0.8644934",
"0.86449... | 0.8824307 | 10 |
The zone ID of the instance. | def zone_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "zone_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zone_id(self) -> str:\n return pulumi.get(self, \"zone_id\")",
"def zon... | [
"0.92218256",
"0.92218256",
"0.92218256",
"0.92218256",
"0.92218256",
"0.8786313",
"0.87219924",
"0.85782444",
"0.85782444",
"0.8508472",
"0.8387669",
"0.8387669",
"0.8387669",
"0.8387669",
"0.8387669",
"0.8387669",
"0.81542605",
"0.8025494",
"0.80054116",
"0.79546607",
"0.79... | 0.889734 | 6 |
Initialises a new 'DesignLocation' instance. | def __init__(self, spanLength=0.0, status=None, MaterialItems=None, Designs=None, DesignLocationCUs=None, WorkLocations=None, Diagrams=None, MiscCostItems=None, ErpBomItemDatas=None, ConditionFactors=None, *args, **kw_args):
#: The legth of the span from the previous pole to this pole.
self.spanLength =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, location):\n self.location = location",
"def __init__(\n self,\n world,\n anchorage_designator,\n berth_designator,\n path_finder,\n tug_designator=None):\n self.world = world\n self.anchorage_designator = a... | [
"0.62156177",
"0.6187727",
"0.59920037",
"0.59682286",
"0.59652424",
"0.59458023",
"0.58690435",
"0.5705014",
"0.5698086",
"0.56625617",
"0.565988",
"0.5616026",
"0.55443156",
"0.5520438",
"0.5481643",
"0.54716897",
"0.54713726",
"0.54193336",
"0.54182786",
"0.5412955",
"0.54... | 0.560636 | 12 |
Calculates the probability distribution of eating time from the given probability of entrance | def getProbabilityDistribution(probEnter = 0.8):
idealTimer = probEnter * 5
initialProbs = [0.05, 0.05, 0.05, 0.05, 0.05]
for i in range(5):
if idealTimer <= i + 1:
initialProbs[i] = 0.6
if i == 0:
initialProbs[1] = 0.2
initialProbs[2] = 0.1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_probability(energy, new_energy, temperature):\n if new_energy < energy:\n return 1.0\n else:\n return exp(float(energy - new_energy) / temperature)",
"def calculate_probability(self):\n return 0",
"def prob(E1, E2, t):\n return 1 if E1 > E2 else np.exp((E1 - E2) / t)... | [
"0.6576199",
"0.6563601",
"0.6512101",
"0.63409036",
"0.62928426",
"0.6280142",
"0.62578565",
"0.6217531",
"0.6194178",
"0.6026022",
"0.6013073",
"0.60119826",
"0.6006106",
"0.60006666",
"0.5981509",
"0.5956107",
"0.594816",
"0.5940198",
"0.5936049",
"0.5935788",
"0.5899674",... | 0.7103082 | 0 |
Generate a url for the provided host. The ports can be overridden with `LOCAL_PORT` and `LOCAL_PRIME_PORT` environment variables. If `BASE_DOMAIN` is set, that is returned. | def base_url(self, request_host: RequestHost) -> str:
if base_domain := os.getenv("BASE_DOMAIN"):
return base_domain
local_port = os.getenv("LOCAL_PORT", "8080")
local_protocol = "http"
if request_host == RequestHost.PRIME:
local_protocol = "https"
lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _form_base_url(\n self,\n deployed_subdomain: str = \"\",\n local_port: str = \"\",\n local_protocol: str = \"\",\n local_subdomain: str = \"\",\n ) -> str:\n if base_domain := os.getenv(\"BASE_DOMAIN\"):\n return base_domain\n\n if not is_local(en... | [
"0.71644074",
"0.70389444",
"0.7028961",
"0.68531275",
"0.68334365",
"0.6815332",
"0.6773702",
"0.6721116",
"0.666645",
"0.6588413",
"0.65780807",
"0.6577354",
"0.65517247",
"0.65190667",
"0.64845145",
"0.6426308",
"0.6396552",
"0.63881594",
"0.63243836",
"0.63120204",
"0.629... | 0.7286316 | 0 |
Create a new product and initial provisioning artifact (version). Arguments mirror the boto3 "create_product" API call, link below. Returns a Product object | def create(cls, **kwargs):
response = cls.get_client().create_product(**kwargs)
object_details = cls._flatten_object_details(response)
return cls(**object_details) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_product(self):\n product = self.product_obj.create({\n \"default_code\": 'A2330',\n \"product_tmpl_id\":\n self.ref(\"product.product_product_4_product_template\"),\n \"attribute_value_ids\": [(6, 0, [\n self.ref('product.product_attribut... | [
"0.736474",
"0.7065725",
"0.6952491",
"0.6664723",
"0.66583896",
"0.6298567",
"0.6219104",
"0.61484075",
"0.6132532",
"0.6075975",
"0.5992252",
"0.58668363",
"0.58562493",
"0.5805281",
"0.5792189",
"0.5790919",
"0.5752445",
"0.5726109",
"0.57234776",
"0.5683488",
"0.567517",
... | 0.713296 | 1 |
Valida URL, metodo regex | def validaURL(url: AnyStr) -> bool:
return re.compile(patternURL).search(url) != None # Linea 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsValidURL(s):\n return RE_COMPLEX_URL.match(s)",
"def validateURL(url):\n pattern = re.compile(\"^https*:\\/\\/\\w+(\\.\\w+){2}[\\/A-Za-z\\d\\?\\=]*$\")\n match = pattern.match(url)\n\n return True if match else False",
"def validate_url(url):\n\n RE_D = re.compile(r'^(http:\\/\\/www\\.|https... | [
"0.8117477",
"0.78844273",
"0.78397477",
"0.78119373",
"0.7724845",
"0.76031137",
"0.75921714",
"0.7587496",
"0.75508994",
"0.75342757",
"0.75175005",
"0.75038606",
"0.749331",
"0.7491576",
"0.7467064",
"0.7456615",
"0.7450233",
"0.7410004",
"0.74003667",
"0.7387946",
"0.7379... | 0.8143868 | 0 |
Instance name used in requests. | def name(self):
return self._client.project_name + '/instances/' + self.instance_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getname(self):\n if self.instance is not None:\n return '%s_%s' % (self.name,self.instance)\n else:\n return self.name",
"def name(self):\n return self.__name__",
"def name(cls):\n return cls._NAME",
"def name(self):\n return self.__class__.__name_... | [
"0.7964767",
"0.777922",
"0.7740508",
"0.77005327",
"0.77005327",
"0.77005327",
"0.77005327",
"0.77005327",
"0.7662946",
"0.7662946",
"0.7662946",
"0.7662946",
"0.7662946",
"0.7662946",
"0.7662946",
"0.7662946",
"0.7662946",
"0.7662946",
"0.7660712",
"0.76327056",
"0.76055276... | 0.77578276 | 2 |
Get a cartonActivity by id Returns the cartonActivity identified by the specified id. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def get_carton_activity_by_id(self, carton_activity_id, **kwargs):
all_params = ['carton_activity_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_duplicate_carton_activity_by_id(self, carton_activity_id, **kwargs):\n\n all_params = ['carton_activity_id']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_params:\n raise TypeErr... | [
"0.6449085",
"0.6341287",
"0.63101023",
"0.5809725",
"0.5605849",
"0.559797",
"0.5246748",
"0.5207538",
"0.52007586",
"0.51091886",
"0.50567985",
"0.50264806",
"0.50061727",
"0.49880445",
"0.49682713",
"0.49606812",
"0.4948862",
"0.48991984",
"0.48133543",
"0.47327924",
"0.47... | 0.7842999 | 0 |
Get a duplicated a cartonActivity by id Returns a duplicated cartonActivity identified by the specified id. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def get_duplicate_carton_activity_by_id(self, carton_activity_id, **kwargs):
all_params = ['carton_activity_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_carton_activity_by_id(self, carton_activity_id, **kwargs):\n\n all_params = ['carton_activity_id']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_params:\n raise TypeError(\n ... | [
"0.68601924",
"0.59325856",
"0.57145596",
"0.5497775",
"0.5472108",
"0.54584974",
"0.5320074",
"0.5269935",
"0.50570655",
"0.48682854",
"0.48382714",
"0.47813615",
"0.47610122",
"0.47371498",
"0.47237444",
"0.4635629",
"0.45927307",
"0.45755008",
"0.45652983",
"0.45400804",
"... | 0.8400414 | 0 |
Constructor for a cell object. Sets all the data fields of the cell. | def __init__(self, color=EMPTY, strength=EMPTY, type=EMPTY,
resources=0, isdisabled=False, adjacent=[]):
self.color = color
self.strength = strength
self.type = type
self.resources = resources
self.disabled = isdisabled
self.adjacent = adjacen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(MultiDataCell, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.base is None:\n self.base = rwrc12_msgs.msg.CellBase()\n if self.mean_height is None:\n ... | [
"0.7343175",
"0.7333126",
"0.72750616",
"0.7174793",
"0.7089391",
"0.70122397",
"0.6942089",
"0.6847884",
"0.6797651",
"0.6795209",
"0.66801435",
"0.664611",
"0.6629316",
"0.6550755",
"0.6532622",
"0.65313005",
"0.6491286",
"0.645086",
"0.64449245",
"0.638815",
"0.6360006",
... | 0.0 | -1 |
Return the max sequence length of this tokenizer. | def max_sequence_length(self) -> int:
return self._max_request_length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_length(self) -> int | None:\n return self._underlying.max_length",
"def max_length(self):\n\t\treturn self._max_length",
"def _max_length(self):\n return self.__max_length",
"def max_request_length(self) -> int:\n return self.max_sequence_length",
"def get_length_of_longest_sen... | [
"0.79248345",
"0.7814715",
"0.7710857",
"0.76122516",
"0.7540627",
"0.74956506",
"0.7342764",
"0.7237697",
"0.71165454",
"0.70737785",
"0.6990284",
"0.68691313",
"0.6851906",
"0.6830742",
"0.68259156",
"0.67945015",
"0.6794275",
"0.67336994",
"0.67235285",
"0.6708446",
"0.669... | 0.7911943 | 1 |
Return the max request length of this tokenizer. | def max_request_length(self) -> int:
return self.max_sequence_length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_sequence_length(self) -> int:\n return self._max_request_length",
"def max_length(self):\n\t\treturn self._max_length",
"def _max_length(self):\n return self.__max_length",
"def max_length(self) -> int | None:\n return self._underlying.max_length",
"def maxsize(self):\r\n ... | [
"0.8040181",
"0.80028194",
"0.7908217",
"0.78137726",
"0.74633443",
"0.7395531",
"0.73337406",
"0.7236661",
"0.70824194",
"0.6937923",
"0.6824151",
"0.6814213",
"0.6814213",
"0.6808442",
"0.6740837",
"0.67247903",
"0.67175454",
"0.6702094",
"0.66950095",
"0.66950095",
"0.6653... | 0.84071106 | 0 |
Change directional facing of an Entity | def rotate(self, rotate: int):
results = ['{} rotates to {}'.format(self.owner.name, 'port' if rotate == 1 else 'starboard')]
self.direction += rotate
if self.direction > len(hex_directions) - 1:
self.direction -= len(hex_directions)
elif self.direction < 0:
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Move180(self):\n if self.facing == 0:\n self.facing = 1\n self.x -= self.stepLeft\n elif self.facing == 1:\n self.facing = 2\n self.y -= self.stepUp\n elif self.facing == 2:\n self.facing = 3\n self.x += self.stepRight\n ... | [
"0.64898735",
"0.6375714",
"0.6309972",
"0.6302147",
"0.6270844",
"0.6245138",
"0.62083113",
"0.62025565",
"0.6173657",
"0.6145803",
"0.6137126",
"0.61226654",
"0.61149645",
"0.60945034",
"0.60304964",
"0.60276514",
"0.6026606",
"0.60117924",
"0.60030496",
"0.5985695",
"0.594... | 0.0 | -1 |
Modify current momentum of an Entity, and speed if necessary | def increase_momentum(self, amount: int, reason: str):
results = []
if reason == 'wind':
if self.current_momentum + amount > self.max_momentum and self.current_speed == self.max_speed:
if self.current_momentum == self.max_momentum:
results.append('{} maint... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def momentum (self):\n\n for planet in self.planets: #this loop takes a 'planet' from 'self.planets' and computes it linear momentum.\n planet.momentum = planet.mass * planet.velocity #Each body's resulting momentum is updated to the body's information defined in the Particle class.",
"def _mom... | [
"0.71070635",
"0.6270519",
"0.6267392",
"0.6231631",
"0.6212865",
"0.61981815",
"0.6109029",
"0.6059501",
"0.6014431",
"0.6014431",
"0.5993286",
"0.59860796",
"0.59657675",
"0.59537256",
"0.59334445",
"0.58792734",
"0.58770907",
"0.5875825",
"0.5824157",
"0.5794347",
"0.57941... | 0.0 | -1 |
Decrease current momentum of an Entity, and speed if necessary | def decrease_momentum(self, amount: int, reason: str):
results = []
if self.current_speed == 0:
if self.current_momentum == 0:
results.append('{} remains stopped'.format(self.owner.name))
elif self.current_momentum + amount <= 0:
self.current_momen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decelerate(self):\n\t\tself.velocity -= self.direction * self.ACCELERATION",
"def reduce_velocity(self):\n if self.controls[\"make_velocity_0\"]:\n # print(self.controls[\"bar_move_velocity\"])\n self.controls[\"bar_move_velocity\"] = 0",
"def decelerate(self):\n self.de... | [
"0.65940326",
"0.6341812",
"0.6082125",
"0.5913043",
"0.586042",
"0.584528",
"0.57583815",
"0.57502013",
"0.57502013",
"0.5707604",
"0.56735307",
"0.56729066",
"0.566998",
"0.56367683",
"0.55974346",
"0.55597836",
"0.55509937",
"0.55164105",
"0.5505747",
"0.55039895",
"0.5501... | 0.5640013 | 13 |
Fits the data assuming a normal distributions, returns mean and standard deviation | def gauss_fit(seld, data=''):
mean, std = norm.fit(data)
return mean, std | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_mean_std(self, data):\n if self._data_mean is None:\n self._data_mean = np.mean(data)\n if self._data_std is None:\n self._data_std = np.std(data)",
"def MeanAndStandardDeviation(data):\n n = len(data)\n if n == 0:\n return 0.0, 0.0\n mean = float(sum(data)) / n\n variance = sum([... | [
"0.6888555",
"0.68504137",
"0.6841606",
"0.6830163",
"0.6830163",
"0.68180627",
"0.6798879",
"0.6758738",
"0.67473656",
"0.6739367",
"0.6725009",
"0.6633292",
"0.6610731",
"0.6590639",
"0.6556199",
"0.6534529",
"0.6516616",
"0.6500733",
"0.6474724",
"0.64506733",
"0.643497",
... | 0.69635624 | 0 |
Basic plot for the correlation matrix | def cov_plot(self, matrix, station="", hour = "", date="" , averaged = "" ):
var = self.var_dics[self.var]['name']
fig,ax = plt.subplots()
date = self.date_prettyfier(date)
hour = str(hour).replace('0','00:00').replace('1','12:00')
if not averaged:
title ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_corr_matrix(df):\n f = plt.figure(figsize=(19, 15))\n plt.matshow(df.corr().abs(), fignum=f.number)\n cb = plt.colorbar()\n cb.ax.tick_params(labelsize=14)\n plt.title('Correlation Matrix', fontsize=16)",
"def plot_correlations(data):\n\n from matplotlib import cm\n \n cols = dat... | [
"0.79154086",
"0.77664775",
"0.7750305",
"0.7675488",
"0.7613529",
"0.75462157",
"0.7459015",
"0.7311571",
"0.72865146",
"0.72843164",
"0.71771485",
"0.7089244",
"0.6951926",
"0.69473094",
"0.6944293",
"0.69327813",
"0.6905935",
"0.6860756",
"0.6845102",
"0.6795315",
"0.67673... | 0.0 | -1 |
Used to delete the document. This method will return a folder object of the parent folder that this document resided in. Once the document has been deleted it will be added to this documents graveyard. This graveyard is used to restore the deleted document. If you delete this document it will set metadata.deleted to tr... | def delete(self):
documentUrl = self.metaData.getLink("delete")
assert documentUrl is not None
response = self._adapter.deleteRequest(documentUrl, self._baseHeader)
self.metaData.graveyard.append(self.metaData)
return Folder(self._client, self._client.getUrlFromHeaderLink(respo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_document(self):\n pass",
"def delete_document(self, document):\n assert isinstance(document, pylastica.document.Document), \"document must be a Document object: %r\" % document\n options = document.get_options([\n 'version',\n 'version_type',\n 'ro... | [
"0.6484638",
"0.61606187",
"0.60621583",
"0.6035355",
"0.5832543",
"0.5816837",
"0.57378757",
"0.57177037",
"0.57134974",
"0.5706775",
"0.57032114",
"0.56466174",
"0.5635844",
"0.56301296",
"0.5602695",
"0.55812174",
"0.5522459",
"0.5512628",
"0.5492893",
"0.54907286",
"0.545... | 0.74119663 | 0 |
Copies this document to target folder. This method returns a Document Object of the new copied document. | def copyTo(self, folder):
copyUrl = self.metaData.getLink("copy")
if not hasattr(folder, "metaData"): raise TypeError("Your newFolder does not have a metaData property")
assert getattr(folder, "selfLink")
assert copyUrl is not None
header = self._baseHeader.copy()
heade... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copyDoc(self, recursive):\n ret = libxml2mod.xmlCopyDoc(self._o, recursive)\n if ret is None:raise treeError('xmlCopyDoc() failed')\n __tmp = xmlDoc(_obj=ret)\n return __tmp",
"def copydoc(self, doc):\n dst = os.path.join(self.path, os.path.split(doc)[1])\n if not se... | [
"0.71349126",
"0.6750404",
"0.6204421",
"0.6086825",
"0.60836196",
"0.6018448",
"0.6002959",
"0.5863096",
"0.5853461",
"0.5714051",
"0.56894773",
"0.5596433",
"0.5568087",
"0.54949385",
"0.54816085",
"0.5456911",
"0.5450843",
"0.54444283",
"0.54300004",
"0.53996104",
"0.53740... | 0.7200869 | 0 |
Convert the keys of the provided dict to be strings. This is especially useful for converting request.json's keys to be regular strings instead of unicode strings so that they can be unpacked as kwargs to functions. | def dict_keys_to_strings(d):
return dict((str(k), v) for (k, v) in d.iteritems()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_keys_into_str(d):\n return { str(k) : v for k,v in d.items() }",
"def keys2string(dictionary):\r\n if not isinstance(dictionary, dict):\r\n return dictionary\r\n return dict((str(k), keys2string(v)) \r\n for k, v in dictionary.items())",
"def convert_keys_to_string(dictionary):\... | [
"0.7738258",
"0.74790674",
"0.7407543",
"0.66171986",
"0.657311",
"0.6526981",
"0.64679486",
"0.64286405",
"0.63769287",
"0.63346267",
"0.62446123",
"0.61347187",
"0.61008525",
"0.610081",
"0.60992754",
"0.6097047",
"0.605571",
"0.6052076",
"0.60330236",
"0.60317963",
"0.5922... | 0.72731286 | 3 |
Set the P_source for the single source constraint | def _set_p_source(self, p_source, p_rec_div=1):
self.p_source = p_source
self.p_S_fin = (1-p_source)*self.p_sus
self.p_rec_div = p_rec_div
self.p_infect_fin = (1-p_source)* (1-self.p_sus)
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_source(self, source):\n self.data['source'] = source",
"def set_flow_source(self, source):\n self._source = source",
"def _set_source(self, source):\n if source != self._source:\n self._source = source\n self._channel = \"\"\n self._channel_name = \... | [
"0.7000559",
"0.6853645",
"0.684918",
"0.67619085",
"0.6555328",
"0.6456665",
"0.64430463",
"0.64430463",
"0.64430463",
"0.64430463",
"0.64430463",
"0.64430463",
"0.64430463",
"0.6427387",
"0.6293089",
"0.62723905",
"0.6253527",
"0.6253527",
"0.61970097",
"0.6196628",
"0.6192... | 0.71566385 | 0 |
Returns value of the cell given row and column numbers | def test_get_cell(workbook):
assert workbook.get_cell(3,1) == '507906000030242007' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cell_value(self, index):\n x, y = index\n return self.grid[y][x]",
"def cellval(row, col):\n key = 'R'+str(row)+'C'+str(col)\n if key not in DATA:\n return None\n return DATA[key]",
"def getCellValue_quick(self, row, column):\n\n\t\t\t\treturn self.thing[f\"{column}{row}\"].value",
... | [
"0.7972438",
"0.78804326",
"0.77991784",
"0.75706124",
"0.7519673",
"0.74999386",
"0.7389128",
"0.7327831",
"0.73212254",
"0.73080796",
"0.7280648",
"0.7222837",
"0.72176254",
"0.71306735",
"0.71249366",
"0.71046156",
"0.7066568",
"0.7001175",
"0.7001175",
"0.7001175",
"0.699... | 0.0 | -1 |
Creates a MainWindow with a BrowserTabWidget. | def create_main_window_with_browser():
main_win = create_main_window()
return main_win.add_browser_tab() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, parent):\n self.widget = _QMainWindow(parent)",
"def createWindow(self, type):\n # this = Browser(self.url())\n # this.show()\n\n self.popup = SequanixQWebView(**self.kwargs)\n self.popup.setObjectName(\"web_content\")\n self.popup.setWindowTitle(\"Sequa... | [
"0.68949765",
"0.6478098",
"0.6435696",
"0.6413921",
"0.62903494",
"0.62232417",
"0.6180552",
"0.6119633",
"0.61178416",
"0.6103711",
"0.60432786",
"0.60425925",
"0.59410733",
"0.59396756",
"0.5931825",
"0.59298074",
"0.58862966",
"0.5838804",
"0.5838804",
"0.58258635",
"0.58... | 0.7908725 | 0 |
Get all comments for question/answer | def get_comments(self, post_id, post_type):
try:
if not post_id or not post_type:
raise Exception('Invalid parameter')
if post_type != 'question' and post_type != 'answer':
raise Exception('Invalid parameter')
url = BASE_URL + 'post_comments/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_comments(self):\n\t\treturn self._client.get_comments(self)",
"def test_get_comments():\n comments = list(get_comments(TEST_SUBREDDIT, TEST_START_DATE, TEST_END_DATE, TEST_MAX))\n\n # prints the dictionary of variables for each comment\n for x in comments:\n print(x.d_)",
"def get_cohor... | [
"0.6908075",
"0.67552567",
"0.6731923",
"0.6726415",
"0.6710735",
"0.6640058",
"0.65884966",
"0.65884966",
"0.65884966",
"0.6576658",
"0.656862",
"0.65647495",
"0.650255",
"0.6494908",
"0.6490332",
"0.64667314",
"0.6454418",
"0.64249283",
"0.6418719",
"0.64166176",
"0.6405647... | 0.61194545 | 39 |
an im2col function, transferring an image to patches of size window (length 2 list). the step size is the stride of the sliding window. | def im2col(A, window, stepsize=1):
return viewW(np.ascontiguousarray(A), (window[0], window[1])).reshape(-1,
window[0] * window[1]).T[:, ::stepsize] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unfold(input, kernel_size, dilation=1, padding=0, stride=1):\n nd_util = utils._ntuple(input.ndimension() - 2)\n out = FunctionLib.apply(\n 'Im2Col',\n input.device,\n [input],\n kernel_shape=nd_util(kernel_size),\n strides=nd_util(stride),\n pads=nd_util(padding... | [
"0.6645364",
"0.6491519",
"0.62999904",
"0.60910404",
"0.604907",
"0.58832616",
"0.5740589",
"0.5653002",
"0.5623746",
"0.5609291",
"0.55689853",
"0.55332327",
"0.5455916",
"0.5418624",
"0.5417081",
"0.5379944",
"0.5376328",
"0.53699076",
"0.53666115",
"0.5354386",
"0.5336",
... | 0.71692234 | 0 |
Predict response for given x based on fitted coefficients. | def predict(self, x: np.ndarray):
return self.fit_function(x, self.coefficients) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(self, x):\n \"\"\"containing values for the independent variables.\"\"\"\n _linear_predictor_typecheck(x, self._coeff)\n return dot(self._coeff, x) + self._intercept",
"def predict(self, x):\n if(self.__trained == False):\n raise ModelNotTrainedException(self.pr... | [
"0.81227326",
"0.79453236",
"0.7797504",
"0.76598966",
"0.7611417",
"0.75813264",
"0.74996483",
"0.74753344",
"0.74670166",
"0.7459472",
"0.7450515",
"0.744085",
"0.74362046",
"0.7429248",
"0.7394951",
"0.7328513",
"0.73182887",
"0.7303986",
"0.7303986",
"0.7303986",
"0.73039... | 0.8447172 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.