query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Normalize a real vector. If axis is provided, vec is treated as an array of vectors, and normalized along the given axis. This should work for arrays of any dimension. (Test this!)
def vector_normalize(vec, axis=None): mag = vector_magnitude(vec, axis=axis) mag = mag if mag > 0 else 1 if axis is None: return vec / mag else: axis_ix = [None] * len(vec.shape) axis_ix[axis] = slice(None, None, None) return vec / numpy.array([mag])[axis_ix]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(complex_vec, axis=None):\n cv_mag_vector = complex_magnitude(complex_vec)\n return vector_normalize(cv_mag_vector, axis=axis)", "def normalize(a, axis=None):\n a_sum = a.sum(axis)\n if axis and a.ndim > 1:\n a_sum[a_sum == 0] = 1\n shape = list(a.shape)\n shape[axis...
[ "0.7519781", "0.728784", "0.7094881", "0.70240945", "0.70092386", "0.6912532", "0.68835497", "0.68467253", "0.68467253", "0.68467253", "0.6808038", "0.67459893", "0.67228395", "0.67105323", "0.6704893", "0.669974", "0.6697565", "0.66756153", "0.6632518", "0.66218597", "0.6610...
0.8560221
0
The number of complex components required to store `self.n_components` real values. When `self.n_components` is even, this will be exactly `self.n_components / 2`. When it is odd, it will be the first integer larger than `self.n_components / 2`. The final imaginary part of the last component will be superfluous.
def n_complex_components(self): return self.n_components // 2 + (self.n_components % 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_components(self):\n return self._components.shape[0]", "def n_components(self):\n return 1", "def getNumberOfScalarComponents(self):\n\t\treturn self.numberOfComponents", "def components(self):\n return self.num_components", "def n_elements(self) -> int:\n n_elem = np.prod...
[ "0.7240709", "0.7238164", "0.71666574", "0.6786088", "0.6500541", "0.6454424", "0.64439607", "0.630045", "0.62663865", "0.62208223", "0.6142444", "0.6125171", "0.6113677", "0.6085901", "0.60725677", "0.60527974", "0.6037869", "0.60263354", "0.5976681", "0.59763", "0.59419096"...
0.8941237
0
The number of trees in the Deduplicator.
def n_trees(self): return len(self.data_kd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_trees(self) -> int:\n\n return len(self.nodes)", "def num_trees(self):\n return self._ll_tree_sequence.get_num_trees()", "def tree_size(self) -> int:\n Q = Queue()\n count = 0\n Q.put(self.root)\n while not Q.empty():\n node = Q.get()\n co...
[ "0.79976815", "0.79958075", "0.77839524", "0.77313733", "0.7635082", "0.7615049", "0.7488677", "0.7465807", "0.7463311", "0.74288374", "0.74173415", "0.7382103", "0.73811615", "0.732395", "0.7315135", "0.7302796", "0.7301912", "0.7298887", "0.72675365", "0.72401077", "0.72381...
0.848073
0
A helper function used by `show_umap_bokeh` to build an array of color data for use by Bokeh.
def umap_color(metadata, color_field, n_colors, dtype=None, palette=magma): palette = palette(n_colors) if color_field is None: metadata_cf = metadata else: metadata_cf = metadata[color_field] if dtype is None: dtype = type(metadata_cf[0]) field = [f if isinstance(f, dtype) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getColors():\n return ['#8c99fc', '#cacefd', '#fff1d7', '#feda98', '#fda85a', '#fc6647']", "def create_colors_list(color_dict):\r\n ret = []\r\n for i in range(len(color_dict)):\r\n ret.append('#' + color_dict[i]['@rgb'])\r\n return ret", "def color(self, data):\n\n red = np.inter...
[ "0.6931707", "0.6698643", "0.6680369", "0.6671751", "0.6602958", "0.6553288", "0.6450207", "0.6448156", "0.6438136", "0.6398265", "0.6398265", "0.63950753", "0.6352892", "0.6350359", "0.6239184", "0.62187016", "0.6171562", "0.61550665", "0.614368", "0.61311966", "0.6117753", ...
0.58662444
43
Generate a Bokeh scatterplot based on a UMAP model. Colors points based on the metadata field indicated by `color_field`. If no color field is provided, a third UMAP dimension is used instead.
def show_umap_bokeh(data, metadata, color_field=None, n_neighbors=10, min_dist=0.001, metric='euclidean'): if color_field is None: dims = 3 else: dims = 2 um = umap.UMAP(n_neighbors=n_neighbors, n_components=dims, min_dist=min_dist, metric=metric) v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_scatter(df_orig, met, xaxis, **kwargs): \n if 'cato' in kwargs:\n cato = kwargs['cato']\n else:\n cato = False\n if 'col' in kwargs:\n col = kwargs['colors']\n else:\n col = Set1[9]\n if 'metric_attrib' in kwargs:\n metric_attrib = kwargs['metric_attr...
[ "0.5492606", "0.5483295", "0.53167456", "0.5283011", "0.5192205", "0.5092238", "0.5048542", "0.5032877", "0.50081116", "0.49516362", "0.49432778", "0.49351755", "0.4933292", "0.4930656", "0.48160133", "0.48076048", "0.47774604", "0.47606358", "0.4737379", "0.4736001", "0.4734...
0.6745194
0
This is the home view. It is called when the user goes to the '/' route.
def home(request): user = request.user context = get_adventure_info() context.update(csrf(request)) return render_to_response('coreapp/home.html', context, context_instance=RequestContext(request),)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n return render_to_response('home.html', {}, RequestContext(request))", "def home(request):\n\treturn render(request, \"compta/home.html\")", "def home():\n return render_template('home.html',\n face=session.get(app.config['SESSION_KEY'], None))", "def home(...
[ "0.8226537", "0.81130207", "0.808595", "0.80539376", "0.80247283", "0.80203336", "0.79686517", "0.7932893", "0.7923409", "0.79155874", "0.78881216", "0.7881082", "0.7878804", "0.7848929", "0.7848929", "0.7848929", "0.7848929", "0.7848929", "0.7848929", "0.7848929", "0.7848929...
0.0
-1
Makes sure form has first_name and last_name and a volunteer exists, otherwise raise form error.
def clean(self): cleaned_data = super(LogSignInForm, self).clean() volunteer = check_volunteer_handle(cleaned_data) cleaned_data['volunteer'] = volunteer return self.cleaned_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_valid(self, form, request):\n data = form.data\n\n # Password hashing\n password = make_password(data.get('password1'))\n\n # Checkbox has value 'on' instead of True\n volunteer = False\n flag = data.get('volunteer')\n if flag is not None and flag != 'false...
[ "0.6447232", "0.6308293", "0.62191516", "0.604255", "0.5990323", "0.5868001", "0.5857009", "0.5840189", "0.5782123", "0.5722739", "0.569707", "0.5681966", "0.5670703", "0.56222343", "0.56193906", "0.5606477", "0.5586893", "0.5580236", "0.5574601", "0.5568516", "0.5561518", ...
0.5788098
8
return elapsed time in days
def days(self): return int(self.hours / 24)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elapsed_days(self) -> int:\n return (datetime.today() - self.release_datetime).days", "def get_elapsed_time(start, end):\n return \"%s days, %s hours, %s minutes, %s seconds\" % dhms_from_seconds(date_diff_in_seconds(start, end))", "def calculate_days(time):\n return int(time / 86400)", "def...
[ "0.75203794", "0.7310724", "0.7111851", "0.7087292", "0.7065484", "0.7040637", "0.7039696", "0.6973917", "0.69536227", "0.6918072", "0.68997335", "0.6899401", "0.6785087", "0.6765446", "0.66785306", "0.6673294", "0.661461", "0.658672", "0.657657", "0.65385485", "0.65277886", ...
0.65850383
18
return elapsed time in days. accepts pid or datetime
def days(input=None): return get(input).days
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_elapsed_time(start, end):\n return \"%s days, %s hours, %s minutes, %s seconds\" % dhms_from_seconds(date_diff_in_seconds(start, end))", "def calculate_days(time):\n return int(time / 86400)", "def evaluate_time(self, pid, edge):\n return self.get_process_speed(pid) * edge.get_time()", "...
[ "0.65062827", "0.6486112", "0.63390917", "0.6304434", "0.62099266", "0.6180133", "0.61510646", "0.61460197", "0.60833615", "0.59980273", "0.5985598", "0.597571", "0.5966315", "0.59606063", "0.5928423", "0.59140605", "0.5879989", "0.58758616", "0.58654225", "0.57962495", "0.57...
0.0
-1
Redirects to make_mosaic endpoint
def entry_page(): return redirect(url_for('index'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n\n # list with url for pictures\n pic_url_list = []\n\n # default resolution\n x_resolution = 2048\n y_resolution = 2048\n\n # converting flask type od dict to default python dict\n request_arguments = request.args.to_dict(flat=False)\n\n # check if optional argument (resolut...
[ "0.69172907", "0.58282906", "0.5780604", "0.559005", "0.5521633", "0.5335325", "0.5273091", "0.516737", "0.5115533", "0.508551", "0.5068684", "0.5065837", "0.50605345", "0.5048209", "0.50465894", "0.50379694", "0.5031413", "0.5018871", "0.50124556", "0.50124484", "0.5012191",...
0.0
-1
Calculate the cross product of two 3d vectors.
def cross(vec1, vec2): result = np.zeros(3) return cross_(vec1, vec2, result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_product(v1, v2):\n return cg3d_vector.CG3dVector(\n v1[1] * v2[2] - v2[1] * v1[2],\n v1[2] * v2[0] - v2[2] * v1[0],\n v1[0] * v2[1] - v2[0] * v1[1]\n )", "def cross(v1: Vector, v2: Vector) -> Vector: # Function is fucked TODO\n if len(v1.coords) != 3 or len(v2.coords) != ...
[ "0.8495347", "0.8209283", "0.8185948", "0.80265963", "0.80217946", "0.7996431", "0.78594023", "0.7847778", "0.783515", "0.7797106", "0.77203244", "0.7618056", "0.75972885", "0.7588651", "0.75682247", "0.75304353", "0.74432504", "0.7407693", "0.73927504", "0.73378044", "0.7336...
0.8005173
5
Calculate the cross product of two 3d vectors.
def cross_(vec1, vec2, result): a1, a2, a3 = double(vec1[0]), double(vec1[1]), double(vec1[2]) b1, b2, b3 = double(vec2[0]), double(vec2[1]), double(vec2[2]) result[0] = a2 * b3 - a3 * b2 result[1] = a3 * b1 - a1 * b3 result[2] = a1 * b2 - a2 * b1 return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_product(v1, v2):\n return cg3d_vector.CG3dVector(\n v1[1] * v2[2] - v2[1] * v1[2],\n v1[2] * v2[0] - v2[2] * v1[0],\n v1[0] * v2[1] - v2[0] * v1[1]\n )", "def cross(v1: Vector, v2: Vector) -> Vector: # Function is fucked TODO\n if len(v1.coords) != 3 or len(v2.coords) != ...
[ "0.8495347", "0.8209283", "0.8185948", "0.80265963", "0.8005173", "0.7996431", "0.78594023", "0.7847778", "0.783515", "0.7797106", "0.77203244", "0.7618056", "0.75972885", "0.7588651", "0.75682247", "0.75304353", "0.74432504", "0.7407693", "0.73927504", "0.73378044", "0.73366...
0.80217946
4
Return length of the inner dictionary.
def __len__(self): return len(self._d)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_sublength(nest_dict):\n return sum(len(v) for v in nest_dict.itervalues())", "def __len__(self) -> int:\n return len(self._dict)", "def size(self):\n return dict.__len__(self)", "def _size_of_dict(dictionary):\n size = len(dictionary.keys())\n for value in dictionary.v...
[ "0.84953874", "0.78595334", "0.78409594", "0.78223604", "0.75585836", "0.7551311", "0.7432247", "0.72399694", "0.72072756", "0.71813524", "0.71331716", "0.71331716", "0.70996034", "0.70890045", "0.6994044", "0.6984488", "0.69334716", "0.6919532", "0.69120383", "0.6882344", "0...
0.6446852
51
Human representation of a course.
def __str__(self): model = self._meta.verbose_name.title() title = self.extended_object.get_title() return f"{model:s}: {title:s}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def course_info(self):\n print(\"Course name: {}\".format(self._course_name))\n print(\"Lead teacher: {}\".format(self._teacher))\n\n if len(self._students) == 0:\n print(\"Course does not enrolled by any student\")\n else:\n print(\"Enrolled: {}/{}\".format(len(se...
[ "0.6712629", "0.6652738", "0.65715927", "0.6560029", "0.655198", "0.6348229", "0.63459116", "0.6335602", "0.6285528", "0.6113067", "0.60122883", "0.5997732", "0.5987578", "0.59715575", "0.58722246", "0.58378285", "0.5810509", "0.57896405", "0.578161", "0.573549", "0.5726865",...
0.0
-1
Get the admin url of the form to add a course run with the "direct_course" field prepopulated to self.
def get_admin_url_to_add_run(self, request): base_url = reverse("admin:courses_courserun_add") return f"{base_url:s}?direct_course={self.id:d}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url(self):\r\n course_key = \"slashes:{course_org}+{course_num}+{course_run}\".format(**self.course_info)\r\n return \"/\".join([BASE_URL, self.url_path, course_key])", "def setup_course_url(self, course):\n self.url = reverse('instructor_dashboard', kwargs={'course_id': str(course.id)})...
[ "0.66739416", "0.6661041", "0.64736366", "0.64344704", "0.64329773", "0.6306608", "0.60825247", "0.59089434", "0.5888406", "0.58553123", "0.5828043", "0.56737375", "0.5618978", "0.55820453", "0.5549834", "0.5549834", "0.55185103", "0.5517158", "0.5487873", "0.54796034", "0.54...
0.8541032
0
Return the main organization linked to the course via an organization plugin on the course detail page. Plugins are sortable by draganddrop in the plugin bar so we use this "position" information to return the first one as the main organization. We assume that only one placeholder holds organization plugins and return ...
def get_main_organization(self): return ( self.get_organizations() .order_by("extended_object__organization_plugins__cmsplugin_ptr__position") .first() )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_organization(self):\n pos_or_org = self.position.to_object\n if pos_or_org is None:\n return None\n elif pos_or_org.portal_type == 'position':\n return pos_or_org.get_organization()\n elif pos_or_org.portal_type == 'organization':\n return pos_or...
[ "0.68587244", "0.5907531", "0.59008014", "0.589964", "0.58633107", "0.5859542", "0.5687222", "0.56385535", "0.54986006", "0.54873925", "0.54269475", "0.5400147", "0.5375925", "0.5355582", "0.5343183", "0.5303373", "0.5293673", "0.52927893", "0.5241732", "0.521707", "0.5217016...
0.7510171
0
Returns a query that sum the enrollment count of each course run. They may be directly related to the course or to a snapshot of the course. The draft and the public page have their own course runs. The course runs on the draft page are copied to the public page when the course is published (for any language).
def course_runs_enrollment_count(self): is_draft = self.extended_object.publisher_is_draft node = self.extended_object.node current_and_descendant_nodes = node.__class__.get_tree(parent=node) return CourseRun.objects.filter( direct_course__extended_object__node__in=current_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enrollment_counts(cls, course_id):\r\n # Unfortunately, Django's \"group by\"-style queries look super-awkward\r\n query = use_read_replica_if_available(cls.objects.filter(course_id=course_id, is_active=True).values('mode').order_by().annotate(Count('mode')))\r\n total = 0\r\n d = d...
[ "0.6074521", "0.6041419", "0.5362961", "0.533614", "0.5182698", "0.5091506", "0.50852716", "0.50764984", "0.5037924", "0.50357306", "0.49651933", "0.48697788", "0.48279262", "0.4770447", "0.4768722", "0.47138315", "0.47057799", "0.47032812", "0.47006965", "0.47005245", "0.468...
0.8019578
0
Returns a dict of course runs grouped by their state.
def course_runs_dict(self): course_runs_dict = { i: [] for i in range(len(CourseState.STATE_CALLS_TO_ACTION)) } for run in self.course_runs: course_runs_dict[run.state["priority"]].append(run) return dict(course_runs_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runs(self):\n return {\n 'passed': self._runs_passed,\n 'failed': self._runs_failed,\n 'missed': self._runs_missed,\n }", "def _running_jobs_by_state(status_map):\n result = {}\n for state_name in sorted(status_map.keys()):\n ...
[ "0.6321693", "0.5944419", "0.5908994", "0.5876156", "0.57753927", "0.5741247", "0.5722565", "0.567515", "0.5672037", "0.5663396", "0.5651055", "0.5647436", "0.5644651", "0.5570746", "0.5570746", "0.5480025", "0.5380726", "0.5376638", "0.5369025", "0.53606087", "0.5335316", ...
0.7880021
0
Human representation of a licence.
def __str__(self): model = self._meta.verbose_name.title() return f"{model:s}: {self.name:s}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.licence.name:s}\"", "def license_plate(self) -> str:\n return self.numerify(self.generator.parse(self.random_element(self.license_formats)))", "def show_licence(namespace):\n print(dedent(GSEA....
[ "0.7081381", "0.68673426", "0.6803742", "0.6774465", "0.6750214", "0.66850436", "0.6660056", "0.6571109", "0.6337733", "0.6134125", "0.61280495", "0.60734", "0.60600924", "0.60434854", "0.6034573", "0.6034573", "0.5965436", "0.595446", "0.58522457", "0.5847454", "0.582143", ...
0.0
-1
Remove a contact group from the database.
async def delete_contact_group(dbcon: DBConnection, contact_group_id: int) -> None: if not await contact_group_exists(dbcon, contact_group_id): raise errors.InvalidArguments('contact group does not exist') q = """delete from contact_groups where id=%s""" await dbcon.operation(q, (contact_group_id,))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_from_group(self, org, contact, group):\n pass", "async def delete_contact_from_contact_group(dbcon: DBConnection, contact_group_id: int, contact_id: int) -> None:\n q = \"\"\"delete from contact_group_contacts where contact_group_id=%s and contact_id=%s\"\"\"\n q_args = (contact_group_id,...
[ "0.8200162", "0.76832724", "0.7679055", "0.7605949", "0.73162013", "0.7294787", "0.71709603", "0.7098276", "0.6971708", "0.69195086", "0.6847481", "0.68159044", "0.6741174", "0.67268705", "0.67192996", "0.66935956", "0.66856873", "0.6685614", "0.6621922", "0.6575301", "0.6559...
0.7935461
1
Compute the sigmoid of z
def sigmoid(self, z): s = 1 / (1 + np.exp(-z)) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(z):\r\n \r\n return vSigmoid(z);", "def sigmoid(z): \n return 1/(1 + np.e**(-z))", "def sigmoid(z):\r\n \r\n return 1.0 / (1.0+np.exp(-z))", "def sigmoid(z):\n return 1 / (1 + e ** -z)", "def sigmoid(z):\n return 1 / (1 + np.exp(-1 * z))", "def sigmoid(self, z):\n ...
[ "0.9236618", "0.9115387", "0.9034685", "0.90323716", "0.8983045", "0.898196", "0.89817816", "0.89586", "0.8936467", "0.89277345", "0.8924896", "0.89058656", "0.88911504", "0.88880706", "0.8871708", "0.88684934", "0.88618755", "0.8860814", "0.88562065", "0.88487744", "0.884515...
0.8874702
14
This function creates vector of zeros of shape (dim, 1) for w and initializes b to 0.
def initialize(self, dim): self.w = np.zeros((dim, 1)) self.b = 0 assert(self.w.shape == (dim, 1)) assert(isinstance(self.b, float) or isinstance(self.b, int))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_with_zeros(dim):\n\n w = np.zeros((dim, 1))\n b = 0\n\n return w, b", "def initialize_with_zeros(dim):\n \n w = np.zeros([dim, 1])\n b = 0;\n\n assert(w.shape == (dim, 1))\n assert(isinstance(b, float) or isinstance(b, int));\n \n return w,b;", "def initialize_with_...
[ "0.78281647", "0.74974597", "0.73732233", "0.72463846", "0.7071679", "0.6665771", "0.6609793", "0.6556628", "0.6540469", "0.64331144", "0.6398242", "0.6317353", "0.6290744", "0.6290744", "0.6290744", "0.62891424", "0.62828666", "0.6271031", "0.6248183", "0.6223827", "0.618452...
0.6644284
6
Pull all values of specified key from nested JSON.
def extract_values(obj, key): arr = [] def extract(obj, arr, key): """Recursively search for values of key in JSON tree.""" if isinstance(obj, dict): for k, v in obj.items(): if isinstance(v, (dict, list)): extract(v, arr, key) elif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_values(obj, key): \n arr = [] \n def extract(obj, arr, key): \n \"\"\"Recursively search for values of key in JSON tree.\"\"\" \n if isinstance(obj, dict): \n for k, v in obj.items(): \n if isinstance(v, (dict, list)): \n extract(v, arr, ...
[ "0.7465364", "0.744467", "0.73683906", "0.73683906", "0.7286594", "0.7276108", "0.6437917", "0.6150235", "0.6105374", "0.6105374", "0.6105374", "0.6105374", "0.6105374", "0.609175", "0.60788906", "0.60494304", "0.60182303", "0.5951623", "0.5826152", "0.5795389", "0.57927316",...
0.7370781
2
Gets JSON file as a dictionary.
def get_json(filename): with open(filename) as f: file_content = f.read() data = json.loads(file_content) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_dict(path):\n json_file=open(path)\n json_str = json_file.read()\n json_data = json.loads(json_str)\n return json_data", "def read_json_file(file_name: str) -> Dict[str, Any]:\n with open(file_name) as file:\n return json.load(file)", "def json_dict(path):\n json_file=open(pat...
[ "0.8013772", "0.80073994", "0.8005784", "0.7953202", "0.79398215", "0.78763324", "0.7790268", "0.77846634", "0.7781607", "0.77340037", "0.77132505", "0.77044356", "0.7674398", "0.7646241", "0.76253676", "0.76036257", "0.7593111", "0.7574853", "0.7568953", "0.7563689", "0.7539...
0.8079181
0
Get the front item from the deque.
def getFront(self) -> int: if not self.isEmpty(): return self.q[self.move_forward(self.front)] else: return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peek_front(self):\n if ((self.is_empty()) or self.data_[self.front_]== None): #If we trip this if block we raise an error since we know the deque should be empty \n raise IndexError\n return self.data_[self.front_]", "def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\tretur...
[ "0.85059357", "0.8490365", "0.841699", "0.8373131", "0.8284386", "0.8258886", "0.82038033", "0.79905766", "0.7978276", "0.79609853", "0.79590595", "0.79549676", "0.7929272", "0.7900703", "0.7898534", "0.78633916", "0.78493965", "0.78493965", "0.7750533", "0.7747822", "0.77285...
0.7571963
24
Get the last item from the deque.
def getRear(self) -> int: if not self.isEmpty(): return self.q[self.rear] else: return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last(self):\n return self.deque[-1]", "def last_item(self):\n return self.container[self.length-1]", "def last(self):\n if self.is_empty():\n raise Empty(\"Deque is empty\")\n return self._trailer._prev._element #real item just before trailer", "def last(iterabl...
[ "0.873561", "0.84392744", "0.8213561", "0.8139774", "0.7803814", "0.7800985", "0.7751803", "0.7621705", "0.7618637", "0.75757027", "0.75228494", "0.7490607", "0.74851626", "0.7431453", "0.7431453", "0.7409974", "0.73955023", "0.7393824", "0.7360437", "0.7358974", "0.7358188",...
0.0
-1
Checks whether the circular deque is full or not.
def isFull(self) -> bool: if self.move_forward(self.rear) == self.front: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.deque) == 0", "def isFull(self):\n return len(self.queue) == self.size", "def isFull(self):\r\n if (len(self.queue) == self.maxlen):\r\n return True\r\n else:\r\n return False", "def empty(self) -> bool:\n return l...
[ "0.7989078", "0.7895886", "0.7891434", "0.7660478", "0.75128245", "0.7484213", "0.7483096", "0.73029816", "0.73029816", "0.72759694", "0.7268464", "0.7253773", "0.7235688", "0.72299623", "0.72299623", "0.72278905", "0.72223043", "0.7189977", "0.7189218", "0.7189218", "0.71661...
0.6976988
42
Given a string representation of document content, this function splits it into a list of TextContent objects representing the lines of the document
def split_content_into_lines(content: str) -> List[TextContent]: lines_content = content.splitlines(True) # build a list of line objects lines = [] for line_content in lines_content: lines.append(TextContent(content=line_content)) return lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_content_into_document(content: str) -> List[TextContent]:\n return [TextContent(content=content)]", "def read(self, content: str):\n documents = []\n # 1. Split the text in documents using string '-DOCSTART- -X- O O' and loop over it\n content = content.split('-DOCSTART- -X- O O...
[ "0.79900974", "0.71688455", "0.6962049", "0.67655903", "0.6740423", "0.66443825", "0.66100544", "0.6367101", "0.6315669", "0.6315603", "0.62921154", "0.61634886", "0.6135387", "0.6135006", "0.61063814", "0.60974294", "0.6091374", "0.6072826", "0.60515374", "0.6042577", "0.604...
0.7881781
1
Given a string representation of document content, this function splits it into a list of TextContent objects at an optionally given level of granularity
def text_contents_from_document_body( content: str, granularity="document" ) -> List[TextContent]: return text_content_split_functions[granularity](content)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_content_into_document(content: str) -> List[TextContent]:\n return [TextContent(content=content)]", "def split(text):\n articles = re.split(\"<doc>\", text)\n del articles[0]\n return articles", "def read(self, content: str):\n documents = []\n # 1. Split the tex...
[ "0.7345478", "0.6747749", "0.6354209", "0.6328884", "0.6093199", "0.6083863", "0.6051214", "0.6047963", "0.60374886", "0.6019502", "0.6018944", "0.60116994", "0.59527236", "0.57839215", "0.57355374", "0.5702328", "0.56594014", "0.5633477", "0.5573477", "0.5531004", "0.5519658...
0.70896304
1
Yield successive nsized chunks from l.
def chunks(l, n): for i in range(0, len(l), n): yield l[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8038813", "0.79248375", "0.7923423", "0.7885103", "0.78773195", "0.7815877", "0.77655786", "0.77556044", "0.77441615", "0.7731815", "0.77288336", "0.772473", "0.77028215", "0.76889825", "0.76889825", "0.7664208", "0.76570904", "0.7655856", "0.7655856", "0.76458347", "0.764...
0.7448925
85
split strings, but only keep splits if they result in actual words
def semantic_split(input_string): # if already a word, go back word_gain = False split_string = wordninja.split(input_string) # if at least one word is gained that is not 'a' or 'o' for string in split_string: if (has_vowels(string) and (string not in {"a", "o", "A", "O"})): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def separate_words(text):\n splitter = re.compile('\\\\W*')\n return [s.lower() for s in splitter.split(text) if s != '']", "def break_words(stuff):\n\twords = stuff.split(' ')\n\treturn words", "def break_words(stuff):\n\twords = stuff.split(' ')\n\treturn words", "def break_words(stuff):\r\n words...
[ "0.7137161", "0.70054454", "0.70054454", "0.70007706", "0.6931502", "0.6897904", "0.6870416", "0.6870416", "0.6870416", "0.6870416", "0.6870416", "0.68608433", "0.68608433", "0.6859621", "0.6845815", "0.6844826", "0.6844826", "0.68411094", "0.6801817", "0.67611885", "0.675539...
0.68730825
6
Returns state, reward and done flag given an action.
def env_step(action: np.ndarray) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: state, reward, done, _ = env.step(action) return ( state.astype(np.float32), np.array(reward, np.float32), np.array(done, np.int32), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self, action):\r\n reward = self.__execute(action)\r\n self.__totalReward += reward\r\n status = self.__status()\r\n state = self.__observe()\r\n logging.debug(\"action: {:10s} | reward: {: .2f} | status: {}\".format(Action(action).name, reward, status))\r\n retur...
[ "0.7696786", "0.75491583", "0.7476857", "0.7464613", "0.7378774", "0.73376304", "0.7302427", "0.72069573", "0.7199904", "0.71545213", "0.71231115", "0.71169156", "0.70998794", "0.7034533", "0.70221037", "0.70158213", "0.6965064", "0.6963189", "0.6962916", "0.6939048", "0.6937...
0.0
-1
Check to see if this was built with pyinstaller.
def valid_for(obj): if not obj.filedata: return False #hexstring = "cffaedfe07000001030000800200" return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_to_be_built_or_is_installed(self, shutit_module_obj):\n\t\tshutit_global.shutit_global_object.yield_to_draw()\n\t\tcfg = self.cfg\n\t\tif cfg[shutit_module_obj.module_id]['shutit.core.module.build']:\n\t\t\treturn True\n\t\treturn self.is_installed(shutit_module_obj)", "def is_tool(name):\n return find...
[ "0.6855228", "0.6374993", "0.6320093", "0.6280286", "0.6278099", "0.6242287", "0.6234321", "0.6199551", "0.6194903", "0.6194867", "0.61548555", "0.61246425", "0.61246425", "0.6097033", "0.607904", "0.6032464", "0.60257787", "0.6021375", "0.60101235", "0.59989274", "0.5962461"...
0.0
-1
Yield successive nsized chunks from l.
def chunks(l, n): # noqa: E741 for i in range(0, len(l), n): yield l[i : i + n] # noqa: E203
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8038813", "0.79248375", "0.7923423", "0.7885103", "0.78773195", "0.7815877", "0.77655786", "0.77556044", "0.77441615", "0.7731815", "0.77288336", "0.772473", "0.77028215", "0.76889825", "0.76889825", "0.7664208", "0.76570904", "0.7655856", "0.7655856", "0.76458347", "0.764...
0.7635831
22
Example numbers here are represented by binary digit. if x is 11010 then x & (~(x1)) is 10
def get_lowest_one_mask(x): return x & (~(x-1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_lowest_one_with_zero(x):\n return x & (x-1)", "def test_binary_complement_longer_mask(self):\n self.assertEqual(utils.binary_complement('11010', '000010'), '00000')", "def bit_in_place(x, n):\n return (x & 2**n)", "def test_binary_complement_shorter_equal_mask(self):\n self.asse...
[ "0.68127704", "0.6666352", "0.65994275", "0.65612304", "0.65415096", "0.6524083", "0.6516807", "0.64680827", "0.6350648", "0.63479346", "0.632111", "0.63167477", "0.6303793", "0.62875175", "0.62749535", "0.627356", "0.6257102", "0.62329364", "0.62329364", "0.6232761", "0.6219...
0.56949663
78
hide inputs on selection
def hideInputs(): for node in nuke.selectedNodes(): node.knob('hide_input').setValue(not node.knob('hide_input').value())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide(self):\n self.row_box.grid_remove()\n self.field_name_box.grid_remove()\n self.field_name_label.grid_remove()\n self.value_box.grid_remove()\n self.active_value_widget.grid_remove()", "def hide(self):\n self.visible = False", "def show(self): \n InputIt...
[ "0.68803406", "0.6391345", "0.6389261", "0.6389261", "0.63629895", "0.6243904", "0.6220035", "0.61587775", "0.61403745", "0.61403745", "0.6098808", "0.60608405", "0.5947613", "0.5893146", "0.5810868", "0.5780752", "0.5780367", "0.5743026", "0.56984985", "0.56751376", "0.56726...
0.7560828
0
Substitutes numbers for words.
def substitute_words(self, string): condensed_string = '_'.join(string.split()) for word in self.math_words['words']: condensed_string = re.sub( '_'.join(word.split(' ')), self.math_words['words'][word], condensed_string ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_numbers(words):\n p = inflect.engine()\n new_words = []\n for word in words:\n if word.isdigit():\n new_word = p.number_to_words(word)\n new_words.append(new_word)\n else:\n new_words.append(word)\n return ' '.join(new_words)", "def replace_n...
[ "0.78815424", "0.78815424", "0.76899475", "0.7578668", "0.75603855", "0.7543888", "0.7543888", "0.7543888", "0.7543888", "0.7543888", "0.7543888", "0.7543888", "0.74002683", "0.73591626", "0.73477817", "0.6909062", "0.68585044", "0.68140036", "0.68121225", "0.67885137", "0.67...
0.6855777
17
Return `text` with spurious words stripped. For example, Google includes the word "Cached" in many search summaries, and this word should therefore mostly be ignored.
def remove_spurious_words(text): spurious_words = ["Cached", "Similar", '的'] for word in spurious_words: text = text.replace(word, "") return re.sub('[.、”“::a-zA-Z%?=()()—「 /-]', ' ', text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_noise(text):\n\n text = text.split()\n word = [word for word in text if word not in [\n 'pertain',\n 'estimate',\n 'link',\n 'and',\n 'more',\n 'fetch',\n 'be',\n 'there',\n 'do',\n 'you',\n 'have',\n 'any',\n ...
[ "0.76660633", "0.7518357", "0.74872106", "0.7423958", "0.7423958", "0.7423958", "0.7423958", "0.7423958", "0.7423958", "0.7299608", "0.7297694", "0.7292363", "0.7215531", "0.72045904", "0.7203306", "0.7144507", "0.7128469", "0.7086231", "0.7060873", "0.7038596", "0.70112026",...
0.7851087
0
Return all the `n`grams in the list `words`. The ngrams are returned as a list of tuples, each tuple containing an ngram, as per the description in `candidate_answers`.
def ngrams(words, n=1): return [tuple(words[j:j + n]) for j in range(len(words) - n + 1)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ngrams(self, words):\n if words[0] in self._locs:\n for loc in self._locs[words[0]]:\n ngram = NGram.from_loc(len(words), loc)\n if ngram.words == words:\n yield ngram", "def word_ngrams(sent, n):\n\t\n\t# EXAMPLES \n\t# > word_ngrams(tokeniz...
[ "0.74296814", "0.7207111", "0.7156558", "0.68480724", "0.683955", "0.6824584", "0.6824584", "0.6815814", "0.6815814", "0.6810911", "0.679814", "0.6745664", "0.6715491", "0.66801095", "0.6589672", "0.6581412", "0.65408325", "0.652116", "0.65170217", "0.6511866", "0.64707834", ...
0.7871076
0
Represents the primitive Boolean object.
def __init__(self, val: bool) -> None: if type(val) != bool: raise TypeError(f"Invalid literal {val} with type '{val.__class__.__name__}' for parameter 'val'") self._val: bool = val return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_bool(self):\n return self.as_type(bool)", "def is_boolean_type(self):\n raise exceptions.NotImplementedError()", "def isBoolean(self):\n return _libsbml.ASTNode_isBoolean(self)", "def CONST_BOOL(self, t):\n t.value = False if t.value == '#false' else True\n return t"...
[ "0.7802424", "0.7252334", "0.7200947", "0.7155087", "0.7127187", "0.703225", "0.6972011", "0.696523", "0.69525456", "0.6942381", "0.69281906", "0.69140244", "0.6912753", "0.6891855", "0.6883718", "0.68571824", "0.681882", "0.68157387", "0.67950046", "0.6693864", "0.66900116",...
0.0
-1
Return indices corresponding to start and end indices, strings as defined in self.ind
def getind(self,start,end,blk): if blk is None: # Return all blocks blk = np.arange(self.ind[start].size) ind=np.array([]) for k,val in enumerate(blk): ind=np.append(ind,np.arange(self.ind[start][val],self.ind[end][val])) return ind.astype(int)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indices(self):\n return tuple([slice(*r) for r in self.location])", "def mainIndices(self):\n return self.i1, self.i2", "def _get_marker_indices(marker, line):\n indices = [i for i, ltr in enumerate(line) if ltr == marker]\n start = indices[0:-1:2]\n end = [i + 1 for i in indices[1::...
[ "0.6613252", "0.65965605", "0.6544618", "0.6431059", "0.6364212", "0.63390064", "0.6300627", "0.6292207", "0.6190158", "0.6163438", "0.6141324", "0.60766125", "0.6073179", "0.60501415", "0.6031483", "0.6014726", "0.60144985", "0.59757674", "0.5963542", "0.59562665", "0.594752...
0.6896402
0
Represents the Server instance as a string.
def __repr__(self): return 'Server %s at Node %s' % (self.id_number, self.node.id_number)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return self.socket.__str__()", "def __repr__(self):\n return \"API Server Running at: \" + str(self.host) + \" on Port:\" + str(self.port) \\\n + \"/records: Return records\\n\" + \"/response_time: Return All response_times\\n\" \\\n + \"/response_ti...
[ "0.70346725", "0.702829", "0.68264943", "0.6764361", "0.6764361", "0.6743984", "0.6655925", "0.66538006", "0.6634197", "0.6550206", "0.6547462", "0.65176344", "0.65027064", "0.6497352", "0.6479447", "0.6467043", "0.6450142", "0.6426703", "0.63892514", "0.63801646", "0.6379929...
0.74702674
0
Get an iterator to go over all vertices on this face
def vertices(self): top_exp = TopologyUtils.TopologyExplorer(self.topods_shape(), ignore_orientation=True) return map(Vertex, top_exp.vertices())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n return iter(self._vertices.values())", "def __iter__(self):\n return iter(self.vertices.values())", "def vertex_generator(self):\n for V in self.Vrepresentation():\n if V.is_vertex():\n yield V", "def iterator(self):\n return _osgAni...
[ "0.7754764", "0.77251667", "0.76747346", "0.75961226", "0.7524729", "0.74594074", "0.7436522", "0.72085536", "0.7203449", "0.715892", "0.69165814", "0.68816936", "0.68550915", "0.68550915", "0.68022317", "0.6798917", "0.6790471", "0.66502005", "0.66284955", "0.66284955", "0.6...
0.0
-1
Get the face surface geometry
def surface(self): return BRep_Tool_Surface(self.topods_shape())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surface(self):\n return self._surface", "def surface():\n \"\"\"\n Get surface for plotting.\n\n :return fsaverage: surface locations as in nilearn\n :return surf: surface for plotting\n \"\"\"\n\n fsaverage = fetch_surf_fsaverage('fsaverage')\n surf = ...
[ "0.680215", "0.67266846", "0.6512448", "0.6512448", "0.6383799", "0.6345213", "0.63189715", "0.6280069", "0.6251288", "0.62504005", "0.6235906", "0.62328655", "0.62249625", "0.62249625", "0.62133723", "0.6187063", "0.61621284", "0.61621034", "0.61154896", "0.60494953", "0.604...
0.60977256
19
Is this face on the left hand side of the given edge. We take the orientation of the edge into account here Edge direction ^ | Left | Right face | face |
def is_left_of(self, edge): found_edge = False for wire in self.wires(): for edge_from_face in wire.ordered_edges(): if edge == edge_from_face: if edge.reversed() == edge_from_face.reversed(): return True else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_left_edge(self, ndx):\n if len(self._dims)== 1:\n return ndx == 0\n return ndx < self._dims[1]", "def check_left_side():\n maze.turn_right()\n #print 'checked left side'\n if maze.go():\n maze.turn_right()\n maze.turn_right()\n ...
[ "0.7298923", "0.67701554", "0.66744465", "0.62685955", "0.62516993", "0.621695", "0.61714643", "0.6140334", "0.6125345", "0.6123193", "0.61086607", "0.61075264", "0.6033908", "0.60122323", "0.59473485", "0.5942818", "0.59123516", "0.5909268", "0.5878878", "0.5861554", "0.5858...
0.8736889
0
Compute the mean curvature of the surface geometry at given parameter
def mean_curvature(self, uv): mean_curv = GeomLProp_SLProps( self.surface(), uv[0], uv[1], 2, 1e-9 ).MeanCurvature() if self.reversed(): mean_curv *= -1 return mean_curv
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def curvature(self):\n return self.circle().curvature(self.o, self.r, p = self.a)", "def curvature_in_coord_space(self, param):\n with self.fix_evaluator():\n xp, zp = self.diff(param, diff=1)\n xpp, zpp = self.diff(param, diff=2)\n n = np.sqrt(xp**2 + zp**2)\n ...
[ "0.6968003", "0.67775613", "0.6562867", "0.6457239", "0.64446145", "0.6442057", "0.6376508", "0.63385653", "0.6325697", "0.63190585", "0.62529796", "0.62448597", "0.62369734", "0.6039628", "0.59965503", "0.5932112", "0.57973164", "0.57961893", "0.579356", "0.57590014", "0.572...
0.688378
1
Compute the area of the face
def area(self): geometry_properties = GProp_GProps() brepgprop_SurfaceProperties(self.topods_shape(), geometry_properties) return geometry_properties.Mass()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self) -> npt.NDArray[np.float_]:\n return np.sum(self.faces.area)", "def compute_surface_area(self):\n return np.sum(self._find_triangle_areas())", "def area(self) -> torch.Tensor:\n box = self.tensor\n area = (box[:, 2] - box[:, 0]) * (box[:, 3] - box[:, 1])\n retur...
[ "0.8075365", "0.75477207", "0.7409792", "0.73411655", "0.73229676", "0.7243535", "0.7236911", "0.7189196", "0.71172404", "0.709804", "0.7077326", "0.70591605", "0.70460397", "0.7045543", "0.70402086", "0.699596", "0.6990804", "0.69881445", "0.69680536", "0.6962157", "0.694803...
0.0
-1
Get the given edge's curve geometry as a 2D parametric curve on this face
def pcurve(self, edge): crv, umin, umax = BRep_Tool().CurveOnSurface( edge.topods_shape(), self.topods_shape() ) return crv, Interval(umin, umax)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TransformPCurve(self, *args):\n return _ShapeBuild.ShapeBuild_Edge_TransformPCurve(self, *args)", "def as_curve(self, context):\n curve = bpy.data.curves.new('LINE', type='CURVE')\n curve.dimensions = '2D'\n spline = curve.splines.new('POLY')\n spline.use_endpoint_u = False...
[ "0.594334", "0.58956635", "0.5850334", "0.56354296", "0.5602325", "0.5592754", "0.5577196", "0.55470103", "0.55455935", "0.55170935", "0.54957074", "0.54723036", "0.5438827", "0.5429558", "0.54181516", "0.54023826", "0.54004747", "0.5396389", "0.53569096", "0.53291345", "0.53...
0.7469369
0
Get the UV parameter by projecting the point on this face
def point_to_parameter(self, pt): uv = ShapeAnalysis_Surface(self.surface()).ValueOfUV( gp_Pnt(pt[0], pt[1], pt[2]), 1e-9 ) return np.array(uv.Coord())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uvmap(self, p):\n # bottom left corner of the plane\n p00 = self.position - (self.sx * self.n0) / 2 - (self.sy * self.n1) / 2\n dif_vector = p - p00\n u = np.dot(dif_vector, self.n0) / self.sx\n v = np.dot(dif_vector, self.n1) / self.sy\n return u, v", "def uvmap(sel...
[ "0.74567586", "0.72020894", "0.6987332", "0.68170387", "0.6740343", "0.64852583", "0.6426348", "0.631582", "0.63151157", "0.6213298", "0.61232054", "0.61133444", "0.60805804", "0.6071526", "0.60660106", "0.6035578", "0.6008279", "0.60076493", "0.59738916", "0.59698856", "0.59...
0.7431836
1
Whether the surface is closed along the Udirection
def closed_u(self): sa = ShapeAnalysis_Surface(self.surface()) return sa.IsUClosed()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def periodic_u(self):\n adaptor = BRepAdaptor_Surface(self.topods_shape())\n return adaptor.IsUPeriodic()", "def closed_v(self):\n sa = ShapeAnalysis_Surface(self.surface())\n return sa.IsVClosed()", "def degenerate(self):\n return self.radius == 0.0", "def is_upper(self):\...
[ "0.6720064", "0.6552915", "0.6457255", "0.63541704", "0.62969494", "0.62857306", "0.6279894", "0.6199884", "0.6155958", "0.61556506", "0.6103687", "0.6102787", "0.6075759", "0.6073888", "0.6072125", "0.6046026", "0.6037678", "0.60334384", "0.6031402", "0.6007667", "0.6001204"...
0.77395856
0
Whether the surface is closed along the Vdirection
def closed_v(self): sa = ShapeAnalysis_Surface(self.surface()) return sa.IsVClosed()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vert_is_open(v, front, left, right, prop):\n if prop.open_side == \"LEFT\":\n if v in left.verts and v not in front.verts:\n return True\n elif prop.open_side == \"RIGHT\":\n if v in right.verts and v not in front.verts:\n return True\n return False", "def is_vers...
[ "0.6927587", "0.6569981", "0.64208853", "0.6407151", "0.639047", "0.62821025", "0.6270388", "0.6258616", "0.6196833", "0.61622787", "0.614954", "0.61195624", "0.61181366", "0.6080501", "0.60649216", "0.60649216", "0.6062318", "0.6049763", "0.6019987", "0.60188407", "0.5972964...
0.76044774
0
Whether the surface is periodic along the Udirection
def periodic_u(self): adaptor = BRepAdaptor_Surface(self.topods_shape()) return adaptor.IsUPeriodic()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def periodic_v(self):\n adaptor = BRepAdaptor_Surface(self.topods_shape())\n return adaptor.IsVPeriodic()", "def isstationary(self):\n if np.all(np.abs(self.arroots) > 1.0):\n return True\n else:\n return False", "def isAcute(trpl):\n vd = vectorFormat(trpl)...
[ "0.6646627", "0.61730313", "0.6131752", "0.5937108", "0.5841844", "0.57729334", "0.5770635", "0.57558036", "0.56387997", "0.5601028", "0.5582384", "0.5564862", "0.5559984", "0.5556545", "0.55439967", "0.5532087", "0.55265665", "0.55261064", "0.55203736", "0.551137", "0.550807...
0.79861295
0
Yield successive nsized chunks from lst.
def chunks(lst, n): for i in range(0, len(lst), n): yield lst[i : i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunks(self, lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]", "def chunks(lst: list, n: int):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]", "def chunks(lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]", "de...
[ "0.83071756", "0.81939614", "0.81910837", "0.81910837", "0.81267184", "0.81218547", "0.81218547", "0.80773693", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457", "0.80533457"...
0.8190213
4
Updates the contents of the analysis text box.
def update(self, *_): if not self.input_main.edit_modified(): return analyze_text = self.create_analysis() self.output_main["state"] = tk.NORMAL self.output_main.delete("1.0", tk.END) self.output_main.insert("1.0", analyze_text) self.output_main["state"] = tk...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh(self, event):\n self.updatetext(self.textfunc, self.textargs)", "def edit_text(self):\n self.text = self.ui.plainTextEdit.toPlainText()\n sentences_number = count_sentences(self.text)\n self.ui.label.setText(\n f\"{count_sentences(self.text)} sentences in source...
[ "0.70499164", "0.69921833", "0.6784368", "0.66810155", "0.6622882", "0.65331525", "0.6486708", "0.6376039", "0.63442814", "0.6257796", "0.6184613", "0.6184613", "0.616388", "0.6135382", "0.61353534", "0.61353534", "0.61115617", "0.61001474", "0.6061367", "0.6051179", "0.60337...
0.7827922
0
Generate a random string of fixed length
def random_string(string_length=15): letters = string.ascii_lowercase return ''.join(random.choice(letters) for i in range(string_length))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",...
[ "0.8679777", "0.8572563", "0.85476273", "0.8527712", "0.8520763", "0.8431956", "0.8430901", "0.8414719", "0.84101564", "0.83888966", "0.83451134", "0.8343124", "0.8339913", "0.83331096", "0.8322297", "0.8297985", "0.8291266", "0.82815176", "0.8280923", "0.82804364", "0.826402...
0.78849506
64
Generate a random string of fixed length
def random_number(): return random.randint(0, 9999)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",...
[ "0.8680464", "0.8573714", "0.85486245", "0.85297275", "0.85209286", "0.84331024", "0.8432044", "0.84157014", "0.84120053", "0.8389201", "0.8345882", "0.8343962", "0.83406156", "0.83348686", "0.83240855", "0.82986933", "0.82911193", "0.8281826", "0.82818025", "0.82811046", "0....
0.0
-1
Return a list of all Concerts in the database.
def get(self, request): concerts = Concert.objects.order_by('date_time') if concerts: last_updated = concerts[0].date_scraped # TODO handle empty DB else: last_updated = datetime(1900,1,1) context = { 'concert_list': concerts, 'last...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list():\n\n return {\"cncs\": [{\"id\": id.split(\"/\")[-1]} for id in sorted(flask.current_app.redis.keys(\"/cnc/*\"))]}", "def get_citations(self):\n url = self._get_url() + 'citations'\n citations = self._request(url)\n return citations.json()", "def read_all():\n # Create...
[ "0.6729277", "0.66297257", "0.64498377", "0.6415649", "0.6382938", "0.63697636", "0.6329437", "0.62263405", "0.6207303", "0.61637545", "0.6128165", "0.609323", "0.607647", "0.6072333", "0.6071385", "0.6048761", "0.60121936", "0.59947985", "0.5945403", "0.5934015", "0.59317696...
0.5669912
44
Perform a horizontal shift on all rows. Pass left=True for left and left=False for right. The grid will be changed inplace.
def push_all_rows(grid, left=True): for i,row in enumerate(grid): grid[i] = push_row(row, left)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swipeLeft (self) :\n rotated = Grid(np.rot90(np.rot90(np.rot90(self.grid))))\n self.grid = np.rot90(rotated.swipeBase())", "def push_left (grid):\r\n \r\n for row in range (4):\r\n section = []\r\n for col in range (4):\r\n section.append(grid[row][col])\r\n ...
[ "0.67095685", "0.6561249", "0.650597", "0.6432329", "0.6376621", "0.63711894", "0.6282684", "0.6199841", "0.6176549", "0.6171532", "0.6097904", "0.60967135", "0.59959304", "0.5982909", "0.5982516", "0.59429663", "0.59148717", "0.5884634", "0.58775246", "0.5843569", "0.5837161...
0.6738214
0
Return a list of coordinate pairs corresponding to empty cells.
def get_empty_cells(grid): empty = [] for j,row in enumerate(grid): for i,val in enumerate(row): if not val: empty.append((j,i)) return empty
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_empty_cells(grid):\n empty = []\n for j,row in enumerate(grid):\n for i,val in enumerate(row):\n if not val:\n empty.append((j,i))\n return empty", "def empty_cells(state):\r\n cells = []\r\n for x, row in enumerate(state):\r\n for y, cell in enumera...
[ "0.82016677", "0.8106722", "0.7881721", "0.78399885", "0.7816201", "0.7774224", "0.76896685", "0.7566796", "0.75358933", "0.7367822", "0.7362139", "0.7313527", "0.72766584", "0.7221659", "0.7109574", "0.7071009", "0.7039268", "0.6926364", "0.6887955", "0.68496126", "0.6788944...
0.82954764
0
Compute the kernel matrix between A and B. Might get called with A = X, B = X, or A = X, B = Y, etc. Should return a tensor of shape [A.shape[0], B.shape[0]]. This default, slow, version calls self._compute_one(a, b) in a loop. If you override this, you don't need to implement _compute_one at all.
def _compute(self, A, B): return torch.stack( [ torch.stack([torch.as_tensor(self._compute_one(a, b)) for b in B]) for a in A ] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, A, B):\n assert len(A.shape) == len(B.shape)\n # A = A.contiguous()\n # B = B.contiguous()\n if len(A.shape) == 2 and len(B.shape) == 2:\n A = A[None]\n B = B[None]\n two_dimentional = True\n dim += 1\n elif len(A.shape) == 3 and len(B.shape) == 3:\n two_d...
[ "0.62648165", "0.6137887", "0.6037008", "0.5923665", "0.5819289", "0.5785836", "0.5755274", "0.5726333", "0.5710969", "0.56440824", "0.56375194", "0.5636588", "0.5634933", "0.5603411", "0.5581478", "0.5559403", "0.55582786", "0.55526364", "0.5540945", "0.5519009", "0.5502999"...
0.6028569
3
Compute something extra for each part A. Can be used to share computation between kernel(X, X) and kernel(X, Y). We end up calling basically (but with caching) self._compute(A, self._precompute(A), B, self._precompute(B)) This default _precompute returns an empty tuple, so it's self._compute(A, B) But if you return [A_...
def _precompute(self, A): return ()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute(self, A, B):\n return torch.stack(\n [\n torch.stack([torch.as_tensor(self._compute_one(a, b)) for b in B])\n for a in A\n ]\n )", "def compute_model(self, A_on_basis_vecs, B_on_standard_basis_array,\n C_on_basis_vecs):\n ...
[ "0.6791557", "0.62104493", "0.60345423", "0.59312725", "0.591139", "0.58817303", "0.57777464", "0.5768677", "0.55885524", "0.558009", "0.5484722", "0.5465948", "0.54596984", "0.54596984", "0.54454696", "0.5422421", "0.54032713", "0.53993064", "0.5396079", "0.5364988", "0.5359...
0.6353818
1
Takes UTC datetime object and return ISO8601 string
def toisostring(dt): return dt.format(ISOFORMAT) + 'Z'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_to_isoformat(obj: datetime.datetime) -> str:\n return obj.replace(tzinfo=datetime.timezone.utc).isoformat().replace(\"+00:00\", \"Z\")", "def format_iso8601(obj):\n return obj.strftime('%Y-%m-%dT%H:%M:%SZ')", "def datetime_to_iso8601(date_time):\n assert not date_time.utcoffset()\n ret...
[ "0.8141941", "0.79252195", "0.7835218", "0.77787304", "0.75846547", "0.7471046", "0.7303033", "0.7273685", "0.7231081", "0.7222901", "0.72224396", "0.71815675", "0.71231914", "0.71199864", "0.7076541", "0.70720387", "0.7069851", "0.700888", "0.6998697", "0.6990029", "0.696071...
0.7102107
14
The function search the closest math symbol to input symbol on the right side and returns his index.
def __search_right_closest_symbol(symbol, index): closest_right_rect = -1 min_dist = float("inf") for index_2 in range(len(symbols_info)): # check if the two symbols are different if index_2 != index: # take the rect info rect_info = symbols_info[index_2] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __search_left_closest_symbol(symbol, index):\n closest_left_index = -1\n min_dist = float(\"inf\")\n\n for index_2 in range(len(symbols_info)):\n # check if the two symbols are different\n if index_2 != index:\n # take the rect info\n rect_info = symbols_info[index_...
[ "0.71953446", "0.67018914", "0.6351156", "0.6343793", "0.6289443", "0.6196905", "0.6167313", "0.6005686", "0.60014474", "0.60012966", "0.598553", "0.5813043", "0.57776487", "0.561742", "0.56140614", "0.5576748", "0.5576558", "0.5575744", "0.5556814", "0.55048174", "0.54939574...
0.71717495
1
The function search the closest symbol to symbol on the left side and returns his index.
def __search_left_closest_symbol(symbol, index): closest_left_index = -1 min_dist = float("inf") for index_2 in range(len(symbols_info)): # check if the two symbols are different if index_2 != index: # take the rect info rect_info = symbols_info[index_2] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __search_right_closest_symbol(symbol, index):\n closest_right_rect = -1\n min_dist = float(\"inf\")\n\n for index_2 in range(len(symbols_info)):\n # check if the two symbols are different\n if index_2 != index:\n # take the rect info\n rect_info = symbols_info[index...
[ "0.71731657", "0.6783734", "0.63910544", "0.6198357", "0.61702436", "0.6149031", "0.61278903", "0.6110517", "0.60872394", "0.60468185", "0.6033304", "0.59687793", "0.59586424", "0.5955617", "0.59552675", "0.59451944", "0.59365183", "0.5935274", "0.5933324", "0.591271", "0.590...
0.82870704
0
Returns the n'th occurrence of s splitted with the delimiter.
def get_occurence(s, delimiter, occurence): return s.split(delimiter)[occurence]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_index(s):\n return int(s[s.find(\"[\")+1:s.find(\"]\")])", "def find_index_from_str(delimited_string: str, fnd: str, split: str = \",\"):\n lst = [x.strip().lower() for x in str(delimited_string).split(split)]\n rank = -1\n for idx in range(len(lst)):\n try:\n lst[idx].index...
[ "0.627772", "0.6240202", "0.6105271", "0.6012377", "0.59757066", "0.59426624", "0.5932078", "0.58777165", "0.56676006", "0.5625075", "0.5619137", "0.56100154", "0.5606043", "0.5595186", "0.5577129", "0.55570596", "0.55358815", "0.55144393", "0.55008495", "0.5477959", "0.54745...
0.7550748
0
Return a list of numbers from 'bgn' to 'end' (inclusive), separated by at LEAST 'stepSize'
def incr_min_step( bgn , end , stepSize ): # NOTE: The actual step size will be the size that produces an evenly-spaced list of trunc( (end - bgn) / stepSize ) elements return np.linspace( bgn , end , num = trunc( (end - bgn) / stepSize ) , endpoint=True )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def incr_max_step( bgn , end , stepSize ):\n numSteps = (end - bgn) / stepSize\n rtnLst = [ bgn + i * stepSize for i in xrange( trunc(numSteps) + 1 ) ]\n if numSteps % 1 > 0:\n rtnLst.append( end )\n return rtnLst", "def mrange(start, end, steps=1):\n list = []\n i = start\n while i <...
[ "0.7503607", "0.67077297", "0.65793264", "0.6468329", "0.6410941", "0.6394417", "0.63912874", "0.62909937", "0.6212184", "0.61731505", "0.6156595", "0.6086265", "0.60644144", "0.60462826", "0.6028342", "0.60192126", "0.6010421", "0.5993806", "0.59905833", "0.5950705", "0.5949...
0.7509704
0
Return a list of numbers from 'bgn' to 'end' (inclusive), separated by at MOST 'stepSize'
def incr_max_step( bgn , end , stepSize ): numSteps = (end - bgn) / stepSize rtnLst = [ bgn + i * stepSize for i in xrange( trunc(numSteps) + 1 ) ] if numSteps % 1 > 0: rtnLst.append( end ) return rtnLst
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def incr_min_step( bgn , end , stepSize ):\n # NOTE: The actual step size will be the size that produces an evenly-spaced list of trunc( (end - bgn) / stepSize ) elements\n return np.linspace( bgn , end , num = trunc( (end - bgn) / stepSize ) , endpoint=True )", "def mrange(start, end, steps=1):\n list ...
[ "0.72661185", "0.68283045", "0.66001165", "0.6527431", "0.65084", "0.65026414", "0.63567674", "0.6327457", "0.62562716", "0.6225763", "0.61354244", "0.61353606", "0.61297274", "0.6098803", "0.6096684", "0.60566485", "0.60063785", "0.5986516", "0.59771997", "0.595036", "0.5938...
0.7589755
0
Create a very simple SparseTensor with dimensions (batch, time).
def SimpleSparseTensorFrom(x): x_ix = [] x_val = [] for batch_i, batch in enumerate(x): for time, val in enumerate(batch): x_ix.append([batch_i, time]) x_val.append(val) x_shape = [len(x), np.asarray(x_ix).max(0)[1]+1] return x_ix, x_val, x_shape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SimpleSparseTensorFrom(x):\n x_ix = []\n x_val = []\n for batch_i, batch in enumerate(x):\n for time, val in enumerate(batch):\n x_ix.append([batch_i, time])\n x_val.append(val)\n x_shape = [len(x), np.asarray(x_ix).max(0)[1]+1]\n x_ix = tf.constant(x_ix, tf.int64)\n x_val = tf.constant(x_va...
[ "0.806455", "0.698965", "0.69786584", "0.6715365", "0.65662026", "0.6559799", "0.64801747", "0.6436444", "0.6337114", "0.63059366", "0.6297952", "0.62593", "0.6196853", "0.6183319", "0.6165012", "0.6125902", "0.6123623", "0.61051357", "0.6100126", "0.6088683", "0.6075629", ...
0.7715332
1
Sets the id of this VersionList.
def id(self, id): self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_id(self, id_):\n\n self.id_ = id_", "def SetId(self, id):\n self.id = int(id)", "def set_id(self, id):\n self.__id = id", "def set_id(self, id):\n self.data['id'] = id", "def id(self, id):\n \n self._id = id", "def id(self, id):\n \n self._i...
[ "0.72839373", "0.7283293", "0.72781837", "0.7143824", "0.6959204", "0.6959204", "0.6959204", "0.6959204", "0.6959204" ]
0.0
-1
Sets the description of this VersionList.
def description(self, description): if (self.local_vars_configuration.client_side_validation and description is not None and len(description) > 200): raise ValueError("Invalid value for `description`, length must be less than or equal to `200`") # noqa: E501 self._descripti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_description(self, description):\r\n self.__description = description", "def set_description(self, description):\n self.description = description", "def set_description(self, description):\n self.__description = description", "def set_description(self, description):\n self....
[ "0.7628644", "0.7612122", "0.76053977", "0.7595256", "0.7502267", "0.73817474", "0.73817474", "0.73817474", "0.73817474", "0.73747677", "0.73747677", "0.73747677", "0.73747677", "0.73747677", "0.73747677", "0.73747677", "0.73747677", "0.73747677", "0.73747677", "0.73747677", ...
0.6477355
90
Sets the error_message of this VersionList.
def error_message(self, error_message): if (self.local_vars_configuration.client_side_validation and error_message is not None and len(error_message) > 500): raise ValueError("Invalid value for `error_message`, length must be less than or equal to `500`") # noqa: E501 self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_message(self, error_message: str):\n\n self._error_message = error_message", "def error_message(self, error_message):\n\n self._error_message = error_message", "def setErrorMessage(self, errorMessage):\n self._errorMessage = errorMessage", "def set_error(self, error):\n ...
[ "0.78350246", "0.78121287", "0.7400095", "0.7005561", "0.69827324", "0.65354335", "0.6524109", "0.62657756", "0.61801594", "0.61469555", "0.61469555", "0.61469555", "0.61430734", "0.61283404", "0.61283404", "0.61283404", "0.61243135", "0.60951674", "0.6088888", "0.6087473", "...
0.7075057
3
Sets the memory_allocation of this VersionList.
def memory_allocation(self, memory_allocation): if (self.local_vars_configuration.client_side_validation and memory_allocation is not None and memory_allocation > 1048576): # noqa: E501 raise ValueError("Invalid value for `memory_allocation`, must be a value less than or equal to `1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allocated_memory(self, allocated_memory):\n\n self._allocated_memory = allocated_memory", "def memory(self, memory):\n\n self._memory = memory", "def memory_management(self, memory_management):\n allowed_values = [\"AUTOMATIC\", \"IN_CORE\", \"MEMORY_DEMAND_EVALUATION\", \"OUT_OF_CORE\...
[ "0.74491113", "0.708843", "0.63942", "0.6375137", "0.6355916", "0.63141024", "0.60862654", "0.6064399", "0.6025613", "0.6020074", "0.6008263", "0.596554", "0.5952661", "0.5853796", "0.58076775", "0.5722856", "0.56539494", "0.5615019", "0.5561028", "0.55372864", "0.55322236", ...
0.74105346
1
Sets the maximum_instances of this VersionList.
def maximum_instances(self, maximum_instances): if (self.local_vars_configuration.client_side_validation and maximum_instances is not None and maximum_instances > 2147483647): # noqa: E501 raise ValueError("Invalid value for `maximum_instances`, must be a value less than or equal to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setMaxEpochs(self, v):\n return self._set(maxEpochs=v)", "def define_max_instance(cls, max_instance: int, *args: BuiltInTypes, **kwargs: BuiltInTypes) -> ClassInstance:\n if cls._max_val_is_changed:\n return 'The maximum number of class instances has already been changed.'\n e...
[ "0.64629024", "0.644348", "0.63426554", "0.6230698", "0.6230698", "0.6204371", "0.6128207", "0.60930145", "0.60930145", "0.60541433", "0.60541433", "0.60541433", "0.6049028", "0.603094", "0.60249895", "0.59941524", "0.5989461", "0.5984751", "0.5982129", "0.59422135", "0.59355...
0.75081205
0
Sets the last_updated of this VersionList.
def last_updated(self, last_updated): self._last_updated = last_updated
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_updated(self, last_updated: str):\n\n self._last_updated = last_updated", "def last_updated(self, value):\n self._last_updated = value", "def updated(self, updated: datetime):\n\n self._updated = updated", "def last_update_timestamp(self, last_update_timestamp):\n\n self....
[ "0.783156", "0.742845", "0.7095724", "0.70114964", "0.6935989", "0.6897056", "0.68349934", "0.68167955", "0.68167955", "0.6754715", "0.6660729", "0.66458774", "0.66458774", "0.66458774", "0.66458774", "0.6567543", "0.6507392", "0.64871097", "0.64871097", "0.64871097", "0.6487...
0.7990411
3
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, VersionList): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, VersionList): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
Moves the horizontal print position relative to the left margin in 1/60th of inches. The printer ignores this command if the specified position is to the right of the right margin.
def horizontalPosition(self, horizontalPosition=0): if not(0 <= horizontalPosition <= 4095) or type(horizontalPosition) is not int: raise ValueError('horizontalPosition must be a int between 0 and 4095 and not ' + str(horizontalPosition)) else: nH = horizontalPosition >> 8 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_left(self):\n\n if self.xcor() < -230:\n self.setx(-255)\n else:\n new_x = self.xcor() - 40\n self.setx(new_x)", "def leftMargin(self, leftMargin=10):\n if not(0 <= leftMargin <= 65535) or type(leftMargin) is not int:\n raise ValueError('l...
[ "0.67172843", "0.66747254", "0.6126015", "0.610396", "0.6089386", "0.60388637", "0.5968692", "0.5838799", "0.5829698", "0.5821977", "0.5765187", "0.5720383", "0.5713015", "0.5703716", "0.56930363", "0.5654981", "0.5646541", "0.55797887", "0.5579431", "0.55454755", "0.5500115"...
0.5974407
6
Sets the left margin for printing. Set the left margin at the beginning of a line. The printer ignores any data preceding this command on the same line in the buffer. In page mode sets the left margin to leftMargin x (horizontal motion unit) from the left edge of the printable area
def leftMargin(self, leftMargin=10): if not(0 <= leftMargin <= 65535) or type(leftMargin) is not int: raise ValueError('leftMargin must be a int between 0 and 65535') else: nH = leftMargin >> 8 nL = leftMargin - (nH << 8) self._write(self.__class__.__GS + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_write_page_margins_left(self):\n\n self.worksheet.set_margins(left=0.5)\n self.worksheet._write_page_margins()\n\n exp = \"\"\"<pageMargins left=\"0.5\" right=\"0.7\" top=\"0.75\" bottom=\"0.75\" header=\"0.3\" footer=\"0.3\"/>\"\"\"\n got = self.fh.getvalue()\n\n self.a...
[ "0.6157114", "0.60113204", "0.60113204", "0.59523124", "0.5837685", "0.583633", "0.57008284", "0.567002", "0.5639263", "0.55910116", "0.5498445", "0.54898745", "0.5487963", "0.54803205", "0.54713064", "0.5425386", "0.53695226", "0.53454417", "0.53319454", "0.52931565", "0.529...
0.77645415
0
Compute the pairwise distance matrix between a and b which both have size [m, n, d] or [n, d]. The result is a tensor of
def pairwise_distances(a, b, p=2): squeezed = False if len(a.shape) == 2 and len(b.shape) == 2: a = tf.expand_dims(a,0) #[np.newaxis, :, :] b = tf.expand_dims(a,0) #b[np.newaxis, :, :] squeezed = True ret = tf.reduce_sum(tf.keras.backend.pow(tf.math.abs(tf.expand_dims(a,2) - tf....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euclidean_distance(a, b):\n\n N, D = tf.shape(a)[0], tf.shape(a)[1]\n M = tf.shape(b)[0]\n a = tf.tile(tf.expand_dims(a, axis=1), (1, M, 1))\n b = tf.tile(tf.expand_dims(b, axis=0), (N, 1, 1))\n dists_to_normal_class = tf.reduce_mean(tf.square(a - b), axis=2)\n dists_to_center = tf.reduce_mea...
[ "0.6902652", "0.67911065", "0.6719337", "0.66482395", "0.66320753", "0.65923566", "0.6484438", "0.643346", "0.63322103", "0.62631416", "0.6201301", "0.6182633", "0.61790967", "0.6174446", "0.6154466", "0.6112784", "0.60769695", "0.60753304", "0.6055228", "0.6037735", "0.59989...
0.7342199
0
This will return the number of connections.
def net_get_connections (): data = commands.getoutput("netstat -n | grep -c tcp") return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getconnectioncount(self):\n return self.proxy.getconnectioncount()", "def _created_connections(self):\n return len(self._available_connections) + len(self._in_use_connections)", "def get_num_connections(self):\n\n synapses = 0\n for mat in self.weights:\n synapses += ...
[ "0.87262654", "0.79701847", "0.7888119", "0.77742416", "0.7731998", "0.7409358", "0.7396894", "0.7315347", "0.7295333", "0.7286989", "0.72343886", "0.7207752", "0.7160435", "0.7069122", "0.70655435", "0.7047154", "0.7040733", "0.7027381", "0.7017638", "0.7006243", "0.69963837...
0.7330322
7
Shortest distance between two sets of spherical coordinates. Given a set of groundtruth spherical coordinates, and its respective predicted coordinates, we calculate the spherical distance between each of the spherical coordinate pairs resulting in a matrix of distances, where one axis represents the number of groundtr...
def distance_between_gt_pred(gt_list_rad, pred_list_rad): gt_len, pred_len = gt_list_rad.shape[0], pred_list_rad.shape[0] ind_pairs = np.array([[x, y] for y in range(pred_len) for x in range(gt_len)]) cost_mat = np.zeros((gt_len, pred_len)) # Slow implementation # cost_mat = np.zeros((gt_len, pred...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spherical_distances(x, y):\n # Compute the norms of all points, we do NOT check they actually all lie on\n # the same sphere (that's the caller's responsibility).\n \n xn = np.sqrt((x**2).sum(axis=1))\n yn = np.sqrt((y**2).sum(axis=1))\n ang_cos = np.dot(x, y.T)/(xn[:, None]*yn[None, :])\n ...
[ "0.57881534", "0.5718847", "0.5637151", "0.5613649", "0.56097025", "0.5563413", "0.5557891", "0.5539134", "0.550624", "0.54595786", "0.5453537", "0.542221", "0.54142886", "0.54104954", "0.54030025", "0.5357205", "0.53551453", "0.53439796", "0.533596", "0.53135914", "0.5306946...
0.0
-1
Angular distance between two spherical coordinates
def distance_between_spherical_coordinates_rad(az1, ele1, az2, ele2): dist = np.sin(ele1) * np.sin(ele2) + np.cos(ele1) * np.cos(ele2) * np.cos(np.abs(az1 - az2)) # Making sure the dist values are in -1 to 1 range, else np.arccos kills the job dist = np.clip(dist, -1, 1) dist = np.arccos(dist) * 180 / n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angular_distance( lat1, lon1, lat2, lon2 ):\n\tpi_180 = pi / 180\n\treturn acos( cos( lat1 * pi_180 ) * cos( lon1 * pi_180 ) * cos( lat2 * pi_180) * cos( lon2 * pi_180 ) + \n\t\t\tcos( lat1 * pi_180) * sin( lon1 * pi_180 ) * cos( lat2 * pi_180) * sin( lon2 * pi_180 ) + \n\t\t\tsin( lat1 * pi_180 ) * sin( lat2 ...
[ "0.771338", "0.7457169", "0.6832781", "0.67985874", "0.67935944", "0.67864627", "0.6754118", "0.66961193", "0.6659209", "0.66559553", "0.6639117", "0.661399", "0.6601418", "0.65968424", "0.65929717", "0.6591951", "0.6563591", "0.6545598", "0.6481332", "0.64763004", "0.6475621...
0.6501094
18
Including A moving object into the gridworld, which moves uniformly at random in all accessible directions (including idle), without
def move_obj(self, s, bg=True, blit=True): if bg: self.background() x, y = self.indx2coord(s, center=True) pygame.draw.circle(self.surface, (205, 92, 0), (y, x), self.size / 2) if blit: self.screen.blit(self.surface, (0, 0)) pygame.display.flip() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MoveRandom(self):\n r = random.randint(0,3)\n if r == 0: self.x += 1\n elif r == 1: self.y += 1\n elif r == 2: self.x -= 1\n elif r == 3: self.y -= 1", "def update(self):\n if self.x<0:\n self.x = 0\n\n if self.y <0:\n self.y = 0\n\n ...
[ "0.7344722", "0.72038114", "0.698939", "0.6971952", "0.69340324", "0.6897358", "0.689688", "0.6845048", "0.67559236", "0.6707663", "0.6658819", "0.6650899", "0.66193163", "0.6580656", "0.65782386", "0.65782386", "0.64878494", "0.6484331", "0.64633733", "0.64251995", "0.642348...
0.0
-1
Perform top k accuracy.
def __call__(self, output, target, *args, **kwargs): if isinstance(output, tuple): output = output[0] if isinstance(target, tuple) or isinstance(target, list): target = target[0] res = accuracy(output, target, self.topk) n = output.size(0) self.data_num +=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accuracy_topk(output, target, topk=(5,10)):\n maxk = max(topk)\n batch_size = target.size(0)\n\n _, pred = output.topk(maxk, 1, True, True)\n pred = pred.t()\n correct = pred.eq(target.view(1, -1).expand_as(pred))\n\n res = []\n for k in topk:\n correct_k = correct[:k].view(-1).floa...
[ "0.7956461", "0.76888674", "0.76277393", "0.7607592", "0.7501635", "0.75003934", "0.75003934", "0.7492706", "0.7491988", "0.74913317", "0.7485141", "0.7484721", "0.7476828", "0.7476828", "0.7476828", "0.7476828", "0.7476828", "0.7476828", "0.7476828", "0.7476828", "0.7476828"...
0.0
-1
Reset states for new evaluation after each epoch.
def reset(self): self.sum = [0.] * len(self.topk) self.data_num = 0 self.pfm = [0.] * len(self.topk)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.train_loss.reset_states()\n self.train_accuracy.reset_states()\n self.val_loss.reset_states()\n self.val_accuracy.reset_states()\n self.train_mIoU.reset_states()\n self.val_mIoU.reset_states()", "def reset_states(self):\n K.batch_set_value([(v,...
[ "0.80495393", "0.78997624", "0.78915554", "0.7809362", "0.7702101", "0.7452878", "0.7401274", "0.73966926", "0.7392122", "0.73909366", "0.7355613", "0.7320188", "0.7273222", "0.72527194", "0.7237268", "0.72339463", "0.72228444", "0.72228444", "0.7216148", "0.7116189", "0.7116...
0.0
-1
Perform top k accuracy.
def __call__(self, output, target, *args, **kwargs): _, y_pred = output.topk(1, 1, True, True) y_pred = y_pred.t().detach().cpu().numpy()[0] y_true = target.detach().cpu().numpy() self.pfm = self.metric_func(y_true, y_pred) return self.pfm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accuracy_topk(output, target, topk=(5,10)):\n maxk = max(topk)\n batch_size = target.size(0)\n\n _, pred = output.topk(maxk, 1, True, True)\n pred = pred.t()\n correct = pred.eq(target.view(1, -1).expand_as(pred))\n\n res = []\n for k in topk:\n correct_k = correct[:k].view(-1).floa...
[ "0.7956461", "0.76888674", "0.76277393", "0.7607592", "0.7501635", "0.75003934", "0.75003934", "0.7492706", "0.7491988", "0.74913317", "0.7485141", "0.7484721", "0.7476828", "0.7476828", "0.7476828", "0.7476828", "0.7476828", "0.7476828", "0.7476828", "0.7476828", "0.7476828"...
0.0
-1
Reset states for new evaluation after each epoch.
def reset(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.train_loss.reset_states()\n self.train_accuracy.reset_states()\n self.val_loss.reset_states()\n self.val_accuracy.reset_states()\n self.train_mIoU.reset_states()\n self.val_mIoU.reset_states()", "def reset_states(self):\n K.batch_set_value([(v,...
[ "0.80500746", "0.7900075", "0.7892623", "0.7809766", "0.7701779", "0.7452834", "0.74003196", "0.73978704", "0.7391068", "0.73904717", "0.73551613", "0.73188496", "0.72726554", "0.72525", "0.7236549", "0.72333264", "0.72223294", "0.72223294", "0.72152805", "0.7116018", "0.7116...
0.0
-1
Type payee phone into "Phone" field Raise NoSuchElementException on failure
def type_phone(self, phone): with allure.step("Type payee phone"): element = Element(driver=self.driver, explicit_wait_time=self.explicit_wait_time, locator=BillPayPageLocator.PHONE_INPUT) element.write(phone) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_phone(form, field):\n if len(field.data) > 16:\n raise ValidationError('Invalid phone number')\n try:\n input_number = phonenumbers.parse(field.data)\n if not (phonenumbers.is_valid_number(input_number)):\n raise ValidationError('Invalid phone number')\n except...
[ "0.63507754", "0.6292955", "0.6292955", "0.6279666", "0.6223703", "0.62006015", "0.6068031", "0.60555166", "0.6040544", "0.60141146", "0.59224", "0.59070563", "0.58461493", "0.5844821", "0.5844821", "0.5844821", "0.5844821", "0.5844821", "0.5782861", "0.5779016", "0.57526994"...
0.75374633
0
Get payee phone from "Phone" field Raise NoSuchElementException on failure
def phone(self): element = Element(driver=self.driver, explicit_wait_time=self.explicit_wait_time, locator=BillPayPageLocator.PHONE_INPUT) return element.element_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_phone(self):\n\n e = await self.request.request(url='https://accountinformation.roblox.com/v1/phone', method='get')\n return e", "def type_phone(self, phone):\n\n\t\twith allure.step(\"Type payee phone\"):\n\t\t\telement = Element(driver=self.driver,\n\t\t\t explicit_...
[ "0.6897545", "0.6485001", "0.6464395", "0.6464395", "0.63824224", "0.6265222", "0.6233421", "0.6213375", "0.61879885", "0.6149147", "0.6137433", "0.60983044", "0.6048351", "0.6035856", "0.6035856", "0.6023397", "0.5987126", "0.5981656", "0.5981656", "0.5981656", "0.59740716",...
0.6829676
1
Returns resultant quaternion of 3 rotation quaternions. First gets the resultant quaternion of q_sweq_fla and rotates the wing axis by that quaternion. Then gets q_fea, which is a rotation about the wing axis(which is why q_sweq_fla needs to be calculated first). The gets resultant quaternion q_feaq_sweq_fla.
def get_q_total(fla_q, swe_q, theta_fea, wing_axis): q_swe_fla = swe_q.__mul__(fla_q) wa_rot = q_swe_fla.rotate(wing_axis) q_fea = pq.Quaternion(axis=wa_rot, angle=theta_fea) return q_fea.__mul__(q_swe_fla)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply_quaternions( qa, qb ):\n combined = Quaternion()\n\n combined.w = (qa.w * qb.w - qa.x * qb.x - qa.y * qb.y - qa.z * qb.z)\n combined.x = (qa.x * qb.w + qa.w * qb.x + qa.y * qb.z - qa.z * qb.y)\n combined.y = (qa.w * qb.y - qa.x * qb.z + qa.y * qb.w + qa.z * qb.x)\n combined.z = (qa.w * ...
[ "0.6281801", "0.58474183", "0.5839346", "0.5722328", "0.5649433", "0.56389904", "0.55813515", "0.5550359", "0.55407625", "0.55036485", "0.5487441", "0.5478441", "0.5470156", "0.54384583", "0.54284835", "0.5422494", "0.538703", "0.5369212", "0.5361896", "0.535905", "0.5346346"...
0.7129776
0
Rotate 3D vectors by quaternion 'q'. 'vec' should be an Nby3 numpy array, where N is the number of vectors to rotate. Returns an array of the same size as 'vec', with each vector rotated by 'q'
def rotate_vectors(q, vec): rot_vec = [] for i, v in enumerate(vec): rot_vec.append(q.rotate(v)) return rot_vec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qrot(q, v):\n assert q.shape[-1] == 4\n assert v.shape[-1] == 3\n assert q.shape[:-1] == v.shape[:-1]\n\n qvec = q[..., 1:]\n uv = torch.cross(qvec.double(), v.double(), dim=len(q.shape) - 1)\n uuv = torch.cross(qvec.double(), uv.double(), dim=len(q.shape) - 1)\n return v + 2 * (q[..., :1]...
[ "0.713796", "0.71102613", "0.7014051", "0.6781593", "0.66422695", "0.66422695", "0.66227746", "0.662108", "0.6602797", "0.6575993", "0.6534116", "0.64992374", "0.6448314", "0.6429001", "0.6342501", "0.63213795", "0.6317977", "0.62170136", "0.6201201", "0.6198141", "0.61677426...
0.7858003
0
Create a JSON object representing an error and return 404 Response
def error_response(error_text): return Response(json.dumps({'error' : error_text}), status=404, mimetype='application/json')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_found(self, error):\n return jsonify({'error': 'NOT FOUND'}), 404", "def normal404(e):\n return jsonify({\"error\": \"Not found\"}), 404", "def not_found(error): # pylint: disable=unused-argument\n response = jsonify(\n {\"success\": False, \"error_code\": 404, \"message\": \"Not Found...
[ "0.83780223", "0.8175947", "0.8148857", "0.8093175", "0.8065299", "0.80618864", "0.8054956", "0.80440694", "0.79954505", "0.7986744", "0.7930817", "0.78934455", "0.78742594", "0.7629958", "0.7615865", "0.7615865", "0.7566938", "0.74541277", "0.74468863", "0.74427444", "0.7442...
0.75599664
17
Returns the shortest first name (str). You can assume there is only one shortest name.
def shortest_first_name(names): names = dedup_and_title_case_names(names) names_splitted = [name.split() for name in names] names_splitted.sort(key=sort_length) names_sorted = [" ".join(name) for name in names_splitted] return names_sorted[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortest_first_name(names):\n names = dedup_and_title_case_names(names)\n split_names = [name.split(' ') for name in names]\n first_name = [first for first, last in split_names]\n shortest = first_name[0]\n for name in first_name:\n if len(name) < len(shortest):\n shortest = na...
[ "0.84954876", "0.84290755", "0.83644813", "0.81783897", "0.7850813", "0.7567559", "0.7426242", "0.7413317", "0.74103856", "0.7284431", "0.7284431", "0.7284431", "0.7284431", "0.7284431", "0.7284431", "0.7284431", "0.7284431", "0.7284431", "0.7284431", "0.7284431", "0.7284431"...
0.8405048
2
Tabulates and outputs a table of next episodes for each show in shows.
def tabulator(shows): padding = 3 headers = ['Show', 'Next episode', 'Rating', 'Title'] shows = sorted(shows) header_lengths = [len(h) for h in headers] max_show_title_length = max(len(s.title) for s in shows) max_ep_title_length = max(len(s._next.title) for s in shows) max_entry_lengths = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_all_shows(self):\n self.load_shows()\n print()\n for show_id in sorted(\n self.shows_data, key=lambda show_id: self.shows_data[show_id]['title']\n ):\n next_show = self.shows_data[show_id]\n if next_show['watchedEpisodes'] <= 0:\n ...
[ "0.72311586", "0.6727877", "0.6667352", "0.63191134", "0.6001607", "0.5962473", "0.59517664", "0.59280515", "0.5919233", "0.5898998", "0.58696705", "0.585247", "0.5823006", "0.57642514", "0.5753256", "0.5742879", "0.5731514", "0.5702913", "0.5695918", "0.56855905", "0.5654781...
0.7177147
1
Clean and extract episode details response. Take an episode details response and cleans the data. Extract the relevant fields needed to construct an Episode object.
def extract_episode_details(season, episode_response): try: rating = float(episode_response['imdbRating']) except ValueError: # Rating may come through as 'N/A' if episode has not aired rating = None return { 'title': episode_response['Title'], 'episode': int(episode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_episode_details(self, episode):\n\n url_data = episode.url.get()\n\n # XXX Maybe we should just not return a list because we only use\n # the first element.\n #\n if hasattr(url_data, '__iter__'):\n url_data = url_data[0]\n\n self.parser.set_buffer(1...
[ "0.7203547", "0.6758013", "0.6681653", "0.6353754", "0.61681914", "0.61393476", "0.61391693", "0.59553236", "0.5943734", "0.5897874", "0.5745463", "0.565098", "0.56336325", "0.5554903", "0.5539353", "0.5535537", "0.55113834", "0.55002975", "0.54995906", "0.5497507", "0.549673...
0.70539284
1
Reconstruct an object if the class has been registered. Check if the key in deserialized_data corresponds to a registered class and if so, construct and return an instance of the class with keyword arguments given in value in deserialized_data.
def _reconstruct_object(deserialized_data): for key, value in deserialized_data.items(): key = key.strip('__') if key in registry: # Gather the keyword arguments for class *key* kwargs = dict(value.items()) return registry[key](**kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _deserialize_deconstructed(cls, payload):\n cls_path = payload['type']\n cls_module, cls_name = cls_path.rsplit('.', 1)\n\n try:\n cls_type = getattr(import_module(cls_module), cls_name)\n except (AttributeError, ImportError):\n raise ImportError('Unable to loc...
[ "0.6607428", "0.6560893", "0.6464798", "0.630142", "0.621104", "0.6123421", "0.61056954", "0.61031395", "0.61001456", "0.608511", "0.59696656", "0.59675705", "0.5954092", "0.5942543", "0.5940531", "0.59133", "0.5888015", "0.5867093", "0.58607334", "0.58199954", "0.5772865", ...
0.8193221
0
A strategy for generating email addresses as strings.
def emails() -> st.SearchStrategy[str]: return ( st.emails() .map(lambda s: s.lower()) .map(_validate_email) .filter(_is_valid_email) .map(lambda m: m.normalized) # type: ignore[union-attr] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_email_address(self):\n return \"%s.%s@%s\" % (uuid.uuid4(), self.mailbox, \"mailosaur.io\")", "def generate_email():\n valid_domain_name_chars = [c for c in range(48,57)]+[c for c in range(65,90)]+[c for c in range(97,122)]+[45]\n username = ''.join(generate_string(10, valid_username_ch...
[ "0.7134931", "0.6899943", "0.6820698", "0.6697338", "0.6679038", "0.6355258", "0.6354774", "0.62803566", "0.62622255", "0.62215036", "0.62215036", "0.61614406", "0.60821813", "0.60776705", "0.603496", "0.600464", "0.5944022", "0.59114844", "0.58966064", "0.5859411", "0.584651...
0.6092325
12
Tokenize, extract features and create dataloaders for train, validation and test datasets.
def preprocess_sentences(train, val, test): tokenizer = BertTokenizer.from_pretrained('bert-base-uncased', do_lower_case=True) train_data = convert_examples_to_features(train, tokenizer, pad_token_label_id=pad_id) val_data = convert_examples_to_features(val, tokenizer, pad_token_label_id=pad_id) t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_loaders(args, tokenizer):\n personachat = get_dataset(tokenizer, args.dataset_path, args.dataset_cache, args.train_lang)\n _ = personachat.pop(\"test\", None)\n logger.info(\"Build inputs and labels\")\n datasets = {\"train\": [], \"valid\": []}\n\n if args.train_lang in [\"En\", \"Fr\"...
[ "0.7140566", "0.6850385", "0.673339", "0.67242247", "0.6703386", "0.66814893", "0.6673964", "0.6616081", "0.6600683", "0.6570088", "0.65100056", "0.6471666", "0.6446229", "0.64296216", "0.6409746", "0.6392946", "0.6376742", "0.6365234", "0.63433605", "0.6307133", "0.62951416"...
0.0
-1
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
def haversine(lon1, lat1, lon2, lat2): # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 a = sin(dlat / 2) ** 2 + cos(lat1) * cos(lat2) * sin(dlon / 2) ** 2 c = 2 * asin(sqrt(a)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.8146076", "0.7864454", "0.7633271", "0.76056963", "0.75972307", "0.7595696", "0.7593779", "0.75715214", "0.7563679", "0.7556733", "0.752954", "0.7516531", "0.74944276", "0.7466583", "0.7451814", "0.74339056", "0.73920107", "0.7358634", "0.73481995", "0.73311156", "0.732847...
0.0
-1
Create slices of a list
def generate_equal_slices(list_to_slice, batch_size): assert len(list_to_slice) > 1 list_slices = [] sample_size = len(list_to_slice) for start_i in range(0, sample_size, batch_size): end_i = start_i + batch_size aslice = list_to_slice[start_i:end_i] if len(aslice) < batch_si...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slice(list, point):\n index = list.index(point)\n slices = []\n \n slices.append(list[:index])\n slices.append(list[index + 1:])\n \n return slices", "def get_slice_from_list(self,list_,start=0,end=None):\r\n start = self._index_to_int(start,True)\r\n if end is not...
[ "0.7789472", "0.73200864", "0.7111179", "0.6968356", "0.683307", "0.6811933", "0.6790205", "0.6783199", "0.6685886", "0.6664954", "0.66613954", "0.6595111", "0.65604013", "0.65525025", "0.6550791", "0.65335923", "0.65285903", "0.65054154", "0.6485275", "0.6481337", "0.6429342...
0.6889797
4