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
export db according to cmdline options
def exportDB(self): sourcesession=svc.connect(self.__source,accessMode=coral.access_Update) destsession=svc.connect(self.__dest,accessMode = coral.access_Update) try: dbcp=DBCopy(sourcesession,destsession,1024) if self.__all: dbcp.copyDB() elif self.__inv: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mysqldump():\n run(\"mysqldump -u database_user database_name -p > ~/tmp/exported_db.sql\")", "def export_db(self, export_location: Path) -> None:\n raise NotImplementedError", "def export_database(self):\n base_path = QtWidgets.QFileDialog.getSaveFileName(self, 'Save File', filter='CSV (*...
[ "0.6796095", "0.66522276", "0.65214247", "0.6448473", "0.64326113", "0.6260671", "0.6183226", "0.6029654", "0.6020472", "0.6012382", "0.60047936", "0.59933054", "0.59021336", "0.5850272", "0.5836538", "0.58344364", "0.582759", "0.58275163", "0.58113915", "0.5756773", "0.57486...
0.64018035
5
Build an expression equivalent to a lookup table
def build_lookup(mapping, var='ptype', default='ptype'): if len(mapping) > 0: return 'where(%s==%s, %s, %s)' % (var, mapping[0][0], mapping[0][1], build_lookup(mapping[1:], var, default)) else: return str(default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_lookup(mapping, var='ptype', default=0.):\n # force mapping to be a list if it wasn't already\n mapping=list(mapping)\n if len(mapping) > 0:\n return 'where(%s==%s, %s, %s)' % (var, mapping[0][0], mapping[0][1], build_lookup(mapping[1:], var, default))\n else:\n ...
[ "0.6523732", "0.61150914", "0.5955717", "0.570927", "0.56178665", "0.5579834", "0.5579453", "0.54781777", "0.5457547", "0.5432533", "0.5425061", "0.5388716", "0.5387384", "0.5381003", "0.5378903", "0.53568715", "0.5315897", "0.52996916", "0.5293774", "0.528251", "0.5204979", ...
0.64584607
1
Convert to a form that takes PDG codes rather than CORSIKA codes.
def to_PDG(self): new = copy.copy(self) new._translator = CompiledFlux.pdg_to_corsika return new
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gto_from_ccdata(self):\n\n gbasis = self.ccdata.gbasis\n lines = []\n\n for no, basis in enumerate(gbasis):\n lines.append(f\"{no + 1:3d} 0\")\n for prims in basis:\n lines.append(f\"{prims[0].lower():s} {len(prims[1]):5d} 1.00\")\n for ...
[ "0.5789563", "0.5776991", "0.5653332", "0.5652865", "0.5619703", "0.55503684", "0.5515544", "0.5507542", "0.54932725", "0.5486814", "0.5382935", "0.5364032", "0.5348216", "0.5343982", "0.5308476", "0.5303527", "0.5294769", "0.5288192", "0.5246301", "0.5244871", "0.5243715", ...
0.5622449
4
Build an expression equivalent to a lookup table
def build_lookup(mapping, var='ptype', default=0.): # force mapping to be a list if it wasn't already mapping=list(mapping) if len(mapping) > 0: return 'where(%s==%s, %s, %s)' % (var, mapping[0][0], mapping[0][1], build_lookup(mapping[1:], var, default)) else: ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_lookup(mapping, var='ptype', default='ptype'):\n if len(mapping) > 0:\n return 'where(%s==%s, %s, %s)' % (var, mapping[0][0], mapping[0][1], build_lookup(mapping[1:], var, default))\n else:\n return str(default)", "def __getitem__(self, key: str) -> ir.TableExpr:\n return sel...
[ "0.64584607", "0.61150914", "0.5955717", "0.570927", "0.56178665", "0.5579834", "0.5579453", "0.54781777", "0.5457547", "0.5432533", "0.5425061", "0.5388716", "0.5387384", "0.5381003", "0.5378903", "0.53568715", "0.5315897", "0.52996916", "0.5293774", "0.528251", "0.5204979",...
0.6523732
0
Walks the source paths and place them in appropriate environment variables.
def parse_paths(): sources = get_source_paths() results = collections.defaultdict(list) for root_dir in sources: for script_type, dirs in walkdirs(root_dir).iteritems(): for d in dirs: logger.debug(d) # Add paths to environments ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUpEnvironmentVariables(basedir):\n\tif sys.platform == 'win32':\n\t\toldpath = os.environ[\"PATH\"]\n\t\tcwd = os.getcwd()\n\t\tos.environ[\"PATH\"] = oldpath + ';' + cwd + fileSeperator + basedir + fileSeperator + \"platform-tools\"\n\t\tprint os.environ[\"PATH\"]\n\telse:\n\t\tcwd = os.getcwd()\n\t\toldpa...
[ "0.63907224", "0.6346975", "0.61996144", "0.60590684", "0.60590684", "0.5998856", "0.59357774", "0.58390045", "0.58113414", "0.57515734", "0.5701455", "0.56915116", "0.56711894", "0.56232524", "0.55800885", "0.55783176", "0.55595547", "0.552883", "0.550608", "0.54858047", "0....
0.62142795
2
Returns defaultdict with script type / paths mapping, excluding given patterns and python packages.
def walkdirs(root): scriptype_paths = collections.defaultdict(set) for root, subdirs, files in os.walk(root): # Filter subdirs tmpdir = [] for i in subdirs: if i.startswith(EXCLUDE_PATTERNS): continue if '__init__.py' in os.listdir(os.pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_extension_to_type_map(file_types):\n extension_to_type = dict()\n for file_type in file_types:\n for file_ext in file_type['extensions']:\n if file_ext not in extension_to_type:\n extension_to_type[file_ext] = file_type\n return extension_to_type", "def run_mapp...
[ "0.5768541", "0.569013", "0.5677841", "0.55597234", "0.55592877", "0.55176985", "0.5469804", "0.5445721", "0.53891", "0.53409356", "0.527778", "0.5227336", "0.5217691", "0.5178613", "0.5168109", "0.5162053", "0.5146098", "0.5145351", "0.5128747", "0.51221925", "0.5121463", ...
0.6402314
0
Return valid paths from __file__ dir, PYENV and MELENV.
def get_source_paths(): script_paths = set() try: script_paths.update(filter(None, os.environ.get(PYENV).split(os.pathsep))) script_paths.update(filter(None, os.environ.get(MELENV).split(os.pathsep))) except AttributeError: logger.debug('No custom environ variables set.') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_environment_paths(basedir=None):\n basedir = (\n get_default_secrets_basedir() if basedir is None\n else Path(basedir)\n )\n results = list()\n for item in sorted(basedir.iterdir()):\n if is_valid_environment(item):\n results.append(item)\n return results", ...
[ "0.7171722", "0.6597074", "0.6507689", "0.6315025", "0.6311144", "0.6296824", "0.62492156", "0.6234693", "0.62341654", "0.61818033", "0.61814684", "0.6162761", "0.6095949", "0.60329336", "0.6010903", "0.59968036", "0.5987034", "0.59694135", "0.59489715", "0.5938563", "0.59279...
0.7076356
1
Brainrender's Atlas class subclasses BrainGlobeAtlas to add methods to get regions meshes as Actors and to get a plane at a given point and normal.
def __init__(self, atlas_name=None): atlas_name = atlas_name or settings.DEFAULT_ATLAS self.atlas_name = atlas_name logger.debug(f"Generating ATLAS: {atlas_name}") try: super().__init__(atlas_name=atlas_name, print_authors=False) except TypeError: # The l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def atlas_organizations():\n pass", "def mapToAtlas(self, obj):\n raise Exception(\"Must be reimplemented in subclass.\")", "def atlas_clusters():\n pass", "def drawCoordinatePlane_region():\r\n turtle2 = t.Screen()\r\n turtle2.title(\"Life Expectancy versus Region\")\r\n t2.speed(0)\r\...
[ "0.59558874", "0.57791656", "0.5683139", "0.5672896", "0.5621679", "0.55926305", "0.5586181", "0.5576486", "0.5411854", "0.53528136", "0.53440684", "0.53308517", "0.530004", "0.5247385", "0.522802", "0.5217718", "0.5179405", "0.5156655", "0.51544255", "0.5152359", "0.5142874"...
0.48600948
48
Returns the best camera zoom given the atlas resolution
def zoom(self): res = np.max(self.metadata["resolution"]) if self.atlas_name == "allen_human_500um": logger.debug( "ATLAS: setting zoom manually for human atlas, atlas needs fixing" ) return 350 else: return 40 / res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_zoom(input_box, z=18):\n box_tile = smopy.get_tile_box(input_box, z)\n box = smopy.correct_box(box_tile, z)\n sx, sy = smopy.get_box_size(box)\n if sx * sy >= MAXTILES:\n z = get_zoom(input_box, z - 1)\n return z", "def compute_resolution(zoom, size_px):\n # Calibration data:\n ...
[ "0.6454999", "0.64292175", "0.6390678", "0.62350464", "0.622483", "0.6209762", "0.61986816", "0.6183604", "0.6173395", "0.61674184", "0.60466546", "0.5988281", "0.5962575", "0.57636255", "0.5750779", "0.56561506", "0.56086415", "0.55965966", "0.55922043", "0.5578516", "0.5558...
0.7805432
0
Gets the rgb color of a region in the atlas
def _get_region_color(self, region): return [ x / 255 for x in self._get_from_structure(region, "rgb_triplet") ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_color_in_region(self, start, end):\n # Input format: (start_x, start_y), (end_x, end_y)\n start_x, start_y = start\n end_x, end_y = end\n\n # x and y are flipped\n crop_img = self.img[start_x:(end_x + 1), start_y:(end_y + 1)]\n channels = cv2.mean(crop_img)\n\n ...
[ "0.69011796", "0.6625769", "0.65982455", "0.65948516", "0.6562015", "0.6556168", "0.6497549", "0.63513184", "0.6319954", "0.63109565", "0.6263722", "0.6247156", "0.6227768", "0.6227081", "0.61992794", "0.6185941", "0.61626786", "0.6158018", "0.6136658", "0.6122602", "0.607359...
0.77586186
0
Get brain regions meshes as Actors
def get_region(self, *regions, alpha=1, color=None): if not regions: return None _color = color actors = [] for region in regions: if ( region not in self.lookup_df.acronym.values and region not in self.lookup_df["id"].values ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_actors(self):\n actors = [ddpg_agent.actor for ddpg_agent in self.maddpg_agent]\n return actors", "def get_actors(self):\n actors = [ddpg_agent.actor for ddpg_agent in self.maddpg_agent]\n return actors", "def get_actors(self):\n actors = [ddpg_agent.actor for ddpg_ag...
[ "0.5648692", "0.5648692", "0.5648692", "0.5648692", "0.55982864", "0.54755956", "0.54316795", "0.54214567", "0.5276514", "0.51840776", "0.51769817", "0.5133247", "0.5124935", "0.5030467", "0.5030467", "0.5030467", "0.5030467", "0.49961495", "0.4993293", "0.4992125", "0.496741...
0.53804225
8
Returns a plane going through a point at pos, oriented orthogonally to the vector norm and of width and height sx, sy.
def get_plane( self, pos=None, norm=None, plane=None, sx=None, sy=None, color="lightgray", alpha=0.25, **kwargs, ): axes_pairs = dict(sagittal=(0, 1), horizontal=(2, 0), frontal=(2, 1)) if pos is None: pos = self.ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proj_to_plane(norm, d, pts):\n a = norm[0]\n b = norm[1]\n c = norm[2]\n\n p = []\n\n for i in range(len(pts)):\n x_p = pts[i][0]\n y_p = pts[i][1]\n z_p = pts[i][2]\n\n if a != 0:\n x_0 = (b * b + c * c) * x_p - a * b * y_p - a * c * z_p - a * d\n ...
[ "0.6396546", "0.6396546", "0.6183506", "0.6174271", "0.6145053", "0.61160415", "0.6035465", "0.5979914", "0.59591293", "0.5913918", "0.59053445", "0.5904647", "0.5876737", "0.58654743", "0.58250505", "0.58204174", "0.57940704", "0.5756824", "0.57409114", "0.57186556", "0.5703...
0.68663776
0
compute z_n(t+1), t+1 means current
def compute_z_curr(Z_opt, z_prev1, z_diff, alpha): z_curr = alpha * Z_opt + (1 - alpha) * (z_prev1 + z_diff) return z_curr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def naive_sum(z, n_times_atom):\n n_atoms, n_trials, n_times_valid = z.shape\n\n ztz = np.zeros(shape=(n_atoms, n_atoms, 2 * n_times_atom - 1))\n t0 = n_times_atom - 1\n for k0 in range(n_atoms):\n for k in range(n_atoms):\n for i in range(n_trials):\n for t in range(n_...
[ "0.6356676", "0.6174303", "0.6141612", "0.611247", "0.60448945", "0.59694135", "0.59533453", "0.591878", "0.5898236", "0.5881904", "0.58761", "0.58495486", "0.5808688", "0.5808281", "0.5794205", "0.57925135", "0.57923263", "0.5782475", "0.5782251", "0.5780868", "0.5780224", ...
0.5866463
11
compute z_n at previous time, i.e. z_n(t), z_n(t1)
def compute_z_prev(n, Z_opt, device): nzx, nzy = Z_opt.shape[2], Z_opt.shape[3] # no. of channel for noise input nc_z = 3 if n == 0: # z_rand is gaussian noise z_rand = functions.generate_noise([1, nzx, nzy], device= device) z_rand = z_rand.expand(1, 3, Z_opt.shape[2], Z...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_z_curr(Z_opt, z_prev1, z_diff, alpha):\r\n z_curr = alpha * Z_opt + (1 - alpha) * (z_prev1 + z_diff)\r\n return z_curr", "def lookback_time(self, z, z0 = 0.0):\n lt_func = np.vectorize(lambda z, z0: \n si.quad(self._lookback_integrand, z0, z, limit=1000)\n ...
[ "0.6359763", "0.6280652", "0.5986535", "0.59398437", "0.58886546", "0.5796982", "0.57787", "0.57448745", "0.5621632", "0.55678546", "0.5563106", "0.55606556", "0.55116934", "0.54717535", "0.54433835", "0.544052", "0.54086614", "0.538945", "0.53769845", "0.53676015", "0.536680...
0.6960639
0
Formats a list of instances.
def transform_instances_table_output(result): table_output = [] for item in result: table_output.append(_transform_instance_row(item)) return table_output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _format_zone_list(self, instance_list):\n result = []\n if instance_list is not None:\n if \"items\" in instance_list:\n items = instance_list[\"items\"]\n for item in items:\n result.append(self._process_instance(item))\n return ...
[ "0.6747392", "0.66881895", "0.6636258", "0.66095626", "0.633661", "0.6001779", "0.59141594", "0.5864193", "0.57297856", "0.5722374", "0.567803", "0.5657962", "0.5648478", "0.56444466", "0.55935", "0.5561002", "0.5559794", "0.5552907", "0.5552907", "0.55031353", "0.5497598", ...
0.5732184
8
Usage Return the free space in the segment s, from point p. This free space is the set of all point in s whose distance from p is at most eps. Since s is a segment, the free space is also a segment. We return a 1x2 array whit the fraction of the segment s which are in the free space. If no part of s are in the free spa...
def free_line(p, eps, s, dps1, dps2, ds): px = p[0] py = p[1] s1x = s[0, 0] s1y = s[0, 1] s2x = s[1, 0] s2y = s[1, 1] if s1x == s2x and s1y == s2y: if eucl_dist(p, s[0]) > eps: lf = [-1, -1] else: lf = [0, 1] else: if point_to_seg(p, s[0], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fragmentation(free_resources_gaps, p=2):\n f = free_resources_gaps\n frag = pd.Series()\n for i, fi in enumerate(f):\n if fi.size == 0:\n frag_i = 0\n else:\n frag_i = 1 - (sum(fi**p) / sum(fi)**p)\n frag.set_value(i, frag_i)\n return frag", "def get_fre...
[ "0.5914965", "0.5738517", "0.55175877", "0.5503777", "0.53583515", "0.5344195", "0.5280643", "0.52537614", "0.5230603", "0.5207553", "0.5191342", "0.51225924", "0.5113665", "0.50883824", "0.50724685", "0.5034044", "0.5032066", "0.5020193", "0.5015276", "0.5013812", "0.5008300...
0.4932411
25
Usage Compute all the free space on the boundary of cells in the diagram for polygonal chains P and Q and the given eps LF[(i,j)] is the free space of segment [Pi,Pi+1] from point Qj BF[(i,j)] is the free space of segment [Qj,Qj+1] from point Pj
def LF_BF(P, Q, p, q, eps, mdist, P_dist, Q_dist): LF = {} for j in range(q): for i in range(p - 1): LF.update({(i, j): free_line(Q[j], eps, P[i:i + 2], mdist[i, j], mdist[i + 1, j], P_dist[i])}) BF = {} for j in range(q - 1): for i in range(p): BF.update({(i, j):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LR_BR(LF, BF, p, q):\n if not (LF[(0, 0)][0] <= 0 and BF[(0, 0)][0] <= 0 and LF[(p - 2, q - 1)][1] >= 1 and BF[(p - 1, q - 2)][1] >= 1):\n rep = False\n BR = {}\n LR = {}\n else:\n LR = {(0, 0): True}\n BR = {(0, 0): True}\n for i in range(1, p - 1):\n ...
[ "0.5799362", "0.56557685", "0.56553715", "0.55753076", "0.5484209", "0.5474942", "0.541693", "0.53881", "0.5384835", "0.5301325", "0.52949774", "0.5292436", "0.528571", "0.5250551", "0.52481675", "0.519482", "0.5136062", "0.5130518", "0.51211125", "0.51081985", "0.5103744", ...
0.6871466
0
Usage Compute all the free space,that are reachable from the origin (P[0,0],Q[0,0]) on the boundary of cells in the diagram for polygonal chains P and Q and the given free spaces LR and BR LR[(i,j)] is the free space, reachable from the origin, of segment [Pi,Pi+1] from point Qj BR[(i,j)] is the free space, reachable f...
def LR_BR(LF, BF, p, q): if not (LF[(0, 0)][0] <= 0 and BF[(0, 0)][0] <= 0 and LF[(p - 2, q - 1)][1] >= 1 and BF[(p - 1, q - 2)][1] >= 1): rep = False BR = {} LR = {} else: LR = {(0, 0): True} BR = {(0, 0): True} for i in range(1, p - 1): if LF[(i, 0)]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dbgain_free_space(self, pt_1, pt_2):\n if (pt_1.ndim > 1) or (pt_2.ndim > 1):\n raise NotImplementedError\n dist = np.linalg.norm(pt_1 - pt_2)\n\n return self.dist_to_dbgain_free_space(\n dist,\n wavelength=self.wavelength,\n antenna_dbgain_tx=se...
[ "0.5692554", "0.5665216", "0.5620372", "0.5388032", "0.5333929", "0.53203285", "0.5296268", "0.5269298", "0.5259146", "0.5242636", "0.5239064", "0.52265537", "0.52158135", "0.51837415", "0.51299995", "0.5123705", "0.5116886", "0.51046026", "0.50999355", "0.50996166", "0.50863...
0.57159686
0
Usage Test is the frechet distance between trajectories P and Q are inferior to eps
def decision_problem(P, Q, p, q, eps, mdist, P_dist, Q_dist): LF, BF = LF_BF(P, Q, p, q, eps, mdist, P_dist, Q_dist) rep, _, _ = LR_BR(LF, BF, p, q) return rep
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frechet(P, Q):\n p = len(P)\n q = len(Q)\n\n mdist = eucl_dist_traj(P, Q)\n P_dist = [eucl_dist(P[ip], P[ip + 1]) for ip in range(p - 1)]\n Q_dist = [eucl_dist(Q[iq], Q[iq + 1]) for iq in range(q - 1)]\n\n cc = compute_critical_values(P, Q, p, q, mdist, P_dist, Q_dist)\n eps = cc[0]\n w...
[ "0.6616158", "0.6592152", "0.64553887", "0.6350893", "0.62643933", "0.6163484", "0.6138259", "0.60603935", "0.6030578", "0.5999862", "0.59948444", "0.59899145", "0.5978065", "0.59257007", "0.5892972", "0.58657134", "0.5855452", "0.5832778", "0.5832765", "0.5831971", "0.582727...
0.0
-1
Usage Compute all the critical values between trajectories P and Q
def compute_critical_values(P, Q, p, q, mdist, P_dist, Q_dist): origin = eucl_dist(P[0], Q[0]) end = eucl_dist(P[-1], Q[-1]) end_point = max(origin, end) cc = set([end_point]) for i in range(p - 1): for j in range(q - 1): Lij = point_to_seg(Q[j], P[i], P[i + 1], mdist[i, j], mdis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cost(P, Q):\n Q = np.where(Q != 0, Q, 1e-12)\n P = np.where(P != 0, P, 1e-12)\n Div = P / Q\n C = np.sum(P * np.log(Div))\n return C", "def frechet(P, Q):\n p = len(P)\n q = len(Q)\n\n mdist = eucl_dist_traj(P, Q)\n P_dist = [eucl_dist(P[ip], P[ip + 1]) for ip in range(p - 1)]\n ...
[ "0.59205824", "0.58363307", "0.57980275", "0.5699093", "0.5682799", "0.5677158", "0.5676779", "0.5636182", "0.56267333", "0.5624366", "0.5620646", "0.5620646", "0.5620646", "0.5620646", "0.5620646", "0.5599994", "0.5571987", "0.55696845", "0.5563916", "0.55605155", "0.5541283...
0.67792004
0
Usage Compute the frechet distance between trajectories P and Q
def frechet(P, Q): p = len(P) q = len(Q) mdist = eucl_dist_traj(P, Q) P_dist = [eucl_dist(P[ip], P[ip + 1]) for ip in range(p - 1)] Q_dist = [eucl_dist(Q[iq], Q[iq + 1]) for iq in range(q - 1)] cc = compute_critical_values(P, Q, p, q, mdist, P_dist, Q_dist) eps = cc[0] while (len(cc) !...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dist(p, q):\n return ((p[0] - q[0])**2 + (p[1] - q[1])**2 + (p[2] - q[2])**2)**0.5", "def dist(p,q):\n return math.sqrt((p[0] - q[0]) ** 2+(p[1] - q[1]) ** 2)", "def distance(M, p, q):\n\n return (math.sqrt(math.pow(M[p, 0] - M[q, 0],2) + math.pow(M[p, 1] - M[q, 1],2))) # obliczanie dystansu mie...
[ "0.7173551", "0.69895643", "0.6843418", "0.6539303", "0.65212935", "0.650371", "0.63225406", "0.62851346", "0.6272369", "0.6259774", "0.62053066", "0.62031424", "0.6179285", "0.6176652", "0.6154126", "0.6151824", "0.6131871", "0.6069721", "0.60457736", "0.6016533", "0.5989678...
0.7064292
1
! Get OpenGL primitive type
def oglprimtype(self): return self._enttype.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_shader_type(varinfo):\n if type(varinfo[\"ndim\"]) == int or type(varinfo[\"ndim\"]) == long:\n if varinfo[\"ndim\"] == 1:\n shader_type = varinfo[\"vartype\"]\n elif varinfo[\"ndim\"] >= 2:\n shader_type = \"vec%d\" % varinfo[\"ndim\"]\n if varinfo[\"vart...
[ "0.64662415", "0.63826877", "0.63370425", "0.6299459", "0.6277748", "0.6261586", "0.6123466", "0.61118096", "0.61035246", "0.6098541", "0.60723066", "0.60723066", "0.6029126", "0.5982416", "0.5969808", "0.59436804", "0.59233886", "0.58949155", "0.5894639", "0.58420587", "0.58...
0.0
-1
! Get number of vertices for the entity type (pyD3VOGLModel.GLEntityType)
def _getnumver4enttype(self): if self._enttype == GLEntityType.QUAD: return 4 elif self._enttype == GLEntityType.TRIA: return 3 elif self._enttype == GLEntityType.LINE: return 2 else: return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vertices_count(self) -> int:\n # TODO: verify the following claim:\n raise NotImplementedError", "def num_vertices(self):\n return len(self)", "def num_vertices(self):\n return len(self.vertices)", "def num_vertices(self):\n return len(self.vertices)", "def obtene...
[ "0.70886576", "0.6977656", "0.6910094", "0.6910094", "0.6875554", "0.68577117", "0.6852669", "0.6802562", "0.67703396", "0.6729522", "0.6707347", "0.6678461", "0.6672218", "0.6627881", "0.65335345", "0.6504911", "0.6445821", "0.64410627", "0.63270456", "0.6130506", "0.6094207...
0.67097986
10
! Clone the instance Must be implemented in the derived class
def clone(self): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone(self):", "def clone(self):\n raise NotImplementedError", "def __copy__(self):\n raise NotImplementedError", "def copy(self):", "def copy(self):\n return super().copy()", "def copy(self):\n # YOUR CODE HERE\n raise NotImplementedError()", "def clone(self) -> ...
[ "0.85975575", "0.8476917", "0.81450146", "0.79791814", "0.7938127", "0.78946114", "0.7842544", "0.7780354", "0.77377695", "0.7648979", "0.7634681", "0.7614245", "0.7600491", "0.7600491", "0.7600491", "0.75832105", "0.7536777", "0.75353307", "0.75353307", "0.75353307", "0.7530...
0.76812917
9
Append size with the specified number of entities
def appendsize(self, numents): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def appendsize(self, numents):\n self._numents += numents", "def inc_size(self):\r\n self.__length += 1", "def batch_size(self) -> int:\n ...", "def appenddictitemsize(self, key, numents):\n self._dentsvertsdata[key].appendsize(numents * self._multFactor)", "def _assign_sizes(se...
[ "0.71058905", "0.62483996", "0.60852516", "0.60310906", "0.6018139", "0.5965686", "0.588384", "0.5873902", "0.5820619", "0.5802095", "0.57661766", "0.57575065", "0.57453406", "0.5733978", "0.5712476", "0.57062435", "0.5704675", "0.56961715", "0.56593245", "0.56401414", "0.563...
0.7674417
0
! Append Vertex collector dictionary item with new vertex data
def appendlistdata_f3xyzf3rgb(self, x, y, z, r, g, b): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vertex(self, vertex):\n self[vertex] = {}", "def add_vertex(self, v):\n self[v] = {}", "def add_vertex(self, v):\n self[v] = {}", "def add_vertex(self, vertex_id):\n # just add new dict entry\n self.vertices[vertex_id] = set()\n\n pass # TODO", "def add_ve...
[ "0.737616", "0.72784466", "0.72784466", "0.71688884", "0.6941539", "0.69381565", "0.6877082", "0.6858609", "0.6858609", "0.6768274", "0.66951805", "0.66867685", "0.66455746", "0.6638114", "0.65936536", "0.6529869", "0.6493031", "0.6483585", "0.64828694", "0.6426926", "0.64084...
0.0
-1
! Allocate memory for the vertex data channels Allocation size is based on the information collected by client calls to appendsize()
def allocatememory(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allocatememory(self):\n self._numvertstotal = self._numents * self._nvet\n self._cords = VertDataSingleChannel(GLDataType.FLOAT, 3, self._numvertstotal)\n self._colors = VertDataSingleChannel(GLDataType.UBYTE, 4, self._numvertstotal)", "def _allocate_buffer_memory(self):\n for cha...
[ "0.76169854", "0.6268719", "0.61186135", "0.57991874", "0.560458", "0.5575091", "0.55208147", "0.54995835", "0.5477305", "0.54349387", "0.54285145", "0.5426824", "0.54087883", "0.5403441", "0.5387381", "0.5375428", "0.5373897", "0.53613126", "0.5357203", "0.5356363", "0.53444...
0.51186466
40
! Free vertex data channels memory
def free(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def free_intermediate_arrays(self):\n self._mgx = None\n self._mgy = None\n self._mgz = None\n self._vander = None\n self._bkg_cube = None\n self._bkg_cube_dirty = True", "def clean(self):\n # Delete vertices / faces / colors / normals :\n self._vert_buffer...
[ "0.6838438", "0.6758785", "0.663656", "0.64891547", "0.6419878", "0.62101656", "0.6183297", "0.608437", "0.6017738", "0.60073966", "0.5957772", "0.59355956", "0.5868735", "0.5816589", "0.5805749", "0.5782311", "0.575024", "0.57485825", "0.57404554", "0.5723663", "0.5720703", ...
0.59053314
13
Append size with the specified number of entities
def appendsize(self, numents): self._numents += numents
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def appendsize(self, numents):\n pass", "def inc_size(self):\r\n self.__length += 1", "def batch_size(self) -> int:\n ...", "def appenddictitemsize(self, key, numents):\n self._dentsvertsdata[key].appendsize(numents * self._multFactor)", "def _assign_sizes(self):", "def setDat...
[ "0.7674417", "0.62483996", "0.60852516", "0.60310906", "0.6018139", "0.5965686", "0.588384", "0.5873902", "0.5820619", "0.5802095", "0.57661766", "0.57575065", "0.57453406", "0.5733978", "0.5712476", "0.57062435", "0.5704675", "0.56961715", "0.56593245", "0.56401414", "0.5638...
0.71058905
1
! Append Vertex collector dictionary item with new vertex data
def appendlistdata_f3xyzf3rgb(self, x, y, z, r, g, b): self._ivert += 1 self._cords.add_Data3(x, y, z) self._colors.add_Data4(r * 255, g * 255, b * 255, 255) return self._ivert
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vertex(self, vertex):\n self[vertex] = {}", "def add_vertex(self, v):\n self[v] = {}", "def add_vertex(self, v):\n self[v] = {}", "def add_vertex(self, vertex_id):\n # just add new dict entry\n self.vertices[vertex_id] = set()\n\n pass # TODO", "def add_ve...
[ "0.737616", "0.72784466", "0.72784466", "0.71688884", "0.6941539", "0.69381565", "0.6877082", "0.6858609", "0.6858609", "0.6768274", "0.66951805", "0.66867685", "0.66455746", "0.6638114", "0.65936536", "0.6529869", "0.6493031", "0.6483585", "0.64828694", "0.6426926", "0.64084...
0.0
-1
! Allocate memory for the vertex data channels Allocation size is based on the information collected by client calls to appendsize()
def allocatememory(self): self._numvertstotal = self._numents * self._nvet self._cords = VertDataSingleChannel(GLDataType.FLOAT, 3, self._numvertstotal) self._colors = VertDataSingleChannel(GLDataType.UBYTE, 4, self._numvertstotal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _allocate_buffer_memory(self):\n for channel in self._channels_dict.values():\n if channel.enabled:\n channel.allocate(self._num_captures, self._num_samples)", "def allocatememory(self):\n\n for key, value in self._dentsvertsdata.items():\n value.allocatemem...
[ "0.6268719", "0.61186135", "0.57991874", "0.560458", "0.5575091", "0.55208147", "0.54995835", "0.5477305", "0.54349387", "0.54285145", "0.5426824", "0.54087883", "0.5403441", "0.5387381", "0.5375428", "0.5373897", "0.53613126", "0.5357203", "0.5356363", "0.53444767", "0.53117...
0.76169854
0
! Get total number of vertices
def numverts(self): return self._numvertstotal
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_vertices(self):\n return len(self.vertices)", "def num_vertices(self):\n return len(self.vertices)", "def num_vertices(self):\n return len(self)", "def return_num_vertices(self):\n return self.__size", "def obtener_cantidad_vertices(self):\n return len(self.vertic...
[ "0.86687046", "0.86687046", "0.8652682", "0.86131585", "0.8541997", "0.8537827", "0.85252416", "0.8454468", "0.8438959", "0.83214945", "0.82999843", "0.81529725", "0.8131506", "0.8122777", "0.80816376", "0.79698586", "0.79213357", "0.7791163", "0.76986504", "0.7620644", "0.76...
0.76473486
19
! Free vertex data channels memory
def free(self): self._cords.free() self._colors.free()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def free_intermediate_arrays(self):\n self._mgx = None\n self._mgy = None\n self._mgz = None\n self._vander = None\n self._bkg_cube = None\n self._bkg_cube_dirty = True", "def clean(self):\n # Delete vertices / faces / colors / normals :\n self._vert_buffer...
[ "0.6838438", "0.6758785", "0.64891547", "0.6419878", "0.62101656", "0.6183297", "0.608437", "0.6017738", "0.60073966", "0.5957772", "0.59355956", "0.59053314", "0.59053314", "0.5868735", "0.5816589", "0.5805749", "0.5782311", "0.575024", "0.57485825", "0.57404554", "0.5723663...
0.663656
2
! Clone the instance of VertDataCollectorCoord3fColor4ub class Overrides the base class abstract method
def clone(self): vdc = VertDataCollectorCoord3fColor4ub(self._enttype) return vdc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return vertex(self.x, self.y, self.z)", "def clone(self, *args):\n return _osgAnimation.VertexInfluenceMap_clone(self, *args)", "def Clone(self) -> \"itkBinaryContourImageFilterIUS3IUS3_Pointer\":\n return _itkBinaryContourImageFilterPython.itkBinaryContourImageFilterIUS3...
[ "0.56691396", "0.56231135", "0.5584617", "0.5574439", "0.55721986", "0.5510009", "0.5508986", "0.5500849", "0.5500065", "0.54964495", "0.5489479", "0.5352548", "0.53463817", "0.53232324", "0.53192043", "0.5311618", "0.53026754", "0.52971894", "0.5295959", "0.5295959", "0.5279...
0.7961676
0
Builds a random function of depth at least min_d and depth at most max_d (see assignment writeup for definition of depth in this context)
def bld_func(min_d, max_d): opers = ['prod','avg','cos_pi','sin_pi','subtract','add'] oper = random.choice(opers) depth = random.randint(min_d,max_d) if depth <= 1: return [random.choice(['x','y','t'])] elif oper == 'prod': return ['prod', bld_func(min_d-1,max_d-1), bld_func(min_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_random_function(min_depth, max_depth):\n depth = random.randint(min_depth, max_depth)\n return build_random_function_helper(depth)", "def build_random_function(min_depth, max_depth):\n\n # your code goes here", "def build_rand_func(min_depth, max_depth):\n\n\toptions = [['prod'],['sin_pi'],[...
[ "0.844839", "0.81581044", "0.7588808", "0.75613904", "0.74945325", "0.72136813", "0.7209755", "0.68981344", "0.59353805", "0.5803092", "0.5787404", "0.5731713", "0.5636801", "0.55801135", "0.55632687", "0.54969573", "0.5446349", "0.5446349", "0.5432722", "0.54282004", "0.5376...
0.661697
8
Evaluate the random function f with inputs x,y Representation of the function f is defined in the assignment writeup
def eval_func(f, x, y, t): if f[0] == 'x': return x if f[0] == 'y': return y if f[0] == 't': return y-t if f[0] == 'prod': return eval_func(f[1],x,y,t)*eval_func(f[2],x,y,t) if f[0] == 'avg': return (eval_func(f[1],x,y,t)+eval_func(f[2],x,y,t))/2.0 if f[0]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_random_function(f, x, y):\n\n # your code goes here", "def evaluate_random_function(f, x, y):\n\n if f[0] == \"prod\":\n return evaluate_random_function(f[1],x,y) * evaluate_random_function(f[2],x,y)\n elif f[0] == \"sin_pi\":\n return sin(evaluate_random_function(f[1],x,y) * ...
[ "0.84637374", "0.80705845", "0.8036055", "0.78878623", "0.7851928", "0.7746008", "0.76089233", "0.7117402", "0.69877934", "0.6655339", "0.6420247", "0.6387316", "0.63596076", "0.62204003", "0.6102009", "0.60832006", "0.6036363", "0.6001321", "0.5903752", "0.57972616", "0.5791...
0.66649127
9
Given an input value in the interval [input_interval_start, input_interval_end], return an output value scaled to fall within the output interval [output_interval_start, output_interval_end].
def remap(val, input_interval_start, input_interval_end, output_interval_start, output_interval_end): weight_end = float(val-input_interval_start)/(input_interval_end-input_interval_start) weight_start = float(input_interval_end-val)/(input_interval_end-input_interval_start) return (weight_end*output_inter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remap_interval(val, input_interval_start, input_interval_end, output_interval_start, output_interval_end):\n inputrange = float(input_interval_end) - float(input_interval_start) #finds length or original interval\n outputrange = float(output_interval_end) - float(output_interval_start) #finds leng...
[ "0.82906735", "0.7995952", "0.790404", "0.7889895", "0.7753282", "0.72913456", "0.7240076", "0.71240556", "0.701782", "0.685399", "0.6797459", "0.66878915", "0.6675623", "0.65690327", "0.6418705", "0.62768626", "0.62538075", "0.6196677", "0.61702305", "0.61658955", "0.6163130...
0.78778845
4
Maps input value between 1 and 1 to an integer 0255, suitable for use as an RGB color code.
def c_map(val): return int(remap(val, -1, 1, 0, 255))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color_map(val):\n color_code = remap_interval(val, -1, 1, 0, 255)\n return int(color_code)", "def color_map(val):\n # NOTE: This relies on remap_interval, which you must provide\n color_code = remap_interval(val, -1, 1, 0, 255)\n return int(color_code)", "def color_map(val):\n # NOTE: Thi...
[ "0.7929347", "0.7822189", "0.7822189", "0.7822189", "0.7822189", "0.68541807", "0.6615683", "0.6547917", "0.6357396", "0.6288208", "0.6195222", "0.6162569", "0.6038869", "0.6036886", "0.5966221", "0.59070814", "0.5886374", "0.58810294", "0.58580077", "0.5822967", "0.58094645"...
0.73409516
5
Generate test image with random pixels and save as an image file.
def test_image(filename, x_size=350, y_size=350): # Create image and loop over all pixels im = Image.new("RGB", (x_size, y_size)) pixels = im.load() for i in range(x_size): for j in range(y_size): x = remap(i, 0, x_size, -1, 1) y = remap(j, 0, y_size, -1, 1) p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_image(filename, x_size=350, y_size=350):\n # Create image and loop over all pixels\n im = Image.new(\"RGB\", (x_size, y_size))\n pixels = im.load()\n for i in range(x_size):\n for j in range(y_size):\n pixels[i, j] = (random.randint(0, 255), # Red channel\n ...
[ "0.7916328", "0.7276964", "0.72279763", "0.7180069", "0.7180069", "0.7180069", "0.6833925", "0.67390573", "0.6636539", "0.6577365", "0.6552666", "0.654833", "0.6493901", "0.64547956", "0.6446572", "0.6445794", "0.6444757", "0.6440958", "0.6415097", "0.6344109", "0.63346565", ...
0.73138684
1
Generates computational art and save as an image file. All args optional complexity base complexity (depth of recursion) for image creation num_frames determines how many frames will be drawn
def gen_art(complexity=7, num_frames=1, x_size=350, y_size=350): # Functions for red, green, and blue channels - where the magic happens! red_function = bld_func(complexity, complexity+2) green_function = bld_func(complexity, complexity+2) blue_function = bld_func(complexity, complexity+2) # Crea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genFrameImages((widthPixels, heightPixels), flashColourGen, flashColourGenPipTrain, numFrames, FPS, superSamplingScale=8, BG_COLOUR=(0,0,0), TEXT_COLOUR=(255,255,255), GFX_COLOUR=(255,255,255), title=\"\", TITLE_COLOUR=(255,255,255), FRAMES_AS_FIELDS=False, frameSkipChecker=None, segments=[]):\n\n # we're g...
[ "0.6099129", "0.60725677", "0.59570324", "0.57942635", "0.5732733", "0.5721138", "0.5702478", "0.5699087", "0.56475115", "0.56121796", "0.5609035", "0.56052744", "0.5589004", "0.5555326", "0.5541834", "0.5528516", "0.5511197", "0.55007917", "0.5499388", "0.54913527", "0.54791...
0.76743954
0
Calculates and returns Y position to draw the graph or the border lines on canvas. Correct calculation is based on given sensor.
def calculate_y_pos(value, sensor): if GraphModel.check_value(value, sensor): return ((32 - int(value)) * 12.5) + 50 if sensor == 't' else 450 - (int(value) / 10 * 40) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_y_position(self):\n return self.actual_coordinates[1]", "def _get_y(self):\n return self.position.y", "def get_y_position(self): \n return self.rect.y", "def _get_y(self):\n enabled = self.num_enabled\n\n if self.heart_enabled:\n self._heart_y = 45...
[ "0.66574275", "0.6487656", "0.6412374", "0.6384742", "0.63770056", "0.63079816", "0.63051313", "0.62791324", "0.6248244", "0.6188574", "0.61683464", "0.61539483", "0.6150818", "0.6133438", "0.61187756", "0.6089482", "0.6060128", "0.605848", "0.60405856", "0.60292876", "0.6007...
0.78490245
0
Returns mean value for values in mean_t or mean_l list based on sensor.
def calculate_mean(cls, sensor): try: if sensor == 't': return cls.calculate_y_pos(sum(cls.mean_t) / len(cls.mean_t), sensor) if sensor == 'l': return cls.calculate_y_pos(sum(cls.mean_l) / len(cls.mean_l), sensor) except ZeroDivisionError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_t_mean_value(self, value_list):\n if not len(value_list):\n return None\n else:\n return round(statistics.mean(value_list), 1)", "def add_value_mean(cls, sensor, values, device_id):\n if values[device_id] is not None:\n if sensor == 't':\n ...
[ "0.72287035", "0.7126963", "0.69162667", "0.6880043", "0.68731856", "0.6742288", "0.6600956", "0.6521696", "0.6425413", "0.64079094", "0.6404101", "0.6390297", "0.63823843", "0.6371286", "0.6350793", "0.630408", "0.63019705", "0.62969667", "0.6281619", "0.62799853", "0.621725...
0.74634945
0
Adds read value to mean. Called every tick. These values are used to get the mean value.
def add_value_mean(cls, sensor, values, device_id): if values[device_id] is not None: if sensor == 't': cls.mean_t.append(int(values[device_id][sensor])) if sensor == 'l': cls.mean_l.append(int(values[device_id][sensor]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mean(self):\n self.meanval = np.mean(self.adulist)", "def mean(self, mean):\n\n self._mean = mean", "def append(self, sample):\n self.samples.append(sample)\n self.total += sample\n while len(self.samples) > self.maxlen:\n self.total -= self.samples.popleft...
[ "0.6854176", "0.6748024", "0.6688963", "0.6655775", "0.61862844", "0.6102434", "0.60873306", "0.6011965", "0.60101664", "0.6008731", "0.6008731", "0.5993495", "0.59511685", "0.59456867", "0.594157", "0.59405386", "0.5939677", "0.5939337", "0.59340096", "0.59340096", "0.593400...
0.6536168
4
Resets list of read values. Called once graph has used previous values to calculate mean.
def reset_mean(cls, sensor): if sensor == 't': cls.mean_t.clear() return cls.mean_t == [] if sensor == 'l': cls.mean_l.clear() return cls.mean_l == []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_values(self):\n\n self.values = []", "def reset_mean(self,new_mean):\n self.mean = new_mean\n return", "def reset_mean(self,new_mean):\n self.mean = new_mean\n return", "def reset_values(self):\n\n self.values = np.array([])", "def reset(self):\n s...
[ "0.71116215", "0.67884207", "0.67884207", "0.6774277", "0.6606896", "0.6513724", "0.64850163", "0.6417199", "0.63952273", "0.6310606", "0.627359", "0.6248682", "0.62342864", "0.6158954", "0.6145374", "0.61183226", "0.6116542", "0.606829", "0.60516536", "0.6004929", "0.5986703...
0.5996303
20
Checks if value is an integer and if value is in range. Returns True or False.
def check_value(value, sensor): if not GraphModel.check_if_int(value): return False return (sensor == 't' and ba.min_temp < int(value) < ba.max_temp) or \ (sensor == 'l' and ba.min_light < int(value) < ba.max_light)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_int_value(int_value):\n try:\n int(int_value)\n except ValueError:\n return False\n return True", "def is_int(value):\n try:\n int(value)\n except ValueError:\n return False\n else:\n return True", "def is_int(value):\n try:\n ...
[ "0.76669616", "0.76157403", "0.76127064", "0.76127064", "0.7480772", "0.74768794", "0.7414767", "0.7368367", "0.7346949", "0.72493625", "0.7232499", "0.7177812", "0.7109457", "0.7069834", "0.7018194", "0.70049167", "0.697105", "0.69260687", "0.6916968", "0.6914514", "0.691344...
0.61110985
89
This method is used internally to check if the current animation needs to be skipped or not. It also checks if the number of animations that were played correspond to the number of animations that need to be played, and raises an EndSceneEarlyException if they don't correspond.
def update_skipping_status(self): # there is always at least one section -> no out of bounds here if self.file_writer.sections[-1].skip_animations: self.skip_animations = True if ( config["from_animation_number"] and self.num_plays < config["from_animation_num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_next_animation(self):\n current_num_animations = len(self.queued_animations)\n while len(self.queued_animations) >= current_num_animations and len(self.queued_animations) > 0:\n self.update(100)", "def verify_ending(self):\n self._fast_forward_to_penultimate_play()\n ...
[ "0.5900172", "0.55246276", "0.5460398", "0.5384421", "0.53802437", "0.5294638", "0.5283734", "0.52820474", "0.52820474", "0.5280884", "0.5170907", "0.5156991", "0.5137927", "0.5131808", "0.5128726", "0.50902385", "0.50789577", "0.5078137", "0.50726855", "0.50664717", "0.50526...
0.746912
0
Returns an image from the current frame. The first argument passed to image represents the mode RGB with the alpha channel A. The data we read is from the currently bound frame buffer. We pass in 'raw' as the name of the decoder, 0 and 1 args are specifically used for the decoder tand represent the stride and orientati...
def get_image(self) -> Image.Image: raw_buffer_data = self.get_raw_frame_buffer_object_data() image = Image.frombytes( "RGBA", self.get_pixel_shape(), raw_buffer_data, "raw", "RGBA", 0, -1, ) return image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grabFrame(self):\r\n \r\n data, w, h, orientation = self.grabRawFrame()\r\n return Image.fromstring(\"RGB\", (w, h), data, \"raw\", \"BGR\", 0, orientation)", "def grabRawFrame(self):\r\n \r\n self.surface = self.capture.get_image(self.surface)\r\n width, height = se...
[ "0.6702811", "0.6255629", "0.62121195", "0.5816756", "0.5771386", "0.57592493", "0.56033903", "0.5568716", "0.55405825", "0.5520708", "0.54805356", "0.54444456", "0.54290974", "0.5426007", "0.5381863", "0.5361281", "0.5349747", "0.5332689", "0.5305605", "0.53024167", "0.52890...
0.6270685
1
If graph is a dag (directional acyclic graph), returns a list of the Nodes in graph such that for each edge A > B, A appears before B. If graph is not a dag, returns a list of the keys in graph in decreasing order of their Nodes' finishTime as determined from a DFS.
def topological_sort(graph, rootKey = None): # Reset's the attribute values of all Nodes in graph to their initialization values. # Importantly, resets Node.searchStatus to "undiscovered" and Node.parent to None. graph.reset() topologicalKeyList = [] # time is declared inside a function and so must be made glob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topologicalSort(graph):\n vertexState = dict.fromkeys(graph.keys(), DFS.WHITE)\n topologicalSort = []\n def dfs(vertex):\n vertexState[vertex] = DFS.GRAY\n for neighbor in graph[vertex]:\n if vertexState[neighbor] == DFS.WHITE:\n dfs(neighbor)\n vertexSta...
[ "0.6870418", "0.6653123", "0.62808746", "0.6193029", "0.615637", "0.60633636", "0.59539557", "0.59509176", "0.59378695", "0.5868872", "0.5856139", "0.5848763", "0.5805774", "0.578109", "0.57603496", "0.5736487", "0.5732424", "0.5702125", "0.57002413", "0.5691765", "0.56834507...
0.6322051
2
Recursively creates a tree rooted at thisKey. Calls from outside this function create a new tree rooted at thisKey. As each Node is finished, it('s key) is added to the front of a list which is ultimately returned. The final list is ordered by decreasing finish times. Returns [latest key finished, ..., first key finish...
def topological_sort_visit(graph, thisKey, topologicalKeyList): # Discover the Node at thisKey. global time time += 1 thisNode = graph.vertexMap[thisKey] thisNode.searchStatus = "exploring" # Explore each undiscovered adjacent Node and set their parent attributes. # The keys are ordered here to enforce an eas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gen_merkle_tree__(self):\n tree_stage = []\n tree_stage_num = int(log2(self.l))\n current_tree_stage = self.keys[1:]\n\n for i in range(0, tree_stage_num):\n tree_stage.insert(i, self.__gen_parent_level_tree__(current_tree_stage))\n current_tree_stage = tree_...
[ "0.6379297", "0.59075665", "0.57866067", "0.5698447", "0.5614546", "0.5583749", "0.55444175", "0.5527922", "0.55247885", "0.54618603", "0.5415479", "0.54131424", "0.541206", "0.5411771", "0.53825253", "0.53715", "0.5329354", "0.5318918", "0.5313793", "0.5309839", "0.5297558",...
0.52634203
24
4thorder RungeKutta integration step.
def _rk4(t, dt, x, f, args=None): x = np.asarray(x) k1 = np.asarray(f(x, t, *args)) k2 = np.asarray(f(x + 0.5*dt*k1, t + 0.5*dt, *args)) k3 = np.asarray(f(x + 0.5*dt*k2, t + 0.5*dt, *args)) k4 = np.asarray(f(x + dt*k3, t + dt, *args)) return x + dt*(k1 + 2*k2 + 2*k3 + k4)/6.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Runge_Kutta_Fourth_Order(Method, Coordinate_file, Program, Temperature, Pressure,\n molecules_in_coord, Statistical_mechanics, RK4_stepsize, min_RMS_gradient, **keyword_parameters):\n # Setting up program specific file endings and giving parameter files blank names to avoid error...
[ "0.6984782", "0.6976005", "0.66236335", "0.6574196", "0.6486697", "0.64137286", "0.63729113", "0.6325329", "0.62955695", "0.628342", "0.6192354", "0.6186201", "0.61601764", "0.61541504", "0.614848", "0.6125483", "0.61228025", "0.6114608", "0.60647225", "0.6035532", "0.6020015...
0.591413
29
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, normalize=False, title=None, cmap=plt.cm.Blues, target_names=None): if not title: if normalize: title = 'Normalized confusion matrix' else: ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8194862", "0.80949175", "0.8029915", "0.8019153", "0.79941195", "0.7991258", "0.7980955", "0.7976606", "0.79610753", "0.79590565", "0.79378676", "0.7934962", "0.7934504", "0.79313844", "0.7926313", "0.7924577", "0.79241234", "0.7923211", "0.7923023", "0.7921931", "0.791787...
0.0
-1
Toggle access to some hidden channels
async def togglechannel(self, ctx, channel): user = ctx.message.author await ctx.message.delete() if channel == "nsfw": if self.bot.nsfw_role in user.roles: await user.remove_roles(self.bot.nsfw_role) await user.send("Access to NSFW channels revoked...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def hidden(self, ctx: commands.Context, true_or_false: Optional[bool] = True):\n data = await self.config.guild(ctx.guild).pchannels()\n try:\n for key in data:\n if data[key] == ctx.author.voice.channel.id:\n ov = {\n ctx.guil...
[ "0.6628103", "0.63905036", "0.63575", "0.63066304", "0.6278452", "0.62155324", "0.62129813", "0.62129813", "0.6189753", "0.615593", "0.6109313", "0.60333866", "0.5989333", "0.59387034", "0.59250236", "0.58515936", "0.5840473", "0.5838243", "0.58030766", "0.5795239", "0.578068...
0.6161952
9
toggle some hidden roles
async def togglerole(self, ctx, role): user = ctx.message.author await ctx.message.delete() if role == "MK8D": if self.bot.mk8d_role in user.roles: await user.remove_roles(self.bot.mk8d_role) await user.send("Left MK8D role") el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def togglerole(self, ctx, role=\"\"):\r\n\r\n user = ctx.message.author\r\n joinmsg = \"Joined {0} role\"\r\n leavemsg = \"Left {0} role\"\r\n\r\n role = await commands.clean_content().convert(ctx, role)\r\n\r\n if role == \"\":\r\n embed = discord.Embed(title=\"...
[ "0.6238514", "0.6086664", "0.60527873", "0.60003686", "0.59938115", "0.5955556", "0.595006", "0.5887976", "0.5831321", "0.5823231", "0.58129466", "0.58129466", "0.5715156", "0.570212", "0.5676507", "0.5575213", "0.5554035", "0.5548002", "0.5524851", "0.5477772", "0.5448031", ...
0.5371544
24
Set the commitment to sha256(serialization of public key P2) Return in hex to calling function
def get_commitment(self): if not self.P2: raise PoDLEError("Cannot construct commitment, no P2 available") if not isinstance(self.P2, secp256k1.PublicKey): raise PoDLEError("Cannot construct commitment, P2 is not a pubkey") self.commitment = hashlib.sha256(self.P2.seriali...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sha256(self):\n return self._sha256", "def hash(self) -> bytes:", "def printsha(self):\n print(self.sha256.hex())", "def RSA_SIGNATURE_HASH() :\n return \"SHA-256\"", "def SHA256(self) -> _n_0_t_3[_n_0_t_9]:", "def hash(self) -> str:\r\n ...", "def sha256(self) -> Optional[p...
[ "0.6685336", "0.6628729", "0.65991706", "0.6530299", "0.64776933", "0.6459898", "0.6440979", "0.6411019", "0.6385267", "0.62253946", "0.6224505", "0.6205821", "0.61614484", "0.6151875", "0.61337245", "0.6097328", "0.60924083", "0.60726136", "0.60650444", "0.6061097", "0.60603...
0.70035625
0
Given a raw private key, in hex format, construct a commitment sha256(P2), which is the hash of the value xJ, where x is the private key as a raw scalar, and J is a NUMS alternative basepoint on the Elliptic Curve; we use J(i) where i is an index, so as to be able to create multiple commitments against the same privkey...
def generate_podle(self, index=0): #TODO nonce could be rfc6979? k = os.urandom(32) J = getNUMS(index) KG = secp256k1.PrivateKey(k, ctx=ctx).pubkey KJ = J.tweak_mul(k) self.P2 = getP2(self.priv, J) self.get_commitment() self.e = hashlib.sha256(''.join( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_commitment(self):\n if not self.P2:\n raise PoDLEError(\"Cannot construct commitment, no P2 available\")\n if not isinstance(self.P2, secp256k1.PublicKey):\n raise PoDLEError(\"Cannot construct commitment, P2 is not a pubkey\")\n self.commitment = hashlib.sha256(s...
[ "0.6087655", "0.5933877", "0.5853314", "0.5774425", "0.57171875", "0.56149906", "0.5612459", "0.5601832", "0.557603", "0.54608804", "0.544489", "0.5415691", "0.53977793", "0.5379621", "0.53774935", "0.53718704", "0.5356903", "0.53507465", "0.5345769", "0.53355074", "0.5330033...
0.5166209
30
Encapsulate all the data representing the proof in a dict for client functions. Data output in hex.
def reveal(self): if not all([self.u, self.P, self.P2, self.s, self.e]): raise PoDLEError("Cannot generate proof, data is missing") if not self.commitment: self.get_commitment() Phex, P2hex, shex, ehex, commit = [ safe_hexlify(x) for x in [self.P.serialize(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_data(self):\n self.check_proof()\n return {\n \"vars\": [{'name': v.name, 'T': str(v.T)} for v in self.vars],\n \"proof\": sum([printer.export_proof_item(self.thy, item, unicode=True, highlight=True)\n for item in self.prf.items], []),\n ...
[ "0.60062224", "0.59404445", "0.58804053", "0.585302", "0.5616752", "0.5561285", "0.55145526", "0.5495601", "0.5492765", "0.54911596", "0.5489464", "0.54656714", "0.5438447", "0.5421299", "0.5415515", "0.54064167", "0.5376681", "0.53762263", "0.53696877", "0.5365422", "0.53627...
0.6377318
0
For an object created without a private key, check that the opened commitment verifies for at least one NUMS point as defined by the range in index_range
def verify(self, commitment, index_range): if not all([self.P, self.P2, self.s, self.e]): raise PoDLE("Verify called without sufficient data") if not self.get_commitment() == commitment: return False for J in [getNUMS(i) for i in index_range]: sig_priv = secp2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_validity(self):\n cnt = np.array([len(v) for v in self.t_signatures.values()])\n cnt_n = len(cnt) - self.min_bins\n idx = None\n if cnt_n < 0:\n self.valid = False\n else:\n y = [np.all(cnt[i:(i + self.min_bins)] >= self.min_neigh) for i in range(...
[ "0.60313314", "0.57843703", "0.5700702", "0.5683255", "0.5668263", "0.5665159", "0.56576747", "0.56090784", "0.5576112", "0.55565137", "0.54981154", "0.5470356", "0.54564524", "0.5453247", "0.5430382", "0.53956276", "0.5395109", "0.5362661", "0.5359905", "0.53594095", "0.5355...
0.66429484
0
Returns the public key binary representation of secp256k1 G
def getG(compressed=True): priv = "\x00"*31 + "\x01" G = secp256k1.PrivateKey(priv, ctx=ctx).pubkey.serialize(compressed) return G
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derive_public_key(private_key):\r\n\r\n Q = int.from_bytes(private_key, byteorder='big') * BIP32_CURVE.generator\r\n xstr = Q.x().to_bytes(32, byteorder='big')\r\n parity = Q.y() & 1\r\n return (2 + parity).to_bytes(1, byteorder='big') + xstr", "def generate_ecc_public_key(private_key: EllipticCu...
[ "0.6999427", "0.69973236", "0.69607085", "0.6955401", "0.6817513", "0.6802411", "0.6732746", "0.6685661", "0.6667977", "0.654074", "0.6512128", "0.64995784", "0.6488834", "0.6488834", "0.6424222", "0.6328244", "0.6264105", "0.6260353", "0.6245178", "0.6235156", "0.61760545", ...
0.7992583
0
Taking secp256k1's G as a seed, either in compressed or uncompressed form, append "index" as a byte, and append a second byte "counter" try to create a new NUMS base point from the sha256 of that bytestring. Loop counter and alternate compressed/uncompressed until finding a valid curve point. The first such point is co...
def getNUMS(index=0): assert index in range(256) nums_point = None for G in [getG(True), getG(False)]: seed = G + chr(index) for counter in range(256): seed_c = seed + chr(counter) hashed_seed = hashlib.sha256(seed_c).digest() #Every x-coord on the curve ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_podle(self, index=0):\n #TODO nonce could be rfc6979?\n k = os.urandom(32)\n J = getNUMS(index)\n KG = secp256k1.PrivateKey(k, ctx=ctx).pubkey\n KJ = J.tweak_mul(k)\n self.P2 = getP2(self.priv, J)\n self.get_commitment()\n self.e = hashlib.sha256...
[ "0.588711", "0.55167645", "0.5486731", "0.5389965", "0.5368635", "0.5368635", "0.5340812", "0.5231569", "0.5220929", "0.5193509", "0.51206154", "0.5085955", "0.5046237", "0.5041022", "0.502793", "0.5023869", "0.50096273", "0.49974316", "0.49673843", "0.49673653", "0.49479038"...
0.78247774
0
Check that the algorithm produces the expected NUMS values; more a sanity check than anything since if the file is modified, all of it could be; this function is mostly for testing, but runs fast with precomputed context so can be run in user code too.
def verify_all_NUMS(write=False): nums_points = {} for i in range(256): nums_points[i] = safe_hexlify(getNUMS(i).serialize()) if write: with open("nums_basepoints.txt", "wb") as f: from pprint import pformat f.write(pformat(nums_points)) assert nums_points == prec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_converges_to_accurate_values(fake_args):\n with tempfile.TemporaryDirectory() as tmp_dir:\n fake_args.return_value = FakeArguments('orvara/tests/diagnostic_config.ini', tmp_dir)\n tt = run()[1].data\n # check params\n i = -1 # walker index.\n burn = 250 # number of ...
[ "0.6062466", "0.6013086", "0.58547235", "0.5534653", "0.5532871", "0.5531744", "0.55294245", "0.5479131", "0.54670936", "0.54526573", "0.543836", "0.5416768", "0.53805554", "0.53707004", "0.5367765", "0.53630483", "0.53561896", "0.533691", "0.533691", "0.53347796", "0.5329929...
0.63798946
0
Given a secp256k1.PrivateKey priv and a secp256k1.PublicKey nums_pt, an alternate
def getP2(priv, nums_pt): priv_raw = priv.private_key return nums_pt.tweak_mul(priv_raw)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derive_public_key(private_key):\r\n\r\n Q = int.from_bytes(private_key, byteorder='big') * BIP32_CURVE.generator\r\n xstr = Q.x().to_bytes(32, byteorder='big')\r\n parity = Q.y() & 1\r\n return (2 + parity).to_bytes(1, byteorder='big') + xstr", "def check_equal_rsa_pub_key(sk2_, sk_):\n ...
[ "0.59067875", "0.5829378", "0.5765356", "0.5526576", "0.5433772", "0.54143405", "0.5405053", "0.53853583", "0.53798145", "0.53798145", "0.5323323", "0.53160423", "0.528461", "0.5262551", "0.5256528", "0.5253128", "0.5232929", "0.5206507", "0.52053124", "0.51826376", "0.517654...
0.64084935
0
To allow external functions to add PoDLE commitments that were calculated elsewhere;
def add_external_commitments(ecs): update_commitments(external_to_add=ecs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_commitments(commitment=None, external_to_remove=None,\n external_to_add=None):\n c = {}\n if os.path.isfile(PODLE_COMMIT_FILE):\n with open(PODLE_COMMIT_FILE, \"rb\") as f:\n try:\n c = json.loads(f.read())\n except ValueError:\n ...
[ "0.6084426", "0.6054412", "0.5841496", "0.5841496", "0.5827327", "0.5769322", "0.5695153", "0.5672127", "0.55997235", "0.5597223", "0.55949086", "0.5594832", "0.5516829", "0.54900813", "0.54555416", "0.53672564", "0.53643566", "0.53592396", "0.535497", "0.535497", "0.535497",...
0.6456808
0
Optionally add the commitment commitment to the list of 'used', and optionally remove the available external commitment whose key value is the utxo in external_to_remove, persist updated entries to disk.
def update_commitments(commitment=None, external_to_remove=None, external_to_add=None): c = {} if os.path.isfile(PODLE_COMMIT_FILE): with open(PODLE_COMMIT_FILE, "rb") as f: try: c = json.loads(f.read()) except ValueError: pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_external_commitments(ecs):\n update_commitments(external_to_add=ecs)", "def commit(self):\n\t\t## Loops through ALL items\n\t\tfor k in self.data.keys():\n\t\t\tfor item in self[k]:\n\n\t\t\t\t## If the object needs committing, commit it!\n\t\t\t\tif item['meta']['needs_commit']:\n\t\t\t\t\t## Create ...
[ "0.58187145", "0.5580867", "0.50022554", "0.4993998", "0.4935813", "0.49136874", "0.4909131", "0.49072638", "0.4864383", "0.48420364", "0.48227012", "0.4786407", "0.47639194", "0.4718446", "0.46703878", "0.46602783", "0.46588057", "0.465066", "0.46503636", "0.46418327", "0.46...
0.7458837
0
Given a list of privkeys, try to generate a PoDLE which is not yet used more than tries times.
def generate_podle(priv_utxo_pairs, tries=1, allow_external=None): used_commitments, external_commitments = get_podle_commitments() for priv, utxo in priv_utxo_pairs: for i in range(tries): #Note that we will return the *lowest* index #which is still available. p = Po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_keys(g, o):\n priv = o.random()\n pub = priv * g\n\n return (priv, pub)", "def calc_pool(players):\n players = [str(x) for x in players]\n n = len(players)\n for player in players:\n nopool = payoff_nopool(p=percentages[player])\n print(nopool)\n p = {i: percen...
[ "0.5407278", "0.53765005", "0.5358425", "0.5299596", "0.52687997", "0.5203861", "0.5168442", "0.5158879", "0.50972825", "0.5045369", "0.50346786", "0.50105166", "0.4999906", "0.49660498", "0.49414423", "0.49236983", "0.4902794", "0.48773238", "0.48708338", "0.48589072", "0.48...
0.6327766
0
This function returns a list of all of the words in a document.
def separate_words(file_name): file = open(file_name, 'r') all_words = [] new_word_list = [] for line in file: for char in line: if char.isalpha(): new_word_list.append(str(char).lower()) e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_words(doc):\n splitter = re.compile('\\\\W*')\n # Split the words by non-alpha characters\n words = [s.lower() for s in splitter.split(doc) \n if len(s)>2 and len(s)<20]\n # Return the unique set of words only\n return dict([(w,1) for w in words])", "def getWords(docstr):\n # g...
[ "0.78325886", "0.76878834", "0.7548581", "0.7548581", "0.75132763", "0.75132763", "0.7500771", "0.7403039", "0.7389119", "0.73873216", "0.73423976", "0.73173547", "0.7296464", "0.7293121", "0.7286599", "0.7250563", "0.7222277", "0.719714", "0.7191383", "0.71413404", "0.713624...
0.0
-1
This function counts how many words are in the given file_name
def count_all_words(file_name): return len(separate_words(file_name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_words(filename):", "def count_words_in_file(file_name):\n\n\treturn len(get_words_in_file(file_name))", "def count_words(filename):\n try:\n with open(filename, encoding='utf-8') as f:\n contents = f.read()\n except FileNotFoundError:\n pass\n else:\n words = ...
[ "0.92212546", "0.91631883", "0.8392936", "0.82892996", "0.8273559", "0.8248086", "0.82424957", "0.8211755", "0.8179705", "0.81753147", "0.8166122", "0.8147389", "0.80578834", "0.791176", "0.786363", "0.77768314", "0.7760722", "0.77503896", "0.77346194", "0.7714639", "0.756120...
0.8836883
2
This function counts how many words are the same between the cuisine file and menu list.
def count_same_words(cuisine_file, menu): cuisine_list = separate_words(cuisine_file) same_word_count = 0 for i in cuisine_list: for j in menu: if i == j: same_word_count += 1 return same_word_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_words(filename):", "def count_words_and_dublicates(novel):", "def word_count(self):\n print(self.words())\n return len(self.words())\n #count = 0\n #for lines in self.lines:\n # line = lines.strip(os.linesep)\n # wordslst = line.split()\n # co...
[ "0.690674", "0.68663776", "0.68278384", "0.6711609", "0.66950136", "0.659886", "0.6540741", "0.651223", "0.6462825", "0.63756806", "0.62130094", "0.6198834", "0.61832255", "0.6172285", "0.61688614", "0.6166723", "0.615954", "0.61456776", "0.6139662", "0.61389077", "0.6133218"...
0.8976418
0
Writes a dictionary of cuisines, scores per dining hall menu to a JSON file
def to_JSON(meal, list_of_cuisines, list_of_menus): data = {} for cuisine in list_of_cuisines: cuisine_list = separate_words(cuisines[cuisine]) scores = {} for i in range(len(list_of_menus)): scores[menus[i]] = get_score(cuisines[cuisine], list_of_menus[i]) data[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_json(toWrite):\n with open('clubs.json', 'w+') as outfile:\n json.dump(toWrite, outfile)", "def write_to_json(dictData, fileout):\n\t# Prepare the output file\n\tfout = codecs.open(fileout, 'w', 'utf-8')\n\thwDict = prepare_hw_dict(dictData)\n\tjson.dump(hwDict, fout)\n\t# Give some summary t...
[ "0.63122237", "0.612619", "0.5950973", "0.57618344", "0.5728447", "0.5712075", "0.5669831", "0.5658273", "0.56450564", "0.56368273", "0.5627659", "0.56155825", "0.5583689", "0.5558727", "0.55583084", "0.5555163", "0.55480874", "0.5523268", "0.55128515", "0.55048144", "0.54915...
0.75506806
0
split data from post tag
def split_POS_tag(data_dir, split_sum, split_count): with open(data_dir + "pos_tag.json") as pos_tag: pos_data = json.load(pos_tag) for i in range(0, split_sum, split_count): pos_data_split = pos_data[i:i+split_count] split_dir = data_dir + "pos_tag_"+ str(i) + "_" + str(i+split_count) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getPostData(data):\n\tparams = data.split(\"\\r\\n\\r\\n\")[1]\n\treturn params.split(\"&\")", "def post_data_parser(post_data):\n post_data_json = {}\n for parameter in post_data.rsplit(\"&\"):\n post_data_json[parameter.rsplit(\"=\")[0]] = parameter.rsplit(\"=\")[1]\n return post_data_json...
[ "0.6730449", "0.5935488", "0.59213", "0.58509296", "0.5801925", "0.5733575", "0.5683659", "0.56764436", "0.5670018", "0.54840696", "0.54830337", "0.5457703", "0.5416807", "0.53818005", "0.5356286", "0.5351869", "0.53304595", "0.53297937", "0.5307494", "0.52983165", "0.5281591...
0.47886896
93
split data from raw json
def split_data(data_dir, split_sum, split_count): with open(data_dir + "data.json") as raw_file: raw_data = json.load(raw_file)["list_string"] raw_data_dict = {} raw_data_dict["pos"] = "" raw_data_dict["negation_label"] = 0 raw_data_dict["error_label"] = 0 raw_data_dict["semantic_label"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _separate_raw_data(self, raw_data):\n for key, value in raw_data.items():\n if type(value) == dict:\n self.data_dict[key] = value\n elif type(value) == list:\n self.data_list[key] = value", "def extract_data(line):\n lines = line.split(' - ')\n ...
[ "0.6280174", "0.6204928", "0.60424036", "0.59973556", "0.5838469", "0.57746494", "0.57594657", "0.57127994", "0.568985", "0.568885", "0.5684861", "0.56730115", "0.5666996", "0.5622222", "0.5616759", "0.5602831", "0.55976075", "0.55788", "0.55546767", "0.5549629", "0.55450976"...
0.6056986
2
get shape key local co
def get_shapekeys_co(ob_name): obj = bpy.data.objects[ob_name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_key_id(self):", "def loc_key(self):\r\n key = tuple(self.loc.coord)\r\n return (key)", "def key():", "def grid_shape(self, key):\n return self.execute(b\"GRID.SHAPE\", key)", "def GetRootKey(self):", "def locate_shape(shape):", "def shape_id(self):\n return self._sha...
[ "0.62794775", "0.627112", "0.6183166", "0.61344665", "0.5998332", "0.5967131", "0.5965354", "0.59295803", "0.5864717", "0.5857207", "0.5822323", "0.57988447", "0.5792031", "0.5763907", "0.57507324", "0.5741417", "0.5723869", "0.5723869", "0.57104725", "0.5698671", "0.5692661"...
0.7656703
0
get the b in ax = b
def get_animation_verts(ob_name): "metahuman_004_FaceMesh" obj = bpy.data.objects[ob_name] count = len(obj.data.vertices) verts = np.zeros(count*3, dtype=np.float32) depsgraph = bpy.context.evaluated_depsgraph_get() object_eval = obj.evaluated_get(depsgraph) mesh_from_eval = object_eval.to_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getB(self):\n\t\treturn self.b", "def __getxyB(x, y):\n\t\treturn x*3+y", "def get_b(self):\n return self._b", "def b(self):\r\n return self.__b", "def acc_b_v(self):\r\n return self._acc_b_v", "def b(self):\n return self._b", "def b(self):\n return self._b", "def b...
[ "0.70153064", "0.6971221", "0.68219525", "0.64924663", "0.64658225", "0.63635904", "0.63635904", "0.63635904", "0.63635904", "0.62055707", "0.60724425", "0.60151994", "0.5949541", "0.59409136", "0.5863105", "0.57899165", "0.57492495", "0.57482284", "0.5725232", "0.5725232", "...
0.0
-1
Connect to the specified filename representing the SQLite db.
def connect_db(file_name): db = sqlite3.connect(file_name) c = db.cursor() return db, c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_sqlite_connection(self):\n filename = filedialog.askopenfilename(title=\"Open\", filetypes=((\"Database files\", \"*.db\"),))\n if filename:\n self.connection = Connection('sqlite', filename)\n self.session = self.connection.new_session()", "def create_sqlite_connecti...
[ "0.80312794", "0.7777943", "0.77503705", "0.75681734", "0.7535913", "0.75350404", "0.75303537", "0.75202596", "0.75080675", "0.74739575", "0.7466751", "0.7463046", "0.74533737", "0.7449823", "0.7445868", "0.7440627", "0.7440627", "0.7440627", "0.7433183", "0.7433183", "0.7433...
0.7483485
9
Gets all users having a specific treatment. Return a list of unique ids.
def get_userids(cursor, having_treatment=None): cursor.execute('SELECT id FROM users WHERE treatment=?', (having_treatment,)) return cursor.fetchall()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id_users(self):\n return self.execute(TABELLE['id_users']['select']['all'])", "def _get_user_ids(model):\n return model.objects.values_list(\"user\", flat=True).distinct(\"user\")", "def user_ids(self):\n return list(self.get_users())", "def get_users_and_id(self):\n return se...
[ "0.6486269", "0.6268288", "0.6096328", "0.5965909", "0.5874028", "0.5859561", "0.58230615", "0.58035034", "0.5749481", "0.5737924", "0.57142645", "0.5705991", "0.57020724", "0.5667985", "0.5667205", "0.5649348", "0.5617039", "0.5612184", "0.55673", "0.5501717", "0.54955304", ...
0.75097686
0
Inject a new user if it is not already existent.
def inject_user(dbConn, uid, username): try: with dbConn: pars = (uid, username) print "pars: ", pars dbConn.execute( """INSERT OR IGNORE INTO users(uid, username) VALUES(?, ?)""", pars) except sqlite3.IntegrityError as e: log.error("Error in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_append_existing_user(self):\n print('(' + self.test_append_existing_user.__name__+')',\n self.test_append_existing_user.__doc__)\n self.assertIsNone(self.connection.append_user(\n PATIENT_USERNAME, NEW_PATIENT))", "def add_user_to_g():\n \n if CURRENT_USER in ...
[ "0.6981035", "0.6747009", "0.6734936", "0.67245996", "0.671906", "0.671906", "0.671906", "0.6718293", "0.66659963", "0.6617214", "0.6604228", "0.6601467", "0.6455636", "0.6441589", "0.6425503", "0.63296014", "0.63053393", "0.629712", "0.6287836", "0.6258661", "0.6240081", "...
0.68272775
1
Make an update for entry in 'notifications' DB table for a notification message. When a notification arrives.
def make_notification_update(dbConn, obj): try: with dbConn: dbConn.execute("update notifications set rcv_ts=? where msg_id=?", (obj['dt'], obj['msg_id'])) except sqlite3.IntegrityError as e: log.error("Error in DB transaction when updating notification fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def update_notification_status(db_session: Session, notification: NotificationUpdate):\n notification_exists = await NotificaitonCRUD.find_notification_by_id(db_session, notification.id)\n if notification_exists:\n notification_exists.sent_date = notification.sent_date\n n...
[ "0.68454736", "0.6658394", "0.6574994", "0.6457614", "0.63482887", "0.62627167", "0.6245886", "0.62132937", "0.6201244", "0.61510915", "0.6078458", "0.60640794", "0.60503453", "0.6039418", "0.59960485", "0.59960234", "0.59941435", "0.5983427", "0.59663224", "0.5915447", "0.58...
0.7377954
0
Get the last used uid. Corresponds to the number of current rows in users table.
def get_last_uid(cursor): cursor.execute('SELECT count(uid) FROM users') return int(cursor.fetchall()[0][0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_last_id(cls):\n db = database.db_connection()\n cursor = db.cursor()\n sql_query = \"SELECT max(id_user) FROM user\"\n cursor.execute(sql_query)\n row = cursor.fetchone()\n cursor.close()\n return int(row[0])", "def findLastUserID():\n conn = engine.c...
[ "0.71453404", "0.69029254", "0.68670946", "0.6793728", "0.67858857", "0.65834606", "0.65095794", "0.6316191", "0.6264117", "0.6212843", "0.6200426", "0.6200426", "0.6200426", "0.6198154", "0.61980546", "0.6170376", "0.61453146", "0.60790145", "0.6074715", "0.6057952", "0.5975...
0.8011418
0
Get the last sessios id. Corresponds to the number of current rows in sessions table.
def get_last_sid(cursor): cursor.execute('SELECT count(sid) FROM sessions') return int(cursor.fetchall()[0][0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_last_id(cls):\n db = database.db_connection()\n cursor = db.cursor()\n sql_query = \"SELECT max(id_user) FROM user\"\n cursor.execute(sql_query)\n row = cursor.fetchone()\n cursor.close()\n return int(row[0])", "def last(self):\n return int(self.r...
[ "0.71088165", "0.7083588", "0.7010163", "0.6716816", "0.66496617", "0.66146433", "0.65737474", "0.65153116", "0.6488121", "0.6480088", "0.64697057", "0.6468558", "0.6450978", "0.6436075", "0.62589836", "0.6256979", "0.6219457", "0.62008554", "0.61697483", "0.61649126", "0.615...
0.77453893
0
Checks if the block has a value associated with a given attribute. Returns the T/F value of that check.
def __contains__(self, attribute_name): return False # pragma: no cover
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about_attribute(self, name):\n for cdef in self.getmro():\n if name in cdef.attrs:\n s_result = cdef.attrs[name].s_value\n if s_result != s_ImpossibleValue:\n return s_result\n else:\n return None\n retu...
[ "0.6455551", "0.63856006", "0.6380633", "0.6380633", "0.6276537", "0.5993905", "0.5960404", "0.5906758", "0.58617663", "0.5859435", "0.58545864", "0.5839311", "0.5821635", "0.5802421", "0.5775815", "0.5761179", "0.5709144", "0.5704257", "0.5696985", "0.5696533", "0.5689685", ...
0.0
-1
Set an attribute of the block to have a specific value. Note that this is a destructive overwrite if the attribute had a previous value.
def __setitem__(self, attribute_name, value): pass # pragma: no cover
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_attribute(self, name, value):\n\n pass", "def set_attr(self, asset_key, attr, value=True):\r\n self.set_attrs(asset_key, {attr: value})", "def set_attribute(self, attr, value):\n logger.debug(\"SET ATTRIBUTE {} to {}\".format(attr, value))", "def set(self, attribute, value):\n ...
[ "0.72852594", "0.71782523", "0.7053205", "0.6885064", "0.6843691", "0.6814253", "0.6800374", "0.6671457", "0.6614173", "0.66132635", "0.6594443", "0.6588818", "0.657348", "0.65617675", "0.6553907", "0.6532638", "0.65098536", "0.649894", "0.64950657", "0.6494574", "0.6459838",...
0.59992915
58
Return the value of a given attribute of the block.
def __getitem__(self, attribute_name): return None # pragma: no cover
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attribute_value(self) -> str:\n return pulumi.get(self, \"attribute_value\")", "def __getattr__(self, attribute):\n ret_val = getattr(self._value, attribute)\n return ret_val", "def get_value(self, block):\n value = getattr(block, self.parameter_name)\n if self.formula is...
[ "0.7026187", "0.6933966", "0.6878825", "0.6842516", "0.67986757", "0.67924726", "0.6760566", "0.6760566", "0.6730111", "0.6687998", "0.6649922", "0.66475594", "0.66282576", "0.66282576", "0.66282576", "0.6625704", "0.6625704", "0.6625704", "0.6601716", "0.6571391", "0.6570338...
0.0
-1
Convert to a compiled block. Uses the existing has(), set(), and get() operations on the block, as well as leveraging the context if desired. No other operations may be relied on to exist.
def compile(self): return None # pragma: no cover
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_block(self, current, block_params):\n block_args = {}\n\n # extract name\n block_name = block_params['name']\n\n # save upper_tri flatten\n self.preds_triu |= (block_name == 'upper_tri')\n \n # if Keras, get block variables names\n pass_all_globals = True\n if block_name[0]...
[ "0.6083432", "0.6052982", "0.5920443", "0.57263225", "0.56978273", "0.56699336", "0.56249857", "0.5570866", "0.5519436", "0.5460835", "0.5449454", "0.54401827", "0.5437248", "0.54197574", "0.5404059", "0.54003495", "0.5385774", "0.53805405", "0.5361094", "0.53163844", "0.5312...
0.5186814
31
Method to locate and send the user_name to login page.
def enter_username(self, user=TestData.USERS[0]): self.username.clear() self.username.click() self.username.send_keys(user) return self.username
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enter_username(self):", "def user():\n if \"username\" in session:\n username = session[\"username\"]\n return f\"<h1>{username}</h1>\"\n return redirect(url_for(\"login\"))", "def do_login(self, login):\n if not login:\n print('please supply a user name to login')\n ...
[ "0.7245115", "0.71635675", "0.7130957", "0.7098521", "0.6974844", "0.69725806", "0.69709194", "0.6718153", "0.6671411", "0.6669573", "0.6668547", "0.6661385", "0.6631735", "0.6631735", "0.6626392", "0.6591681", "0.6591681", "0.6563645", "0.65570194", "0.65399295", "0.6459479"...
0.70288193
4
Method to locate and send the password to login page.
def enter_password(self): self.password.clear() self.password.click() self.password.send_keys(TestData.PASSWORD) sleep(TestData.DELAY) return self.password
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_password(self,text):\r\n return self.driver.find_element(*SinginPage.password).send_keys(text)", "def log_in_password(self):\n password_elem = waiter.find_element(self.driver, 'password', by=NAME)\n return password_elem.get_attribute('value')", "def log_in_password(self, password):...
[ "0.7597619", "0.759405", "0.73641455", "0.72979414", "0.7020201", "0.6964761", "0.69096184", "0.6870856", "0.68634623", "0.6860177", "0.6843023", "0.6816947", "0.6816947", "0.679568", "0.67951405", "0.67888826", "0.67781925", "0.67553616", "0.67450225", "0.6737726", "0.673022...
0.6661715
23
Method to locate and click login button
def click_login(self): self.login.click() return self.login
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_login_button(self):", "def click_login_button(self):\n submit_button = self.locate_element_by_css_selector(LOGIN_BUTTON_SELECTPR)\n submit_button.click()", "def login(self):\n self.driver.find_element(*BaseLocators.PRIMARY_BUTTON).click()", "def log_in_button_click(self):\n ...
[ "0.84078276", "0.8386845", "0.83338106", "0.82320184", "0.8073118", "0.7755192", "0.77092034", "0.7578108", "0.74145705", "0.72704613", "0.7243353", "0.7226535", "0.7203748", "0.71688896", "0.7167337", "0.71640134", "0.71494836", "0.71324444", "0.712173", "0.7070081", "0.7027...
0.80358994
5
Method to scroll down and up the page
def scroll_page(self): scroll_down = self.driver.find_element_by_tag_name("html") scroll_down.send_keys(Keys.END) sleep(TestData.DELAY) scroll_down.send_keys(Keys.CONTROL + Keys.HOME) sleep(TestData.DELAY) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scroll_down(self):\r\n self.driver.execute_script('window.scrollTo(0, document.body.scrollHeight);')\r\n sleep(self.wait)", "def scroll_half_page_up(event):\n scroll_backward(event, half=True)", "def scrollTop(self):\n\t\tself.driver.execute_script(\"window.scrollTop(0)\")", "def scroll_...
[ "0.74910605", "0.6924257", "0.68156487", "0.681399", "0.67801416", "0.66706586", "0.66691154", "0.66658944", "0.6662427", "0.66357076", "0.660041", "0.65823764", "0.6574611", "0.6517441", "0.643081", "0.6410477", "0.6406138", "0.6405084", "0.63762605", "0.63598233", "0.634576...
0.71633923
1
Method to locate the bot image in the login page
def bot_image(self): return self.bot_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locateImageOnScreen(ImageName):\n location = pyautogui.locateOnScreen(ImageName) \n try: \n for x in location:\n return location\n except:\n sys.exit('The image could not be found in the active screen. \\n'+'Stopping program.')", "def get_bot_icon(self):\n return s...
[ "0.61848575", "0.6016288", "0.5862747", "0.5774769", "0.5676973", "0.565614", "0.56560594", "0.561276", "0.556046", "0.556046", "0.5436463", "0.54205257", "0.54033643", "0.5379427", "0.5356934", "0.5349648", "0.53474325", "0.5340549", "0.5332325", "0.5332325", "0.5332325", ...
0.70394737
0
Send a request to the website; get html and use BS to parse.
def getHTML(self): html = requests.get(self.URL).text soup = BeautifulSoup(html, "lxml") return soup
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request(self, url):\r\n\r\n req = self.get(url)\r\n soup = BeautifulSoup(req.content, \"lxml\")\r\n return soup", "def request(url):\n response=requests.get(url)\n soup=BeautifulSoup(response.content,\"lxml\")\n return soup", "def make_request(url):\r\n req = requests.get(u...
[ "0.73586965", "0.72802454", "0.71961963", "0.7060133", "0.7015183", "0.6989629", "0.6912771", "0.6907971", "0.67884505", "0.6747878", "0.6738168", "0.67174125", "0.65971315", "0.65941864", "0.6588109", "0.65566903", "0.6551328", "0.6546303", "0.6507564", "0.64768684", "0.6455...
0.6013323
60
Populates the object's quotes array.
def HTMLparser(self): soup = self.getHTML() # Sort through all the text in the html: for text in soup.find_all('p'): try: paragraphNo = int(text.parent.p['id'][14:]) # Only grab paragraphs in "On the Social Contract" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quotes(self, quotes):\n\n self._quotes = quotes", "def __build_quotes_from_query_result(self, rows: List[sqlite3.Row]) -> List[Quote]:\n quotes = []\n\n for row in rows:\n quotes.append(Quote(row['id'], row['author'], row['quote'], row['created_at']))\n\n return quotes"...
[ "0.67744374", "0.6084", "0.5712852", "0.5712852", "0.56015575", "0.5570666", "0.545815", "0.5396111", "0.5395227", "0.53650916", "0.52743995", "0.5270798", "0.51627326", "0.5155274", "0.5130806", "0.51138353", "0.5076283", "0.5031665", "0.4976316", "0.4962586", "0.4921472", ...
0.0
-1
Write into the corpus file.
def corpusWriter(self): with open('corpus.txt', 'w') as file: for quote in self.quotes: file.write(quote + '\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_corpus_to_file(output_file, corpus): \n \n file = open(output_file, 'w')\n for line in corpus: \n file.write(line)\n print ('Corpus has been writted in file')\n file.close()", "def save(file, corpus):\n with open(file, 'w') as f_out:\n f_out.write(corpus)", "def sav...
[ "0.8130881", "0.7788724", "0.71461576", "0.70922303", "0.6882938", "0.6699375", "0.6698951", "0.65648764", "0.63408846", "0.63222456", "0.6238415", "0.6161453", "0.6103348", "0.6076733", "0.6034292", "0.6018647", "0.5968113", "0.5964516", "0.59475064", "0.5937549", "0.5929299...
0.80795825
1
Sets/gets epsilon (linear coefficient)
def linear_coefficient(self): if self._epsilon.size == 1: return np.full((cfg.Nx, cfg.Ny), self._epsilon.get_h(), dtype = cfg.dtype) else: return self._epsilon.get_h()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epsilon_delta(self):", "def epsilon():\n return _EPSILON", "def epsilon(self):\n return self.__epsilon", "def epsilon(self):\n return self._epsilon", "def set_epsilon(self,epsilon):\r\n\t\tself.epsilon = epsilon", "def __init__(self, epsilon=1e-14):\n self.epsilon = epsilon", ...
[ "0.7321953", "0.7270123", "0.69878083", "0.6875579", "0.68674105", "0.6795693", "0.67359823", "0.67171705", "0.6712022", "0.6666621", "0.66384065", "0.66193897", "0.6487971", "0.64055926", "0.62626576", "0.6249151", "0.62280107", "0.62033653", "0.6192877", "0.61483586", "0.61...
0.6522892
12
Sets/gets homogeneous external field and does not update vector potential.
def homogeneous_external_field(self): return self._H
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def external_field(self):\n # TODO: return curl(A) for non-homogeneous external_field\n A = self.external_vector_potential\n if A is not None:\n Ax, Ay = A\n # TODO: check expression below\n return (- np.diff(Ax, axis=1) * cfg.idy\n + np.diff...
[ "0.6045435", "0.6040067", "0.58883786", "0.5711208", "0.55493957", "0.5493443", "0.54701155", "0.53724504", "0.5348009", "0.5171922", "0.5158918", "0.5158763", "0.51249254", "0.5080409", "0.50776005", "0.5062098", "0.5047997", "0.5029041", "0.50261176", "0.5023545", "0.498671...
0.61421114
0
Sets self.gvpei = (self.ae, self.be) + (ai, bi). To be executed in self.external_vector_potential and self.fixed_vortices setters.
def _update_gvpei(self): assert (self.ae is None) == (self.be is None) ai, bi = None, None if self.fixed_vortices is not None and self.fixed_vortices._vpi is not None: ai, bi = self.fixed_vortices._vpi.get_vec_h() assert (ai is None) == (bi is None) vpe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_global_problem_vf_3_gr1_bif(self):\n #0\n std_map = Epetra.Map(len(self.all_fine_vols_ic),0,self.comm)\n self.trans_fine = Epetra.CrsMatrix(Epetra.Copy, std_map, 7)\n self.b = Epetra.Vector(std_map)\n for volume in self.all_fine_vols_ic - set(self.neigh_wells_d):\n ...
[ "0.56007665", "0.5436167", "0.53549033", "0.5279826", "0.52668923", "0.5232523", "0.5191996", "0.5186861", "0.5171484", "0.5170207", "0.5155571", "0.5155571", "0.51301646", "0.50711966", "0.50634015", "0.5041026", "0.5024466", "0.50092936", "0.5004564", "0.49962527", "0.49778...
0.8162519
0
Sets/gets external vector potential.
def external_vector_potential(self): assert (self.ae is None) == (self.be is None) if self.ae is not None: return self.ae, self.be return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def external_irregular_vector_potential(self):\n if self._vpei is not None:\n return self._vpei.get_vec_h()\n\n return None", "def potential(self) -> np.ndarray:\n if self._V is None:\n potential = -self._gp.reshape(-1, 1) * self._gp # pylint: disable=E1101\n ...
[ "0.6709609", "0.6408864", "0.63957906", "0.6121401", "0.6120507", "0.6060116", "0.6041537", "0.5978795", "0.5968136", "0.59421694", "0.5931237", "0.5890419", "0.5791883", "0.5742687", "0.57241136", "0.57071424", "0.5693986", "0.56902176", "0.5679575", "0.56609213", "0.5643648...
0.67878634
0
Sets/gets external irregular vector potential
def external_irregular_vector_potential(self): if self._vpei is not None: return self._vpei.get_vec_h() return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def potential(self) -> np.ndarray:\n if self._V is None:\n potential = -self._gp.reshape(-1, 1) * self._gp # pylint: disable=E1101\n object.__setattr__(self, \"_V\", potential)\n return self._V", "def external_vector_potential(self):\n assert (self.ae is None) == (self...
[ "0.6777151", "0.6714715", "0.6365124", "0.62756366", "0.62136114", "0.615632", "0.6140968", "0.6131208", "0.61214024", "0.6068877", "0.6030403", "0.5973165", "0.596924", "0.59545225", "0.5888215", "0.5796419", "0.5769236", "0.57671154", "0.5765479", "0.57427657", "0.57207257"...
0.711595
0
Sets/gets external (nonhomogeneous) magnetic field. Setter accepts only a number now.
def external_field(self): # TODO: return curl(A) for non-homogeneous external_field A = self.external_vector_potential if A is not None: Ax, Ay = A # TODO: check expression below return (- np.diff(Ax, axis=1) * cfg.idy + np.diff(Ay, axis=0)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnetisation(field):\n norm_field = df.Field(field.mesh, dim=1, value=(field.norm.array != 0))\n volume = df.integral(norm_field * df.dV, direction='xyz')\n return df.integral(field * df.dV / volume, direction='xyz')", "def set_mag(self, target_mag):\n raise NotImplementedError", "def forc...
[ "0.6052164", "0.58075583", "0.5660472", "0.56470233", "0.56268007", "0.55273485", "0.55198425", "0.54633737", "0.54148656", "0.5404679", "0.5372116", "0.5360851", "0.53192836", "0.5313411", "0.53039193", "0.5290954", "0.52766335", "0.524643", "0.5224424", "0.51870406", "0.517...
0.46482316
99
Check usage of default credentials on master node
def test_001_check_default_master_node_credential_usage(self): ip = self.config.nailgun_host ssh_client = ssh.Client(ip, self.config.master.master_node_ssh_user, self.config.master.master_node_ssh_password, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_003_check_default_keystone_credential_usage(self):\n\n usr = self.config.master.keystone_user\n pwd = self.config.master.keystone_password\n url = 'http://{0}:5000/v2.0'.format(self.config.nailgun_host)\n\n try:\n keystone = keystoneclient(usernam...
[ "0.8095686", "0.73973477", "0.68096805", "0.6725103", "0.6619466", "0.6389539", "0.6344078", "0.6290091", "0.6246063", "0.6232161", "0.61840326", "0.6176696", "0.6170216", "0.6159659", "0.611495", "0.6110858", "0.60856205", "0.6053819", "0.60522896", "0.604298", "0.6013833", ...
0.7976447
1
Check if default credentials for OpenStack cluster have changed
def test_002_check_default_openstack_credential_usage(self): cluster_data = { 'password': self.config.identity.admin_password, 'username': self.config.identity.admin_username} default_data = { 'password': 'admin', 'username': 'admin'} self.verify...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_003_check_default_keystone_credential_usage(self):\n\n usr = self.config.master.keystone_user\n pwd = self.config.master.keystone_password\n url = 'http://{0}:5000/v2.0'.format(self.config.nailgun_host)\n\n try:\n keystone = keystoneclient(usernam...
[ "0.7338063", "0.65568185", "0.6468364", "0.62571883", "0.59062266", "0.5873348", "0.585109", "0.5782438", "0.57635754", "0.57020897", "0.5653839", "0.563108", "0.5605719", "0.55638623", "0.5553499", "0.5546776", "0.5503604", "0.5487107", "0.5486545", "0.5467942", "0.5448755",...
0.7722615
0
Check usage of default credentials for keystone on master node
def test_003_check_default_keystone_credential_usage(self): usr = self.config.master.keystone_user pwd = self.config.master.keystone_password url = 'http://{0}:5000/v2.0'.format(self.config.nailgun_host) try: keystone = keystoneclient(username=usr, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_002_check_default_openstack_credential_usage(self):\n cluster_data = {\n 'password': self.config.identity.admin_password,\n 'username': self.config.identity.admin_username}\n\n default_data = {\n 'password': 'admin',\n 'username': 'admin'}\n\n ...
[ "0.7416696", "0.73040277", "0.66775703", "0.64706546", "0.63807833", "0.63734967", "0.6169981", "0.6136318", "0.6118", "0.6086049", "0.607734", "0.60373425", "0.60364085", "0.6034082", "0.59883475", "0.5980997", "0.5974277", "0.59671694", "0.59401226", "0.5902685", "0.5882367...
0.8827416
0
serve all the available categories in database
def showCategories(): categories = session.query(Category).all() if 'username' not in login_session: return render_template("publicCategories.html", categories=categories) return render_template("categories.html", categories=categories)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_categories():\n return session.query(Category)", "def getAllCategory():\n return session.query(Category).all()", "def _get_all_categories() -> dict:\n categories = database.fetchall(\"Categories\", \"id\", \"name_ua\")\n return categories", "def category_list():\n categories = ...
[ "0.7705028", "0.7627448", "0.7511238", "0.7445892", "0.7405592", "0.7365661", "0.7350554", "0.72850347", "0.72420293", "0.7235994", "0.7227327", "0.72021663", "0.7164747", "0.7158634", "0.71210396", "0.7074154", "0.70734376", "0.7038551", "0.7037313", "0.7008739", "0.69950527...
0.6956977
23