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 a django.forms.Field instance for this database Field.
def formfield(self, form_class=RadioSelectField, **kwargs): defaults = { 'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text, 'html_attrs': self.html_attrs } if self.has_default(): defaults['in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_field(self):\n return self", "def get_field(self, field_name: str) -> fields.Field:\n field = self.try_get_field(field_name)\n if not field:\n raise ValueError(f\"Model {self} has no field {field_name}.\")\n return field", "def _db_field(self):\n return sel...
[ "0.7138181", "0.6913065", "0.6848417", "0.6637213", "0.64959234", "0.6467271", "0.64635706", "0.64606184", "0.6383224", "0.6383224", "0.6383224", "0.6383224", "0.6310013", "0.630248", "0.6225219", "0.62177145", "0.6167503", "0.61578184", "0.6124669", "0.6118436", "0.6109003",...
0.5720001
47
Returns a django.forms.Field instance for this database Field.
def formfield(self, form_class=HstoreCheckboxInput, **kwargs): defaults = { 'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text, 'html_attrs': self.html_attrs, } if self.has_default(): defaults...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_field(self):\n return self", "def get_field(self, field_name: str) -> fields.Field:\n field = self.try_get_field(field_name)\n if not field:\n raise ValueError(f\"Model {self} has no field {field_name}.\")\n return field", "def _db_field(self):\n return sel...
[ "0.7139312", "0.69126815", "0.6848137", "0.6637518", "0.6496184", "0.64671105", "0.64617246", "0.6460085", "0.63828045", "0.63828045", "0.63828045", "0.63828045", "0.6309175", "0.6302463", "0.6224699", "0.6215952", "0.61680114", "0.6158374", "0.6125468", "0.61173975", "0.6108...
0.5857329
41
Returns a django.forms.Field instance for this database Field.
def formfield(self, form_class=MultipleSelectField, **kwargs): defaults = { 'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text, 'html_attrs': self.html_attrs } if self.has_default(): defaults[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_field(self):\n return self", "def get_field(self, field_name: str) -> fields.Field:\n field = self.try_get_field(field_name)\n if not field:\n raise ValueError(f\"Model {self} has no field {field_name}.\")\n return field", "def _db_field(self):\n return sel...
[ "0.7139312", "0.69126815", "0.6848137", "0.6637518", "0.6496184", "0.64671105", "0.64617246", "0.6460085", "0.63828045", "0.63828045", "0.63828045", "0.63828045", "0.6309175", "0.6302463", "0.6224699", "0.6215952", "0.61680114", "0.6158374", "0.6125468", "0.61173975", "0.6108...
0.5708478
51
Convert pydantic object to pandas dataframe with 1 row.
def to_df(self): return pd.DataFrame([dict(self)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_df(self):\n return pd.DataFrame([dict(self)])", "def to_df(self):\n return pd.DataFrame([dict(self)])", "def to_df(self):\n return pd.DataFrame([dict(self)])", "def to_df(self):\n return pd.DataFrame([dict(self)])", "def to_df(self):\n return pd.DataFrame([dict(sel...
[ "0.75369906", "0.75369906", "0.75369906", "0.75369906", "0.75369906", "0.7209753", "0.71949995", "0.71874905", "0.71487474", "0.71033204", "0.7100494", "0.7046343", "0.6982141", "0.69812274", "0.69812274", "0.6949213", "0.6906141", "0.68650144", "0.6826173", "0.681689", "0.67...
0.7580992
0
Return valid filename for image. If there are multiple files in the database they append it with ',{number}'. For example image.png,0. This method will put the `number` between the filename and the extension. Thus 'image.png,0' becomes 'image0.png'. Returns str Converted filename.
def get_filename(self) -> str: fname = self.url.split("/")[-1] if "," in fname: _fname, _i = fname.split(",") _split_fname = _fname.split(".") _name = _split_fname[0] _extension = _split_fname[-1] return _name + _i + "." + _extension el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_file_name(self):\n # create a unique id for the file name\n index = self.helpers.alpha_uuid()\n\n filename = self.form['FieldStorage'][self.image_cid].filename\n extension = guess_extension(guess_type(filename)[0])\n return ( # concatenates the following data\n ...
[ "0.712252", "0.6974862", "0.67796457", "0.6768139", "0.6755476", "0.6694814", "0.66734874", "0.6669626", "0.6649419", "0.664161", "0.65641737", "0.65102273", "0.6467254", "0.6443507", "0.64337325", "0.6411749", "0.6411749", "0.6411749", "0.64037764", "0.6389226", "0.63800997"...
0.70944995
1
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
def haversine(lon1, lat1, lon2, lat2): # https://stackoverflow.com/questions/15736995/how-can-i-quickly-estimate-the-distance-between-two-latitude-longitude-points # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine formula dlon = lon2 - l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.81450045", "0.7863265", "0.76322985", "0.76064754", "0.75978696", "0.75965863", "0.75944835", "0.75720793", "0.75630087", "0.7555095", "0.7528691", "0.7517629", "0.7492963", "0.7467739", "0.7452678", "0.7434477", "0.73914117", "0.7357736", "0.73484355", "0.73318124", "0.73...
0.0
-1
Returns a sorted list of stops, sorted by distance from the given point.
def get_stops_sorted( latitude, longitude ): returnvalue = [] stops_file = open( 'google_transit/stops.txt' ) stops_iter = DictReader( stops_file ) for stop in stops_iter: distance = angular_distance( latitude, longitude, float( stop[ 'stop_lat' ] ), float( stop[ 'stop_lon' ])) stop[ 'distance' ] = dis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sortDistance(self, point = (-1, -1)):\n return FeatureSet(sorted(self, key = lambda f: f.distanceFrom(point)))", "def sort(points):\n if len(points) == 0:\n return []\n \n starting_vertex = min(points)\n reference_point = starting_vertex + Point2D(0, 1)\n ...
[ "0.7020484", "0.63203174", "0.62495136", "0.5769085", "0.5747792", "0.56788474", "0.5570238", "0.54841065", "0.53662777", "0.5289484", "0.52861816", "0.5244743", "0.52408653", "0.5218816", "0.5199385", "0.5181247", "0.5177152", "0.5161949", "0.5161203", "0.5150489", "0.513137...
0.657288
1
Returns the angular distance between two points
def angular_distance( lat1, lon1, lat2, lon2 ): pi_180 = pi / 180 return acos( cos( lat1 * pi_180 ) * cos( lon1 * pi_180 ) * cos( lat2 * pi_180) * cos( lon2 * pi_180 ) + cos( lat1 * pi_180) * sin( lon1 * pi_180 ) * cos( lat2 * pi_180) * sin( lon2 * pi_180 ) + sin( lat1 * pi_180 ) * sin( lat2 * pi_180 ))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angular_distance(lng1, lat1, lng2, lat2):\n\n phi1 = math.radians(lat1)\n phi2 = math.radians(lat2)\n\n d_phi = math.radians(lat2 - lat1)\n d_lmd = math.radians(lng2 - lng1)\n\n A = math.pow(math.sin(d_phi / 2), 2) + \\\n math.cos(phi1) * math.cos(phi2) * \\\n math.pow(math.sin(d_lmd / 2), 2)\n\n return 2 * ...
[ "0.74848044", "0.69298506", "0.6856045", "0.6851529", "0.6850949", "0.6821571", "0.6805049", "0.68026394", "0.6726844", "0.67224205", "0.6722374", "0.671347", "0.67133456", "0.6711086", "0.6701511", "0.66720694", "0.667153", "0.66648185", "0.666308", "0.66407585", "0.6630755"...
0.7870642
0
Attach a lot of summaries to a Tensor (for TensorBoard visualization).
def variable_summaries(var): with tf.name_scope('summaries'): with tf.name_scope('mean'): mean = tf.reduce_mean(var) tf.summary.scalar('mean', mean) with tf.name_scope('stddev'): stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean))) tf.summary.scalar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_summary(self):\n for k, v in self.metrics.items():\n tf.summary.scalar(k, v)\n \n self.summary_op = tf.summary.merge_all()", "def build_summaries(self):\n\n # Loss summary.\n tf.summary.scalar('loss', self.loss)\n\n merged = tf.summary.merge_all()\n self.summary_op = merged\n ...
[ "0.7070732", "0.6969362", "0.6969362", "0.6800668", "0.6787022", "0.67409945", "0.66656876", "0.6657773", "0.6620287", "0.66077507", "0.6596125", "0.65843266", "0.6580329", "0.65522784", "0.6500319", "0.64599043", "0.64153045", "0.6294719", "0.6270816", "0.6270488", "0.626585...
0.55398446
89
returns True if the target value is in the list, otherwise returns False, the underlying algorithm is binary search
def in_bisect(sorted_list, target): size = len(sorted_list) left = 0 right = size - 1 while left <= right: middle = (left + right) // 2 #print('left -> %d \t right -> %d \t middle -> %d' % (left, right, middle)) if target < sorted_list[middle]: right = middle-1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bs_contains(ordered, target):\n\n low = 0\n high = len(ordered)-1\n while low <= high:\n \tmid = (low + high) / 2\n \tif target == ordered[mid]:\n \t\treturn True\n \telif target < ordered[mid]:\n \t\thigh = mid-1\n \telse:\n \t\tlow = mid+1\n\n return False", "def binary_sea...
[ "0.74859285", "0.73394114", "0.73217493", "0.72563255", "0.72552204", "0.72203624", "0.71295196", "0.70180285", "0.7016294", "0.6993585", "0.6989475", "0.69663733", "0.6929355", "0.6928552", "0.6900077", "0.68658483", "0.6857289", "0.6814464", "0.6795595", "0.67933756", "0.67...
0.6761557
21
Check if 'axis' has already been referenced with 'refmode'.
def _isreferenced(self, refmode, axis): if self.prop['forceref']: return False if refmode in ('POS',): return False if refmode == 'ATZ': return self.pidevice.qATZ(axis)[axis] if refmode == 'REF': return self.pidevice.qREF(axis)[axis] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ref_known(self):\r\n \r\n if \"N\" in self.ref:\r\n return False\r\n else:\r\n return True", "def checkRefs(self, export_refs):\r\n return True", "def _ref_with_refcmd(self, axes, refmode):\n debug('ControllerStartup._ref_with_refcmd(a...
[ "0.62752515", "0.6220863", "0.6005233", "0.59288573", "0.5925373", "0.58923024", "0.58557653", "0.5796622", "0.570388", "0.5672749", "0.5603658", "0.5603465", "0.55883646", "0.55624634", "0.55470496", "0.55324847", "0.5511487", "0.5494428", "0.5420732", "0.53797483", "0.53541...
0.7821823
0
Return dictionary of on target states for open or closedloop 'axes'. If qOSN is not supported open loop axes will return True.
def ontarget(pidevice, axes): if not isdeviceavailable([GCS2Commands, GCS21Commands], pidevice): raise TypeError('Type %s of pidevice is not supported!' % type(pidevice).__name__) axes = getaxeslist(pidevice, axes) if not axes: return {} servo = getservo(pidevice, axes) closedloopax...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def axes_coupled(robot):\n\n target_ctrl_path = get_target_ctrl_path(robot)\n attr_name = 'axisCoupling'\n\n attr_path = target_ctrl_path + '.' + attr_name\n\n if not pm.objExists(attr_path):\n return False\n else:\n return pm.getAttr(attr_path)", "def axes_active(self) -> np.ndarray...
[ "0.52759826", "0.51507485", "0.49435332", "0.48457035", "0.48273617", "0.47947535", "0.47759688", "0.47717133", "0.4736952", "0.47318158", "0.4717859", "0.471497", "0.46966356", "0.4686796", "0.4681813", "0.4674398", "0.46723193", "0.46713328", "0.46647486", "0.46268576", "0....
0.5636245
0
Test that webhook returns 500 for unkown action
def test_webhook_unkown_action(self): event = { "body": json.dumps({ "queryResult": { "action": "1manage_bmi" }}) } context = {} resp = webhook(event, context) self.assertEqual(resp["statusCode"], 500) self.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unsupported_action(self):\r\n self.xmodule.verify_oauth_body_sign = Mock()\r\n request = Request(self.environ)\r\n request.body = self.get_request_body({'action': 'wrongAction'})\r\n response = self.xmodule.grade_handler(request, '')\r\n real_response = self.get_response...
[ "0.69867796", "0.698422", "0.6960273", "0.67963976", "0.6699416", "0.6666364", "0.6647646", "0.6636956", "0.6598994", "0.6533085", "0.65311563", "0.653109", "0.651041", "0.64883715", "0.6477502", "0.64637", "0.6421816", "0.6410432", "0.6400015", "0.639822", "0.6357702", "0....
0.8470133
0
Calculates surface area of square
def square_surface_area(a): return (a*a)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_surface_area(self):\n return np.sum(self._find_triangle_areas())", "def surface_area(self) -> float:\n return 4 * np.pi * self.radius**2", "def surfaceArea(self):\n surfaceArea = self.sideLength**2 * 6\n return surfaceArea", "def rectangle_surface_area(a,b):\n retur...
[ "0.7919954", "0.76347554", "0.76003134", "0.73753244", "0.7210805", "0.70903355", "0.7076613", "0.7038129", "0.7034476", "0.6993899", "0.69891864", "0.6846133", "0.6832713", "0.6830783", "0.68109065", "0.6806593", "0.68017524", "0.6777848", "0.6749091", "0.67174566", "0.66962...
0.8115568
0
Sets the sender of this UpdateSmtpTemplate.
def sender(self, sender): self._sender = sender
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sender(self, sender: str):\n if sender is None:\n raise ValueError(\"Invalid value for `sender`, must not be `None`\") # noqa: E501\n\n self._sender = sender", "def sender(self, sender: Address) -> None:\n enforce(\n isinstance(sender, str), f\"Sender must be strin...
[ "0.7058966", "0.6835392", "0.62833107", "0.62126154", "0.5771215", "0.57069683", "0.5668948", "0.5637219", "0.55729574", "0.55395645", "0.5509899", "0.5509899", "0.5451803", "0.54177517", "0.5371461", "0.5345881", "0.5335251", "0.5296157", "0.52315205", "0.5206619", "0.520661...
0.59108436
8
Sets the template_name of this UpdateSmtpTemplate.
def template_name(self, template_name): self._template_name = template_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template_id(self, template_id):\n\n self._template_id = template_id", "def setTemplate(self, template):\n self.template = template", "def set_template(self, name, value):\n\n self.templates[name] = value", "def template_name(self, template_type: Union[TemplateType, str]) -> str:\n ...
[ "0.6428923", "0.63492084", "0.6289518", "0.62629175", "0.6210519", "0.6139613", "0.60831803", "0.6069467", "0.6065459", "0.60353065", "0.60353065", "0.58650047", "0.5752538", "0.5721378", "0.56142247", "0.5564095", "0.5535376", "0.55189353", "0.54267377", "0.5419198", "0.5413...
0.8125446
0
Sets the attachment_url of this UpdateSmtpTemplate.
def attachment_url(self, attachment_url): self._attachment_url = attachment_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attachment_id(self, attachment_id):\n\n self._attachment_id = attachment_id", "def avatar_url(self, avatar_url):\n\n self._avatar_url = avatar_url", "def attachment_file_name(self, attachment_file_name):\n\n self._attachment_file_name = attachment_file_name", "def attachment_file_nam...
[ "0.57066125", "0.56993", "0.5668265", "0.5668265", "0.5528204", "0.54329574", "0.54173625", "0.5387698", "0.5307973", "0.5294027", "0.52891266", "0.52693737", "0.51740557", "0.516391", "0.516391", "0.5150971", "0.5148844", "0.5120335", "0.5108294", "0.50362116", "0.50353986",...
0.7963267
0
Sets the is_active of this UpdateSmtpTemplate.
def is_active(self, is_active): self._is_active = is_active
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_active(self, is_active):\n \n self._is_active = is_active", "def is_active(self, is_active: bool):\n if is_active is None:\n raise ValueError(\"Invalid value for `is_active`, must not be `None`\")\n\n self._is_active = is_active", "def is_active(self, is_active):\n...
[ "0.73397493", "0.7168877", "0.68949836", "0.68922305", "0.68289626", "0.67404073", "0.67404073", "0.67404073", "0.67404073", "0.6705737", "0.6632772", "0.6599747", "0.644963", "0.64310765", "0.641627", "0.641627", "0.641627", "0.641627", "0.6081769", "0.6025035", "0.6015076",...
0.72923404
3
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, UpdateSmtpTemplate): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8089204", "0.8089204", "0.8055265", "0.7983358", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Print to stderr shorthand.
def errprint(*args): sys.stderr.write(' '.join(map(str,args)) + '\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def err_print(*args, **kwargs):\n print(*args, file=sys.stderr, **kwargs)", "def print_err(*args, **kwargs):\n print(*args, file=stderr, **kwargs)", "def printerr(*args, **kwargs):\n console_print(sys.stderr, *args, **kwargs)", "def error(*args, **kwargs):\n print(*args, file=sys.stderr, **kwargs...
[ "0.8116848", "0.81160986", "0.8031346", "0.7907138", "0.77580494", "0.77050763", "0.76942265", "0.7680025", "0.7668313", "0.76152235", "0.73743373", "0.73687625", "0.72907186", "0.7286313", "0.7248487", "0.7193676", "0.71489435", "0.7135852", "0.7126489", "0.7126489", "0.7126...
0.7630614
9
Return dict of platformdependent default paths.
def get_paths(): paths = {} if sys.platform == "linux" or sys.platform == "linux2": if os.path.exists("/usr/local/share/opencpn"): paths["systemdir"] = "/usr/local/share/opencpn" else: paths["systemdir"] = "/usr/share/opencpn" paths["systemdir"] += "/plugins-metad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_paths(self):\n return {key: value.default_path for key, value in self}", "def get_default_paths():\n DATA_ROOT = os.environ.get(\"DATA_ROOT\", \"data\")\n defaults = {\n \"TOKENIZE_DATA_DIR\": DATA_ROOT + \"/tokenize\",\n \"MWT_DATA_DIR\": DATA_ROOT + \"/mwt\",\n ...
[ "0.79842186", "0.73858106", "0.6776477", "0.66379195", "0.6599083", "0.64806676", "0.6358321", "0.6311555", "0.62456787", "0.624513", "0.61454284", "0.61094207", "0.60782266", "0.606998", "0.604509", "0.59834415", "0.5970117", "0.5903661", "0.5899699", "0.5867961", "0.5859237...
0.659432
5
Calculates the distance between 2 colors
def colorDistance(color1, color2): intColor1 = np.array(color1, dtype=int) intColor2 = np.array(color2, dtype=int) return sqrt(2 * (intColor1[0] - intColor2[0])**2 + 4 * (intColor1[1] - intColor2[1])**2 + 3 * (intColor1[2] - intColor2[2])**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color_distance(color1, color2):\n dist_h = color1[0] - color2[0]\n dist_s = color1[1] - color2[1]\n dist_v = color1[2] - color2[2]\n\n return sqrt(dist_h * dist_h + dist_s * dist_s + dist_v * dist_v)", "def color_distance(RGB1, RGB2):\n d2_r = (RGB1[0] - RGB2[0]) ** 2\n d2_g = (RGB1[1] - RG...
[ "0.86129403", "0.8573879", "0.85049134", "0.84547156", "0.8294029", "0.82709336", "0.82026094", "0.8028525", "0.7363183", "0.72872114", "0.7201384", "0.7116556", "0.6713742", "0.6638822", "0.6513618", "0.64796627", "0.6385172", "0.63207823", "0.6311719", "0.62588584", "0.6229...
0.85454017
2
Returns average color distance between pixels in originalPixels list and newPixels list
def checkQualityOfSection(originalPixels, newPixels): totalDistance = 0 numPixels = 0 for r in range(originalPixels.shape[0]): for c in range(originalPixels.shape[1]): if r == 0 or r == originalPixels.shape[0] - 1 or c == 0 or c == originalPixels.shape[1] - 1: continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(rgb1, rgb2):\n diffs = np.array(rgb1) - np.array(rgb2)\n return math.sqrt(np.sum(diffs**2))", "def color_distance(RGB1, RGB2):\n d2_r = (RGB1[0] - RGB2[0]) ** 2\n d2_g = (RGB1[1] - RGB2[1]) ** 2\n d2_b = (RGB1[2] - RGB2[2]) ** 2\n return d2_r + d2_g + d2_b", "def mold_image(self,...
[ "0.6561033", "0.6329309", "0.62736565", "0.62726533", "0.62004334", "0.61687744", "0.6100622", "0.60588473", "0.5993518", "0.59609854", "0.59419906", "0.593154", "0.5862414", "0.57588434", "0.5679564", "0.5677268", "0.56682885", "0.5631702", "0.5587156", "0.55482876", "0.5501...
0.6925194
0
Get the price of this membership as a string of pounds and pence.
def price_pounds(self): price = '{0:03d}'.format(self.price) return price[:-2] + '.' + price[-2:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_price(self):\n return self.price", "def get_price(self):\n return self.price", "def get_price(self):\n return self.price", "def price(self):\n return self.price_", "def display_price(self):\n return '$ '+str(self.price)", "def get_price(self):\n return se...
[ "0.7219085", "0.7219085", "0.7219085", "0.7204589", "0.7165673", "0.7139111", "0.7138113", "0.70815927", "0.7050938", "0.7050938", "0.69639355", "0.6915576", "0.68036145", "0.66906595", "0.6688339", "0.66788113", "0.65983194", "0.6585856", "0.6581671", "0.6524062", "0.6460041...
0.7743524
0
Get the price of the membership.
def price(self): return self.price_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_price(self):\n return self.price", "def get_price(self):\n return self.price", "def get_price(self):\n return self.price", "def get_price(self):\n return self._price", "def get_price(self):\r\n return self.price", "def getPrice(self):\n return self.price"...
[ "0.7833968", "0.7833968", "0.7833968", "0.778956", "0.77802473", "0.7591641", "0.7574471", "0.7574471", "0.7453541", "0.7266338", "0.7123246", "0.7090533", "0.7056376", "0.70204484", "0.6911015", "0.6853408", "0.6796563", "0.6790867", "0.67216057", "0.67171776", "0.67075324",...
0.75886303
6
Set the price of the membership.
def price(self, value): self.price_ = max(value, 0) if self.price_ == 0: self.mark_as_paid()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPrice(self, val):\n self.price = val", "def price(self, price):\n\n self._price = price", "def price(self, price):\n\n self._price = price", "def price(self, price):\n\n self._price = price", "def price(self, price):\n\n self._price = price", "def set_price(self,...
[ "0.78696364", "0.78645194", "0.78645194", "0.78645194", "0.78645194", "0.77774996", "0.7726788", "0.75905675", "0.7454649", "0.71044457", "0.7075923", "0.69270444", "0.67468005", "0.67468005", "0.6738048", "0.66158205", "0.65959406", "0.64347976", "0.6385287", "0.638108", "0....
0.6399383
18
Generate and return a list of three random strings.
def generate_path_segments(): # Constrain path characters to alphanumeric and # skip lookalikes (1, i, l, 0, o) allowed = \ 'abcdefghjkmnpqrstuvwxyz' \ 'ABCDEFGHJKMNPQRSTUVWXYZ' \ '23456789' segs = [] for index in range(3): # I will allow API path segments to be 3-8...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_strings(nr_strings, alphabet, length):\n strings = []\n for _ in range(0, nr_strings):\n strings.append(rng_string(alphabet, randint(0, length)))\n return strings", "def get_random_names(count=3):\n if not isinstance(count, int):\n raise ValueError('Need a number!')\n fi...
[ "0.74044436", "0.6997721", "0.69723463", "0.696553", "0.68062824", "0.6796104", "0.6794537", "0.6786202", "0.67664576", "0.67288446", "0.67187226", "0.66193795", "0.6597439", "0.6597439", "0.6597439", "0.6594594", "0.65810585", "0.6566894", "0.65430355", "0.64910704", "0.6482...
0.0
-1
returns input_ids, attention_mask, token_type_ids for set of data ready in BERT format
def prepare_set(text, max_length=64): global tokenizer text = [ preprocess_text(t) if set_id != "gr" else strip_accents_and_lowercase(preprocess_text(t)) for t in text ] t = tokenizer.batch_encode_plus(text, pad_to_max_length=True, add_special_tokens=True, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocessing_for_bert(self, data):\n # Create empty lists to store outputs\n input_ids = []\n attention_masks = []\n MAX_LEN = self.opt.MAX_QUESTION_LEN\n # For every sentence...\n for sent in data:\n \n encoded_sent = self.tokenizer.encode_plus(...
[ "0.7062984", "0.64507776", "0.6301123", "0.6267048", "0.6266138", "0.6251982", "0.62004155", "0.6124136", "0.6059433", "0.60182226", "0.6002676", "0.59950376", "0.5971897", "0.5971274", "0.589872", "0.58788574", "0.5875511", "0.58704543", "0.5867832", "0.58447826", "0.5836901...
0.59210354
14
Get group headers from self._grouping_labels
def _group_headers(self) -> List[str]: return [_[0] for _ in self._grouping_labels]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_group_names(self):\n return [self.frame.columns[i] for i in self.group_cols]", "def get_group_names(self):\r\n return self.groups.keys()", "def _flat_groupings(\n self, grouping: Tuple[Tuple[str, Tuple[Tuple[str, Any]]]] = None\n ) -> List[Tuple[str, Any]]:\n grouping = g...
[ "0.6871165", "0.6661643", "0.62353957", "0.6033604", "0.5959639", "0.59267735", "0.57593286", "0.5736832", "0.57264966", "0.57093465", "0.5673237", "0.56410503", "0.56166875", "0.5601591", "0.5574714", "0.5573216", "0.5543794", "0.54342717", "0.5420204", "0.53577757", "0.5335...
0.8808598
0
convert string to unicode
def str_to_unicode(text, encoding='utf-8'): if isinstance(text, str): return text.decode(encoding) elif isinstance(text, unicode): return text else: raise TypeError('str_to_unicode must receive a str or unicode object, got %s' % type(text).__name__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_unicode(string):\n\n if isinstance(string, str):\n return string.decode('utf-8')\n else:\n return unicode(string)", "def to_unicode(self, _string):\n if not isinstance(_string, unicode):\n try:\n _string = unicode(_string)\n except:\n ...
[ "0.7966668", "0.79333144", "0.79075515", "0.77981734", "0.77891207", "0.77775425", "0.7762543", "0.7740948", "0.7671407", "0.7626741", "0.76177394", "0.758305", "0.7575478", "0.75258815", "0.74426067", "0.74382097", "0.7393463", "0.73915756", "0.73915756", "0.73826355", "0.73...
0.7541535
13
load image, returns tensor
def image_loader(img_name, transform=None): image = Image.open(img_name) image = transform(image).float() image = torch.Tensor(image) if image.size(0) == 1: image = torch.cat((image, image, image), 0) image = Variable(image, requires_grad=False) image = image.unsqueeze(0) return imag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_image(self, id_: str) -> Tensor:\n filename = os.path.join(self.root, \"output\", id_ + \".jpg\")\n with Image.open(filename) as img:\n array = np.array(img)\n tensor: Tensor = torch.from_numpy(array) # type: ignore[attr-defined]\n # Convert from HxWxC to C...
[ "0.8322746", "0.79828805", "0.771963", "0.76471734", "0.7613312", "0.7497175", "0.7443528", "0.73994523", "0.73994523", "0.7335932", "0.73087394", "0.7267389", "0.7207316", "0.7166437", "0.7033066", "0.7005002", "0.7003158", "0.6993807", "0.69716966", "0.6958558", "0.69059306...
0.6976924
18
Reset the values of the hessian term and the bias term to zero to reset the
def reset_hessian_and_bias(self): # reset_shared_var(self.t_H) t = self.QUAD_REG if len(t.shape) == 1: self.t_H.set_value(np.diag(self.QUAD_REG)) elif len(t.shape) == 2: self.t_H.set_value(self.QUAD_REG) else: raise ValueError('Invalid quad_re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_parameters(self):\n if self.W is not None:\n tanh_gain = weight_init.calculate_gain(\"tanh\")\n weight_init.xavier_normal_(self.W, tanh_gain)\n # self.W.data.uniform_(-0.001, 0.001)", "def reset(self):\n self.reset_image_estimate()\n self.init_m_aux...
[ "0.70881516", "0.708221", "0.6806984", "0.67656636", "0.6675885", "0.6660311", "0.66351706", "0.66191715", "0.6577939", "0.6569499", "0.6541274", "0.6515547", "0.65126866", "0.6502201", "0.64899135", "0.6471892", "0.6464242", "0.64477897", "0.6444937", "0.6430383", "0.6421966...
0.7808178
0
Function to fetch the chain from a blockchain node, parse the data and store it locally.
def fetch_posts(): get_chain_address = "{}/chain".format(CONNECTED_NODE_ADDRESS) response = requests.get(get_chain_address) if response.status_code == 200: content = [] chain = json.loads(response.content) for pos, block in enumerate(chain["chain"]): if pos ==0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_chain():\n response = {\n 'chain': blockchain.chain,\n 'length':len(blockchain.chain)\n }\n\n return jsonify(response), 200", "def get_chain(self):\n app_process = sqlite3.connect('app_process::memory:', check_same_thread=False)\n app_process_cursor = app_process.curs...
[ "0.61759084", "0.58957267", "0.56563175", "0.5639484", "0.5556409", "0.55563444", "0.5422224", "0.5418525", "0.5364156", "0.51986253", "0.51876044", "0.5178942", "0.5089098", "0.50675553", "0.50588924", "0.50088316", "0.49951652", "0.49946082", "0.498919", "0.49730784", "0.49...
0.46158192
42
Verifies prediction and label shapes are equal.
def check_shape_equal(pred, labels): if pred.shape != labels.shape: raise ValueError('Prediction and labels shapes must be equal:' f'{pred.shape} vs {labels.shape}.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_label_shapes(labels, preds, shape=0):\n\n if shape == 0:\n label_shape, pred_shape = len(labels), len(preds)\n else:\n label_shape, pred_shape = labels.shape, preds.shape\n\n if label_shape != pred_shape:\n raise ValueError(\"Shape of labels {} does not match shape of \"\n ...
[ "0.7969878", "0.7264365", "0.7258978", "0.71695817", "0.6899441", "0.68151385", "0.6598533", "0.6566734", "0.6538672", "0.64354575", "0.6296917", "0.622556", "0.6192627", "0.6162538", "0.6154577", "0.6067735", "0.60317224", "0.6001732", "0.5992151", "0.5929971", "0.58998036",...
0.87678856
0
Verifies the nested dictionary dtypes are equal to target dtype.
def check_dtype_equal(input_dict, target_dtype = jnp.float32, exclude_list = ()): flat_input = traverse_util.flatten_dict(input_dict) for key, value in flat_input.items(): if key[0] in exclude_list: continue key_name = '_'.join([str(sub_key) for sub_key in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dtype_equality(self):\r\n dtypes = get_numeric_types(with_complex=True)\r\n # Perform all pairwise comparisons of dtypes, making sure comparing\r\n # their string representation yields the same result.\r\n for dtype1_idx, dtype1 in enumerate(dtypes):\r\n for dtype2 i...
[ "0.65680695", "0.6526487", "0.6405589", "0.6161182", "0.6083145", "0.60452515", "0.6042174", "0.6006597", "0.59724295", "0.59593993", "0.59462154", "0.59145516", "0.5882707", "0.5867973", "0.58577424", "0.58535045", "0.58512837", "0.583794", "0.58129144", "0.5789161", "0.5759...
0.79315984
0
Computes a safe divide which returns 0 if the denominator is zero.
def safe_divide(x, y, rtol = 1e-5, atol = 1e-8): is_zero = jnp.isclose(y, 0.0, rtol=rtol, atol=atol) safe_y = jnp.where(is_zero, jnp.ones_like(y), y) return jnp.where(is_zero, jnp.zeros_like(x), x / safe_y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def safe_divide(num,denom,ifzero=0.0):\n\n return ifzero if denom==0 else num/denom", "def safe_div(numerator, denominator, name='safe_div'):\n return array_ops.where(\n math_ops.equal(denominator, 0),\n array_ops.zeros_like(numerator),\n math_ops.div(numerator, denominator),\n name=name)...
[ "0.79543906", "0.7755627", "0.775295", "0.76914287", "0.76768035", "0.76334155", "0.75794435", "0.75274825", "0.7474466", "0.7414367", "0.7405881", "0.71072584", "0.710611", "0.7095741", "0.7004468", "0.6937613", "0.6930533", "0.68200856", "0.6744411", "0.6726299", "0.6687144...
0.5951222
78
Computes a safe log. This function returns 0.0 wherever x contains any value <= 0.0.
def safe_log(x): safe_x = jnp.where(x > 0.0, x, jnp.ones_like(x)) return jnp.where(x > 0.0, jnp.log(safe_x), jnp.zeros_like(x))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def safelog(x):\n #return np.log(x)\n return np.log(np.clip(x,floor,np.inf))", "def smart_log(self, value: float) -> float:\n if value > 0:\n return math.log(value, self.log_scale)\n elif value == 0:\n return 0\n elif value < 0:\n return -(math.log(abs(valu...
[ "0.8466852", "0.7791398", "0.76290375", "0.75993013", "0.75740945", "0.7498413", "0.7462287", "0.7412065", "0.72859854", "0.72764105", "0.7259336", "0.723413", "0.7206518", "0.71971625", "0.7141088", "0.7078743", "0.70738405", "0.70517623", "0.6978665", "0.69375044", "0.67808...
0.8335094
1
Computes the cross entropy loss between logits and the actual labels. Converts the labels into one hot and calls softmax_cross_entropy function to compute the loss
def onehot_cross_entropy_loss( logits, labels, loss_reduction = LossReductionType .SUM_BY_NONZERO_WEIGHTS, **kwargs): del kwargs vocab_size = logits.shape[-1] labels_one_hot = jax.nn.one_hot(labels.astype(jnp.int32), vocab_size) weights = jax.numpy.where(labels > 0, 1, 0) return softmax_cr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_entropy_loss(self, logits, labels):\n return F.cross_entropy(logits, labels)", "def softmax_cross_entropy(y, label):\r\n losses = np.sum((- np.log(y + g_epsilon) * label), axis=1)\r\n return losses\r\n pass", "def cross_entropy_loss(logits, labels, label_smoothing=0., dtype=jnp.float3...
[ "0.8201313", "0.79512864", "0.7912619", "0.79017407", "0.7825034", "0.78058565", "0.77078104", "0.7679489", "0.76698333", "0.76489973", "0.7614974", "0.75806975", "0.75430423", "0.75258714", "0.75047636", "0.74800843", "0.74709576", "0.74657154", "0.744807", "0.744807", "0.74...
0.7891177
4
A wrapper to add weight decay to underlying loss function. Use this wrapper if the weight decay in the optimizer is not suitable. For example, if you need to exclude some parameters from decay loss.
def weight_decay_loss_wrapper( loss_fn = gin.REQUIRED, factor = gin.REQUIRED, exclude = (), ): traversal = traverse_util.ModelParamTraversal( lambda path, _: all([e not in path for e in exclude])) def wrapped_loss(outputs, *args, params, **kwargs): losses = loss_fn(outputs, *args, **kwargs) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extend_with_decoupled_weight_decay(base_optimizer):\n\n class OptimizerWithDecoupledWeightDecay(DecoupledWeightDecayExtension,\n base_optimizer):\n \"\"\"Base_optimizer with decoupled weight decay.\n\n This class computes the update step of `base_optimizer` and\n...
[ "0.7632419", "0.76224226", "0.72987336", "0.70135576", "0.695887", "0.68777436", "0.6820775", "0.6765971", "0.67616886", "0.673294", "0.6707882", "0.6704943", "0.6666855", "0.66658753", "0.6649116", "0.6647162", "0.6631825", "0.6618139", "0.6591792", "0.6591792", "0.6585925",...
0.7627787
1
Sets the owner of this link.
def set_owner(self, owner: Optional["STACObject_Type"]) -> "Link": self.owner = owner return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_owner(self, owner):\n self.__owner = owner", "def set_owner(self, owner):\n self.settings[\"owner\"] = owner", "def owner(self, owner: str):\n\n self._owner = owner", "def owner(self, owner):\n self._owner = owner", "def owner(self, owner):\n self._owner = owner",...
[ "0.8302126", "0.8135389", "0.8064421", "0.79439116", "0.79439116", "0.79439116", "0.79439116", "0.7895545", "0.7895545", "0.7895545", "0.7895545", "0.7442883", "0.7366591", "0.7358244", "0.72455347", "0.6930826", "0.6841902", "0.6657067", "0.6593225", "0.6468359", "0.640672",...
0.85328895
0
Optional title for this link. If not provided during instantiation, this will attempt to get the title from the STAC object that the link references.
def title(self) -> Optional[str]: if self._title is not None: return self._title if self._target_object is not None and isinstance( self._target_object, pystac.Catalog ): return self._target_object.title return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_title(self) -> Optional[str]:\n return self.title", "def title(self) -> Optional[str]:\n return self.get(\"/Title\")", "def Title(self, default={}):\n return HEP.TitleObject(self.data.get('title', default))", "def short_title(self):\n if hasattr(self, \"title\"):\n ...
[ "0.69105786", "0.6895118", "0.6473908", "0.64691746", "0.64505994", "0.6439746", "0.6439746", "0.6439746", "0.6439746", "0.6439746", "0.6379838", "0.6379838", "0.6379838", "0.6379838", "0.63518524", "0.63235426", "0.63089734", "0.63060486", "0.62965906", "0.62965906", "0.6282...
0.7591315
0
Returns the HREF for this link. If the href is None, this will throw an exception. Use get_href if there may not be an href.
def href(self) -> str: result = self.get_href() if result is None: raise ValueError(f"{self} does not have an HREF set.") return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_href(self, transform_href: bool = True) -> Optional[str]:\n # get the self href\n if self._target_object:\n href = self._target_object.get_self_href()\n else:\n href = self._target_href\n\n if (\n transform_href\n and href\n ...
[ "0.68136275", "0.68054163", "0.68054163", "0.67377317", "0.66265225", "0.63145745", "0.6179258", "0.61082935", "0.60186666", "0.596101", "0.592977", "0.5924774", "0.58844876", "0.58479047", "0.580537", "0.57960415", "0.5775185", "0.5771198", "0.5771198", "0.5771198", "0.57571...
0.76138645
0
The target of the link. If the link is unresolved, or the link is to something that is not a STACObject, the target is an HREF. If resolved, the target is a STACObject.
def target(self) -> Union[str, "STACObject_Type"]: if self._target_object: return self._target_object elif self._target_href: return self._target_href else: raise ValueError("No target defined for link.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_target_str(self) -> Optional[str]:\n if self._target_href:\n return self._target_href\n elif self._target_object:\n return self._target_object.get_self_href()\n else:\n return None", "def has_target_href(self) -> bool:\n return self._target_hre...
[ "0.67976296", "0.62307954", "0.6215397", "0.61617273", "0.5862698", "0.565353", "0.5597784", "0.55615544", "0.5497127", "0.54542977", "0.5454122", "0.54058546", "0.53850055", "0.5383484", "0.5362352", "0.5348752", "0.53102714", "0.53102714", "0.5302297", "0.5296698", "0.52889...
0.795444
0
Returns this link's target as a string. If a string href was provided, returns that. If not, tries to resolve the self link of the target object.
def get_target_str(self) -> Optional[str]: if self._target_href: return self._target_href elif self._target_object: return self._target_object.get_self_href() else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target(self) -> Union[str, \"STACObject_Type\"]:\n if self._target_object:\n return self._target_object\n elif self._target_href:\n return self._target_href\n else:\n raise ValueError(\"No target defined for link.\")", "def href(self) -> str:\n res...
[ "0.6613602", "0.6349546", "0.6326438", "0.6221752", "0.6183839", "0.58277327", "0.5809976", "0.5801703", "0.5685269", "0.5653803", "0.561428", "0.561428", "0.546091", "0.5437358", "0.5431587", "0.540748", "0.540748", "0.540748", "0.540748", "0.540748", "0.540748", "0.540748...
0.8104228
0
Returns true if this link has a string href in its target information.
def has_target_href(self) -> bool: return self._target_href is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_href_valid(self, link):\n url = str(link['href'])\n # if it doesn't lead to a wiki page\n if not url.startswith(\"/wiki/\"):\n return False\n\n wikipedia_classes = [\"external_text\", \"mw-disambig\", \"infobox-data\"]\n # if the href has a class\n if lin...
[ "0.67790794", "0.6705688", "0.6634559", "0.65864813", "0.6529386", "0.64960945", "0.648174", "0.648174", "0.648174", "0.64595854", "0.64516133", "0.6385341", "0.6367129", "0.6193168", "0.6110131", "0.6107418", "0.60843617", "0.60497266", "0.60383934", "0.59954834", "0.5982210...
0.79885954
0
Determines if the link's target is a resolved STACObject.
def is_resolved(self) -> bool: return self._target_object is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target(self) -> Union[str, \"STACObject_Type\"]:\n if self._target_object:\n return self._target_object\n elif self._target_href:\n return self._target_href\n else:\n raise ValueError(\"No target defined for link.\")", "def has_target_href(self) -> bool:\...
[ "0.62964565", "0.6135031", "0.6005933", "0.5843953", "0.58416283", "0.5790394", "0.577382", "0.5659708", "0.56222975", "0.55950385", "0.5592904", "0.5583178", "0.5562626", "0.554284", "0.5501144", "0.54868263", "0.5481935", "0.5480033", "0.5472723", "0.54365206", "0.54336035"...
0.66906935
0
Return the default environment identifier. There are multiple ways for a user to specify the environment to use for python_secrets commands. Some of these involve explicit settings (e.g., via command line option, a saved value in the current working directory, or an environment variable) or implicitly from the name of ...
def get_default_environment(cwd=None): # NOTE(dittrich): I know this code has multiple return points # but it is simpler and easier to understand this way. # # Highest priority is inhereted environment variable. environment = os.getenv('D2_ENVIRONMENT', None) if environment is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_env_name(self):\n if self.options.environment:\n return self.options.environment\n elif os.environ.get(\"JUJU_ENV\"):\n return os.environ['JUJU_ENV']\n\n env_ptr = os.path.join(self.juju_home, \"current-environment\")\n if os.path.exists(env_ptr):\n ...
[ "0.71756715", "0.7117789", "0.68693656", "0.6850072", "0.68206316", "0.67635626", "0.6761713", "0.6749947", "0.6571323", "0.65223706", "0.64882225", "0.64521635", "0.64339304", "0.6418718", "0.64067113", "0.640124", "0.63758415", "0.63409525", "0.6335122", "0.6334783", "0.633...
0.74237955
0
Return sorted list of valid environment paths found in `basedir`.
def get_environment_paths(basedir=None): basedir = ( get_default_secrets_basedir() if basedir is None else Path(basedir) ) results = list() for item in sorted(basedir.iterdir()): if is_valid_environment(item): results.append(item) return results
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dir_list(load):\n if \"env\" in load:\n # \"env\" is not supported; Use \"saltenv\".\n load.pop(\"env\")\n\n ret = []\n\n if \"saltenv\" not in load:\n return ret\n\n saltenv = load[\"saltenv\"]\n metadata = _init()\n\n if not metadata or saltenv not in metadata:\n ...
[ "0.69561356", "0.62635636", "0.6199789", "0.6019164", "0.5972499", "0.5962681", "0.5954401", "0.5949282", "0.59453523", "0.5911142", "0.5864499", "0.58633655", "0.58458513", "0.581863", "0.5789844", "0.5776963", "0.5722316", "0.5696323", "0.5690342", "0.56546295", "0.5612966"...
0.843912
0
Searches a list of dictionaries by value of a specified key. Find the first item from a list of dicts where the key identified by ``key`` has the value specified by ``value``.
def find(lst, key, value): for i, dic in enumerate(lst): if dic[key] == value: return i return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _search_list_of_dictionaries(key, value, list_of_dictionaries):\n\n for element in list_of_dictionaries:\n if element.get(key) == value:\n return element\n return None", "def get_dictionary_from_list(list_to_search, key, search_value):\n for the_dict in list_to_sear...
[ "0.8390287", "0.80685455", "0.7539982", "0.7517039", "0.735684", "0.7351567", "0.7305957", "0.7119344", "0.6955537", "0.68692905", "0.6836406", "0.6823301", "0.6702182", "0.6554348", "0.6549927", "0.645468", "0.64451545", "0.64211553", "0.64078695", "0.6403113", "0.63743114",...
0.7123705
7
Updates current querystring with a given dict of params, removing existing occurrences of such params. Returns a urlencoded querystring.
def updated_querystring(request, params): original_params = request.GET.copy() for key in params: if key in original_params: original_params.pop(key) original_params.update(params) return original_params.urlencode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_query_params(cls, url: str, **params: Mapping[str, str]) -> str:\n url, _ = cls.separate_query_params(url, params.keys())\n return cls.add_query_params(url, **params)", "def get_query_string(p, new_params=None, remove=None):\n if new_params is None:\n new_params = {}\n if r...
[ "0.7936514", "0.74957633", "0.7153125", "0.6790267", "0.67709136", "0.6738045", "0.67204905", "0.6706251", "0.6668768", "0.66175866", "0.65436184", "0.64668345", "0.64521825", "0.64521825", "0.64507204", "0.6441597", "0.63582", "0.635697", "0.6322598", "0.6310018", "0.6254809...
0.8049712
1
Return list of service_ids that match a given datetime
def getServiceIdsForDate(self, dt, exclude0000=True): dayDict = {1:"monday", 2:"tuesday", 3:"wednesday", 4:"thursday", 5:"friday", 6:"saturday", 7:"sunday"} sqlQuery = "select service_id from calendar" \ + " where {} = 1".format(dayDict[dt.isoweekday()]) \ + " and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_serviceIDs_for_date(date):\n global SDHandler\n return SDHandler.effective_service_ids(date);", "def filter_list_by_day(vevent_seq, dt=None):\n dt = dt or datetime_now()\n if is_naive(dt):\n dt = make_aware(dt)\n start = datetime.datetime(dt.year, dt.month, dt.day, tzinfo=dt.tzinfo)\n ...
[ "0.7054457", "0.55842924", "0.5545218", "0.5449232", "0.53947216", "0.5309217", "0.52697635", "0.52399474", "0.5219247", "0.51845676", "0.51796013", "0.5153664", "0.51219136", "0.50670344", "0.5062298", "0.50604385", "0.5058337", "0.5056613", "0.5055468", "0.50297636", "0.501...
0.71749496
0
Returns the successor of element different from first_successor in a binary lattice
def other_above(self, element, first_successor): successors = list(self.above(element)) if len(successors) != 2: raise ValueError("element is not binary in lattice") elif successors[0] == first_successor: return successors[1] elif successors[1] == first_successor:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def other_under(self, element, first_predecessor):\n predecessors = list(self.under(element))\n if len(predecessors) != 2:\n raise ValueError(\"element is not binary in lattice\")\n elif predecessors[0] == first_predecessor:\n return predecessors[1]\n elif predeces...
[ "0.6546926", "0.64019597", "0.60879385", "0.6056825", "0.6039657", "0.5892914", "0.5845297", "0.57128656", "0.566253", "0.56558645", "0.56257665", "0.56140566", "0.5604517", "0.56000495", "0.56000495", "0.56000495", "0.56000495", "0.56000495", "0.56000495", "0.56000495", "0.5...
0.67283386
0
This helper function validates inputs to check that they are either scalars or arrays and then that any arrays of the same shape. It either raises an error or returns the common shape or 1 if all arguments are scalar.
def check_input_shapes(*args): # Collect the shapes of the inputs shapes = set() # DESIGN NOTES - currently allow: # - scalars, # - 0 dim ndarrays (also scalars but packaged differently) # - 1 dim ndarrays with only a single value for val in args: if isinstance(val, np.ndarr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def common_shape(arrays):\n arrays = iter(arrays)\n shape = next(arrays).shape\n for array in arrays:\n shape = tuple(a if a == b else None\n for a, b in zip(shape, array.shape))\n return shape", "def _get_consistent_shape(images: Iterable):\n dim0s = []\n dim1s = []...
[ "0.6624878", "0.65816003", "0.6564006", "0.64985836", "0.63906205", "0.63877285", "0.63808954", "0.63576496", "0.6357112", "0.6344511", "0.6341772", "0.62508506", "0.62365884", "0.62330407", "0.61754423", "0.61516166", "0.61161005", "0.6115013", "0.60989213", "0.60769963", "0...
0.82600343
0
Returns True if max episode steps have been reached.
def is_terminal(self) -> bool: return self.time_index == self.max_episode_steps - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_episode_end_condition(self):\n vehicles = self._get_available_vehicles()\n if np.sum(vehicles == 0) < self.episode_threshold:\n return True\n else:\n return False", "def _exceeded_maximum_iteration(self) -> bool:\n if self.iteration >= self._maxiter:\n...
[ "0.71122867", "0.6849744", "0.6711568", "0.670124", "0.6694763", "0.6669541", "0.6615247", "0.6608392", "0.6584162", "0.6422713", "0.6394887", "0.63653255", "0.63096106", "0.6282592", "0.6261041", "0.62465924", "0.6240609", "0.62317926", "0.62271726", "0.61191446", "0.6112608...
0.69028705
1
Reset the initial conditions and run a single step of the simulation so that `get_obs` here can be used in the first control step.
def reset(self, **kwargs) -> Tuple[dict, dict]: self.time_index = 0 self.time = self.simulation_times[self.time_index] self.charging_vehicles = [] self.departed_vehicles = [] # Select first N vehicles if not randomized, else shuffle rows of df. self.df = self._df.sampl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n \n self.env.reset()\n obs, _, done, _ = self.env.step(1)\n if done: \n self.env.reset()\n obs, _, done, _ = self.env.step(2)\n if done: \n self.env.reset()\n \n return obs", ...
[ "0.6886072", "0.67628556", "0.6514333", "0.64630187", "0.6340601", "0.62548536", "0.6253377", "0.6128681", "0.60707235", "0.6002343", "0.59971803", "0.5965147", "0.59519863", "0.5903619", "0.58806473", "0.58778477", "0.5875486", "0.58708036", "0.58708036", "0.58708036", "0.58...
0.5874901
17
Create an empty Queue. Test that its size is 0.
def test_new_queue_is_empty(self): queue = Queue_() self.assertTrue(queue.empty()) self.assertEqual(queue.size(), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_empty_queue():\n return Queue(0, None, None)", "def empty_queue():\n return Queue()", "def empty_queue():\n return Queue()", "def test_size_empty(the_queue):\n assert the_queue.size() == 0", "def test_size_of_new_queue():\n queue = Queue()\n assert queue.size() == 0", "def test...
[ "0.87515324", "0.8171699", "0.8171699", "0.81615436", "0.80206966", "0.75779504", "0.7575396", "0.7412317", "0.7373005", "0.73489606", "0.7348045", "0.7347103", "0.7224042", "0.7193373", "0.7141106", "0.71210796", "0.7055048", "0.7046142", "0.7018612", "0.6972072", "0.6963029...
0.8647534
1
Create a Queue from a list. Check that the size of queue equals to the size of the queue. Check that the top element of queue equals to the latest element of the list.
def test_new_queue_from_list(self): data = [1, 3, 5, 7, 2, 4] queue = Queue_(data) self.assertFalse(queue.empty()) self.assertEqual(queue.size(), len(data)) self.assertEqual(queue.top(), data[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_initialization_with_empty_list_last_node_check():\n queue = Queue([])\n assert queue._queue.last_node is None", "def queue_to_stack(queue):\n stack = Stack()\n check_list = []\n\n while len(queue) != 0:\n check_list.append(queue.dequeue())\n\n check_list.reverse()\n\n while c...
[ "0.656142", "0.6330778", "0.6320571", "0.6206751", "0.61039263", "0.60570526", "0.604458", "0.59754544", "0.5956983", "0.59466815", "0.59238017", "0.58860093", "0.58682257", "0.5859621", "0.5830505", "0.57924914", "0.57899845", "0.5778571", "0.5774191", "0.5771166", "0.576109...
0.83507144
0
Create a Queue_ from a generator. Test that its size equals to the number provided in the generator.
def test_new_queue_from_generator(self): queue = Queue_(range(10)) self.assertFalse(queue.empty()) self.assertEqual(queue.size(), 10) self.assertEqual(queue.top(), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def large_queue():\n que = Queue()\n for num in range(1, 11):\n que.enqueue(num)\n return que", "def build_generator(self, i):\n if self.rng.random() < self.freeze_probability:\n return SequenceIterator(self.rng.choice(SIZES[:SIZES.index(self.max_size)]))\n else:\n ...
[ "0.6048734", "0.60149246", "0.5839498", "0.5820395", "0.57929295", "0.57875896", "0.5727647", "0.57267374", "0.57099265", "0.5691689", "0.5681378", "0.5661334", "0.5646394", "0.5631191", "0.561792", "0.5603292", "0.55817884", "0.5534262", "0.55297804", "0.5498225", "0.5494258...
0.80516404
0
Create an empty Queue. Test that call of get function raises Assertion error
def test_call_get_of_empty_queue_raised_error(self): queue = Queue_() self.assertRaises(IndexError, queue.get)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_new_queue_is_empty(self):\n queue = Queue_()\n self.assertTrue(queue.empty())\n self.assertEqual(queue.size(), 0)", "def test_is_empty(self):\n queue = Queue()\n self.assertEqual(queue.is_empty(), True)\n queue.enqueue(1)\n self.assertEqual(queue.is_empty(), False)", "...
[ "0.8160254", "0.8153244", "0.8052863", "0.7911015", "0.7905001", "0.7894963", "0.76920027", "0.7689933", "0.7631737", "0.7544532", "0.75173104", "0.75173104", "0.7458197", "0.74333274", "0.7330861", "0.73305017", "0.729531", "0.72764575", "0.7261248", "0.7248773", "0.72299206...
0.8159753
1
A bit of hackery to get the first name and last name at the top of the form instead at the end.
def __init__(self, *args, **kw): super(SignupFormExtra, self).__init__(*args, **kw) # Put the first and last name at the top new_order = self.fields.keyOrder[:-2] new_order.insert(0, 'first_name') new_order.insert(1, 'last_name') self.fields.keyOrder = new_order
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_form_label_first_last(self):\n self.user.first_name = 'Full'\n self.user.last_name = 'Name'\n self.assertEqual(\n self.user.get_form_label(email=True),\n 'Full Name (testuser) <testuser@example.com>',\n )", "def get_full_name(self):\n full_name = ...
[ "0.68024236", "0.67611563", "0.6627254", "0.6617748", "0.65998566", "0.6593606", "0.65707374", "0.65366936", "0.652893", "0.65270996", "0.65101355", "0.65094435", "0.6499947", "0.64810055", "0.6469396", "0.64499617", "0.644919", "0.6432713", "0.64285314", "0.64285314", "0.640...
0.0
-1
return the neighbors of this vertex
def get_neighbors(self): return self.neighbors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbors(self):\n return self.mesh.neighbors()", "def neighbors(self):\n return self.graph.neighbors(self.id)", "def neighbors(self):\n return self._neighbors", "def get_neighbors(self):\n \n return self.adjacent.keys()", "def neighbours(self):\n return [x.nod...
[ "0.8425768", "0.8418366", "0.8311628", "0.8163226", "0.80177677", "0.79666513", "0.79441965", "0.78708047", "0.78681886", "0.7857", "0.7841807", "0.7841807", "0.7823757", "0.7800037", "0.7788394", "0.7778026", "0.7680035", "0.7657395", "0.7657395", "0.7637939", "0.74998033", ...
0.81125665
7
return the id of this vertex
def get_id(self): return self.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vertex_id(self):\n ident = self.vid\n self.vid += 1\n return ident", "def getNewVertexId(self):\n \n return str(self._maxVertexId + 1)", "def vertex_id_type(self):\n return self._vertex_id_type", "def getId(self):\n return _libsbml.GraphicalObject_getI...
[ "0.7892035", "0.7257178", "0.7131824", "0.7107204", "0.7085526", "0.70773166", "0.70301354", "0.702662", "0.70043594", "0.69884765", "0.6951958", "0.6932379", "0.6932379", "0.6923012", "0.6923012", "0.6923012", "0.6923012", "0.6923012", "0.6923012", "0.6892489", "0.6874294", ...
0.6832376
46
return all the vertices in the graph
def get_vertices(self): if self.vert_list.keys() != None: return self.vert_list.keys() raise KeyError("Vertex not found")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertices(self):\n return list(self._graph)", "def vertices(self):\n return list(self.__graph.values())", "def get_vertices(self):\n return self.graph.keys()", "def vertices(self):\n return list(self.graph_dict.keys())", "def vertices(self):\r\n return list(self.__grap...
[ "0.861594", "0.8598573", "0.8461272", "0.84232175", "0.83618134", "0.8358795", "0.8358795", "0.8358795", "0.83203393", "0.8090475", "0.79803914", "0.7959565", "0.79577017", "0.79134774", "0.7899346", "0.78649145", "0.78386706", "0.78323376", "0.78055906", "0.78055906", "0.777...
0.78921044
15
The object pk value as a string.
def object_pk(self): if self._wrapped not in (None, empty): return str(self._wrapped.pk) if '_object_pk' in self.__dict__: return self.__dict__['_object_pk'] identifier = self._get_identifier() if identifier: # noinspection PyBroadException ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_key(self) -> str:\n return self._values.get('object_key')", "def _get_obj_pk(self, obj):\n if self.use_natural_keys and hasattr(obj, 'natural_key'):\n raw_nat_key = obj.natural_key()\n obj_pk = smart_text(NATURAL_KEY_JOINER.join(raw_nat_key))\n keytype = ...
[ "0.73430043", "0.7338839", "0.73322386", "0.72485405", "0.71463984", "0.70808476", "0.70808476", "0.7046806", "0.7027561", "0.701783", "0.70041835", "0.70041835", "0.69952285", "0.6962158", "0.6962158", "0.6951326", "0.6927094", "0.69219065", "0.68189216", "0.6818153", "0.680...
0.75594234
0
Returns the sum of all the amicable numbers under n. >>> solution(10000) 31626 >>> solution(5000) 8442 >>> solution(1000) 504 >>> solution(100) 0 >>> solution(50) 0
def solution(n): total = sum( [ i for i in range(1, n) if sum_of_divisors(sum_of_divisors(i)) == i and sum_of_divisors(i) != i ] ) return total
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sumTo(n):\n\n sum_all = (n * (n+1))/2\n\n return sum_all", "def totalSolutions(n:int):\n\n memo = [0]*6\n memo[5] = 1\n if n == 1:\n return 1\n\n for i in range(n):\n solutions = sum(memo)\n memo.pop(0)\n memo.append(solutions)\n\n return memo.pop()", "def s...
[ "0.75704265", "0.7567007", "0.7502853", "0.7453001", "0.7453001", "0.74199104", "0.7372081", "0.7356077", "0.7310368", "0.7294893", "0.72215", "0.7114687", "0.7083928", "0.7040943", "0.6975035", "0.69693834", "0.69632906", "0.6895174", "0.6855686", "0.6822801", "0.6799302", ...
0.6534391
33
The working directory for the Configuration. Returns str Path to working directory.
def working_dir(cls) -> str: return cls._working_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def working_directory(self):\n return self._working_directory", "def working_dir(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"working_dir\")", "def get_working_dir(self):\r\n return self.process.get_working_dir()", "def workDir(self):\n self.debug.printHeader(...
[ "0.8272883", "0.80822647", "0.80707604", "0.7958291", "0.7886885", "0.7864339", "0.786264", "0.78127676", "0.7802864", "0.77705896", "0.77094704", "0.7702679", "0.7647526", "0.75679433", "0.75248295", "0.74807364", "0.7449656", "0.74102527", "0.739319", "0.7369031", "0.735653...
0.84283805
0
The temporary directory for outputs. Returns str Path to the temporary directory.
def temp_dir(cls) -> Union[str, Path]: if cls._temp_dir is None: msg = "temp_dir not supplied, defaulting to working_dir" run_log.warning(msg) return cls.working_dir else: return cls._temp_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def temp_directory(self):\n\n return self.get_raw(\"temp_directory\")", "def tempdir():\n\n # Create a directory and return the path\n return tempfile.mkdtemp()", "def get_temp_dir():\n return tempfile.mkdtemp()", "def get_temp_path():\n return os.getcwd() + \"/temp/\"", "def tempdir...
[ "0.811013", "0.79867524", "0.79506916", "0.79061234", "0.7889727", "0.7751684", "0.76945865", "0.76937467", "0.76878154", "0.763722", "0.75744534", "0.754457", "0.75371987", "0.74926746", "0.7451378", "0.744744", "0.7424311", "0.74204576", "0.7409969", "0.739947", "0.73595786...
0.7633598
10
The data directory for outputs. Returns str Path to the data directory.
def data_dir(cls) -> Union[str, Path]: if cls._data_dir is None: msg = "data_dir not supplied, defaulting to working_dir" run_log.warning(msg) return cls.working_dir else: return cls._data_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_dir(self) -> Path:\n return self._data_dir", "def data_directory(self):\n\n return self.get_raw(\"data_directory\")", "def get_data_dir() -> str:\n os.makedirs(DEFAULT_OUTPUT_DIR, exist_ok=True)\n return DEFAULT_OUTPUT_DIR", "def get_data_dir(self):\n return self.data_dir"...
[ "0.8403194", "0.8345147", "0.8334831", "0.82861847", "0.82107955", "0.82107955", "0.81990373", "0.81348646", "0.8078026", "0.8069524", "0.79723597", "0.78643006", "0.78466976", "0.78240585", "0.78233856", "0.77694124", "0.7732511", "0.772405", "0.7674926", "0.7654644", "0.765...
0.7797625
15
Reads and populates from json.
def from_dict(self, data: dict): for name, sub in data.items(): if hasattr(getattr(self, name, None), "from_dict"): getattr(self, name).from_dict(sub) else: setattr(self, name, decoder(sub))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_json(self):\n\n self.load_json_str(self.get_json_str())", "def load_from_json(self, json={}):\n\n self.original_json = json\n for key in self.__dict__.keys():\n if key in json:\n setattr(self, key, json[key])\n\n self.set_expiration()", "def read_j...
[ "0.7214153", "0.6813726", "0.680829", "0.6796304", "0.6724903", "0.67024136", "0.66402966", "0.6591609", "0.6578776", "0.6578776", "0.65351284", "0.65351284", "0.65126956", "0.6503687", "0.6492366", "0.64710087", "0.64565194", "0.64377207", "0.6428473", "0.63873994", "0.63809...
0.0
-1
initialisations of dataframe storage class. Attributes
def __init__(self): self.data = None self.compiled = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, df):\n self.df = df", "def __init__(self, df):\n self.df = df\n self._set_hash()", "def __init__(self, df):\n self.data = df", "def __init__(self):\n BDLQuery.__init__(self)\n self.pandas_df = []", "def __init__(self, df):\n self.original_...
[ "0.7946648", "0.7769436", "0.77689147", "0.753167", "0.74400496", "0.7379767", "0.7273143", "0.7257649", "0.71998584", "0.71116513", "0.7073033", "0.70523196", "0.70502305", "0.69554234", "0.6952958", "0.6889403", "0.677408", "0.6722787", "0.6719446", "0.6713069", "0.6670152"...
0.0
-1
Reads and populates from json. Loads in the parent class and then populates the dataframe if required.
def from_dict(self, data: dict): super().from_dict(data) if self.data is not None: try: self.data["columns"] = np.array( [int(col) for col in self.data["columns"]] ) except: pass self.data = pd.DataFr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, animals_data=\"animals.json\", food_data=\"food.json\", zookeeper_data=\"zookeeper.json\"):\n if type(animals_data) is pd.DataFrame:\n self.animals_df = animals_data\n else:\n self.animals_df = pd.read_json(animals_data)\n\n if type(food_data) is pd.Dat...
[ "0.6633983", "0.66326016", "0.65159917", "0.6299965", "0.6267431", "0.620024", "0.6075206", "0.60262954", "0.6010111", "0.59935445", "0.5872419", "0.5857605", "0.58146614", "0.58114433", "0.58065546", "0.580541", "0.5805088", "0.5773758", "0.5768019", "0.57508796", "0.5750645...
0.5811423
14
return for the current row of the books dataFrame the rate of the first review
def return_first_review_overall(x, review_books_df): asin = x.name return review_books_df.query('asin == @asin').sort_values(by=['unixReviewTime']).iloc[0].overall
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rating(self):\n average = self.review.all().aggregate(Avg('rating'))['rating__avg']\n if not average:\n return 0\n return average", "def get_current_rate(self):\n pass", "def get_rating(self):\n self.total = sum(int(review['stars']) for review in self.reviews.v...
[ "0.6295078", "0.617707", "0.6110781", "0.59789956", "0.58231413", "0.58185756", "0.57670903", "0.5752119", "0.56879455", "0.5686966", "0.56659776", "0.5629178", "0.56277907", "0.5627686", "0.56208754", "0.5620721", "0.56025547", "0.5594329", "0.5588395", "0.5568699", "0.55582...
0.6859296
0
return the letter H, L or M from a rating value
def return_category_from_value_HML(val): val = int(val.values[0]) if val == 5: return 'H' elif val == 4: return 'M' else: return 'L'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_rating_text(self) -> str:\n\n rating_text = \"\"\n if self.current_level.rating:\n rating_text = f\"{self.current_level.rating}⭐\"\n\n return rating_text", "def get_letter(value, IC_type):\n\tif value > 10 or value < 0:\n\t\t# Invalid value (must be between 0 to 10)\n\t\t...
[ "0.6330846", "0.62616825", "0.6134952", "0.612155", "0.61200655", "0.61006725", "0.6098099", "0.607265", "0.59683573", "0.59428596", "0.58588976", "0.5760137", "0.5733303", "0.5732842", "0.57232374", "0.5706526", "0.56809527", "0.56723946", "0.56552404", "0.56552404", "0.5648...
0.6004075
8
plot the errorplot with each longterm ratings mean.
def plot_lastreviews_means_and_errors(H_in_HL_mean, H_in_HL_error, L_in_HL_mean, L_in_HL_error, H_in_HH_mean, H_in_HH_error, H_in_HM_mean, H_in_HM_error, M_in_HM_mean, M_in_HM_error): # plot the result in a nice plot plt.figure(figsize=(1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_errors(self):\n\n plt.title(\"Prediction Error\")\n plt.plot(self.errors)\n plt.ylabel(\"MSE (Mean Squared Error)\")\n plt.xlabel(\"Iteration\")\n plt.show()", "def plot_lastreviews_means_and_errors_scaled(H_in_HH_mean, H_in_HH_error, M_in_MM_mean, M_in_MM_error, L_in_...
[ "0.7123026", "0.6633457", "0.65329194", "0.6492488", "0.64087635", "0.6374497", "0.63542676", "0.62802917", "0.61992013", "0.6183493", "0.613223", "0.6128087", "0.61226404", "0.6120966", "0.6115421", "0.6091699", "0.608599", "0.6078244", "0.6043395", "0.60348445", "0.603081",...
0.72428143
0
plot the errorplot with each longterm ratings mean.
def plot_lastreviews_means_and_errors_scaled(H_in_HH_mean, H_in_HH_error, M_in_MM_mean, M_in_MM_error, L_in_LL_mean, L_in_LL_error, H_in_HL_mean, H_in_HL_error, L_in_HL_mean, L_in_HL_error, H_in_HM_mean, H_in_HM_error, M_in_HM_mea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_lastreviews_means_and_errors(H_in_HL_mean, H_in_HL_error, L_in_HL_mean, L_in_HL_error,\n H_in_HH_mean, H_in_HH_error, H_in_HM_mean, H_in_HM_error,\n M_in_HM_mean, M_in_HM_error):\n # plot the result in a nice plot\n plt.figure(f...
[ "0.72428143", "0.7123026", "0.65329194", "0.6492488", "0.64087635", "0.6374497", "0.63542676", "0.62802917", "0.61992013", "0.6183493", "0.613223", "0.6128087", "0.61226404", "0.6120966", "0.6115421", "0.6091699", "0.608599", "0.6078244", "0.6043395", "0.60348445", "0.603081"...
0.6633457
2
Function to clean the lyrics. It lowercases the lyrics, tokenizes it and removes all stopwords.
def clean_lyrics(data): #Initialize list to store clean data, tokenizer and the set of stopwords cleaned_data = [] tokenizer = RegexpTokenizer(r'\w+') stopword_set = set(stopwords.words('english')) # Clean data for all the lyrics in the list for doc in data: # Get lowercase of lyrics string...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_stopwords(text):\n tokens = tokenize(text)\n tokens = stopwordsRem(tokens)\n return tokens", "def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n ...
[ "0.7149533", "0.711997", "0.71127933", "0.70084614", "0.7008055", "0.6964465", "0.69019014", "0.6889795", "0.6886759", "0.6817508", "0.680712", "0.680712", "0.680712", "0.680712", "0.680712", "0.680712", "0.6803836", "0.6785484", "0.6744621", "0.6723114", "0.6663751", "0.66...
0.80085784
0
Function to download the nltk stopwords, necessary for downloading them in deployed streamlit.
def download_nltk(): nltk.download('stopwords') return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_stopwords():\n\n try:\n stopwords = nltk.corpus.stopwords.words('english')\n except LookupError:\n nltk.download('stopwords')\n stopwords = nltk.corpus.stopwords.words('english')\n\n return stopwords", "def getStopWords():\n import os\n cur_dir = os.getcwd()\n\n d...
[ "0.7056914", "0.672676", "0.65633", "0.64674133", "0.64260197", "0.60864633", "0.60857505", "0.6040219", "0.5840577", "0.5820878", "0.5693822", "0.5691857", "0.5678198", "0.567216", "0.567216", "0.5590431", "0.5583685", "0.55802655", "0.5579682", "0.5562735", "0.5561147", "...
0.8456259
0
Gets the policy_filter of this OrganizationPolicyAssignmentResponse.
def policy_filter(self): return self._policy_filter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy(self) -> HwPolicy:\n return self._policy", "def policy(self) -> typing.Optional[\"BucketPolicy\"]:\n return jsii.get(self, \"policy\")", "def policy(self) -> typing.Optional[\"BucketPolicy\"]:\n return jsii.get(self, \"policy\")", "def policy(self) -> pulumi.Output[str]:\n ...
[ "0.64426523", "0.63347477", "0.63347477", "0.6254262", "0.6254262", "0.6254262", "0.6232846", "0.6154645", "0.6054802", "0.6038672", "0.5961586", "0.5961586", "0.5961586", "0.59271795", "0.5914966", "0.5914966", "0.59142625", "0.5909025", "0.59050524", "0.58475024", "0.584271...
0.7547869
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, OrganizationPolicyAssignmentResponse): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Generator of ntuples from iterable
def gen_4_tuples(it): return list(zip(it[0::4], it[1::4], it[2::4], it[3::4]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch(\n iterable: Iterable[_T], n: int\n) -> Generator[tuple[_T, ...], None, None]:\n iterator = iter(iterable)\n while True:\n try:\n # Unnecessary list here, but a generator won't raise StopIteration,\n # instead it will raise RuntimeError: \"generator raises StopIteration\".\n # I'd ...
[ "0.7630275", "0.73351336", "0.73198056", "0.7250565", "0.72191614", "0.7164015", "0.71611464", "0.70801914", "0.70235115", "0.7004495", "0.7003316", "0.7003056", "0.69986975", "0.69799066", "0.68949616", "0.6889569", "0.6816095", "0.6791507", "0.6791507", "0.6774855", "0.6707...
0.6507567
29
Generator of ntuples from iterable
def gen_4_tuples(it): return list(zip(it[0::4], it[1::4], it[2::4], it[3::4]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch(\n iterable: Iterable[_T], n: int\n) -> Generator[tuple[_T, ...], None, None]:\n iterator = iter(iterable)\n while True:\n try:\n # Unnecessary list here, but a generator won't raise StopIteration,\n # instead it will raise RuntimeError: \"generator raises StopIteration\".\n # I'd ...
[ "0.7630275", "0.73351336", "0.73198056", "0.7250565", "0.72191614", "0.7164015", "0.71611464", "0.70801914", "0.70235115", "0.7004495", "0.7003316", "0.7003056", "0.69986975", "0.69799066", "0.68949616", "0.6889569", "0.6816095", "0.6791507", "0.6791507", "0.6774855", "0.6707...
0.6507567
28
Given a list of dicts/objects return a dict mapping item[key_name] > item
def list_to_map(item_list, key_name): return {x.pop(key_name): x for x in item_list}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items_dict(slist, key=None):\n fields = slist.fields()\n items = [collections.OrderedDict((k, f) for k, f in zip(fields[0], item))\n for item in fields[1:]]\n if key:\n return collections.OrderedDict((i[key], i) for i in items)\n else:\n return items", "def list_to_dict(...
[ "0.668586", "0.6637244", "0.63673234", "0.6252041", "0.60777247", "0.59447753", "0.59235644", "0.59206873", "0.58975065", "0.58687013", "0.58588576", "0.58409035", "0.57967824", "0.5757043", "0.5666372", "0.5651253", "0.56499344", "0.56259024", "0.56049645", "0.55956835", "0....
0.7173263
0
Slightly more direct converter for header,row combo into a dict of objects
def pivot_rows_to_keys(header_list, row_list, key_names=[], whitelist_headers=None): header_map = {v: header_list.index(v) for v in [x for x in header_list if not whitelist_headers or x in whitelist_headers or x in key_names]} key_idxs = [] for key_name in key_names: key_idxs.appe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_factory(cursor, row):\n rowdict = {}\n for idx, col in enumerate(cursor.description):\n rowdict[col[0]] = row[idx]\n return rowdict", "def make_dict(row):\n return dict((key[0], value) for key, value in zip(colnames, row))", "def make_dicts(cursor, row):\n ret...
[ "0.6960638", "0.6893799", "0.6752165", "0.6752165", "0.671053", "0.669405", "0.6643579", "0.6634165", "0.6623209", "0.65957767", "0.6593919", "0.6593919", "0.6593919", "0.6520989", "0.6518434", "0.64453775", "0.6433524", "0.6412034", "0.6341894", "0.6289053", "0.62455565", ...
0.0
-1
Simple utility function. Expects a UTC input, does no tz conversion
def datetime_to_rfc3339(dt_obj): return dt_obj.strftime(rfc3339_date_fmt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromutc(self, dt):\n if dt.tzinfo is None:\n return dt.replace(tzinfo=self)\n return super(UTC, self).fromutc(dt)", "async def test_process_timestamp_to_utc_isoformat() -> None:\n datetime_with_tzinfo = datetime(2016, 7, 9, 11, 0, 0, tzinfo=dt_util.UTC)\n datetime_without_tzinf...
[ "0.70308954", "0.70109975", "0.6943024", "0.6821358", "0.67526853", "0.6719707", "0.6668003", "0.6651226", "0.6610945", "0.66026133", "0.65995836", "0.6597547", "0.65736383", "0.6568187", "0.65412307", "0.64541227", "0.6453167", "0.64465904", "0.64254415", "0.64245594", "0.64...
0.0
-1
Helper method for escaping the Ensures that resulting version is CPE 2.3 formatted string compliant, this is necessary for as_cpe22_uri() to do its thing affected version data in nvd json data which is usually unescaped. Converts the supplied version
def update_version(self, version): self.version = CPE.escape_for_cpe23_fs(version)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __format_golang_version(self, version):\n if '.' in version and version[0].isdigit():\n version = 'v' + version\n return version", "def format_version(version):\n\n return \"v%03d\" % version", "def _canonicalize_version(_version: str) -> str:\n\n try:\n version = Pyth...
[ "0.63605845", "0.6071471", "0.59519637", "0.58833855", "0.58813864", "0.5815081", "0.57764536", "0.5725392", "0.567802", "0.56723124", "0.56363887", "0.5627636", "0.5595905", "0.5481817", "0.5464057", "0.5450415", "0.54397607", "0.5431349", "0.5430239", "0.54297805", "0.54265...
0.60912997
1
Helper method for escaping special characters as per the CPE 2.3 formatted string spec
def escape_for_cpe23_fs(element): if not isinstance(element, str): raise Exception('Value to be escaped is not a string') if element in ['*', '-', '']: # let these pass through as they are return element elif any(char in CPE_SPECIAL_CHAR_ENCODER.keys() for char in elem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _escape(s):\n assert isinstance(s, str), \\\n \"expected %s but got %s; value=%s\" % (type(str), type(s), s)\n s = s.replace(\"\\\\\", \"\\\\\\\\\")\n s = s.replace(\"\\n\", \"\\\\n\")\n s = s.replace(\"\\t\", \"\\\\t\")\n s = s.replace(\",\", \"\\t\")\n return s", "def _escapeSpecialCharacters(...
[ "0.78421646", "0.775181", "0.7700246", "0.75963396", "0.75397426", "0.73587126", "0.7323553", "0.7311374", "0.7195743", "0.71949416", "0.7188537", "0.7143813", "0.7134885", "0.711369", "0.7092969", "0.708906", "0.7060448", "0.7057724", "0.70461917", "0.70264775", "0.70227337"...
0.6423762
81
Determines whether a user has DAG read access.
def can_read_dag(self, dag_id: str, user=None) -> bool: root_dag_id = self._get_root_dag_id(dag_id) dag_resource_name = permissions.resource_name_for_dag(root_dag_id) return self.has_access(permissions.ACTION_CAN_READ, dag_resource_name, user=user)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_read(self, user):\n raise Return(True)", "def has_read_permission(request):\n return request.user.is_authenticated", "def has_access(self, action_name: str, resource_name: str, user=None) -> bool:\n if not user:\n user = g.user\n if (action_name, resource_name) in...
[ "0.7598551", "0.7589699", "0.7226936", "0.7186378", "0.71421206", "0.7118634", "0.70449024", "0.6999025", "0.69731724", "0.6968622", "0.6941354", "0.69252783", "0.69086224", "0.6758709", "0.6709498", "0.66952443", "0.6646694", "0.6631528", "0.6598221", "0.65821195", "0.657995...
0.7601378
0
Determines whether a user has DAG edit access.
def can_edit_dag(self, dag_id: str, user=None) -> bool: root_dag_id = self._get_root_dag_id(dag_id) dag_resource_name = permissions.resource_name_for_dag(root_dag_id) return self.has_access(permissions.ACTION_CAN_EDIT, dag_resource_name, user=user)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_can_edit(self, user):\n return user == self.owner", "def can_be_edited(self, user):\n return (self.is_public or user == self.owner or\n user in list(self.auth_users.all()))", "def can_edit_user(user):\n\tu = current_user._get_current_object()\n\treturn u==user or u.is_admin()", "def...
[ "0.8196486", "0.8158488", "0.8127265", "0.78834283", "0.7858913", "0.78170127", "0.7639393", "0.7588364", "0.7568134", "0.7498156", "0.74698603", "0.7469665", "0.738535", "0.738195", "0.734322", "0.7330942", "0.72021836", "0.7200458", "0.7199215", "0.7175251", "0.7113749", ...
0.7417644
12
Determines whether a user has DAG delete access.
def can_delete_dag(self, dag_id: str, user=None) -> bool: root_dag_id = self._get_root_dag_id(dag_id) dag_resource_name = permissions.resource_name_for_dag(root_dag_id) return self.has_access(permissions.ACTION_CAN_DELETE, dag_resource_name, user=user)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_delete(self, user):\n raise Return(False)", "def check_delete_permission(self):\n if getSecurityManager().checkPermission(\"Delete objects\", self):\n username = getSecurityManager().getUser().getUserName()\n if username == self.getOwner().getId():\n ret...
[ "0.78429", "0.7446556", "0.7367293", "0.72968274", "0.72547096", "0.71889985", "0.71632475", "0.71632475", "0.7145582", "0.7087952", "0.7009737", "0.7005602", "0.68999463", "0.68475777", "0.6841784", "0.6757655", "0.6748384", "0.6725004", "0.66738075", "0.6660552", "0.6650544...
0.75682795
1
Whether the user has this role name.
def _has_role(self, role_name_or_list: Container, user) -> bool: if not isinstance(role_name_or_list, list): role_name_or_list = [role_name_or_list] return any(r.name in role_name_or_list for r in user.roles)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_role(self, role_name):\n\n return any(r.name == role_name for r in self.roles)", "def has_role(self, role):\n\n if self.roles and (role in self.roles):\n return True\n return False", "def has_role(self, role):\n return False", "def hasRole():\n conn = iamConn...
[ "0.7989628", "0.7720755", "0.7675134", "0.7429624", "0.7336531", "0.7005844", "0.6994442", "0.69907486", "0.69821125", "0.69522184", "0.6943753", "0.69332", "0.69194365", "0.6911759", "0.6908945", "0.68643034", "0.68545574", "0.68545127", "0.6847402", "0.6833809", "0.6804268"...
0.7358908
4
Compute the softmax values for x. Returns
def softmax(x): """""" return exp(x) / sum(exp(x), axis=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, x):\n\n out = np.zeros(x.shape)\n for i in range(x.shape[0]):\n max_x = x[i] - np.max(x[i])\n out[i] = np.exp(max_x) / np.sum(np.exp(max_x), axis=0)\n\n return out", "def softmax(self, x):\n if x.ndim == 1:\n x = x.reshape((1, -1))\n ...
[ "0.9161911", "0.89887714", "0.89874166", "0.8967078", "0.8965579", "0.8953441", "0.89481646", "0.89442265", "0.89437145", "0.89132607", "0.8904507", "0.8864177", "0.8864177", "0.8863592", "0.88509274", "0.8844156", "0.88250345", "0.8820495", "0.8820495", "0.8820495", "0.88204...
0.89287674
9
Evaluates the model for current parameter values.
def evaluate(self, x): try: z = ((x - self["mu"]) + (1.j) * abs(self["al"])) / \ (numpy.sqrt(2.0) * abs(self["ad"])) y = self["A"] * numpy.real(sps.wofz(z)) y /= (abs(self["ad"]) * numpy.sqrt(2.0 * numpy.pi)) y += x * self["lin"] + self["off"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _evaluate_model_parameters(self, session):\n logger.info('There are no model specific operation evaluation!')", "def _run_point(self, data_param):\n\n dvals = [float(val) for val in data_param.values()]\n self._parent.set_parameters(dvals)\n \n # Run the model\n supe...
[ "0.6914057", "0.68656504", "0.66800463", "0.66631466", "0.66631466", "0.66454923", "0.6585017", "0.65470123", "0.6534865", "0.65036184", "0.64991385", "0.649602", "0.6465108", "0.64618087", "0.6455278", "0.6400785", "0.6396289", "0.6369079", "0.63528275", "0.63415813", "0.633...
0.0
-1
Evaluates the model for current parameter values.
def evaluate(self, x): # Assign 'continuum' y = self["off"] + self["lin"] * x # Add Voigt lines for i in smo.range(self.n): p = str(i + 1) self._v1d.assignValues( {"A": self["A" + p], "al": self["al" + p], "ad": self["ad" + p], "mu": self["mu" + p]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _evaluate_model_parameters(self, session):\n logger.info('There are no model specific operation evaluation!')", "def _run_point(self, data_param):\n\n dvals = [float(val) for val in data_param.values()]\n self._parent.set_parameters(dvals)\n \n # Run the model\n supe...
[ "0.6914057", "0.68656504", "0.66800463", "0.66631466", "0.66631466", "0.66454923", "0.6585017", "0.65470123", "0.6534865", "0.65036184", "0.64991385", "0.649602", "0.6465108", "0.64618087", "0.6455278", "0.6400785", "0.6396289", "0.6369079", "0.63528275", "0.63415813", "0.633...
0.0
-1
Determines the best satellite number for a given date.
def _get_goes_sat_num(self, date): # GOES-17 is operational but currently does not provide Level 2 data # GOES-16 start date is based on the availability of regular level 1b data suvi_operational = { 16: TimeRange("2018-06-01", parse_time("now")), } results = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_goes_sat_num(self, date):\n goes_operational = {\n 2: TimeRange(\"1981-01-01\", \"1983-04-30\"),\n 5: TimeRange(\"1983-05-02\", \"1984-07-31\"),\n 6: TimeRange(\"1983-06-01\", \"1994-08-18\"),\n 7: TimeRange(\"1994-01-01\", \"1996-08-13\"),\n 8...
[ "0.74015623", "0.56602454", "0.5434096", "0.5408103", "0.5402877", "0.53601795", "0.53103787", "0.52805215", "0.5273263", "0.5166013", "0.5148456", "0.5140715", "0.5115912", "0.5089272", "0.50828665", "0.50501645", "0.50464404", "0.4998767", "0.49792892", "0.49729776", "0.497...
0.74445915
0
Convert a imageIO byte encoded image into a image tensor suitable as input to ConvNets The name of the input must be a subset of those specified in `image.imageIO.imageSchema`.
def buildSpImageConverter(img_dtype): with IsolatedSession() as issn: # Flat image data -> image dimensions # This has to conform to `imageIO.imageSchema` height = tf.placeholder(tf.int32, [], name="height") width = tf.placeholder(tf.int32, [], name="width") num_channels = tf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tensor2im_raw(input_image, imtype=np.float64):\n if not isinstance(input_image, np.ndarray):\n if isinstance(input_image, torch.Tensor): # get the data from a variable\n image_tensor = input_image.data\n else:\n return input_image\n image_numpy = image_tensor[0].c...
[ "0.61793643", "0.61714", "0.61179817", "0.6091925", "0.60696024", "0.60183555", "0.59447914", "0.5940669", "0.5937978", "0.593109", "0.5930596", "0.589751", "0.58831567", "0.58694065", "0.5869341", "0.58426666", "0.5834395", "0.58255255", "0.58113605", "0.58113605", "0.581136...
0.0
-1
Return unique id of this task.
def task_id(self): return self._task_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_id(self) -> str:\n return self.get_from_redis(\"task_id\")", "def task_id(self):\n return self._mpis.task_id", "def get_task_id(self):\n if self.task_id:\n return self.task_id\n return (f'{self.task_type}_{self.get_source_system().lower()}'\n f'.{s...
[ "0.88248545", "0.84131324", "0.8284315", "0.82157016", "0.77533805", "0.77094215", "0.76750463", "0.76750463", "0.7639691", "0.76357454", "0.76357454", "0.76357454", "0.76357454", "0.76357454", "0.76357454", "0.76357454", "0.76357454", "0.7529151", "0.74882424", "0.74882424", ...
0.8547835
4
the integer timestamp when this task is created.
def create_timestamp(self): return self._create_ts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")", "def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")", "def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")", "def creation_times...
[ "0.82551646", "0.82551646", "0.82551646", "0.8106152", "0.8027002", "0.79658085", "0.7960547", "0.7960547", "0.7960547", "0.7955435", "0.7828166", "0.7828166", "0.7828166", "0.7813512", "0.77852875", "0.77852875", "0.7752021", "0.7744925", "0.7744925", "0.7744925", "0.7744925...
0.80804354
4
A readable string converted from the timestamp when this task is created.
def create_time_str(self): ts = time.localtime(self._create_ts) return time.strftime("%Y-%m-%d %H:%M:%S", ts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def creation_time_str(self):\n return \"%Y/%m/%d %I:%M:%S\".format(self.creation_time)", "def creation_timestamp(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"creation_timestamp\")", "def created_time(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"created_time\")", "...
[ "0.7777843", "0.73781943", "0.73427457", "0.73427457", "0.733272", "0.733272", "0.73199356", "0.73199356", "0.73199356", "0.7313272", "0.7313272", "0.7313272", "0.7303396", "0.7303396", "0.7303396", "0.7303396", "0.7303396", "0.7303396", "0.7303396", "0.7303396", "0.7303396",...
0.7573687
1