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
204 responses must not return some entity headers
def get204(self): bad = ('content-length', 'content-type') for h in bad: bottle.response.set_header(h, 'foo') bottle.status = 204 for h, v in bottle.response.headerlist: self.assertFalse(h.lower() in bad, "Header %s not deleted" % h)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_204_response() -> bytes:\n date = datetime.datetime.now(datetime.timezone.utc).strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n\n header = \"HTTP/1.1 204 No Content\" + \"\\r\\nDate: \" + date + \"\\r\\n\\r\\n\"\n\n print(header)\n return header.encode(HttpServer.FORMAT)", "def as...
[ "0.7504536", "0.7456752", "0.70702946", "0.7007137", "0.6838798", "0.6740226", "0.66936654", "0.66851264", "0.66362447", "0.65761197", "0.648202", "0.6477876", "0.64216065", "0.6242951", "0.623777", "0.623777", "0.6185526", "0.61398613", "0.61072254", "0.6086671", "0.60757756...
0.83296347
0
Construct an ThothOnixTelescope instance.
def __init__( self, *, dag_id: str, cloud_workspace: CloudWorkspace, publisher_id: str, format_specification: str, bq_dataset_id: str = "onix", bq_table_name: str = "onix", bq_dataset_description: str = "Thoth ONIX Feed", bq_table_descripti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, world: Optional[SimWorld] = None, **kwargs: Any):\n BaseTelescope.__init__(self, **kwargs, motion_status_interfaces=[\"ITelescope\", \"IFocuser\", \"IFilters\"])\n FitsNamespaceMixin.__init__(self, **kwargs)\n\n # init world and get telescope\n from pyobs.utils.simula...
[ "0.6043081", "0.5964881", "0.57800967", "0.57065284", "0.5576632", "0.5284193", "0.5260236", "0.5221126", "0.52082175", "0.51896495", "0.5188457", "0.5174516", "0.5166596", "0.51366943", "0.5117554", "0.51174974", "0.5112744", "0.5068512", "0.50668824", "0.5044727", "0.504393...
0.0
-1
Test whether two objects contain the same elements. This function allows two GeoSeries to be compared against each other to see if they have the same shape and geometries (same wkb bytes). NaNs in the same location are considered equal. The column headers do not need to have the same type, but the elements within the c...
def equals(self, other): if not isinstance(other, GeoSeries): return False return self._data.equals(other._data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_identical(self, other):\n return (self.compounddatatype == other.compounddatatype and\n self.min_row == other.min_row and\n self.max_row == other.max_row)", "def similar(self, other):\r\n if self.rows == other.rows and self.columns == other.columns:\r\n ...
[ "0.713626", "0.70874375", "0.6902014", "0.6831683", "0.68126047", "0.67645264", "0.66774386", "0.6625861", "0.6573688", "0.65623236", "0.6527109", "0.6523672", "0.65229714", "0.6514099", "0.6510609", "0.6509781", "0.6501745", "0.64968944", "0.64894736", "0.6446339", "0.644061...
0.6488795
19
Check if each geometry is of valid geometry format.
def is_valid(self): return _property_op(arctern.ST_IsValid, self).astype(bool, copy=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkGeom(geodataframe):\n for geometry in geodataframe.geometry:\n if explain_validity(geometry) != 'Valid Geometry':\n print(explain_validity(geometry))", "def is_valid_geometry(self, value: List) -> bool:\n\n def check_geom(geom):\n if isinstance(geom, (Point, MultiP...
[ "0.7904392", "0.690688", "0.6685605", "0.66615665", "0.6612329", "0.64486986", "0.64352995", "0.6389536", "0.6370707", "0.6149703", "0.6111263", "0.6095195", "0.6012014", "0.59583324", "0.5873552", "0.58691776", "0.58599246", "0.5856493", "0.58545256", "0.58147585", "0.581045...
0.0
-1
Check whether each geometry is "simple". "Simple" here means that a geometry has no anomalous geometric points, such as self intersection or self tangency.
def is_simple(self): return _property_op(arctern.ST_IsSimple, self).astype(bool, copy=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_simple(geometry, **kwargs):\n return lib.is_simple(geometry, **kwargs)", "def is_simple(self):\n if not self.is_compact(): return False\n\n for v in self.vertex_generator():\n adj = [a for a in v.neighbors()]\n if len(adj) != self.dim():\n return False...
[ "0.7666004", "0.64723015", "0.6392264", "0.62469393", "0.6124172", "0.6097932", "0.60693663", "0.59628433", "0.59498405", "0.59405744", "0.58801895", "0.5861422", "0.5823311", "0.5766822", "0.5688275", "0.560034", "0.55730313", "0.5571647", "0.5562339", "0.5434933", "0.541820...
0.6210017
4
Calculate the 2D Cartesian (planar) area of each geometry.
def area(self): return _property_op(arctern.ST_Area, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n if isinstance(self.crs, GeographicalCRS):\n major_axis = self.crs.ellipsoid.a\n minor_axis = self.crs.ellipsoid.b\n\n area = 0.0\n if major_axis == minor_axis: # Sphere\n for seg in self.segment_tuples:\n x1, ...
[ "0.7063971", "0.6625418", "0.65976596", "0.659629", "0.6554382", "0.6529425", "0.65187824", "0.6507955", "0.64807117", "0.6467007", "0.6453874", "0.6421093", "0.6408375", "0.6345457", "0.6292591", "0.6268464", "0.6240269", "0.6230155", "0.61827403", "0.6177272", "0.6141594", ...
0.0
-1
For each geometry in geometries, return a string that indicates is type.
def geom_type(self): return _property_op(arctern.ST_GeometryType, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geometry_type(self) -> ir.StringValue:\n return ops.GeoGeometryType(self).to_expr()", "def getGeometryType(restGeom):\n if \"Polygon\" in restGeom:\n return \"POLYGON\"\n elif \"Polyline\" in restGeom:\n return \"POLYLINE\"\n elif \"Point\" in restGeom:\n return \"POINT\"...
[ "0.6874476", "0.6696634", "0.6290559", "0.62605953", "0.6224997", "0.619825", "0.5985244", "0.575593", "0.569537", "0.56879616", "0.55618614", "0.54778594", "0.54542613", "0.5450805", "0.54445904", "0.5382666", "0.53738856", "0.53256947", "0.5278076", "0.5276421", "0.52664536...
0.626888
3
Convert curves in each geometry to approximate linear representation, e.g., CIRCULAR STRING to regular LINESTRING, CURVEPOLYGON to POLYGON, and MULTISURFACE to MULTIPOLYGON. Useful for outputting to devices that can't support CIRCULARSTRING geometry types.
def curve_to_line(self): return _unary_geo(arctern.ST_CurveToLine, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_segments(segments):\n polygons = []\n interiors = []\n linestrings = []\n for segment in segments:\n ls = LineString(segment)\n if segment[0][0] == segment[-1][0] and segment[0][1] == segment[-1][1]:\n lr = LinearRing(ls)\n if not lr.is_ccw:\n ...
[ "0.5612656", "0.5605624", "0.55674744", "0.55128264", "0.54048735", "0.5354755", "0.53211635", "0.52772313", "0.52101445", "0.5138058", "0.5118836", "0.5081327", "0.5062001", "0.5044732", "0.50275433", "0.49676812", "0.49635187", "0.4959512", "0.49567842", "0.4953524", "0.494...
0.51644486
9
Transform each geometry to a different coordinate reference system. The ``crs`` attribute on the current GeoSeries must be set.
def to_crs(self, crs): if crs is None: raise ValueError("Can not transform with invalid crs") if self.crs is None: raise ValueError("Can not transform geometries without crs. Set crs for this GeoSeries first.") if self.crs == crs: return self return _u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_geometries(datasource, src_epsg, dst_epsg):\n # Part 1\n src_srs = osr.SpatialReference()\n src_srs.ImportFromEPSG(src_epsg)\n dst_srs = osr.SpatialReference()\n dst_srs.ImportFromEPSG(dst_epsg)\n transformation = osr.CoordinateTransformation(src_srs, dst_srs)\n layer = datasource.GetLa...
[ "0.6502866", "0.62526053", "0.61256564", "0.6086267", "0.60835266", "0.6010616", "0.5969945", "0.5863563", "0.5861438", "0.5789306", "0.5703812", "0.56789464", "0.5665309", "0.5656348", "0.56265503", "0.5570779", "0.5527477", "0.5501872", "0.5500846", "0.5494727", "0.5475225"...
0.7170733
0
Check whether each geometry is within other (elementwise).
def within(self, other): return _binary_op(arctern.ST_Within, self, other).astype(bool, copy=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doBoundingBoxesIntersect(self, other):\n if(self.upperLeft.x <= other.lowerRight.x and\n self.lowerRight.x >= other.upperLeft.x and\n self.upperLeft.y >= other.lowerRight.y and\n self.lowerRight.y <= other.upperLeft.y):\n return True\n return False"...
[ "0.7524902", "0.73729897", "0.71685326", "0.7139274", "0.7030789", "0.702235", "0.70122725", "0.6991214", "0.6973276", "0.6951702", "0.69121456", "0.6908521", "0.6871371", "0.6854054", "0.6852921", "0.6798403", "0.6786245", "0.6746447", "0.6740402", "0.6731472", "0.67281044",...
0.6281432
82
Check whether each geometry contains other (elementwise).
def contains(self, other): return _binary_op(arctern.ST_Contains, self, other).astype(bool, copy=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doBoundingBoxesIntersect(self, other):\n if(self.upperLeft.x <= other.lowerRight.x and\n self.lowerRight.x >= other.upperLeft.x and\n self.upperLeft.y >= other.lowerRight.y and\n self.lowerRight.y <= other.upperLeft.y):\n return True\n return False"...
[ "0.6927342", "0.6813174", "0.67808735", "0.6683514", "0.6608095", "0.66048783", "0.6543079", "0.651822", "0.6502066", "0.6419477", "0.64123785", "0.6408629", "0.6377291", "0.63678026", "0.63514185", "0.63224965", "0.6319783", "0.6301619", "0.6301403", "0.62778205", "0.6274065...
0.0
-1
Check whether each geometry is "spatially equal" to other. "Spatially equal" means two geometries represent the same geometry structure.
def geom_equals(self, other): from pandas.api.types import is_scalar if is_scalar(other): other = self.__class__([other] * len(self), index=self.index) this = self if not this.index.equals(other.index): warn("The indices of the two GeoSeries are different.") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def are_equal(self, sp1, sp2):\n return True", "def are_equal(self, sp1, sp2):\n for s1 in sp1.keys():\n spin1 = getattr(s1, \"spin\", 0)\n oxi1 = getattr(s1, \"oxi_state\", 0)\n for s2 in sp2.keys():\n spin2 = getattr(s2, \"spin\", 0)\n ...
[ "0.6802465", "0.67805123", "0.66960746", "0.66589355", "0.6498028", "0.6484803", "0.62827766", "0.6278034", "0.6247545", "0.6240349", "0.6240165", "0.62319565", "0.6208261", "0.6191864", "0.61298805", "0.6103202", "0.6102807", "0.6097758", "0.6073104", "0.6059349", "0.6056827...
0.6046562
21
Check whether each geometry "touches" other. "Touch" means two geometries have common points, and the common points locate only on their boundaries.
def touches(self, other): return _binary_op(arctern.ST_Touches, self, other).astype(bool, copy=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersects(self):\n match = False\n for i in range(len(self.__points) - 1):\n p1 = self.__points[i]\n p2 = self.__points[i + 1]\n bounds = self.__line_segment(p1, p2)\n if not bounds is None:\n xmin = bounds[0]\n ymin = bounds[1]\n xmax = bounds[0]\n ymax =...
[ "0.65426964", "0.6534798", "0.64519405", "0.6406436", "0.6399988", "0.637896", "0.6334022", "0.6320897", "0.6273946", "0.6238817", "0.6082561", "0.60700196", "0.6025307", "0.601121", "0.59974545", "0.59330696", "0.59228545", "0.59096324", "0.58627254", "0.5842866", "0.5815128...
0.65202117
2
Return minimum distance in meters between two lon/lat points. Uses a spherical earth and radius derived from the spheroid defined by the SRID.
def distance_sphere(self, other): if not self.crs == getattr(other, "crs", "EPSG:4326") == "EPSG:4326": raise ValueError("Only can calculate spherical distance with 'EPSG:4326' crs.") return _binary_op(arctern.ST_DistanceSphere, self, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_spherical_distance(lat1,lat2,long1,long2):\n lat1,lat2,long1,long2= float(lat1),float(lat2),float(long1),float(long2)\n q=radians(lat2-lat1)\n r=radians(long2-long1)\n lat2r=radians(lat2)\n lat1r=radians(lat1)\n a=sin(q/2)*sin(q/2)+cos(lat1r)*cos(lat2r)*sin(r/2)*si...
[ "0.68833476", "0.68543684", "0.6664104", "0.66225034", "0.6614609", "0.6551876", "0.6545566", "0.6468671", "0.64259017", "0.63936806", "0.63863176", "0.63863176", "0.63863176", "0.63863176", "0.63863176", "0.638405", "0.6378784", "0.6377177", "0.63747877", "0.63671356", "0.63...
0.6405948
9
Returns the Hausdorff distance between each geometry and other. This is a measure of how similar or dissimilar 2 geometries are.
def hausdorff_distance(self, other): return _binary_op(arctern.ST_HausdorffDistance, self, other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hausdorff_distance(self, other):\n ...", "def hausdorff_distance(image1, image2):\n image1_int = image1.clone(\"unsigned int\")\n image2_int = image2.clone(\"unsigned int\")\n\n libfn = utils.get_lib_fn(\"hausdorffDistance%iD\" % image1_int.dimension)\n d = libfn(image1_int.pointer, image2...
[ "0.759283", "0.7179202", "0.7101328", "0.689909", "0.6858431", "0.6837336", "0.67604476", "0.6683294", "0.66194665", "0.66013527", "0.6569919", "0.65585876", "0.6527269", "0.6473583", "0.6433952", "0.6392746", "0.63679177", "0.63628966", "0.6316012", "0.63065404", "0.6305005"...
0.76239663
0
Construct Point geometries according to the coordinates.
def point(cls, x, y, crs=None): crs = _validate_crs(crs) return cls(arctern.ST_Point(x, y), crs=crs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_points(data):\n #TODO list comprehension\n for row in data:\n\n if row[\"x\"] and row[\"y\"]:\n try:\n row[\"geometry\"] = point.Point(float(row[\"x\"]), float(row[\"y\"]))\n except:\n row[\"geometry\"] = None\n...
[ "0.6530858", "0.6457091", "0.64059484", "0.640297", "0.6357891", "0.6344461", "0.6337387", "0.6316078", "0.62294465", "0.6183091", "0.6170689", "0.613722", "0.613722", "0.60727257", "0.60714775", "0.6061231", "0.60591716", "0.59994185", "0.59989065", "0.59790605", "0.5955864"...
0.5411405
95
Construct geometries from geopandas GeoSeries.
def from_geopandas(cls, data): import geopandas as gpd import shapely.wkb if not isinstance(data, gpd.GeoSeries): raise TypeError(f"data must be {gpd.GeoSeries}, got {type(data)}") if data.crs is not None: crs = data.crs.to_authority() or data.crs.source_crs.to_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_geoseries(self, dataframe):\n geo_list = []\n with click.progressbar(dataframe.iterrows(), label='Pulling site plans and geographic title data', length=len(dataframe)) as d:\n for index, row in d:\n geo_list.append(self.map_property(row['linc']))\n\n geo_ser...
[ "0.6760645", "0.66406184", "0.6611926", "0.65941155", "0.65144163", "0.63927484", "0.6314211", "0.62846774", "0.62605417", "0.61809194", "0.5986733", "0.5974453", "0.59539646", "0.5952975", "0.59197783", "0.5875279", "0.5856764", "0.5832553", "0.58124745", "0.58063805", "0.57...
0.663567
2
Get index of left child
def get_left_index(i): pos = i + 1 left_pos = 2 * pos left_index = left_pos - 1 return left_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_left_child_index(self):\n return (2 * self.index) + 1", "def left_child(self, index):\n return 2 * index + 1", "def left_child(self, index):\n return 2 * index", "def get_left_child_index(self, parent):\n return 2*parent+1", "def left_child_idx(idx):\n return (idx << ...
[ "0.9122641", "0.88522995", "0.8762248", "0.86230975", "0.83617294", "0.8189093", "0.80934316", "0.80934316", "0.79510504", "0.77594656", "0.76739126", "0.76264703", "0.7587339", "0.7570154", "0.750047", "0.7485209", "0.74505705", "0.74247074", "0.72877926", "0.7251152", "0.72...
0.75896484
12
Returns true if the queue is empty and false otherwise Must be O(1)
def is_empty(self) -> bool: if self.num_items == 0: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return self.queue == []", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def empty(self) -> bool: \n if(self.queue is not None and len(self.queue) > 0):\n print(\"len > 0\" )\n ...
[ "0.88570523", "0.87778527", "0.87778527", "0.8776103", "0.87759084", "0.8768391", "0.86971426", "0.8675233", "0.8659355", "0.8658433", "0.8606875", "0.8600865", "0.85989565", "0.8582111", "0.8568123", "0.8497459", "0.84956324", "0.8487618", "0.8420514", "0.8420514", "0.832870...
0.0
-1
Checks if created data class is of the right class.
def test_creates_data(self, config_filename, expected_class): data = create_data(read_config_file(config_filename)) self.assertIsInstance(data, expected_class)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_dataclass_instance(obj):\n return hasattr(type(obj), '__dataclass_fields__')", "def _check_dataclass(self) -> PossibleResult[T]:\n if is_dataclass(self.constructor):\n if not isinstance(self.obj, Mapping):\n raise DeserializeError(\n Mapping, self.ob...
[ "0.73167884", "0.70281214", "0.697299", "0.6734586", "0.65639776", "0.6543953", "0.6501673", "0.64816797", "0.6398697", "0.63877684", "0.63857174", "0.62964743", "0.62771004", "0.6239756", "0.6161517", "0.6121133", "0.6119971", "0.60966104", "0.6038572", "0.59667945", "0.5946...
0.0
-1
(Computed) The etag of the IAM policy.
def etag(self) -> str: return pulumi.get(self, "etag")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def etag(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"etag\")", "def etag(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"etag\")", "def etag(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"etag\")", "def etag(self) -> pulumi.Output[str]:\n return pul...
[ "0.7073697", "0.7073697", "0.7073697", "0.7073697", "0.7073697", "0.7073697", "0.7073697", "0.69740593", "0.6932817", "0.6932817", "0.6932817", "0.6932817", "0.6932817", "0.6932817", "0.6932817", "0.6932817", "0.6932817", "0.6932817", "0.6932817", "0.6932817", "0.6932817", ...
0.71071345
7
Backward computation of gradients.
def backward(self): assert self.cache is not None, "Cannot backprop without forward first." prob, y = self.cache dX = prob - y if self.reduction == "mean": m, _ = prob.shape dX /= m # clear cache self.cache = None return dX
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward(self, gradient):\n #TODO\n pass", "def backward(self, gradient):\n #TODO\n pass", "def backward(self, gradient):\n raise NotImplementedError()", "def backward(self, gradient: Tensor) -> Tensor:\n self.b_grad = np.sum(gradient, axis=0)\n self.w_gra...
[ "0.82506675", "0.82506675", "0.82469416", "0.8232206", "0.80324847", "0.80324847", "0.78823906", "0.7857436", "0.78483355", "0.78429383", "0.77847767", "0.7679982", "0.76649225", "0.7645512", "0.7608589", "0.7604201", "0.759334", "0.7587491", "0.75818443", "0.7530521", "0.751...
0.0
-1
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(GraspableObjectList, self).__init__(*args, **kwds) # message fields cannot be None, assign default values for those that are if self.graspable_objects is None: self.graspable_objects = [] if self.image is None: self.im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.77936506", "0.7720004", "0.7720004", "0.76861507", "0.76264745", "0.756367", "0.74394095", "0.74168324", "0.7351523", "0.7307856", "0.7280199", "0.7237893", "0.72272074", "0.7223773", "0.7223773", "0.7218694", "0.7211321", "0.7211321", "0.7211321", "0.7211321", "0.7211321"...
0.0
-1
Wrapper around k8s.load_and_create_resource to create a SageMaker resource
def create_sagemaker_resource( resource_plural, resource_name, spec_file, replacements, namespace="default" ): reference, spec, resource = k8s.load_and_create_resource( resource_directory, CRD_GROUP, CRD_VERSION, resource_plural, resource_name, spec_file, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_resource(\n service_name: str, config_name: str = None, **resource_args\n):\n session = get_session(config_name)\n return session.resource(service_name, **resource_args)", "def create_resource():\n return wsgi.Resource(Controller())", "def create_resource():\n return wsgi.Resource(Con...
[ "0.6695489", "0.65566033", "0.6527681", "0.63303506", "0.61349356", "0.6096821", "0.6095365", "0.6082456", "0.60742486", "0.6072159", "0.6070179", "0.60697085", "0.6067538", "0.6065695", "0.60196674", "0.60108477", "0.59737706", "0.59575313", "0.59364146", "0.5927485", "0.590...
0.7768747
0
Wrapper around k8s.load_and_create_resource to create a Adopoted resource
def create_adopted_resource(replacements, namespace="default"): reference, spec, resource = k8s.load_and_create_resource( resource_directory, ADOPTED_RESOURCE_CRD_GROUP, CRD_VERSION, "adoptedresources", replacements["ADOPTED_RESOURCE_NAME"], "adopted_resource_base", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_resource(\n service_name: str, config_name: str = None, **resource_args\n):\n session = get_session(config_name)\n return session.resource(service_name, **resource_args)", "def create_sagemaker_resource(\n resource_plural, resource_name, spec_file, replacements, namespace=\"default\"\n):\n...
[ "0.6452652", "0.6253703", "0.6171513", "0.6096159", "0.59922796", "0.59912336", "0.595014", "0.58938444", "0.5844623", "0.5840295", "0.58089936", "0.57912517", "0.57580245", "0.5738343", "0.573344", "0.5730226", "0.5724765", "0.5722394", "0.5716222", "0.5712392", "0.56978524"...
0.71058977
0
Generate a name for a file using the description and channel
def generate_file_name(well, channel, desc): return "bPLATE_w" + well + "_" + desc + "_c" + channel + ".png"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_raw_file_name(self, well, channel, desc):\n \n return \"bPLATE_w\" + well + \"_\" + desc + \"_c\" + channel + \".png\"", "def file_name(id, title, kind=\"src\"):\n fn_template = conf.template_source_file_name\n if kind == \"tst\":\n fn_template = conf.template_test_fi...
[ "0.75195915", "0.7167804", "0.71012443", "0.70670754", "0.69943404", "0.67369324", "0.6670187", "0.66342044", "0.66167426", "0.6494215", "0.64797497", "0.6479064", "0.6476831", "0.64566636", "0.6450938", "0.64458376", "0.6431859", "0.6416797", "0.6390564", "0.63887256", "0.63...
0.80092597
0
Generate a name for a file using the description and channel
def _generate_raw_file_name(self, well, channel, desc): return "bPLATE_w" + well + "_" + desc + "_c" + channel + ".png"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_file_name(well, channel, desc):\n \n return \"bPLATE_w\" + well + \"_\" + desc + \"_c\" + channel + \".png\"", "def file_name(id, title, kind=\"src\"):\n fn_template = conf.template_source_file_name\n if kind == \"tst\":\n fn_template = conf.template_test_file_name\n\n return f...
[ "0.80091065", "0.7165928", "0.7101471", "0.7064337", "0.69931364", "0.67345184", "0.6668517", "0.66324764", "0.66144115", "0.64927953", "0.6479", "0.6476943", "0.64755803", "0.6454013", "0.6448165", "0.6447837", "0.6430102", "0.6413977", "0.63882077", "0.63864017", "0.6377731...
0.7519707
1
Generate a name for a file using the description and channel
def _generate_overlay_file_name(self, well, channel, desc): return "c" + channel + "_w" + well + "_" + desc + ".png"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_file_name(well, channel, desc):\n \n return \"bPLATE_w\" + well + \"_\" + desc + \"_c\" + channel + \".png\"", "def _generate_raw_file_name(self, well, channel, desc):\n \n return \"bPLATE_w\" + well + \"_\" + desc + \"_c\" + channel + \".png\"", "def file_name(id, title, k...
[ "0.80092597", "0.75195915", "0.7167804", "0.70670754", "0.69943404", "0.67369324", "0.6670187", "0.66342044", "0.66167426", "0.6494215", "0.64797497", "0.6479064", "0.6476831", "0.64566636", "0.6450938", "0.64458376", "0.6431859", "0.6416797", "0.6390564", "0.63887256", "0.63...
0.71012443
3
Initializes network input shape
def init_input_shape(image_size, channels=3): (img_rows, img_cols) = image_size if K.image_data_format() == 'channels_first': input_shape = (channels, img_rows, img_cols) else: input_shape = (img_rows, img_cols, channels) return input_shape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, shape, input_var=None):\n\n self.output = layers.InputLayer(shape, input_var=input_var)", "def __init__(self, netSize):\n\t\t\n\t\t# TRY THIS FOR RANDOM!\n\t\t#\n\t\t#\n\t\t#\n\t\t\n\t\tself.biases = [self.randomArray(i, 1) for i in netSize[1:]] # Biases do not exist for the ...
[ "0.7029771", "0.7024046", "0.6919055", "0.68907285", "0.68846923", "0.68404883", "0.6822069", "0.6804236", "0.6804236", "0.6804236", "0.67505586", "0.66984344", "0.66806984", "0.666526", "0.6639504", "0.66085154", "0.6592786", "0.6583862", "0.65691096", "0.65449697", "0.65282...
0.0
-1
Initializes network input shape and batch normalization axis
def init_input_shape_and_bn_axis(image_size): (img_rows, img_cols) = image_size if K.image_data_format() == 'channels_first': input_shape = (1, img_rows, img_cols) bn_axis = 1 else: input_shape = (img_rows, img_cols, 1) bn_axis = 3 return (input_shape, bn_axis)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, net, batch):\n self.net = net\n self.train_batch_is(batch)\n self.image_height = len(batch.image_array[0][0])\n self.image_width = len(batch.image_array[0][0][0])\n self.net.reset_forward()", "def initialize_network(self):\n # intermediate layer size\n...
[ "0.726126", "0.69356924", "0.6871046", "0.6827918", "0.66717565", "0.66414213", "0.65312356", "0.6525526", "0.64984953", "0.645438", "0.64380443", "0.63919", "0.63639694", "0.6353767", "0.63438046", "0.6335529", "0.633095", "0.6296713", "0.62875813", "0.628072", "0.6252297", ...
0.0
-1
Adds "dropout" layer to model
def dropout(keep_prob, net, is_training): return Dropout(keep_prob)(net) if is_training else net
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dropout_layer(self):\n return tf.keras.layers.Dropout(rate=self.dropout)", "def add_drop_out_layer(self, input_layer):\n return tf.nn.dropout(input_layer, self.keep_prob)", "def dropout(input_var=None):\n\n # Hyperparameters\n hp = Hyperparameters()\n hp('batch_size', 20)\n ...
[ "0.8024405", "0.7728018", "0.74729925", "0.72339785", "0.71602124", "0.6933945", "0.69273853", "0.6838031", "0.6837817", "0.682116", "0.6715737", "0.6679599", "0.65281695", "0.6525919", "0.65130067", "0.65084773", "0.64376026", "0.63970506", "0.62666637", "0.62647206", "0.622...
0.633441
18
Initializes training cost function
def retrieve_optimizer(flags): lrate = flags.learning_rate momentum = flags.momentum decay = lrate / flags.epochs if flags.optimizer == 'adam': optimizer = Adam(lr=lrate, decay=decay) logger.print_directly(flags, 'ADAM optimizer was configured') else: optimizer = SGD(lr=lrat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_trainer(self):\n self.cost = mse(0., 0.)\n for task_id in self.task_ids.keys():\n self.cost += self.model.get_layer(task_id + '-loss')\n\n opt = Optimizer(self.cost)\n self.optimizer = opt.get_adagrad(self.learning_rate)", "def __init__(self, cost_func):\n ...
[ "0.7631753", "0.7487942", "0.71219885", "0.7037173", "0.694103", "0.6896091", "0.6878694", "0.68467164", "0.6837462", "0.6803369", "0.6757318", "0.6744617", "0.6744267", "0.67090356", "0.66888", "0.66572183", "0.6620065", "0.661703", "0.66004735", "0.6590226", "0.6585318", ...
0.0
-1
Get maximum depth of given tree by BFS
def max_depth(root): # basic case if root is None: return 0 # breadth-first traversal queue = collections.deque([root]) depth = 0 while queue: queue_size = len(queue) for i in range(queue_size): curr = queue.popleft() if curr.left is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _max_depth(self):\n max_depth = 0\n for node, data in self.traverse():\n max_depth = max(max_depth, data['level'])\n return max_depth", "def max_depth(node):\n if not node:\n return 0\n return max(max_depth(node.left), max_depth(node.right)) + 1", "def maxDepth(...
[ "0.7669001", "0.7654562", "0.7653014", "0.7614319", "0.7599487", "0.74606186", "0.74326384", "0.73375744", "0.7196552", "0.718703", "0.7182534", "0.71651614", "0.7148998", "0.71120065", "0.7107149", "0.7074876", "0.706041", "0.7011375", "0.6983949", "0.6968935", "0.6909913", ...
0.7672864
0
Parse start date and time.
def _parse_start(self, item): raw_date_time = item.css('td[headers~=Date]::text').extract_first() date_time_str = re.sub(r'\s+', ' ', raw_date_time).strip() if not date_time_str: return None try: dt = datetime.strptime(date_time_str, '%b %d, %Y - %I:%M %p') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_start(self, date_str):\n # TODO: Find start time\n return datetime.strptime(date_str.title(), \"%B %d, %Y\")", "def _parse_start(self, response):\n date_str = response.css(\".date time::attr(datetime)\").extract_first()\n time_str = \"\".join(response.css(\"article.time::te...
[ "0.8012607", "0.7956383", "0.79541355", "0.775254", "0.7745357", "0.7708766", "0.7648467", "0.7642984", "0.754136", "0.74821883", "0.7399587", "0.7093819", "0.697785", "0.69141096", "0.6728942", "0.65998924", "0.6470897", "0.6462791", "0.6380753", "0.634331", "0.6262659", "...
0.7459805
10
Collate function that padds examples to the longest sequence in a batch. It is meant for training the question generation model. Used together with SQuAD2.0 dataset preprocesses with preprocess_dataset function.
def dynamic_padding_collate_fn(batch_list): batch_uncollated = [[] for i in range(3)] for features in batch_list: length = features[1].sum().item() for i, feature in enumerate(features): batch_uncollated[i].append(feature[:length]) batch_collated = [] for batch in batch_unc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collate_fn(self, batch):\r\n batch = list(map(torch.stack, zip(*batch)))\r\n max_seq_len = torch.max(torch.sum(batch[1], 1)).item()\r\n for i in range(len(batch) - 1):\r\n if batch[i].size()[1] > max_seq_len:\r\n batch[i] = batch[i][:, :max_seq_len]\r\n if ...
[ "0.7033074", "0.6944575", "0.67516834", "0.6637126", "0.65820885", "0.65329534", "0.6456716", "0.6453996", "0.629609", "0.62111056", "0.6209131", "0.6203681", "0.6183075", "0.61593163", "0.6139525", "0.6039231", "0.6031318", "0.59539074", "0.5948258", "0.5943981", "0.59365565...
0.59552723
17
Init object to store step and trial data.
def init_data(stats_list): data = {stats_name: {} for stats_name in stats_list} return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._trials = [] # private variables _ convention", "def __init__( self ):\n self._env = None\n self._steps = None\n\n self._initialize( )", "def init(self, **kwargs):\n self._d = {}\n self._th = None\n self._run = True\n ...
[ "0.716681", "0.70468086", "0.6757133", "0.6672487", "0.66058046", "0.6582223", "0.653331", "0.65125954", "0.649741", "0.64206564", "0.63828874", "0.6369628", "0.6362635", "0.6338107", "0.6331931", "0.6317953", "0.6301544", "0.6297562", "0.62726104", "0.62723035", "0.6268866",...
0.0
-1
Return name of connectivity configuration.
def conn_config_name(conn_config): n_conn_config = [cname for cname, on in conn_config.items() if on] n_conn_config = ' + '.join(n_conn_config) return n_conn_config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._config_name", "def get_config_name(self): # pragma: no cover\n pass", "def name(self):\n return self._config.get(CONF_NAME)", "def connection_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"connection_name\")", "def connection_name(s...
[ "0.77077055", "0.7493195", "0.745413", "0.72979784", "0.7289367", "0.7035228", "0.6940678", "0.685062", "0.6848523", "0.6846582", "0.6830779", "0.68089354", "0.6791377", "0.675848", "0.67513496", "0.67148095", "0.66720396", "0.6649063", "0.66395855", "0.6601104", "0.6592569",...
0.7347803
3
Return entropy of each HC state across village locations.
def get_hc_co_occ_entropy(co_occs, v_repl_nan=None): return utils.get_row_entropy(co_occs.T, v_repl_nan)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(self):\n\n \"\"\"Gets the first neighbours, which are the first 2*r+1 cells.\"\"\"\n current_neighbours = []\n amount = [0] * self.k ** (2 * self.r + 1)\n for i in range(2 * self.r + 1):\n current_neighbours.append(self.config[self.t, i % self.width])\n\n \"\"\"Calculates the rule...
[ "0.67780423", "0.6692582", "0.66096693", "0.6583241", "0.646438", "0.6463834", "0.64497703", "0.643623", "0.6350943", "0.6336463", "0.6297908", "0.62889063", "0.62844735", "0.6246048", "0.62386346", "0.62371117", "0.6227964", "0.62140536", "0.6190457", "0.618255", "0.6164896"...
0.0
-1
Start playing the room playlist
async def start(self, ctx): if ctx.guild is None: await ctx.reply("This command can only be used in a server, not in DMs.") raise commands.CommandError("Invoker not in a guild.") if ctx.voice_client is None or ctx.voice_client.channel is None: await ctx.reply(f"I am ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n gv.logger.info(\"Started playing new playlist\")\n thread = Thread(target=self.run, args=())\n thread.daemon = True\n self.thread = thread\n thread.start()", "def play_next(self):\n self.stop()\n play_flag = True\n if self.playlist:\n ...
[ "0.74985003", "0.69871664", "0.6981441", "0.68703204", "0.67883384", "0.67791086", "0.67515475", "0.67425054", "0.66611314", "0.6573882", "0.6475358", "0.6315773", "0.6276613", "0.62280256", "0.6226545", "0.6223181", "0.6217674", "0.61872447", "0.6159366", "0.613671", "0.6131...
0.66087157
9
This funtion is to get the dataframe of yield to maturity and discount rate value.
def get_ytm_discount_data(self): ytm=Bootstrapping.get_ytm_dict(self) data = pd.DataFrame() for i in ytm.keys(): data.loc[i / 2, 'Yield to maturity'] = ytm[i] data.loc[i / 2, 'discount_rate'] = Bootstrapping.P_Tn(self,ytm[i], i) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_treasury_yield(interval: str, maturity: str) -> pd.DataFrame:\n d_interval = {\"d\": \"daily\", \"w\": \"weekly\", \"m\": \"monthly\"}\n d_maturity = {\"3m\": \"3month\", \"5y\": \"5year\", \"10y\": \"10year\", \"30y\": \"30year\"}\n\n url = f\"https://www.alphavantage.co/query?function=TREASURY_Y...
[ "0.6506243", "0.61616105", "0.5973585", "0.59033316", "0.57318133", "0.5705728", "0.568607", "0.56644547", "0.5616574", "0.55478776", "0.55426395", "0.5541117", "0.5517417", "0.55045354", "0.55006254", "0.5484498", "0.54590946", "0.54367566", "0.5420372", "0.53916895", "0.539...
0.6999018
0
Create logger. Output to file and console.
def __init__(self, logfilename='logfile.log'): # Create file handler (output to file) # "%(asctime)s - %(name)s - %(levelname)s - %(message)s" # "[%(asctime)s %(process)d] %(message)s" # fileFormatter = logging.Formatter("%(asctime)s : %(threadName)-12.12s : %(levelname)-5.5s : %(message...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_logger():\r\n global logger\r\n logger = logging.getLogger(logger_name)\r\n\r\n formatter = logging.Formatter(fmt='%(asctime)s %(levelname)s %(message)s')\r\n \r\n handler = logging.StreamHandler()\r\n handler.setFormatter(formatter)\r\n logger.addHandler(handler)\r\n \r\n ret...
[ "0.7532494", "0.742732", "0.7345848", "0.73430514", "0.7258522", "0.7255411", "0.72414166", "0.7216692", "0.72023225", "0.71971697", "0.71704555", "0.7163259", "0.71248853", "0.71200293", "0.7105047", "0.70947397", "0.70875716", "0.70841235", "0.7044458", "0.70319575", "0.699...
0.0
-1
test that a 'unauthorized' response (http 401) is returned when doing a request with an incorrect api key
def test_filter_wrong_api_key_expect_unauthorized_response(session_stream, path): session_stream.headers.update({'api-key': 'wrong key'}) params = {LOCATION_CONCEPT_ID: geo.stockholm} expected_http_code = requests.codes.unauthorized try: get_stream_expect_error(session_stream, params, expected_h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_incorrect_api_key(self):\n with self.subTest(\"Missing API key\"):\n response = self.client.get(\n self.url, HTTP_AUTHORIZATION=f\"ApiKey {self.web_user.username}:\"\n )\n self.assertEqual(response.status_code, 401)\n\n with self.subTest(\"Miss...
[ "0.82850015", "0.8072468", "0.8039055", "0.8037536", "0.79810125", "0.796687", "0.79512525", "0.79512525", "0.7869238", "0.7855653", "0.7835723", "0.7777454", "0.7749252", "0.76528376", "0.76375806", "0.7606968", "0.7559815", "0.75589436", "0.7528576", "0.7527643", "0.7497882...
0.7447739
24
test that a 'bad request' response (http 400) is returned when doing a request without date parameter
def test_filter_without_date_expect_bad_request_response(session_stream, type, value): get_stream_expect_error(session_stream, params={type: value}, expected_http_code=requests.codes.bad_request)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_GET_startdate_error(self):\n self.register_user()\n result = self.login_user()\n access_token = json.loads(result.data.decode())['access_token']\n res = self.client().post('/expenses/', headers=dict(Authorization=\"Bearer \" + access_token), data=self.expense)\n self.ass...
[ "0.77888143", "0.7680683", "0.757144", "0.75589854", "0.7493942", "0.74357533", "0.7431725", "0.74137115", "0.73940873", "0.7284682", "0.72209555", "0.7100021", "0.7095673", "0.7079107", "0.7077526", "0.7027701", "0.7026709", "0.7008976", "0.6985253", "0.6983918", "0.6933023"...
0.69333655
20
Test create maze gets type error with noninteger.
def test_create_maze_non_integer(self): try: _ = Maze('I am not an integer', 4) self.assertEqual(True, False, 'should not have got here: ' 'maze created with non-integer index.') except TypeError: self.assertEqual(True, True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_maze(self):\n maze = Maze(4, 4)\n self.assertEqual(maze.row_count, 4)\n self.assertEqual(maze.col_count, 4)\n self.assertEqual(maze.size, 16)\n self.assertTrue(isinstance(maze.entrance, list))\n self.assertTrue(isinstance(maze.exit, list))", "def testMaze...
[ "0.7993788", "0.72578806", "0.72363365", "0.7099285", "0.7063041", "0.6861209", "0.68212044", "0.65768915", "0.6436121", "0.63770556", "0.6309218", "0.608427", "0.6020378", "0.5984016", "0.5975598", "0.5941816", "0.58987296", "0.58849007", "0.5789791", "0.57807946", "0.576970...
0.8117515
0
Test that a maze exit can be can be found at creation using private method __verify_exit_path.
def test_maze_created_can_be_traversed(self): maze = Maze(100, 100) self.assertTrue(maze._Maze__verify_exit_path())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testMazeExists(self):\n pass", "def testMazeExists(self):\n\n pass", "def test_maze_exit_pointers_are_none(self):\n maze = Maze(100, 100)\n\n row, col = maze.exit\n if maze.grid[row][col].up:\n maze.grid[row][col].up.down = None\n if maze.grid[row][col]....
[ "0.7718954", "0.7711811", "0.7170441", "0.6457077", "0.64257324", "0.63298804", "0.6325129", "0.6186493", "0.6110823", "0.60940695", "0.6087242", "0.5893084", "0.58477277", "0.57537746", "0.56882125", "0.56534946", "0.5650642", "0.5640697", "0.56240755", "0.56226784", "0.5569...
0.7800023
0
Test that a maze cannot be exited when rooms adjacent to the exit have their pointers set to None.
def test_maze_exit_pointers_are_none(self): maze = Maze(100, 100) row, col = maze.exit if maze.grid[row][col].up: maze.grid[row][col].up.down = None if maze.grid[row][col].right: maze.grid[row][col].right.left = None if maze.grid[row][col].down: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_maze_entrance_pointers_are_none(self):\n maze = Maze(100, 100)\n\n row, col = maze.entrance\n maze.grid[row][col].up = None\n maze.grid[row][col].right = None\n maze.grid[row][col].down = None\n maze.grid[row][col].left = None\n\n self.assertFalse(maze.can_...
[ "0.84921086", "0.7337513", "0.7119611", "0.6680111", "0.6654044", "0.6379823", "0.62804466", "0.61869204", "0.61617595", "0.61408913", "0.6139881", "0.61133355", "0.6019866", "0.5997094", "0.5945427", "0.593739", "0.5920975", "0.5908153", "0.5904515", "0.59022844", "0.5888381...
0.86979586
0
Analytic expression for the normalized inverse cumulative mass function. The argument ms is normalized mass fraction [0,1]
def _icmf(self, ms): return self._pot.a * numpy.sqrt(ms) / (1 - numpy.sqrt(ms))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mass(query, ts):\n\n m = len(query)\n q_mean = np.mean(query)\n q_std = np.std(query)\n mean, std = mov_mean_std(ts, m)\n dot = sliding_dot_product(query, ts)\n return 2 * m * (1 - (dot - m * mean * q_mean) / (m * std * q_std))", "def normalize(X, m, s):\n return (X - m) / s", "def nor...
[ "0.6188651", "0.61184984", "0.6113977", "0.6110041", "0.60532564", "0.60418516", "0.6002625", "0.59949887", "0.59357876", "0.5919308", "0.5904984", "0.5893741", "0.5891592", "0.5873965", "0.58559597", "0.5819413", "0.58134836", "0.5808183", "0.5798541", "0.57581913", "0.57415...
0.68552166
0
Returns Key instance of the Profile which corresponds to the Role which is represented by the specified Key.
def _getProfileKeyForRoleKey(key, profile_model): entity = db.get(key) profile = _getProfileForRole(entity, profile_model) return profile.key()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_key(self, role):\n\n for key, role_name in self.assignable_roles[0].items():\n if role_name == role.name:\n return key", "def get_key(self, key):\n ret = None\n qkey = key.__qualname__\n ret = self.get(qkey)\n if not ret:\n # check a...
[ "0.66111445", "0.58805066", "0.58505315", "0.5831204", "0.5803281", "0.5803281", "0.57678306", "0.5754127", "0.56673247", "0.56673247", "0.5639647", "0.5624423", "0.56116235", "0.56116235", "0.56116235", "0.56116235", "0.56116235", "0.56116235", "0.56116235", "0.56116235", "0...
0.828253
0
Function to concatenate dictionaries
def _join_dicts(dicts): if dicts is None: # pragma: no cover return assembled_dict = {k: v for D in dicts for k, v in D.items()} return assembled_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concatDic(dic1, dic2):\n pass", "def concat_dicts(self, dict1, dict2):\n result = dict()\n for key, value in dict1.items():\n if len(value.shape) == 1:\n result[key] = np.concatenate([value, dict2[key]])\n else:\n result[key] = np.vstack([v...
[ "0.78326815", "0.76263916", "0.7547149", "0.7144526", "0.7144526", "0.7033631", "0.70007455", "0.6978834", "0.68688685", "0.67944866", "0.6774909", "0.67653054", "0.6748235", "0.6728825", "0.67226535", "0.6719533", "0.6710105", "0.6710105", "0.6710105", "0.6700148", "0.669384...
0.71008927
5
MPI wrapper for maxvar and vcmt computation
def _maxvar_vcm_calc(ifg_paths, params, preread_ifgs): log.info('Calculating the temporal variance-covariance matrix') process_indices = mpiops.array_split(range(len(ifg_paths))) def _get_r_dist(ifg_path): """ Get RDIst class object """ ifg = Ifg(ifg_path) ifg.open()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_max_and_argmax(node):\r\n if node.op == T._max_and_argmax:\r\n if len(node.outputs[1].clients) == 0:\r\n #MaxAndArgmax support variable axis,\r\n #but CAReduce support only constant axis.\r\n if node.inputs[1].data is None:\r\n axis = None\r\n ...
[ "0.6341681", "0.61969894", "0.6065083", "0.60228604", "0.60162735", "0.596405", "0.5831983", "0.58185774", "0.57805014", "0.57521695", "0.57240343", "0.57173043", "0.56774616", "0.5617856", "0.5602376", "0.5560389", "0.55562276", "0.5540691", "0.5516906", "0.549255", "0.54219...
0.80074286
0
dropping table at the end of all tests
def tearDownClass(cls): cls.database_connection.connect() cls.database_connection.clear_table('''DROP TABLE ''' + table_name) cls.database_connection.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n self.database.truncate_all_tables()", "def tearDown(self):\n drop_all_tables()\n create_all()", "def tearDown(self):\n with app.app_context():\n db = app.db.get_db()\n cur = db.cursor()\n with app.open_resource('sql/drop_tests.s...
[ "0.7847522", "0.77294594", "0.76650023", "0.76413673", "0.76413673", "0.76196283", "0.7617512", "0.7613479", "0.7605289", "0.7605084", "0.7603006", "0.7583381", "0.7562543", "0.7504366", "0.7504366", "0.7504366", "0.7504366", "0.7504366", "0.7504366", "0.7504366", "0.7504366"...
0.738027
35
Set the nth diagonal of a symmetric 2D numpy array to a fixed value. Operates in place.
def set_mat_diag(mat, diag=0, val=0): m = mat.shape[0] step = m + 1 start = diag end = m ** 2 - diag * m mat.flat[start:end:step] = val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_diagonal(self, value = 0):\n for d in range(self.size):\n self.write(d, d, value)", "def set_diag(M,d,idx=0):\n n, m = shape_mat(M)\n if idx >= 0:\n for i, di in enumerate( d ):\n M[i][i+idx] = di\n else:\n for i, di in enumerate( d ):\n M[i-...
[ "0.7125442", "0.69381803", "0.66931725", "0.6662349", "0.6404038", "0.6235831", "0.6171781", "0.6152024", "0.60630727", "0.5889371", "0.57974076", "0.5756528", "0.57523865", "0.5675084", "0.5653157", "0.5643824", "0.55920154", "0.5581051", "0.55746204", "0.5569762", "0.554835...
0.6709417
2
Trim an upper triangle sparse matrix so that only the first n diagonals are kept.
def diag_trim(mat, n): if sp.issparse(mat): if mat.format != "csr": raise ValueError("input type must be scipy.sparse.csr_matrix") # Trim diagonals by removing all elements further than n in the # upper triangle trimmed = sp.tril(mat, n, format="csr") trimmed = sp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trim_whitespace(matrix, details, min_gap):\r\n if details == -1:\r\n row = matrix[0, ]\r\n else:\r\n row = matrix[matrix.shape[0] - 1, ]\r\n\r\n min_left = np.argmin(row)\r\n min_right = np.argmin(row[::-1])\r\n\r\n if min_left > min_gap:\r\n ...
[ "0.64127666", "0.58649224", "0.57881296", "0.5781573", "0.5728801", "0.57002896", "0.5696073", "0.568997", "0.5671774", "0.566362", "0.566362", "0.566362", "0.56233585", "0.5622041", "0.5614353", "0.55710584", "0.55435014", "0.5482823", "0.5455417", "0.54416484", "0.54353005"...
0.7814169
0
Returns lists of detectable indices after excluding low interacting bins based on the proportion of zero pixel values in the matrix bins.
def get_detectable_bins(mat, n_mads=3, inter=False): matrix = mat.copy() matrix.eliminate_zeros() def mad(x): return ss.median_abs_deviation(x, nan_policy="omit") if not inter: if matrix.shape[0] != matrix.shape[1]: raise ValueError("Intrachromosomal matrices must be symmetric.") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vir_indices(self):\n indices = []\n for index,item in enumerate(self):\n if item==0:\n indices.append(index)\n return indices", "def get_agent_indices(array):\t\n\tagent_indices = np.argwhere(array != 0)\n\treturn agent_indices", "def pick_nonzero_bin(binning,...
[ "0.6325455", "0.63100487", "0.6245059", "0.6240828", "0.62382156", "0.622966", "0.6220698", "0.62201536", "0.6188076", "0.6029027", "0.59354", "0.5917809", "0.59095675", "0.5891025", "0.5851099", "0.58345515", "0.5804097", "0.5793994", "0.5785157", "0.5784481", "0.5775276", ...
0.57897145
18
Compute the sum of matrices bins (i.e. rows or columns) using only the upper triangle, assuming symmetrical matrices.
def sum_mat_bins(mat): # Equivalaent to row or col sum on a full matrix # Note: mat.sum returns a 'matrix' object. A1 extracts the 1D flat array # from the matrix return mat.sum(axis=0).A1 + mat.sum(axis=1).A1 - mat.diagonal(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row_col_sums(i, b_j, bins, C, n_u):\n s= C[i][i]*n_u[i]*n_u[i]\n for j in range(bins[b_j], bins[b_j+1]):\n if i != j:\n s+= (C[i][j] + C[j][i])*n_u[i]*n_u[j]\n return s", "def block_sum(i, bins, C, n_u):\n s= 0.0\n for j in range(bins[i], bins[i+1]):\n for k in range(b...
[ "0.7041019", "0.6156732", "0.6129798", "0.5976102", "0.59643245", "0.5771837", "0.57445884", "0.5654173", "0.5501301", "0.5317589", "0.5288595", "0.52820784", "0.5261982", "0.5255658", "0.52305037", "0.5229471", "0.52255195", "0.5207664", "0.5206341", "0.5196019", "0.5180939"...
0.7172675
0
Adds margin of zeros around an input sparse matrix.
def zero_pad_sparse(mat, margin_h, margin_v, fmt="coo"): sm, sn = mat.shape padded_mat = mat.copy() # Up and down margins initialized with zeros and filled as needed margin_h_0 = sp.csr_matrix((sm, margin_h), dtype=mat.dtype) margin_v_0 = sp.csr_matrix((margin_v, sn + 2 * margin_h), dtype=mat.dtype...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pad_with_zeros(self, X, margin):\n newX = np.zeros((X.shape[0] + 2 * margin, X.shape[1] + 2 * margin, X.shape[2]))\n x_offset = margin\n y_offset = margin\n newX[x_offset:X.shape[0] + x_offset, y_offset:X.shape[1] + y_offset, :] = X\n return newX", "def OffsetSparseMatrix(...
[ "0.6846492", "0.6157045", "0.6157045", "0.6109819", "0.59839016", "0.59775317", "0.59726745", "0.59028137", "0.5901642", "0.5830433", "0.57942516", "0.57754564", "0.5743076", "0.57350683", "0.57294387", "0.57047725", "0.5701384", "0.5644425", "0.5624889", "0.56114304", "0.560...
0.7736398
0
Given an array of valid indices, return the corrsesponding array of missing indices.
def valid_to_missing(valid, size): missing = np.ones(size, dtype=bool) try: missing[valid] = False # In case there is no valid index except IndexError: pass missing = np.flatnonzero(missing) return missing
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def non_masked_indices(mask):\n\treturn np.nonzero(np.ravel(mask-1,order='C'))[0]", "def _get_nan_indices(*tensors: Tensor) ->Tensor:\n if len(tensors) == 0:\n raise ValueError('Must pass at least one tensor as argument')\n sentinel = tensors[0]\n nan_idxs = torch.zeros(len(sentinel), dtype=torch...
[ "0.6300259", "0.6108775", "0.6091231", "0.60477185", "0.6002121", "0.5978218", "0.59119964", "0.58613497", "0.58460724", "0.5842929", "0.57560515", "0.5704897", "0.5615569", "0.55952543", "0.55720913", "0.55479383", "0.5543988", "0.55328596", "0.5526036", "0.55213183", "0.547...
0.610664
2
r"""Close file when EOF to be sent.
def on_send_eof(self): flag, msg_s = super(FileComm, self).on_send_eof() try: self.fd.flush() except (AttributeError, ValueError): # pragma: debug if self.is_open: raise # self.close() return flag, msg_s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endfile(self) :\n\n\t\tself.fd.close()\n\t\treturn 1", "def _close(self):\n self.fh.close()", "def close(self):\n\n if self._buffer:\n self.flush()\n self._handle.write(_bgzf_eof)\n self._handle.flush()\n self._handle.close()", "def endFileOutput(self):\n ...
[ "0.7616852", "0.70272315", "0.6968532", "0.69370455", "0.6904911", "0.6900146", "0.6881973", "0.6857646", "0.6857646", "0.6731838", "0.67068696", "0.6695717", "0.6672172", "0.66496336", "0.66146374", "0.66146374", "0.6599462", "0.6599462", "0.65962714", "0.6594169", "0.658688...
0.6309329
39
Helper function for printing just one element in an array. All parameters except `idx` are the same as for `print`. Returns an identity operation on `x`, so that it can be used as follows >>> x = shim.tensor(np.arange(100, 0.1)) >>> x = shim.print_array(x, idx=3)
def print_array(x, idx=slice(None), message=None, message_prefix="SHIM - ", file=sys.stdout): return set_subtensor(x[idx], print(x[idx], message=message, message_prefix=message_prefix, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ndarray_print(nd):\n try:\n x = nd.tolist()\n except (TypeError, NotImplementedError):\n x = nd.tobytes()\n if isinstance(nd, ndarray):\n offset = nd.offset\n flags = nd.flags\n else:\n offset = 'unknown'\n flags = 'unknown'\n print(\n \"ndarray(%...
[ "0.60525095", "0.601079", "0.5855006", "0.575493", "0.5318782", "0.52099293", "0.5171336", "0.5115472", "0.50951475", "0.50903505", "0.50739056", "0.5069581", "0.49996632", "0.49829748", "0.4963213", "0.49431276", "0.49431276", "0.49431276", "0.49431276", "0.4938878", "0.4933...
0.77429724
0
Return True if `var` is sparse with `scipy.sparse` interface. True for scipy.sparse, theano.sparse.
def isspsparse(var): if 'theano.sparse' in sys.modules: return (sp.sparse.issparse(var) or isinstance(var, sys.modules['theano.sparse'].basic.SparseVariable)) else: return sp.sparse.issparse(var)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_sparse(x: Any, backend=None) -> bool:\r\n module = get_module(backend)\r\n return module.is_sparse(x)", "def issparse(var):\n if 'theano.sparse' in sys.modules:\n return (sp.sparse.issparse(var)\n or isinstance(var, sys.modules['theano.sparse'].basic.SparseVariable))\n el...
[ "0.73790324", "0.72182786", "0.7192387", "0.71083176", "0.706764", "0.65949607", "0.6314302", "0.62896657", "0.62845683", "0.6133798", "0.6107449", "0.6087067", "0.6074301", "0.6030176", "0.60223293", "0.5920868", "0.585102", "0.5810927", "0.57268214", "0.57231104", "0.570871...
0.86598843
0
For Numpy arrays, an axis is broadcastable iff it has length one.
def broadcastable(self): return tuple(s==1 for s in self.shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def really1d(arr):\n if np.ndim(arr) != 1:\n return False\n # Empty list or array\n if len(arr) == 0:\n return True\n if np.any(np.vectorize(np.ndim)(arr)):\n return False\n return True", "def test_broadcast_dims():\r\n test((1, 2, 3))\r\n test((2, 1, 3))\r\n test((2,...
[ "0.67279613", "0.65214336", "0.64793956", "0.6454583", "0.6402333", "0.63785535", "0.6363917", "0.6327987", "0.62992084", "0.6255868", "0.6253109", "0.61367655", "0.61352086", "0.61097795", "0.6078569", "0.60693306", "0.5999976", "0.59963834", "0.59572417", "0.593746", "0.586...
0.6370583
6
All parameters except `array_shape` are the same as for np.pad. `array_shape` is necessary because while we can deal with a Theano array, we need to know its shape.
def pad(array, array_shape, pad_width, mode='constant', **kwargs): if mode not in ['constant']: raise ValueError("theano_shim does not support mode '{}'".format(mode)) if not is_theano_object(array): assert(array.shape == array_shape) # If this fails, than the Theano code will also f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(arr, target_shape, constant_values=0):\n arr_shape = arr.shape\n npad = ()\n for dim in range(len(arr_shape)):\n diff = target_shape[dim] - arr_shape[dim]\n if diff > 0:\n before = int(diff / 2)\n after = diff - before\n else:\n before = 0\n ...
[ "0.72683674", "0.69279623", "0.6815563", "0.6631931", "0.6603894", "0.6579442", "0.65710515", "0.6466191", "0.646429", "0.6456382", "0.63967574", "0.6391941", "0.630208", "0.6301449", "0.62548065", "0.6236044", "0.6222941", "0.61766315", "0.61551076", "0.61501074", "0.6145136...
0.774596
0
Location of the OCSP responder for this certificate. Will be one of the
def ocsp_url(self): if self._authority_information_access is None: return None for ad in self._authority_information_access: if ad['access_method'].native == 'ocsp' and ad['access_location'].name == 'uniform_resource_identifier': return ad['access_location'].cho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_ocsp_server(self, cert_path):\n try:\n url, _err = util.run_script(\n [\"openssl\", \"x509\", \"-in\", cert_path, \"-noout\", \"-ocsp_uri\"],\n log=logger.debug)\n except errors.SubprocessError:\n logger.info(\"Cannot extract OCSP URI ...
[ "0.6131117", "0.5615289", "0.5481226", "0.52892077", "0.5258419", "0.5220536", "0.51888037", "0.51888037", "0.510542", "0.50266665", "0.5012942", "0.49867067", "0.49449998", "0.49422258", "0.49315235", "0.49149665", "0.49149665", "0.48778692", "0.48690465", "0.48679858", "0.4...
0.61559165
0
Tokenize data file and turn into tokenids using given vocabulary file. This function loads data linebyline from data_path, calls the above sentence_to_token_ids, and saves the result to target_path. See comment for sentence_to_token_ids on the details of tokenids format.
def data_to_token_ids(data_path, target_path, vocabulary_path, tokenizer=None, normalize_digits=True): if not gfile.Exists(target_path): print("Tokenizing data in %s" % data_path) vocab, _ = data_utils.initialize_vocabulary(vocabulary_path) with gfile.GFile(data_path, m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_to_token_ids(data_path, target_path, vocabulary_path):\n if not gfile.Exists(target_path):\n print(\"Tokenizing data in %s\" % data_path)\n vocab, _ = initialize_vocabulary(vocabulary_path)\n with gfile.GFile(data_path, mode=\"rb\") as data_file:\n with gfile.GFile(targe...
[ "0.88158065", "0.8449106", "0.83855826", "0.8366422", "0.82797813", "0.8102873", "0.7367587", "0.726734", "0.7234463", "0.7134788", "0.7093858", "0.70898783", "0.70898783", "0.70594037", "0.7039706", "0.6949376", "0.6746222", "0.67304814", "0.6648989", "0.6558965", "0.6438027...
0.8453001
1
Compute the average precision of a ranked list against some ground truth
def average_precision(ranking, references, atk=None): total, num_correct = 0.0, 0.0 for k, prediction in enumerate(ranking[:atk], 1): if prediction in references: num_correct += 1 total += num_correct / k return total / num_correct if total > 0 else 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(ground_truth, prediction):\n ground_truth = remove_duplicates(ground_truth)\n prediction = remove_duplicates(prediction)\n precision_score = count_a_in_b_unique(prediction, ground_truth) / float(len(prediction))\n assert 0 <= precision_score <= 1\n return precision_score", "def avera...
[ "0.7208344", "0.7128738", "0.70493734", "0.70493734", "0.69964546", "0.69185257", "0.6745876", "0.6717349", "0.6709977", "0.670711", "0.66209596", "0.66137177", "0.65935045", "0.65935045", "0.6568909", "0.6563142", "0.65568525", "0.6533323", "0.6532258", "0.65147334", "0.6491...
0.7527089
0
Compute the mean average precision. Input should be a list of prediction rankings and a list of ground truth rankings.
def mean_average_precision(rankings, references, atk=None): return _mean_score(rankings, references, partial(average_precision, atk=atk))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_average_precision(ground_truth_boxes, predicted_boxes):\n # DO NOT EDIT THIS CODE\n all_gt_boxes = []\n all_prediction_boxes = []\n confidence_scores = []\n\n for image_id in ground_truth_boxes.keys():\n pred_boxes = predicted_boxes[image_id][\"boxes\"]\n scores = predicted_bo...
[ "0.7831679", "0.7574589", "0.75513065", "0.75513065", "0.75288075", "0.74372524", "0.732722", "0.7210581", "0.7141075", "0.6975217", "0.69228095", "0.6889771", "0.6889771", "0.6876503", "0.67573595", "0.67374164", "0.6712426", "0.668879", "0.66805184", "0.66583216", "0.664517...
0.77060956
1
Compute the mean reciprocal precision. Input should be a list of prediction rankings and a list of ground truth rankings.
def mean_reciprocal_rank(rankings, references, atk=None): return _mean_score(rankings, references, partial(reciprocal_rank, atk=atk))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_precision(ranking, references, atk=None):\n total, num_correct = 0.0, 0.0\n for k, prediction in enumerate(ranking[:atk], 1):\n if prediction in references:\n num_correct += 1\n total += num_correct / k\n return total / num_correct if total > 0 else 0.0", "def me...
[ "0.7065807", "0.70518625", "0.70157504", "0.70157504", "0.68720365", "0.685541", "0.6840075", "0.67997265", "0.67997265", "0.67997265", "0.67128766", "0.67063826", "0.6668957", "0.6668957", "0.666502", "0.6556388", "0.65000385", "0.63746715", "0.6370327", "0.6348512", "0.6345...
0.6964207
4
Return the margin, or absolute difference between the highest irrelevant item and the lowest relevant one.
def margin(ranking, references): lowest_relevant, highest_irrelevant = 0, 0 for k, prediction in enumerate(ranking, 1): if prediction not in references and highest_irrelevant is 0: highest_irrelevant = k if prediction in references and k > lowest_relevant: lowest_relevant...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_margin(self) -> float:\n return self.position.exchange.available_margin", "def score_margin(self):\n if self.previous_event is None:\n score = self.score\n else:\n score = self.previous_event.score\n offense_team_id = self.get_offense_team_id()\n ...
[ "0.6683197", "0.6535715", "0.6526499", "0.64784586", "0.6443067", "0.637917", "0.63374513", "0.6324491", "0.6324483", "0.6308849", "0.62230015", "0.59055555", "0.576389", "0.57285047", "0.56073964", "0.56070846", "0.55782366", "0.5575528", "0.55331033", "0.55096865", "0.54899...
0.6742604
0
Normalized discounted cumulative gain (NDGC)
def ndcg(relevances, rank=10): best_dcg = dcg(sorted(relevances, reverse=True), rank) if best_dcg == 0: return 0. return dcg(relevances, rank) / best_dcg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dcg(scores, discount=np.log2):\n scores = np.nan_to_num(scores)\n ranks = np.arange(1, len(scores) + 1)\n disc = discount(ranks)\n np.maximum(disc, 1, out=disc)\n np.reciprocal(disc, out=disc)\n return np.dot(scores, disc)", "def _get_cg_discount(top_k_int=1):\n log_2 = tf.log(tf.constant...
[ "0.65538585", "0.6481912", "0.6384384", "0.6360059", "0.6212594", "0.6171593", "0.61645573", "0.6149474", "0.6141358", "0.6097007", "0.6049013", "0.60426986", "0.59782493", "0.59467566", "0.59015936", "0.5899923", "0.5890733", "0.5869578", "0.5842891", "0.583804", "0.5810907"...
0.5687919
27
Getter for total Duration Return
def GetTotalDuration(self): return self.totalDuration
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_duration(self):\n return self.duration", "def get_duration(self):\n return self._duration", "def Duration(self):\r\n\t\treturn self._get_attribute('duration')", "def Duration(self):\n\t\treturn self._get_attribute('duration')", "def duration(self):\n return self._get('duration'...
[ "0.8640967", "0.8465019", "0.8192792", "0.81764585", "0.81736344", "0.81567216", "0.81567216", "0.81567216", "0.81567216", "0.81567216", "0.81567216", "0.81567216", "0.81567216", "0.81281835", "0.81279856", "0.81210256", "0.80905044", "0.79546475", "0.7880334", "0.78671366", ...
0.8545387
1
Returns a default LabelStoreConfig to fill in any missing ones.
def get_default_label_store(self, scene: SceneConfig) -> LabelStoreConfig: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_config(cls):\n default = super(LSHNearestNeighborIndex, cls).get_default_config()\n\n lf_default = plugin.make_config(get_lsh_functor_impls())\n default['lsh_functor'] = lf_default\n\n di_default = plugin.make_config(get_descriptor_index_impls())\n default['descri...
[ "0.6221486", "0.60220504", "0.5819019", "0.5805407", "0.5782555", "0.57711416", "0.57619035", "0.57562435", "0.5748874", "0.56956226", "0.56690294", "0.5653731", "0.5632784", "0.55963796", "0.55954915", "0.55846584", "0.55831254", "0.55684423", "0.5543517", "0.55301565", "0.5...
0.77048916
0
Returns a default EvaluatorConfig to use if one isn't set.
def get_default_evaluator(self) -> EvaluatorConfig: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_config():\n # pylint: disable=cyclic-import\n from raylab.agents.sac import DEFAULT_CONFIG\n\n return DEFAULT_CONFIG", "def get_default_config(self):\n return config.read(pathlib.Path(__file__).parent / \"ext.conf\")", "def default(self):\n return self._config...
[ "0.69978195", "0.67205906", "0.6683171", "0.6621579", "0.63026786", "0.62763005", "0.62488645", "0.62030625", "0.61780494", "0.61780494", "0.6141372", "0.6116631", "0.6102302", "0.6101332", "0.60781455", "0.6034338", "0.6029229", "0.60245436", "0.5991673", "0.5976192", "0.596...
0.85756123
0
Returns true if the given resource type is an AWS resource that supports tags.
def is_taggable(t: str) -> bool: return t in taggable_resource_types
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsTagExists(self, ResourceId, TagName):\n\n try:\n if self.Service == 'ec2':\n response = self.DescribeTags(ResourceId)\n if TagName in list(map(lambda x: x['Key'], [x for x in response['Tags']])):\n return True\n elif self.Service =...
[ "0.6399579", "0.63201123", "0.62766284", "0.6256046", "0.62011147", "0.61333555", "0.6058019", "0.6058019", "0.5869327", "0.5817959", "0.57866144", "0.5778956", "0.57481205", "0.57481205", "0.57481205", "0.5704926", "0.5670921", "0.5625209", "0.55327207", "0.551816", "0.54557...
0.7635412
0
Computes the discounted reward for the entire episode.
def accumulate_rewards(rewards, gamma): reversed_rewards = rewards[::-1] # list reversal acc = list(itertools.accumulate(reversed_rewards, lambda x, y: x*gamma + y)) return np.array(acc[::-1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discount_and_normalize_rewards(self, episode_rewards):\n # Get empty array with the same size as the rewards array\n discounted_episode_rewards = np.zeros_like(episode_rewards)\n\n # Variable that stores value of the discounted reward being calculated by the loop\n current_reward = ...
[ "0.74826664", "0.7430066", "0.741672", "0.7255326", "0.71947306", "0.7184354", "0.71606743", "0.7058474", "0.6957285", "0.69207364", "0.6917125", "0.6786361", "0.6777256", "0.675367", "0.6746068", "0.6699113", "0.6676255", "0.6666142", "0.6660753", "0.6658038", "0.6646817", ...
0.0
-1
Get the checkpoint path from the given model output directory
def _get_checkpoint(self): ckpt = tf.train.get_checkpoint_state(self.model) if ckpt and ckpt.model_checkpoint_path: ckpt_path = ckpt.model_checkpoint_path else: raise RuntimeError('No checkpoint file found') return ckpt_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_dir(self):\n return os.path.join(self.checkpoint_dir, self.model_dir)", "def _checkpoint_dir(job_log_dir: str) -> str:\n return os.path.join(job_log_dir, 'checkpoints')", "def get_checkpoint_path(self) -> str:\n return self._j_checkpoint_storage.getCheckpointPath().toString()", "def...
[ "0.8124849", "0.7751144", "0.7577298", "0.746758", "0.7276259", "0.71268463", "0.7119968", "0.7004831", "0.6968759", "0.6910264", "0.68485147", "0.6757792", "0.6754972", "0.67422986", "0.67221975", "0.6708189", "0.6678933", "0.6621704", "0.65912944", "0.65912944", "0.6507298"...
0.7458354
4
String for representing the Organization object (in Admin site etc.).
def __str__(self): if self.name != None and self.name != '': return self.name else: return "Organization object owned by %s."%(self.owner)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str('%s (%s)' % (self.company, self.owner))", "def organization_name(self):\n if self.organization is not None:\n return self.organization.name\n\n return ''", "def org_urn(self):\n return f\"psc:org:{self.credentials.org_key}\"", "def organi...
[ "0.7165319", "0.6806214", "0.6790389", "0.64104795", "0.6407919", "0.6346011", "0.6310931", "0.63100046", "0.630681", "0.6305702", "0.6300019", "0.62802875", "0.6278159", "0.6271169", "0.626531", "0.62608826", "0.6247357", "0.620912", "0.6205226", "0.61515045", "0.61467075", ...
0.76456773
0
Extracts all the ngrams (min_order <= n <= max_order) from a sequence of tokens.
def extract_ngrams(line, min_order=1, max_order=BLEU.NGRAM_ORDER) -> Counter: ngrams = Counter() # type: Counter tokens = line.split() for n in range(min_order, max_order + 1): for i in range(0, len(tokens) - n + 1): ngram = ' '.join(tokens[i: i + n]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_grams(tokens, n):\n return zip(*[tokens[i:] for i in range(n)])", "def build_ngrams(tokens, n=2):\n ngrams = zip(*(islice(group, idx, None) for idx, group in enumerate(tee(tokens, n))))\n return ngrams", "def get_ngrams(tokens, min_n, max_n):\n all_ngrams = list()\n n_tokens = len(tokens)\...
[ "0.8024978", "0.78923404", "0.7772897", "0.75658435", "0.75516206", "0.7496225", "0.7459337", "0.7409229", "0.7395054", "0.7372828", "0.7341489", "0.728606", "0.7244324", "0.7237867", "0.72247565", "0.7176616", "0.7175382", "0.71394616", "0.71245074", "0.71214175", "0.7113682...
0.7025471
23
Apply Gaussian noise to an input tensor.
def gaussian_noise(tensor, mean, stddev): noise = Variable(tensor.data.new(tensor.size()).normal_(mean, std)) return tensor + noise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian_noise(self, tensor):\n return tensor.new_empty(tensor.size()).normal_(std=self._discreteness)", "def task_gaussian_noise(input_array, noise_factor):\n return(np.random.normal(0, noise_factor, input_array.shape))", "def add_gaussian_noise(X, mu=0, sigma=0.1):\n noise = np.random.normal...
[ "0.78414464", "0.7245466", "0.71811473", "0.71459424", "0.68363976", "0.6799063", "0.66733646", "0.66543114", "0.65751487", "0.6564241", "0.6492763", "0.64736784", "0.64736784", "0.64586484", "0.64251614", "0.6397649", "0.6334172", "0.63252485", "0.6302892", "0.6299813", "0.6...
0.7755156
1
Module fixture for the IrisDataset class
def iris(): return IrisDataset()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.dataset = self.dataset_cls()", "def __init__(self, dataset: Dataset):\n self.dataset = dataset", "def test_get_iris_setosa_data(self):\n iris = get_iris_setosa_data()\n self.assertEqual(len(iris.data), 150)\n self.assertEqual(len(iris.labels), 150)", ...
[ "0.7222384", "0.71654016", "0.6917572", "0.68906116", "0.6813696", "0.68106896", "0.6733908", "0.6733908", "0.6693054", "0.6673248", "0.6665914", "0.66434", "0.6637773", "0.6597069", "0.6580226", "0.6575524", "0.65625507", "0.65582585", "0.6514318", "0.64990556", "0.6495193",...
0.8066619
0
Should return False when filename doesn't have extension.
def test_09_is_allowed_file_no_ext(self): filename = "somename" is_allowed = utils.is_allowed_file(filename) self.assertFalse(is_allowed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_good_file(filename):\n for e in extensions:\n if filename.endswith(e):\n return True\n return False", "def has_extension(self, filename):\n if filename is None:\n return False\n return filename.split(\".\")[-1].lower() in self.extensions", ...
[ "0.86114055", "0.8488944", "0.8337902", "0.8333528", "0.8282026", "0.8244654", "0.82361555", "0.8206642", "0.81754893", "0.81569153", "0.81452125", "0.81301445", "0.81301445", "0.81301445", "0.81301445", "0.81301445", "0.81301445", "0.8106526", "0.8106526", "0.8100288", "0.81...
0.7480339
71
A torch.nn.Module is return with a Binarization op inside. Usefull on Sequencial instanciation.
def BinaryConnect(stochastic=False): act = BinaryConnectStochastic if stochastic else BinaryConnectDeterministic return front(act)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backbone(self) -> nn.Module:\n raise NotImplementedError()", "def _block(args: ClusterArgs, input_dim: int) -> layers.Bijector:\n _chain: List[layers.Bijector] = []\n\n if args.inn_idf:\n _chain += [\n layers.IntegerDiscreteFlow(input_dim, hidden_channels=args.inn_coupling_chan...
[ "0.6195831", "0.6028067", "0.5984085", "0.5977603", "0.5933567", "0.577126", "0.563872", "0.56152946", "0.5602039", "0.5588794", "0.5583806", "0.55589455", "0.5541637", "0.553707", "0.5502502", "0.5497476", "0.54557115", "0.5453031", "0.54503006", "0.5436571", "0.5436571", ...
0.0
-1
Returns the postfix form of the infix expression found in `expr`
def infix_to_postfix(expr): # you may find the following precedence dictionary useful prec = {'*': 2, '/': 2, '+': 1, '-': 1} ops = Stack() postfix = [] toks = expr.split() ### BEGIN SOLUTION opp = {'*', '/','+', '-'} for x in toks: if str.isdigit(x): post...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infix_to_postfix(expr):\n ops = Stack()\n postfix = []\n toks = expr.split()\n def tests(chr):\n if chr.isdigit():\n postfix.append(chr)\n\n elif chr == '(':\n ops.push('(')\n\n elif ops.peek() == '(' or ops.empty():\n ops.push(chr)\n\n e...
[ "0.81900203", "0.7801753", "0.76920533", "0.7429643", "0.7404279", "0.7347274", "0.7156811", "0.7048756", "0.6956311", "0.6874034", "0.68503463", "0.67862564", "0.67233485", "0.6722634", "0.6648669", "0.6607104", "0.65920854", "0.6575015", "0.65612596", "0.65422934", "0.64984...
0.7979371
1
Retrieve list of lending requests in Alma.
def get(self, library_id, q_params={}, raw=False): args = q_params.copy() args['apikey'] = self.cnxn_params['api_key'] args['library'] = str(library_id) url = self.cnxn_params['api_uri_full'] response = self.read(url, args, raw=raw) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_requesters():\n from mephisto.core.local_database import LocalMephistoDB\n from tabulate import tabulate\n\n db = LocalMephistoDB()\n requesters = db.find_requesters()\n dict_requesters = [r.to_dict() for r in requesters]\n click.echo(tabulate(dict_requesters, headers=\"keys\"))", "def...
[ "0.6040457", "0.5955607", "0.58180857", "0.5787489", "0.57837325", "0.576755", "0.5657119", "0.5593387", "0.55743015", "0.5559228", "0.553012", "0.5527205", "0.5499191", "0.5457418", "0.5445605", "0.5431204", "0.53873026", "0.53873026", "0.53873026", "0.53873026", "0.53873026...
0.0
-1
Hide a DLL function.
def _prohibit(self, fname): @functools.wraps(getattr(cls, fname)) def prohibited(*args, **kwargs): raise AttributeError( "{} is not a public function of the DLL".format(fname)) setattr(self, fname, prohibited)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide(self):\n raise NotImplementedError", "def do_hf_unhide(self, arg):\n self.show_hidden_frames = True\n self.refresh_stack()", "def hidden():\n return False", "def disable(func):\n return func", "def hide_gui():\n pass", "def do_hf_hide(self, arg):\n se...
[ "0.6301674", "0.60477537", "0.60280937", "0.59768236", "0.5971939", "0.59075075", "0.5817386", "0.57986", "0.5764656", "0.57285553", "0.5725818", "0.57060546", "0.5704686", "0.56854", "0.5649857", "0.56369823", "0.55817014", "0.5533546", "0.5519958", "0.5513072", "0.5513072",...
0.60058
3
Returns unique elements from a list of permutations.
def permutations(config): return list(set(itertools.permutations(config)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_permutations(items):\n return set(permutations(items))", "def listUnique(self,permutations=True):\n ind,ok = self.testDuplicate(permutations)\n return ind[ok]", "def uniq(elements):\n us = set()\n ret = []\n for e in elements:\n if e not in us:\n ret.appen...
[ "0.8177064", "0.7411001", "0.6802766", "0.6653996", "0.66447264", "0.65575033", "0.6525947", "0.64785385", "0.64524955", "0.6374415", "0.6337084", "0.6331694", "0.63158125", "0.6297816", "0.6290124", "0.6272724", "0.6271203", "0.627059", "0.6264411", "0.6260488", "0.6235243",...
0.6415549
9
Insert value at index k
def __setitem__(self, k, value): if k < 0: k += len(self) if value is not None: self.store_array.add_list_item(ListNode(value , k))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setitem__(self,k,v):\n self.insert(k,v)", "def insert(self, k: int, v: int) -> None:\n i = k % self.capacity\n if not self.data[i]:\n self.data[i] = ListNode(k, v)\n else:\n cur = self.data[i]\n while True:\n if cur.pair[0] == k:\n...
[ "0.77019125", "0.7627747", "0.74772215", "0.7229901", "0.7198082", "0.6954016", "0.6874141", "0.6824919", "0.6617062", "0.66130084", "0.64938253", "0.648273", "0.64766896", "0.6475448", "0.64466083", "0.6428774", "0.64268345", "0.6418416", "0.6408187", "0.63482594", "0.633443...
0.68265134
7
Get the argument parser for passing files.
def get_parser_files(): parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( "outdir", action="store", type=pathlib.Path, help="Directory where to write resulting images.") parser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parser():\n p = argparse.ArgumentParser(description='such a good program')\n p.add_argument('infile')\n p.add_argument('outfile')\n return p", "def get_parser():\n parser = argparse.ArgumentParser()\n # parser = argparse.ArgumentParser(description=__doc__, formatter_class=argpar...
[ "0.79019636", "0.7870106", "0.7787764", "0.75685984", "0.74728954", "0.72674626", "0.71568024", "0.7144376", "0.71342105", "0.71342105", "0.7131248", "0.7063849", "0.7038956", "0.7009244", "0.6967036", "0.6923422", "0.6912022", "0.69116515", "0.6897074", "0.68824583", "0.6878...
0.6530431
70
Returns an ``Iterable`` containing all the instances in the specified dataset. If ``self.lazy`` is False, this calls ``self._read()``, ensures that the result is a list, then returns the resulting list. If ``self.lazy`` is True, this returns an object whose ``__iter__`` method calls ``self._read()`` each iteration. In ...
def read(self, *args, **kwargs) -> Iterable[Instance]: lazy = getattr(self, 'lazy', None) if lazy is None: logger.warning("DatasetReader.lazy is not set, " "did you forget to call the superclass constructor?") if lazy: return _LazyInstances(lam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n return iter(self._datasets)", "def __iter__(self) -> Iterator:\n return iter(self.get_data_loader())", "def __iter__(self) -> Union[Iterator[int], Iterator[Tuple[int, Any]]]:\n self.size = self._data._dataset_size\n if (not self._data._fully_cached or\n ...
[ "0.7040597", "0.6643148", "0.6294192", "0.62414855", "0.61743397", "0.61443645", "0.60582954", "0.6047906", "0.59985113", "0.5981316", "0.5973242", "0.59701633", "0.5944178", "0.5882069", "0.58764064", "0.58696884", "0.5857583", "0.5841389", "0.58389926", "0.5835787", "0.5801...
0.8134299
0
Check for invalid username and invalid password should not be able to login
def test_invalid_username_invalid_password(self): response = self.client.post( reverse('users:login'), { 'username': self.create_user_data()['username'], 'password': self.create_user_data()['password1'] } ) self.assertEqual(response.status_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_auth_user_fail_bad_username(self):\n\n self.assertFalse(User.authenticate(\"invalid\", \"allison\"))", "def test_login_wrong_credentials(self):\n\t\tdata = {'username' : 'nonexistentuser', 'password' : 'nopasswordlol'}\n\t\tresponse = self.login(data)\n\n\t\terror_text = \"Unable to log in with p...
[ "0.7901798", "0.77217233", "0.77012146", "0.76538616", "0.7576865", "0.7574334", "0.755077", "0.7488525", "0.74578387", "0.744723", "0.74460363", "0.74412745", "0.74403954", "0.7430433", "0.7425823", "0.7395681", "0.7395213", "0.7375655", "0.7326853", "0.7312103", "0.7311579"...
0.7513344
7
Check for invalid username and valid password should not be able to login
def test_invalid_username_valid_password(self): response = self.client.post(reverse('users:login'), {'username': 'xyzabe', 'password': self.user['password1']}) self.assertEqual(response.status_code, 200) self.assertFormError(response, 'form', None, ERROR_MSG)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_auth_user_fail_bad_username(self):\n\n self.assertFalse(User.authenticate(\"invalid\", \"allison\"))", "def test_valid_username_invalid_password(self):\n response = self.client.post(reverse('users:login'), {'username': self.user['username'], 'password': '1sfsdf'})\n self.assertEqual...
[ "0.7951096", "0.7841457", "0.7711811", "0.76967174", "0.7688351", "0.7644936", "0.76221037", "0.760486", "0.7591186", "0.75574297", "0.7532108", "0.75310373", "0.7526137", "0.7497212", "0.74888337", "0.74736017", "0.7467855", "0.74638116", "0.7450047", "0.7411747", "0.7391035...
0.7611962
7
Tokenizes a given text and determines the postags. Lowercases the text.
def pos_tag(text, simple=False): tokens = nltk.word_tokenize(text.lower()) pos = nltk.pos_tag(tokens) # simplify tags if requested if simple: simple_pos = [] for word, tag in pos: new_tag = nltk.tag.mapping.map_tag('en-ptb', 'universal',tag) # simplificati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(text):\n return text.lower()", "def preprocess_sent(sent):\n #tokenized = word_tokenize(sent.lower())\n tokenizer = Tok()\n tokenized = tokenizer.tokenize(sent.lower())\n return tokenized", "def process_text(text, tokenize=tokenize1, filter=filter1, stem=None, lower=True):\n as...
[ "0.73638403", "0.71996164", "0.70776325", "0.70369464", "0.70350385", "0.699438", "0.6974615", "0.69460094", "0.6889723", "0.6881596", "0.6870311", "0.68678427", "0.68667", "0.682271", "0.6777725", "0.6755323", "0.67493415", "0.6743987", "0.6711147", "0.67024463", "0.66992223...
0.0
-1
Mark a video as flagged.
def flag_video(self, video_id, flag_reason=""): object=self._video_library.get_video(video_id) print(f"{object}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flag_video(self, video_id, flag_reason=\"Not supplied\"):\n video = self._video_library.get_video(video_id)\n if not video:\n print(\"Cannot flag video: Video does not exist\")\n return\n if video.flag is not None:\n print(\"Cannot flag video: Video is alre...
[ "0.7585753", "0.7543017", "0.7286989", "0.7286989", "0.6934897", "0.68738246", "0.67508376", "0.65071416", "0.59914064", "0.5956641", "0.583062", "0.5781579", "0.5766682", "0.57447886", "0.57447886", "0.57447886", "0.57447886", "0.56196725", "0.5476563", "0.54668385", "0.5389...
0.6579819
7
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: hass.data.pop(DOMAIN) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok", "async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):\n unload_ok = await hass.config_entries.async_unloa...
[ "0.697284", "0.6779855", "0.6747459", "0.6689002", "0.6657831", "0.66162205", "0.6603433", "0.65925974", "0.65595686", "0.65411645", "0.6507643", "0.6507643", "0.6507643", "0.6507643", "0.64977276", "0.64931643", "0.6486601", "0.6486601", "0.6486601", "0.6486601", "0.6469397"...
0.6888074
1
Function for rendering the home page
def render_home(): return render_template("index.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n\n return render_template('home_page.html')", "def home():\n return render_template('homepage.html')", "def home():\n\n return render_template(\"home.html\")", "def home():\n return render_template('home.html')", "def home():\n return render_template('home.html')", "def home()...
[ "0.88329524", "0.86391366", "0.8630416", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.8602575", ...
0.88435775
0
Return the sum of two fractions as a new fraction. Use the standard formula a/b + c/d = (ad+bc)/(bd)
def __add__(self, frac): add_new_numerator = (self.numerator * frac.denominator) +\ (frac.numerator * self.denominator) add_new_denominator = self.denominator * frac.denominator if add_new_denominator == 0: raise ValueError("UNDEFINED.") return Fra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simplify_fraction(a, b):\n c = gcd(a, b)\n return a // c, b // c", "def __add__ (self, other):\n if (self.debug): print(f'enter fraction.__add__ with {other}')\n lcm = find_lcm(self.value[1], other.value[1])\n if (self.debug): print(f'{int(lcm/self.value[1])} {self.value}')\n f1 = self.equi...
[ "0.7550767", "0.73520947", "0.70274425", "0.70012", "0.68851763", "0.68535614", "0.6831391", "0.6830096", "0.6678177", "0.66171855", "0.6570202", "0.6537826", "0.6499646", "0.6448474", "0.64213866", "0.6402042", "0.63277656", "0.6272814", "0.62671316", "0.62539977", "0.618849...
0.65008366
12
Two fractions are equal if they have the same value. Fractions are stored in proper form so the internal representation is unique (3/6 is same as 1/2).
def __eq__(self, frac): return self.equal == frac.equal
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_equal(self):\n self.assertTrue(Fraction(7,10)==Fraction(7,10))", "def test_notequal(self):\n self.assertTrue(Fraction(144,2)!=Fraction(8,4))", "def test_frac_same(self):\n s1 = self.RNA(\"ACGU\")\n s2 = self.RNA(\"AACG\")\n s3 = self.RNA(\"GG\")\n s4 = self.RN...
[ "0.8099188", "0.7660002", "0.74295694", "0.72934115", "0.7253576", "0.7143537", "0.6919099", "0.6876407", "0.6799766", "0.67680925", "0.6742922", "0.67288", "0.6660526", "0.6650963", "0.66349375", "0.6611294", "0.6571344", "0.64932424", "0.64467835", "0.64218277", "0.64188033...
0.7083102
6
Generates parsing spec for tf.parse_example to be used with classifiers. If users keep data in tf.Example format, they need to call tf.parse_example
def classifier_parse_example_spec(feature_columns, label_key, label_dtype=dtypes.int64, label_default=None, weight_column=None): parsing_spec = fc.make_parse_example_spec(feature_col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tf_example_parser(example):\n def _get_feature_map():\n \"\"\"Returns data format of the serialized tf record file.\"\"\"\n return {\n # 3 sparse feature with variable length. Use this if you have a\n # variable number or more than 1 feature value per example.\n \"featur...
[ "0.7969642", "0.77698576", "0.7314053", "0.7263414", "0.72264713", "0.71797144", "0.7169134", "0.7144098", "0.70959514", "0.7066097", "0.704645", "0.702182", "0.69985455", "0.6914308", "0.68740547", "0.68440163", "0.68436134", "0.6774798", "0.6757371", "0.66926384", "0.663061...
0.0
-1
Generates parsing spec for tf.parse_example to be used with regressors. If users keep data in tf.Example format, they need to call tf.parse_example
def regressor_parse_example_spec(feature_columns, label_key, label_dtype=dtypes.float32, label_default=None, label_dimension=1, weight_column=None): pars...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tf_example_parser(example):\n def _get_feature_map():\n \"\"\"Returns data format of the serialized tf record file.\"\"\"\n return {\n # 3 sparse feature with variable length. Use this if you have a\n # variable number or more than 1 feature value per example.\n \"featur...
[ "0.8089116", "0.7692144", "0.7427058", "0.73363465", "0.7304736", "0.72581846", "0.7235934", "0.7229534", "0.7021413", "0.70062184", "0.69566554", "0.69477016", "0.69340587", "0.69241685", "0.6892932", "0.6824007", "0.6796293", "0.6792499", "0.6732977", "0.67035663", "0.66994...
0.0
-1
Lookup the Id for the VPC Route Table with the given name.
def rt_lookup(session, vpc_id, rt_name): if session is None: return None client = session.client('ec2') response = client.describe_route_tables(Filters=[{"Name": "vpc-id", "Values": [vpc_id]}, {"Name": "tag:Name", "Values": [rt_name]}]) if l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_id(self, tag_name):\n response = await self.describe(tag_name)\n if response['RouteTables']:\n return response['RouteTables'][0][\"RouteTableId\"]\n else:\n raise RtbDoesntExists", "def transit_router_route_table_id(self) -> Optional[pulumi.Input[str]]:\n ...
[ "0.7265778", "0.6650314", "0.6650314", "0.65430045", "0.65120596", "0.64262307", "0.6146517", "0.60185033", "0.56920457", "0.5620676", "0.5594443", "0.5552543", "0.5518078", "0.5444758", "0.54276913", "0.5355043", "0.5323631", "0.5280393", "0.5248865", "0.52361125", "0.522494...
0.7589303
0
Lookup up SNS topic ARN given a topic name
def sns_topic_lookup(session, topic_name): if session is None: return None client = session.client('sns') response = client.list_topics() topics_list = response['Topics'] for topic in topics_list: arn_topic_name = topic["TopicArn"].split(':').pop() if arn_topic_name == topic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_topic_arn(topic_name):\n # https://stackoverflow.com/a/37723278/1558022\n sts_client = boto3.client('sts')\n account_id = sts_client.get_caller_identity().get('Account')\n\n return f'arn:aws:sns:eu-west-1:{account_id}:{topic_name}'", "def get_full_topicarn ( base_topicarn, topicname ) :\n ...
[ "0.79431546", "0.72963053", "0.7135237", "0.7135237", "0.7130573", "0.6910786", "0.69055796", "0.6537543", "0.65364784", "0.646367", "0.6283038", "0.59111613", "0.5876922", "0.5643607", "0.56244606", "0.55634636", "0.5465788", "0.54464096", "0.54258615", "0.5421659", "0.53438...
0.8113506
0