query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
By now, we should have access to zsh, git, an alias for git, and git aliases.
def test_git(self): g_d = subprocess.check_output(["zsh", "-i", "-c", "g d --help"]) self.assertIn( "`git d' is aliased to " "`diff --ignore-all-space --ignore-blank-lines --word-diff=color'", g_d, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def git():\n pass", "def git_server():\n log('Instalando git', yellow)\n sudo('apt-get -y install git')", "def is_git():\n return exists('.git') and not islink('.git')", "def git_available():\n null = open(\"/dev/null\", \"w\")\n subprocess.Popen(\"git\", stdout=null, stderr=null)\n null...
[ "0.71773803", "0.65173554", "0.62426406", "0.62096626", "0.58561724", "0.58560854", "0.57751656", "0.5771134", "0.57407856", "0.5733032", "0.5664556", "0.565262", "0.5579932", "0.55676", "0.54418606", "0.54170084", "0.53293735", "0.53232515", "0.5294981", "0.5284832", "0.5240...
0.62428856
2
Normalize the given vector to be of unit length.
def normalize(x: float, y: float, z: float) -> Point3D: mag = math.sqrt(x*x + y*y + z*z) return x/mag, y/mag, z/mag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(vec):\n return vec / length(vec)", "def normalize(vector):\n return vector / np.linalg.norm(vector)", "def _unit_vector(vector):\n return vector / np.linalg.norm(vector)", "def unit_vector(vector):\n vector = np.array(vector)\n if np.linalg.norm(vector) <= 0.00010:\n ...
[ "0.8418114", "0.8342787", "0.82465947", "0.8231255", "0.8206098", "0.81620806", "0.8138398", "0.8138398", "0.8138398", "0.8138398", "0.8138398", "0.8138398", "0.8138398", "0.8138398", "0.8138398", "0.8138398", "0.8138398", "0.81377804", "0.81377804", "0.81377804", "0.81258905...
0.0
-1
Wrap a collection to print iteration progress as a percentage.
def progress_iterator(collection: Collection, message: str) -> Iterable: num_items = len(collection) last_percentage = -1 for i, item in enumerate(collection): percentage = 100 * i // num_items if percentage > last_percentage: last_percentage = percentage print(f"{mes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def progress(items, desc='', total=None, min_delay=0.1):\n total = total or len(items)\n t_start = time.time()\n t_last = 0\n for n, item in enumerate(items):\n t_now = time.time()\n if t_now - t_last > min_delay:\n print('\\r%s%d/%d (%6.2f%%)' % (desc, n+1, total, n / float(to...
[ "0.59742546", "0.59003246", "0.5892191", "0.58499545", "0.5846175", "0.5842051", "0.58191466", "0.58191466", "0.57947624", "0.5790346", "0.57512665", "0.5720828", "0.57070386", "0.57001543", "0.5694676", "0.5692206", "0.56794834", "0.5662845", "0.5627087", "0.561779", "0.5617...
0.78705937
0
Linearly mix two colors. A mix_amount of 0.0 gives color1, and 1.0 gives color2.
def mix_colors(color1: Color, color2: Color, mix_amount: float) -> Color: return [(1-mix_amount)*v1 + mix_amount*v2 for v1, v2 in zip(color1, color2)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mix(a, b, amount):\n return ((1.0 - amount) * a) + (amount * b)", "def mix(self, other, coef=0.5):\n def m(a, b):\n return a * (1 - coef) + b * coef\n\n return Color(from_rgba=(c(m(self.r, other.r)),\n c(m(self.g, other.g)),\n ...
[ "0.6814503", "0.66157776", "0.65710086", "0.65704286", "0.6514247", "0.6078982", "0.60165936", "0.60012364", "0.5994862", "0.5946861", "0.5756687", "0.5738199", "0.57059467", "0.56846344", "0.56739783", "0.5672902", "0.55314547", "0.54851085", "0.5474063", "0.54560703", "0.54...
0.80415565
0
Multiply two vectors elementwise.
def multiply_vectors(vec1: Iterable[float], vec2: Iterable[float]) -> Iterable[float]: return [v1*v2 for v1, v2 in zip(vec1, vec2)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mulVectors(X1,X2):\n _checkSize(X1,X2)\n return sum([ X1[i] * X2[i] for i in range(len(X1))])", "def dot_product(vector1, vector2):\n return [reduce_by_multiplication(pair) for pair in zip(vector1, vector2)]", "def vec_dot(x, y):\r\n return sum(a * b for a, b in zip(x, y))", "def __mul__(self,...
[ "0.8108592", "0.758668", "0.7563538", "0.75536615", "0.7483179", "0.7424614", "0.739436", "0.73315334", "0.73269993", "0.7323699", "0.7294078", "0.72823274", "0.72690797", "0.72641194", "0.72641194", "0.72514796", "0.72514236", "0.724465", "0.72237176", "0.7200534", "0.714153...
0.8106799
1
Create a directional light given its direction and color. The dot_clip parameter adjusts the value of the dot product used in the lighting calculation; a lower value compresses the range of brightnesses produced by the light.
def __init__(self, direction: Point3D, color: Color, dot_clip: float = 0.0): self._direction = normalize(*direction) self._color = color self._dot_clip = dot_clip
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def directionalLight(*args, decayRate: int=0, discRadius: Union[float, bool]=0.0, exclusive:\n bool=True, intensity: Union[float, bool]=0.0, name: Union[AnyStr, bool]=\"\",\n position: Union[List[float, float, float], bool]=None, rgb:\n Union[List[float, ...
[ "0.5512884", "0.5359985", "0.5224884", "0.51298463", "0.49652985", "0.49155885", "0.49088266", "0.48779944", "0.4798884", "0.47342348", "0.47193816", "0.47108945", "0.46938923", "0.46933818", "0.46920228", "0.4672632", "0.46464553", "0.46086583", "0.46074972", "0.4583746", "0...
0.63035196
0
Return the maximum color value that this light can produce.
def get_max_brightness(self) -> float: return max(self._color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_color_max(image, color):\n boundaries = find_color_boundaries(image, color)\n if boundaries:\n return (0, image[boundaries[0] : boundaries[1] + 1, boundaries[2] : boundaries[3] + 1])\n else:\n return 1, None", "def maximal_color(graph, node):\n return max(get_node_colors(graph, ...
[ "0.7567657", "0.7444326", "0.69971585", "0.68010145", "0.67860895", "0.66241765", "0.6564625", "0.6542855", "0.65393096", "0.65304965", "0.6511511", "0.6487539", "0.64411324", "0.6435717", "0.64141905", "0.6350198", "0.6333665", "0.63173854", "0.62954146", "0.6288576", "0.625...
0.8303178
0
Return the color contributed by this light on a surface given its (unit) normal vector and material color.
def compute_shaded_color(self, normal: Point3D, material_color: Color) -> Color: dot_product = sum(multiply_vectors(self._direction, normal)) light_amount = max(dot_product, self._dot_clip) light_amount = (light_amount - self._dot_clip) / (1.0 - self._dot_clip) return [vm*vl*light_amount...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_shaded_color(self, p1: Point3D, p2: Point3D, p3: Point3D, material_color: Color) -> Color:\n # compute the normal vector\n ax, ay, az = p1[0]-p2[0], p1[1]-p2[1], p1[2]-p2[2]\n bx, by, bz = p1[0]-p3[0], p1[1]-p3[1], p1[2]-p3[2]\n nx = ay*bz - az*by\n ny = az*bx - ax*bz...
[ "0.66830057", "0.64685374", "0.63342154", "0.6113619", "0.61106956", "0.60924566", "0.6054413", "0.6053781", "0.6053781", "0.6053781", "0.60509187", "0.6034845", "0.59819704", "0.59732807", "0.59732807", "0.5946499", "0.5937387", "0.59219927", "0.5917848", "0.5914473", "0.591...
0.7437899
0
Create a camera given its position in 3D space and the TaitBryan angles of its orientation.
def __init__(self, pos: Point3D, theta_x: float, theta_y: float, theta_z: float, zoom: float, fog_factor: float, lights: Iterable[DirectionalLight], fast_draw: bool): self._pos = pos self._cx = math.cos(theta_x) self._sx = math.sin(theta_x) self._cy = ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, at=(0, 0, 0), eye=(0, 0, -0.1), lens=None,\r\n is_3d=True, scale=1.0):\r\n super(Camera, self).__init__()\r\n\r\n self.at = at\r\n self.start_eye = eye # for reset with different lens settings\r\n self.eye = [eye[0], eye[1], eye[2]]\r\n if lens == None:\r\n from ...
[ "0.6798269", "0.67603046", "0.66758746", "0.65076005", "0.64469564", "0.63589436", "0.6302461", "0.6173746", "0.6167616", "0.6162428", "0.6041424", "0.6036619", "0.5972016", "0.59465146", "0.59234536", "0.586841", "0.5862043", "0.5859587", "0.5833382", "0.58221215", "0.573312...
0.0
-1
Project a point in 3D world space into 2D screen space.
def project_point(self, point: Point3D) -> Point3D: x, y, z = point cam_x, cam_y, cam_z = self._pos x -= cam_x y -= cam_y z -= cam_z dx = self._cy*(self._sz*y + self._cz*x) - self._sy*z dy = self._sx*(self._sy*(self._sz*y + self._cz*x) + self._cy*z) + self._cx*(se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _world_point(self, point_3d):\n return self.obj.matrix_world @ point_3d", "def screenToCamera(self,x,y):\n #self.x = x\n #self.y = y\n new_x = x / (self.surf.get_width() - 1) - 0.5\n #-(new_x)\n new_y = y / (self.surf.get_height() - 1)\n new_y = (1.0 - cy) - 0...
[ "0.74053556", "0.6547067", "0.64282596", "0.64282596", "0.64282596", "0.6392517", "0.63821685", "0.63705236", "0.6332853", "0.63261366", "0.63232213", "0.6312432", "0.6261391", "0.62242615", "0.6203859", "0.61349493", "0.6087345", "0.6072686", "0.60687876", "0.6006095", "0.59...
0.72277606
1
Draw a 2D triangle given its three vertices.
def draw_triangle(self, p1: Point2D, p2: Point2D, p3: Point2D, color: Color): if self._fast_draw: color_str = "#%02x%02x%02x" % tuple([round(255.0*x) for x in color]) x1, y1 = p1 x2, y2 = p2 x3, y3 = p3 turtle.getcanvas().create_polygon((x1,-y1,x2,-y2,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_triangle(tup):\n x, y, z = tup[0], tup[1], tup[2]\n t_draw = turtle.Turtle()\n for index in range(3):\n t_draw.forward()", "def draw_triangle(self, x0, y0, x1, y1, x2, y2, color=Color['white']):\n self.draw_line(x0, y0, x1, y1, color)\n self.draw_line(x1, y1, x2, y2, color)...
[ "0.73055226", "0.69093883", "0.6836986", "0.66134053", "0.6600105", "0.65658873", "0.6545517", "0.6538176", "0.65234506", "0.6516404", "0.64608943", "0.6257798", "0.62576264", "0.62315243", "0.6178835", "0.61253864", "0.61169004", "0.60595083", "0.60403", "0.5990932", "0.5943...
0.66810584
3
Shade the color of a triangle according to a directional light.
def compute_shaded_color(self, p1: Point3D, p2: Point3D, p3: Point3D, material_color: Color) -> Color: # compute the normal vector ax, ay, az = p1[0]-p2[0], p1[1]-p2[1], p1[2]-p2[2] bx, by, bz = p1[0]-p3[0], p1[1]-p3[1], p1[2]-p3[2] nx = ay*bz - az*by ny = az*bx - ax*bz n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawTriangle(t, color, x, y):\n ## t.color(color)\n ## t.begin_fill()\n for i in range(3):\n t.forward(x)\n t.right(y)", "def shade(l):\n t.color(\"black\",\"gray\")\n t.right(180)\n t.begin_fill()\n for i in range(4):\n t.circle(l / 2, 90)\n t.right(180)\n t...
[ "0.6437846", "0.6129551", "0.60239905", "0.58626735", "0.5794404", "0.57666254", "0.5748235", "0.5602676", "0.5571155", "0.55309993", "0.54138094", "0.5374066", "0.53271747", "0.53018796", "0.52762336", "0.52462494", "0.5212749", "0.51940364", "0.5174119", "0.51721853", "0.51...
0.6095455
2
Fade a color depending on how far from the camera it is.
def compute_fog_faded_color(self, color: Color, dz: float) -> Color: fade_amount = math.exp(-(dz * self._fog_factor)**2) return mix_colors(UPPER_SKY_COLOR, color, fade_amount)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def colorEyes(self, color, fade_duration = 0.2):\n\n\t\tif color in self.colors:\n\t\t\tcolor = self.colors[color]\n\n\t\tself.leds.fadeRGB(\"FaceLeds\", color, fade_duration)", "def do_fade_colour(l, leds, r, g, b, duration):\n l._do_multi_led_command(\n create_fade_colour_command, leds, r, g,...
[ "0.6437271", "0.64267206", "0.6367479", "0.62626547", "0.6219544", "0.61913073", "0.5968006", "0.57155895", "0.5697734", "0.5643331", "0.5637951", "0.5629955", "0.5598446", "0.558756", "0.5551077", "0.5531995", "0.5469604", "0.54235256", "0.53964067", "0.5386732", "0.53677034...
0.6534394
0
Shade, project, and draw a list of triangles in 3D.
def draw_triangles(self, triangles: Collection): # project the points into 2D and compute each shaded/faded color processed_triangles = [] for p1, p2, p3, color in progress_iterator(triangles, "Processing triangles..."): shaded_color = self.compute_shaded_color(p1, p2, p3, color) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_wireframe_3d(self, **kwds):\n wireframe = [];\n for l in self.lines:\n l_coords = self.coordinates_of(l)\n wireframe.append( line3d(l_coords, **kwds))\n for a in self.arrows:\n a_coords = self.coordinates_of(a)\n wireframe.append(arrow3d(a...
[ "0.6908125", "0.6733296", "0.6631174", "0.654832", "0.65126437", "0.6491568", "0.64820564", "0.6396006", "0.6345809", "0.6259672", "0.624029", "0.6208812", "0.6182865", "0.6181145", "0.610569", "0.6074357", "0.60483927", "0.60355747", "0.5983546", "0.5922067", "0.5917617", ...
0.7079494
0
Initialize and generate the Terrain.
def __init__(self, recursion_depth: int, noise_depth: int, scale: float, snow_height: float = None, tree_height: float = None, color_offset_heightmap: "Terrain" = None): self._depth = recursion_depth self._noise_depth = noise_depth self._scale = scale se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_terrain(self):\r\n self.terrain_scale = LVector3(512, 512, 100)\r\n self.terrain_pos = LVector3(-256, -256, -70)\r\n # sample values for a 4096 x 4096px heightmap.\r\n #self.terrain_scale = LVector3(4096, 4096, 1000)\r\n #self.terrain_pos = LVector3(-2048, -2048, -70)\r...
[ "0.74549556", "0.6478305", "0.63706297", "0.63594836", "0.6356376", "0.6118691", "0.6046103", "0.60201776", "0.5974347", "0.58480215", "0.58463407", "0.5843627", "0.58257407", "0.57353765", "0.57326496", "0.5727694", "0.56909436", "0.5686018", "0.5664434", "0.56508946", "0.56...
0.61276466
5
Return the two given points' midpoint, optionally displacing it randomly.
def _get_midpoint(self, p1: Point3D, p2: Point3D, displace: bool) -> Point3D: key = (p1, p2) if p1 < p2 else (p2, p1) if key not in self._height_cache: x1, y1, z1 = p1 x2, y2, z2 = p2 if displace: displacement = random.gauss(0, math.hypot(x1-x2, z1-z2)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def midpoint(ptA, ptB):\n return( (ptA[0] + ptB[0]) * 0.5, (ptA[1]+ ptB[1]) * 0.5 )", "def mid_point(a: Point, b: Point) -> Point:\n return Point((a.x + b.x) / 2, (a.y + b.y) / 2)", "def _mid(pt1, pt2):\n (x0, y0), (x1, y1) = pt1, pt2\n return 0.5 * (x0 + x1), 0.5 * (y0 + y1)", "def midpoint(poin...
[ "0.6839947", "0.6778735", "0.6717456", "0.66509056", "0.6526006", "0.64425707", "0.6356274", "0.62709063", "0.62450653", "0.60857177", "0.59908175", "0.5983488", "0.5940813", "0.5871515", "0.5869892", "0.57786846", "0.57527125", "0.57234603", "0.56530315", "0.5579146", "0.556...
0.5196508
47
Return the key in the _heightmap dict for the given triangle.
def _get_heightmap_key(self, p1: Point3D, p2: Point3D, p3: Point3D) -> Hashable: return p1[0]+p2[0]+p3[0], p1[2]+p2[2]+p3[2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getblockhash(self, blockheight):\n for block in self.blocks:\n if block[\"height\"] == int(blockheight):\n return block[\"hash\"]", "def height_at(self, x, z):\n\n return self.heightmap[x * 16 + z]", "def hkl(self, i):\n return self.get_hkl(self.xp[i], self.yp...
[ "0.5575947", "0.549903", "0.5401808", "0.53665644", "0.53405434", "0.5322528", "0.52560556", "0.5242165", "0.5181723", "0.51672906", "0.51612586", "0.5136122", "0.5113682", "0.50287825", "0.5016688", "0.50130314", "0.5011915", "0.49585357", "0.49564213", "0.49434075", "0.4912...
0.68827283
0
Recursively subdivide the triangle, building the triangle list.
def _fractal_triangle(self, p1: Point3D, p2: Point3D, p3: Point3D, depth: int): if depth == 0: height = (p1[1]+p2[1]+p3[1])/3 if self._only_heightmap: self._heightmap[self._get_heightmap_key(p1,p2,p3)] = height else: if self._color_offset_heigh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pascal_triangle(n):\n my_list = []\n if n <= 0:\n return my_list\n for i in range(1, n + 1):\n value = 1\n tmp_list = []\n for j in range(1, i + 1):\n tmp_list.append(str(value))\n value = value * (i - j) // j\n my_list.append(tmp_list)\n ret...
[ "0.61156666", "0.60765684", "0.6068923", "0.5943549", "0.5928018", "0.5881479", "0.5858516", "0.5801549", "0.578863", "0.57768923", "0.57020724", "0.5700097", "0.56656283", "0.5640589", "0.556706", "0.5558455", "0.552868", "0.54261845", "0.54098445", "0.54004496", "0.53299546...
0.5555776
16
Return the height value for the given triangle.
def get_height(self, p1: Point3D, p2: Point3D, p3: Point3D) -> float: return self._heightmap[self._get_heightmap_key(p1,p2,p3)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triangle_area(base, height):\n return (base * height) / 2", "def triangleArea(base, height):\n base = float(base)\n height = float(height)\n area = 0.5*base*height\n return area", "def triangle_area(base, height): # Compute the area of a triangle\n area = (1.0 / 2) * base * hei...
[ "0.73493534", "0.71972257", "0.7036666", "0.6747272", "0.6747272", "0.6747272", "0.6599264", "0.6586082", "0.6580181", "0.65383524", "0.647105", "0.64360845", "0.64316607", "0.63968635", "0.63645583", "0.63489264", "0.63467", "0.6335431", "0.6335431", "0.6292737", "0.6270184"...
0.6763277
3
Draw the terrain using the given Camera.
def draw(self, camera: Camera): camera.draw_triangles(self._triangles)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self, surface, camera=None):\n if camera:\n surface.blit(self.image, camera.apply(self.rect))\n else:\n surface.blit(self.image, self.rect)", "def draw(self, camera):\n for line in self._polyline.lines:\n camera.draw_line(line.begin, line.end, self.c...
[ "0.6371948", "0.628486", "0.62307286", "0.60651135", "0.59940034", "0.5988739", "0.578298", "0.57561666", "0.5680349", "0.56671095", "0.56671095", "0.5614266", "0.5581884", "0.55596256", "0.55214775", "0.54720634", "0.5420156", "0.5419159", "0.5342214", "0.5324978", "0.532494...
0.6245847
2
Fill the axisaligned rectangle bounded by the given coordinates.
def fill_rectangle(min_x: float, min_y: float, max_x: float, max_y: float, color: Color): turtle.goto(min_x, min_y) turtle.fillcolor(color) turtle.begin_fill() turtle.goto(max_x, min_y) turtle.goto(max_x, max_y) turtle.goto(min_x, max_y) turtle.end_fill()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_rect(self, x, y, width, height, color=Color['white']):\n area = [x, y, width, height]\n pygame.draw.rect(self.display, color, area)", "def fill_box(self, x, y, w, h):\n\t\tpass", "def fill_rect(self, value, x1, y1, x2, y2):\n self.fill(x1, y1, x2-x1, y2-y1)", "def fill_rectangle...
[ "0.7113693", "0.6831624", "0.67631185", "0.66097134", "0.65551496", "0.64967453", "0.6489305", "0.64281934", "0.6296841", "0.6289033", "0.628656", "0.6220911", "0.6196391", "0.6186246", "0.617723", "0.6136184", "0.5985113", "0.5934858", "0.5879427", "0.5859154", "0.58509415",...
0.59198654
18
Fill the background sky gradient. Uses num_steps rectangles to approximate a linear gradient that goes from the top of the screen to start_y of the way down the screen (between 0.0 and 1.0).
def fill_sky_gradient(num_steps: int, start_y: float): # compute some helper values min_x = -turtle.window_width() / 2 max_x = +turtle.window_width() / 2 y_step = turtle.window_height()*start_y / num_steps min_y = turtle.window_height() / 2 - turtle.window_height()*start_y # fill the sectio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_bg (self):\n self.health = max(0.0, min(1.0, (self.healthsteps + self.mud.value) / self.healthsteps))\n healthycolor = (0x11, 0x22, 0x44)\n pollutedcolor = (0x66, 0x66, 0)\n self.watercolor = [int((a - b) * self.health + b)\n for a,b in zip(healthycolo...
[ "0.5875574", "0.5867943", "0.567791", "0.565743", "0.56277025", "0.56065214", "0.54429275", "0.54425997", "0.5415052", "0.54125994", "0.5393641", "0.5389858", "0.5376464", "0.532522", "0.52964115", "0.52853453", "0.52220666", "0.5220336", "0.5219927", "0.52009046", "0.5150408...
0.82996637
0
The entry point of the program.
def main(): # parse command-line arguments parser = argparse.ArgumentParser() parser.add_argument("--no-export", action="store_true", help="Don't export an .eps file of the drawing") parser.add_argument("--fast", action="store_true", help="Add triangles di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n return", "def main(self) -> None:\n pass", "def main() -> None:\n return", "def main():\n pass", "def main():\n print(\"Call your main application code here\")", "def main():\n print(\"Call your main application code here\")", "def main():\n print(\"Call your ...
[ "0.84002817", "0.83892125", "0.83758676", "0.8358361", "0.82993263", "0.82993263", "0.82993263", "0.82943714", "0.8273223", "0.8273223", "0.8273223", "0.8273223", "0.81731397", "0.81714946", "0.8061473", "0.8027592", "0.8027592", "0.8027592", "0.8027592", "0.8027592", "0.8027...
0.0
-1
Method to create data for training, validation and testing.
def get_data( self, shuffle_sample_indices: bool = False, fold: int = None ) -> Tuple: training_elms, validation_elms, test_elms = self._partition_elms( max_elms=config.max_elms, fold=fold ) LOGGER.info("Reading ELM events and creating datasets") LOGGER.info("-" *...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_data():\n tf.logging.info(\"Create records..\")\n train, val, test = util.load_data(data_dir, FLAGS[\"is_aug\"])\n tf.logging.info(\"Dataset size: Train-{} Test-{} Val-{}\".format(len(train), len(test), len(val)))\n return train, val, test", "def prepare_data(self):\n # Set up the ...
[ "0.80186445", "0.7634816", "0.74651897", "0.7411561", "0.73869574", "0.73638266", "0.7355798", "0.7304635", "0.72340393", "0.71644646", "0.7164372", "0.7038772", "0.70161545", "0.70069146", "0.6995095", "0.69406855", "0.69375765", "0.6927627", "0.6926559", "0.6915905", "0.685...
0.0
-1
Partition all the ELM events into training, validation and test indices. Training and validation sets are created based on simple splitting with validation set being `fraction_validate` of the training set or by Kfold crossvalidation.
def _partition_elms( self, max_elms: int = None, fold: int = None ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: # get ELM indices from datafile elm_index, _ = self._read_file() # limit the data according to the max number of events passed if max_elms is not None and max_el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_validation_split(self, threshold=None):\n for train, validation in self._get_k_folds(5, threshold):\n train_provider = train\n validation_provider = validation\n break\n return train_provider, validation_provider", "def split_data(self):\n self.trai...
[ "0.64495283", "0.6436599", "0.64065903", "0.62911177", "0.6255103", "0.62455463", "0.62217116", "0.6184939", "0.61742663", "0.61742663", "0.61652815", "0.6137683", "0.61352956", "0.61342204", "0.61287206", "0.6107777", "0.60363936", "0.6032738", "0.60128796", "0.59902066", "0...
0.7032567
0
Helper function to perform Kfold crossvalidation.
def _kfold_cross_val(self, training_elms: np.ndarray) -> None: kf = model_selection.KFold( n_splits=config.folds, shuffle=True, random_state=config.seed ) self.df["elm_events"] = training_elms self.df["fold"] = -1 for f_, (_, valid_idx) in enumerate(kf.split(X=trainin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_validation(whole_train_data, whole_train_labels, k, k_fold):\n accuracies = []\n for i in range(k_fold):\n train_data, train_labels, validation_data, validation_labels = split_train_and_validation(whole_train_data, whole_train_labels, i, k_fold)\n accuracy = knn(train_data, train_labe...
[ "0.80294365", "0.77735084", "0.7601803", "0.75463474", "0.7538767", "0.74884", "0.7456089", "0.7418098", "0.7385494", "0.7364106", "0.733272", "0.73250705", "0.72707504", "0.72571886", "0.7215479", "0.72141963", "0.72053087", "0.7204734", "0.7181817", "0.71800596", "0.7173328...
0.68311703
42
Helper function to read a HDF5 file.
def _read_file(self) -> Tuple[np.ndarray, h5py.File]: assert os.path.exists(self.datafile) LOGGER.info(f"Found datafile: {self.datafile}") # get ELM indices from datafile hf = h5py.File(self.datafile, "r") LOGGER.info(f"Number of ELM events in the datafile: {len(hf)}") e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_hdf5(filename, namelist=None, **kwargs):\n\n print('Reading %s...'%filename)\n\n fid = h5py.File(filename, mode='r')\n \n data = read_hdf5_tree(fid, namelist, **kwargs)\n\n fid.close()\n \n print('Finished reading %s.'%filename)\n return data", "def read_hdf5(path_to_file):\n\n ...
[ "0.7876679", "0.77904415", "0.7660807", "0.76478595", "0.7424069", "0.7279942", "0.7209535", "0.71982026", "0.7188982", "0.716932", "0.71537584", "0.714661", "0.71031755", "0.70184517", "0.70004874", "0.69663435", "0.69661", "0.6934876", "0.69162387", "0.69102424", "0.6904979...
0.58811384
80
Helper function to concatenate the signals and labels for the ELM events for a given mode. It also creates allowed indices to sample from with respect to signal window size and label look ahead. See the README to know more about it.
def _get_valid_indices( self, _signals: np.ndarray, _labels: np.ndarray, window_start_indices: np.ndarray = None, elm_start_indices: np.ndarray = None, elm_stop_indices: np.ndarray = None, valid_t0: np.ndarray = None, labels: np.ndarray = None, sig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mne_events(self, event_label, anchor = 'beginning', offset = 0) :\n if anchor == 'beginning' : index = 0\n else : index = 1\n events = [[event[index] , 0, 0] for event in self.dic[event_label]]\n return np.array(events, dtype = np.dtype(int))", "def _oversample...
[ "0.5263164", "0.5034725", "0.49608484", "0.49540937", "0.49440297", "0.49331918", "0.48951226", "0.48082525", "0.47010872", "0.46797997", "0.4676625", "0.46277416", "0.46271396", "0.46159562", "0.46156287", "0.46056822", "0.4564617", "0.45601", "0.45503357", "0.4531912", "0.4...
0.47105598
8
Helper function to reduce the class imbalance by upsampling the data points with active ELMS.
def _oversample_data( self, _labels: np.ndarray, valid_indices: np.ndarray, elm_start: np.ndarray, elm_stop: np.ndarray, index_buffer: int = 20, ) -> np.ndarray: # indices for sampling data sample_indices = valid_indices # oversample active EL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overSampling( self, feature, Class, random_state = 0 ):\n oversampler = SMOTE(random_state=0)\n feature_resample, Class_resample = oversampler.fit_sample(feature, \n Class)\n print(\"Warning: You are increasing the datase...
[ "0.6110288", "0.6059917", "0.6038484", "0.57742745", "0.563639", "0.56279844", "0.5613938", "0.56088525", "0.552376", "0.55226964", "0.5484394", "0.5461221", "0.5457568", "0.5457568", "0.5450383", "0.54379547", "0.5396663", "0.53395903", "0.5338186", "0.53211", "0.5274305", ...
0.55385625
8
PyTorch dataset class to get the ELM data and corresponding labels according to the sample_indices. The signals are grouped by `signal_window_size`
def __init__( self, signals: np.ndarray, labels: np.ndarray, sample_indices: np.ndarray, window_start: np.ndarray, signal_window_size: int, label_look_ahead: int, stack_elm_events: bool = False, transform=None, ): self.signals = signals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_data(nb_samples):\n inputs = torch.empty(nb_samples, 2).uniform_(0, 1)\n center = Tensor([0.5, 0.5]).view(1, -1)\n distances = torch.norm((inputs - center).abs(), 2, 1)\n labels = (distances < 1 / math.sqrt(2 * math.pi)).type(LongTensor)\n return inputs.t(), labels", "def sample(self,...
[ "0.5600111", "0.54804593", "0.5479767", "0.5365365", "0.530453", "0.5254754", "0.52142054", "0.51725596", "0.5127227", "0.51050186", "0.50939244", "0.50804824", "0.5077783", "0.5063263", "0.50388134", "0.5032259", "0.50208396", "0.5009674", "0.5003568", "0.49945354", "0.49891...
0.57378817
0
Extract the sub graph defined by the output nodes and convert all its variables into constant
def freeze_graph(model_dir, output_node_names): if not tf.gfile.Exists(model_dir): raise AssertionError( "Export directory doesn't exists. Please specify an export " "directory: %s" % model_dir) if not output_node_names: print("You need to supply the name of a node to --...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output_nodes(self):\n \n\n self.buildings = self.dataset.groups['buildings']\n self.building_nodes = self.buildings.groups['nodes']\n\n eta_output_added = getattr(self.building_nodes,'eta_output_added')\n uv_output_added = getattr(self.building_nodes,'uv_output_added')\n\n ...
[ "0.6531531", "0.62398374", "0.6184663", "0.6158006", "0.6112566", "0.602329", "0.5927106", "0.592106", "0.5906961", "0.58681947", "0.58655256", "0.5793338", "0.5752446", "0.5735098", "0.5618127", "0.56000096", "0.55986136", "0.5587631", "0.55767405", "0.55487365", "0.55209166...
0.0
-1
Given a Stormpath resource, we'll extract the custom data in a JSON compatible format.
def get_custom_data(self, resource): try: custom_data = dict(resource.custom_data) except AttributeError: custom_data = dict(resource['custom_data']) custom_data['createdAt'] = custom_data['created_at'].isoformat() custom_data['modifiedAt'] = custom_data['modifie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meta_data(self):\r\n return simplejson.dumps(self.__resource_meta)", "def fetch_extra_data(resource):\n person_id = resource.get(\"cern_person_id\")\n return dict(person_id=person_id)", "def get_resource_data(self, resource):\n url = self.api_url + resource\n return self.get_url_...
[ "0.7061312", "0.6757691", "0.61228764", "0.6066298", "0.5922103", "0.5876381", "0.5807942", "0.5787658", "0.57215774", "0.571815", "0.5709122", "0.56961465", "0.56823915", "0.5677301", "0.5654893", "0.5653712", "0.5647304", "0.56388575", "0.55996674", "0.55707127", "0.5553939...
0.69236267
1
Given a Stormpath Resource, we'll extract the resource ID.
def get_id(self, resource): try: return resource.href.split('/')[-1] except AttributeError: return resource['href'].split('/')[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resourceDocumentId(self, resource: Resource) -> str:", "def resource_id(self) -> str:\n return pulumi.get(self, \"resource_id\")", "def resource_id(self) -> str:\n return pulumi.get(self, \"resource_id\")", "def resource_id(self) -> str:\n return pulumi.get(self, \"resource_id\")", ...
[ "0.77710336", "0.7645945", "0.7645945", "0.7645945", "0.76283467", "0.76112777", "0.75265026", "0.75265026", "0.75265026", "0.75265026", "0.75265026", "0.75265026", "0.75265026", "0.75265026", "0.75265026", "0.75265026", "0.7460142", "0.7449439", "0.7448532", "0.74260885", "0...
0.7842492
0
Return the proper location used to export our JSON data.
def set_location(self, location): if not location: location = getcwd() + '/stormpath-exports' return location
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _json_export(self, exppath):\n # TODO: Settle on JSON format for colortable\n pass", "def get_user_data_path():\n current_directory = os.path.dirname(os.path.realpath(__file__))\n return os.path.join(current_directory, 'emergency_fund_info.json')", "def to_json(self):\n return json.dumps...
[ "0.6630642", "0.6431156", "0.6369135", "0.6270783", "0.6194249", "0.6039364", "0.6018636", "0.601511", "0.6011705", "0.59982336", "0.5923969", "0.5918854", "0.5888626", "0.58819115", "0.58031833", "0.5786394", "0.5783489", "0.5776163", "0.57752323", "0.5763074", "0.5761586", ...
0.5497745
54
Write JSON data to the specified file. This is a simple wrapper around our file handling stuff.
def write(self, file, data): if not exists(dirname(file)): makedirs(dirname(file)) with open(file + '.json', 'w') as file: file.write(dumps(data, indent=2, separators=(',', ': '), sort_keys=True))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeJsonFile(filename, data):\n try:\n with open(filename, 'w') as jsonfile:\n json.dump(data, jsonfile, indent=0, sort_keys=True)\n except IOError:\n print(\"Error writing to json file %s\" % filename)", "def _write(self, filename, data):\n fullpath = os.path.join(self...
[ "0.7961672", "0.79502094", "0.7937308", "0.79276156", "0.7915652", "0.7915652", "0.7870587", "0.7840478", "0.78364086", "0.78331935", "0.7825509", "0.78103507", "0.7800449", "0.77245957", "0.7690022", "0.7645593", "0.7633606", "0.76325184", "0.76158357", "0.76046854", "0.7592...
0.79068244
6
Export all tenant data for this Stormpath account.
def export_tenants(self): print('\n=== Exporting all tenant data...') tenant = dict(self.client.tenant) print('- Exporting tenant:', tenant['name']) json = { 'id': self.get_id(tenant), 'href': tenant['href'], 'name': tenant['name'], 'key...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_accounts(self):\n print('=== Exporting all account data...')\n\n for account in self.client.tenant.accounts:\n print('- Exporting account:', account.email)\n\n json = {\n 'id': self.get_id(account),\n 'href': account.href,\n ...
[ "0.7993855", "0.64110136", "0.6349004", "0.6227858", "0.61415046", "0.5991233", "0.5866704", "0.5837029", "0.5750611", "0.56921303", "0.56606555", "0.56530935", "0.56111664", "0.5586277", "0.55795664", "0.5577892", "0.55623376", "0.5542531", "0.55090034", "0.5446627", "0.5430...
0.8416211
0
Export all application data for this Stormpath account.
def export_applications(self): print('\n=== Exporting all application data...') for application in self.client.applications: print('- Exporting application:', application.name) json = { 'id': self.get_id(application), 'href': application.href, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_data(self):\n return self.export_all_data()", "def export_accounts(self):\n print('=== Exporting all account data...')\n\n for account in self.client.tenant.accounts:\n print('- Exporting account:', account.email)\n\n json = {\n 'id': self.get_...
[ "0.66612107", "0.6570566", "0.62946093", "0.59756947", "0.59498", "0.59372663", "0.5811485", "0.5728861", "0.55750054", "0.55355513", "0.5454583", "0.5442122", "0.5434154", "0.54202384", "0.54049903", "0.5402838", "0.5373483", "0.53653264", "0.5299492", "0.52917093", "0.52849...
0.7371662
0
Export all directory data for this Stormpath account.
def export_directories(self): print('=== Exporting all directory data...') for directory in self.client.directories: print('- Exporting directory:', directory.name) json = { 'id': self.get_id(directory), 'href': directory.href, 'n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_accounts(self):\n print('=== Exporting all account data...')\n\n for account in self.client.tenant.accounts:\n print('- Exporting account:', account.email)\n\n json = {\n 'id': self.get_id(account),\n 'href': account.href,\n ...
[ "0.6736293", "0.63576007", "0.62175053", "0.60875624", "0.58454275", "0.5837468", "0.57908094", "0.570937", "0.5686852", "0.56343424", "0.55987227", "0.55606085", "0.55584383", "0.5548896", "0.5548611", "0.55001694", "0.5499001", "0.547543", "0.54266113", "0.5383986", "0.5332...
0.73455876
0
Export all organization data for this Stormpath account.
def export_organizations(self): print('\n=== Exporting all organization data...') for organization in self.client.organizations: print('- Exporting organizations:', organization.name) json = { 'id': self.get_id(organization), 'href': organization...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_accounts(self):\n print('=== Exporting all account data...')\n\n for account in self.client.tenant.accounts:\n print('- Exporting account:', account.email)\n\n json = {\n 'id': self.get_id(account),\n 'href': account.href,\n ...
[ "0.7005029", "0.6404232", "0.6374312", "0.6110875", "0.59876496", "0.5962026", "0.5902772", "0.5896829", "0.5857048", "0.5806698", "0.5772332", "0.5749651", "0.5704955", "0.56713694", "0.5623573", "0.56124943", "0.56087846", "0.55982965", "0.5550646", "0.553527", "0.5504203",...
0.80846584
0
Export all group data for this Stormpath account.
def export_groups(self): print('=== Exporting all group data...') for group in self.client.tenant.groups: print('- Exporting group:', group.name) json = { 'id': self.get_id(group), 'href': group.href, 'name': group.name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_accounts(self):\n print('=== Exporting all account data...')\n\n for account in self.client.tenant.accounts:\n print('- Exporting account:', account.email)\n\n json = {\n 'id': self.get_id(account),\n 'href': account.href,\n ...
[ "0.6567801", "0.64058274", "0.6267897", "0.61082447", "0.60897505", "0.6071893", "0.59926325", "0.5926644", "0.58263636", "0.58187973", "0.5750844", "0.5742057", "0.57241446", "0.5646611", "0.56150687", "0.56112945", "0.55956185", "0.55901736", "0.556596", "0.55508196", "0.55...
0.81396973
0
Export all account data for this Stormpath account.
def export_accounts(self): print('=== Exporting all account data...') for account in self.client.tenant.accounts: print('- Exporting account:', account.email) json = { 'id': self.get_id(account), 'href': account.href, 'username': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_data(self):\n return self.export_all_data()", "def fetch_accounts(self):\n return self.fetch('/accounts')", "def accounts():", "def get_all_accounts_information(self):\n\t\treturn self._send_command_to_entity_server(us.SERVER_COMMAND_ENTITY_OWNER_SUDO_OPERATION, us.SERVER_COMMAND_GET...
[ "0.66904116", "0.66201806", "0.65058035", "0.6460658", "0.6426826", "0.63867044", "0.63663775", "0.62696487", "0.62393665", "0.62054133", "0.6188278", "0.6173564", "0.61213315", "0.6097949", "0.6078857", "0.6077221", "0.6065543", "0.6044305", "0.60366124", "0.6018987", "0.599...
0.7974274
0
Export all Stormpath data to the disk, in JSON format. Takes an optional argument (the directory to export all data to).
def export(self, location=None): self.location = self.set_location(location) # Export all Stormpath data. for export_type in self.EXPORTS: getattr(self, 'export_' + export_type)()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_json(path):\n export_db(path)", "def export_directories(self):\n print('=== Exporting all directory data...')\n\n for directory in self.client.directories:\n print('- Exporting directory:', directory.name)\n\n json = {\n 'id': self.get_id(directory...
[ "0.7012706", "0.6749845", "0.6472012", "0.6261694", "0.62503386", "0.62416023", "0.61960953", "0.6180815", "0.60918665", "0.60655445", "0.60653245", "0.604609", "0.60378456", "0.5993692", "0.598355", "0.5974582", "0.5935927", "0.5927514", "0.5896361", "0.5855954", "0.58550733...
0.54349476
94
Handle user input, and do stuff accordingly.
def main(): arguments = docopt(__doc__, version=VERSION) # Handle the configure as a special case -- this way we won't get invalid # API credential messages when we're trying to configure stormpath-export. if arguments['configure']: configure() return exporter = StormpathExport(arg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_inputs(self):\n user_input = \"\"\n while user_input != \"exit\":\n self.print_divider()\n user_input = input()\n self.do_action_for_input(user_input)", "def handle_input(self):\n\n\t\tline = sys.stdin.readline().strip()\n\n\t\tif line == '':\n\t\t\t# pri...
[ "0.8089529", "0.71945643", "0.7152043", "0.7119826", "0.7109778", "0.6931501", "0.6881671", "0.67774254", "0.6774166", "0.67358834", "0.66917354", "0.6563089", "0.6528063", "0.64771414", "0.64646894", "0.64289", "0.6418052", "0.64100003", "0.636745", "0.6304811", "0.62985945"...
0.0
-1
Log error, then raise if is is set.
def log_error(self, error: Exception) -> None: logging.error(error)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _log_error(self, err_msg):\n if self._on_error_action == \"raise\":\n raise InvalidDatasetError(err_msg)\n else:\n logger.warning(err_msg)", "def error(self, tag, message, exc_info=False):\n \n self.log(logging.error,tag, message, exc_info)", "def error ( ...
[ "0.7021225", "0.6831562", "0.6772998", "0.67632544", "0.6753129", "0.67513996", "0.6689103", "0.66439587", "0.6643325", "0.66173506", "0.6590305", "0.65843606", "0.6580504", "0.6578764", "0.6578764", "0.6573797", "0.6555744", "0.6552961", "0.654769", "0.65416425", "0.6523136"...
0.68669385
1
Raise if it is needed.
def conditionally_raise(self, error: ImageNotFound) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\r\n raise self", "def __call__(self):\r\n raise self", "def throw(self):\n pass", "def _check_exc(self):\n if self._exc is not None:\n raise self._exc", "def propagate(self):\n self._raise_not_supported()", "def raise_(err):\n r...
[ "0.7244947", "0.7244947", "0.71142393", "0.704427", "0.69281447", "0.6811908", "0.6639901", "0.65708345", "0.65682596", "0.634518", "0.6304556", "0.6237187", "0.61081886", "0.6076695", "0.6067924", "0.606104", "0.6056899", "0.60353726", "0.6020898", "0.6013375", "0.5962033", ...
0.599512
20
Get replacement file when original missing.
def get_replacement_file(self, path) -> Optional[bytes]: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getOriginalFile(url):\n # does url exist?\n if url is None or url is \"\":\n return", "def get_pristine(self):\n for path in self.get_all_files():\n if path.endswith('.orig.tar.gz'):\n return path\n return None", "def get_original_path(self) -> Optional[...
[ "0.64597625", "0.6178859", "0.61031616", "0.5966035", "0.5832142", "0.582151", "0.58184856", "0.5694266", "0.56546396", "0.5616646", "0.55166143", "0.5515076", "0.5506135", "0.5455651", "0.5425946", "0.5390687", "0.5366639", "0.53574777", "0.53303367", "0.53286433", "0.532718...
0.7418505
0
Set value to the cache.
def cache_set(self, key: str, value: bytes) -> None: if self.cache is not None: self.cache.set(key, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cache(self, val):\n pass", "def set_cache(self, key, value):\n self.r.set(key, value)\n self.r.expire(key, time=1500)", "def set(key, value):\n return Cache.cache_connector.set(key, value)", "def set(self, key, value):\n # Initialize key variables\n result = ...
[ "0.87990963", "0.8499686", "0.84710413", "0.83927995", "0.79952127", "0.79158014", "0.7793222", "0.77615124", "0.7744642", "0.76519793", "0.7640359", "0.7526895", "0.74960685", "0.7474116", "0.7405842", "0.7276603", "0.724271", "0.722965", "0.71943367", "0.71354383", "0.70880...
0.8448183
3
Get value from the cache.
def cache_get(self, key: str) -> Optional[bytes]: if self.cache is not None: return self.cache.get(key) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, key):\n return self.cache_data.get(key)", "def get_cache(self, key):\n return self.r.get(key)", "def get(key):\n return Cache.cache_connector.get(key)", "def get(self, key):\n if key in self.cache:\n value = self.cache[key].value\n # Re-enqueue ...
[ "0.83625716", "0.83094805", "0.830325", "0.82590353", "0.82101774", "0.8169877", "0.81134486", "0.81134486", "0.8110776", "0.80983776", "0.7883199", "0.7830114", "0.759128", "0.7495643", "0.7471642", "0.745905", "0.74223953", "0.7412616", "0.7366012", "0.73415864", "0.731887"...
0.7725818
12
Load file from url.
def load_file_from_url(self, url: str) -> bytes: cached_content = self.cache_get(url) if cached_content is not None: return cached_content try: req = requests.get(url, timeout=self.requests_timeout) req.raise_for_status() content = req.content ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self, url):\n pass", "def load(self, url):\n pass", "def load_url(url):\n\n req = urllib2.Request(url = url)\n f = urllib2.urlopen(req)\n return f.read()", "def load_url(src):\n return LOAD(url=src)", "def load_from_remote(self, url: Optional[str] = None) -> None:\n ...
[ "0.7793382", "0.7793382", "0.7392714", "0.73364216", "0.70095974", "0.68694866", "0.66386175", "0.66035604", "0.65725374", "0.65094954", "0.6486452", "0.64789176", "0.6461602", "0.64108413", "0.6380366", "0.6376564", "0.63653404", "0.626396", "0.6243737", "0.62009317", "0.618...
0.6959541
5
Load file from file.
def load_file_from_folders(self, path: str) -> bytes: for root in self.folders_root: fullpath = os.path.join(root, path) if os.path.isfile(fullpath): with open(fullpath, "rb") as handle: return handle.read() content = self.get_replacement_file(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self, file):\n self._load(file.encode())", "def loadFromFile(self, path):\n\n if \"~\" in path:\n path = os.path.expanduser(path)\n f = open(path)\n body = f.read()\n f.close()\n self._path = path\n self.loadFromString(body)", "def load(self)...
[ "0.7760983", "0.76494026", "0.7544831", "0.74958193", "0.7403288", "0.73513305", "0.733502", "0.726575", "0.72226715", "0.71902466", "0.71881104", "0.7176479", "0.7176479", "0.71405506", "0.71275806", "0.71138734", "0.7101522", "0.7078612", "0.70739806", "0.70727354", "0.7064...
0.0
-1
Load image from source.
def load_file(self, src: str) -> bytes: if re.match("https?://", src): content = self.load_file_from_url(src) else: content = self.load_file_from_folders(src) return content
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_image(path_to_image, image_name):\n print(\"Loading: \", path_to_image + image_name, \" ...\")\n return Image.open(path_to_image + image_name)", "def load_image(self):\n try:\n return Image.open(self._path, 'r')\n except IOError:\n messagebox.showerror(\"Error\"...
[ "0.7326599", "0.72935545", "0.72269684", "0.7189972", "0.7102464", "0.70199", "0.68191826", "0.6717447", "0.6621866", "0.661698", "0.65815234", "0.6576263", "0.65469617", "0.6535037", "0.65093017", "0.6501832", "0.64767975", "0.64154387", "0.64041495", "0.63925433", "0.636608...
0.0
-1
Initialize counter of images.
def init_cid(self) -> None: self.position = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initImages(self):\n pass", "def initImages(self):\n pass", "def initImages(self):\n pass", "def _init(self):\n # A string of the last image taken\n self.last_image = None\n\n # Number of images captured\n self.image_count = 0\n\n # Duration tracking...
[ "0.7243952", "0.7243952", "0.7243952", "0.70288455", "0.6919657", "0.66796446", "0.66505873", "0.65938205", "0.65783334", "0.6475849", "0.64568156", "0.6399936", "0.6349805", "0.63394505", "0.6332038", "0.6299767", "0.6296637", "0.62840945", "0.6224736", "0.6177287", "0.61760...
0.0
-1
Get next CID for related content.
def get_next_cid(self) -> str: self.position += 1 return "img{}".format(self.position)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_id(self):\n self.id_counter += 1\n return self.id_counter - 1", "def next_collapsed_id(self):\n to_return = self.collapsed_id_counter\n self.collapsed_id_counter += 1\n return to_return", "def get_next_id(self):\n con = self.c._connect()\n last_id = sel...
[ "0.61992425", "0.61363083", "0.6128795", "0.5966513", "0.59172714", "0.5896527", "0.58824", "0.58359903", "0.58097434", "0.5796506", "0.5771497", "0.5724505", "0.5684626", "0.56635547", "0.56191045", "0.55953336", "0.5580772", "0.55750984", "0.5575075", "0.55578667", "0.55578...
0.7154687
0
Collect images from html code. Return html with iamge src=cid and list of tuple with (maintype, subtype, cid, imagebytes).
def collect_images(self, html_body: str, encoding: str = "UTF-8") -> Tuple[str, List[Tuple[str, str, str, bytes]]]: images = [] reader = etree.HTMLParser(recover=True, encoding=encoding) root = etree.fromstring(html_body, reader) self.init_cid() same_content = {} # type: Dict[by...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embed_images(self):\n for img in self.book.xpath(\"//img[ not(starts-with(@src, 'data:')) and @src!= '']\"):\n img_src = img.attrib[\"src\"]\n img_raw = self.get_remote_content(img_src)\n if img_raw != None:\n img_64 = base64.b64encode(img_raw)\n ...
[ "0.6578264", "0.6405035", "0.636044", "0.6353167", "0.625685", "0.61547244", "0.61008567", "0.60811025", "0.6048114", "0.5902244", "0.5867286", "0.5780136", "0.5753646", "0.57383347", "0.57188696", "0.56709164", "0.5641198", "0.5579539", "0.55609024", "0.55588067", "0.5557961...
0.76466244
0
Collect attachment contents from paths or urls.
def collect_attachments(self, paths_or_urls: Iterable[str]) -> List[Tuple[str, str, str, bytes]]: attachments = [] same_content = [] # type: List[bytes] for src in paths_or_urls: try: content = self.load_file(src) except ImageNotFound as err: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_attachments(request):\n attachments = []\n for attachment in request.files.getlist('attachment'):\n attachments.append(Attachment(attachment.filename, attachment))\n return attachments", "def attachments(self):\n for part in self.email.walk():\n filename = part.get_fil...
[ "0.6221126", "0.6146354", "0.60774887", "0.5915002", "0.5801748", "0.5782203", "0.57530725", "0.57097447", "0.56753266", "0.5673091", "0.56211513", "0.5555098", "0.5532392", "0.5503337", "0.54877687", "0.5478201", "0.5437538", "0.5432417", "0.5394351", "0.53382355", "0.533160...
0.7265279
0
Get C statistics numpy record list, or return None if the file does not exist.
def load_csv_cached(filename='../apps/naive_c_stats.csv', cache={}): if filename in cache: return cache[filename] if not os.path.exists(filename): ans = None else: ans = numpy.recfromcsv(filename) cache[filename] = ans return ans
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MainStats(path, filetype, NrExp, col, start, stop):\n# path= path.split('/') # here is better to google and see what is going on. Or experiment alone\n# path= \"/\".join(path[:-1]) \n dato=ExtractData_raw_files(path, filetype)\n dBase=dato.createDictBase()\n stats = Stats(dBase, NrExp, col, ...
[ "0.55165815", "0.54774755", "0.54651594", "0.53451926", "0.5323847", "0.524924", "0.51764786", "0.514426", "0.51365834", "0.5109591", "0.5106836", "0.50748354", "0.50632674", "0.50623465", "0.5045517", "0.5033683", "0.5028954", "0.5026244", "0.502574", "0.5021514", "0.5018565...
0.5491351
1
Get the lines of main program logic, excluding various less important information such as imports/comments/tests, and globals (typically used for tests).
def lines(filename, exclude_imports=True, exclude_comments=True, exclude_tests=True, exclude_globals=True, exclude_blank=True, verbose=False, is_c=False, s=None): if s is None: s = open(filename, 'rt').read() L = s.split('\n') # Hack to strip out triple and single quote string lines in a heuri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lines_without_stdlib(self):\n prev_line = None\n current_module_path = inspect.getabsfile(inspect.currentframe())\n for module_path, lineno, runtime in self.lines:\n module_abspath = os.path.abspath(module_path)\n if not prev_line:\n prev_line = [module...
[ "0.67089903", "0.58544457", "0.5778849", "0.5775647", "0.57722783", "0.56521636", "0.563037", "0.5536816", "0.551413", "0.5475512", "0.54629", "0.54422885", "0.54418725", "0.5426173", "0.5407686", "0.53450173", "0.53443503", "0.5323852", "0.5322268", "0.5320133", "0.5281814",...
0.6400236
1
Constructor for a Method class to define a single approach for distance measurements.
def __init__(self, name, hyperparameters, group, number, function=None, kwargs=None, metric=None, tag=""): #self.name = name.lower() #self.hyperparameters = hyperparameters.lower() #self.name_with_hyperparameters = "{}:{}".format(name,hyperparameters).lower() self.name = re.sub('[^0-9a-zA-Z]+', '_', name.lower...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args: Any, **kwargs: Any) -> None:\n super(DistanceMetric, self).__init__(initial_value=0.0)\n self._past_location = None", "def __init__(self, normal, distance):\r\n self.normal = normal\r\n self.distance = distance", "def __init__(\n\t\tself, start: Vector, vector: Vec...
[ "0.68324125", "0.676998", "0.67197305", "0.61268675", "0.6123217", "0.61066914", "0.6080851", "0.606487", "0.6023677", "0.60075945", "0.59843886", "0.5950709", "0.59353566", "0.5933893", "0.59211123", "0.5873872", "0.5868845", "0.5864347", "0.5862679", "0.58131856", "0.580924...
0.0
-1
Each pulse sent here steps the motor by whatever number of steps or microsteps that has been set by MS1, MS2 and MS3 settings.
def step(self, clockwise=True, delay=200): self.on() if clockwise: self.dir_pin.value(0) else: self.dir_pin.value(1) for _ in range(self.STEPS_PER_REV): self.step_pin.value(1) utime.sleep_us(delay) self.step_pin.value(0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_motor(self,pin_num):\n pi.set_servo_pulsewidth(pin_num, 2000)\n sleep(2)\n pi.set_servo_pulsewidth(pin_num, 500 )\n sleep(2)", "def at_pwm(seq, m1, m2, m3, m4):\n # FIXME: what type do mx have?\n raise NotImplementedError()", "def __init__(self, power, FWHM_ps, cente...
[ "0.6476055", "0.6442633", "0.63158023", "0.62284786", "0.62128353", "0.610558", "0.6078904", "0.59652066", "0.5910328", "0.5865627", "0.5840209", "0.58109164", "0.58094746", "0.5746087", "0.57320654", "0.57305753", "0.57171196", "0.5690624", "0.56543803", "0.5631995", "0.5616...
0.0
-1
A small docstring for getting grades.
def get_score_summary(fname): gradedata = {} fhandler = open(fname, 'r') rest_data = csv.reader(fhandler) for row in rest_data: if row[10] not in ['P', '', 'GRADE']: gradedata[row[0]] = [row[1], row[10]] gradedata.update(gradedata) fhandler.close() gradereview = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_grade(course_det):\n return course_det[1]", "def get_grade(self) -> int :\n return self.grade", "def student_grades(student, course):\n cg = CourseGradeFactory().create(student, course)\n return cg.summary", "def grades(self) -> List[int]:\n\n return grades_present(self, _eps)", ...
[ "0.68382996", "0.6736907", "0.66993415", "0.63576144", "0.6355177", "0.6315764", "0.6310989", "0.62943363", "0.6160899", "0.6155406", "0.61451447", "0.6137835", "0.61083204", "0.6070652", "0.60664713", "0.6053968", "0.6044173", "0.6024818", "0.60204947", "0.5944113", "0.59338...
0.5141811
80
A small docstring for getting counts for markets per boro.
def get_market_density(fname): fhandler = open(fname, 'r') jdata = json.load(fhandler) datasum = jdata['data'] datareturn = {} fhandler.close() for data in datasum: data[8] = data[8].strip() if data[8] not in datareturn.iterkeys(): count1 = 1 else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_markets(add):\r\n name=get_zipcode_names(add)\r\n engine = get_sql_engine()\r\n number_markets = text(\r\n \"\"\"\r\n SELECT COUNT(\"NAME\") AS num_markets\r\n FROM farmers_markets\r\n WHERE \"ZIP\" = :name\r\n \"\"\"\r\n )\r\n resp = engine.execute(num...
[ "0.6272966", "0.6123051", "0.6123051", "0.6123051", "0.6123051", "0.5973908", "0.58511776", "0.57283175", "0.5712326", "0.570615", "0.5682525", "0.565857", "0.56518793", "0.563723", "0.5629075", "0.56198895", "0.56116724", "0.5609089", "0.560611", "0.55977", "0.55818033", "...
0.0
-1
A small docstring to combine and correlate the data.
def correlate_data(fname1='inspection_results.csv', fname2='green_markets.json', fname3='dataresults.csv'): correlate1 = get_score_summary(fname1) correlate2 = get_market_density(fname2) datareturn = {} for key2 in correlate2.iterkeys(): for key1 in correlat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_correlation(data):\n pass", "def concatenate_data():", "def main():\n tests = [\n ([1,2,1,2,1,2,1,2], [1,-0.875,0.75,-0.625,0.5,-0.375,0.25,-0.125]),\n ([1,-1,1,-1], [1, -0.75, 0.5, -0.25]),\n ]\n\n for x, answer in tests:\n x = np.array(x)\n answer = n...
[ "0.6273406", "0.6005179", "0.5521216", "0.54399335", "0.5421584", "0.53831375", "0.53786576", "0.5358167", "0.5335663", "0.52532417", "0.5243458", "0.5235976", "0.52320844", "0.5231237", "0.5208015", "0.51907843", "0.51890796", "0.518527", "0.51407844", "0.5135973", "0.508837...
0.51201993
20
Compute the gradient of the loglikelihood function for part f.
def compute_grad_likelihood(sensor_loc, obj_loc, distance): grad = np.zeros(sensor_loc.shape) # Your code: finish the grad loglike return grad
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_likelihood_gradients(self, y, f):\n # align shapes and compute mask\n y = y.reshape(-1, 1)\n f = f.reshape(-1, 1)\n mask = np.isnan(y)\n y = np.where(mask, f, y)\n\n # compute gradients of the log likelihood\n log_lik, J, H = vmap(self.log_likelihood_gradien...
[ "0.7547901", "0.7498062", "0.7014036", "0.68455", "0.67977226", "0.6769472", "0.672758", "0.672534", "0.6693901", "0.66858673", "0.6678785", "0.6664874", "0.6662964", "0.6538633", "0.6531279", "0.65267783", "0.64186287", "0.6395677", "0.63719517", "0.6368377", "0.63618845", ...
0.6305764
24
Compute the gradient of the loglikelihood function for part f.
def find_mle_by_grad_descent(initial_sensor_loc, obj_loc, distance, lr=0.001, num_iters = 1000): sensor_loc = initial_sensor_loc # Your code: finish the gradient descent return sensor_loc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_likelihood_gradients(self, y, f):\n # align shapes and compute mask\n y = y.reshape(-1, 1)\n f = f.reshape(-1, 1)\n mask = np.isnan(y)\n y = np.where(mask, f, y)\n\n # compute gradients of the log likelihood\n log_lik, J, H = vmap(self.log_likelihood_gradien...
[ "0.754637", "0.7496449", "0.7017116", "0.6847091", "0.6798989", "0.67696995", "0.6727729", "0.67254645", "0.66947544", "0.66855836", "0.66796124", "0.66667724", "0.66643614", "0.65410495", "0.6532857", "0.6529797", "0.64204985", "0.6399001", "0.6374029", "0.6369888", "0.63640...
0.0
-1
stimate distance given estimated sensor locations.
def compute_distance_with_sensor_and_obj_loc(sensor_loc, obj_loc): estimated_distance = scipy.spatial.distance.cdist(obj_loc, sensor_loc, metric='euclidean') return estimated_distance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure_distance(self):\n # set Trigger to HIGH\n GPIO.output(self.GPIO_TRIGGER, True)\n\n # set Trigger after 0.01ms to LOW\n time.sleep(0.00001)\n GPIO.output(self.GPIO_TRIGGER, False)\n\n start_time = time.time()\n stop_time = time.time()\n\n # save St...
[ "0.62089807", "0.597473", "0.59654075", "0.5948641", "0.589891", "0.58918214", "0.58761024", "0.5871087", "0.5824022", "0.5823167", "0.5822607", "0.5809026", "0.57345897", "0.57335913", "0.5690579", "0.56877965", "0.5680121", "0.56717455", "0.56000197", "0.5594889", "0.558374...
0.6066834
1
Load the config file.
def load_config(pattern, verbose=True): # load config files config = configparser.ConfigParser( inline_comment_prefixes = (';','#'), interpolation = configparser.ExtendedInterpolation(), ) # find local config file for fname in os.listdir(os.curdir): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(self):\r\n with open('config.json', 'r') as f:\r\n self.config = json.load(f)", "def load_config(self):\n pass", "def load(file):\n _config.load(file)", "def load_config(self):\n if os.path.exists(self.config_file):\n with open(self.config_file) a...
[ "0.83968216", "0.8278706", "0.8202513", "0.819913", "0.8113424", "0.8033347", "0.79480237", "0.7898393", "0.77904564", "0.77830076", "0.7733813", "0.7690193", "0.7690193", "0.7634193", "0.7623375", "0.761552", "0.7614357", "0.7612691", "0.75964284", "0.7591621", "0.7580963", ...
0.0
-1
Find and read the observing log file.
def load_obslog(pattern, fmt='obslog', verbose=True): # find observing log in the current workin gdirectory logname_lst = [fname for fname in os.listdir(os.curdir) if re.match(pattern, fname)] if len(logname_lst)==0: print('No observation log found') return None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_linelog():", "def _read_log(self):\n\n line_regex = compile(r\"\\[I\\]\\s*\\(\\d+ms\\)[^\\d]+(?P<counter>\\d+)\"\n r\"[^\\d]+(?P<timestamp>\\d+(\\.\\d+)?)[^\\d]+\"\n r\"(?P<acceleration>\\d+);\")\n values = []\n with open(self....
[ "0.60699195", "0.5945723", "0.5875873", "0.5854158", "0.57434773", "0.57226753", "0.57217354", "0.57209086", "0.5714799", "0.5700735", "0.56245184", "0.5595432", "0.55869824", "0.557967", "0.5578444", "0.5529408", "0.5524706", "0.55045867", "0.54335624", "0.5433416", "0.53890...
0.64161575
0
Displays statistics on the most frequent times of travel.
def time_stats(df): print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() # TO DO: display the most common month popular_month = df['month'].mode()[0] print("Most Frequent month:",popular_month) # TO DO: display the most common day of week popu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80247396", "0.80233026", "0.7915788", "0.78266186", "0.7822246", "0.78143597", "0.77659196", "0.7740343", "0.77344066", "0.76867086", "0.7668633", "0.7651731", "0.7644636", "0.76399267", "0.76367253", "0.7625196", "0.7623158", "0.7612803", "0.76002145", "0.7583438", "0.757...
0.773628
8
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # TO DO: display most commonly used start station most_com_sta= df['Start Station'].mode()[0] print('Most common Start Station:', most_com_sta) # TO DO: display most commo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.7815675", "0.7662213", "0.7553417", "0.74914914", "0.74748665", "0.7446617", "0.7428588", "0.74237514", "0.74177027", "0.7400495", "0.7387161", "0.7385634", "0.73647535", "0.735934", "0.73566747", "0.73548365", "0.7351854", "0.7351274", "0.735057", "0.73421645", "0.7340198...
0.7163289
51
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # TO DO: display total travel time print(df.groupby(['month'])['Trip Duration'].sum()) print(df.groupby(['day_of_week'])['Trip Duration'].sum()) # TO DO: display mean travel time print(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.8143032", "0.8024939", "0.8004003", "0.7949475", "0.79372776", "0.79307956", "0.7926507", "0.79149866", "0.7914229", "0.79077655", "0.79054105", "0.7900338", "0.78913456", "0.78892654", "0.78863764", "0.7884846", "0.78839767", "0.7882144", "0.7873669", "0.7868308", "0.7866...
0.7553662
96
Displays statistics on bikeshare users.
def user_stats(df): print('\nCalculating User Stats...\n') start_time = time.time() # TO DO: Display counts of user types user_types =df['User Type'].value_counts() print(user_types) # TO DO: Display counts of gender Gender =df['Gender'].value_counts() print(Gender) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_stats(request):\r\n user_count = UserMgr.count()\r\n pending_activations = ActivationMgr.count()\r\n users_with_bookmarks = BmarkMgr.count(distinct_users=True)\r\n return _api_response(request, {\r\n 'count': user_count,\r\n 'activations': pending_activations,\r\n 'with_bo...
[ "0.73562527", "0.7330705", "0.7287992", "0.725103", "0.72384006", "0.71689993", "0.7129556", "0.7077414", "0.70719624", "0.70607764", "0.7057475", "0.7049566", "0.70459133", "0.7036633", "0.7024461", "0.70230764", "0.7022977", "0.7014054", "0.70087725", "0.69945276", "0.69888...
0.71736777
5
Create .gif from given images.
def make_gif(im_dir, out_file, pattern='*.png', fps=10): im_files = glob.glob(os.path.join(im_dir, pattern)) if len(im_files) == 0: raise ValueError(f'No images found in {im_dir}!') writer = imageio.get_writer(out_file, mode='I', fps=fps) for im_file in im_files: im = imageio.imread(im_file) writ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_gif(image_list, gif_name):\n if not gif_name.endswith(\".gif\"):\n gif_name += \".gif\"\n imageio.mimsave(gif_name, [imageio.imread(x) for x in image_list])", "def create_gif():\n anim_file = 'sample/training.gif'\n\n with imageio.get_writer(anim_file, mode='I') as writer:\n filenames ...
[ "0.769655", "0.7416528", "0.72496986", "0.710578", "0.7064454", "0.7029012", "0.68660015", "0.67962193", "0.6757921", "0.66741127", "0.6640495", "0.6591746", "0.6547858", "0.6495395", "0.64641535", "0.64420575", "0.64105964", "0.63935524", "0.63378096", "0.63261235", "0.62539...
0.6453785
15
Save frames to a single row or as a gif.
def save_frames(frames, out_dir, as_row=True, as_gif=False): os.makedirs(out_dir, exist_ok=True) if frames.dtype == torch.uint8: # save_image needs float value in [0, 1] frames = frames.float() frames = frames / 255. if as_gif: gif_dir = 'gif_images' os.makedirs(os.path.join(out_dir, gif_dir), ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_gif(frames):\n print(\"Saving gif images!\")\n for i in range(len(frames)):\n im_out_path = \"gif/gif_emilie_will_\" + str(i) + \".png\"\n plt.imsave(im_out_path, frames[i])", "def saveFrames(filepath, frames):\n\n for i, frame in enumerate(frames):\n image = Image.fromarra...
[ "0.73017335", "0.72355133", "0.6915706", "0.68751323", "0.6866969", "0.6702963", "0.64925975", "0.6485176", "0.6412501", "0.6385749", "0.6311999", "0.6305541", "0.6288399", "0.6262558", "0.6237853", "0.62274206", "0.61932164", "0.6116848", "0.60730493", "0.5990745", "0.598803...
0.7977077
0
Render the homepage template on the / route
def homepage(): pagesClassIDs = { "index": { "bannertitle": [], "subtitle": [], "firstText": [], "secondText": [] } } for key in pagesClassIDs["index"].keys(): pagesClassIDs["index"][key].append( str( pageTe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def homepage():\n return render_template(\"home/index.html\")", "def home():\n return render_template('homepage.html')", "def homepage():\n return render_template('homepage.html')", "def homepage():\n return render_template(\"home/index.html\", title=\"Welcome\")", "def render_home():\r\n\treturn...
[ "0.8597299", "0.8569112", "0.85272837", "0.8474665", "0.8474087", "0.8451808", "0.8424757", "0.8424757", "0.84213376", "0.8389955", "0.83125323", "0.8266481", "0.8266481", "0.8266481", "0.8266481", "0.8266481", "0.8266481", "0.82651", "0.8260553", "0.8250731", "0.8250731", ...
0.0
-1
Render the fase1 template on the /fase1 route
def fase1(): pagesClassIDs = { "fase1": { "bannertitle": [], "subtitle": [], "firstText": [], "secondText": [] } } for key in pagesClassIDs["fase1"].keys(): pagesClassIDs["fase1"][key].append( str( pageTexts...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def landing():\n return render_template(\"landing.html\")", "def landing_page():\n\n return render_template('index.html')", "def graphing1():\n return render_template('graph1.html')", "def prototype_page1():\n return render_template('Prototype1.html')", "def index():\n return render_template...
[ "0.638614", "0.6373444", "0.63079125", "0.6282907", "0.62595075", "0.6239214", "0.61953425", "0.61786556", "0.6143801", "0.60757196", "0.60483044", "0.6037403", "0.60196054", "0.5998281", "0.5984551", "0.59771687", "0.5976989", "0.59730905", "0.5965922", "0.5963188", "0.59589...
0.0
-1
Render the fase2 template on the /fase2 route
def fase2(): pagesClassIDs = { "fase2": { "bannertitle": [], "subtitle": [], "firstText": [], "secondText": [] } } for key in pagesClassIDs["fase2"].keys(): pagesClassIDs["fase2"][key].append( str( pageTexts....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version2():\n return render_template('version2.html')", "def display():\n\n #still needs some cleanup on imagry and what the site is about. \n\n return render_template(\"index.html\")", "def index():\n return render_template('home.jinja2')", "def graphing2():\n return render_template('grap...
[ "0.6506364", "0.6411184", "0.6305651", "0.62910795", "0.62681633", "0.61693186", "0.614081", "0.6059946", "0.60556245", "0.59836537", "0.5967862", "0.59223074", "0.59111863", "0.58944744", "0.5881215", "0.58739644", "0.58739644", "0.58628017", "0.5862619", "0.58464366", "0.58...
0.0
-1
Render the fase3 template on the / route
def fase3(): pagesClassIDs = { "fase3": { "bannertitle": [], "subtitle": [], "firstText": [], "secondText": [], "thirdText": [] } } for key in pagesClassIDs["fase3"].keys(): pagesClassIDs["fase3"][key].append( s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n return render_template('home.jinja2')", "def display():\n\n #still needs some cleanup on imagry and what the site is about. \n\n return render_template(\"index.html\")", "def landing_page():\n\n return render_template('index.html')", "def landing():\n return render_template(\"la...
[ "0.6992224", "0.6916828", "0.6885695", "0.68696064", "0.68494356", "0.6746363", "0.67157197", "0.6707549", "0.6707549", "0.6707416", "0.6693784", "0.66927797", "0.66871464", "0.66830254", "0.66830254", "0.66830254", "0.66830254", "0.6681699", "0.6676894", "0.6676894", "0.6676...
0.0
-1
Checks an image to make sure that it is sensible.
def validate_image(path): problems = False # Rasterio env is required to make sure that the gdal bindings are setup correctly. with rasterio.Env(): try: dataset = rasterio.open(path) except Exception as e: logging.error("Could not open dataset", e) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_image(image):\n msg = image_validation(image)\n if msg:\n raise ValidationError(msg)", "def check_image(image):\n\n if not path.isfile(image):\n raise ImageException('Error: Singularity image \"%s\" not found.' % image)\n return True", "def ff_correct_image(image):\n ...
[ "0.76078737", "0.7410912", "0.7344285", "0.7344285", "0.7247997", "0.72398746", "0.7144644", "0.7042983", "0.6955212", "0.6867803", "0.6867412", "0.6829934", "0.66258365", "0.66171414", "0.65947044", "0.6578245", "0.6563784", "0.6550707", "0.6465686", "0.64412266", "0.6426481...
0.69536835
9
divalent cation correction (Ahsen et al., 2001)
def C_Na_eq(): global C_Na, C_Mg, C_dNTP return C_Na + 120*sqrt(C_Mg - C_dNTP)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pbc_correction(self, r):\n return ( self.length * int(round(r[0]/self.length)), self.length * int(round(r[1]/self.length)), self.length * int(round(r[2]/self.length)) )", "def identify_divtrans(bed):\n pass", "def _calculate_correction(self, telid):", "def DivideCV(self):\n unicodeV...
[ "0.60098803", "0.5927142", "0.58881354", "0.5882708", "0.5872718", "0.5847055", "0.58458394", "0.5785713", "0.5771696", "0.5765197", "0.57306695", "0.5723363", "0.5686266", "0.5684703", "0.5674558", "0.5672817", "0.56568325", "0.5635444", "0.5585559", "0.5581887", "0.55817264...
0.0
-1
List all types supported by doc comments.
def supported_types(self, idl: Idl): for cluster in idl.clusters: yield cluster for command in cluster.commands: yield command
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doc_types(self):\n return self._extract_set('doc_type')", "def document_types(db: Session = Depends(get_db)):\n return get_document_types(db)", "def list_available_document_types(cls):\n\n response = cls._client.get(\"automatedDocumentOptions/\")\n return from_api(response.json())",...
[ "0.7557287", "0.6674936", "0.6634782", "0.6484766", "0.6473804", "0.63318497", "0.62815404", "0.59790814", "0.5946823", "0.59403014", "0.5923433", "0.5805419", "0.5766532", "0.5765785", "0.5755991", "0.56938773", "0.566705", "0.56290555", "0.5591547", "0.55759996", "0.5569823...
0.0
-1
Numbers in the grammar are integers or hex numbers.
def positive_integer(self, tokens): if len(tokens) != 1: raise Exception("Unexpected argument counts") n = tokens[0].value if n.startswith('0x'): return int(n[2:], 16) else: return int(n)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_numeric(numeric: str):\r\n if numeric[0] == '-':\r\n polarity = 1\r\n numeric = numeric.lstrip('-')\r\n numeric = numeric.lstrip('0')\r\n else:\r\n polarity = 0\r\n\r\n digits = []\r\n for character in numeric:\r\n try:\r\n digits.append(int(chara...
[ "0.6449524", "0.6431936", "0.62696415", "0.6252544", "0.61755836", "0.6164721", "0.60528713", "0.5970831", "0.59653306", "0.5932578", "0.59192854", "0.5868717", "0.5850324", "0.58296484", "0.57998127", "0.57811093", "0.5753101", "0.57502353", "0.57498366", "0.5728909", "0.571...
0.5460398
34
An id is a string containing an identifier
def id(self, tokens): if len(tokens) != 1: raise Exception("Unexpected argument counts") return tokens[0].value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getID():", "def id(self) -> str:\n pass", "def id(self, id: str):\n self._id = id", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", ...
[ "0.7323067", "0.7313052", "0.7220145", "0.7156434", "0.7156434", "0.7156434", "0.7156434", "0.7156434", "0.7156434", "0.7156434", "0.7156434", "0.7156434", "0.7156434", "0.7156434", "0.7156434", "0.7132985", "0.70587593", "0.69940984", "0.6950771", "0.69505686", "0.69490325",...
0.0
-1
A type is just a string for the type
def type(self, tokens): if len(tokens) != 1: raise Exception("Unexpected argument counts") return tokens[0].value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _type(self) -> str:\n ...", "def getTypeString(self):\n return '_'.join(self.types)", "def type(name):", "def typeString(self):\n return Parameter.string_dict[self._field.type]", "def type_name(self) -> str: # pragma: no cover\n return repr_type(self.type_obj)", "def type...
[ "0.83689374", "0.8099", "0.8058516", "0.7917908", "0.7815858", "0.77321285", "0.7708954", "0.7705447", "0.7705447", "0.76916414", "0.7685083", "0.76513165", "0.7607655", "0.76035225", "0.76035064", "0.75833535", "0.7582974", "0.75711", "0.7570669", "0.756874", "0.7518379", ...
0.0
-1
Processes comments starting with "/"
def c_comment(self, token: Token): if token.value.startswith("/**"): self.doc_comments.append(PrefixCppDocComment(token))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_comments(self):\n new_lines = list()\n for line in self.lines:\n if ((not line.startswith(\"//\")) & (not line.isspace()) &\n (not line.startswith(\"/*\") & (not line.startswith(\"*/\")))):\n line = Parser.strip_line(line)\n new_li...
[ "0.6902916", "0.6847837", "0.6776069", "0.67623574", "0.6670584", "0.66693544", "0.6593758", "0.65829724", "0.655288", "0.65514684", "0.6513684", "0.6499126", "0.6499126", "0.6419629", "0.6399462", "0.6370356", "0.6356026", "0.6320951", "0.6306026", "0.6278806", "0.6244805", ...
0.6216431
24
Generates a parser that will process a ".matter" file into a IDL
def CreateParser(skip_meta: bool = False): return ParserWithLines(skip_meta)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self, infile):\r\n raise NotImplementedError()", "def main():\n parse_file(sys.argv[1])", "def create_parser_file():\n lark_file = os.path.join(dirname(__file__), 'hcl2.lark')\n with open(lark_file, 'r') as lark_file, open(PARSER_FILE, 'w') as parser_file:\n lark_inst = Lark(lark_f...
[ "0.59334826", "0.58940643", "0.5857667", "0.57273275", "0.5687171", "0.558841", "0.55419457", "0.5463937", "0.5456663", "0.54238296", "0.5412136", "0.5397953", "0.5359215", "0.53442574", "0.53268564", "0.5313342", "0.527558", "0.52654064", "0.52644235", "0.5261466", "0.522004...
0.0
-1
mcxPyBot constructor initialises mcxDatabase connection and adds command handlers.
def __init__(self, channel, nickname, password, server, port = 6667, dbcon = False): # IRC connection SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) # register event handler for all events self.ircobj.add_global_handler('all_events', getattr(self, 'on_event'), -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, user, password, database='mesomat', host='localhost'): \n \n \n self.config = {\n 'user' : user,\n 'password' : password,\n 'host' : host,\n 'database' : database,\n 'raise_on_warnings' : True,\n 'auth_...
[ "0.61448985", "0.5992468", "0.59882843", "0.5959786", "0.5893138", "0.5862879", "0.58266366", "0.57569146", "0.575443", "0.57380295", "0.5736009", "0.56736994", "0.5635677", "0.56265783", "0.5626573", "0.5624763", "0.5621554", "0.5619871", "0.56172127", "0.5610549", "0.560741...
0.69860715
0
initialize some quit message and save them into a list by filling self.__quitmsgs
def __initQuitMsgPool(self): self.__quitmsgs.append("Infektion festgestellt... leite Quarantaenemassnahmen ein... trenne aktive Verbindung")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_quit(self, raw_msg, source, **kwargs):", "def __init__(self):\n\n\t\tself.count = 0\n\t\tself.messages = []", "def __init__(self, msg):\n super(QuitMessageException, self).__init__(msg)", "def getRandomQuitMsg(self):\n return self.__quitmsgs[randint(0, len(self.__quitmsgs)-1)]", "def _...
[ "0.5805985", "0.569918", "0.5597306", "0.55945224", "0.5488201", "0.5455527", "0.5361667", "0.5361548", "0.5293691", "0.52259815", "0.5221136", "0.52198446", "0.52198446", "0.52172184", "0.5200485", "0.51755583", "0.5162636", "0.51529586", "0.5147324", "0.5142985", "0.5137079...
0.79404175
0
get any random quit message that was initialized by __initQuitMsgPool()
def getRandomQuitMsg(self): return self.__quitmsgs[randint(0, len(self.__quitmsgs)-1)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __initQuitMsgPool(self):\n self.__quitmsgs.append(\"Infektion festgestellt... leite Quarantaenemassnahmen ein... trenne aktive Verbindung\")", "def get_msg_quit(self, username):\n return self.user_table[username]['msg_quit']", "def get_msg_quit(self, username):\n return \"Bye bye\"", ...
[ "0.7058567", "0.637686", "0.6002327", "0.5931621", "0.58883643", "0.5877688", "0.5856501", "0.5820552", "0.579374", "0.5449078", "0.54188406", "0.538813", "0.5298811", "0.5292298", "0.5277682", "0.52572966", "0.51838183", "0.51838183", "0.51838183", "0.51563007", "0.51104975"...
0.82633847
0
get the version string of this class
def get_version(self): return "mcxPyBot.py by Toni Uebernickel <tuebernickel@whitestarprogramming.de> using ircbot based on python-irclib"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version(self) -> str:\n return versioning.get_version()", "def getVersionString():\n return str(version_gen.major) + \".\" + str(version_gen.minor) + \".\" + str(version_gen.compilation)", "def versionstring():\n return \"%i.%i.%i\" % __version__", "def versionstring():\n return \"%i....
[ "0.83939236", "0.83651793", "0.8328865", "0.8328865", "0.8318886", "0.81609386", "0.8143588", "0.8109128", "0.8109128", "0.8109128", "0.8109128", "0.8109128", "0.8066372", "0.80393845", "0.80291635", "0.7950095", "0.7938742", "0.79246277", "0.79246277", "0.79246277", "0.79246...
0.0
-1
returns a formatted date string
def getFormattedDate(self, dt): if DATE_FORMAT_STRING == '': return time.strftime('%Y-%m-%d %H:%M:%S', dt.timetuple()) else: return time.strftime(DATE_FORMAT_STRING, dt.timetuple())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date() -> str:\n\n return datetime.strftime(datetime.today(), _fmt)", "def date_string(date):\n day = date.day\n month = date.month\n year = date.year\n formatted_string = str(month) + \"/\"\n formatted_string += str(day) + \"/\"\n formatted_string += str(year)\n return formatted_stri...
[ "0.8016059", "0.7916384", "0.7914958", "0.7656416", "0.745917", "0.74570465", "0.7381044", "0.73655266", "0.73201656", "0.72859514", "0.72671545", "0.7251556", "0.7224932", "0.7190442", "0.7117921", "0.711506", "0.71048146", "0.71048146", "0.7021738", "0.7020266", "0.7007234"...
0.7215428
13
simple example command greeting the executing user
def cmd_channel_greet(self, c, e): c.privmsg(e.target(), 'Greetings %s!' % nm_to_n(e.source()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def greet_user():\n print(\"Hello\")", "def greet_user():\r\n print(\"hello!\")", "def greet_user():\n print(\"Hello!\")", "def greet_user():\n print(\"Hello!\")", "def greet_user():\n print(\"Hello!\")", "def greet_user(username):\r\n print(\"Hello, \" + username + \"!\")", "def ...
[ "0.8049088", "0.78862774", "0.7880772", "0.7880772", "0.7880772", "0.77212095", "0.77092606", "0.76061106", "0.76061106", "0.75531715", "0.75531715", "0.75266325", "0.7517451", "0.749191", "0.74894816", "0.74639577", "0.74101824", "0.7405025", "0.7374833", "0.7317575", "0.728...
0.0
-1
simple example command using mcxDatabase
def cmd_channel_getMySQLVersion(self, c, e): c.privmsg(e.target(), 'MySQL Server Version: %s' % self.__database.getMySQLVersion())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query(mdx_stmt):", "def do_command(self, args):\n chk_arg_count(args, 0)\n dbops.init_database()", "def db(action):\n if action not in commands:\n return 'Available commands: %s' % list(commands.keys())\n from app.db import DB\n db = DB(app)\n db.execute_sql(commands[action...
[ "0.63189936", "0.61696064", "0.6062341", "0.60062075", "0.600137", "0.596549", "0.5885804", "0.58501065", "0.5823914", "0.5821101", "0.57294565", "0.5712288", "0.56857145", "0.56739485", "0.56711733", "0.5663404", "0.5663201", "0.56520045", "0.5632753", "0.5632753", "0.562244...
0.0
-1
For testing purpose only, will be erased in future versions.
def cmd_channel_getTestUserByBotKey(self, c, e): BotKey = self.getParameterListByEvent(e)[0] UserId = int(self.__database.getUserIdByBotKey(BotKey)) if UserId: c.privmsg(e.target(), 'UserId for Botkey: %s' % user) else: c.privmsg(e.target(), 'Not Found: User')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use(self):", "def __call__(self) -> None:", "def test_4_4_1_1(self):\n pass", "def __call__(self):\n\t\treturn", "def __call__(self):\n pass", "def __call__(self):\n pass", "def __upgrade(self):", "def mockup(cls):\n pass", "def __init__():", "def __call__(self):\n...
[ "0.7051174", "0.69587713", "0.6827455", "0.6784662", "0.6760687", "0.6760687", "0.6738522", "0.66627103", "0.6641278", "0.6629686", "0.6620852", "0.6620852", "0.6620852", "0.6567494", "0.6567494", "0.6525338", "0.6493429", "0.6483424", "0.64653677", "0.64601654", "0.6456517",...
0.0
-1
command to let the bot quit and end the program
def cmd_query_die(self, c, e): self.die(self.getRandomQuitMsg())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_quit(args):", "def command_quit(self, arg):\n self.write('221 Bye', self.finish)", "async def module_command_quit(self, ctx, parsed):\n if parsed.invoker != ctx.owner:\n return\n reason = \" \".join(parsed.args[\"msg\"] or []) or \"Shutting down\"\n self.quit(reas...
[ "0.8041607", "0.79281455", "0.76705015", "0.76685286", "0.7558226", "0.74295765", "0.7426876", "0.74031633", "0.7400951", "0.7395473", "0.734823", "0.7261887", "0.7261887", "0.7261887", "0.7261887", "0.725393", "0.7253544", "0.7226303", "0.7204447", "0.7122349", "0.70978296",...
0.0
-1
auth command, a user may authenticate itself by sending a authentification key
def cmd_not_authed_dcc_auth(self, c, e): UserId = self.__authUser(c, e) if int(UserId) > 0: self.__IpToUser[self.getIpStringByDCCConnection(c)]['auth'] = 'authed_dcc' c.privmsg(AUTH_USER_SUCCESS_BY_BOTKEY) else: c.privmsg(AUTH_USER_FAILED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth():\n pass", "def auth():\n pass", "def auth(self, user):", "def authenticate(self):\n expires = int(time.time())\n method = \"GET\"\n path = \"/realtime\"\n msg = method + path + str(expires)\n signature = hmac.new(\n self.secret, msg.encode(), dig...
[ "0.72916865", "0.72916865", "0.7031809", "0.68804866", "0.67559546", "0.66912556", "0.66756177", "0.66715854", "0.66143775", "0.6605998", "0.6588032", "0.6542396", "0.6509783", "0.65073836", "0.6485412", "0.6463984", "0.6435641", "0.6430253", "0.64275837", "0.6399525", "0.632...
0.0
-1
get the lastest message for the user
def cmd_authed_dcc_getLatestMessage(self, c, e): MessageDict = self.__database.getLatestMessage(self.__getUserIdByDCCConnection(c)) if MessageDict.has_key('from'): created = self.getFormattedDate(MessageDict['created']) c.privmsg(LATEST_MESSAGE_INTRO) c.privmsg(LATEST...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_most_recent(self):\n return self.unread()[:5]", "def last(self):\n if len(self._messages) == 0:\n return ''\n else:\n return self.format_message(self._messages[-1])", "def lastMessageReceived():", "def get_last_message(self):\n self.driver_Lock.acquir...
[ "0.7184769", "0.6790789", "0.67303634", "0.6717637", "0.6701714", "0.6598463", "0.65936667", "0.6568074", "0.6514163", "0.6477696", "0.6448938", "0.63924676", "0.63721263", "0.63578105", "0.6316596", "0.6291368", "0.62867814", "0.6206668", "0.6147896", "0.6104151", "0.6103471...
0.65338624
8
commands executed after connected to the server triggered if the chosen nickname on construction is already in use
def on_nicknameinuse(self, c, e): c.nick(c.get_nickname() + "_")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_nicknameinuse(self, raw_msg, busy_nickname, **kwargs):", "def on_nicknameinuse(self, conn, event) -> None:\n self._nickname += '_'\n conn.nick(self._nickname)", "def on_nick(self, raw_msg, source, old_nickname, new_nickname, **kwargs):", "def on_welcome(self, raw_msg, server, port, nickn...
[ "0.694035", "0.6767303", "0.66506344", "0.65627545", "0.6395496", "0.62655073", "0.61659", "0.6128941", "0.61008", "0.6065453", "0.6005221", "0.5998594", "0.599429", "0.597298", "0.5958442", "0.59406614", "0.5906776", "0.58808583", "0.5872089", "0.5869215", "0.58509284", "0...
0.6800195
1
commands executed after connected to the server triggered immediately after connection has been established
def on_welcome(self, c, e): c.privmsg('NICKSERV', 'GHOST %s %s' % (self._nickname, self.__password)) c.nick(self._nickname) c.privmsg('NICKSERV', 'IDENTIFY %s' % self.__password) c.join(self.channel)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_connect(self):\n pass", "async def on_connect(self) -> None:", "async def on_connect(self):\n pass", "def connectionMade(self):", "def _send_custom_commands_after_welcome(self, conn):\n for command in self.commands:\n conn.send_raw(command)", "def on_connect(self...
[ "0.7020557", "0.69459486", "0.6780789", "0.67315364", "0.6669281", "0.66611785", "0.6576801", "0.6571881", "0.65439636", "0.6515856", "0.64574045", "0.6455664", "0.6451482", "0.6444221", "0.6434293", "0.64248335", "0.63213265", "0.6318825", "0.6310891", "0.63066167", "0.62765...
0.0
-1
commands executed when the bot received a private message forwards the command and the event to self.do_command()
def on_privmsg(self, c, e): self.do_command(e.arguments()[0], c, e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_private_message(self, private_message):\n pass", "def privmsg(self, user, channel, message):\n # Only actually private messages\n user = user.split('!', 1)[0]\n if (channel != self.help_channel\n or user in self.ignore\n or not user.strip()):\n ...
[ "0.6949553", "0.6780412", "0.6731864", "0.6605808", "0.6591112", "0.6566711", "0.65491927", "0.6518306", "0.65104854", "0.64871526", "0.6435231", "0.6421582", "0.6418484", "0.6351781", "0.6327283", "0.63123596", "0.6310017", "0.6302293", "0.62811166", "0.62644047", "0.6242353...
0.7241555
0
commands executed when the bot received a public message on a channel extracts command and forward it and the event to self.do_command() if no command prefix (bot not addressed) is find, nothing happens
def on_pubmsg(self, c, e): args = e.arguments()[0].split(",", 1) sender = args[0] if len(args) > 1 and irc_lower(sender) == irc_lower(self.connection.get_nickname()): self.do_command(self.getCommandByEvent(e), c, e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __command_handler__(self, commands, handler):\n message_set = self.event.text.split(u' ')\n for command in commands:\n if command in message_set:\n handler(self.event, self.vk)\n break", "def parse_bot_commands(self, slack_events):\n for event in ...
[ "0.6792378", "0.67852736", "0.6666915", "0.6657862", "0.6604446", "0.6600385", "0.6583449", "0.65736973", "0.65669423", "0.6559967", "0.65213996", "0.65205705", "0.6518104", "0.65156865", "0.6509748", "0.65064645", "0.64882356", "0.64882356", "0.64882356", "0.64779747", "0.64...
0.57634467
98