query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
return a list of action
def get_legal_actions(self, index): actions = [] agent = self.agent_states[index] for action in ACTIONS: pos = agent.pos[0] + action[0], agent.pos[1] + action[1] if MAP[pos[0]][pos[1]] not in WALL: actions.append(action) return actions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_actions(self):\n return []", "def get_list_of_actions(self):\n return self.actions", "def actions(self):\n return self._action_list", "def actions(self, request, action_list, group):\n return action_list", "def actions(self, state):\n myActionList= (1,2);\n ...
[ "0.8450859", "0.8234837", "0.82166684", "0.81895244", "0.8085559", "0.7998739", "0.76120627", "0.76120627", "0.76120627", "0.76084036", "0.75976473", "0.7583569", "0.7500404", "0.7491602", "0.7481807", "0.7443471", "0.74418193", "0.7439532", "0.7439532", "0.73826504", "0.7340...
0.6413894
92
Returns true if ``node`` is part of the assignment at ``assignment_node``. Normally this is just a simple identity check, except for imports where the assignment is attached to the entire import statement but we are interested in ``Name`` nodes inside the statement.
def _is_assignment(node: cst.CSTNode, assignment_node: cst.CSTNode) -> bool: if node is assignment_node: return True if isinstance(assignment_node, (cst.Import, cst.ImportFrom)): aliases = assignment_node.names if isinstance(aliases, cst.ImportStar): return False for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isAssignment(self):\n return _libsbml.Rule_isAssignment(self)", "def is_assign_to_name(statement):\n return isinstance(statement, ast.Assign) and \\\n len(statement.targets) == 1 and \\\n isinstance(statement.targets[0], ast.Name)", "def is_assignment(*args):\n return _ida_he...
[ "0.62317604", "0.60697824", "0.5954752", "0.5715725", "0.55724084", "0.55121505", "0.5378449", "0.5343535", "0.53163487", "0.5311576", "0.53089356", "0.52855116", "0.5275552", "0.5273492", "0.52600914", "0.52340776", "0.520116", "0.51995283", "0.5169611", "0.5149941", "0.5117...
0.836117
0
returns True if the list is sorted by Course Number, False otherwise
def is_sorted(self): cur_list = [] cur_node = self.head while cur_node is not None: cur_list.append(cur_node.data.number()) cur_node = cur_node.next if cur_list == sorted(cur_list): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_sorted_list(list_):\n prev = -1\n for item in list_:\n if item < prev:\n return False\n prev = item\n return True", "def is_sorted(l: list):\n for idx, num in enumerate(l):\n if idx is 0:\n continue\n elif l[idx-1] <= num:\n continu...
[ "0.64845145", "0.63505226", "0.6258908", "0.6216176", "0.6167742", "0.610778", "0.6065763", "0.60476375", "0.60458887", "0.5988047", "0.5985882", "0.59754354", "0.59156555", "0.5914994", "0.58944833", "0.5874584", "0.5858344", "0.58307153", "0.57908547", "0.57533205", "0.5724...
0.6650408
0
Returns a xapian index document from the context. Introspecting the connection provides the relevant fields available.
def document(self, connection): doc = xappy.UnprocessedDocument() for iface in providedBy(self.context): for field in schema.getFields(iface).values(): if not isinstance(field, (schema.Text, schema.ASCII)): continue value = field.query(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_index(self, uid: str) -> Index:\n return Index(self.config, uid).fetch_info()", "def as_search_document(self, index='_all'):\n raise NotImplementedError(\n \"{} does not implement 'get_search_document'.\".format(self.__class__.__name__)\n )", "def document_indexer(self):...
[ "0.6285873", "0.58124757", "0.57936424", "0.5732638", "0.56942385", "0.56683356", "0.5626097", "0.5600954", "0.55877274", "0.55677587", "0.5518595", "0.5501073", "0.54690313", "0.54614365", "0.54614365", "0.5457262", "0.5432552", "0.5432552", "0.5432552", "0.5432552", "0.5432...
0.60662013
1
Convert xml data to dictionary format and then dump to YAML format
def convert(): d = request.get_json() return xmltodict.unparse(d), 201
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_yaml(cls, dumper, data):\n m = {k: getattr(data, k) for k in cls._yaml_keys}\n return dumper.represent_mapping(cls.yaml_tag, m)", "def _yaml_dump(data):\n return yaml.dump(data, Dumper=_OrderedDumper, allow_unicode=True)", "def to_yaml(cls, dumper, data):\n yamlData = data._yamlData\...
[ "0.6744567", "0.67335916", "0.67086184", "0.6697154", "0.66911316", "0.64298695", "0.6406907", "0.63319504", "0.62797713", "0.6212044", "0.61582947", "0.6156358", "0.60948706", "0.6090281", "0.6081702", "0.6049612", "0.60190135", "0.5992448", "0.5922469", "0.5922469", "0.5901...
0.0
-1
Get the mode of a categorical and cast to onehot.
def one_hot_categorical_mode(logits): dist = tfd.Categorical(logits) return tf.cast(tf.one_hot(dist.mode(), dist.event_size), tf.float32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_categorical(x, n_col=None):\n if not n_col:\n n_col = np.amax(x) + 1\n one_hot = np.zeros((x.shape[0], n_col))\n one_hot[np.arange(x.shape[0]), x] = 1\n return one_hot", "def to_categorical(target: np.ndarray, n_classes: int = None) -> np.ndarray:\n\tn_classes = n_classes if n_classes i...
[ "0.7203805", "0.7131759", "0.69734716", "0.69353926", "0.6869692", "0.68215334", "0.6793382", "0.6789208", "0.67846286", "0.67513657", "0.67081213", "0.66956395", "0.6684978", "0.6679585", "0.6672036", "0.6661204", "0.6650561", "0.66481876", "0.66481876", "0.66481876", "0.664...
0.77782106
0
Calculate the Intersection over Union (IoU) of two 3D cuboid.
def get_iou_cuboid(cu1, cu2): polygon_1 = Polygon([(cu1[0][0], cu1[0][1]), (cu1[1][0], cu1[1][1]), (cu1[2][0], cu1[2][1]), (cu1[3][0], cu1[3][1])]) polygon_2 = Polygon([(cu2[0][0], cu2[0][1]), (cu2[1][0], cu2[1][1]), (cu2[2][0], cu2[2][1]), (cu2[3][0], cu2[3][1])]) intersect_2d = polygon_1.intersection(poly...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iou(box1, box2):\n\n # get the area of intersection\n xi1 = max(box1[0], box2[0])\n yi1 = max(box1[1], box2[1])\n xi2 = min(box1[2], box2[2])\n yi2 = min(box1[3], box2[3])\n\n inter_area = max(xi2 - xi1, 0) * max(yi2 - yi1, 0)\n\n # get the area of union\n box1_area = (box1[2] - box1[0]...
[ "0.7375083", "0.7367214", "0.7329424", "0.73293835", "0.72443515", "0.720159", "0.7189095", "0.7150982", "0.7133373", "0.7124295", "0.71049947", "0.70893395", "0.7072737", "0.70175004", "0.7010003", "0.69688714", "0.6898972", "0.68825495", "0.68825495", "0.6801109", "0.677942...
0.7078131
12
helper method which takes string of YYYYMMDD format, removes dashes so relative times can be compared for plotting also removes day, so we have data split by months
def _get_time(string): string = string[0:7] # Drop day return string.replace("-", "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __split_date(self, date: str) -> list:\n parts = date.split(\"-\")\n return parts", "def split_fr_date(date_str):\n day=date_str[:2]\n month=date_str[3:5]\n try:\n #date coded on 4 digits\n year=date_str[6:]\n except:\n #date coded on 2 digits\n year=date...
[ "0.6509203", "0.6450229", "0.63128257", "0.6183876", "0.61488855", "0.6123659", "0.61123264", "0.6107795", "0.6102867", "0.60900676", "0.60900676", "0.6022365", "0.6020689", "0.5960389", "0.5958182", "0.5947044", "0.5892996", "0.5842276", "0.5841609", "0.5835138", "0.58316123...
0.0
-1
Removes base classes. If there are no more base classes, returns the original class slotted at bases[0]
def remove_base_class(x, cls): bases = list(x.__class__.__bases__) original_class = bases[0] other_classes = bases[1:] if cls in other_classes: other_classes.remove(cls) else: raise PermitError("Class {0} not in list of base classes {1}".format(cls, bases)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mro(cls): # pragma: no cover\n if hasattr(cls, 'mro'):\n return cls.__mro__\n\n def _mro(cls):\n m = [cls]\n for base in cls.__bases__:\n m += _mro(base)\n return m\n\n mro_list = _mro(cls)\n\n # If a class appears multiple times (due to multiple inheritance)...
[ "0.6278506", "0.5917506", "0.5868634", "0.5854781", "0.58289456", "0.5770308", "0.57575125", "0.5735956", "0.5680516", "0.5679301", "0.56645495", "0.56414235", "0.55493724", "0.55452394", "0.553261", "0.55212045", "0.54923844", "0.5323664", "0.5301268", "0.5242089", "0.513890...
0.74186534
0
Return the name of the sensor.
def name(self): return f"{self._name} {self._sensor_name}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._sensor.name", "def get_sensor_name(self):\n return self.data[1]", "def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'", "def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso...
[ "0.91896784", "0.9168378", "0.890185", "0.8770976", "0.8479953", "0.844435", "0.8299758", "0.8186503", "0.8105667", "0.8079737", "0.8066149", "0.8049647", "0.7700968", "0.7612295", "0.7611456", "0.7600605", "0.7600605", "0.7600605", "0.75392073", "0.75166553", "0.7467876", ...
0.8511273
4
Return a unique_id for this entity.
def unique_id(self): return self._unique_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_id(self):\n return self._id", "def unique_id(self):\n return self._id", "def unique_id(self):\n return self._uuid", "def unique_id(self):\n return self._uuid", "def unique_id(self) -> str:\n return self._unique_id", "def unique_id(self) -> str:\n retur...
[ "0.83266777", "0.83266777", "0.8272739", "0.8272739", "0.8237578", "0.8237578", "0.8237578", "0.8237578", "0.8237578", "0.8237578", "0.8237578", "0.8237578", "0.8169528", "0.8161978", "0.81421477", "0.8113556", "0.8113556", "0.8113556", "0.8000785", "0.79811245", "0.78985703"...
0.8211608
26
Return the unit of measurement of this entity, if any.
def unit_of_measurement(self): return self._unit_of_measurement
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit_of_measurement(self):\n return self._metadata[1]", "def unit_of_measurement(self):\n return self._unit", "def unit_of_measurement(self):\n return self._unit", "def unit_of_measurement(self):\n return self._unit", "def unit_of_measurement(self):\n return self._uni...
[ "0.8565862", "0.8477338", "0.8477338", "0.8477338", "0.8477338", "0.8477338", "0.8477338", "0.8477338", "0.8473674", "0.843327", "0.83701795", "0.8368336", "0.8334028", "0.82777756", "0.8239642", "0.82141906", "0.8204512", "0.8196942", "0.81599694", "0.8150877", "0.81474745",...
0.845385
17
Return the state attributes.
def device_state_attributes(self): return {ATTR_ATTRIBUTION: ATTRIBUTION}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_attributes(self):\n return self._attributes", "def state_attributes(self):\n return self._attributes", "def device_state_attributes(self):\r\n return self.attributes", "def device_state_attributes(self):\n return self._state_attrs", "def device_state_attributes(self):\...
[ "0.8953404", "0.8953404", "0.85239846", "0.8366765", "0.8366765", "0.8363429", "0.83362615", "0.8334551", "0.8310377", "0.8292682", "0.8289349", "0.8289349", "0.82871646", "0.82871646", "0.82871646", "0.82871646", "0.82871646", "0.82871646", "0.82871646", "0.82871646", "0.828...
0.7716202
45
returning all elements names from ``MedicationKnowledgeDefinitionalIngredient`` according specification, with preserving original sequence order.
def elements_sequence(cls): return [ "id", "extension", "modifierExtension", "item", "type", "strengthRatio", "strengthCodeableConcept", "strengthQuantity", ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elements_sequence(cls):\n return [\n \"id\",\n \"extension\",\n \"modifierExtension\",\n \"definition\",\n \"doseForm\",\n \"intendedRoute\",\n \"ingredient\",\n \"drugCharacteristic\",\n ]", "def getIngredi...
[ "0.5976165", "0.55639905", "0.55079573", "0.5450941", "0.53593826", "0.5334777", "0.5299364", "0.5248993", "0.52192104", "0.5186041", "0.5174125", "0.5148762", "0.513972", "0.5123322", "0.5119534", "0.5104124", "0.5088404", "0.5083376", "0.5053056", "0.5050514", "0.50288296",...
0.50372595
20
Generate all 2^n 2 incomparable hyperboxes.
def subdivide(self, rec2, drop_fb=True): n = self.dim if n <= 1: return elif drop_fb: indicies = range(1, 2**n - 1) else: indicies = range(0, 2**n) lo, hi = rec2.bot, rec2.top forward, backward = self.forward_cone(lo), self.backward_con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generatePrimesFrom2(n):\n sieve = bytearray([True]) * (n//2+1)\n for i in range(1,int(n**0.5)//2+1):\n if sieve[i]:\n sieve[2*i*(i+1)::2*i+1] = bytearray((n//2-2*i*(i+1))//(2*i+1)+1)\n return [2, *compress(range(3,n,2), sieve[1:])]", "def binary_compositions(n):...
[ "0.6057566", "0.58849967", "0.5860545", "0.5799387", "0.56275123", "0.55537844", "0.5545516", "0.54802513", "0.5474842", "0.54712147", "0.54540414", "0.53835243", "0.5363728", "0.53585577", "0.5345846", "0.53421885", "0.532909", "0.5286306", "0.5243055", "0.519788", "0.518845...
0.0
-1
Get token from Vault.
def get_token(): global vault_token global vault_token_time current_app.logger.info('************* GET TOKEN METHOD **************') return 'root' if validate_token(): vault_duration = None try: auth_type = current_app.config.get('VAULT_AUTH', 'TOKEN') current...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def token(request: Request):\n return get_token()", "def get_token():\n params = {'get_token': 'get_token'}\n return load_page(API, params=params, headers={'content-type': 'application/json'})['token']", "def get(uid: int, token_id: int):\n\n token = Token.get(uid, token_id).as_dto().to_p...
[ "0.7275925", "0.7074497", "0.7003901", "0.68835914", "0.6838572", "0.68307024", "0.676279", "0.67362076", "0.6676773", "0.666665", "0.66557", "0.6624486", "0.6624486", "0.65986884", "0.65986884", "0.65986884", "0.65887886", "0.65849286", "0.6560688", "0.6560688", "0.6544694",...
0.80251646
0
Generate GCP JWT for Vault authentication.
def _generate_gcp_jwt(): role = current_app.config.get('VAULT_AUTH_ROLE') account = current_app.config.get('VAULT_AUTH_ACCOUNT') if role and account: headers = {'Metadata-Flavor': 'Google'} url = 'http://metadata/computeMetadata/v1/instance/service-accounts/' + account + '/identity' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_jwt_token(self):\n payload = jwt_payload_handler(self)\n token = jwt_encode_handler(payload)\n return token", "def _generate_jwt_token(self):\n import jwt\n from datetime import datetime, timedelta\n from django.conf import settings\n\n dt = datetime...
[ "0.6614784", "0.6614367", "0.65258294", "0.6461658", "0.64035386", "0.6360927", "0.63380235", "0.6322474", "0.62901527", "0.6256548", "0.6229225", "0.6217421", "0.61592877", "0.6156592", "0.614825", "0.6128425", "0.60756314", "0.60685194", "0.6028773", "0.60129017", "0.599216...
0.8443291
0
Returns a dictionary with a table>engine mapping. This is suitable for use of sessionmaker(binds=db.get_binds(app)). Increase the cache for table > engine mapping bind_key is the bind mapping name,default None, that is SQLALCHEMY_DATABASE_URI
def get_binds(self, app=None): bind_name = g.bind_key if self.is_binds and getattr(g, "bind_key", None) else None if not _lru_cache.get(bind_name): _lru_cache[bind_name] = super().get_binds(app) return _lru_cache[bind_name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_urn_table_mappings(engine):\n mappings = {}\n try:\n logger.debug(f'cached_urn_mappings: {cached_urn_mappings}')\n # check in to see if already have service_urn values\n if cached_urn_mappings == {}:\n result = None\n metadata = MetaData(bind=engine, schema=...
[ "0.6652193", "0.6480723", "0.6126096", "0.6016538", "0.5984937", "0.59512275", "0.58430433", "0.5815465", "0.57546353", "0.5747746", "0.5682871", "0.5662358", "0.55900586", "0.5579647", "0.55600846", "0.55587626", "0.55313677", "0.5527422", "0.55101806", "0.5495946", "0.54628...
0.5051345
65
Resolve a filename relative to this directory
def resolve(self, name): # pylint: disable = E1101 root = _os.path.normpath('/') resolved = _os.path.splitdrive(_os.path.normpath( _os.path.join(root, unicode(name).encode('utf-8')) ))[1] while resolved.startswith(root): resolved = resolved[1:] re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve(fname):\n if os.path.dirname(__file__):\n return os.path.dirname(__file__) + \"/../common/\" + fname\n else:\n return \"/common/\" + fname", "def rel_filename(filename, relative_to=None):\n if relative_to is None:\n relative_to = os.getcwd()\n if not relative_to.endsw...
[ "0.7362332", "0.6747728", "0.6739235", "0.65846235", "0.656219", "0.65612847", "0.65566796", "0.6551496", "0.65442425", "0.65062994", "0.65059465", "0.6505097", "0.6504365", "0.6454143", "0.6390446", "0.6387397", "0.6368316", "0.632986", "0.631312", "0.6308752", "0.62896514",...
0.72245663
1
Sets the project of this ProblemScope.
def project(self, project): self._project = project
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project(self, project):\n self._project = project", "def project(self, project):\n self._project = project", "def scope_project(self, project_key):\n self.raw['scope'] = 'PROJECT'\n self.raw['projectKey'] = project_key\n return self", "def set_project(self, version):\n ...
[ "0.7517149", "0.7517149", "0.70284534", "0.69898176", "0.68446493", "0.6674718", "0.6455304", "0.64134246", "0.64134246", "0.6349704", "0.62026215", "0.60871446", "0.59652585", "0.5911611", "0.5865982", "0.5795976", "0.5723208", "0.57020885", "0.560834", "0.5525059", "0.55087...
0.7417054
4
Sets the build_type of this ProblemScope.
def build_type(self, build_type): self._build_type = build_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_types(self, build_types):\n\n self._build_types = build_types", "def build_type(self) -> Optional[pulumi.Input['BuildTypeArgs']]:\n return pulumi.get(self, \"build_type\")", "def __init__(self, project=None, build_types=None, build_type=None, teamcity=None): # noqa: E501 # noqa: E501\...
[ "0.625394", "0.59458286", "0.5855856", "0.577268", "0.5698405", "0.5533615", "0.5451951", "0.54216546", "0.5392611", "0.53884697", "0.5381613", "0.5381613", "0.5381613", "0.5381613", "0.53579956", "0.53508645", "0.53253186", "0.5323894", "0.5323894", "0.5235474", "0.5209653",...
0.7677981
0
A weighted version of keras.objectives.categorical_crossentropy for keras (2.0.6). This lets you apply a weight to unbalanced classes.
def weighted_categorical_crossentropy(weights): weights = K.variable(weights) def loss(y_true, y_pred): # scale predictions so that the class probas of each sample sum to 1 y_pred /= K.sum(y_pred, axis=-1, keepdims=True) # clip to prevent NaN's and Inf's y_pred = K.clip...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weighted_categorical_crossentropy(weights):\n weights = K.variable(weights)\n\n def loss(y_true, y_pred):\n y_hat = y_pred / K.sum(y_pred, axis=-1, keepdims=True)\n y_hat = K.clip(y_hat, K.epsilon(), 1 - K.epsilon())\n loss = y_true * K.log(y_hat) * weights\n loss = - K.sum(lo...
[ "0.8203031", "0.79314363", "0.7234755", "0.71510255", "0.702699", "0.70055", "0.70055", "0.69127864", "0.6847676", "0.67895746", "0.6735132", "0.66833335", "0.6594962", "0.6553082", "0.6502841", "0.6399763", "0.63869053", "0.63820964", "0.63813084", "0.6356557", "0.6352567", ...
0.842637
0
Strips text from the given html string, leaving only tags. This functionality requires BeautifulSoup, nothing will be done otherwise.
def escape_tags(value, valid_tags): # 1. escape everything value = conditional_escape(value) # 2. Reenable certain tags if valid_tags: # TODO: precompile somewhere once? tag_re = re.compile(r'&lt;(\s*/?\s*(%s))(.*?\s*)&gt;' % '|'.join(re.escape(tag) for tag i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_html(inputString):\r\n return BeautifulSoup(inputString, \"html.parser\").text", "def strip_html_tags(text):\r\n soup = BeautifulSoup(text, 'lxml')\r\n stripped_text = soup.get_text(separator=\" \")\r\n return stripped_text", "def strip_html_tags(text):\n soup = BeautifulSoup(text, \"h...
[ "0.81024426", "0.8101726", "0.80697876", "0.80697876", "0.79429233", "0.79096913", "0.78852296", "0.7825286", "0.7742608", "0.7719675", "0.7712011", "0.76734984", "0.7635117", "0.763383", "0.7618847", "0.76166385", "0.76166385", "0.76087105", "0.75854695", "0.7572013", "0.754...
0.0
-1
Unload a config entry.
async def async_unload_entry(hass, config_entry): _LOGGER.info("Remove the Spotify token from AIS gate and cloud") try: import os os.remove(hass.config.path(DEFAULT_CACHE_PATH)) _LOGGER.info("Token from cache file removed") except Exception as e: _LOGGER.error("Error removing...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok", "async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True", ...
[ "0.697284", "0.6888074", "0.6779855", "0.6747459", "0.6689002", "0.6657831", "0.66162205", "0.6603433", "0.65925974", "0.65595686", "0.65411645", "0.6507643", "0.6507643", "0.6507643", "0.6507643", "0.64977276", "0.64931643", "0.6486601", "0.6486601", "0.6486601", "0.6486601"...
0.56245375
90
Returns a single training item from the dataset as a dictionary. Values correspond to torch tensors.
def __getitem__(self, index): inputs = {} do_color_aug = self.is_train and random.random() > 0.5 do_flip = self.is_train and random.random() > 0.5 for i in self.frame_idxs: if i=='s': filename = os.path.join('cam1', 'data', self.filenames[index]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, item: int) -> Dict[str, torch.Tensor]:\n\n return {\n \"inputs\": self.inputs[item],\n \"targets\": self.targets[item],\n }", "def __getitem__(self, item):\n return self.default_dataset[item]", "def __getitem__(self, index: int) -> Dict[str, Tens...
[ "0.6668739", "0.6310413", "0.62461215", "0.6054832", "0.60530686", "0.602308", "0.5987119", "0.59603965", "0.58329684", "0.5828048", "0.57812864", "0.57812864", "0.57812864", "0.5752854", "0.5752854", "0.5730539", "0.57068443", "0.56585646", "0.5638331", "0.56030136", "0.5593...
0.0
-1
Return the syncname of a process given it's PID.
def get_process_info_by_pid(self, pid): # TODO: discuss if self.logger needs to happen here? I think not? -BY for process in self.data_storage.running_data: if self.data_storage.running_data[process]['pid'] == pid: return self.data_storage.running_data[process]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_process_name(pid):\n proc = subprocess.Popen(['ps', '-p', pid, '-o', 'comm='],\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE)\n out, err=proc.communicate()\n return out.strip().decode('utf-8')", "def get_pid_name(pid):\n try:\n ...
[ "0.7457736", "0.6966884", "0.6934237", "0.6835257", "0.670662", "0.6412244", "0.63484544", "0.60720015", "0.5883947", "0.58539605", "0.5772256", "0.5722616", "0.5706914", "0.570375", "0.5698324", "0.56725764", "0.5657675", "0.5614198", "0.5606319", "0.5588672", "0.5577531", ...
0.0
-1
Sanitize directory paths by removing whitespace and trailing slashes. Currently only tested on Unix, but should also work on Windows.
def sanatize_path(self, path): # Remove extra whitespace path = path.strip() # Remove slash from end of path path = path.rstrip(os.sep) return path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_slashes(path):\n return path.strip(\"/\")", "def clean_directory_path(path):\n allowed = string.digits + string.ascii_letters + string.whitespace\n stripped = \"\".join(c for c in path if c in allowed)\n return stripped.replace(\" \", \"_\")", "def fix_dir_separator(slash_deli...
[ "0.73595685", "0.7308992", "0.6792081", "0.67758703", "0.6744615", "0.6662944", "0.66584635", "0.6606885", "0.65441716", "0.65385413", "0.65196", "0.64663", "0.64636576", "0.64401805", "0.643265", "0.63909924", "0.63763976", "0.63763976", "0.6365127", "0.626117", "0.6238333",...
0.6585961
8
List the model that is currently served by the backend server.
def list_servables(self): if not self._server_started() is True: print('Server not started at host %s, port %d' % (self.host, self.port)) sys.exit(0) else: headers = {'Content-Type': 'application/json'} url = 'http://'+self.host+':'+str(self.port)+'/servab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ListModels(self, request, context):\n context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)", "def index(self, req):\n return self._get_models(req, is_detail=False)", "def list(self):\n return self.objects.all()", "def models(self):\n \n # Call the Razor RESTful API to g...
[ "0.7304176", "0.7261459", "0.70327926", "0.69593745", "0.6885191", "0.6797283", "0.6778932", "0.6743295", "0.6740762", "0.670496", "0.6684537", "0.66692847", "0.66218585", "0.66218585", "0.6605175", "0.66038567", "0.6598384", "0.6563228", "0.64725196", "0.6437404", "0.6418811...
0.0
-1
Sends message to a slack channel. If you want to send it to a "user" > use "", if "public channel" > use "channel", if "private channel" > use "channel"
def task_fail_slack_alert(context): slack_channel = context['dag'].default_args.get('slack_channel', BaseHook.get_connection(SLACK_CONN_ID).login) slack_token = BaseHook.get_connection(SLACK_CONN_ID).password failed_alert = SlackAPIPostOperator( task_id='slack_failed', channel=slack_channel,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message(channel, message):\n slack_client = get_client()\n slack_client.chat_postMessage(channel=channel, text=message, as_user=True)", "def send_slack(self, message):\n self.slack_client.api_call('chat.postMessage', channel=self.slack_channel, text=message, username=self.username, icon_emo...
[ "0.81818455", "0.7747355", "0.7624407", "0.74804205", "0.7464758", "0.72661525", "0.72385836", "0.7156393", "0.70404494", "0.6989569", "0.6981702", "0.68600804", "0.6846838", "0.6808624", "0.68030524", "0.68006533", "0.67900604", "0.67721087", "0.67620957", "0.67601335", "0.6...
0.0
-1
Computes normalized quantile loss for torch tensors. Uses the qRisk metric as defined in the "Training Procedure" section of the main TFT paper.
def normalized_quantile_loss(actuals: torch.Tensor, predictions: torch.Tensor, quantiles: List[float] = None) -> torch.Tensor: normalizer = torch.sum(abs(actuals)) if quantiles == None: QL = QuantileLoss(quantiles=[0.1, 0.5, 0.9]) else: QL = QuantileLoss(quantiles=quantiles) q_loss = QL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numpy_normalised_quantile_loss(self, y_pred, y, quantile):\n if not isinstance(y_pred, paddle.Tensor):\n y_pred = paddle.to_tensor(y_pred,paddle.float32)\n\n if len(y_pred.shape) == 3:\n ix = self.quantiles.index(quantile)\n y_pred = y_pred[..., ix]\n\n if ...
[ "0.70270723", "0.6815313", "0.58613586", "0.58225995", "0.56911457", "0.5627937", "0.5546004", "0.5536235", "0.54864985", "0.54816455", "0.547545", "0.54679716", "0.546322", "0.54552704", "0.53829426", "0.5378242", "0.53772986", "0.53498733", "0.5348454", "0.534481", "0.53448...
0.7660437
0
Convert timestamp in microseconds since the unix epoch to datetime.
def _from_microseconds(value): return _UTC_EPOCH + datetime.timedelta(microseconds=value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epoch2datetime(t):\n return datetime.fromtimestamp(t/1000.0)", "def microseconds_to_datetime(ms):\n return datetime.utcfromtimestamp(ms / 1000000.0).replace(tzinfo=pytz.utc)", "def timestamp_to_datetime(value):\n if not isinstance(value, (int, long, float)):\n raise ValueError(\n 'Expectin...
[ "0.7855639", "0.76308304", "0.748107", "0.7351378", "0.73210603", "0.7274123", "0.703481", "0.6979407", "0.696939", "0.6914299", "0.6760967", "0.67531097", "0.6739049", "0.6689654", "0.6685133", "0.66629726", "0.6650632", "0.6613998", "0.6574735", "0.6567968", "0.6565157", ...
0.67063355
13
Convert a datetime to an RFC3339 timestamp string.
def _to_rfc3339(value, ignore_zone=True): if not ignore_zone and value.tzinfo is not None: # Convert to UTC and remove the time zone info. value = value.replace(tzinfo=None) - value.utcoffset() return value.strftime(_RFC3339_MICROS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_datetime_to_rfc3339(dt):\n time_rfc3339 = vendor.rfc3339.datetimetostr(dt)\n return time_rfc3339", "def datetime_to_rfc3339(dt_obj):\n\n return dt_obj.strftime(rfc3339_date_fmt)", "def rfc3339date(date):\n if not date: return ''\n date = date + datetime.timedelta(seconds=-time.timezone)\...
[ "0.7795933", "0.71398693", "0.6804288", "0.6798364", "0.6789715", "0.6773456", "0.67530066", "0.6719797", "0.6719797", "0.6719797", "0.66983306", "0.66510653", "0.6640073", "0.6640073", "0.6629991", "0.6623292", "0.6609848", "0.6593492", "0.65900385", "0.654989", "0.65427846"...
0.6390009
31
Return an RFC3339compliant timestamp.
def rfc3339(self): if self._nanosecond == 0: return _to_rfc3339(self) nanos = str(self._nanosecond).rjust(9, "0").rstrip("0") return "{}.{}Z".format(self.strftime(_RFC3339_NO_FRACTION), nanos)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rfc3339_time() -> Text:\n\n return datetime.datetime.utcnow().isoformat('T') + 'Z'", "def _timestamp():\n moment = time.time()\n moment_us = repr(moment).split(\".\")[1]\n return time.strftime(\"%Y-%m-%d-%H-%M-%S-{}\".format(moment_us), time.gmtime(moment))", "def get_timestamp(self):\n ...
[ "0.7412164", "0.7067743", "0.70454866", "0.680817", "0.6691189", "0.66868603", "0.664912", "0.66445935", "0.66431254", "0.6610651", "0.65642494", "0.65453845", "0.65272963", "0.65122104", "0.649016", "0.6486672", "0.64797294", "0.6453291", "0.64185005", "0.6393736", "0.637609...
0.75104326
0
Return a timestamp message.
def timestamp_pb(self): inst = ( self if self.tzinfo is not None else self.replace(tzinfo=datetime.timezone.utc) ) delta = inst - _UTC_EPOCH seconds = int(delta.total_seconds()) nanos = self._nanosecond or self.microsecond * 1000 return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp():\n return datetime.now().strftime(\"%Y%m%dT%H%M%S\")", "def get_timestamp():\n return time.strftime('%Y-%m-%d %H:%M:%S')", "def timestamp():\n\tn = datetime.datetime.now()\n\treturn \"%04d-%02d-%02dT%02d:%02d:%02d\" % (\n\t\tn.year, n.month, n.day, n.hour, n.minute, n.second\n\t)"...
[ "0.7584546", "0.75290275", "0.7434642", "0.7374414", "0.73461294", "0.7262186", "0.7260911", "0.7207727", "0.7193734", "0.7188587", "0.7182828", "0.7145677", "0.711516", "0.7112772", "0.7106385", "0.7098005", "0.70562106", "0.703967", "0.70383", "0.70205724", "0.7006787", "...
0.0
-1
Tests behavior if interface.get_vessel_list throws a DoesNotExistError
def test_get_vessel_list_throws_DoesNotExistError(): interface.get_vessel_list = mock_get_vessel_list_throws_DoesNotExistError interface.release_vessels = mock_release_vessels response = c.post('/html/del_resource', good_data, follow=True) assert(response.status_code == 200) assert("Unable to remove"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_url_vessel_empty_list(self):\n url = reverse('vessel-list')\n response = self.get(url)\n self.assertEqual(response.status_code, status.HTTP_200_OK)", "def test_get_vessel_list_throws_InvalidRequestError():\r\n interface.get_vessel_list = mock_get_vessel_list_throws_InvalidRequestEr...
[ "0.72203964", "0.71185136", "0.7066029", "0.679958", "0.5962365", "0.590518", "0.58169925", "0.57935566", "0.5749535", "0.5715016", "0.5686451", "0.56774145", "0.5670005", "0.5656361", "0.56513494", "0.5625519", "0.5612344", "0.56053144", "0.55029345", "0.54844", "0.54839444"...
0.75056046
0
Retrieve lessons from the lesson pages.
def get_lessons(lesson_id): url = '{0}?cat={1}'.format(BASE_URL, lesson_id) page = requests.get(url, verify=False) soup = BeautifulSoup(page.content) output = [] for item in soup.find(id='playlist').findAll('dd'): video_id = item.find('a')['href'].split('=')[-1] title = item.find('a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_lessons(self, course: str):\n\n lesson_link: Any = self.courses[course][\"link\"]\n lesson_data = self._parse_lesson(lesson_link)\n # self.courses[course][\"lessons\"] = lesson_data\n self.lessons = lesson_data", "def get_lessons(course_id, lesson=None):\n lesson_list = []\...
[ "0.7031197", "0.66613", "0.6472741", "0.6313995", "0.6297631", "0.5964357", "0.581034", "0.5612484", "0.55869335", "0.55612785", "0.54270446", "0.53654546", "0.5331647", "0.53290176", "0.53130364", "0.5286712", "0.52614826", "0.52531", "0.5216531", "0.5206971", "0.5196762", ...
0.6672646
1
Inserts node in a sorted linked list.
def insert_node(self, head, node): prev, curr = None, head while curr.val < node.val: prev, curr = curr, curr.next if not prev: head = node else: prev.next = node node.next = curr return head
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sorted_insert(self, value):\n if self.__head is None:\n self.__head = Node(value, None)\n elif value < self.__head.data:\n self.__head = Node(value, self.__head)\n else:\n n = self.__head\n while n.next_node is not None and n.next_node.data <= va...
[ "0.820729", "0.818316", "0.7987863", "0.7959922", "0.720093", "0.71969026", "0.7186086", "0.71179855", "0.70869774", "0.70600545", "0.7054983", "0.7033538", "0.7014881", "0.70129776", "0.69990766", "0.6961826", "0.6951662", "0.6951662", "0.6932985", "0.6932985", "0.69122976",...
0.8149673
2
Chooses a random id of length 'length'. There are 62^'length' possible randids. For length '12', that's 10K+ years of making a guess 10 times a second to find a single random page, with a billion pages.
def randid(length=12): import random return ''.join(random.choice('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') for x in range(length))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_id(length=MAX_ID_LENGTH - 1):\n arb_id = random.choice(LEAD_ID_CHARACTERS)\n for i in range(length - 1):\n arb_id += random.choice(CHARACTERS)\n return arb_id", "def generate_id(length: int = 8):\n return \"\".join(random.choices(string.ascii_uppercase, k=length))", "def _crea...
[ "0.74631286", "0.74071676", "0.7272849", "0.70104885", "0.67147696", "0.6712778", "0.66736937", "0.66303253", "0.6618916", "0.6553483", "0.65376747", "0.6533648", "0.65256494", "0.65190023", "0.65097946", "0.6489149", "0.64810395", "0.64748263", "0.6467832", "0.64407367", "0....
0.7521966
0
One hot encodes type, adds it to data and returns data and types
def encode_and_extract_type(input_data, N_max): # copy types conn_type = input_data[['type']].copy() # encode types type_dict = {'1JHC': [1, 0, 0, 0, 0, 0, 0, 0], '1JHN': [0, 1, 0, 0, 0, 0, 0, 0], '2JHC': [0, 0, 1, 0, 0, 0, 0, 0], '2JHH': [0, 0, 0, 1,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encoding(data):\n\n data_encoded = pd.get_dummies(data)\n\n return data_encoded", "def __encode_one_hot_util(self):\n for col in self.cat_cols:\n if (\n col in self.train_df\n and col + str(\"Encoded\") not in self.ord_cols\n ):\n ...
[ "0.7423223", "0.7304322", "0.72946715", "0.72284955", "0.71829796", "0.69747144", "0.6941821", "0.6923228", "0.6866014", "0.6843859", "0.67920154", "0.67755646", "0.67505896", "0.6698092", "0.6675622", "0.6640889", "0.6632117", "0.6617487", "0.66159904", "0.6577033", "0.65604...
0.5978919
94
Return vector of model parameters.
def get_theta(self, subset='all', measure='PQ'): theta = np.array([self.mean_v, self.kappa_s, self.kappa_y, self.eta_s, self.eta_y, self.rho, self.lmbd, self.lmbd_s, self.lmbd_y]) if subset == 'all' and measure == 'PQ': return theta ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model_params(self):\n\n results = self._model.fit()\n model_params = np.expand_dims(results.params.as_matrix(), 1)\n return model_params", "def parameters(self):\n return self.model.parameters()", "def get_params(self):\n return deepcopy(np.hstack([to_numpy(v).flatten...
[ "0.79449385", "0.7761084", "0.7666261", "0.7547986", "0.7517525", "0.75160277", "0.74620205", "0.74527353", "0.74124396", "0.7399836", "0.73807317", "0.73770857", "0.729376", "0.72593826", "0.72426635", "0.7231588", "0.72294164", "0.72116625", "0.71679926", "0.7154512", "0.71...
0.0
-1
Saves the qualifying loans to a CSV file.
def save_qualifying_loans(qualifying_loans): # Usability dialog for savings the CSV Files. save_file = questionary.confirm("Would you like to save these loans to a file? y or n: ").ask() print("\n") if save_file: output = questionary.text("Please provide a name for your file. Ex: my_loans.csv: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_csv(self):\r\n # Save the read values to a csv file\r\n with open(self.fname, \"a\") as f:\r\n wr = csv.writer(f, dialect='excel')\r\n wr.writerow([self.set_time, self.read_time_P_ac, self.read_time_P_bat,\r\n self.soc0, self.set_val, self.P_a...
[ "0.6966328", "0.6870253", "0.68277895", "0.67218447", "0.6585621", "0.65582293", "0.6475791", "0.64576596", "0.64095336", "0.6373284", "0.6370008", "0.6350625", "0.63475597", "0.6340548", "0.6335227", "0.6317062", "0.62919617", "0.62722164", "0.6265656", "0.62428063", "0.6209...
0.7288751
0
Name of the field.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def NAME(self) -> str:\n return self._field_name", "def name_field(self):\r\n return 'name'", "def fieldName(self):\n return self._field.name", "def _field_name(self) -> str:\n name = self._resolve_field_name()\n if name is None:\n # pylint: disable=consider-usin...
[ "0.8791825", "0.86143434", "0.83854705", "0.80715984", "0.80518514", "0.80468625", "0.7724366", "0.7578427", "0.75519866", "0.7535055", "0.7520458", "0.7445304", "0.7441232", "0.7432342", "0.74116534", "0.7393328", "0.7393187", "0.73901075", "0.73725045", "0.7370975", "0.7370...
0.73407966
26
Whether this field is marked required field or not.
def is_required(self): return self._required
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isRequired(self):\n return not self.isOptional()\n # return self._field.label == FieldDescriptor.LABEL_REQUIRED", "def is_required(self, field):\n return field.scheme.is_required and not field.scheme.is_pk", "def is_required(self) -> bool:\n return self.required", "def require...
[ "0.8853373", "0.8378991", "0.83107877", "0.8055878", "0.78809005", "0.78809005", "0.7794905", "0.77309114", "0.7646152", "0.75763714", "0.7550528", "0.75304097", "0.7449529", "0.74410534", "0.7385511", "0.7287369", "0.7261416", "0.7194855", "0.7194855", "0.7098411", "0.704615...
0.8128947
3
Convert a time to a datetime for datastore storage.
def _time_to_datetime(value): assert isinstance(value, datetime.time) return datetime.datetime(1970, 1, 1, value.hour, value.minute, value.second, value.microsecond)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_to_datetime(time):\n split_time = time.split(':')\n hour = int(split_time[0])\n minutes = int(split_time[1])\n now = dt.datetime.now()\n time_as_datetime = dt.datetime(now.year, now.month, now.day,\n hour=hour, minute=minutes)\n\n # Need to change the da...
[ "0.76862586", "0.71638316", "0.7140985", "0.70503753", "0.7001265", "0.69803745", "0.68884057", "0.6877281", "0.67336893", "0.67133236", "0.66956383", "0.65040106", "0.64000684", "0.63857096", "0.63808364", "0.6339152", "0.63245136", "0.6307302", "0.6298653", "0.6283557", "0....
0.77680534
0
Test `uniq` filter function.
def test_uniq(self): test_cases = [ Case( description="lists of strings", val=["a", "b", "b", "a"], args=[], kwargs={}, expect=["a", "b"], ), Case( description="lists of things", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique():\n\n def _apply_fn(dataset):\n return dataset.unique()\n\n return _apply_fn", "def uniq(input, output, fields, delimiter, encoding, verbose, format_in, format_out, zipfile, filter):\n if verbose:\n enableVerbose()\n options = {}\n options['output'] = output\n options['fields'...
[ "0.63492405", "0.62281924", "0.6093811", "0.59848446", "0.5980171", "0.59633833", "0.59403497", "0.59102774", "0.5889821", "0.5874548", "0.5850808", "0.57886237", "0.5765051", "0.5734143", "0.57336146", "0.57023686", "0.5699716", "0.5691954", "0.568361", "0.5671094", "0.56442...
0.76420027
0
Closes SQLite connection Returns None
def close(self): if self._conn is not None: self._conn.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_db(connection: sqlite3.Connection):\n connection.commit()\n connection.close()", "def close_db(nothing):\n if hasattr(g, 'sqlite_db'):\n g.sqlite_db.close()", "def close_db(error):\n conn = g.get('sqlite_db', None)\n if conn is not None:\n conn.close()", "def close_db(e...
[ "0.79247993", "0.78334403", "0.78167325", "0.76617754", "0.76419055", "0.76217234", "0.76103306", "0.76103306", "0.76103306", "0.76103306", "0.76103306", "0.76103306", "0.76103306", "0.76103306", "0.76103306", "0.76103306", "0.76103306", "0.76103306", "0.76103306", "0.76103306"...
0.0
-1
Get database path Returns str database file path
def file_loc(self): return self.__dbfile
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_database_path():\n\treturn _paths[_DATABASE_PATH_KEY]", "def get_db_path():\n \n return(db_run.db_abs_path)", "def getDBPath():\n return os.path.join(CONFIG_DIR, CONFIG_DICT['common']['local_db'])", "def database_file(file):\r\n fpath = path.join('databases', '{0}'.format(file))\r\n db...
[ "0.8533109", "0.85153514", "0.80799925", "0.7953906", "0.7915227", "0.7909218", "0.77999234", "0.7799264", "0.7789118", "0.774749", "0.7743577", "0.76493114", "0.76176137", "0.7213972", "0.71832234", "0.70999044", "0.70995295", "0.7067724", "0.7067724", "0.70646983", "0.70551...
0.62412673
58
While uses of this feature should be quite rare, we should be able to check whether two objects are the same based on their IDs being the same by default. Note that subclasses will undoubtedly modify this behavior with other __eq__ methods.
def test_compare() -> None: obj = SpecificLocation() obj2 = SpecificLocation() assert obj != obj2 obj._id = obj2.id assert obj == obj2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return type(self) == type(other) and self.id == other.id", "def __eq__(self, other):\n eqclass = self.__class__.__name__ == other.__class__.__name__\n eqid = hasattr(other, 'id') and self.id == other.id\n return eqclass and eqid", "def __eq__(self, other):...
[ "0.84492165", "0.8396703", "0.8391562", "0.8353251", "0.83496857", "0.83491087", "0.81567466", "0.81011605", "0.77821684", "0.7781911", "0.76908267", "0.763387", "0.7568703", "0.75353193", "0.7487003", "0.7485118", "0.74422914", "0.74422914", "0.74422914", "0.7388333", "0.735...
0.71153337
95
Tests that binary SpecificLocation serializes as expected
def test_binary_serialization() -> None: uid = UID(value=uuid.UUID(int=333779996850170035686993356951732753684)) obj = SpecificLocation(id=uid, name="Test") blob = ( b"\n/syft.core.io.location.specific.SpecificLocation\x12\x1a\n\x12\n\x10" + b"\xfb\x1b\xb0g[\xb7LI\xbe\xce\xe7\x00\xab\n\x15...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_default_serialization() -> None:\n\n uid = UID(value=uuid.UUID(int=333779996850170035686993356951732753684))\n obj = SpecificLocation(id=uid, name=\"Test\")\n\n blob = sy.serialize(obj, to_proto=True)\n\n assert sy.serialize(obj) == blob", "def test_binary_deserialization() -> None:\n\n b...
[ "0.7375597", "0.72204155", "0.6941698", "0.6747669", "0.6687572", "0.66465783", "0.6593975", "0.65680665", "0.63872945", "0.63758487", "0.62996614", "0.6264945", "0.61968005", "0.6076474", "0.60626924", "0.6027337", "0.5995509", "0.59866995", "0.59510314", "0.5870925", "0.585...
0.7700117
0
Return the time in seconds of the previous solve shifted by the simulation start time. That is, this is the time from 12 AM on the first day to the time at the previous hydraulic timestep.
def _prev_shifted_time(self): return self._prev_sim_time + self.options.time.start_clocktime
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _shifted_time(self):\n return self.sim_time + self.options.time.start_clocktime", "def sim_step(self):\n return traci.simulation.getCurrentTime()/1000 # milliseconds to seconds", "def get_simulation_time(self):\n if not self.simulation_init_time:\n return 0\n if self...
[ "0.7158862", "0.67761683", "0.66555315", "0.66283196", "0.64012426", "0.64009786", "0.6364507", "0.63604295", "0.6347445", "0.6292934", "0.6258326", "0.625451", "0.61905634", "0.6159625", "0.6156674", "0.6154028", "0.61382556", "0.6125578", "0.6115283", "0.6097853", "0.608191...
0.75587815
0
Return the clocktime day of the simulation
def _clock_day(self): return int(self._shifted_time / 86400)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_of_day(self):\n return self.time_of_day_value", "def day(self):\n return 0", "def day(self):\n return 0", "def unit_day(self):\n return (self.time_base * 60.0) * 24.0", "def time_of_the_day(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"time_of...
[ "0.72421193", "0.7015691", "0.7015691", "0.6804973", "0.67424273", "0.6686264", "0.66749734", "0.65851897", "0.6573514", "0.6541982", "0.65127045", "0.6437197", "0.6330646", "0.63277256", "0.63277256", "0.62924594", "0.62924594", "0.62924594", "0.62901354", "0.6270266", "0.62...
0.75825566
0
Adds a source to the water network model
def add_source(self, name, node_name, source_type, quality, pattern=None): if pattern and isinstance(pattern, six.string_types): pattern = self.get_pattern(pattern) source = Source(self, name, node_name, source_type, quality, pattern) self._sources[source.name] = source self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_source(self, source: _Source) -> None:\n\n self._sources.append(source)", "def AddSource(self, source):\n self._sources.append(source)", "def AddSource (self, name, source, filename):\n self.containments [name] = source, filename, False", "def add_source(self, model, x, y):\n\n ...
[ "0.75925076", "0.7413303", "0.7154899", "0.6972677", "0.69620556", "0.6811902", "0.67813593", "0.6749328", "0.6671457", "0.6658951", "0.6658951", "0.6510423", "0.63688797", "0.6359709", "0.6346215", "0.6320607", "0.6320607", "0.6320607", "0.6320607", "0.6320607", "0.6320607",...
0.68387914
5
Get a specific pattern
def get_pattern(self, name): return self._pattern_reg[name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPattern(self):\n return self.pattern", "def pattern(self):\n return self.get_data(\"pattern\")", "def pattern(self):\n return self[\"pattern\"]", "def pattern(self):\n return self[\"pattern\"]", "def pattern(self) -> str:\n return pulumi.get(self, \"pattern\")", "def...
[ "0.7889197", "0.7732446", "0.76944095", "0.76944095", "0.75318676", "0.75318676", "0.75318676", "0.7341625", "0.72529024", "0.7201574", "0.71860427", "0.71860427", "0.71240026", "0.7068256", "0.7014461", "0.70117474", "0.7005323", "0.6892915", "0.68164325", "0.67527807", "0.6...
0.744587
7
Create a WaterNetworkModel from a JSON file.
def read_json(self, f, **kw_json): return wntr.network.io.read_json(f, append=self, **kw_json)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_json(cls, path):\n\n if not isinstance(path, Path):\n path = Path(path)\n\n directory, prefix = path.parent, path.stem\n\n with open(path) as fp:\n params = json.load(fp)\n model = cls(params['element'],\n params['r_cut'],\n ...
[ "0.69725555", "0.6945759", "0.6867434", "0.6781323", "0.67301834", "0.66804194", "0.6562913", "0.653263", "0.64936143", "0.64841425", "0.6448988", "0.6387072", "0.6353583", "0.6338721", "0.6336967", "0.6332047", "0.6316105", "0.6291314", "0.6217239", "0.6201419", "0.61892474"...
0.5432088
83
Test that models/base.py conforms to PEP8
def test_pep8(self): pep8style = pep8.StyleGuide(quiet=True) result = pep8style.check_files(['models/square.py']) self.assertEqual(result.total_errors, 0, "Fix PEP8 Style")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pep8_base_model(self):\n syntax = pep8.StyleGuide(quit=True)\n check = syntax.check_files(['models/base_model.py'])\n self.assertEqual(\n check.total_errors, 0,\n \"Found code style errors (and warnings).\"\n )", "def test_base_pep8(self):\n\n pep...
[ "0.7453463", "0.72078586", "0.72025883", "0.71329147", "0.7119043", "0.7045536", "0.70115036", "0.6908024", "0.68620104", "0.67976946", "0.6787752", "0.659859", "0.659363", "0.65897286", "0.6516813", "0.64944935", "0.64626634", "0.6439026", "0.6439002", "0.64148736", "0.64142...
0.0
-1
Error returned if only invalid IP addresses are passed in input file.
def test_input_file_invalid_ip_addresses_passsed(self, api_client): runner = CliRunner() expected = ( "Error: at least one valid IP address must be passed either as an " "argument (IP_ADDRESS) or through the -i/--input_file option." ) result = runner.invoke( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_input_file_invalid_ip_addresses_passsed(self, api_client):\n runner = CliRunner()\n\n expected = (\n \"Error: at least one valid IP address must be passed either as an \"\n \"argument (IP_ADDRESS) or through the -i/--input_file option.\"\n )\n\n result = r...
[ "0.7329706", "0.69877046", "0.6758954", "0.6752534", "0.64434695", "0.6431371", "0.63859427", "0.6324199", "0.62635887", "0.62278163", "0.6187877", "0.6162502", "0.6157764", "0.6089943", "0.60771656", "0.6074368", "0.606984", "0.6059683", "0.60493106", "0.6029607", "0.6019981...
0.77088946
0
Error is displayed if API key is not found.
def test_api_key_not_found(self): runner = CliRunner() with patch("greynoise.cli.decorator.load_config") as load_config: load_config.return_value = {"api_key": ""} result = runner.invoke( subcommand.ip, ["0.0.0.0"], parent=Context(main, info_name="greynoise") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_key_not_found(self):\n runner = CliRunner()\n\n with patch(\"greynoise.cli.decorator.load_config\") as load_config:\n load_config.return_value = {\"api_key\": \"\"}\n result = runner.invoke(\n subcommand.quick,\n [\"0.0.0.0\"],\n ...
[ "0.713393", "0.7114223", "0.70754087", "0.7028489", "0.70042485", "0.6958488", "0.6948775", "0.6886608", "0.681045", "0.67111915", "0.6689149", "0.6682669", "0.66406655", "0.6632251", "0.65937406", "0.65627766", "0.6518985", "0.65086174", "0.6469222", "0.6457816", "0.64355737...
0.6905634
7
Error is displayed if API key is not found.
def test_api_key_not_found(self): runner = CliRunner() with patch("greynoise.cli.decorator.load_config") as load_config: load_config.return_value = {"api_key": ""} result = runner.invoke( subcommand.query, ["<query>"], parent=Conte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_key_not_found(self):\n runner = CliRunner()\n\n with patch(\"greynoise.cli.decorator.load_config\") as load_config:\n load_config.return_value = {\"api_key\": \"\"}\n result = runner.invoke(\n subcommand.quick,\n [\"0.0.0.0\"],\n ...
[ "0.7133699", "0.7113899", "0.70748323", "0.70287615", "0.70035744", "0.69579756", "0.6905072", "0.6886157", "0.68102723", "0.6711269", "0.6688278", "0.66838604", "0.6640796", "0.6632667", "0.6593882", "0.6562457", "0.65179884", "0.6508917", "0.6468864", "0.6456466", "0.643569...
0.69482815
6
Quickly check IP address.
def test_quick(self, api_client, ip_address, output_format, expected): runner = CliRunner() api_client.quick.return_value = [ OrderedDict((("ip", ip_address), ("noise", True))) ] result = runner.invoke(subcommand.quick, ["-f", output_format, ip_address]) assert resu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_ip(ip):\n ...", "def checkIP(self, ip = None):\n\t\treturn os.system(\"ping -c 1 -w2 \" + ip + \" > /dev/null 2>&1\") == 0", "def validateIP():\n try:\n s = socket.inet_aton(args.target)\n except socket.error:\n print(\"\")\n print(f\"{bad_cmd} Bad...
[ "0.75226593", "0.73323077", "0.726158", "0.714526", "0.7039643", "0.70006317", "0.6994464", "0.69903743", "0.69818884", "0.6963008", "0.6944864", "0.69097364", "0.68759936", "0.6857343", "0.68358934", "0.6822815", "0.6811216", "0.6803256", "0.678195", "0.67804265", "0.6733001...
0.0
-1
Error returned if only invalid IP addresses are passed in input file.
def test_input_file_invalid_ip_addresses_passsed(self, api_client): runner = CliRunner() expected = ( "Error: at least one valid IP address must be passed either as an " "argument (IP_ADDRESS) or through the -i/--input_file option." ) result = runner.invoke( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_input_file_invalid_ip_addresses_passsed(self, api_client):\n runner = CliRunner()\n\n expected = (\n \"Error: at least one valid IP address must be passed either as an \"\n \"argument (IP_ADDRESS) or through the -i/--input_file option.\"\n )\n\n result = r...
[ "0.77088946", "0.69877046", "0.6758954", "0.6752534", "0.64434695", "0.6431371", "0.63859427", "0.6324199", "0.62635887", "0.62278163", "0.6187877", "0.6162502", "0.6157764", "0.6089943", "0.60771656", "0.6074368", "0.606984", "0.6059683", "0.60493106", "0.6029607", "0.601998...
0.7329706
1
Error is displayed if API key is not found.
def test_api_key_not_found(self): runner = CliRunner() with patch("greynoise.cli.decorator.load_config") as load_config: load_config.return_value = {"api_key": ""} result = runner.invoke( subcommand.quick, ["0.0.0.0"], parent=Conte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_key_error(api):\n\twith pytest.raises(top_stories.APIKeyError):\n\t\tmissingAPI = top_stories.TopStoriesAPI()", "def check_api_key(x_api_key: str = Security(api_key_header_auth)):\n\n if x_api_key != API_KEY:\n raise HTTPException(\n status_code=status.HTTP_401_UNAUTHORIZED,\n ...
[ "0.7113899", "0.70748323", "0.70287615", "0.70035744", "0.69579756", "0.69482815", "0.6905072", "0.6886157", "0.68102723", "0.6711269", "0.6688278", "0.66838604", "0.6640796", "0.6632667", "0.6593882", "0.6562457", "0.65179884", "0.6508917", "0.6468864", "0.6456466", "0.64356...
0.7133699
0
Save API key to configuration file.
def test_save_api_key(self, key_option): runner = CliRunner() api_key = "<api_key>" expected_config = {"api_key": api_key, "timeout": DEFAULT_CONFIG["timeout"]} expected_output = "Configuration saved to {!r}\n".format(CONFIG_FILE) with patch("greynoise.cli.subcommand.save_config...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(cls, api_key: str, token: str):\n cls.config_file.write_text(str({\"key\": api_key, \"token\": token}))\n return True", "def write_key(api_key, output_path, client_module=pyalveo):\n client = client_module.Client(api_key, API_URL, use_cache=False)\n outfile = open(output_path, 'w')\n...
[ "0.8118445", "0.71339417", "0.66817755", "0.662788", "0.66265863", "0.6612377", "0.6605093", "0.65996575", "0.6566931", "0.65117097", "0.64639074", "0.6457544", "0.6430672", "0.6419204", "0.63880306", "0.6386759", "0.63492435", "0.6332439", "0.63322526", "0.6315013", "0.62865...
0.6529628
9
Save API key and timeout to configuration file.
def test_save_api_key_and_timeout(self, key_option, timeout_option): runner = CliRunner() api_key = "<api_key>" timeout = 123456 expected_config = {"api_key": api_key, "timeout": timeout} expected_output = "Configuration saved to {!r}\n".format(CONFIG_FILE) with patch("g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(cls, api_key: str, token: str):\n cls.config_file.write_text(str({\"key\": api_key, \"token\": token}))\n return True", "def test_save_api_key(self, key_option):\n runner = CliRunner()\n api_key = \"<api_key>\"\n expected_config = {\"api_key\": api_key, \"timeout\": DE...
[ "0.7276802", "0.64182734", "0.64098287", "0.6263883", "0.62403715", "0.61415565", "0.6018724", "0.59904474", "0.59442395", "0.5923738", "0.59134287", "0.5912611", "0.5911297", "0.5909669", "0.5908877", "0.5864476", "0.58602154", "0.5853999", "0.5843998", "0.5833313", "0.58315...
0.698072
1
Setup fails when api_key is not passed.
def test_missing_api_key(self): runner = CliRunner() expected_error = 'Error: Missing option "-k" / "--api-key"' result = runner.invoke(subcommand.setup, []) assert result.exit_code == 2 assert expected_error in result.output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_api_key(self):\n\n api_key = 'abc'\n project_id = '123'\n\n kaput.init(api_key, project_id)\n\n self.assertEqual(api_key, kaput._API_KEY)\n self.assertEqual(project_id, kaput._PROJECT_ID)\n self.assertFalse(kaput._DEBUG)\n self.assertEqual(kaput._handle...
[ "0.7627034", "0.74046487", "0.73914933", "0.7372485", "0.71628237", "0.7137709", "0.71146214", "0.7114452", "0.7004966", "0.6978424", "0.6942819", "0.69388515", "0.6821132", "0.67947453", "0.67947453", "0.6776923", "0.67639387", "0.6718686", "0.6701499", "0.66941726", "0.6672...
0.75195545
1
Error is displayed if API key is not found.
def test_api_key_not_found(self): runner = CliRunner() with patch("greynoise.cli.decorator.load_config") as load_config: load_config.return_value = {"api_key": ""} result = runner.invoke( subcommand.stats, ["query"], parent=Context(main, info_name="greynoise") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_key_not_found(self):\n runner = CliRunner()\n\n with patch(\"greynoise.cli.decorator.load_config\") as load_config:\n load_config.return_value = {\"api_key\": \"\"}\n result = runner.invoke(\n subcommand.quick,\n [\"0.0.0.0\"],\n ...
[ "0.7133699", "0.7113899", "0.70748323", "0.70287615", "0.69579756", "0.69482815", "0.6905072", "0.6886157", "0.68102723", "0.6711269", "0.6688278", "0.66838604", "0.6640796", "0.6632667", "0.6593882", "0.6562457", "0.65179884", "0.6508917", "0.6468864", "0.6456466", "0.643569...
0.70035744
4
Given a workflowType workflow_type, return the name of a corresponding workflow class to load
def get_workflow_name(workflow_type): return "workflow_" + workflow_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cls_for(obj_type):\n return {\n \"workflow\": Workflow\n }[obj_type]", "def get_workflow_type(decision):\n try:\n return decision[\"workflowType\"][\"name\"]\n except KeyError:\n # No workflowType found\n return None", "def import_workflow_class(workflow_name):\n tr...
[ "0.71542835", "0.67883533", "0.63764113", "0.6033745", "0.59493256", "0.58950895", "0.58703315", "0.58070356", "0.57632667", "0.5750004", "0.57477725", "0.57462007", "0.5737046", "0.5728862", "0.56926966", "0.56816906", "0.56768847", "0.56578654", "0.56526405", "0.56239957", ...
0.78413796
0
Returns the unstructured units of the RG.502330083 documents These interviews did not have any indi
def getUnstructured_50_233_0083_Units(filename): doc = Document(filename) units=[] # iterate over all paragraphs to get text units for para in doc.paragraphs: paragraph = para.text if len(paragraph.strip())>0: units.append({'unit':paragraph.strip()}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getUnstructured042_special_Units(filename):\n doc = Document(filename)\n units = list()\n # all interviews start with a header\n isHeader = True\n # iterate over all paragraphs to get text units\n for para in doc.paragraphs:\n paragraph = para.text\n \n # ensure paragraph...
[ "0.72448844", "0.6986209", "0.6645673", "0.59777975", "0.5652428", "0.5555099", "0.5550419", "0.5440101", "0.54270256", "0.53146136", "0.53146136", "0.53099555", "0.52914363", "0.5262525", "0.52597654", "0.525665", "0.5223961", "0.52127844", "0.5186636", "0.51777446", "0.5112...
0.71817046
1
returns the value of self.id
def get_id(self): return self._id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_id(self):\n return self.id", "def get_id(self):\n\n\t\treturn self.__id", "def GetId(self):\r\n\r\n return self.id", "def get_id(self):\n return self.id", "def get_id(self):\n return self.id", "def get_id(self):\n return self.id", "def get_id(self):\n ...
[ "0.89018816", "0.880966", "0.8788802", "0.8776924", "0.8776924", "0.8776924", "0.8776924", "0.8776924", "0.8776924", "0.8776924", "0.8776924", "0.8776924", "0.8776924", "0.8776924", "0.8776924", "0.8776924", "0.8776924", "0.8776924", "0.8776924", "0.8776924", "0.87711287", ...
0.8598346
34
takes a person's ID and adds it to this rooms self.persons; if the ID already exists inside the list, this method raises an exception
def add_person(self, per: str): if per not in self._people: self._people.append(per) else: raise IDAlreadyExists
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_person(self, person):\n # Check if the person is an instance of the Person class\n # and if the room has a vacancy, then allocate\n # TODO: Perform SQL Query\n # if isinstance(person, Person) and has_vacancy(self):\n # self.occupants.append(person)\n pass", "...
[ "0.65676033", "0.61027765", "0.5929824", "0.59218085", "0.5875231", "0.5845906", "0.5837034", "0.5836314", "0.5750028", "0.5706715", "0.56969297", "0.5672724", "0.56648934", "0.56353074", "0.56224453", "0.558963", "0.55000347", "0.5431597", "0.5428824", "0.5368888", "0.536674...
0.7483298
0
returns a dictionary of connections to this room in the form of room IDs stored in self.connections
def get_connections(self): return self._connections
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_connections(self):\n return self.connections", "def get_connections(self):\n return self.connections", "def get_connections_in(self) -> dict:\n return self.__ni_in", "def get_outgoing_connections(self, comp):\n return self.connections.get(comp.id, [])", "def get_connecti...
[ "0.74302614", "0.74302614", "0.71650916", "0.6995511", "0.69870436", "0.69122136", "0.6890542", "0.68694234", "0.67947936", "0.673722", "0.67097753", "0.6488986", "0.64883214", "0.64643973", "0.6393606", "0.6390274", "0.63503754", "0.63425726", "0.6302496", "0.62470734", "0.6...
0.7341529
2
takes a dictionary of connections to this room in the form of room IDs and sets self.connections to this dict
def set_connections(self, connections: dict): self._connections = connections
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connections(self, connections):\n\n self._connections = connections", "def loadConnections(self):\n\n #create each connecting map\n for direction, (fn, offset) in self.connections.items():\n self.connectedMaps[direction] = (Tilemap(fn), offset)", "def __init__(self):\n self....
[ "0.6299071", "0.6227639", "0.60175973", "0.56802016", "0.5665811", "0.56469935", "0.55497473", "0.5549558", "0.5485854", "0.5449879", "0.54207087", "0.5355422", "0.529117", "0.52848494", "0.5275657", "0.52159476", "0.51966083", "0.51816684", "0.51708376", "0.5163054", "0.5139...
0.6811939
0
Calculate AttForward forward propagation.
def forward( self, enc_hs_pad, enc_hs_len, dec_z, att_prev, scaling=1.0, last_attended_idx=None, backward_window=1, forward_window=3, ): batch = len(enc_hs_pad) # pre-compute all h outside the dec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_propagation(self, X):\n W1, W2, W3, B1, B2, B3 = self.get_weights_from_dna()\n\n Z1 = np.dot(W1, X) + B1\n A1 = np.maximum(Z1, 0)\n Z2 = np.dot(W2, A1) + B2\n A2 = np.maximum(Z2, 0)\n Z3 = np.dot(W3, A2) + B3\n A3 = Z3\n return A3", "def forward...
[ "0.69127244", "0.6661948", "0.6599426", "0.65406865", "0.6539206", "0.65109557", "0.6426377", "0.6377771", "0.6372988", "0.63440114", "0.6313331", "0.6307047", "0.6277334", "0.6256578", "0.62562007", "0.62381864", "0.62189525", "0.62094706", "0.62001157", "0.6171973", "0.6164...
0.0
-1
json output file writing
def __saveGithubResults(self): self.__debugInfo("Saving JSON results into file {}".format(self.output_file)) try: with open(self.output_file, 'w') as wfile: json.dump(self.final_results, wfile) except Exception as exception: raise MsgException('Output file could not be written', exception)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_json_file(self, fname, content):\n pass", "def write_json_file(self, fname, content):\n pass", "def write(self):\n self.json_o.write()", "def _write_json(self):\n with open(self._file_path, 'w') as f:\n json.dump(self._content, f, indent=4, separators=None,\n ...
[ "0.80718476", "0.80718476", "0.78945005", "0.7868495", "0.780393", "0.7712382", "0.769262", "0.76469857", "0.76469254", "0.7538126", "0.7532651", "0.7523846", "0.75095695", "0.7470825", "0.74618125", "0.7454895", "0.74429333", "0.74311054", "0.7425154", "0.74142754", "0.74088...
0.0
-1
Get the mongodb collection
def get_collection(cls): return mongo_db[cls.__collection__]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_collection(self):\n db = self._get_db()\n return getattr(db, global_settings.MONGODB_COLLECTION)", "def collection(self):\n try:\n db = getattr(self.mongo_connection, self.DATABASE, None)\n collection = getattr(db, self.COLLECTION, None)\n return col...
[ "0.87214553", "0.8572807", "0.8276924", "0.78693706", "0.784457", "0.7714699", "0.759699", "0.7374092", "0.7370372", "0.73476285", "0.7112127", "0.7005924", "0.69832927", "0.69355994", "0.6924612", "0.69220066", "0.6900657", "0.67650044", "0.66980904", "0.6688415", "0.6591945...
0.84436613
2
Destroy the whole damn database before running tests! WOO! We would do this afterwards, but sometimes you might need to do a postmortem on the state of the database.
def setup(): with get_session() as s: colls = s.db.collection_names() for coll in colls: if coll == 'system.indexes': continue s.db[coll].drop_indexes() s.db[coll].drop() s.db.command({'dropDatabase':1})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n self.db.drop_all()\n pass", "def tearDown(self):\n app.db.drop_database('local')\n app.db.close()", "def tearDown(self) -> None:\n things.db.session.remove()\n things.db.drop_all()", "def tearDown(self):\n with app.app_context():\n ...
[ "0.8432176", "0.838974", "0.8379926", "0.8338639", "0.83202684", "0.83202684", "0.825254", "0.8235055", "0.8219022", "0.82182497", "0.8207208", "0.8199387", "0.8196897", "0.8194157", "0.8182184", "0.8182184", "0.8182184", "0.8182184", "0.8182184", "0.8182184", "0.8182184", ...
0.0
-1
Create user with {APR1} password and check that user can login.
def test_auth_with_apr1_stored_password(self): # Create test user name = u'Test User' # generated with "htpasswd -nbm blaze 12345" password = '{APR1}$apr1$NG3VoiU5$PSpHT6tV0ZMKkSZ71E3qg.' # 12345 self.createUser(name, password, True) # Try to "login" theuser = us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user(email, password, f_name, l_name):\n pass", "def create_user(self):\n User.objects.create_user('test', 'testing@test.com', 'testing')", "def user_created(self, user, password):\n\n if not self.check_prereqs():\n return False\n\n if self.has_user(user):\n ...
[ "0.73004067", "0.7224032", "0.71962816", "0.70947254", "0.70152885", "0.69930893", "0.6973203", "0.69717765", "0.69700277", "0.69580203", "0.69015574", "0.6899521", "0.6899521", "0.6899521", "0.6867215", "0.68664825", "0.6848039", "0.68402165", "0.6837405", "0.68344754", "0.6...
0.7594792
0
Create user with {MD5} password and check that user can login.
def test_auth_with_md5_stored_password(self): # Create test user name = u'Test User' password = '{MD5}$1$salt$etVYf53ma13QCiRbQOuRk/' # 12345 self.createUser(name, password, True) # Try to "login" theuser = user.User(self.request, name=name, password='12345') ass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_new_user(username, hash_password):\n try:\n conn = sqlite3.connect(DATABASE)\n cursor = conn.cursor()\n\n query = '''\n INSERT INTO user\n (Username, Password)\n values\n (?, ?)'''\n cursor.execute(query, (username, hash_password...
[ "0.7318656", "0.73062855", "0.7287217", "0.72614634", "0.7258231", "0.72305536", "0.7217494", "0.7212634", "0.7208353", "0.7205905", "0.720523", "0.7198507", "0.7187735", "0.7183065", "0.7181787", "0.71778566", "0.71710557", "0.7155194", "0.7145005", "0.7124427", "0.71208876"...
0.8022129
0
Create user with {DES} password and check that user can login.
def test_auth_with_des_stored_password(self): # Create test user name = u'Test User' # generated with "htpasswd -nbd blaze 12345" password = '{DES}gArsfn7O5Yqfo' # 12345 self.createUser(name, password, True) try: import crypt # Try to "login" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user(username):\n\n password = getpass.getpass('Password for {0}: '.format(username))\n confirm = getpass.getpass('Again: ')\n\n if password != confirm:\n print >> sys.stderr, \"Passwords don't match\"\n\n sys.exit(1)\n\n with transaction.manager:\n Users(username, pass...
[ "0.7343586", "0.73068523", "0.72953594", "0.7279533", "0.7268812", "0.7237736", "0.7235069", "0.72157264", "0.72143716", "0.7140119", "0.7119481", "0.71022165", "0.707469", "0.7071333", "0.7054914", "0.70465577", "0.7039468", "0.70377856", "0.70342153", "0.7029694", "0.701669...
0.746672
0
Add a URL asset to the adversary.
def add_url_asset(self, value): return self.add_asset('URL', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_url(self, url):\n self.queue.put(url)", "def add_link (self, src, dst):\n raise NotImplementedError", "async def add(self, ctx, url, name):\n async with aiohttp.ClientSession() as session:\n async with session.get(url) as resp:\n data = await resp.read()\n ...
[ "0.67932934", "0.652156", "0.6461821", "0.64571977", "0.6455303", "0.64421105", "0.633815", "0.6309748", "0.6232123", "0.61788785", "0.61086047", "0.6106751", "0.60589206", "0.60515255", "0.59763986", "0.59452015", "0.5936189", "0.58758444", "0.58670616", "0.5857115", "0.5842...
0.7426201
0
Annotates single cell types at each level and adds the result to the object.
def getCellTypes(self): sc_data = Utils.convertAnnDataToDf(self.sc_data) try: self.sc_annot, self.de_dict = Annotate.annotateTree(sc_data, self.refDataset, self.refAnnot) except: print("Columns of annotations should be cell type levels. Additionally, higher levels should ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_annotations(annot_tuples, ref_data, annot_type):\n\n for annot in ref_data.annotations.select_type(annot_type):\n annot_begin, annot_end = annot.spans[0]\n annot_tuples.append((annot_begin, annot_end, annot.id))", "def initTypes(self):\n self.types = [ty.NoneType]*self.numcols()\n for k,row ...
[ "0.53548366", "0.49283662", "0.49159172", "0.48532856", "0.4844311", "0.48404062", "0.48219582", "0.48180592", "0.47917625", "0.47327456", "0.47157717", "0.4695715", "0.46835762", "0.46732008", "0.46381748", "0.4630978", "0.45994526", "0.4596766", "0.4594033", "0.45796517", "...
0.6900952
0
This function checks if the response is "No user found." when the token is not the right one.
def test_wrong_token(self): wrong_token = "1"*64 resp = DeleteTest.client.post('/api/deleteuser/',{"token":wrong_token,"email":"umut@gmail.com"}) self.assertEqual(json.loads(resp.content),"No user found.","Token Verification is not True")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_non_existing_token_authenticated_user(self):\r\n\r\n user_no_tokens = UserFactory.create_batch(2)[1]\r\n\r\n res = self.app.get('/api/token/twitter?api_key=' + user_no_tokens.api_key)\r\n error = json.loads(res.data)\r\n\r\n assert res.status_code == 404, error\r\n a...
[ "0.73251975", "0.70914847", "0.70688903", "0.6932121", "0.691841", "0.6847966", "0.6800146", "0.6786132", "0.6719246", "0.66476846", "0.66331077", "0.6631456", "0.6617345", "0.6609191", "0.66083944", "0.6577699", "0.6570477", "0.6552532", "0.65516645", "0.6541631", "0.6533848...
0.6181125
71
This function checks if the response is "No email address found." when the mail is not given
def test_without_mail(self): resp = DeleteTest.client.post('/api/deleteuser/',{'token':DeleteTest.valid_token}) self.assertEqual(json.loads(resp.content),"No e-mail address found.","No Mail Found")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_response(response: requests.Response) -> None:\n logger.debug('Received response:\\n%s', response.content)\n try:\n response.raise_for_status()\n if not response.json()['status']:\n _report_failure('your e-mail address appears to be invalid')\n except requests.exception...
[ "0.7398724", "0.71681416", "0.70833945", "0.6775973", "0.6673803", "0.6660222", "0.665737", "0.6648107", "0.66422635", "0.6605365", "0.6600216", "0.6585923", "0.6530984", "0.6530839", "0.6504101", "0.6499421", "0.6488651", "0.64776295", "0.64576936", "0.6456871", "0.6422239",...
0.6445502
20
This function converts a segmentation mask to a onehot encoded version
def get_one_hot(self, mask_slice): mask_one_hot = self.map_vert_to_class(mask_slice).reshape(-1, 1) self.one_hot_encoder.fit(mask_one_hot) mask_one_hot = self.one_hot_encoder.transform(mask_one_hot).toarray() # set 1st dim to num classes mask_one_hot = np.transpose(mask_one_hot, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encoding(mask: typing.Any, classes: typing.List[int]):\n raise TypeError(\"Mask should be either np.ndarray of torch.Tensor\")", "def binary_to_one_hot(arr: np.ndarray) -> np.ndarray:\n res = np.zeros((arr.shape[0], 2))\n res[np.where(arr == 1)[0], 0] = 1\n res[np.where(arr == 0)[0], 1] =...
[ "0.7464706", "0.7032775", "0.70228434", "0.69899994", "0.69584465", "0.6958401", "0.69303614", "0.6923459", "0.6914034", "0.68933815", "0.68916476", "0.68892264", "0.68866897", "0.68721896", "0.6867728", "0.68463516", "0.6792192", "0.67787373", "0.6777861", "0.6775648", "0.67...
0.7079161
1
Calculate all primes up to limit using the sieve of Eratosthenes method utilizing numpy arrays and methods
def eratosthenes_np(limit): if isinstance(limit, (int, float)): limit = int(limit) else: raise ValueError mask = np.ones(limit+1, dtype=np.bool) mask[:2] = False for i in range(2, int(np.sqrt(limit))+1): if mask[i]: mask[i*i::i] = False return np.nonzero(mask)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eratosthenes(limit):\n if isinstance(limit, (int, float)) and limit == int(limit):\n limit = int(limit)\n else:\n raise ValueError\n primes = []\n mask = [1]*(limit+1)\n for i in range(2, limit+1):\n if mask[i]:\n primes.append(i)\n for j in range(i*i, ...
[ "0.7992336", "0.7909294", "0.7712548", "0.7400638", "0.73392034", "0.7270079", "0.72225815", "0.72037303", "0.71615726", "0.7113354", "0.7088446", "0.70873755", "0.7083947", "0.70722246", "0.70629865", "0.7048688", "0.70477164", "0.7042445", "0.7023456", "0.6998842", "0.69970...
0.7299943
5
Calculate all primes up to limit using the sieve of Eratosthenes method utilizing numpy arrays and methods, trying to conserve memory
def eratosthenes_npo(limit): if isinstance(limit, (int, float)): limit = int(limit) else: raise ValueError mask = np.ones(limit//2, dtype=np.bool) for i in range(3, int(limit**0.5)+1, 2): if mask[i//2]: mask[i*i//2::i] = False return np.r_[2, 2*np.nonzero(mask)[0]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eratosthenes_mem(limit):\n if isinstance(limit, (int, float)) and limit == int(limit):\n limit = int(limit)\n else:\n raise ValueError\n primes = [2]\n multiples = [2]\n limit += 1\n for candidate in range(3, limit):\n if candidate not in multiples:\n primes.ap...
[ "0.81197673", "0.79916984", "0.78075534", "0.7505316", "0.7406559", "0.735463", "0.73453736", "0.7327509", "0.7276104", "0.7251672", "0.72084326", "0.7208323", "0.7171149", "0.7153772", "0.7151581", "0.7126833", "0.7097478", "0.70838034", "0.70822394", "0.7057637", "0.7049681...
0.6990677
35
Computes dh w.r.t. dw, db, dcx, dhx, dx.
def lstmcell_grad_h(input, hx, cx, w_ih, w_hh, b_ih, b_hh, dh, dc, target="cce"): # things from fwd batch, input_size = get_shape(input) _, hidden_size = get_shape(hx) xh = akg.topi.concatenate((hx, input), 1) whl = [w_ih, w_hh] W = Concat(whl, 1) # [4*hidden_size, input_size+hidden_size] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ddm(self):\n return hp2ddm(self.hp_angle)", "def dgdx(self, X):\n \n return 2*(X[0]) - 2", "def derivcd4(vals, dx):\n deriv = []\n for i in range(2):\n deriv.append((-3*vals[i] + 4*vals[i+1] - vals[i+2]) / (2*dx))\n for i in range(2, len(vals) - 2):\n deriv.appen...
[ "0.64852047", "0.6477711", "0.6462607", "0.635886", "0.63515806", "0.6321939", "0.6248424", "0.6246327", "0.6186997", "0.61609703", "0.6160334", "0.61412215", "0.6130756", "0.60825366", "0.60670483", "0.6017121", "0.60134906", "0.6001335", "0.59953654", "0.59953654", "0.59807...
0.0
-1
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8194862", "0.80949175", "0.8029915", "0.8019153", "0.79941195", "0.7991258", "0.7980955", "0.7976606", "0.79610753", "0.79590565", "0.79378676", "0.7934962", "0.7934504", "0.79313844", "0.7926313", "0.7924577", "0.79241234", "0.7923211", "0.7923023", "0.7921931", "0.791787...
0.0
-1
Haversine formula to calculate the distance between two points
def getDistance(point1, point2): """Convert in radians""" lat1 = radians(point1.getLatitude()) lon1 = radians(point1.getLongitude()) lat2 = radians(point2.getLatitude()) lon2 = radians(point2.getLongitude()) d_lon = lon2 - lon1 d_lat = lat2 - lat1 """App...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def haversine(lon1, lat1, lon2, lat2): \r\n lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) \r\n #print 34\r\n dlon = lon2 - lon1 \r\n dlat = lat2 - lat1 \r\n a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2 \r\n c = 2 * atan(sqrt(a)/sqrt(1-a)) \r\n r = 637...
[ "0.815167", "0.7946265", "0.78728384", "0.7866806", "0.7842053", "0.7805471", "0.77952105", "0.7792028", "0.77653587", "0.77413654", "0.77328813", "0.7727324", "0.7710586", "0.77097833", "0.77033585", "0.7695762", "0.7694342", "0.7689911", "0.7684215", "0.7684118", "0.7675206...
0.0
-1
Subclass this method in a platform module to configure an LED. This method should return a reference to the LED's platform interface object which will be called to access the hardware.
def configure_led(self, config, channels): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_switch(self, number: str, config: SwitchConfig, platform_config: dict) -> \"SwitchPlatformInterface\":\n raise NotImplementedError", "def __init__(self, device):\n methods = ['on', 'off', 'toggle']\n if all(m in dir(device) for m in methods):\n self._impl = device\n ...
[ "0.6641828", "0.65736413", "0.6460057", "0.6397714", "0.620894", "0.6207697", "0.61761826", "0.5883481", "0.58704567", "0.58704567", "0.58674765", "0.5831515", "0.5828792", "0.58179885", "0.58175516", "0.57586664", "0.5751355", "0.5748864", "0.574557", "0.57433003", "0.574034...
0.5822536
13
Returns a list of constants that do not occur in eq already.
def get_numbered_constants(self, num=1, start=1, prefix='C') -> list[Symbol]: ncs = self.iter_numbered_constants(start, prefix) Cs = [next(ncs) for i in range(num)] return Cs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_constants():\n return filter(\n lambda key: key.upper() == key and type(globals()[key]) in _ALLOWED,\n\n filter( # filter _PRIVATE variables\n lambda x: not x.startswith(\"_\"),\n globals()\n )\n )", "def Remove_constants(...
[ "0.6324319", "0.5895369", "0.582006", "0.57549465", "0.5729457", "0.56551546", "0.56386364", "0.5613856", "0.56071347", "0.55426955", "0.55078447", "0.54958916", "0.54677147", "0.5467097", "0.5455516", "0.54419833", "0.5401395", "0.5389544", "0.53751177", "0.5373783", "0.5365...
0.0
-1
Returns an iterator of constants that do not occur in eq already.
def iter_numbered_constants(self, start=1, prefix='C') -> Iterator[Symbol]: atom_set = self.eq.free_symbols func_set = self.eq.atoms(Function) if func_set: atom_set |= {Symbol(str(f.func)) for f in func_set} return numbered_symbols(start=start, prefix=prefix, exclude=atom_set...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_unsolved_cells(self) -> Iterable[Cell]:\n\t\treturn (\n\t\t\tcell\n\t\t\tfor cell in self\n\t\t\tif not cell.value()\n\t\t)", "def getEquates(self) -> Iterator[ghidra.program.model.symbol.Equate]:\n ...", "def __xor__(self, other):\n\n sym_diff = [value for value in self if value not in ...
[ "0.5731011", "0.56658673", "0.56519014", "0.56385195", "0.55685914", "0.5514159", "0.5513947", "0.5483818", "0.5463168", "0.5373391", "0.53559387", "0.53512216", "0.53047884", "0.5269318", "0.51905745", "0.5183834", "0.5177662", "0.51533836", "0.51530755", "0.51335204", "0.51...
0.55309266
5
Save the current pylab figure to a file and inserts a figure element into the notebook.
def pylab_savefig(self, filename=None, caption=None, type='png', **attribs): from matplotlib.pylab import savefig number = self.ipython_current_number() if filename is None: filename = '%s-%s.%s' % (self.name, number, type) savefig(filename) self.add_figure(os.path....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_plot(self, ):\n pass", "def save_fig(fig, filename):\n fig_filepath = figures_path / filename\n fig.write_image(str(fig_filepath))\n logging.info(f\"Written figure to {fig_filepath.resolve()}\")", "def subplot_to_figure(self):\n if self.format is \"show\":\n plt.show(...
[ "0.6759438", "0.6731989", "0.6640216", "0.66177183", "0.6613351", "0.6595994", "0.6580543", "0.6480672", "0.6404133", "0.6401536", "0.639745", "0.6391997", "0.6355489", "0.6355487", "0.6350751", "0.6298951", "0.62712073", "0.6265991", "0.62354624", "0.62350345", "0.6234987", ...
0.7195282
0
function to get indices for unfold and unfold
def get_indices(input_shape, kernel_size=(3,3), stride=(1,1), padding=(0,0)): batch_size, in_chan, in_height, in_width = input_shape out_height = (in_height + 2 * padding[0] - kernel_size[0])// stride[0] + 1 out_width = (in_width + 2 * padding[1] - kernel_size[1])// stride[1] + 1 i0 = np.repeat(np.ara...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_split_indices(self):\n\n cumsum = np.cumsum(\n np.concatenate((np.array([0], dtype=np.int8), self.split_sizes)))\n \n fold_inds = np.array(\n [(cumsum[n], cumsum[n + 1]) for n in range(self.n_splits)])\n\n return fold_inds", "def fold(nb_splits, dataset)...
[ "0.68412125", "0.64883584", "0.6145123", "0.6145123", "0.60725677", "0.5985566", "0.59739876", "0.59739876", "0.5962081", "0.59591424", "0.593875", "0.5938139", "0.59313697", "0.5929616", "0.59206855", "0.5912627", "0.5892535", "0.5833193", "0.58301216", "0.5759169", "0.57371...
0.53846127
64
Pretend it is a vector, return magnitude
def magnitude(self): return math.sqrt(self.x**2 + self.y**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnitude(v: Vector) -> float:\n return math.sqrt(sum_of_squares(v)) #math.sqrt() is a square root function", "def magnitude(v):\n if len(v.arr) != 4 or v[3] != 0.0:\n raise ValueError(\"Only use this function with vectors.\")\n return np.sqrt(np.sum(np.square(v.arr)))", "def magnitude(v: V...
[ "0.83212495", "0.82795614", "0.82095546", "0.8184698", "0.8156178", "0.7991793", "0.79893816", "0.7858376", "0.7829627", "0.77027106", "0.76909196", "0.76669794", "0.7621764", "0.75843215", "0.75431645", "0.74838066", "0.73868483", "0.73465514", "0.733537", "0.73240113", "0.7...
0.71391016
27
r"""Test ipcrm_queues if IPC library is not installed.
def test_ipcrm_queues_not_isntalled(): # pragma: windows IPCComm.ipcrm_queues()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ipc_queues():\n IPCComm.ipc_queues()", "def test_ipcrm_queues():\n IPCComm.ipcrm_queues()\n nt.assert_equal(len(IPCComm.ipc_queues()), 0)\n mq = IPCComm.get_queue()\n nt.assert_equal(len(IPCComm.ipc_queues()), 1)\n IPCComm.ipcrm_queues(str(mq.key))\n nt.assert_equal(len(IPCComm.ipc_...
[ "0.8008137", "0.7720549", "0.7641696", "0.70068365", "0.6380621", "0.61851704", "0.61425763", "0.60028666", "0.59536433", "0.5861993", "0.5858062", "0.5767807", "0.5748083", "0.5646327", "0.56084925", "0.5569209", "0.556616", "0.55529207", "0.55467355", "0.55287415", "0.54757...
0.7927601
1
r"""Test raise of an error if a IPC library is not installed.
def test_not_running(): # pragma: windows comm_kwargs = dict(comm='IPCComm', direction='send', reverse_names=True) nt.assert_raises(RuntimeError, new_comm, 'test', **comm_kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_install_subprocess_error_should_fail(self, *args):\n manifest = self.generate_mock_manifest(cfg={\n EXTCFG_SECTION.INSTALL: {\n EXTCFG_OPTION.EXEC_EXT_CMD: ['command'],\n }\n })\n ext_manager = PkgInstExtrasManager(manifest)\n with pytest.ra...
[ "0.6537753", "0.6441889", "0.6415946", "0.6373139", "0.6369227", "0.6304067", "0.62745816", "0.6266385", "0.61608016", "0.6136231", "0.6126578", "0.6120205", "0.6101033", "0.6034754", "0.60344476", "0.6021366", "0.6003013", "0.59750104", "0.5969304", "0.59662056", "0.5963332"...
0.71670264
0
Gets the worksheet column names The the name of the worksheet is in the `excelSheetName` member of `self.settings`
def get_columns(self) -> list or None: if self.connected and self.settings.excelSheetName: cursor = self.workbook.cursor() if cursor: columns = [] for row in cursor.columns(self.settings.excelSheetName): columns.append(row['column_name'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_columns(worksheet):\n if worksheet.id in WORKSHEET_COLUMN_CACHE:\n return list(WORKSHEET_COLUMN_CACHE[worksheet.id])\n\n columns = worksheet.row_values(1)\n WORKSHEET_COLUMN_CACHE[worksheet.id] = columns\n\n return list(columns)", "def getColumnsNames(self):\r\n ColsName = []\r\...
[ "0.70292157", "0.67439514", "0.67346174", "0.6641707", "0.6615929", "0.6541085", "0.64410496", "0.6435658", "0.6428676", "0.6342918", "0.6327007", "0.6257687", "0.62535757", "0.6233388", "0.6198362", "0.6192271", "0.6188859", "0.6163422", "0.61477065", "0.61360264", "0.611417...
0.75815916
0
Warns that the supplied parameter has an Opt2Qincompatible format. In this case, the simulator can still return simulation results, but they may not have a format compatible for use with other Opt2Q functions.
def incompatible_format_warning(_var): warnings.warn( 'The supplied {} may not be formatted for use in other Opt2Q modules. Proceeding anyway.'.format(_var), category=IncompatibleFormatWarning)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_format(self):\n raise NotImplementedError()", "def test_buoy_format2():\n with pytest.raises(AssertionError) as err_info:\n Check_BuoyDC.check_buoy_format(buoy_format_fail_2)\n assert str(err_info.value) == 'Input length incorrect, see instructions'", "def test_load_do_not_conv...
[ "0.52853954", "0.5262143", "0.52332765", "0.5100626", "0.5096792", "0.50936174", "0.50696886", "0.50607574", "0.5059825", "0.50295365", "0.50286955", "0.5025042", "0.5012817", "0.50059515", "0.49987686", "0.4997985", "0.4997217", "0.49804184", "0.49583432", "0.49350727", "0.4...
0.68449926
0
distance(SALOMERuntime_PySwigIterator self, SALOMERuntime_PySwigIterator x) > ptrdiff_t
def distance(self, *args): return _SALOMERuntime.SALOMERuntime_PySwigIterator_distance(self, *args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(self, x):\n return _elas.SwigPyIterator_distance(self, x)", "def distance(self, *args):\n return _libsbml.SwigPyIterator_distance(self, *args)", "def __ne__(self, *args):\n return _SALOMERuntime.SALOMERuntime_PySwigIterator___ne__(self, *args)", "def __ne__(self, x):\n ...
[ "0.66222537", "0.63891274", "0.606281", "0.5909859", "0.5880196", "0.57178473", "0.5664775", "0.5646779", "0.563074", "0.5559446", "0.5538745", "0.5407855", "0.53745323", "0.5262236", "0.52026165", "0.5101843", "0.51013815", "0.5094972", "0.5058925", "0.5026778", "0.5002912",...
0.6866537
0
__eq__(SALOMERuntime_PySwigIterator self, SALOMERuntime_PySwigIterator x) > bool
def __eq__(self, *args): return _SALOMERuntime.SALOMERuntime_PySwigIterator___eq__(self, *args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, x):\n return _elas.SwigPyIterator___eq__(self, x)", "def __eq__(self, *args):\n return _libsbml.SwigPyIterator___eq__(self, *args)", "def equal(self, *args):\n return _SALOMERuntime.SALOMERuntime_PySwigIterator_equal(self, *args)", "def equal(self, x):\n return _e...
[ "0.8034055", "0.78556937", "0.7784427", "0.7555337", "0.74281204", "0.73822355", "0.7068573", "0.6824058", "0.6813078", "0.66771525", "0.65417016", "0.6496761", "0.6472789", "0.64449835", "0.64324296", "0.64121634", "0.63816386", "0.63360125", "0.63296485", "0.62931377", "0.6...
0.8202956
0