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
Waits for messages from other components of the app and dispatches commands as necessary
def run(self): # waits for new messages and reacts based on message try: self.__email_handler.run() except KeyboardInterrupt: print('\nClosing...\n') except Exception as e: print(f'{self.__source}: and error has occured: %s' % e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _execute(self):\n LOG.info(\"Waiting for a message...\")", "def main(self):\n\n updater = Updater(self.token)\n dp = updater.dispatcher\n\n dp.add_handler(MessageHandler(Filters.text, self.__msg_handler))\n dp.add_handler(MessageHandler(Filters.command, self.__msg_handler))...
[ "0.722827", "0.6583136", "0.6575468", "0.63810545", "0.6380672", "0.6361295", "0.6314942", "0.62583387", "0.6249404", "0.6244898", "0.616663", "0.60918003", "0.6082881", "0.6080931", "0.60132414", "0.60022396", "0.59993714", "0.5983036", "0.59463596", "0.59252965", "0.5925011...
0.5945537
19
Try finding good candidates for compaction
def _compact_pass1(self, min_cardinality, child_ratio): def grandchildren(tree): for c in tree.children.values(): for gc in c.children.keys(): yield gc def recursive(tree): child_count = len(tree.children) if child_count > min_card...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, full_table, bad_tables, good_tables, **kwargs):\n self.full_table = full_table\n self.bad_tables = bad_tables\n self.good_tables = good_tables\n self.bad_err_funcs = [self.err_func.clone() for t in bad_tables]\n self.good_err_funcs = [self.err_func.clone() for ...
[ "0.5891554", "0.58388346", "0.55771506", "0.55318457", "0.54864943", "0.5392519", "0.5326511", "0.5310141", "0.5301276", "0.53007215", "0.5286802", "0.52391326", "0.522699", "0.519896", "0.51907796", "0.5184375", "0.5182485", "0.5163144", "0.515931", "0.51409996", "0.5140504"...
0.0
-1
! Clamp angles between (pi, pi] angle The angle Clamped angle
def clamp(angle): while angle > np.pi: angle -= 2 * np.pi while angle <= -np.pi: angle += 2 * np.pi return angle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_angle(angle):\n\n angle = (angle + np.pi) % (2 * np.pi) - np.pi\n\n return angle", "def simplify_angle(angle):\n if angle > math.pi:\n return math.pi - angle\n return angle", "def wrap_angles(angle):\n return (angle + pi) % (2 * pi) - pi", "def _confined_angle_pi(a):\n while...
[ "0.7253713", "0.7211587", "0.71298516", "0.712739", "0.7106415", "0.70632184", "0.7024957", "0.7020985", "0.7001495", "0.6973188", "0.6972748", "0.696525", "0.69315684", "0.6906103", "0.6902425", "0.6859615", "0.68486387", "0.6762119", "0.6724876", "0.6715224", "0.6715224", ...
0.7882026
0
! Get the 4x4 transformation matrix from link to world
def FK_dh(dh_params, joint_angles, link): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMatrix(self) -> CMatrix4:\n ...", "def matrix(self):\n m = Matrix.identity(4, 4)\n\n m[:3, :3] = self.rotation.matrix.data\n m[:3, 3:4] = self.translation.matrix.data\n\n return m", "def getTransposeMatrix(self) -> CMatrix4:\n ...", "def get_direction_matrix(s...
[ "0.67277634", "0.65599537", "0.6540112", "0.64462286", "0.6384859", "0.63385653", "0.6266697", "0.6194439", "0.6133355", "0.6114672", "0.6102785", "0.60988957", "0.60400885", "0.6003334", "0.6003334", "0.59956646", "0.5993969", "0.5979662", "0.59764636", "0.5951162", "0.59470...
0.0
-1
! Gets the transformation matrix from dh parameters.
def get_transform_from_dh(a, alpha, d, theta): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dhMatrix(self):\n row1 = np.array([np.cos(self.theta), -np.sin(self.theta)*np.cos(self.alpha), np.sin(self.theta)*np.sin(self.alpha), self.a*np.cos(self.theta)])\n row2 = np.array([np.sin(self.theta), np.cos(self.theta)*np.cos(self.alpha), -np.cos(self.theta)*np.sin(self.alpha), self.a*np.sin(s...
[ "0.7223759", "0.7196637", "0.6873913", "0.673187", "0.6503569", "0.6426385", "0.6411647", "0.6405354", "0.6387804", "0.6387804", "0.63843906", "0.6356444", "0.63466644", "0.6344464", "0.6341292", "0.63363296", "0.6311011", "0.6265211", "0.6264327", "0.62036526", "0.6183622", ...
0.6528768
4
! Gets the euler angles from a transformation matrix.
def get_euler_angles_from_T(T): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rotation_matrix_to_euler_angles(self, R):\n assert (self._is_rotation_matrix(R))\n\n sy = math.sqrt(R[0, 0] * R[0, 0] + R[1, 0] * R[1, 0])\n singular = sy < 1e-6\n\n if not singular:\n x = math.atan2(R[2, 1], R[2, 2])\n y = math.atan2(-R[2, 0], sy)\n ...
[ "0.75182706", "0.7428497", "0.7422957", "0.71761715", "0.7145424", "0.71223485", "0.69868743", "0.6967", "0.69654804", "0.66869587", "0.668514", "0.6603598", "0.6544097", "0.6526637", "0.6484461", "0.6440097", "0.6358438", "0.63052535", "0.6285869", "0.6279883", "0.62661356",...
0.6803455
9
! Gets the pose from T.
def get_pose_from_T(T): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPose(self):\n\t\treturn self.__subs['pose'].getData()", "def get_pose(self, joint_angles: dict, query_node: str) -> SE3:\n kinematic_map = self.kinematic_map\n parents = self.parents\n T_ref = self.T_zero\n T = T_ref[\"p0\"]\n for node in kinematic_map[\"p0\"][query_node...
[ "0.7187253", "0.6933531", "0.672665", "0.65035844", "0.6450835", "0.62265545", "0.6220612", "0.6193213", "0.6180652", "0.61510414", "0.61258614", "0.61116815", "0.6047407", "0.6039513", "0.5990924", "0.59187305", "0.5886028", "0.58447236", "0.5842025", "0.58301324", "0.580211...
0.8583743
0
! Get a 4tuple (x, y, z, phi) representing the pose of the desired link
def FK_pox(joint_angles, m_mat, s_lst): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_goal_ee_pose(self):\n #self.target_endpoint = #magic tf call that I can add ie the pose of the palm from camera aruco detection\n while True:\n try:\n translation, rotation = self.listener.lookupTransform('world_frame', 'palm_frame_camera', rospy.Time()) # ee_frame_c...
[ "0.6071441", "0.6025158", "0.6019991", "0.5937238", "0.59027195", "0.58826804", "0.5766654", "0.5766654", "0.5766654", "0.57409614", "0.57398325", "0.57385", "0.5692674", "0.5679011", "0.5676367", "0.5675034", "0.5660762", "0.5649292", "0.5632161", "0.5619964", "0.56163067", ...
0.0
-1
! Convert to s matrix.
def to_s_matrix(w,v): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_matrix(self) -> types.Matrix:", "def get_stain_matrix(I):", "def convert(self, s, numRows):\n \n if numRows == 1:\n return s\n \n matrix = []\n for i in range(numRows):\n\n # Change from storing matrices of letter to strings\n # matrix....
[ "0.68945247", "0.6642457", "0.6603314", "0.6522115", "0.6472364", "0.64635885", "0.6433777", "0.6428377", "0.63919264", "0.63550717", "0.6309325", "0.6300631", "0.62582445", "0.6221067", "0.6177143", "0.61561906", "0.61437947", "0.6129541", "0.6115956", "0.61145544", "0.60799...
0.81369454
0
! Get all possible joint configs that produce the pose.
def IK_geometric(dh_params, pose): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters(self):\n return [i.parameter for i in self.joints.values()]", "def chs_config(self):\n conf = set()\n for j in self.get_fd_j(self.id):\n if self.get_config_j(j) != constants.NOT_PARTICIPANT:\n conf |= set(self.get_config_j(j))\n if conf == set(...
[ "0.61084604", "0.5877382", "0.5827816", "0.57932264", "0.57727504", "0.576476", "0.5750087", "0.5727622", "0.5699759", "0.56863415", "0.5679535", "0.5605332", "0.55895245", "0.5579664", "0.5503426", "0.55003947", "0.5475498", "0.5474627", "0.5438028", "0.5417057", "0.54132235...
0.0
-1
Computes the truncated SVD of A. If r is None or equals the number of nonzero singular values, it is the compact SVD.
def truncated_svd(A,k=None): AHA=np.conj(A).T.dot(A) evals,evecs=la.eig(AHA) order=np.argsort(evals) evals=evals[order][::-1].copy() evecs=evecs.T[order][::-1].copy() m,n=AHA.shape tol=1e-12 Vh=[] for i in xrange(0,m): if np.abs(evals[i])>=tol: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def truncated_svd(A,k=None):", "def svd0(A):\n M,N = A.shape\n if M>N: return sla.svd(A, full_matrices=True)\n else: return sla.svd(A, full_matrices=False)", "def pinv_damped(a, l, rcond=1e-15 ):\n # a, wrap = np.linalg._makearray(a)\n # np.linalg._assertNoEmpty2d(a)\n a = a.conjugate()\n u, s...
[ "0.7408433", "0.6813271", "0.6227772", "0.6188896", "0.6054052", "0.59679675", "0.59457225", "0.58844644", "0.5869929", "0.58507484", "0.5739411", "0.5691503", "0.5602991", "0.5565803", "0.5549047", "0.5537558", "0.5508911", "0.5458776", "0.5437982", "0.5437848", "0.5436468",...
0.6630652
2
Plot each transformation associated with the SVD of A.
def visualize_svd(): A=np.array([[3,1],[1,3]]) U,s,Vh=truncated_svd(A) twopi=np.linspace(0,2.*np.pi,360) one=np.reshape(np.linspace(0,1,100),(1,100)) zeros=np.zeros((1,100)) S=np.vstack((np.reshape(np.cos(twopi),(1,360)),np.reshape(np.sin(twopi),(1,360)))) e1=np.vstack((zeros,one)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize_svd(A):\r\n theta = np.linspace(0,2*np.pi,200)\r\n #Set S as unit circle\r\n S = np.array([np.cos(theta), np.sin(theta)])\r\n #Set E as orthogonal basis\r\n E = np.array([[1,0,0],[0,0,1]])\r\n U,Si,Vh = la.svd(A)\r\n Si = np.diag(Si)\r\n\r\n #plot original S and E\r\n first...
[ "0.7446054", "0.6830006", "0.66623765", "0.60932344", "0.60709465", "0.60032773", "0.5920726", "0.5840712", "0.56891584", "0.5674648", "0.56161666", "0.55661666", "0.55647403", "0.5467181", "0.5462486", "0.54301476", "0.5419256", "0.54070497", "0.53769505", "0.53765595", "0.5...
0.663423
3
Returns best rank k approximation to A with respect to the induced 2norm.
def svd_approx(A, k): U,s,Vh=la.svd(A,full_matrices=False) return U[:,:k].dot(np.diag(s[:k])).dot(Vh[:k,:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def k_rank_approximate(doc_matrix, k):\n return []", "def computeBound(A, omega, Q, omega2, Q2, k):\n A = A.todense()\n M = Q2.T.dot(A).dot(Q2)\n R = A.dot(Q2) - Q2.dot(M)\n \n normR = numpy.linalg.norm(R) \n lmbda, U = numpy.linalg.eigh(M)\n L2 = omega[k:]\n\n delta = float(\"inf\"...
[ "0.62445366", "0.62090725", "0.61899227", "0.59206605", "0.590111", "0.588553", "0.58643836", "0.5837029", "0.58113295", "0.5809164", "0.5769161", "0.5729828", "0.57291305", "0.5697681", "0.5696698", "0.5694108", "0.5687137", "0.5647675", "0.5642368", "0.56338096", "0.5629287...
0.0
-1
Returns the lowest rank approximation of A with error less than e with respect to the induced 2norm.
def lowest_rank_approx(A,e): U,s,Vh=la.svd(A,full_matrices=False) t=s.copy() t[t>e]=0 i=t.nonzero()[0][0] return U[:,:i].dot(np.diag(s[:i])).dot(Vh[:i,:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowest_rank_approx(A,e):", "def lowest_rank_approx(A, err):\n \n #Is this not just problem 1 repeated, just with different returns?\n \n u, d, v = compact_svd(A)\n \n s = len(d)\n for i in range(0, len(d)):\n if d[i] < err:\n s = i\n break\n \n v = v.co...
[ "0.7423881", "0.6019328", "0.6006175", "0.5983821", "0.58116776", "0.58109677", "0.57976466", "0.5749795", "0.5728308", "0.56952167", "0.56908226", "0.56268173", "0.5626445", "0.56208396", "0.5615378", "0.5576524", "0.55443656", "0.5530991", "0.5524992", "0.55179006", "0.5516...
0.68139
1
Plot the original image found at 'filename' and the rank k approximation of the image found at 'filename.' filename jpg image file path k rank
def compress_image(filename,k): img_color=plt.imread(filename) orig=img_color.copy() R=img_color[:,:,0] G=img_color[:,:,1] B=img_color[:,:,2] m,n=(R.shape[0],R.shape[1]) u1,s1,vh1=la.svd(R,full_matrices=False) u2,s2,vh2=la.svd(G,full_matrices=False) u3,s3,vh3=la.svd(B,full_matri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_comparison(filename, k_values):\n basename = os.path.basename(filename).split(\".\")[0]\n\n K_nums = [str(val[\"K\"]) for val in k_values]\n print(f\"\\nstart K-means on {basename} for K=[{', '.join(K_nums)}]\")\n\n if not os.path.exists(basename):\n os.mkdir(basename)\n\n img = i...
[ "0.61253667", "0.5967198", "0.5783416", "0.5655451", "0.5476648", "0.5382434", "0.5345423", "0.53212297", "0.53069985", "0.5282727", "0.5280036", "0.52722347", "0.5271273", "0.5256575", "0.5243671", "0.5242266", "0.52320015", "0.5218855", "0.52187943", "0.5211906", "0.5202215...
0.5404266
5
Export entity specific data as DXF tags.
def export_entity(self, tagwriter: TagWriter) -> None: super().export_entity(tagwriter) # AcDbEntity export is done by parent class # AcDbCircle export is done by parent class if tagwriter.dxfversion > DXF12: tagwriter.write_tag2(SUBCLASS_MARKER, acdb_arc.name) self.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_entity(self, tagwriter: 'TagWriter') -> None:\n # base class export is done by parent class\n super().export_entity(tagwriter)\n # AcDbEntity export is done by parent class\n tagwriter.write_tag2(SUBCLASS_MARKER, acdb_tolerance.name)\n self.dxf.export_dxf_attribs(tagwr...
[ "0.63105893", "0.6185762", "0.61040395", "0.6035611", "0.58427787", "0.5701736", "0.5509082", "0.54831487", "0.54149663", "0.54122865", "0.5400104", "0.5375761", "0.5325041", "0.52323043", "0.519035", "0.5183843", "0.5177302", "0.5173674", "0.5170246", "0.51581097", "0.515787...
0.61629796
2
Returns the start point of the arc in WCS, takes OCS into account.
def start_point(self) -> Vec3: v = list(self.vertices([self.dxf.start_angle])) return v[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_arc_center(self):\n # First two anchors and handles\n a1, h1, h2, a2 = self.points[:4]\n # Tangent vectors\n t1 = h1 - a1\n t2 = h2 - a2\n # Normals\n n1 = rotate_vector(t1, TAU / 4)\n n2 = rotate_vector(t2, TAU / 4)\n try:\n return ...
[ "0.6179543", "0.6066767", "0.60599524", "0.56948525", "0.5665913", "0.56469965", "0.5609979", "0.5566748", "0.55583507", "0.5535", "0.5533847", "0.55278826", "0.55274695", "0.55264086", "0.548918", "0.5485597", "0.5480605", "0.54784", "0.54637015", "0.54637015", "0.54563135",...
0.6059262
3
Returns the end point of the arc in WCS, takes OCS into account.
def end_point(self) -> Vec3: v = list(self.vertices([self.dxf.end_angle])) return v[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_end_point(arc: FpArc)->Coords:\n x: float = float(arc.start[0])\n y: float = float(arc.start[1])\n ang: float = float(arc.angle)\n x_c: float = float(arc.end[0])\n y_c: float = float(arc.end[1])\n r: float = math.sqrt((x - x_c) * (x - x_c) + (y - y_c) * (y - y_c))\n start_angle: float ...
[ "0.6821191", "0.62864006", "0.5807849", "0.5759162", "0.5675946", "0.5645561", "0.55972826", "0.55416834", "0.5516155", "0.5422003", "0.54003006", "0.53776693", "0.53365004", "0.5305714", "0.52976304", "0.5211127", "0.5184522", "0.5172099", "0.5158973", "0.515795", "0.5144223...
0.627563
2
Returns `num` angles from start to end angle in degrees in counter clockwise order. All angles are normalized in the range from [0, 360).
def angles(self, num: int) -> Iterable[float]: if num < 2: raise ValueError("num >= 2") start = self.dxf.start_angle % 360 stop = self.dxf.end_angle % 360 if stop <= start: stop += 360 for angle in linspace(start, stop, num=num, endpoint=True): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_angle(n):\n return n % 360 if n > 360 else (n * 180) / PI", "def calculate_angle(start: tuple, end: tuple):\n radians = -math.atan2(end[0] - start[0], end[1] - start[1])\n return math.degrees(radians) % 360", "def degree_range(n, start=0, end=180):\n start_ = np.linspace(start, end, n+1, en...
[ "0.69789016", "0.6480122", "0.64355767", "0.63461417", "0.61619854", "0.6121664", "0.6098144", "0.60696733", "0.60160345", "0.58649814", "0.58536875", "0.5849952", "0.57118773", "0.56563556", "0.5630533", "0.5594795", "0.5569927", "0.5524123", "0.55092126", "0.55007035", "0.5...
0.7683883
0
Approximate the arc by vertices in WCS, argument `segment` is the max. distance from the center of an arc segment to the center of its chord.
def flattening(self, sagitta: float) -> Iterator[Vec3]: arc = self.construction_tool() ocs = self.ocs() elevation = Vec3(self.dxf.center).z if ocs.transform: to_wcs = ocs.points_to_wcs else: to_wcs = Vec3.generate yield from to_wcs( Ve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segmentarc(c,u1,u2):\n\n pol1=samplearc(c,u1,polar=True)\n pol2=samplearc(c,u2,polar=True)\n sr= (c[1][3] == -2)\n if sr:\n return arc(pol1[0],pol1[1],pol2[2],pol1[2],samplereverse=True)\n else:\n return arc(pol1[0],pol1[1],pol1[2],pol2[2])", "def intersection_segment_plane(segme...
[ "0.56789714", "0.56275415", "0.5404232", "0.526627", "0.50678796", "0.5067105", "0.50314313", "0.5003801", "0.49465248", "0.49374533", "0.49315086", "0.4920969", "0.4898533", "0.48621497", "0.48603126", "0.48142242", "0.48120928", "0.47588274", "0.47166684", "0.4711173", "0.4...
0.0
-1
Transform ARC entity by transformation matrix `m` inplace. Raises ``NonUniformScalingError()`` for non uniform scaling.
def transform(self, m: Matrix44) -> Arc: ocs = OCSTransform(self.dxf.extrusion, m) super()._transform(ocs) s: float = self.dxf.start_angle e: float = self.dxf.end_angle if not math.isclose(arc_angle_span_deg(s, e), 360.0): ( self.dxf.start_angle, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_M(pca, M):\n return pca.transform(M)", "def apply_affine_transform(x, M):\n is1d = len(x.shape) == 1\n if is1d:\n x = np.expand_dims(x, axis=0)\n\n x_hom = np.concatenate(\n [x, np.ones((x.shape[0], 1), dtype=x.dtype)], axis=-1\n )\n x_out = x_hom @ M.T\n if is1d:...
[ "0.6531993", "0.6270979", "0.61930734", "0.6004775", "0.5982845", "0.5892362", "0.58800626", "0.5865425", "0.5843489", "0.5809627", "0.58091384", "0.58003235", "0.58003235", "0.5765189", "0.5754191", "0.5752435", "0.5734377", "0.57039636", "0.56810164", "0.56775236", "0.56762...
0.5440676
29
Creates a YML file to be used as a custom exclusions template, so users can fill out the fields without needing to look up the required format.
def create_exclusions_file(output_file: str, verbosity: int) -> None: set_log_level(verbosity) with open(output_file, "a") as file_obj: for line in EXCLUSIONS_TEMPLATE: file_obj.write(line) utils.print_green(f"Success! Exclusions template file written to: {output_file}") print( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_exclusions(proteins):\n pass", "def test__create_excl_file_2(self):\n rsync = RsyncMethod(self.settings, self.meta, self.log, self.comms, False)\n rsync.settings.set('debug-level', 1)\n rsync.exclude_file = os.path.join(os.environ['HOME'],\"temp/myocp_excl\")\n rsync._...
[ "0.58035815", "0.53256804", "0.53069764", "0.5283049", "0.52198035", "0.51952946", "0.51761174", "0.5160965", "0.5155543", "0.51421845", "0.5109539", "0.51084596", "0.50987554", "0.50949365", "0.5078183", "0.50466263", "0.50214356", "0.4995813", "0.49698544", "0.4954272", "0....
0.61798495
0
in case of a non file you wan to use nocheck=True (like /dev/null)
async def getfile(url: str, filepath, chunk_size=150000, bytes_range=None, retries=5, nocheck=False, **kwargs) -> None: callback = kwargs.pop('callback', None) userdata = kwargs.pop('userdata', None) kwargs.setdefault('raise_for_status', True) def get_headers(file_size=None) -> dict: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noCheck():\n dislin.nochek()", "def test_check(self):\n\n self.assertTrue(Naive().check(self.file_gitignore))\n self.assertTrue(Naive().check(self.file_tests))\n self.assertTrue(Naive().check(self.file_bin))\n self.assertTrue(Naive().check(self.file_py))\n self.assertTru...
[ "0.6305159", "0.62550896", "0.6145006", "0.61087954", "0.59869045", "0.59646285", "0.59346807", "0.592191", "0.5865518", "0.5859718", "0.5827415", "0.5811571", "0.57681894", "0.57546294", "0.57245594", "0.57193375", "0.56955117", "0.56896937", "0.56348944", "0.56010413", "0.5...
0.0
-1
Function construct complex number
def __init__(self, a=0, b=0): self._a = a self._b = b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complex(real, imag):", "def _complex(real, imag):\n real = np.asarray(real)\n imag = np.asarray(imag)\n cplx = 1j * imag \n return cplx + real", "def __complex__(self):\n return complex(self._reNum, self._imNum)", "def __complex__(self):\n return complex(self.q[0], self.q[1])...
[ "0.8198033", "0.77351445", "0.76188505", "0.73935705", "0.7340337", "0.7271693", "0.71695983", "0.7168124", "0.71572167", "0.70651966", "0.7025084", "0.68867147", "0.68855846", "0.68855846", "0.68855846", "0.68855846", "0.68855846", "0.68855846", "0.68855846", "0.68855846", "...
0.0
-1
Function return real num
def get_a(self): return self._a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def real(z):", "def get_real(val, precision):\n if precision == \"single\":\n return numpy.float32(val)\n elif precision == \"double\":\n return numpy.float64(val)\n else:\n raise ValueError (\"precision %s not supported!\"%(precision))", "def getNumber():", "def Sqr(num):\n ...
[ "0.70360833", "0.66534823", "0.6416397", "0.6371853", "0.6340088", "0.6171573", "0.6140519", "0.6118412", "0.61131155", "0.61131155", "0.6103398", "0.60876864", "0.6082805", "0.60586", "0.6041225", "0.6012087", "0.6000757", "0.59871763", "0.59682447", "0.5883435", "0.5818909"...
0.0
-1
Function return real num
def get_b(self): return self._b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def real(z):", "def get_real(val, precision):\n if precision == \"single\":\n return numpy.float32(val)\n elif precision == \"double\":\n return numpy.float64(val)\n else:\n raise ValueError (\"precision %s not supported!\"%(precision))", "def getNumber():", "def Sqr(num):\n ...
[ "0.70360833", "0.66534823", "0.6416397", "0.6371853", "0.6340088", "0.6171573", "0.6140519", "0.6118412", "0.61131155", "0.61131155", "0.6103398", "0.60876864", "0.6082805", "0.60586", "0.6041225", "0.6012087", "0.6000757", "0.59871763", "0.59682447", "0.5883435", "0.5818909"...
0.0
-1
Function prints complex number in correct form
def __str__(self): sign = '' if self.get_b() > 0: sign = '+' elif self.get_a() == self.get_b() or self.get_b() == 0: return f'z = {self.get_a()}i' elif self.get_a() == 0: return f'z = {self.get_b()}i' return f'z = {self.get_a()}{sign}{self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complexinfo(a, str=None):\n\n if str:\n print \n print \"\\t\", str\n re = a.real.copy()\n im = a.imag.copy()\n _log.debug(\"\\t%.2e %.2g = re.sum im.sum\" % (re.sum(), im.sum()))\n _log.debug(\"\\t%.2e %.2g = abs(re).sum abs(im).sum\" % (abs(re).sum(), abs(im).sum()))", "d...
[ "0.7244853", "0.7220926", "0.72013825", "0.6815524", "0.6771268", "0.6730379", "0.670886", "0.66197026", "0.6509665", "0.6499921", "0.6454943", "0.6434747", "0.64002264", "0.6315071", "0.628439", "0.62117547", "0.6205477", "0.6205477", "0.6205477", "0.6205477", "0.6205477", ...
0.0
-1
out_data2 = imutil.imread(out_path) out_data == out_data2 image = out_data2
def _imshow_dtm(image): import copy import matplotlib as mpl from matplotlib.colors import Normalize import plottool as pt UNKNOWN = -32767 vmin = image[image != UNKNOWN].min() vmax = image.max() norm = Normalize(vmin=vmin, vmax=vmax) cmap = copy.copy(mpl.cm.get_cmap('viridis')) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_RawImage_write_out():\n i.write_out()\n # now compare the output with reference\n print i.outpath\n print t.processed_path\n assert_image_equal(i.outpath, t.processed_path)", "def assert_image_equal(path1, path2):\n test_im = np.asarray(Image.open(path1))\n ref_im = np.asarray(Image...
[ "0.6522312", "0.63933545", "0.6368202", "0.636577", "0.6283282", "0.61069536", "0.60416305", "0.59845793", "0.5942118", "0.59081787", "0.5860526", "0.5857463", "0.5819259", "0.58096236", "0.57952625", "0.578652", "0.5738333", "0.5736712", "0.57099766", "0.5691949", "0.5684920...
0.0
-1
Loads the source data into the Inputs format for further processing.
def load_fullres_inputs(task, subdir='training'): tagged_paths = { 'gt': glob.glob(join(task.root, subdir, '*_GTL.tif')), 'im': glob.glob(join(task.root, subdir, '*_RGB.tif')), 'gti': glob.glob(join(task.root, subdir, '*_GTI.tif')), # digital terrain model ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self, source):\n try:\n inputdata = self.__inputmanager.read(source)\n self.__suitables = self.__inputmanager.map(inputdata)\n self.__data = inputdata\n except ValueError as e:\n print (\"Failed to load the dataset: %s\" % e)\n raise\n\n...
[ "0.72463214", "0.69247866", "0.6851725", "0.6774142", "0.67552024", "0.66952884", "0.6576251", "0.6491617", "0.6390504", "0.6388523", "0.63387704", "0.6287613", "0.6287613", "0.6264103", "0.6261214", "0.62299746", "0.621701", "0.6204398", "0.61860484", "0.6114994", "0.6112335...
0.0
-1
Inplace / lazy modification of groundtruth labels hacky.
def rebase_groundtruth(task, fullres, force=False): # Remap the original three labels to [0, 1, 2] orig_labels = [2, 6, 65] mapping = np.full(max(orig_labels) + 1, fill_value=-1) mapping[orig_labels] = np.arange(len(orig_labels)) datadir = ub.ensuredir((task.workdir, 'data')) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateLabel(self) -> _n_6_t_0:", "def test_issue_replace_labels(self):\n pass", "def _relabel(labels, minval=0, bgval=None):\n\n labels = np.unique(labels, return_inverse=True)[-1] + minval\n if bgval is not None:\n labels[labels == minval] = bgval\n return labels", "def forget_lab...
[ "0.6552775", "0.64296865", "0.6331347", "0.62288725", "0.6124574", "0.60941124", "0.60580987", "0.6044636", "0.599782", "0.59934396", "0.5971612", "0.59426975", "0.59148395", "0.58575964", "0.5838784", "0.5820563", "0.5820563", "0.58087516", "0.57766753", "0.5771515", "0.5760...
0.56884044
30
gti_data = np.array([ [0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0], [0, 0, 5, 5, 5, 5, 5, 5, 0, 0, 0], [0, 0, 5, 5, 5, 5, 5, 5, 2, 2, 2], [0, 0, 5, 5, 5, 5, 5, 5, 2, 2, 2], [0, 5, 5, 5, 5, 5, 5, 5, 2, 2, 2], [0, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0], [0, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 3,...
def instance_boundary(gti_data, gtl_data): out_data = np.full(gti_data.shape, dtype=np.uint8, fill_value=NON_BUILDING) # 5x5 erosion is equivalent to two iterations of a 3x3 erosion kernel = np.ones((3, 3)) for label, submask, rc_off, rc_sl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def erode(img, kernel = (5,5), iterations = 1):\n\ttmp = grayscale(img)\n\tk = np.ones(kernel, np.uint8)\n\terosion = cv2.erode(tmp, k, iterations= iterations)\n\treturn erosion", "def erode(image, kernel_size=(5, 5)):\n kernel = np.ones(kernel_size, np.uint8)\n image = cv2.erode(image, kernel)\n return...
[ "0.6813081", "0.6655335", "0.6655335", "0.6326385", "0.62629443", "0.6173644", "0.616028", "0.60584724", "0.6048696", "0.60176474", "0.6009464", "0.5972192", "0.59574443", "0.5947122", "0.59254193", "0.5881773", "0.58735096", "0.58453214", "0.5690558", "0.5689311", "0.5658610...
0.55255014
35
Recombine parts back into an entire image
def stitch_tiles(rc_locs, tiles): shapes = [t.shape[0:2] for t in tiles] n_channels = 1 if len(tiles[0].shape) == 2 else tiles[0].shape[2] bboxes = np.array([ (r, c, r + h, c + w) for ((r, c), (h, w)) in zip(rc_locs, shapes) ]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruct_image(patch_list, patch_nb=2):\n line_list = []\n for i in range(0, patch_nb ** 2 - 1, patch_nb):\n line_list.append(cv2.hconcat(patch_list[i : i + patch_nb]))\n final_img = cv2.vconcat(line_list)\n return final_img", "def transform_images(img1,img2):", "def transform(self, p...
[ "0.67004097", "0.66201097", "0.6563718", "0.64026254", "0.631528", "0.62526196", "0.6201229", "0.6071955", "0.60583776", "0.60260767", "0.5984834", "0.5976638", "0.59046507", "0.5903756", "0.58812374", "0.5855542", "0.5846808", "0.5841477", "0.581932", "0.58078796", "0.579899...
0.0
-1
Recombine parts back into an entire image
def stitch_tiles_ave(rc_locs, tiles, weighted=False): shapes = [t.shape[0:2] for t in tiles] n_channels = 1 if len(tiles[0].shape) == 2 else tiles[0].shape[2] bboxes = np.array([ (r, c, r + h, c + w) for ((r, c), (h, w)) in zip(rc_locs, shapes) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruct_image(patch_list, patch_nb=2):\n line_list = []\n for i in range(0, patch_nb ** 2 - 1, patch_nb):\n line_list.append(cv2.hconcat(patch_list[i : i + patch_nb]))\n final_img = cv2.vconcat(line_list)\n return final_img", "def transform_images(img1,img2):", "def transform(self, p...
[ "0.6700326", "0.6619646", "0.65631014", "0.64027864", "0.63155764", "0.6252576", "0.6201516", "0.6072268", "0.6058612", "0.6026108", "0.59840626", "0.5976472", "0.59055954", "0.5903025", "0.58820647", "0.58544", "0.58464336", "0.58426243", "0.5818387", "0.58068055", "0.579777...
0.0
-1
Recombine parts back into an entire image
def stitch_tiles_vote(rc_locs, tiles): shapes = [t.shape[0:2] for t in tiles] n_channels = 1 if len(tiles[0].shape) == 2 else tiles[0].shape[2] assert n_channels == 1 bboxes = np.array([ (r, c, r + h, c + w) for ((r, c), (h, w)) in zip(rc_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruct_image(patch_list, patch_nb=2):\n line_list = []\n for i in range(0, patch_nb ** 2 - 1, patch_nb):\n line_list.append(cv2.hconcat(patch_list[i : i + patch_nb]))\n final_img = cv2.vconcat(line_list)\n return final_img", "def transform_images(img1,img2):", "def transform(self, p...
[ "0.6700326", "0.6619646", "0.65631014", "0.64027864", "0.63155764", "0.6252576", "0.6201516", "0.6072268", "0.6058612", "0.6026108", "0.59840626", "0.5976472", "0.59055954", "0.5903025", "0.58820647", "0.58544", "0.58464336", "0.58426243", "0.5818387", "0.58068055", "0.579777...
0.0
-1
Do some postprocessing to label instances instead of classes
def instance_label(task, pred, k=15, n_iters=1, dist_thresh=5, watershed=False): mask = pred # noise removal if k > 1 and n_iters > 0: kernel = np.ones((k, k), np.uint8) mask = cv2.morphologyEx(mask, cv2.MORPH_OPEN, kernel, iterations=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multi_label_cls_head__post_process(ctx, self, pred, **kwargs):\n return pred", "def _post_transform(self):\n # Reclassify strategy post __init__, if needed.\n for (reclassifier, args, kwargs) in self._reclassifiers:\n self.classifier = reclassifier(self.classifier, *args, **kwargs...
[ "0.6998397", "0.6416584", "0.6398392", "0.6248536", "0.623932", "0.6210227", "0.6058601", "0.59982306", "0.59315073", "0.59097195", "0.59043396", "0.5815752", "0.5814318", "0.5801434", "0.57983583", "0.5782739", "0.57623565", "0.5757331", "0.57066524", "0.5687625", "0.5673649...
0.5417718
51
Iterate over a cropped mask for each instance in an instance segmentation
def instance_submasks(gti): rc_locs = np.where(gti > 0) grouped_cc_rcs = util.group_items( np.ascontiguousarray(np.vstack(rc_locs).T), gti[rc_locs], axis=0 ) def bounding_box(rcs): rc1 = rcs.min(axis=0) rc2 = rcs.max(axis=0) return rc1, rc2 for label, rcs in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bg_mask(query_imgs, method):\n print(\"Obtaining masks\")\n segmentation_method = get_method(method)\n return [segmentation_method(img) for img in query_imgs]", "def img_process(fgMask):\n backSub = cv.createBackgroundSubtractorKNN()\n kernel1 = cv.getStructuringElement(shape=cv.MORPH_ELLIPSE,...
[ "0.63669485", "0.62147236", "0.61084807", "0.6079566", "0.60006905", "0.5989203", "0.5969494", "0.5966395", "0.591953", "0.5907332", "0.58997315", "0.5882974", "0.58462447", "0.5816596", "0.58141476", "0.58063954", "0.5799162", "0.57579124", "0.57267785", "0.5714815", "0.5706...
0.64390075
0
Extracts a contour for each (nonoverlapping) instance label in a mask
def instance_contours(gti): # TODO: move to somewhere better import cv2 rc_locs = np.where(gti > 0) grouped_cc_rcs = util.group_items( np.ascontiguousarray(np.vstack(rc_locs).T), gti[rc_locs], axis=0 ) def bounding_box(rcs): rc1 = rcs.min(axis=0) rc2 = rcs.max(a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mask_label_contour(image, seg):\n return sitk.Mask(image, sitk.LabelContour(seg+1)==0)", "def get_contour_features(mask,selectcell=\"centered\"):\r\n \r\n #binarize image (everything above 0 becomes 1)\r\n mask = np.clip(mask,a_min=0,a_max=1)\r\n\r\n #for contours, dont use RETR_TREE, but RETR_...
[ "0.7284189", "0.7216781", "0.6806945", "0.67010385", "0.6601212", "0.6331396", "0.63178694", "0.6256933", "0.61907893", "0.6157728", "0.6108738", "0.60891694", "0.6067135", "0.6033934", "0.60224605", "0.6009662", "0.59973556", "0.5993736", "0.5985048", "0.5974666", "0.5945327...
0.66997796
4
img = util.imread('/home/joncrall/remote/aretha/data/UrbanMapper3D/training/TAM_Tile_003_RGB.tif') gti = util.imread(ub.truepath('~/remote/aretha/data/UrbanMapper3D/training/TAM_Tile_003_GTI.tif')) gtl = util.imread('/home/joncrall/remote/aretha/data/UrbanMapper3D/training/TAM_Tile_003_GTL.tif') thickness = 2 alpha = 1
def draw_instance_contours(img, gti, gtl=None, thickness=2, alpha=1, color=None): import cv2 grouped_contours = instance_contours(gti) if gtl is not None: unknown_labels = set(np.unique(gti[gtl == 65])) else: unknown_labels = set() known_labels = set(grouped_contours.keys()) - unk...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_tif():\n parameters = {'path': 'green-dot.tif'}\n\n img = images.load(parameters)\n\n numpy.testing.assert_array_equal(img[10, 5], [0, 255, 0])", "def test_save_tif():\n img = Image.new('RGB', (10, 20))\n\n parameters = {'path': 'green-dot.tif', 'data': [img]}\n\n assert images.sa...
[ "0.7076391", "0.6545913", "0.64205337", "0.6392171", "0.63680726", "0.6344497", "0.6018894", "0.6004421", "0.5993268", "0.5986748", "0.5969459", "0.59548044", "0.5954693", "0.59082866", "0.58946025", "0.58738846", "0.5857484", "0.5810171", "0.5803431", "0.5800404", "0.5785079...
0.0
-1
compute ROUGEN for a single pair of summary and reference
def compute_rouge_n(output, reference, n=1, mode='f'): assert mode in list('fpr') # F-1, precision, recall match = _n_gram_match(reference, output, n) if match == 0: score = 0.0 else: precision = match / len(list(make_n_grams(output, n))) recall = match / len(list(make_n_grams(r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rouge(ref_file, summarization_file, subword_option=None):\n\n references = []\n with codecs.getreader(\"utf-8\")(tf.gfile.GFile(ref_file, \"rb\")) as fh:\n for line in fh:\n references.append(_clean(line, subword_option))\n\n hypotheses = []\n with codecs.getreader(\"utf-8\")(\n tf.gfile.GFil...
[ "0.59994656", "0.580792", "0.5503322", "0.5481186", "0.5475576", "0.547244", "0.5428628", "0.54162747", "0.5406109", "0.53631014", "0.5319566", "0.5271652", "0.526884", "0.5182089", "0.51223683", "0.5116938", "0.51069325", "0.51056755", "0.50990134", "0.50808424", "0.5057335"...
0.48229542
61
compute the len dp of lcs
def _lcs_dp(a, b): dp = [[0 for _ in range(0, len(b) + 1)] for _ in range(0, len(a) + 1)] # dp[i][j]: lcs_len(a[:i], b[:j]) for i in range(1, len(a) + 1): for j in range(1, len(b) + 1): if a[i - 1] == b[j - 1]: dp[i][j] = dp[i - 1][j - 1] + 1 else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _lcs_len(a, b):\n dp = _lcs_dp(a, b)\n return dp[-1][-1]", "def _len_lcs(x, y):\n table = _lcs(x, y)\n n, m = len(x), len(y)\n return table[n, m]", "def _len_lcs(x, y):\n table = _lcs(x, y)\n n, m = len(x), len(y)\n return table[n, m]", "def _len_lcs(x, y):\n table = _lcs(x, y)\n n, m =...
[ "0.7369952", "0.72339016", "0.72339016", "0.7178741", "0.66930044", "0.65075463", "0.6326829", "0.6310558", "0.6306825", "0.6279071", "0.6263366", "0.62361485", "0.62065816", "0.61543864", "0.61426204", "0.61426204", "0.6130789", "0.6125237", "0.610565", "0.6093229", "0.60821...
0.7251978
1
compute the length of longest common subsequence between a and b
def _lcs_len(a, b): dp = _lcs_dp(a, b) return dp[-1][-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longestCommonSubsequence(self, text1: str, text2: str) -> int:\n if len(text1) == 0 or len(text2) == 0:\n return 0\n if text1[0] == text2[0]:\n return 1 + self.longestCommonSubsequence(text1[1:], text2[1:])\n else:\n return max(self.longestCommonSubsequence...
[ "0.77036387", "0.7551531", "0.7479743", "0.74269044", "0.74152994", "0.739756", "0.7195203", "0.71844494", "0.70629114", "0.7058059", "0.7053145", "0.7036421", "0.69795805", "0.69477475", "0.69437826", "0.69384384", "0.6936886", "0.69272065", "0.6915973", "0.68329513", "0.680...
0.7914411
0
compute ROUGEL for a single pair of summary and reference output, reference are list of words
def compute_rouge_l(output, reference, mode='f'): assert mode in list('fpr') # F-1, precision, recall lcs = _lcs_len(output, reference) if lcs == 0: score = 0.0 else: precision = lcs / len(output) recall = lcs / len(reference) f_score = 2 * (precision * recall) / (precis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rouge(ref_file, summarization_file, subword_option=None):\n\n references = []\n with codecs.getreader(\"utf-8\")(tf.gfile.GFile(ref_file, \"rb\")) as fh:\n for line in fh:\n references.append(_clean(line, subword_option))\n\n hypotheses = []\n with codecs.getreader(\"utf-8\")(\n tf.gfile.GFil...
[ "0.68512774", "0.6794853", "0.6781679", "0.6636516", "0.6634663", "0.6033136", "0.60246843", "0.5999753", "0.591893", "0.5897353", "0.5897353", "0.58255905", "0.578991", "0.5759897", "0.57576495", "0.566979", "0.5570331", "0.5539233", "0.55027527", "0.5498804", "0.54661024", ...
0.62309587
5
Takes self.url (for a general MyLife search), scrapes the site data, and adds it to the self.data_from_website DataFrame. MyLife keeps its full data set on the page for the specific record, so self._gather_deep_data() can be used to pull that deeper data.
def get_data(self): def _clean_search_hit(search_hit): """ Takes in a search result hit as a BeautifySoup tag and pulls out all the data to match the desired schema. :param search_hit: :return Dictionary: A dictionary with the cleaned data """ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gather_deep_data(self):\n\n cleaned_data_from_website = list()\n\n for i, search_result in self.data_from_website.iterrows():\n cleaned_data_from_website.append(self._deep_data(search_result.url))\n\n cleaned_data_from_website = pd.DataFrame(cleaned_data_from_website)\n ...
[ "0.734057", "0.6615082", "0.649611", "0.6229477", "0.62144905", "0.61352277", "0.60608697", "0.59864897", "0.58287615", "0.5696052", "0.56581056", "0.56528085", "0.56447047", "0.5644577", "0.5631243", "0.5629284", "0.55869025", "0.5567835", "0.5558714", "0.55327916", "0.55251...
0.5811679
9
Takes in a search result hit as a BeautifySoup tag and pulls out all the data to match the desired schema.
def _clean_search_hit(search_hit): hit_name = search_hit.find(class_='hit-name') hit_url = hit_name.get('href') hit_id = hit_url.split('/')[-1] name = hit_name.get_text().split(',')[0].title().split() current_city = search_hit.find(class_='hit-location').get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(self):\n def _clean_search_hit(search_hit):\n \"\"\"\n Takes in a search result hit as a BeautifySoup tag and pulls out all the data to match the desired schema.\n\n :param search_hit:\n :return Dictionary: A dictionary with the cleaned data\n ...
[ "0.7068637", "0.6284706", "0.6284706", "0.6060897", "0.60550624", "0.59880733", "0.580835", "0.57218945", "0.5721135", "0.5691528", "0.5633391", "0.5621051", "0.56149995", "0.557798", "0.5557854", "0.5551034", "0.5529365", "0.55274594", "0.5495556", "0.5424936", "0.5424492", ...
0.5892267
6
Takes a list of WebElements and a search string, looks for string in the text of each WebElement, and press the option if found. Returns Boolean for found status
def _refine_search(search_str, options): search_str = search_str.upper() logging.info(f'Looking for \'{search_str}\'') try: for option in options: option_text = option.text.upper() logging.info(f'Option Checked: {option_text}') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_search(self):\n html_element = self.find_element_by_xpath(\n '/html/body').get_attribute('outerHTML')\n soup = Scraper(html_element)\n\n elms_obj = soup.find_search_enable_btn()\n\n for tag, target in elms_obj.items():\n if len(target) > 0:\n ...
[ "0.6565995", "0.6007825", "0.5899171", "0.588052", "0.58556384", "0.5773957", "0.5702507", "0.5661538", "0.56134385", "0.5523983", "0.5489346", "0.5425644", "0.5402936", "0.53933203", "0.5385448", "0.5371235", "0.53526896", "0.53496426", "0.53259146", "0.53237027", "0.5322532...
0.74813646
0
Takes a URL for a specific MyLife record, scrapes the JSON data and returns a dictionary.
def _deep_data(self, url): def _nested_persons(persons): _persons = list() for person_ in persons: person_ = [r.text.split(', ') for r in person_.find_all(class_='default-text')] person = {'name': person_[0][0].title()} if len(person_[0]) =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetchJson(url):", "def Access_URL(url): \n r = requests.get(url) \n json = r.json() \n return json", "async def fetch_data(self, url: str) -> dict:\n async with self.bot.http_session.get(url) as r:\n return await r.json()", "def find_details_json(self, url):\n respons...
[ "0.6364494", "0.62634754", "0.5954379", "0.58847296", "0.58285487", "0.57935375", "0.5754346", "0.57019734", "0.56669426", "0.56618446", "0.5656705", "0.565219", "0.5648498", "0.5584223", "0.5552247", "0.5552037", "0.5542149", "0.5536617", "0.5501606", "0.54985535", "0.549855...
0.53848726
36
Gathers the data that is deeper within the website by calling self._deep_data(url) for each record found during the general search in self.get_data()
def _gather_deep_data(self): cleaned_data_from_website = list() for i, search_result in self.data_from_website.iterrows(): cleaned_data_from_website.append(self._deep_data(search_result.url)) cleaned_data_from_website = pd.DataFrame(cleaned_data_from_website) if len(cleane...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _deep_data(self, url):\n def _nested_persons(persons):\n _persons = list()\n for person_ in persons:\n person_ = [r.text.split(', ') for r in person_.find_all(class_='default-text')]\n person = {'name': person_[0][0].title()}\n if len(pe...
[ "0.6764181", "0.6504204", "0.6407108", "0.6405198", "0.6028385", "0.6017134", "0.60075647", "0.5994258", "0.5978083", "0.59313196", "0.588016", "0.5875708", "0.58599573", "0.58480936", "0.5798911", "0.57943964", "0.5777602", "0.57580256", "0.5734268", "0.5704545", "0.5704199"...
0.7611993
0
Attempts to find the github config file.
def _github_config(self, config_file_name): home = os.path.abspath(os.environ.get('HOME', '')) config_file_path = os.path.join(home, config_file_name) return config_file_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _findconfigfile():\n\n # A ordered list of possible config files\n configfiles = [\"~/.githubhooksrc\",\n \"/etc/githubhooks\"]\n\n for configfile in configfiles:\n if os.path.isfile(os.path.expanduser(configfile)):\n return os.path.expanduser(configfile)\n\n # N...
[ "0.78150916", "0.7267893", "0.6513972", "0.64564544", "0.64560837", "0.640976", "0.63672173", "0.62919074", "0.6254891", "0.6234435", "0.62150365", "0.6196737", "0.6164332", "0.614716", "0.61321723", "0.61281306", "0.60862803", "0.606665", "0.60641634", "0.6059604", "0.605909...
0.7761752
1
Callback if two factor authentication is requested.
def _two_factor_code(self): code = '' while not code: code = input('Enter 2FA code: ') return code
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_two_factor_authentication(self) -> pulumi.Output[bool]:\n return pulumi.get(self, \"require_two_factor_authentication\")", "def require_two_factor_authentication(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"require_two_factor_authentication\")", "def require_two_...
[ "0.6953113", "0.67109174", "0.67109174", "0.647221", "0.62050366", "0.61577046", "0.60967463", "0.6010912", "0.5951027", "0.58988005", "0.5897524", "0.58657104", "0.58193564", "0.5797635", "0.57952434", "0.5794757", "0.57754326", "0.57652265", "0.5760432", "0.574998", "0.5741...
0.0
-1
Take a URL, generate a unique filename, save the image to said file and return the filename.
def save_image(url): ext = url.split('.')[-1] filename = IMAGEDIR+os.sep+hashlib.md5(url.encode('utf-8')).hexdigest()+'.'+ext if os.path.exists(filename): return filename try: content = urlopen(url).read() f = open(filename,'wb') f.write(content) f.close() ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_image(filename: str, img_url: str) -> None:\n\n if not (os.path.isfile(filename)): # Check if the file already exists\n print('Downloading image {}...'.format(img_url))\n res = requests.get(img_url) # Download the image.\n res.ra...
[ "0.7339656", "0.72139686", "0.7092204", "0.7006235", "0.69701207", "0.68517417", "0.6776711", "0.67724454", "0.6753113", "0.6721219", "0.6714699", "0.67063594", "0.66669434", "0.6656108", "0.6643168", "0.66106606", "0.65638", "0.6506329", "0.6501225", "0.6394256", "0.63756764...
0.8284375
0
Scrape an input scamdiggers page for the profile content of the scammer.
def scrape_profile(inhandle, outfile, year, month): #Read file html = inhandle.read() soup = BeautifulSoup(html, 'html.parser') #Find main page content content = soup.find('div', {'class':'entry-content'}) profile = {} #Fill in known info from URL profile['year_reported'] = year profile['month_repo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape(self):\n pass", "def _scrape(self):", "def scrape(self, page_src):\n soup = bs(page_src, 'html.parser')\n self._data = soup.text.split()", "def page_data():\n return scrape()", "def profiles_search(pages: list, session: requests.Session):\n result = []\n for page in...
[ "0.636905", "0.60857433", "0.5832773", "0.5770994", "0.56837744", "0.55691594", "0.5531926", "0.54199207", "0.53520995", "0.5347733", "0.52559036", "0.52416384", "0.5236958", "0.52313113", "0.5225", "0.52243483", "0.5221377", "0.5184076", "0.515028", "0.51449376", "0.51292944...
0.502299
28
Extract all the profile page links from this index page.
def enumerate_profiles(inhandle, page): html = inhandle.read() soup = BeautifulSoup(html, 'html.parser') urls = [ node.find('a')['href'] for node in soup.findAll('h1', {'class':'entry-title'})] return urls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profiles_search(pages: list, session: requests.Session):\n result = []\n for page in pages:\n sleep(1)\n soup = BeautifulSoup(session.get(page).text, \"lxml\")\n table = soup.find(\"table\", class_=\"seaman-list-table va-top seaman-list-table-2\")\n for rows in table.find_all(...
[ "0.5955885", "0.5873089", "0.58373713", "0.5822768", "0.5612937", "0.5595032", "0.55749434", "0.55528224", "0.55278695", "0.55123425", "0.5501893", "0.5496583", "0.5495312", "0.5468743", "0.54336965", "0.54304", "0.54241014", "0.54207915", "0.5416719", "0.539653", "0.5382196"...
0.68228364
0
Walk the index pages, harvesting the profile URLs, and then download and process all the profiles stored under this year and month.
def gather_all_profiles(year, month): page = 1 urls = [] print("{}-{} : Begin indexing.".format(year, month)) while (page > 0): urlstring = "http://scamdigger.com/{}/{}/page/{}".format(year,month,page) jitter = random.choice([0,1]) try: urlhandle = urlopen(urlstring) urls += enumer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape(startyear, startmonth, endyear, endmonth):\n year = startyear\n month = startmonth\n while (not (year == endyear and month == endmonth)):\n ys = \"{}\".format(year)\n ms = \"{:02d}\".format(month)\n gather_all_profiles(ys,ms) \n if month == 12:\n year += 1\n month = 0\n month...
[ "0.64442813", "0.62138397", "0.58489907", "0.56789356", "0.5665456", "0.56577927", "0.5597599", "0.55777854", "0.5560226", "0.5555722", "0.55447924", "0.55403745", "0.552134", "0.5456203", "0.5386207", "0.53852963", "0.5349402", "0.53458893", "0.5320046", "0.52948135", "0.529...
0.795587
0
Walk the database through the defined ranges, downloading everything.
def scrape(startyear, startmonth, endyear, endmonth): year = startyear month = startmonth while (not (year == endyear and month == endmonth)): ys = "{}".format(year) ms = "{:02d}".format(month) gather_all_profiles(ys,ms) if month == 12: year += 1 month = 0 month += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ooni_data(range):\n\n last_ooni_report_generated = get_sys_info(request='last_ooni_report_generated', update=True)\n\n configs = get_configs()\n bucket = 'ooni-data-eu-fra'\n \n session = boto3.Session(profile_name=configs['profile'])\n client = session.client('s3')\n \n #get date r...
[ "0.6517533", "0.61506337", "0.611892", "0.6087091", "0.5753793", "0.57496923", "0.57288957", "0.5696095", "0.56846505", "0.55612725", "0.553414", "0.55322355", "0.5489378", "0.545357", "0.5439448", "0.5427855", "0.54234684", "0.54192215", "0.54063314", "0.5394056", "0.5371635...
0.0
-1
Tests if the constructor handles JSON correctly. That is, set the content of each language to the value given in the serialized JSON.
def test_constructor_serialized_json(self): content = json.dumps({ "nb": "test-nb", "en": "test-en", }) structure = MultiLingualTextStructure(content, use_default_for_empty=True) self.assertEqual(structure["nb"], "test-nb") self.assertEqual(structure["en"]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_json(self, inputfile):\n transtransfile = json.load(inputfile)\n self.language = transfile['lang']\n self.translations = transfile['strings']", "def __init__(self, langConf: str) -> None:\n with open(r\"localization\\localization.json\", \"rt\", encoding=\"utf-8\") as lang:\n ...
[ "0.6162473", "0.60640824", "0.59679496", "0.5962652", "0.59325093", "0.5919701", "0.5907977", "0.5876794", "0.5847541", "0.5780988", "0.5777279", "0.57638365", "0.57590663", "0.57392234", "0.56996155", "0.5672908", "0.5637319", "0.5626917", "0.56231356", "0.5613871", "0.55942...
0.73586935
0
Tests if the constructor handles corrupt data (i.e. a string) correctly. That is, set the content of the default language to this string.
def test_constructor_string(self): structure = MultiLingualTextStructure("test-nb", use_default_for_empty=True) self.assertEqual(structure["nb"], "test-nb") self.assertEqual(structure["en"], "test-nb")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lang_init():\n _locale, _encoding = locale.getdefaultlocale() # Default system values\n path = os.path.join(os.path.dirname(sys.argv[0]), 'localization/lang')\n if os.path.exists(path):\n lang = gettext.translation('UnrulyPuzzlePython', path, [_locale],\n fall...
[ "0.5990697", "0.59643537", "0.58305866", "0.58138573", "0.57625884", "0.5755355", "0.5742913", "0.56937104", "0.5680758", "0.5666587", "0.5589061", "0.5564959", "0.5558148", "0.54922247", "0.54866093", "0.54540205", "0.5452537", "0.5439756", "0.5436664", "0.54336536", "0.5420...
0.55438876
13
Tests if the constructor handles the ``None`` value correctly. That is, the same as if the structure is empty.
def test_constructor_None(self): structure = MultiLingualTextStructure(None, use_default_for_empty=True) self.assertEqual(structure["nb"], "") self.assertEqual(structure["en"], "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_none(self) -> PossibleResult[T]:\n if self.constructor == type(None):\n if not self.obj is None:\n raise DeserializeError(\n type(None), self.obj, self.new_depth, self.key\n )\n return self.obj # type: ignore\n return ...
[ "0.7914818", "0.72811294", "0.7015134", "0.68750614", "0.68750614", "0.68750614", "0.68750614", "0.68750614", "0.6769645", "0.67520285", "0.67520285", "0.67520285", "0.67520285", "0.67520285", "0.6728802", "0.671539", "0.6699236", "0.6644656", "0.6633402", "0.6633402", "0.659...
0.70171434
2
Tests the ``__str__()`` method. It should return the value of the current language of the thread.
def test_str(self): previous_language = translation.get_language() content = json.dumps({ "nb": "test-nb", "en": "test-en", }) structure = MultiLingualTextStructure(content, use_default_for_empty=True) translation.activate("nb") self.assertEqual(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unicode(self):\n thread = mommy.prepare('connectmessages.Thread')\n self.assertEqual(str(thread), \"Thread %s\" % thread.subject)", "def test_i18n11(self):\n output = self.engine.render_to_string('i18n11', {'bool': True})\n self.assertEqual(output, 'ja')", "def language(sel...
[ "0.63634586", "0.59879065", "0.5887455", "0.5887455", "0.5860573", "0.5837954", "0.58233184", "0.5784177", "0.5774993", "0.57586485", "0.5745439", "0.5724829", "0.5685965", "0.56742054", "0.56568784", "0.56481004", "0.56409115", "0.5639232", "0.5605423", "0.56049037", "0.5604...
0.6393691
0
Tests if the builtin set item function is correctly overwritten, so that we can set the value of a language in the array syntax way.
def test_set_item(self): content = json.dumps({ "nb": "test-nb", "en": "test-en", }) structure = MultiLingualTextStructure(content, use_default_for_empty=True) self.assertEqual(structure["nb"], "test-nb") self.assertEqual(structure["en"], "test-en") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setitem__(self, *args, **kwargs): # real signature unknown\n pass", "def __setitem__(self, *args, **kwargs): # real signature unknown\n pass", "def __setitem__(self, *args, **kwargs): # real signature unknown\n pass", "def __setitem__(self, *args, **kwargs): # real signature unknow...
[ "0.5940166", "0.5940166", "0.5940166", "0.5940166", "0.5866111", "0.58568", "0.57745904", "0.5762412", "0.5742872", "0.5731247", "0.5723469", "0.5625247", "0.55334586", "0.55304945", "0.55180305", "0.5504036", "0.5472391", "0.5472391", "0.5472391", "0.5463017", "0.5438905", ...
0.53934044
21
Tests the ``to_python()`` method. It should return ``None`` (if ``None`` given), the object if ``MultiLingualTextStructure``, or the object converted to ``MultiLingualTextStructure`` otherwise.
def test_to_python(self): field = MultiLingualTextField() self.assertEqual(None, field.to_python(None), "to_python of None should always return None.") content = json.dumps({ "nb": "test-nb", "en": "test-en", }) structure = MultiLingualTextStructure(cont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_from_db_value(self):\n field = MultiLingualTextField()\n\n result_none = field.from_db_value(None, None, None)\n self.assertEqual(MultiLingualTextStructure, type(result_none),\n \"from_db_value should always be of type MultiLingualTextStructure\")\n self...
[ "0.57009166", "0.56299824", "0.55680037", "0.5488348", "0.5338049", "0.53207386", "0.5283834", "0.51322764", "0.5092174", "0.50363445", "0.5033038", "0.502039", "0.4997337", "0.49939436", "0.49646625", "0.4963914", "0.4873973", "0.4870973", "0.48417282", "0.48417282", "0.4840...
0.8195778
0
Tests the ``get_prep_value()`` method. This should return ``None`` (if ``None`` given), serialized JSON of its content if ``MultiLingualTextStructure`` is given, or just the value otherwise.
def test_get_prep_value(self): field = MultiLingualTextField() self.assertEqual(None, field.get_prep_value(None), "get_prep_value of None should always return None.") content = { "nb": "test-nb", "en": "test-en", } structure = MultiLingualTextStructure(js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_from_db_value(self):\n field = MultiLingualTextField()\n\n result_none = field.from_db_value(None, None, None)\n self.assertEqual(MultiLingualTextStructure, type(result_none),\n \"from_db_value should always be of type MultiLingualTextStructure\")\n self...
[ "0.66328865", "0.6586675", "0.64637977", "0.6134948", "0.610983", "0.606463", "0.6057703", "0.60523206", "0.60322195", "0.60241705", "0.59964967", "0.58020043", "0.5756462", "0.575159", "0.5704311", "0.566441", "0.56615865", "0.5536008", "0.5517607", "0.5486199", "0.54026115"...
0.835836
0
Tests the ``from_db_value()`` method. Which should always return a ``MultiLingualTextStructure``.
def test_from_db_value(self): field = MultiLingualTextField() result_none = field.from_db_value(None, None, None) self.assertEqual(MultiLingualTextStructure, type(result_none), "from_db_value should always be of type MultiLingualTextStructure") self.assertEqual(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_to_python(self):\n field = MultiLingualTextField()\n self.assertEqual(None, field.to_python(None), \"to_python of None should always return None.\")\n\n content = json.dumps({\n \"nb\": \"test-nb\",\n \"en\": \"test-en\",\n })\n\n structure = MultiL...
[ "0.66070205", "0.65070033", "0.5828789", "0.5672591", "0.55029804", "0.5491402", "0.5434026", "0.53811914", "0.5304458", "0.5277097", "0.5271622", "0.52714705", "0.526597", "0.52633446", "0.52534556", "0.5252944", "0.5239474", "0.52332056", "0.52197295", "0.5208889", "0.51865...
0.8323718
0
Tests the ``compress()`` method. We can assume that the data passed is valid data, as the data is cleaned for each individual field before being passed to the method.
def test_compress(self): form_field = MultiLingualFormField() compressed_data = form_field.compress(["test-nb", "test-en"]) self.assertEqual(MultiLingualTextStructure, type(compressed_data)) self.assertEqual(compressed_data['nb'], "test-nb") self.assertEqual(compressed_data['en']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compress():\n print('Testing compress')\n\n # Cases given to test this problem\n assert_equals('c1o17l1k1a1n1g1a1r1o2',\n hw1.compress('cooooooooooooooooolkangaroo'))\n assert_equals('a3', hw1.compress('aaa'))\n assert_equals('', hw1.compress(''))\n\n # Additional cases ...
[ "0.7139627", "0.66479385", "0.6284567", "0.62130433", "0.60791487", "0.5939703", "0.5841159", "0.5840814", "0.5834568", "0.5802215", "0.57965", "0.57555175", "0.5736981", "0.5707062", "0.56178164", "0.56031865", "0.55972594", "0.5589935", "0.555559", "0.5528295", "0.54627", ...
0.7089348
1
Recursively takes a selfnested list and returns an HTML unordered list WITHOUT opening and closing tags. The list is assumed to be in the proper format. For example, if ``var``
def format_threaded_comments(value, user_voting_data, autoescape=None): if autoescape: escaper = conditional_escape else: escaper = lambda x: x def convert_old_style_list(list_): """ Converts old style lists to the new easier to understand format. The old list forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_unordered_list(items):\n if not items:\n return \"\"\n\n inner = \"\".join(map(html_list_item, items))\n if inner == \"\":\n return \"\"\n\n return \"<ul>\\n\" + inner + \"</ul>\\n\"", "def _parse_list(tag):\r\n\r\n if tag.name == 'ul':\r\n return [_parse_list(item)\r...
[ "0.6655576", "0.63954276", "0.6111492", "0.59855485", "0.59621733", "0.5900856", "0.5793081", "0.5792448", "0.5735775", "0.5710147", "0.5704236", "0.55589944", "0.5539719", "0.5525168", "0.54968905", "0.5493789", "0.545797", "0.54529655", "0.54428005", "0.54400045", "0.543891...
0.50926214
52
Converts old style lists to the new easier to understand format.
def convert_old_style_list(list_): if not isinstance(list_, (tuple, list)) or len(list_) != 2: return list_, False first_item, second_item = list_ if second_item == []: return [first_item], True try: # see if second item is iterable iter(se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _list_parser(self, old_list):\n for i, item in enumerate(old_list):\n if isinstance(item, dict):\n old_list[i] = Yaco(item)\n elif isinstance(item, list):\n old_list[i] = self._list_parser(item)\n else:\n pass\n return ...
[ "0.6803961", "0.67613524", "0.6736399", "0.65787864", "0.6547683", "0.63027596", "0.6184645", "0.61626476", "0.6118478", "0.5990201", "0.5983553", "0.5979835", "0.58792496", "0.58595496", "0.5827031", "0.5819523", "0.5810015", "0.58020484", "0.58003056", "0.57974803", "0.5787...
0.6782985
1
Logs into an OpenShift server and returns the user's token.
def login(host, port, username, password): headers = {'X-Csrf-Token': '1'} host = "https://{}:{}".format(host, port) url = urlparse.urljoin(host, AUTH_PATH) auth = requests.auth.HTTPBasicAuth(username, password) response = requests.get(url, verify=False, headers=headers, auth=auth) parsed_url...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login_user(self):\n response = self.client.post(self.login_url, self.login_data, format='json')\n return response.data['token']", "def login(self):\n r = self._login_token()", "def login(self):\n # create auth payload\n payload = '{{\"grant_type\": \"password\", \"usernam...
[ "0.69959384", "0.6738701", "0.6573574", "0.65415555", "0.6456356", "0.64514875", "0.6373826", "0.635158", "0.63260525", "0.63119733", "0.630883", "0.627969", "0.6261839", "0.6261262", "0.6233389", "0.62330043", "0.62210727", "0.6188914", "0.6188914", "0.6164583", "0.6160506",...
0.0
-1
initializes the neural net
def __init__(self, layer_neuron): self.num_layers = len(layer_neuron) self.layer_neuron = layer_neuron #a list of numpy ndarrays self.weights = [] self.input_len = 0 self.target_vals = [] self.current_guess = 0 self.layer_inputs = [[]]*(len(layer_neuron)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init():\n global neural_network\n global labels\n\n # load objects required by run() for inferencing\n model_dir = Model.get_model_path(\"mnist-fashion\")\n # neural model\n neural_network = keras.models.load_model(f\"{model_dir}/neural-network.h5\")\n # labels\n with open(f\"{model_dir...
[ "0.7754835", "0.7486194", "0.73951536", "0.7314419", "0.7302831", "0.7238307", "0.72338986", "0.7233569", "0.72288126", "0.7175292", "0.716469", "0.71524554", "0.7140224", "0.71354145", "0.7134994", "0.71149826", "0.7084607", "0.70751315", "0.7072266", "0.7027148", "0.7013910...
0.65654284
100
connection to server and whit to the client
def Connection(self): try: system( f'netsh advfirewall firewall add rule name="Open Port {self.PORT}" dir=in action=allow protocol=TCP localport={self.PORT} remoteip={self.HOST}') with socket() as s: # Create a socket object print('Server started!') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connectToServer(self):\n self.client = Client(base_url = self.server)\n self.ping()", "def client():", "def server(conn, address):\n print(\"Client Connection Open\")\n while True:\n request = server_read(conn)\n if request:\n print(request)\n manage_...
[ "0.7488699", "0.724132", "0.7116576", "0.70362324", "0.70091325", "0.69784814", "0.69784814", "0.6926734", "0.6908382", "0.6864912", "0.68283075", "0.68283075", "0.6800894", "0.6781671", "0.6744749", "0.67159367", "0.67054135", "0.66798097", "0.6676666", "0.6641176", "0.66130...
0.6269943
66
sending a message to the client
def Send(self, stringSend): self.c.send(stringSend.encode())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self, msg: str):\n\t\tself.client.send(msg.encode())", "def send(self, message):\n pass", "def send(msg): # event is passed by binders.\n # print(\"i sended: \" + msg)\n msg = msg + \";\"\n client_socket.send(bytes(msg, \"utf8\"))", "def send(self, msg):\n pass", "def send(...
[ "0.82234496", "0.8153046", "0.8039892", "0.8027347", "0.8027347", "0.8027347", "0.80146086", "0.8005253", "0.79704624", "0.79648054", "0.7961565", "0.7955438", "0.7953542", "0.78614396", "0.78362805", "0.78337246", "0.78175944", "0.7806808", "0.77658594", "0.77483255", "0.774...
0.0
-1
getting message from the client
def Recv(self): return self.c.recv(RECV_SIZE).decode('UTF-8')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message():\n\tincoming_message = conn.recv(1024)\n\tincoming_message = incoming_message.decode()\n\treturn incoming_message", "def get_message(self):\n client_message = self.connection_with_client.recv(1024)\n client_message_decoded = client_message.decode()\n\n if \"quit\" in client...
[ "0.77370644", "0.77175355", "0.7423818", "0.7406984", "0.72665787", "0.7243788", "0.72275466", "0.7224105", "0.722228", "0.7163119", "0.7163119", "0.7122896", "0.711274", "0.7047482", "0.70223814", "0.7017876", "0.69941616", "0.69934946", "0.69835466", "0.6960825", "0.6960825...
0.0
-1
DestinyDefinitionsDestinyItemPreviewBlockDefinition a model defined in Swagger
def __init__(self, preview_vendor_hash=None, preview_action_string=None, derived_item_categories=None): # noqa: E501 # noqa: E501 self._preview_vendor_hash = None self._preview_action_string = None self._derived_item_categories = None self.discriminator = None if preview_vend...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_definition(self, block_type, slug=None):\n raise NotImplementedError()", "def mock_deposit(obj, overwrite, **kwargs):\n return Preview(source_id=obj.source_id,\n checksum=obj.checksum,\n metadata=Metadata(added=added,\n ...
[ "0.5170593", "0.500709", "0.49913558", "0.49265093", "0.4903068", "0.48698387", "0.48586363", "0.48017275", "0.47947973", "0.47871843", "0.4782398", "0.47822326", "0.47781777", "0.47469652", "0.4729438", "0.4692864", "0.46779555", "0.46296787", "0.46135998", "0.46099576", "0....
0.0
-1
Sets the preview_vendor_hash of this DestinyDefinitionsDestinyItemPreviewBlockDefinition.
def preview_vendor_hash(self, preview_vendor_hash): self._preview_vendor_hash = preview_vendor_hash
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vendor_reference(self, vendor_reference):\n\n self._vendor_reference = vendor_reference", "def vendor(self, vendor):\n\n self._vendor = vendor", "def __init__(self, preview_vendor_hash=None, preview_action_string=None, derived_item_categories=None): # noqa: E501 # noqa: E501\n\n self...
[ "0.54515517", "0.49631733", "0.4793878", "0.469866", "0.45657286", "0.43995756", "0.43969625", "0.43132776", "0.4206586", "0.41582528", "0.41371256", "0.41370988", "0.41018575", "0.40580624", "0.40572527", "0.40495327", "0.40088585", "0.40035468", "0.399779", "0.39702928", "0...
0.8130399
0
Sets the preview_action_string of this DestinyDefinitionsDestinyItemPreviewBlockDefinition.
def preview_action_string(self, preview_action_string): self._preview_action_string = preview_action_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_previewable(self, previewable):\n self._is_previewable = bool(previewable)", "def __previewEditor(self, checked):\n Preferences.setUI(\"ShowFilePreview\", checked)\n self.previewStateChanged.emit(checked)", "def __init__(self, preview_vendor_hash=None, preview_action_string=None, d...
[ "0.49170393", "0.48936027", "0.48737937", "0.46655303", "0.45847452", "0.45847452", "0.44724616", "0.44220495", "0.44209763", "0.44209763", "0.44209763", "0.44209763", "0.44209763", "0.44209763", "0.4420819", "0.43746156", "0.43392828", "0.42996767", "0.4286542", "0.4258411", ...
0.8190341
0
Sets the derived_item_categories of this DestinyDefinitionsDestinyItemPreviewBlockDefinition.
def derived_item_categories(self, derived_item_categories): self._derived_item_categories = derived_item_categories
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories(self, categories):\n self._categories = categories", "def fill_tab_categories(self):\n self.category.fill_tab_categories(self.list_categories, self.mycursor, self.my_database)", "def on_category(self):\n super(ToolSettings, self).on_category()\n selItems = self.tw_cat...
[ "0.42504486", "0.41763225", "0.41738588", "0.4147597", "0.4145194", "0.41436017", "0.41436017", "0.41436017", "0.41436017", "0.41305125", "0.41266572", "0.41144997", "0.40753424", "0.40561587", "0.38878268", "0.38473186", "0.3840825", "0.38260534", "0.38147235", "0.37995836", ...
0.7910564
0
Returns the model properties as a dict
def to_dict(self): result = {} for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return self.properties", "def to_dict(self):\n return self.properties", "def get_properties(self):\n return self.properties", "def asdict(self):\n return self._prop_dict", "def json(self):\n rv = {\n prop: getattr(self, prop)\n f...
[ "0.7751993", "0.7751993", "0.73391134", "0.7334895", "0.7297356", "0.727818", "0.7159078", "0.71578115", "0.71494967", "0.71494967", "0.71283495", "0.71275014", "0.7122587", "0.71079814", "0.7060394", "0.7043251", "0.7034103", "0.70233124", "0.69635814", "0.69586295", "0.6900...
0.0
-1
Returns the string representation of the model
def to_str(self): return pprint.pformat(self.to_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self) -> str:\n # noinspection PyUnresolvedReferences\n opts = self._meta\n if self.name_field:\n result = str(opts.get_field(self.name_field).value_from_object(self))\n else:\n ...
[ "0.8585799", "0.7814791", "0.77903897", "0.7750947", "0.7750947", "0.7713712", "0.7699211", "0.76708376", "0.76511395", "0.7601015", "0.75830185", "0.7570755", "0.7540716", "0.7523477", "0.75169474", "0.7501407", "0.7487798", "0.7487798", "0.7470098", "0.74518627", "0.7446157...
0.0
-1
For `print` and `pprint`
def __repr__(self): return self.to_str()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pprint(*args, **kwargs):\n if PRINTING:\n print(*args, **kwargs)", "def print_out():\n pass", "def custom_print(*objects):\n print(*objects, sep=OFS, end=ORS)", "def _print(self, *args):\n return _ida_hexrays.vd_printer_t__print(self, *args)", "def _printable(self):\n ...
[ "0.75577617", "0.73375154", "0.6986672", "0.698475", "0.6944995", "0.692333", "0.6899106", "0.6898902", "0.68146646", "0.6806209", "0.6753795", "0.67497987", "0.6744008", "0.6700308", "0.6691256", "0.6674591", "0.6658083", "0.66091245", "0.6606931", "0.6601862", "0.6563738", ...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, DestinyDefinitionsDestinyItemPreviewBlockDefinition): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Return list of recIDs matching query for PVALUE and FVALUE.
def get_recids_matching_query(pvalue, fvalue): rec_id = list(search_pattern(p=pvalue, f=fvalue, m='e') - INTBITSET_OF_DELETED_RECORDS) return rec_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_values(self, value):\n return [\n obj for obj in self if obj == value\n ]", "def values(self):\n if '%' in self.starid:\n query = \"\"\"SELECT * from ngc2236 where starid like '%s'\"\"\" % self.starid\n else:\n query = \"\"\"SELECT * from ngc22...
[ "0.5373899", "0.51960784", "0.51567584", "0.5128959", "0.5087617", "0.50727177", "0.49959168", "0.49717903", "0.49696368", "0.49286002", "0.49211693", "0.4917529", "0.48955002", "0.48827276", "0.48814398", "0.48741", "0.48672736", "0.4864506", "0.48131928", "0.48071274", "0.4...
0.7764384
0
return a dictionary which is used by bibrank daemon for generating the index of sorted research results by citation information
def get_citation_weight(rank_method_code, config): begin_time = time.time() last_update_time = get_bibrankmethod_lastupdate(rank_method_code) if task_get_option("quick") == "no": last_update_time = "0000-00-00 00:00:00" write_message("running thorough indexing since quick option not used", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_dict(results, chunk):\n from math import inf\n from collections import defaultdict\n chunk = [int(au) for au in chunk]\n d = defaultdict(\n lambda: {\"first_year\": inf, \"pubs\": set(), \"coauth\": set(),\n \"n_coauth\": inf, \"n_pubs\": inf})\n for pub in results:\...
[ "0.615179", "0.5961631", "0.59024155", "0.58764994", "0.5853894", "0.5837746", "0.5777888", "0.573996", "0.573696", "0.5724125", "0.5716872", "0.56960845", "0.5678323", "0.5668764", "0.56393546", "0.5624318", "0.5615255", "0.5601827", "0.5591958", "0.55661815", "0.55574524", ...
0.55858314
19
return the last excution date of bibrank method
def get_bibrankmethod_lastupdate(rank_method_code): query = """select last_updated from rnkMETHOD where name ='%s'""" % rank_method_code last_update_time = run_sql(query) r = last_update_time[0][0] if r is None: return "0000-00-00 00:00:00" return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lastdate(self):\n if hasattr(self, \"_lastdate\"):\n return self._lastdate\n else:\n return None", "def _format_last_br_date(self, data):\n raise NotImplementedError", "def _get_eur_gbp_last_daily(self) -> None:\n data = _get_ecb_data(FREQUENCY_DAILY, _ten_...
[ "0.62563515", "0.6135235", "0.5993334", "0.59568703", "0.58971405", "0.5813312", "0.58071977", "0.57964516", "0.577513", "0.576336", "0.5753354", "0.57206935", "0.5710407", "0.5695503", "0.56912684", "0.56911653", "0.56623274", "0.5656828", "0.56515944", "0.5618803", "0.56027...
0.6489557
0
return the list of recods which have been modified after the last exec of bibrank method. The result is expected to have ascending num order.
def get_last_modified_rec(bibrank_method_lastupdate): query = """SELECT id FROM bibrec WHERE modification_date >= '%s' """ % bibrank_method_lastupdate query += "order by id ASC" ilist = run_sql(query) return ilist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateResorts(self):\n self.resorts = []\n for x in self._dfs_non_recursive(self.V):\n pass\n #print(\"visited\", x)", "def getChanges():", "def reset(self) -> List[int]:", "def get_blists(self):\n return self.blists[:]", "def getchangableobslist(self):\n ...
[ "0.5999729", "0.5646804", "0.55687803", "0.55413765", "0.5502476", "0.54501814", "0.54318994", "0.5424124", "0.5380979", "0.53601855", "0.53181535", "0.5303631", "0.52810645", "0.52623254", "0.52623254", "0.52623254", "0.52623254", "0.52623254", "0.52623254", "0.52623254", "0...
0.54004663
8
Create a list of record ids out of RECIDS. The result is expected to have ascending numerical order.
def create_recordid_list(rec_ids): rec_list = [] for row in rec_ids: rec_list.append(row[0]) return rec_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_recordIds(self):\n record_ids = []\n for item in self.order_items:\n record_ids.append(item.get_recordId())\n \n return record_ids", "def get_rsids(input_file: str) -> list:\n\n column_names: list = [\"rsid\", \"chr\"]\n # catching the error if the file do...
[ "0.71660554", "0.6755276", "0.6567358", "0.6502151", "0.6431556", "0.6394535", "0.6390275", "0.6199647", "0.61650753", "0.603711", "0.5996257", "0.5975088", "0.5970256", "0.5936337", "0.5927022", "0.58693117", "0.5824793", "0.58174443", "0.5816194", "0.5816194", "0.58141625",...
0.7744344
0
Creates a tuple of record id from a list of id. The result is expected to have ascending numerical order.
def create_record_tuple(ilist): list_length = len(ilist) if list_length: rec_tuple = '(' for row in list[0:list_length-1]: rec_tuple += str(row) rec_tuple += ',' rec_tuple += str(list[list_length-1]) rec_tuple += ')' else: rec_tuple = '()' return r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_featseltuple(ids):\n newlist = []\n for part_id in ids:\n newlist.extend([part_id, part_id + 91])\n return tuple(sorted(newlist))", "def create_recordid_list(rec_ids):\n rec_list = []\n for row in rec_ids:\n rec_list.append(row[0])\n return rec_list", "def create_id(e...
[ "0.70673424", "0.67906827", "0.6282754", "0.60380954", "0.5777089", "0.577077", "0.56931186", "0.56780326", "0.5641889", "0.5606788", "0.55963814", "0.5531544", "0.55299294", "0.5516861", "0.55163807", "0.5484265", "0.5466873", "0.5397534", "0.53723544", "0.5363456", "0.53095...
0.5790029
4
return the last value of dictionary in rnkMETHODDATA table if it exists and initialize the value of last updated records by zero, otherwise an initial dictionary with zero as value for all recids
def last_updated_result(rank_method_code): result = [{}, {}, {}] query = """select relevance_data from rnkMETHOD, rnkMETHODDATA where rnkMETHOD.id = rnkMETHODDATA.id_rnkMETHOD and rnkMETHOD.Name = '%s'"""% rank_method_code rdict = run_sql(query) if rdict and rdict[0] and rd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rec(self):\n return {'cal': 0}", "def _update(d):\n newd = copy.deepcopy(default)\n\n if 'lastdir' in d:\n newd['lastdir'] = d['lastdir']\n\n return newd", "def last_dict():\n\n # newest_d = {}\n # my_dic = pd.read_excel('grad_gen.xlsx', index_col=0).to_dict()\n # # new_...
[ "0.58107096", "0.5758537", "0.5744504", "0.5732967", "0.53722936", "0.5282241", "0.5257113", "0.5206331", "0.520421", "0.5142212", "0.5122019", "0.5088636", "0.50742084", "0.5067339", "0.5063233", "0.50564384", "0.50432706", "0.50253505", "0.5007381", "0.50047207", "0.4986021...
0.5143988
9
scans the collections searching references (999C5x fields) and citations for items in the recid_list returns a 4 list of dictionaries that contains the citation information of cds records
def get_citation_informations(recid_list, config): begin_time = os.times()[4] d_reports_numbers = {} #dict of recid -> institute-given-report-code d_references_report_numbers = {} #dict of recid -> ['astro-ph/xyz'] d_references_s = {} #dict of recid -> list_of_the_entries_of_this_recs_bibliography d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_references(cls, pmids):\n\n references = cls.query.filter(cls.pmid.in_(pmids)).all()\n citations = {}\n\n for reference in references:\n citation_text = reference.authors + \". (\" + str(\n reference.year) + \"). \" + reference.title + \" \" + reference.journa...
[ "0.64813673", "0.6178384", "0.60846525", "0.6077381", "0.6043557", "0.59674054", "0.59034324", "0.58734137", "0.58487546", "0.58361", "0.5798192", "0.5778596", "0.57374436", "0.563813", "0.5604259", "0.5579555", "0.556315", "0.5559273", "0.5546832", "0.5529941", "0.5516851", ...
0.690522
0
Check which items have been cited by one of the authors of the
def get_self_citations(new_record_list, citationdic, initial_selfcitdict, config): i = 0 #just for debugging .. #get the tags for main author, coauthors, ext authors from config tags = ['first_author', 'additional_author', 'alternative_author_name'] for t in tags: try: dummy = config...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_check(context, authors, poscom):\n displaynames = [x['author']['displayname'] for x in poscom]\n\n for author in authors:\n if author.user.username not in displaynames:\n context.assertFalse(True, \"%s not in list\" %author.user.username)", "def test_citedby_author(self):\n ...
[ "0.71577066", "0.69033414", "0.64529437", "0.6411667", "0.62453896", "0.62002295", "0.61882716", "0.6115645", "0.605986", "0.59958255", "0.59832895", "0.591335", "0.5908707", "0.59039694", "0.58876854", "0.5848254", "0.5828852", "0.5805382", "0.58008856", "0.5780458", "0.5744...
0.0
-1
Traverses citedbydict in order to build "which author is quoted where" dict. The keys of this are author names. An entry like "Apollinaire">[1,2,3] means Apollinaire is cited in records 1,2 and 3.
def get_author_citations(updated_redic_list, citedbydict, initial_author_dict, config): #sorry bout repeated code to get the tags tags = ['first_author', 'additional_author', 'alternative_author_name'] tagvals = {} for t in tags: try: x = config.get(config.get("rank_method", "functi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_citedby_author(self):\n inv_search = 'citedby:author:doggy'\n spi_search = 'find citedby author doggy'\n self._compare_searches(inv_search, spi_search)", "def get_publications_by_author(cached_list, cached_set, author_name):\n publications = { 'dblp': [], 'cdblp':...
[ "0.5992074", "0.59668666", "0.5799877", "0.57464516", "0.5611583", "0.5566841", "0.5525199", "0.55247015", "0.548933", "0.5444908", "0.54439306", "0.53777725", "0.533273", "0.53153", "0.5309737", "0.5296748", "0.5278362", "0.5263696", "0.5235916", "0.5218292", "0.520415", "...
0.63774025
0
Analyze the citation informations and calculate the citation weight and cited by list dictionary.
def ref_analyzer(citation_informations, initialresult, initial_citationlist, initial_referencelist,config, updated_rec_list ): function = "" try: function = config.get("rank_method", "function") except: register_exception(prefix="cfg section [rank_method] has no attr functio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_citation(style, reference_list, citation):\n processed_citation = Element(\"span\", attrib={\"class\":\"citation\"})\n\n for reference in reference_list:\n citeref = SubElement(processed_citation, \"span\")\n for style_node in style.citation.layout:\n process_node(citeref...
[ "0.60321796", "0.5845413", "0.5744994", "0.56930727", "0.5662978", "0.56200105", "0.55414337", "0.5474391", "0.5392177", "0.5307543", "0.5281071", "0.5271394", "0.52353287", "0.52269924", "0.5194141", "0.5171498", "0.51695114", "0.5145369", "0.5134784", "0.5106476", "0.510390...
0.5646937
5
Insert the reference and citation list into the database
def insert_cit_ref_list_intodb(citation_dic, reference_dic, selfcbdic, selfdic, authorcitdic): insert_into_cit_db(reference_dic,"reversedict") insert_into_cit_db(citation_dic,"citationdict") insert_into_cit_db(selfcbdic,"selfcitedbydict") insert_into_cit_db(selfdic,"selfci...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_into_citation_table(citations):\n cursor = connection.cursor()\n cursor.execute(\n 'DROP TABLE IF EXISTS Citations;'\n 'CREATE TABLE Citations(sourcePaperId INT, targetPaperId INT, citationId INT NOT NULL AUTO_INCREMENT PRIMARY KEY);'\n )\n cursor.close()\n i = 0\n\n for ...
[ "0.6965884", "0.68262", "0.6096341", "0.5778446", "0.5740313", "0.5732281", "0.5607799", "0.5572235", "0.55622476", "0.5558603", "0.5553385", "0.5523789", "0.5512726", "0.5501871", "0.54990745", "0.54926753", "0.5489177", "0.54863644", "0.547148", "0.5466431", "0.54623103", ...
0.7009089
0
an aux thing to avoid repeating code
def insert_into_cit_db(dic, name): ndate = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) try: s = serialize_via_marshal(dic) write_message("size of "+name+" "+str(len(s))) #check that this column really exists testres = run_sql("select object_name from rnkCITATIONDATA wher...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regular(self):", "def exo2():", "def _regr_basic():", "def __call__():", "def __call__():", "def __call__():", "def __call__():", "def __call__():", "def sth():", "def common(self):", "def apply(self):", "def g():", "def firstFunction(self):", "def use(self):", "def func():", "def...
[ "0.6806635", "0.6386508", "0.62237775", "0.61517763", "0.61517763", "0.61517763", "0.61517763", "0.61517763", "0.60746104", "0.60519785", "0.6034576", "0.6013738", "0.6012824", "0.5982234", "0.59326035", "0.59287214", "0.59233296", "0.5911283", "0.5911283", "0.58887786", "0.5...
0.0
-1
get a named citation dict from the db
def get_cit_dict(name): cdict = {} try: cdict = run_sql("select object_value from rnkCITATIONDATA where object_name = %s", (name,)) if cdict and cdict[0] and cdict[0][0]: dict_from_db = deserialize_via_marshal(cdict[0][0]) return dict_from_db ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_citation(cit):\n if cit is not None:\n if cit['citation-type'] == \"BIBTEX\":\n return pybtex.database.parse_string(cit['citation-value'], \"bibtex\")\n return None", "def get_author_by_name(self, name):\n\n cur = self.conn.cursor()\n query = 'SELECT author_id , n...
[ "0.6046626", "0.5950197", "0.5847985", "0.58434343", "0.56926155", "0.5684362", "0.5674185", "0.5558614", "0.5495795", "0.54895663", "0.54638165", "0.5446902", "0.5430732", "0.53450066", "0.53339255", "0.53142464", "0.5296164", "0.5265383", "0.5264633", "0.525944", "0.5246737...
0.7352711
0
read author>citedinlist dict from the db
def get_initial_author_dict(): adict = {} try: ah = run_sql("select aterm,hitlist from rnkAUTHORDATA") for (a, h) in ah: adict[a] = deserialize_via_marshal(h) return adict except: register_exception(prefix="could not read rnkAUTHORDATA", alert_admin=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def popAuthors(self):\r\n# cur = self.dbConn.execute(\"SELECT * FROM People WHERE PersonID>0 ORDER BY Lastname\")\r\n# res = cur.fetchall()\r\n res = self.dbConn.execute(\"SELECT * FROM People WHERE PersonID>0 ORDER BY Lastname\").fetchall()\r\n\r\n self.authorList = [formatNameSQL(ln) ...
[ "0.62463015", "0.61490846", "0.61244714", "0.60036224", "0.5967608", "0.5937393", "0.59214526", "0.58278465", "0.57877076", "0.5739218", "0.56823266", "0.5649391", "0.5615111", "0.5582629", "0.5582394", "0.55806595", "0.5542368", "0.551917", "0.5470549", "0.5453344", "0.54351...
0.62780523
0
put the referingrecordnumpublicationstring into the "we are missing these" table
def insert_into_missing(recid, report): report.replace('"','\'') try: srecid = str(recid) wasalready = run_sql("select id_bibrec from rnkCITATIONDATAEXT where id_bibrec = %s and extcitepubinfo = %s", (srecid,report)) if not wasalready: run_sql("i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_NR(self, w2, row):\n row['NR'] = None\n return True", "def addMissingData():\n\n conn = sqlite3.connect(\"./transactions.db\")\n\n person = pd.read_sql(\n \"\"\"\n select * from person;\n \"\"\",\n conn,\n )\n\n record = pd.read_sql(\n \"\"\"\n sel...
[ "0.53357", "0.5239754", "0.50661397", "0.5053511", "0.50410986", "0.5036657", "0.49877408", "0.49684855", "0.4958167", "0.4932847", "0.49291137", "0.49014091", "0.48973417", "0.4891694", "0.48872414", "0.48609567", "0.48588482", "0.48420462", "0.4841088", "0.4835849", "0.4823...
0.5318926
1
temporary simple table + index
def create_analysis_tables(): sql1 = "CREATE TABLE IF NOT EXISTS tmpcit (citer mediumint(10), cited mediumint(10)) TYPE=MyISAM" sql2 = "CREATE UNIQUE INDEX citercited on tmpcit(citer, cited)" sql3 = "CREATE INDEX citer on tmpcit(citer)" sql4 = "CREATE INDEX cited on tmpcit(cited)" try: run_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_index():", "def T1(request):\n T = _get_test_table()\n if request.param:\n T.add_index(\"a\")\n return T", "def test_index_alternate(self):\n self.insert()\n self.tbl[::2]", "def build_index():\n pass", "def index_object(idxs=None):", "def create_new_index(self...
[ "0.6378675", "0.6244597", "0.61699903", "0.61214757", "0.6035877", "0.5879814", "0.5815851", "0.5764521", "0.57210124", "0.56768274", "0.5626417", "0.56132317", "0.56132317", "0.55983233", "0.559672", "0.55530435", "0.55530435", "0.554623", "0.554623", "0.5543864", "0.5530199...
0.5733679
8
write an entry to tmp table
def write_citer_cited(citer, cited): sciter = str(citer) scited = str(cited) try: run_sql("insert into tmpcit(citer, cited) values (%s,%s)", (sciter, scited)) except: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def htable_put(table, key, value):", "def _store_entry_in_table(conn, table_name, entry):\n # Create entry insertion template.\n template = ('?, ' * len(entry)).rstrip(', ') # \"?\" for each value\n template = '(%s)' % template # enclose in parentheses\n # Try to insert a new row into the table.\n ...
[ "0.68487287", "0.64390826", "0.60907364", "0.5969685", "0.59630823", "0.58389467", "0.56817126", "0.56734014", "0.56520325", "0.56517667", "0.56272185", "0.5623497", "0.56175345", "0.56050855", "0.55885863", "0.5566574", "0.5550937", "0.552071", "0.5517991", "0.5485367", "0.5...
0.51368165
60
Print the contents of rnkCITATIONDATAEXT table containing external records that were cited by NUM or more internal records. NUM is by default taken from the E command line option.
def print_missing(num): if not num: num = task_get_option("print-extcites") write_message("Listing external papers cited by %i or more internal records:" % num) res = run_sql("SELECT COUNT(id_bibrec), extcitepubinfo FROM rnkCITATIONDATAEXT \ GROUP BY extcitepubinfo HAVING COUNT(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_icd(self):\n wiki = wikipediaapi.Wikipedia('en') # may as well declare this here so I don't need to call it every query\n supplemental_articles = []\n with open(ICD10_DESC_PATH, 'r') as f:\n current_family = [] # list of lists of descriptions within the current family ...
[ "0.5283312", "0.47920322", "0.47803637", "0.46489966", "0.46426672", "0.46010867", "0.45646727", "0.4531334", "0.45046958", "0.4470535", "0.44359282", "0.44248855", "0.4385767", "0.43826196", "0.43532607", "0.43172917", "0.43149775", "0.43144825", "0.43024385", "0.4301603", "...
0.6221545
0
aux auf to make '100__a' out of ['100','','','a']
def tagify(parsedtag): tag = "" for t in parsedtag: if t == '': t = '_' tag = tag+t return tag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _alphanum_list(x):\n return [_alphanum(y) for y in x]", "def clean(a):\n b = a.lower()\n # en c se encuentra la lista de todos los documentos juntos y limpios\n c = re.sub('[^A-Za-z0-9]+', ' ', b).split()\n return c", "def generate_a_values() -> List[str]:\n return [\"A_1\", \"A_2\", \"A_...
[ "0.626513", "0.5933304", "0.5747301", "0.5679641", "0.55706316", "0.54705375", "0.5390125", "0.53830534", "0.536347", "0.53619814", "0.5348391", "0.53348833", "0.53115875", "0.5304542", "0.5290489", "0.5288956", "0.52829987", "0.5279524", "0.5274321", "0.52679646", "0.5253277...
0.48427668
75
Change the default mute time for the first warning
async def muterole(self, ctx, rolename: str): self.data_check(ctx) server = ctx.message.server self.riceCog2[server.id]["muterole"] = rolename dataIO.save_json(self.warning_settings, self.riceCog2) await self.bot.say("Muted role name is now: **{}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def silly(self):\n print(\"you are getting silly\")\n # 设置时效\n return self._silly if time.localtime(time.time() - self._old_time ).tm_sec < 3 else \"\"", "def mute(self, msg, args):\n if self.mute:\n self.mute=False\n return \"Yay, I can make noise again!\"\n ...
[ "0.6638432", "0.6581909", "0.65700525", "0.6485997", "0.63749397", "0.62527746", "0.60601157", "0.6041151", "0.60398245", "0.60359174", "0.60047853", "0.59576213", "0.5875881", "0.5872893", "0.58570814", "0.5830865", "0.5806074", "0.57983273", "0.57898366", "0.57819015", "0.5...
0.5353241
61