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
Returns the WA status of this Nation
def wa(self) -> str: return self.shards("wa")["unstatus"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Status(self):\r\n\t\treturn self._get_attribute('status')", "def state(self):\n return self._attributes['status']", "def Status(self):\n return self._get_attribute('status')", "def status(self):\n return status_dict[self._get_property_(self.STATUS).upper()]", "def get_status(self):...
[ "0.6768534", "0.66159433", "0.6612813", "0.6595363", "0.6521242", "0.65095884", "0.64661515", "0.64661515", "0.64661515", "0.64247304", "0.64232576", "0.6416275", "0.64156187", "0.63904196", "0.63889587", "0.63815165", "0.6381135", "0.637972", "0.63796276", "0.6375453", "0.63...
0.6774994
0
Retrieve the endorsements of this Nation.
def endorsements(self) -> t.Sequence[str]: return self.shards("endorsements")["endorsements"].split(",")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self) -> list:\n return self.__expedition", "def organizations(self):\n self.elements('organizations')", "def get_organizations(\n self, *, params: Optional[dict] = None\n ) -> \"resource_types.Organizations\":\n\n return communicator.Organizations(self.__requester).fetch...
[ "0.57103807", "0.5530545", "0.5396151", "0.53852755", "0.53021395", "0.51522493", "0.51458657", "0.5119742", "0.5107933", "0.5084954", "0.5053162", "0.50268716", "0.5008801", "0.4984235", "0.49156225", "0.4907943", "0.4894724", "0.48776197", "0.48706213", "0.48514825", "0.484...
0.7383385
0
Returns a RegionStandard object for this Region
def standard(self) -> RegionStandard: return RegionStandard.from_xml( as_xml(self.requester.parameter_request(region=self.name).text) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def standard(self) -> NationStandard:\n return NationStandard.from_xml(\n as_xml(self.requester.parameter_request(nation=self.name).text)\n )", "def to_region(self):\n\n coords = self.convert_coords()\n log.debug(coords)\n viz_keywords = ['color', 'dash', 'dashlist',...
[ "0.6719687", "0.62010175", "0.6193773", "0.60774535", "0.60255605", "0.6025188", "0.6010844", "0.5978403", "0.58916295", "0.5840244", "0.5840244", "0.5759149", "0.5727569", "0.5705467", "0.5638794", "0.56112015", "0.5607099", "0.55876106", "0.5585788", "0.55783194", "0.553535...
0.83791155
0
Return the pint Unit for the DataArray units.
def units2pint(value: str) -> u.Unit: def _transform(s): """Convert a CF-unit string to a pint expression.""" return re.subn(r"\^?(-?\d)", r"**\g<1>", s)[0] value = value.replace("%", "pct") try: # Pint compatible return u.parse_expression(value).units except ( pint.Un...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit_number(self) -> int:\n return self._unit * -1", "def get_unit(self):\n return self.unit", "def unit_of_measurement(self):\n return self.values.primary.units", "def unit_of_measurement(self):\n return self._metadata[1]", "def unit_array(self):\n return self._data_...
[ "0.68680775", "0.68362236", "0.68282676", "0.6728184", "0.6618719", "0.66152424", "0.66152424", "0.6597463", "0.65777653", "0.65626305", "0.6561381", "0.65598136", "0.6549427", "0.64446604", "0.64446604", "0.64283067", "0.6406962", "0.6406943", "0.6363658", "0.6352449", "0.63...
0.0
-1
Returns value of this day playing time in seconds.
def _getDailyPlayHours(self): if self.isSessionStartedThisDay(): return self.__stats.dailyPlayHours[0] + (time_utils._g_instance.serverUTCTime - self.__sessionStartedAt) else: return self.__stats.dailyPlayHours[0] + time_utils._g_instance.serverRegionalTime % 86400
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seconds(self):\n return int(self)", "def t_sec(self):\n return self.t/self.parameters['time_conversion']", "def seconds(self):\n return self._seconds", "def seconds(self):\n return self._seconds", "def seconds(self):\n end = self.end or timezone.now()\n result ...
[ "0.7637468", "0.7599187", "0.7450755", "0.7450755", "0.7437828", "0.7405899", "0.7378319", "0.7326289", "0.7312681", "0.72954136", "0.7256252", "0.72547185", "0.7182789", "0.7169003", "0.71615976", "0.7148273", "0.7094757", "0.7086902", "0.69782484", "0.6930842", "0.6856224",...
0.0
-1
Returns value of this week playing time in seconds.
def _getWeeklyPlayHours(self): serverRegionalSettings = BigWorld.player().serverSettings['regional_settings'] weekDaysCount = account_shared.currentWeekPlayDaysCount(time_utils._g_instance.serverUTCTime, serverRegionalSettings['starting_time_of_a_new_day'], serverRegionalSettings['starting_day_of_a_new_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def t_sec(self):\n return self.t/self.parameters['time_conversion']", "def get_time(self) -> float:\n return self.player.time", "def seconds(self):\n return int(self)", "def get_time(self):\n return self.get_timed() / 10.0", "def seconds(self):\n end = self.end or timezon...
[ "0.7146427", "0.7135009", "0.7089977", "0.70859027", "0.68732214", "0.68485093", "0.68389714", "0.68237275", "0.68191594", "0.6696634", "0.66958416", "0.6675241", "0.6675241", "0.667416", "0.6672201", "0.6667377", "0.6652159", "0.66350937", "0.6632533", "0.6626778", "0.660061...
0.60451084
97
Get the current system configuration.
def discover(self): # Get the Huge Page configuration self.get_hugepages() # Get the device configuration self.get_devices_per_node() # Get the CPU configuration self.get_cpu() # Get the current grub cmdline self.get_grub()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config(self):\n return self[CONFIG_KEY]", "def get_config():\n return _CONFIG", "def get_config():\n return CONFIG", "def get_config(self):\n return self.config", "def getConfig(self):\n \n return self.config", "def get_config():\n return _config", "def _get_con...
[ "0.75642705", "0.74617445", "0.74575794", "0.74097395", "0.73682487", "0.73081577", "0.7296521", "0.7296521", "0.7296521", "0.7296521", "0.7296521", "0.7296521", "0.7296521", "0.7296521", "0.7296521", "0.7296521", "0.7296521", "0.7296521", "0.7296521", "0.7296521", "0.7296521...
0.0
-1
Prepare dataset for training Args
def prepare_train_dataset(name, reso, batch_size=32): transform = transforms.Compose([ transforms.RandomResizedCrop(size=reso, interpolation=3), transforms.ColorJitter(brightness=1.5, saturation=1.5, hue=0.2), transforms.RandomVerticalFlip(), transforms.ToTensor() ]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_data_for_training(args):\n # Form the train/test splits and write them to disk\n dataset = data.Dataset(args)\n # get image classes and image counts in each class\n label_map = dataset.get_class_info()\n class_count = len(list(label_map.values()))\n # split the data and store it in lo...
[ "0.7830734", "0.7599146", "0.7502297", "0.74156016", "0.736024", "0.7244582", "0.7243371", "0.71790385", "0.71667564", "0.7094238", "0.7058129", "0.70443743", "0.70266944", "0.6967939", "0.69281125", "0.691767", "0.6906663", "0.67141515", "0.6709303", "0.67014843", "0.6661476...
0.6699363
20
Fetch a database object via SQLAlchemy.
def fetch_db_object(cls: ClassVar, body: Any): if body is None: item = None elif isinstance(body, cls): item = body elif isinstance(body, Dict): if "id" not in body: raise AttributeError(f"id not found in {body}") id = body["id"] item = session_.query(cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n\n \n\n try:\n db = getDatabase()\n connection = db.connect()\n\n connection.get(self)\n\n except Exception as e:\n raise e\n finally:\n db.dispose()", "async def get_object(conn: Database, query):\n return await c...
[ "0.66394883", "0.6494628", "0.6488872", "0.6354728", "0.63217825", "0.6317714", "0.6315808", "0.6301033", "0.62401026", "0.61215943", "0.6114903", "0.6085064", "0.6078507", "0.6056773", "0.6051809", "0.6050493", "0.60407203", "0.6038177", "0.5998006", "0.5951702", "0.5950476"...
0.58528817
29
Converts pendulum.DateTime into UTC object.
def to_datetime_utc(obj: Union[None, pendulum.DateTime, str]) -> Union[pendulum.DateTime, None]: if isinstance(obj, pendulum.DateTime): return obj.in_tz(tz="UTC") elif isinstance(obj, str): dt = pendulum.parse(obj) return dt.in_tz(tz="UTC") elif obj is None: return None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_utc(dt):\n if dt.tzinfo is None:\n return dt.replace(tzinfo=pytz.utc)\n else:\n return dt.astimezone(pytz.utc)", "def to_utc(dt):\n time_tuple = time.gmtime(time.mktime(dt.timetuple()))\n return datetime.datetime(*time_tuple[0:6])", "def tz_as_utc(dt: datetime) -> datetime:\n ...
[ "0.7058922", "0.6929302", "0.6916029", "0.69072026", "0.69072026", "0.69072026", "0.6862562", "0.6781867", "0.6724737", "0.6719598", "0.66437215", "0.66362655", "0.6619136", "0.6617206", "0.66142446", "0.6612627", "0.6608694", "0.66086143", "0.6606972", "0.6591908", "0.655125...
0.6904978
6
Computes the area of all the boxes.
def area(self) -> torch.Tensor: box = self.tensor area = (box[:, 2] - box[:, 0]) * (box[:, 3] - box[:, 1]) return area
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def box_area(boxes):\n return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])", "def box_area(boxes):\n return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])", "def area(boxes):\n y_min, x_min, y_max, x_max = np.split(boxes, 4, axis=-1)\n return np.squeeze((y_max - y_min) * (x_max ...
[ "0.8266955", "0.8266955", "0.8206058", "0.810532", "0.8051263", "0.8033477", "0.7974076", "0.7853367", "0.7848972", "0.7678939", "0.7502243", "0.7421511", "0.7391133", "0.7330886", "0.7318793", "0.7096697", "0.7093503", "0.700362", "0.6956545", "0.69442", "0.6927992", "0.69...
0.6755678
52
Yield a box as a Tensor of shape (4,) at a time.
def __iter__(self) -> Iterator[torch.Tensor]: yield from self.tensor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_boxes(self):\n boxes_all = []\n for level in range(self.min_level, self.max_level + 1):\n boxes_l = []\n for scale in range(self.num_scales):\n for aspect_ratio in self.aspect_ratios:\n stride = 2 ** level\n intermidate_scale = 2 ** (scale / float(self.num_sca...
[ "0.61383086", "0.5893003", "0.57934636", "0.57829696", "0.5607248", "0.55552095", "0.55450976", "0.5522797", "0.5506475", "0.54854673", "0.5443636", "0.54247755", "0.53750414", "0.53389025", "0.5314383", "0.52964604", "0.52817273", "0.5270994", "0.5262272", "0.5258326", "0.52...
0.53918827
12
Constructor. Initializes the NmTensorNameRegistry. Reserves the default 'loss' name.
def __init__(self): # Create the nmtensor_naming_dict # which contains a mapping of str to NMTensor.unique_name self._nmtensor_naming_dict = {"loss": "loss"} # Reserve keyname of 'loss' # Create a dict that maps unique_names to tensors for use with TrainingState.get_tensor() sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_loss(self):\n with tf.device('/cpu:0'):\n with tf.name_scope('loss'):\n self.loss = tf.reduce_mean(\n tf.nn.softmax_cross_entropy_with_logits(\n labels=self.labels_placeholder, \n logits=self.logits, name=...
[ "0.65355325", "0.65201133", "0.63662857", "0.6132207", "0.60445815", "0.57616985", "0.5706666", "0.5700148", "0.56841266", "0.5633543", "0.55858916", "0.55806524", "0.5580387", "0.55500937", "0.5546574", "0.5532835", "0.55298525", "0.5498791", "0.54704106", "0.54497975", "0.5...
0.7445258
0
Converts a container to a spaceseparated string.
def _to_space_separated_string(l): s = ''; for x in l: if len(s)>0: s += ' ' s += repr(x) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spacelist(listtospace, spacechar=\" \"):\n output = ''\n space = ''\n output += str(listtospace[0])\n space += spacechar\n for listnum in range(1, len(listtospace)):\n output += space\n output += str(listtospace[listnum])\n return output", "def collapse(L):\n output = \"\"\...
[ "0.5897939", "0.53247124", "0.53247124", "0.53247124", "0.53247124", "0.52949774", "0.52304965", "0.52141744", "0.5213261", "0.5177147", "0.5169006", "0.51510155", "0.5015278", "0.50122243", "0.49982578", "0.49942186", "0.49918306", "0.49903002", "0.49701023", "0.49693352", "...
0.6290015
0
r""" Return a string containing the Hrepresentation in cddlib's ine format.
def cdd_Hrepresentation(cdd_type, ieqs, eqns): ieqs = _set_to_None_if_empty(ieqs) eqns = _set_to_None_if_empty(eqns) num, ambient_dim = _common_length_of(ieqs, eqns) ambient_dim -= 1 s = 'H-representation\n' if eqns!=None: assert len(eqns)>0 n = len(eqns) s += "lineari...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cdd_Hrepresentation(self):\n return cdd_Hrepresentation(self._cdd_type, \n [i for i in self.inequalities()],\n [e for e in self.equation_generator()] )", "def repr(self, h):\n return(1.0 - h**self.ad)", "def __repr__(self):\n...
[ "0.7025016", "0.6509633", "0.61850214", "0.60343915", "0.5896414", "0.5884374", "0.58490986", "0.5801519", "0.579693", "0.57903636", "0.57889706", "0.57822424", "0.5778333", "0.5774312", "0.5771136", "0.57658184", "0.5763383", "0.57500917", "0.5691204", "0.56693494", "0.56622...
0.7171033
0
Returns the length of the representation data.
def __len__(self): return len(self._representation_vector)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self) -> int:\n if self.serialize_data:\n return len(self.data_address)\n else:\n return len(self.data_infos)", "def getLen(self):\n return len(self.data)", "def length(self):\n return len(self.data)", "def length(self):\n return len(self.d...
[ "0.84285057", "0.84224397", "0.8306152", "0.8306152", "0.8306152", "0.8246603", "0.8228574", "0.81836927", "0.8140855", "0.80608314", "0.80348", "0.80348", "0.80348", "0.8022426", "0.8022426", "0.8007244", "0.79690796", "0.7964973", "0.7964973", "0.7964973", "0.7964973", "0...
0.0
-1
r""" Returns the coefficient vector `A` in `A\vec{x}+b`.
def A(self): return self._representation_vector[1:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acoeff(self):\n return np.dot(self.mmi,np.dot(self.mmatrix.T,self.bvec))", "def coefA(x0,y0,x1,y1):\n return -(y1-y0)/(x1-x0)", "def scalar_vector_ext(alpha, v, a, b):\n return [alpha * v[0],\n alpha * v[0] * a + b]", "def coefC(x0,y0,x1,y1):\n return (x1*y0-x0*y1)/(x1-x0)", ...
[ "0.6487127", "0.6200018", "0.61887264", "0.6021786", "0.59536505", "0.59363806", "0.592247", "0.58880204", "0.5878437", "0.58377796", "0.58277684", "0.5805122", "0.57912624", "0.5781417", "0.5773192", "0.5772627", "0.5768203", "0.57543355", "0.57524586", "0.5750602", "0.57333...
0.0
-1
r""" Returns the constant `b` in `A\vec{x}+b`.
def b(self): return self._representation_vector[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constant_equation(funct):\n return funct + \"x\"", "def loc_eval(x, b):\r\n loc_est = 0\r\n for i in enumerate(b): loc_est+=i[1]*(x**i[0])\r\n return(loc_est)", "def get_b(self):\n return ((self.b_plus_bstar / self.n_pos) + (self.b_minus_bstar / self.n_neg)) / 2", "def _vB0(self,x):\n ...
[ "0.60010844", "0.5991505", "0.59718937", "0.59611386", "0.58366007", "0.57271534", "0.5716266", "0.5657437", "0.56378216", "0.5630788", "0.56223536", "0.56185055", "0.55930847", "0.55581474", "0.55565435", "0.55104935", "0.5507975", "0.5502621", "0.5496439", "0.548395", "0.54...
0.0
-1
Returns a generator for the incident Hrepresentation objects, that is, the vertices/rays/lines satisfying the (in)equality.
def incident(self): incidence_matrix = self.polyhedron().incidence_matrix() for V in self.polyhedron().Vrep_generator(): if incidence_matrix[V.index(), self.index()] == 1: yield V
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inequality_generator(self):\n for H in self.Hrepresentation():\n if H.is_inequality():\n yield H", "def incident(self):\n incidence_matrix = self.polyhedron().incidence_matrix()\n for H in self.polyhedron().Hrep_generator():\n if incidence_matrix[self...
[ "0.77754116", "0.70151", "0.70151", "0.6561432", "0.6382605", "0.57893103", "0.5776602", "0.5748545", "0.5738079", "0.5737969", "0.5692339", "0.5682993", "0.5618389", "0.55782557", "0.54999983", "0.5489162", "0.54794776", "0.5414852", "0.5407021", "0.5407021", "0.5380062", ...
0.66648674
4
Returns True since this is, by construction, an inequality.
def is_inequality(self): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return self <= other and self >= other", "def __eq__(self, other):\n return abs(self - other) < 10e-10", "def __eq__(self, other: 'LTL'):\n if self.formula == other.formula:\n return True\n implied_a = self >= other\n implied_b = self <= ...
[ "0.73918694", "0.7246016", "0.71810424", "0.7138526", "0.7128823", "0.70941985", "0.69961643", "0.6971562", "0.6922299", "0.6922299", "0.6914022", "0.6906384", "0.6903671", "0.6885709", "0.68856484", "0.6867292", "0.68635046", "0.6863378", "0.6847223", "0.6829796", "0.6824519...
0.0
-1
Tests whether the halfspace (including its boundary) defined by the inequality contains the given vertex/ray/line.
def contains(self, Vobj): try: if Vobj.is_vector(): # assume we were passed a point return self.polyhedron()._is_nonneg( self.eval(Vobj) ) except AttributeError: pass if Vobj.is_line(): return self.polyhedron()._is_zero( self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, line):\n \n return abs( 1 - np.dot(sm.unitvec(self.vec), sm.unitvec(line.vec))) < 10*_eps", "def has_vertex(self, x, y):\n\n return min(x, y) > 0 and x <= self.width and y <= self.height", "def isOnInteriorSide(self, v):\n n = self.normalVect()\n return n.dot...
[ "0.65375763", "0.6494872", "0.64917046", "0.63348883", "0.6322285", "0.62746125", "0.6242936", "0.6224651", "0.6217025", "0.617891", "0.6134053", "0.6134053", "0.6120129", "0.61068463", "0.61016506", "0.6087731", "0.60523325", "0.60460985", "0.60338795", "0.6031744", "0.60272...
0.57066286
63
Tests whether the interior of the halfspace (excluding its boundary) defined by the inequality contains the given vertex/ray/line.
def interior_contains(self, Vobj): try: if Vobj.is_vector(): # assume we were passed a point return self.polyhedron()._is_positive( self.eval(Vobj) ) except AttributeError: pass if Vobj.is_line(): return self.polyhedron()._is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isOnInteriorSide(self, v):\n n = self.normalVect()\n return n.dotProduct(vector(self.vertices[0]) - vector(v)) > 0", "def relative_interior_contains(self, point):\n try:\n p = vector(point)\n except TypeError: # point not iterable or no common ring for elements\n ...
[ "0.6838345", "0.6757653", "0.6745546", "0.64965737", "0.6360816", "0.6345297", "0.6345297", "0.63183767", "0.6300664", "0.62431955", "0.6223511", "0.6203222", "0.60858405", "0.6073887", "0.6030192", "0.6028625", "0.6025482", "0.5995523", "0.5995523", "0.59883946", "0.5979223"...
0.6858966
0
Initializes an equation object.
def __init__(self, polyhedron, data): super(Equation, self).__init__(polyhedron, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, equation_dict):\n self.equation = equation_dict['equation']\n self.variables = equation_dict['variables']\n self.dict = equation_dict\n self.x = list(self.variables)[-1]['variable'] # The variable to solve for", "def __init__(self, linearExpression, indexingExpressi...
[ "0.7227892", "0.70712614", "0.6835836", "0.6835836", "0.67892283", "0.6724007", "0.66772604", "0.6618359", "0.6544848", "0.64240783", "0.6405583", "0.6405259", "0.62852526", "0.6235831", "0.62149554", "0.6207066", "0.6203512", "0.6203512", "0.6198402", "0.61921614", "0.619216...
0.6678264
6
A string representation of this object.
def _repr_(self): s = 'An equation ' have_A = not self.A().is_zero() if have_A: s += repr(self.A()) + ' x ' if self.b()>=0: if have_A: s += '+' else: s += '-' if have_A: s += ' ' s += repr(abs(self.b(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self):\n\n\t\treturn str(self)", "def serialize(self):\n\n return str(self)", "def as_string(self):\n return self.__repr__()", "def to_string(self):\r\n return self.__str__()", "def __str__(self):\n return str(self.serialize())", "def __repr__(self) -> str:\n ...
[ "0.8801228", "0.8777879", "0.87296486", "0.86189115", "0.8576259", "0.8560595", "0.85511076", "0.85087925", "0.85087925", "0.85087925", "0.85087925", "0.85087925", "0.85087925", "0.85087925", "0.85087925", "0.85087925", "0.85087925", "0.85087925", "0.85087925", "0.85087925", ...
0.0
-1
Tests whether the interior of the halfspace (excluding its boundary) defined by the inequality contains the given vertex/ray/line.
def interior_contains(self, Vobj): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interior_contains(self, Vobj):\n try:\n if Vobj.is_vector(): # assume we were passed a point\n return self.polyhedron()._is_positive( self.eval(Vobj) ) \n except AttributeError:\n pass\n \n if Vobj.is_line(): \n return self.pol...
[ "0.6858369", "0.68386346", "0.6758325", "0.6745028", "0.64974236", "0.6362578", "0.63459367", "0.63459367", "0.63198173", "0.62997174", "0.6244368", "0.6224621", "0.62050766", "0.60856944", "0.60730696", "0.60290784", "0.6028484", "0.6026358", "0.5986969", "0.59803355", "0.59...
0.59952885
19
Returns True if the object is a line of the Vrepresentation. This method is overridden by the corresponding method in the derived class Line.
def is_line(self): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_line(self):\n return True", "def is_line(self):\n return True", "def _isLine(self):\n return (self.width == 0 and self.height > 1) or (self.height == 0 and self.width > 1)", "def _isLine(self):\n return (self.width == 0 and self.height > 1) or (self.height == 0 and self.wid...
[ "0.73890924", "0.73890924", "0.7340938", "0.7340938", "0.71303767", "0.6722245", "0.6675775", "0.6626746", "0.6536196", "0.6347503", "0.63393676", "0.63393676", "0.6264747", "0.6248791", "0.6223906", "0.6164967", "0.61352175", "0.6092453", "0.6020981", "0.60133064", "0.601330...
0.7012089
5
Initializes a ray object.
def __init__(self, polyhedron, data): super(Ray, self).__init__(polyhedron, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, initial_direction, initial_position,\n initial_element=None, jitter=None):\n if jitter is not None:\n initial_direction = normalize(initial_direction)\n initial_direction += np.linalg.inv(\n rotation_matrix_arrays(initial_direction)).dot(array(\n [np.rando...
[ "0.69556904", "0.61580163", "0.6071904", "0.6071605", "0.60236895", "0.59356415", "0.5925378", "0.5866671", "0.58082825", "0.5807278", "0.5807278", "0.5685588", "0.567752", "0.5667549", "0.56660926", "0.56634617", "0.56585777", "0.56549776", "0.56221914", "0.5598809", "0.5577...
0.72872376
0
Tests if this object is a ray. Always True by construction.
def is_ray(self): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ray(self):\n return False", "def is_ray(self): \n return False", "def is_intersecting(self, ray):\n\n intersecting_point = self._sympy_plane.intersection(ray.sympy_line)[0]\n\n if 'x' in self._name:\n\n if self._within_y_bounds(intersecting_point.y) and self...
[ "0.76152766", "0.7405027", "0.62074465", "0.62074393", "0.6090226", "0.5951388", "0.5738135", "0.56904054", "0.5686524", "0.55778086", "0.55746454", "0.55088705", "0.54987615", "0.54564613", "0.5426838", "0.5402613", "0.54001117", "0.5375659", "0.53559256", "0.53277266", "0.5...
0.7633362
1
Initializes the line object.
def __init__(self, polyhedron, data): super(Line, self).__init__(polyhedron, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init():\n line.set_data([], [])\n return line,", "def __init__(self, line):\n self.start = LineAndColumn(line, 1)\n self.end = LineAndColumn(line, 0)", "def __init__(self, vertices, **kwargs):\n super(Line, self).__init__(vertices, **kwargs)\n self._geotype = \"Li...
[ "0.84372175", "0.78776747", "0.7551069", "0.74867105", "0.7359488", "0.7303538", "0.72724557", "0.7115625", "0.7032113", "0.6941985", "0.6934653", "0.6867855", "0.684687", "0.68130714", "0.66768235", "0.66596705", "0.6598061", "0.6553738", "0.6522616", "0.65075004", "0.649873...
0.6715231
14
Test whether ``self`` is not equal to ``other``.
def __ne__(self, other): return not self.__eq__(other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__ (self, other):\n return not self == other", "def __ne__(self, other):\n # type: (object) -> bool\n return not self == other", "def __ne__(self, other):\n # type: (object) -> bool\n return not self == other", "def __ne__(self, other):\n # type: (object) -> ...
[ "0.8864751", "0.88107824", "0.88107824", "0.88107824", "0.8681393", "0.8681393", "0.8681393", "0.8681393", "0.8681393", "0.8681393", "0.8681393", "0.8681393", "0.8681393", "0.8681393", "0.8681393", "0.8681393", "0.8681393", "0.8681393", "0.8681393", "0.8681393", "0.8681393", ...
0.0
-1
Return the number of inequalities. The representation will always be minimal, so the number of inequalities is the number of facets of the polyhedron in the ambient space.
def n_inequalities(self): try: return self._n_inequalities except AttributeError: self._n_inequalities = 0 for i in self.inequalities(): self._n_inequalities += 1 return self._n_inequalities
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_facets(self):\n return self.n_inequalities()", "def ieqs(self):\n return self.inequalities()", "def num_vertices(self):\n return self.n * (1 + int(self.variant.is_bipartite()))", "def n_equality_constraints(self):\n return len(self.equality_constraint_names())", "def inter...
[ "0.7486746", "0.6720966", "0.6699361", "0.6529423", "0.6479883", "0.63912666", "0.6385917", "0.6381133", "0.6371878", "0.63241106", "0.6292568", "0.62846744", "0.6282165", "0.62748075", "0.6268369", "0.62666416", "0.62624705", "0.62380004", "0.6203038", "0.61616063", "0.61432...
0.7330504
1
Return the number of rays. The representation will always be minimal.
def n_rays(self): try: return self._n_rays except AttributeError: self._n_rays = 0 for r in self.rays(): self._n_rays += 1 return self._n_rays
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_arcs(self):\n return sum(len(state) for state in self)", "def get_num_arcs(self):\n num_arcs = 0\n for node in self._nodes.values(): num_arcs += node._deg\n return (num_arcs / 2) + 1", "def get_num_arcs(self):\n num_arcs = 0\n for node in self._nodes.values(): ...
[ "0.6625876", "0.6484643", "0.6484643", "0.6460548", "0.6433843", "0.6398098", "0.6398098", "0.6381013", "0.637975", "0.63704294", "0.6351989", "0.63184094", "0.6276302", "0.6266939", "0.624038", "0.6232684", "0.6212521", "0.6209672", "0.620922", "0.62024295", "0.61683655", ...
0.85541546
0
Return the list of face indices (i.e. indices of Hrepresentation objects) and the indices of faces adjacent to them.
def facial_adjacencies(self): try: return self._facial_adjacencies except AttributeError: self._facial_adjacencies = \ [ [ h.index(), [n.index() for n in h.neighbors()] ] for h in self.Hrepresentation() ] return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indices(self):\n i, j, _edge = self.indicesAndEdge()\n return i, j", "def faces(self):\n return map(Face, self._top_exp.faces())", "def GetFaceToAdjacentFacesArray(self, p_int):\n ...", "def faces(self):\r\n return self._faces", "def get_faces(self):\n faces = ...
[ "0.72302914", "0.69233555", "0.6751035", "0.67152923", "0.663686", "0.6608183", "0.6528487", "0.6478386", "0.6475458", "0.64392626", "0.63634056", "0.63462484", "0.63267857", "0.6321245", "0.6290716", "0.6284525", "0.628107", "0.62765837", "0.6267598", "0.62525994", "0.622700...
0.6491585
7
Return a generator for the defining inequalities of the polyhedron.
def inequality_generator(self): for H in self.Hrepresentation(): if H.is_inequality(): yield H
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def incident(self):\n incidence_matrix = self.polyhedron().incidence_matrix()\n for V in self.polyhedron().Vrep_generator():\n if incidence_matrix[V.index(), self.index()] == 1:\n yield V", "def incident(self):\n incidence_matrix = self.polyhedron().incidence_matrix...
[ "0.62948394", "0.62948394", "0.622661", "0.622661", "0.5998201", "0.59693587", "0.5901525", "0.5601014", "0.5601014", "0.55649424", "0.5515636", "0.55103517", "0.5506875", "0.54729754", "0.5467234", "0.54668957", "0.5452751", "0.5452751", "0.5444854", "0.5400072", "0.5359835"...
0.67394197
0
Return a list of vertices of the polyhedron.
def vertices(self): try: return self._vertices except: self._vertices = [list(x) for x in self.vertex_generator()] return self._vertices
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vertices(self):\n return self.vertList.keys()", "def get_vertices(self):\n return list(self.vertices.keys())", "def vertices(self):\n return self.pointlist", "def get_vertices(self):\n return self._vertices", "def vertices(self):\n return self._vertices", "def v...
[ "0.789857", "0.7870564", "0.7856595", "0.7818817", "0.78175515", "0.7788121", "0.7773115", "0.7773115", "0.7768897", "0.7762729", "0.76782686", "0.76376724", "0.75767577", "0.750919", "0.7503351", "0.7472806", "0.74473894", "0.74199235", "0.7369322", "0.7342119", "0.73304594"...
0.80211544
0
Return a generator for the lines of the polyhedron.
def line_generator(self): for V in self.Vrepresentation(): if V.is_line(): yield V
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lines(self):\n for pair in pairs(self.points):\n yield Line(pair, shape=self)", "def generate_lines(self):\n x = self.square[0]\n y = self.square[1]\n lines = [[]]\n \n lines.append( ( (x, y+a) for a in range(1,8) ) )\n lines.append( ( (x+a, y) for ...
[ "0.7541046", "0.6764416", "0.654454", "0.6367951", "0.6355268", "0.6337704", "0.62785095", "0.62785095", "0.62135166", "0.6205329", "0.60971594", "0.60714114", "0.6063338", "0.60324633", "0.5966404", "0.5942463", "0.594133", "0.5906734", "0.5876801", "0.57959944", "0.5774716"...
0.75992817
0
Return the maximal distance from the center to a vertex. All rays and lines are ignored.
def radius(self): return sqrt(self.radius_square())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def radius(self):\n c = self.centroid()\n dmax = -np.inf\n for vertex in self.path.vertices:\n d = np.linalg.norm(vertex - c)\n if d > dmax:\n dmax = d\n return d", "def __compute_distance(self, x, centroid):\n \n diff = x - centroid\...
[ "0.6565694", "0.59782445", "0.59508884", "0.58959746", "0.5762129", "0.5746932", "0.5695137", "0.56922877", "0.56486505", "0.56279284", "0.5616114", "0.5580673", "0.5553547", "0.5523425", "0.55028015", "0.54849696", "0.54523873", "0.54247415", "0.5420174", "0.5386447", "0.538...
0.0
-1
Test whether the relative interior of the polyhedron contains the given ``point``.
def relative_interior_contains(self, point): try: p = vector(point) except TypeError: # point not iterable or no common ring for elements if len(point)>0: return False else: p = vector(self.field(), []) if len(p)!=self.ambient_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interior_contains(self, point):\n try:\n p = vector(point)\n except TypeError: # point not iterable or no common ring for elements\n if len(point)>0:\n return False\n else:\n p = vector(self.field(), [])\n\n if len(p)!=self.amb...
[ "0.7941701", "0.7777154", "0.7743703", "0.76257414", "0.76257414", "0.75868297", "0.7578391", "0.7552529", "0.73895067", "0.7387419", "0.7372237", "0.73581576", "0.7329602", "0.7296402", "0.7247164", "0.7246418", "0.7235826", "0.7191009", "0.7188732", "0.71793354", "0.7171237...
0.8135436
0
r""" Return whether the polyhedron is a simplex.
def is_simplex(self): return self.is_compact() and (self.dim()+1==self.n_vertices())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_simplex(self):\n return self.affine_dimension()+1==self.n_vertices()", "def is_lattice_polytope(self):\n try: \n return self._is_lattice_polytope\n except AttributeError:\n pass\n self._is_lattice_polytope = self.is_compact() and \\\n all(v.is_i...
[ "0.7512828", "0.6371464", "0.62173796", "0.61906195", "0.6048706", "0.57923305", "0.57752305", "0.5758563", "0.5756444", "0.5756444", "0.57197165", "0.5690659", "0.5658435", "0.5635977", "0.5621621", "0.56073844", "0.5595105", "0.5580728", "0.55669546", "0.5566237", "0.551891...
0.7685648
0
r""" Return the coordinates of a rectangular box containing the nonempty polytope.
def bounding_box(self, integral=False): box_min = [] box_max = [] if self.n_vertices==0: raise ValueError('Empty polytope is not allowed') for i in range(0,self.ambient_dim()): coords = [ v[i] for v in self.Vrep_generator() ] max_coord = max(coords) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounding_box(self):\n box_min = []\n box_max = []\n if self.is_empty():\n raise ValueError('empty polytope is not allowed')\n for i in range(0, self.space_dimension()):\n x = Variable(i)\n coords = [ v.coefficient(x) for v in self.generators() ]\n ...
[ "0.6519615", "0.6339789", "0.63274264", "0.6324819", "0.61964387", "0.61964387", "0.6195479", "0.6182804", "0.61821204", "0.6174799", "0.61715555", "0.61457324", "0.6141494", "0.61039114", "0.60471284", "0.6032216", "0.6030809", "0.60011816", "0.59963787", "0.59812605", "0.59...
0.5913238
24
Return the identity projection of the polyhedron.
def identity(self): return self.__call__(projection_func_identity)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_projection(self):\n return self.projection", "def projection(self):\n self.projection = Projection(self)\n return self.projection", "def projection(self) -> Projection:\n return self._projection", "def base_projection(self, fiber):\n return self.ambient_space().quot...
[ "0.6655671", "0.6596642", "0.6541243", "0.64065766", "0.6389707", "0.63852453", "0.63848984", "0.6357089", "0.6357089", "0.6270306", "0.62562454", "0.620448", "0.6156567", "0.61552703", "0.61385185", "0.6123231", "0.6103431", "0.60773915", "0.60773915", "0.60430855", "0.60322...
0.6947691
0
Convert a coordinate vector to its internal index.
def coord_index_of(self, v): try: return self.coords.index(v) except ValueError: self.coords.append(v) return len(self.coords)-1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _vector_index_to_node(v):\n _nodes = context._context._registered_leaf_nodes\n return Vector(\n index = [\n _nodes[uid_i] for uid_i in v._index\n ],\n value = v._value\n )", "def xy_to_index(x, y):\n index = y * columns + x\n return index", "def XYToIdx(cls, p...
[ "0.6739531", "0.6729268", "0.66497844", "0.65106064", "0.65045714", "0.6485774", "0.64387155", "0.6377138", "0.63669103", "0.63418996", "0.63297755", "0.62878597", "0.6266065", "0.62533367", "0.6192388", "0.61876", "0.61613524", "0.6110641", "0.603421", "0.6022502", "0.600941...
0.6305428
11
Convert list of coordinate vectors to the corresponding list of internal indices.
def coord_indices_of(self, v_list): return [self.coord_index_of(v) for v in v_list]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coordinates_of(self, coord_index_list):\n return [self.transformed_coords[i] for i in coord_index_list]", "def mapping_to_indices(coords, batch_size):\n h, w = coords.shape[:2]\n indices_axis_0 = list(np.repeat(np.arange(batch_size), h * w))\n indices_axis_1 = [0]\n indices_axis_2 = list(n...
[ "0.66926", "0.6676841", "0.6667212", "0.6661667", "0.6509132", "0.6410597", "0.6362403", "0.63112533", "0.62284756", "0.62228996", "0.6214185", "0.61771804", "0.6167081", "0.61659724", "0.6161895", "0.61021197", "0.6095236", "0.6091059", "0.6062591", "0.60592127", "0.6010393"...
0.78977
0
Given a list of indices, return the projected coordinates.
def coordinates_of(self, coord_index_list): return [self.transformed_coords[i] for i in coord_index_list]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proj_coords(coords, proj_in, proj_out): \n return [proj_coord(coord, proj_in, proj_out) for coord in coords]", "def coordinates(self, indices):\n\t\t\n\t\t# We expect a tuple\n\t\tif not type(indices) == tuple:\n\t\t\tindices = tuple((indices,))\n\n\t\tcoordinates = {}\n\t\tfor coordinate in self.coordina...
[ "0.71692306", "0.66773254", "0.6428989", "0.6285073", "0.62513804", "0.62001896", "0.61571616", "0.6126175", "0.61006975", "0.6032206", "0.59892875", "0.5955127", "0.59410596", "0.5879376", "0.5854081", "0.5854035", "0.582731", "0.5756893", "0.5741496", "0.57406324", "0.56967...
0.6810736
1
Take a ndimdimensional point and projects it onto the plane perpendicular to (1,1,...,1).
def project_1(fpoint): dim_n = len(fpoint) p_basis = [list(q) for q in Polytopes.orthonormal_1(dim_n)] out_v = [] for v in p_basis: out_v.append(sum([fpoint[ind]*v[ind] for ind in range(dim_n)])) return out_v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_point(self, point: array_like) -> Point:\n # Vector from the point in space to the point on the plane.\n vector_to_plane = Vector.from_points(point, self.point)\n\n # Perpendicular vector from the point in space to the plane.\n vector_projected = self.normal.project_vector(v...
[ "0.7998824", "0.76608586", "0.72045946", "0.717902", "0.6815165", "0.6727674", "0.6716035", "0.6681728", "0.66800654", "0.6643492", "0.6639512", "0.6632769", "0.6629137", "0.65985525", "0.6563293", "0.6534991", "0.6534991", "0.6503588", "0.6491678", "0.64784217", "0.6439208",...
0.0
-1
Converts spatialpandas geometry to an array.
def geom_to_array(geom, index=None, multi=False, geom_type=None): from spatialpandas.geometry import ( Point, Polygon, Line, Ring, MultiPolygon, MultiPoint ) if isinstance(geom, Point): if index is None: return np.array([[geom.x, geom.y]]) arrays = [np.array([geom.y if in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_geopandas(self):\n import geopandas\n import shapely\n\n return geopandas.GeoSeries(self.apply(lambda x: shapely.wkb.loads(x) if x is not None else None), crs=self.crs)", "def getMultiGeometry(geometry):\n geom = arcpy.Array()\n for feature in geometry:\n array = arcpy.Ar...
[ "0.68730795", "0.6433584", "0.6381958", "0.63811517", "0.63704556", "0.6337378", "0.62993824", "0.62957156", "0.6279921", "0.6219561", "0.6218168", "0.620726", "0.6196393", "0.6178507", "0.6147468", "0.60896987", "0.60584193", "0.6034679", "0.60345596", "0.6026241", "0.599429...
0.65537846
1
Returns an array of values from a GeoDataFrame.
def get_value_array(data, dimension, expanded, keep_index, geom_col, is_points, geom_length=geom_length): column = data[dimension.name] if keep_index: return column all_scalar = True arrays, scalars = [], [] for i, geom in enumerate(data[geom_col]): length = 1 if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geo_dataframe_to_list(data_frame, polygon=False):\n to_return = []\n for line in data_frame.geometry:\n lines = []\n if polygon:\n for values in line.exterior.coords:\n lines.append(values)\n else:\n for values in line.coords:\n lin...
[ "0.6998352", "0.668405", "0.6347639", "0.62543565", "0.6247667", "0.6247667", "0.6247667", "0.62407875", "0.62160283", "0.6212792", "0.6202825", "0.6150114", "0.61136127", "0.61017597", "0.6067834", "0.60404366", "0.60134566", "0.60110444", "0.5997468", "0.5996173", "0.599611...
0.6313751
3
Converts shapely based data formats to spatialpandas.GeoDataFrame.
def from_shapely(data): from spatialpandas import GeoDataFrame, GeoSeries from shapely.geometry.base import BaseGeometry if not data: pass elif all(isinstance(d, BaseGeometry) for d in data): data = GeoSeries(data).to_frame() elif all(isinstance(d, dict) and 'geometry' in d and isi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_geopandas(self):\n import geopandas\n import shapely\n\n return geopandas.GeoSeries(self.apply(lambda x: shapely.wkb.loads(x) if x is not None else None), crs=self.crs)", "def convert_to_geopandas(df):\n df['geometry'] = [Point(xy) for xy in zip(df.latitude, df.longitude)]\n crs...
[ "0.75003105", "0.73791826", "0.6911731", "0.6782298", "0.6771331", "0.67135185", "0.663679", "0.65817755", "0.65411407", "0.6499362", "0.64071214", "0.6318661", "0.62666494", "0.6256172", "0.6195745", "0.6191393", "0.6184474", "0.616019", "0.6123125", "0.61162794", "0.6111790...
0.77739555
0
Convert input to array First it tries with a normal `np.asarray(v)` if this does not work it tries with `np.asarray(v, dtype=object)`. The ValueError raised is because of an inhomogeneous shape of the input, which raises an error in numpy v1.24 and above. Reason why it is not located in holoviews.core.util is that ther...
def _asarray(v): try: return np.asarray(v) except ValueError: return np.asarray(v, dtype=object)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_array(self, v, t):\n return v.asnumpy()", "def to_numpy(self, v):\n raise NotImplementedError(\"to_numpy\")", "def _to_arraylike(data):\n _load_objects()\n if data is None:\n raise ValueError('Cannot convert None data.')\n return None\n if not isinstance(data, (...
[ "0.7442653", "0.73813874", "0.72445047", "0.7042579", "0.70074385", "0.6965784", "0.6942325", "0.6891042", "0.68243146", "0.6784853", "0.6783416", "0.67638856", "0.6741284", "0.6741284", "0.6717086", "0.6705295", "0.6695474", "0.664909", "0.66038394", "0.65845656", "0.657084"...
0.8708122
0
Given the name of a character which is either in the party or npc dictionaries, returns an Embed object with all of their relevant qualities.
def print_character(name): character = shared_functions.find_character(name) if not character: return discord.Embed(title="Invalid character") embed = discord.Embed(title=character["Name"], description=character["Backstory"], color=int(character["Color"], 16)) embed.add...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_char_embeddings(char_vocab, ds_name):\n n_char = len(char_vocab)\n pkl = './embeddings/%s_char.pkl' % ds_name\n if os.path.exists(pkl):\n print(\"Load character embeddings from %s...\" % pkl)\n embeddings = pickle.load(open(pkl, 'rb'))\n else:\n emb_path = './embeddings/ch...
[ "0.5712804", "0.51464844", "0.49255276", "0.47472054", "0.47143805", "0.46865404", "0.4675916", "0.46386784", "0.46310282", "0.46298936", "0.46293443", "0.46260893", "0.46087405", "0.45484588", "0.45470178", "0.4546674", "0.45326695", "0.4510449", "0.4506295", "0.4503416", "0...
0.57554096
0
Draw a Cesaro fractal of a given size and tear angle. Leave the turtle facing the same direction.
def koch(t, order, ang, size): turn = 90 - (ang/2) size = size - (size * math.sin(math.radians(ang/2))) if order == 0: # The base case is just a straight line t.forward(size) else: for i in [turn, -2*turn, turn, 0]: koch(t, order-1, ang, size/2) t.right(i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_housing_2():\r\n tom.pensize(3)\r\n tom.color(\"black\", \"darkgrey\")\r\n tom.begin_fill()\r\n tom.forward(80)\r\n tom.left(90)\r\n tom.forward(200)\r\n tom.circle(40, 180)\r\n tom.forward(200)\r\n tom.left(90)\r\n tom.end_fill()\r\n tom.hideturtle()", "def fermat_spira...
[ "0.62871194", "0.61871743", "0.6167432", "0.6117666", "0.6047338", "0.6028735", "0.6025765", "0.60138226", "0.59977967", "0.593579", "0.590026", "0.58954066", "0.58671343", "0.58655727", "0.58538604", "0.5840933", "0.58213925", "0.5814491", "0.57960355", "0.57945365", "0.5777...
0.0
-1
Depth images become an XYZ point cloud in the camera frame with shape (depth.shape[0], depth.shape[1], 3). Transform a depth image into a point cloud in the camera frame with one point for each pixel in the image, using the camera transform for a camera centred at cx, cy with field of view fx, fy.
def depth_image_to_point_cloud(depth, intrinsics_matrix, dtype=tf.float32): with K.name_scope('depth_image_to_point_cloud'): intrinsics_matrix = tf.to_float(intrinsics_matrix) fy = intrinsics_matrix[1, 1] fx = intrinsics_matrix[0, 0] # center of image y coordinate center_y = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_depth_frame_to_pointcloud(depth_image, camera_intrinsics ):\n\t\n\t[height, width] = depth_image.shape\n\n\tnx = np.linspace(0, width-1, width)\n\tny = np.linspace(0, height-1, height)\n\tu, v = np.meshgrid(nx, ny)\n\tx = (u.flatten() - camera_intrinsics.ppx)/camera_intrinsics.fx\n\ty = (v.flatten() - ...
[ "0.80365896", "0.8004296", "0.738188", "0.7208702", "0.71125513", "0.7000501", "0.6885599", "0.6861043", "0.6517396", "0.6516649", "0.6424528", "0.6278618", "0.61977667", "0.6159116", "0.6119891", "0.6098537", "0.6063711", "0.60531276", "0.6035595", "0.5999604", "0.5988224", ...
0.79800797
2
Creating a L{MessageSet} with a single message number adds only that message to the L{MessageSet}; its serialized form includes only that message number, its length is one, and it yields only that message number.
def test_createWithSingleMessageNumber(self): m = MessageSet(1) self.assertEqual(str(m), "1") self.assertEqual(len(m), 1) self.assertEqual(list(m), [1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _next_message_id(self):\n message_id = self.message_id\n self.message_id = 0xFFFF & (1 + self.message_id)\n return message_id", "def test_createWithSequence(self):\n m = MessageSet(1, 10)\n self.assertEqual(str(m), \"1:10\")\n self.assertEqual(len(m), 10)\n se...
[ "0.56720734", "0.56377935", "0.5461547", "0.53992957", "0.5237231", "0.5197883", "0.50825983", "0.5071917", "0.5035462", "0.50135237", "0.49754503", "0.4958392", "0.49482548", "0.49419698", "0.490668", "0.49025166", "0.48869318", "0.48784652", "0.48726654", "0.48685193", "0.4...
0.7036358
0
Helper to implement tests for value filtering of KEYWORD and UNKEYWORD queries.
def _keywordFilteringTest(self, keyword): # Check all the printable exclusions self.assertEqual( '(%s twistedrocks)' % (keyword.upper(),), imap4.Query(**{keyword: r'twisted (){%*"\] rocks'})) # Check all the non-printable exclusions self.assertEqual( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_queryKeywordFlag(self):\n self._keywordFilteringTest(\"keyword\")", "def test_queryUnkeywordFlag(self):\n self._keywordFilteringTest(\"unkeyword\")", "def test_filter_2(self):\n usernames = ['Kinder', 'Ken', 'Alan', 'Tracy']\n filter_dict = {'name-includes': 'Ken', 'locatio...
[ "0.75285655", "0.7350205", "0.6159008", "0.6148101", "0.60689", "0.6059504", "0.60467505", "0.59884334", "0.59767616", "0.59670675", "0.5954767", "0.59508795", "0.59089446", "0.58702534", "0.5862863", "0.58510625", "0.5838319", "0.57612795", "0.5748232", "0.5710095", "0.56724...
0.6474329
2
Return the mailbox's status.
def requestStatus(self, names): r = {} if 'MESSAGES' in names: r['MESSAGES'] = self.getMessageCount() if 'RECENT' in names: r['RECENT'] = self.getRecentCount() if 'UIDNEXT' in names: r['UIDNEXT'] = self.getMessageCount() + 1 if 'UIDVALIDITY' in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_status(self):\n return self.msg", "def GetStatus(self):\r\n return self.status", "def status(self):\n return STATUSES.get(self._mower_status, {}).get('message', self._mower_status)", "def get_status(self):\n return self._status", "def status(self):\n return self.get(s...
[ "0.728767", "0.7285613", "0.7262036", "0.72528285", "0.723259", "0.7218322", "0.7172397", "0.71493846", "0.71493846", "0.71493846", "0.71406925", "0.71102965", "0.7108937", "0.7104501", "0.70922923", "0.70782906", "0.7071757", "0.7056939", "0.70561194", "0.6980682", "0.697511...
0.0
-1
When a parsing method raises L{IllegalOperation}, the server sends a C{NO} response.
def test_parsingRaisesIllegalOperationResponse(self): self.assertParseExceptionResponse( imap4.IllegalOperation("operation"), b"001", b"NO Illegal operation: operation\r\n", )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unknown_method(self, response):\n raise NoData", "def response_method_not_allowed():\n\n return b\"HTTP/1.1 405 Method Not Allowed\\r\\n\"", "def no_response(self):\n raise NotImplementedError", "def _create_method_not_allowed(self):\n body = self.server.create_error(\n ...
[ "0.72630423", "0.64861745", "0.6464582", "0.6404929", "0.6391884", "0.6261658", "0.61989176", "0.61885387", "0.6184638", "0.6167012", "0.61258745", "0.6062136", "0.5996887", "0.5992554", "0.59749633", "0.5958827", "0.59501773", "0.5941055", "0.59200263", "0.58867145", "0.5864...
0.7336822
0
When a command raises L{IllegalClientResponse}, the server sends a C{BAD} response.
def test_commandRaisesIllegalClientResponse(self): self.assertCommandExceptionResponse( imap4.IllegalClientResponse("client response"), b"001", b"BAD Illegal syntax: client response\r\n", )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parsingRaisesIllegalClientResponse(self):\n self.assertParseExceptionResponse(\n imap4.IllegalClientResponse(\"client response\"),\n b\"001\", b\"BAD Illegal syntax: client response\\r\\n\",\n )", "def invalid_command(response): # string -> interaction\r\n print(\...
[ "0.6913848", "0.6872914", "0.6423069", "0.6302898", "0.62719715", "0.61883616", "0.6054091", "0.60121053", "0.5999493", "0.59987104", "0.5987169", "0.5975817", "0.5962536", "0.59459686", "0.59370124", "0.5891266", "0.5883658", "0.58393794", "0.5821561", "0.58163136", "0.57932...
0.80572623
0
An empty string argument raises L{imap4.IllegalClientResponse}.
def test_arg_astringEmptyLine(self): for empty in [b"", b"\r\n", b" "]: self.assertRaises(imap4.IllegalClientResponse, self.server.arg_astring, empty)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_arg_literalEmptyLine(self):\n self.assertRaises(imap4.IllegalClientResponse,\n self.server.arg_literal, b\"\")", "def test_arg_plistEmptyLine(self):\n self.assertRaises(imap4.IllegalClientResponse,\n self.server.arg_plist, b\"\")", "def t...
[ "0.7294522", "0.7223682", "0.7156612", "0.6865867", "0.67882955", "0.64476", "0.61640984", "0.6116054", "0.6096937", "0.59633434", "0.59031945", "0.59030807", "0.5887851", "0.5804092", "0.5798151", "0.57957876", "0.5754019", "0.57476306", "0.5692243", "0.5649277", "0.5643454"...
0.7583302
0
A sequence set returns the unparsed portion of a line.
def test_arg_seqsetReturnsRest(self): sequence = b"1:* blah blah blah" _, rest = self.server.arg_seqset(sequence) self.assertEqual(rest, b"blah blah blah")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _decode_v1(self, line: str) -> Set[str]:\n\n result = set()\n\n local_line = line.strip()\n\n if local_line.startswith(\"||\") and (\n local_line.endswith(\"^\") or local_line.endswith(\"$\")\n ):\n local_line = local_line.replace(\"||\", \"\", 1)\n\n ...
[ "0.62174445", "0.58798426", "0.5684283", "0.56811166", "0.56540006", "0.555964", "0.555964", "0.5497837", "0.53755593", "0.5353814", "0.5332057", "0.5323881", "0.5323187", "0.5294632", "0.5275179", "0.5266455", "0.5225931", "0.51774335", "0.51774335", "0.5165716", "0.51546705...
0.5170754
19
An invalid sequence raises L{imap4.IllegalClientResponse}.
def test_arg_seqsetInvalidSequence(self): self.assertRaises(imap4.IllegalClientResponse, self.server.arg_seqset, b"x:y")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parsingRaisesIllegalClientResponse(self):\n self.assertParseExceptionResponse(\n imap4.IllegalClientResponse(\"client response\"),\n b\"001\", b\"BAD Illegal syntax: client response\\r\\n\",\n )", "def test_commandRaisesIllegalClientResponse(self):\n self.asser...
[ "0.72755814", "0.7074162", "0.6331612", "0.59992903", "0.59352297", "0.582897", "0.5788807", "0.56702125", "0.56675076", "0.56590545", "0.55258405", "0.5509177", "0.5498849", "0.5487901", "0.5486241", "0.5480952", "0.5477624", "0.54509914", "0.54506475", "0.54418075", "0.5436...
0.77317363
0
Test a nonsilent flag modifying method. Call the method, assert that the correct bytes are sent, deliver a I{FETCH} response, and assert that the result of the Deferred returned by the method is correct.
def _flagsTest(self, method, item): d = getattr(self.client, method)('3', ('\\Read', '\\Seen'), False) self.assertEqual( self.transport.value(), b'0001 STORE 3 ' + item + b' (\\Read \\Seen)\r\n') self.client.lineReceived(b'* 3 FETCH (FLAGS (\\Read \\Seen))') self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _flagsSilentlyWithUnsolicitedDataTest(self, method, item):\n d = getattr(self.client, method)('3', ('\\\\Read', '\\\\Seen'), True)\n self.assertEqual(\n self.transport.value(),\n b'0001 STORE 3 ' + item + b' (\\\\Read \\\\Seen)\\r\\n')\n self.client.lineReceived(b'* 2...
[ "0.68510324", "0.68154866", "0.6189213", "0.6177646", "0.5907092", "0.5652755", "0.5630777", "0.5605661", "0.55965257", "0.5580434", "0.55801517", "0.5538843", "0.55364186", "0.5524108", "0.55001396", "0.54949623", "0.54876286", "0.54830325", "0.54823774", "0.5466522", "0.545...
0.6728999
2
Test unsolicited data received in response to a silent flag modifying method. Call the method, assert that the correct bytes are sent, deliver the unsolicited I{FETCH} response, and assert that the result of the Deferred returned by the method is correct.
def _flagsSilentlyWithUnsolicitedDataTest(self, method, item): d = getattr(self.client, method)('3', ('\\Read', '\\Seen'), True) self.assertEqual( self.transport.value(), b'0001 STORE 3 ' + item + b' (\\Read \\Seen)\r\n') self.client.lineReceived(b'* 2 FETCH (FLAGS (\\Rea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_synchronousFetch(self):\n # Here's some pipelined stuff\n self.server.dataReceived(\n b'01 FETCH 1 BODY[]\\r\\n'\n b'02 FETCH 2 BODY[]\\r\\n'\n b'03 FETCH 3 BODY[]\\r\\n')\n\n self.flushPending()\n\n self.assertEqual(\n self.transport...
[ "0.66357887", "0.6413284", "0.6291067", "0.6241506", "0.61308545", "0.597563", "0.588439", "0.5824625", "0.5771638", "0.57648665", "0.57221514", "0.5679604", "0.56288105", "0.5574255", "0.55713975", "0.55703443", "0.55406463", "0.5533418", "0.5529073", "0.5520671", "0.5512197...
0.69682324
0
When passed a C{True} value for the C{silent} parameter, L{IMAP4Client.setFlags} sends the I{STORE} command with a I{FLAGS.SILENT} data item and returns a L{Deferred} which fires with an empty dictionary.
def test_setFlagsSilently(self): self._flagsSilentlyTest('setFlags', b'FLAGS.SILENT')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_setFlagsSilentlyWithUnsolicitedData(self):\n self._flagsSilentlyWithUnsolicitedDataTest('setFlags', b'FLAGS.SILENT')", "def _flagsSilentlyWithUnsolicitedDataTest(self, method, item):\n d = getattr(self.client, method)('3', ('\\\\Read', '\\\\Seen'), True)\n self.assertEqual(\n ...
[ "0.5836351", "0.5622603", "0.55750644", "0.54516363", "0.49765486", "0.48705867", "0.46823853", "0.46823853", "0.46823853", "0.46044394", "0.46039072", "0.45540935", "0.45218372", "0.43812522", "0.43774816", "0.43743378", "0.43717322", "0.43283165", "0.42968148", "0.4286997", ...
0.5348023
4
The month name in the date is locale independent.
def test_fetchInternalDateLocaleIndependent(self): # Fake that we're in a language where December is not Dec currentLocale = locale.setlocale(locale.LC_ALL, None) locale.setlocale(locale.LC_ALL, "es_AR.UTF8") self.addCleanup(locale.setlocale, locale.LC_ALL, currentLocale) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monthname(self):\n return self.strftime(\"%B\")", "def _monthName(self, month):\n if month is not None:\n month = self.tr(\"MONTH.\" + month.upper())\n return month", "def get_month_name(month_no):\n locale.setlocale(locale.LC_TIME, \"et-EE\")\n return calendar.month_n...
[ "0.8291438", "0.7842252", "0.77430135", "0.7597079", "0.757327", "0.7498782", "0.7476153", "0.7394407", "0.7394256", "0.73726565", "0.7363828", "0.7350096", "0.7349094", "0.7281555", "0.7189616", "0.7122951", "0.70630306", "0.69857377", "0.6968951", "0.69673884", "0.6955738",...
0.0
-1
If the search filter contains an I{OR} term with a subexpression which includes a message sequence set wildcard, all messages in that set are considered for inclusion in the results.
def test_searchOrMessageSet(self): return self._messageSetSearchTest('OR 2:* 2:*', [2, 3, 4, 5])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_searchOr(self):\n return self._messageSetSearchTest('OR 1 2', [1, 2])", "def test_searchOr(self):\n self.assertTrue(\n self.server.search_OR(\n [\"SENTSINCE\"] + self.earlierQuery +\n [\"SENTSINCE\"] + self.laterQuery,\n self.seq, self.ms...
[ "0.71143854", "0.6626131", "0.5975881", "0.5850278", "0.56381416", "0.5554031", "0.5535743", "0.54854023", "0.5459893", "0.535226", "0.53341526", "0.5328797", "0.53281426", "0.53128666", "0.52884406", "0.5285237", "0.52583915", "0.5248111", "0.5229999", "0.5219287", "0.520706...
0.7340346
0
Starting a TLS negotiation with an L{IMAP4Server} that already has C{LOGIN} and C{PLAIN} L{IChallengeResponse} factories uses those factories.
def test_startTLSWithExistingChallengers(self): self.server.challengers = {b"LOGIN": imap4.LOGINCredentials, b"PLAIN": imap4.PLAINCredentials} @defer.inlineCallbacks def assertLOGINandPLAIN(): capabilities = yield self.client.getCapabilities() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_doubleSTARTTLS(self):\n\n class DoubleSTARTTLSClient(SimpleClient):\n\n def startTLS(self):\n if not self.startedTLS:\n return SimpleClient.startTLS(self)\n\n return self.sendCommand(imap4.Command(b\"STARTTLS\"))\n\n self.client = D...
[ "0.58984756", "0.5891473", "0.5854032", "0.55000657", "0.5392094", "0.53622156", "0.53243107", "0.530984", "0.5304236", "0.53025275", "0.53008693", "0.528994", "0.5282359", "0.5272042", "0.5230849", "0.52100164", "0.51488215", "0.5138053", "0.51288927", "0.511647", "0.5107865...
0.67146707
0
Advance pending iterators enqueued with L{iterateInReactor} in a roundrobin fashion, resuming the transport's producer until it has completed. This ensures bodies are flushed.
def flushPending(self, asLongAs=lambda: True): while self.iterators and asLongAs(): for e in self.iterators[0][0]: while self.transport.producer: self.transport.producer.resumeProducing() else: self.iterators.pop(0)[1].callback(None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterateInReactor(self, iterator):\n d = defer.Deferred()\n self.iterators.append((iterator, d))\n return d", "def sender_iter(self):\n while 1:\n yield self.send_next()", "def _iter2aiter(iter):\n\n def _consume(loop, iter, q):\n for item in iter:\n ...
[ "0.61461866", "0.59875524", "0.58081794", "0.5781301", "0.5705543", "0.5704287", "0.56183034", "0.5594664", "0.55360645", "0.5478307", "0.54361165", "0.53913754", "0.5342742", "0.5334857", "0.52716005", "0.5260544", "0.5231243", "0.5218572", "0.52170014", "0.52110755", "0.520...
0.5242425
16
Returns a list of all commit hashes
def all_commits(self, prefix=""): command = ['log', '--all', '--pretty=%H'] commits = self._get_commits_iterator(command) if prefix: commits = iter([c for c in commits if c.startswith(prefix)]) for commit in commits: yield commit.strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_known_commit_hashes(request, project_id):\n if request.method == 'GET':\n project_entry = GitProjectEntry.objects.filter(id=project_id).first()\n if project_entry is None:\n return res.get_response(404, 'project not found', {})\n\n obj = {}\n obj['hashes'] = list(G...
[ "0.7133225", "0.70879716", "0.6820463", "0.67418325", "0.6727755", "0.67204934", "0.67114705", "0.66631097", "0.6556236", "0.65120965", "0.64513254", "0.64393383", "0.63973534", "0.6396532", "0.6345889", "0.633688", "0.6319737", "0.62965155", "0.6281221", "0.6275562", "0.6211...
0.626051
20
Generates multiscale anchor boxes.
def _generate_boxes(self): boxes_all = [] for level in range(self.min_level, self.max_level + 1): boxes_l = [] for scale in range(self.num_scales): for aspect_ratio in self.aspect_ratios: stride = 2 ** level intermidate_scale = 2 ** (scale / float(self.num_scales)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_anchor_boxes(image_size, feature_map_size, sizes, scales):\n image_height, image_width = image_size\n fm_height, fm_width = feature_map_size\n height_stride = int(image_height / fm_height)\n width_stride = int(image_width / fm_width)\n\n # Compose horizontal and vertical positions into ...
[ "0.7095319", "0.7087414", "0.676033", "0.67057395", "0.6698711", "0.66437685", "0.66208327", "0.65511936", "0.6535815", "0.64397883", "0.64372414", "0.6420171", "0.6420171", "0.62874", "0.6277956", "0.6263748", "0.6261684", "0.6235041", "0.6204222", "0.6189743", "0.61732316",...
0.5779657
37
Returns the IMPLEMENTATION value. It is read from server capabilities. (see the CAPABILITY command)
def get_implementation(self): return self.__capabilities["IMPLEMENTATION"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capability(self):\n code, data, capabilities = (\n self.__send_command(\"CAPABILITY\", withcontent=True))\n if code == \"OK\":\n return capabilities\n return None", "def get_capabilities(self):\n return json.dumps({'network_api': 'pyez'})", "def get_quantiz...
[ "0.5952397", "0.58605105", "0.57498187", "0.5604473", "0.5591387", "0.54908043", "0.54831296", "0.5468967", "0.54333067", "0.54309314", "0.54087543", "0.5374628", "0.5322978", "0.53000057", "0.5288701", "0.5275961", "0.5253762", "0.5247809", "0.5246327", "0.5242289", "0.52216...
0.71016806
0
Paginate a queryset if required, either returning a page object, or `None` if pagination is not configured for this view.
def paginate_queryset(self, queryset, request, view=None): self.count = queryset.count() self.request = request try: self.page, self.next_page, self.has_next = queryset.fetch_page( self.get_page_size(request), start_cursor=Cursor(urlsafe=self.get_page_token())) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paginate_queryset(self, queryset, request, view=None):\n page_size = self.get_page_size(request)\n if not page_size:\n return None\n\n paginator = self.django_paginator_class(queryset, page_size)\n page_number = self.page_query_param\n if page_number in self.last_p...
[ "0.820122", "0.820122", "0.8023443", "0.8008029", "0.8008029", "0.7759306", "0.7671702", "0.7433488", "0.7380579", "0.72249717", "0.7142897", "0.7009262", "0.694408", "0.6866919", "0.6469438", "0.6411859", "0.64067435", "0.6318743", "0.630996", "0.6271192", "0.62379855", "0...
0.72448623
9
gets a path and returns a list of asm file names
def list_of_files(path): files_list=[] path = os.path.abspath(path) #if the path is a file name, returns a list of a single file name if os.path.isfile(path): files_list.append(path) #if the path is a directory name, returns a list of all the file names anded with .asm else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_asm_file_to_code(file_path):\r\n with open(file_path, 'r') as file:\r\n asm_code = []\r\n for line in file:\r\n asm_code.append(line)\r\n\r\n return asm_code", "def get_c_files(path):\n clist = []\n for file in os.listdir(path):\n if file.endswith(\".cc\") or ...
[ "0.665282", "0.6612353", "0.65799123", "0.6478479", "0.6426161", "0.6267255", "0.61873263", "0.5964881", "0.59580094", "0.58620566", "0.58576775", "0.5852787", "0.5848867", "0.5833024", "0.5830914", "0.58267605", "0.5823265", "0.5762646", "0.5761283", "0.57513857", "0.574913"...
0.773575
0
Any trip ids which don't have values in the most recent set of observations can be set as completed
def mark_completed_trips_from_obs(session, trip_ids_from_observations): print('checking {} observations for completed trips'.format(len(trip_ids_from_observations))) uncompleted = Trip.uncompleted(session) trips_with_no_observations = [trip for trip in uncompleted if trip.trip_id not in trip_ids_from_observ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complete_trios(self):\n return list(filter(lambda t: t.is_complete(), self.trios))", "def remove_premature_departures(trips):\n\t# sort ascending by arrival \n\t# then iteratively remove trips not also sorted by departure\n\tstarting_length = len(trips) # for logging\n\t#\n\ttrips.sort(key = lambda x:...
[ "0.57679456", "0.540125", "0.5286381", "0.517169", "0.512179", "0.5110789", "0.5089066", "0.5079391", "0.50762874", "0.50253123", "0.5021317", "0.4918831", "0.48710182", "0.48700812", "0.48677632", "0.48564744", "0.485578", "0.48247066", "0.4798466", "0.4798466", "0.4798466",...
0.6865053
0
In case of prediction on data of different size than 128x128, the dimension_preprocess function is used to add padding and chunk up the data into pieces of 128x128, and this function is used to reconstruct these pieces into the original data.
def dimension_postprocess(self, chunked_data, original_data, scale=1, padding=True): assert len(original_data.shape) == 2, "data dimension expected to be (xline ,samp_point)" assert len(chunked_data.shape) == 3, "Chunked data dimension expected to be (batch_size, xline, samp_point)" if pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dimension_preprocess(self, data, padding=True):\r\n\r\n assert len(data.shape) == 2, \"Data dimension expected to be ( xline, samp_point)\"\r\n if padding:\r\n if data.shape[0] < self.rows:\r\n padding = np.ones((self.rows - data.shape[0], data.shape[1]))\r\n ...
[ "0.7336187", "0.6822585", "0.65762454", "0.65519", "0.65079427", "0.6433954", "0.64154696", "0.6409113", "0.63467276", "0.63348204", "0.6322181", "0.631285", "0.6298524", "0.6297443", "0.6292261", "0.6273208", "0.61751527", "0.6168299", "0.6167471", "0.61357677", "0.612307", ...
0.71344763
1
Get the list of all vray nodes present in the nuke scene.
def listVrayNodes(): return [node.name() for node in nuke.allNodes() if 'VRay' in node.Class()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNodes(self):\n return self.__allNodes", "def get_nodes(self):\n\n return list(self.graph.nodes)", "def get_nodes(self):\n\n nodes = []\n\n if not self.node:\n return nodes\n \n nodes.extend(self.node.left.get_nodes())\n nodes.append(self.node.v...
[ "0.7351326", "0.733498", "0.7288497", "0.725798", "0.7233458", "0.72053945", "0.7108952", "0.70935047", "0.7090152", "0.7090152", "0.7007069", "0.6990571", "0.6990571", "0.6990571", "0.6971909", "0.6971061", "0.6970739", "0.69631314", "0.69513446", "0.695131", "0.6899979", ...
0.8079756
0
View that returns the index / homepage
def index(request): return render(request, "index.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n return render_template('index.html', title='Home')", "def index():\r\n\r\n # initializes page title\r\n page_title = 'Home'\r\n\r\n # renders the landing page\r\n return render_template('index.html', page_title=page_title)", "def index():\n\treturn render_template(\"index.html...
[ "0.8476668", "0.8429844", "0.83935696", "0.83721644", "0.83502775", "0.83439755", "0.82793474", "0.8272923", "0.82688373", "0.82363534", "0.8224063", "0.8220724", "0.821347", "0.82023513", "0.8196333", "0.81876445", "0.8161829", "0.81591237", "0.8142561", "0.8140612", "0.8140...
0.0
-1
View that allows user to add new info on his profile
def profile_post(request, pk=None): user = User.objects.get(email=request.user.email) if request.user.is_authenticated: if request.method == 'POST': profile_post_form = ProfilePostForm(request.POST, request.FILES) if profile_post_form.is_valid(): profilepost = p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile_add(request):\n if request.method == \"POST\":\n form = forms.AddProfileForm(request.POST, user=request.user)\n profile = form.save_if_valid()\n if profile is not None:\n messages.success(\n request, u\"Profile '{0}' added.\".format(\n ...
[ "0.75200194", "0.7437585", "0.743102", "0.71940976", "0.7167456", "0.71147466", "0.7094974", "0.7034149", "0.69578844", "0.69430494", "0.6912082", "0.68969315", "0.6880774", "0.6879863", "0.6859115", "0.68540365", "0.6800786", "0.67941433", "0.67863154", "0.6766662", "0.67637...
0.63136387
62
The profile of the author of the blogpost
def author_profile(request, pk): author = get_object_or_404(User, pk=pk) profileposts = ProfilePost.objects.filter(user=author).filter(published_date__lte=timezone.now() ).order_by('-published_date').all() return render(request, 'profile.html', {"profile": author, 'profileposts': profileposts})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def author(self):\r\n return self.user", "def get_author(self):\n return self.author", "def get_author(self):\n return self.author", "def get_user_profile(self):\n return self.user.profile", "def author(self):\n return self._data.get('author', None)", "def get_current_u...
[ "0.71831137", "0.70018333", "0.70018333", "0.69332457", "0.69188046", "0.6865966", "0.6860913", "0.6688341", "0.6683102", "0.6657816", "0.6657816", "0.6657816", "0.65880764", "0.65880764", "0.657832", "0.6556059", "0.6554873", "0.6538002", "0.6503973", "0.649318", "0.6488794"...
0.6940689
3
View that will filter the profiles based on first name
def search_user_first_name(request): q1 = request.GET.get('q1') users = UserProfile.objects.filter( Q(first_name__icontains=q1)) return render(request, "allusers.html", {"users": users})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_profiles(request):\n query = request.GET.get('q')\n results = Profile.objects.filter(user__username__icontains=query)\n template = 'profiles/search_profiles.html'\n context = {\n 'results': results,\n 'query': query\n }\n return render(request, template, context)", "def...
[ "0.67871404", "0.67400897", "0.65253174", "0.64910454", "0.6485033", "0.6438013", "0.6420003", "0.6392858", "0.6320621", "0.6279321", "0.6231792", "0.6219094", "0.61990273", "0.61438537", "0.6117414", "0.6101197", "0.6061585", "0.60541844", "0.60344017", "0.6021942", "0.59990...
0.7442812
0
View that will filter the profiles based on last name
def search_user_last_name(request): q2 = request.GET.get('q2') users = UserProfile.objects.filter( Q(last_name__icontains=q2)) return render(request, "allusers.html", {"users": users})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_user_first_name(request):\n q1 = request.GET.get('q1')\n users = UserProfile.objects.filter(\n Q(first_name__icontains=q1))\n return render(request, \"allusers.html\", {\"users\": users})", "def search_profiles(request):\n query = request.GET.get('q')\n results = Profile.objects....
[ "0.6521041", "0.6415845", "0.64030194", "0.6387658", "0.6318225", "0.62886", "0.6263037", "0.62034374", "0.6179929", "0.6150587", "0.6128244", "0.60987604", "0.6094634", "0.6089311", "0.60593003", "0.6046766", "0.6010605", "0.6003118", "0.6002434", "0.59823865", "0.59403956",...
0.7340683
0
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(MPC_ACCRequest, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.u0 is None: self.u0 = 0. if self.h0 is None: self.h0 = 0. if self.vl is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.7794478", "0.77204376", "0.77204376", "0.76865023", "0.7625996", "0.7563802", "0.74399596", "0.74173665", "0.73513013", "0.73086345", "0.72797984", "0.7237519", "0.7227004", "0.7224259", "0.7224259", "0.7218872", "0.72119284", "0.72119284", "0.72119284", "0.72119284", "0.7...
0.0
-1
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(MPC_ACCResponse, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.i is None: self.i = 0. else: self.i = 0.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.77940345", "0.77196896", "0.77196896", "0.7685901", "0.76253456", "0.75629234", "0.7438996", "0.74165684", "0.73517054", "0.73081905", "0.7280219", "0.7237793", "0.7226802", "0.7223405", "0.7223405", "0.7218974", "0.72109884", "0.72109884", "0.72109884", "0.72109884", "0.7...
0.6465564
98
Set the value of the CallbackID input for this Choreo. ((required, string) The ID that can used to retrieve request data that the callback URL has captured.)
def set_CallbackID(self, value): super(GetCallbackDataInputSet, self)._set_input('CallbackID', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback(self, callback):\n if callback is None:\n raise ValueError(\"Invalid value for `callback`, must not be `None`\") # noqa: E501\n\n self._callback = callback", "def set_callback_url(self, callback_url):\n self.callback_url = callback_url", "def callback(self, value) ...
[ "0.5835316", "0.5807138", "0.55448663", "0.55295515", "0.541269", "0.5344302", "0.52390045", "0.5124608", "0.5119514", "0.5113356", "0.50779665", "0.507378", "0.507378", "0.5058252", "0.5058252", "0.5057219", "0.49601257", "0.4928322", "0.49150586", "0.49076363", "0.48760238"...
0.7549056
0
Set the value of the FilterValue input for this Choreo. ((optional, string) Allows you to filter callback data by a query parameter keyvalue pair. FilterName is required when using this input.)
def set_FilterValue(self, value): super(GetCallbackDataInputSet, self)._set_input('FilterValue', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_FilterName(self, value):\n super(GetCallbackDataInputSet, self)._set_input('FilterName', value)", "def filters(self, value):\n if not isinstance(value, dict):\n raise TypeError(\"input must be a dictionary\")\n\n self._filters = value", "def callfilter(self, name, value)...
[ "0.68018854", "0.6394899", "0.6008499", "0.5973909", "0.58091944", "0.5748029", "0.547746", "0.5406157", "0.53657585", "0.52979106", "0.52075994", "0.51972777", "0.5194606", "0.5178163", "0.5155833", "0.51517075", "0.5078385", "0.5062068", "0.5025186", "0.50097245", "0.493763...
0.7905017
0
Get launch config data based on current name. Handle base64 decode automatically. Returned user data is always decoded. Return None if config doesn't exist.
def get(self): lc = self._client.describe_launch_configurations(LaunchConfigurationNames=[self._name]) if len(lc["LaunchConfigurations"]) == 0: return None else: config = lc["LaunchConfigurations"][0] config["UserData"] = base64.b64decode(config["UserData"]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n config = self.user_file.parseString(self.content)\n return config", "def config_data(self):\n if self._key not in self._user_keys():\n raise CouldNotFindUserException(self._key, self._user_keys())\n return next(data for data in self.CONFIG_DATA if data.key ...
[ "0.6100935", "0.5985278", "0.5898775", "0.58858794", "0.58721983", "0.57478404", "0.5664038", "0.56504303", "0.56383246", "0.5636168", "0.55852795", "0.55733395", "0.5573219", "0.5550289", "0.5548633", "0.55384517", "0.5532542", "0.5532542", "0.55278385", "0.5510076", "0.5507...
0.6894191
0
Make a copy of current launch config and return new one. Optionally delete old one. This is composite API that is built with above basic APIs. No need to retry as all underlying APIs already have retry.
def copy(self, new_name, new_config, retain_spot_price=False, delete_old=False): config = self.get() config.update(new_config) config["LaunchConfigurationName"] = new_name # The following fields are not allowed as launch config input. config.pop("LaunchConfigurationARN") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_config():\n return _set_config(_gen_config())", "def delete(self):\r\n return self.connection.delete_launch_configuration(self.name)", "def config(self, **kwargs):\n backup_config = app.config.copy()\n app.config.update(kwargs)\n try:\n yield\n finally...
[ "0.5890484", "0.5746978", "0.57004786", "0.56777227", "0.5619529", "0.5597216", "0.55249244", "0.55112195", "0.54345816", "0.5426472", "0.5418448", "0.53655326", "0.5355111", "0.5348264", "0.5319761", "0.53048426", "0.529094", "0.5278624", "0.5267941", "0.5265533", "0.5221846...
0.71211535
0
Apply Sobel filter and threshold absolute values
def abs_sobel_thresh(img, orient='x', thresh_min=0, thresh_max=255): # Apply the following steps to img # 1) Convert to grayscale # NOTE: This assumes use of cv2.imread to read in images gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # 2) Take the derivative in x or y given orient = 'x' or 'y' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def threshold_image(self, image, ksize, sobel_thresh, mag_thresh, dir_thresh, s_thresh, l_thresh, b_thresh):\n # Note: Magnitude and direction thresholds were not needed for the project. Probably they are for the challenges\n # For Sobel, the light channel will be used\n hls = cv2.cvtColor(ima...
[ "0.66069436", "0.6569269", "0.6554255", "0.6549679", "0.6531978", "0.6531455", "0.64829326", "0.6441156", "0.6393237", "0.63741183", "0.6358776", "0.6347044", "0.6327619", "0.6327428", "0.63074523", "0.6290886", "0.6228088", "0.6219642", "0.6201386", "0.6122688", "0.61210287"...
0.67781943
0
Takes as input a DataFrame with sentences in column 'text_col'. Appends at least one new column to the DataFrame containing lists of single word tokens.
def tokenize(self, df: DataFrame, text_col="text") -> DataFrame: texts = df[text_col] if self.to_lower: texts = texts.apply(lambda text: text.lower()) if self.use_remove_punctuation: texts = texts.apply(lambda text: self.remove_punctuation(text)) # Split senten...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenization(dataframe):\n nlp = English()\n tokenizer = nlp.Defaults.create_tokenizer(nlp)\n stemmer = SnowballStemmer(\"english\")\n\n dataframe.loc[:, \"tokens\"] = dataframe.loc[:, \"content\"].apply(\n lambda cell: [\n token.lemma_\n for token in tokenizer(cell)\n ...
[ "0.6942791", "0.66210395", "0.6583244", "0.65702057", "0.6567869", "0.6556804", "0.65534335", "0.6474945", "0.6437405", "0.64066166", "0.63961506", "0.63075334", "0.6300862", "0.62839985", "0.6225679", "0.6165526", "0.6100412", "0.60733753", "0.60692984", "0.60473436", "0.604...
0.78136414
0
Gets the next alphabetical string that will be seached
def get_next_search_string(letter_ids, last_was_under=True): # Add new letter to the end (A) if not last_was_under: letter_ids.append(0) return letter_ids # Increment letter_ids[-1] = letter_ids[-1] + 1 while (letter_ids[-1] > 25): if (len(letter_ids) > 1): del l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_letter(letter):\r\n\tcoded_text = ''\r\n\tstep = 1\r\n\tif letter in ascii_lowercase:\r\n\t\tcoded_text = coded_text + ascii_lowercase[ascii_lowercase.index(letter) + step % len(ascii_lowercase)]\r\n\r\n\tif letter in ascii_uppercase:\r\n\t\tcoded_text = coded_text + ascii_uppercase[ascii_uppercase.index(...
[ "0.69399875", "0.6792382", "0.6750752", "0.6509938", "0.6430395", "0.635784", "0.62934947", "0.6290743", "0.62730163", "0.62017727", "0.61728597", "0.6155928", "0.61519635", "0.61435574", "0.6138284", "0.6106652", "0.6009435", "0.60089934", "0.6008075", "0.5978922", "0.594655...
0.6689027
3
Set data directory This is useful so data directory paths don't need to be changed everytime you pull from or push to github. To make this useful, make sure you perform step 2, as defined for your operating system.
def SetChronoDataDirectories(): from pathlib import Path import os CONDA_PREFIX = os.environ.get('CONDA_PREFIX') CHRONO_DATA_DIR = os.environ.get('CHRONO_DATA_DIR') if CONDA_PREFIX and not CHRONO_DATA_DIR: CHRONO_DATA_DIR = os.path.join(CONDA_PREFIX, 'share', 'chrono', 'data', '') if no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_data_directory(path):\n if not os.path.exists(path):\n return False\n\n set(\"data_dir\", path)\n return True", "def set_data_directory(path):\n gdc19.DATA_DIRECTORY = path\n return gdc19.DATA_DIRECTORY", "def set_data_dir(datadir, update_env=True):\n if os.path.isdir(datadir):...
[ "0.77309895", "0.76964873", "0.76140803", "0.75543046", "0.7384418", "0.7351647", "0.73477787", "0.7342367", "0.73065317", "0.72858703", "0.72024024", "0.7127364", "0.7028469", "0.7001204", "0.692361", "0.6873261", "0.68504566", "0.68076813", "0.679544", "0.679544", "0.678317...
0.61567545
61
Returns simple averaged lightness of a QColor Newer Qt Versions implement this as part of QColor Reimplemented for backwardscompatibility
def __lightness(self, color): hsv = color.toHsv() return hsv.valueF()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lightness(self):\n min_component = min(self.red, self.green, self.blue)\n max_component = max(self.red, self.green, self.blue)\n avg = (max_component + min_component) / 2\n light = avg / 255\n return light", "def lightness(color):\n\n strongest = max(color.red, color.gre...
[ "0.740297", "0.6967703", "0.6077544", "0.60499024", "0.6023646", "0.5956245", "0.5927049", "0.588251", "0.57679546", "0.5754848", "0.56590307", "0.56243664", "0.5601044", "0.55973107", "0.5594193", "0.55738705", "0.55521625", "0.5531151", "0.5518151", "0.55086625", "0.5470304...
0.6423211
2
Moves the head by setting pan/tilt angles.
def pan_tilt(self, pan, tilt): # TODO: Check that the pan/tilt angles are within joint limits if pan <= self.MIN_PAN: pan = self.MIN_PAN if pan >= self.MAX_PAN: pan = self.MAX_PAN if tilt <= self.MIN_TILT: tilt = self.MIN_TILT if tilt >= self.M...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def example_move(self):\n self.right() # start rotating right\n time.sleep(1) # turn for a second\n self.stop() # stop\n self.servo(1000) # look right\n time.sleep(.25) # give your head time to move\n self.servo(2000) # look left", "def example_move(self):\n self....
[ "0.6873781", "0.6873781", "0.66479665", "0.6523683", "0.6478677", "0.63475657", "0.6333728", "0.62873816", "0.61450356", "0.60849804", "0.6084441", "0.6083106", "0.6033438", "0.60284775", "0.6008307", "0.6004985", "0.599577", "0.5981736", "0.59813046", "0.597696", "0.59614414...
0.6274351
8
Convert class labels from scalars to onehot vectors.
def dense_to_one_hot(labels_dense, num_classes): assert labels_dense.ndim == 1 or labels_dense.ndim == 2 assert labels_dense.dtype == np.int32 if labels_dense.ndim == 1: num_sequences = 0 sequence_len = labels_dense.shape else: num_sequences, sequence_len = labels_dense.shape ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot(labels, classes=None):\n return K.utils.to_categorical(labels, classes)", "def one_hot(labels, classes=None):\n\n one_hot_ = K.utils.to_categorical(labels, classes)\n return(one_hot_)", "def to_onehot(labels: torch.Tensor, num_classes: int) -> torch.Tensor:\n if len(labels.size()) == 1:...
[ "0.8250402", "0.807683", "0.80523187", "0.7977843", "0.7908335", "0.7900327", "0.7892233", "0.7869711", "0.7849721", "0.7849721", "0.7826951", "0.7826122", "0.77677035", "0.7765413", "0.77540547", "0.77540547", "0.77540547", "0.77489346", "0.7742955", "0.7737176", "0.77226317...
0.7453988
50
Destructor for closing the file.
def __del__(self): try: self._document.close() except: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __del__(self):\n self.file.close()", "def __del__(self):\n self.f.close()", "def __del__(self):\n if self.file is None:\n return\n try:\n self.file.close()\n del self.file\n self.file = None\n except:\n getLogger(__name...
[ "0.8550637", "0.8234664", "0.8227588", "0.820426", "0.8169503", "0.8163051", "0.8162041", "0.81108993", "0.80421376", "0.8037555", "0.8037555", "0.8012206", "0.79659367", "0.79543996", "0.79543996", "0.79279643", "0.79279643", "0.790234", "0.78995144", "0.78450024", "0.783765...
0.0
-1
crop patch based on offset
def crop_and_pad(data, offset, crop_shape, target_shape=None): # Spatial dimensions only. All vars in zyx. shape = np.array(data.shape[1:]) crop_shape = np.array(crop_shape) offset = np.array(offset[::-1]) start = shape // 2 - crop_shape // 2 + offset end = start + crop_shape assert np.all...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __crop(img, pos, size):\n ow, oh = img.size\n x1, y1 = pos\n tw = th = size\n if (ow > tw or oh > th):\n return img.crop((x1, y1, x1 + tw, y1 + th))\n return img", "def crop_mask(mask, crop_offset=0.5):\n maxx, maxy, minx, miny = 0, 0, 0, 0\n for r in range(0, mask.shape[0]):\n ...
[ "0.6808927", "0.66510886", "0.64758086", "0.6462376", "0.64524406", "0.644268", "0.6430705", "0.64189816", "0.6403126", "0.6398769", "0.63308966", "0.6295238", "0.62709475", "0.62572837", "0.6250783", "0.6242364", "0.6230135", "0.6202504", "0.61964375", "0.6191344", "0.618909...
0.6887072
0
Updates relu activation functions so that 1 stores output in forward pass 2 imputes zero for gradient values that are less than zero
def update_relus(self): def relu_backward_hook_function(module, grad_in, grad_out): """ If there is a negative gradient, change it to zero """ # Get last forward output corresponding_forward_output = self.forward_relu_outputs[-1] correspond...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_relus(self):\n def relu_backward_hook_function(module, grad_in, grad_out):\n \"\"\"\n If there is a negative gradient, change it to zero\n \"\"\"\n # Get last forward output\n corresponding_forward_output = self.forward_relu_outputs[-1]\n corresponding_forward_output[c...
[ "0.71021515", "0.7060326", "0.705311", "0.70163274", "0.6981374", "0.69719243", "0.6938241", "0.6885461", "0.6854037", "0.6761753", "0.67363274", "0.660197", "0.6565968", "0.65620834", "0.6528729", "0.647825", "0.64745504", "0.64682955", "0.6464981", "0.64511496", "0.64208275...
0.6893404
7
Gets the path to the model and solver of an epoch if specified or to the best model and last solver if epoch is None
def get_model_solver_paths(save_path, epoch): print("Getting model and solver paths") model_paths = [] solver_paths = [] for _, _, fnames in os.walk(save_path): model_paths = [fname for fname in fnames if 'model' in fname] solver_paths = [fname for fname in fnames if 'solver' in fname] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_saved_model_path(training_ckpt_base):\n ckpt_dir = os.path.dirname(training_ckpt_base)\n # If using a checkpoint from the best_exporter, return its saved_model.\n if os.path.basename(ckpt_dir) == 'variables':\n return os.path.join(\n os.path.dirname(ckpt_dir),\n tf.saved_model.constants...
[ "0.6295518", "0.613557", "0.61076945", "0.61018384", "0.6100248", "0.60954654", "0.6032847", "0.60254425", "0.60185444", "0.60015637", "0.59962326", "0.5953621", "0.5937085", "0.5926782", "0.59211683", "0.591372", "0.590693", "0.5891418", "0.58492553", "0.5837758", "0.5823724...
0.71200794
0
Create plot for the confusion matrix for binary gender prediction and compute scores for accuracy, precision, recall, f1 and auc
def plot_gender_prediction(gender, gender_pred, color='black'): mpl.rcParams['text.color'] = color mpl.rcParams['axes.labelcolor'] = color mpl.rcParams['xtick.color'] = color mpl.rcParams['ytick.color'] = color # get confusion matrix cm = metrics.confusion_matrix(gender, gender_pred) cm = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(y_test, y_pred, classes,\n normalize=True,\n title='Average accuracy \\n',\n cmap=plt.cm.Blues, verbose = 0, precision = 0):\n from sklearn.metrics import confusion_matrix\n import itertools\n \n cm = ...
[ "0.7401703", "0.735505", "0.7285023", "0.72712344", "0.72431856", "0.72395736", "0.72271305", "0.7206144", "0.72049004", "0.71924424", "0.71798235", "0.7176012", "0.7166566", "0.7158534", "0.71576416", "0.7141715", "0.71383744", "0.7126315", "0.7124061", "0.71219057", "0.7121...
0.7456385
0
Create plot of artificial signal which maximizes the activation of a filter at a layer in a model using gradient ascent
def create_signal_which_maximizes_activation(model, layer, filt, input_size, lr=0.1, opt_steps=100, upscaling_steps=5, upscaling_factor=2.0, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def figure_10_12_b():\n xs = np.arange(-6,6,0.1)\n plt.plot(xs,sigmoid(xs))\n x=2.5\n plt.scatter(x,sigmoid(x))\n plt.plot(xs,logistic_lower_bound(xs,x))\n plt.show()", "def visualize_train(train_data_full, train_labels, train_data, thetas, losses, niter):\n fig1, ax1 = plt.subplots()\n a...
[ "0.6339056", "0.5884531", "0.5867904", "0.58381253", "0.5698124", "0.5683967", "0.56480646", "0.56281555", "0.5625266", "0.5610442", "0.5598226", "0.5584104", "0.55819684", "0.55789673", "0.55687416", "0.5568734", "0.55559456", "0.5548075", "0.5542615", "0.55394775", "0.55381...
0.6964018
0
Deserialize datetime object into string form for JSON processing.
def dump_datetime(value): if value is None: return None return [value.strftime("%Y-%m-%d"), value.strftime("%H:%M:%S")]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize_datetime(self, obj):\r\n if isinstance(obj, datetime.datetime):\r\n return obj.isoformat()\r\n raise TypeError(\"Type not serializable\")", "def json_datetime_serializer(obj):\n\n if isinstance(obj, datetime):\n serial = obj.isoformat()\n return serial\n ...
[ "0.6995824", "0.6982557", "0.69000393", "0.6865064", "0.68128496", "0.6749708", "0.6649493", "0.66324556", "0.65954465", "0.65469813", "0.6542357", "0.6538773", "0.6487021", "0.6480456", "0.64397836", "0.63939315", "0.6364729", "0.6356435", "0.633706", "0.63110447", "0.629170...
0.5695315
76