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
Computes top left and bottom right points of the boxes
def build_boxes(inputs): center_x, center_y, width, height, confidence, classes = tf.split(inputs, [1, 1, 1, 1, 1, -1], axis=-1) top_left_x = center_x - width / 2 top_left_y = center_y - height / 2 bottom_right_x = center_x + width / 2 bottom_right_y = center_y + height / 2 return tf.concat([top_left_x, to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_yolo_coordinates(y_top, y_bottom, x_left, x_right, width, height):\n w = (width - x_left - x_right) / width # width of bounding box\n h = (height - y_top - y_bottom) / height # height of bounding box\n x = (1 - w / 2) - x_right / width # x center of box (distance right from UL)\...
[ "0.7189052", "0.70713836", "0.7049528", "0.69801676", "0.6952645", "0.6932045", "0.68999004", "0.68394846", "0.68211603", "0.6731479", "0.66911507", "0.6673323", "0.6641144", "0.6561648", "0.6555155", "0.65539366", "0.65538603", "0.65462554", "0.65374565", "0.65328926", "0.65...
0.0
-1
Set the analog model weights based on the digital model.
def set_weights_from_digital_model(self, analog_model, digital_model): weights, biases = self.get_weights_from_digital_model(analog_model, digital_model) analog_model.analog_tile.set_weights(weights, biases, realistic=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setWeights(self, w):\n raise NotImplementedError", "def set_weights(self, weights):\n self.model.set_weights(weights)", "def init_weights(model):\n ...", "def set_weights(self, weights):\r\n self.weights = weights", "def update_weights(self):\n\t\tpass", "def set_weights(s...
[ "0.69701874", "0.6816834", "0.677921", "0.6763403", "0.67067647", "0.664186", "0.660116", "0.65940607", "0.65678084", "0.65616155", "0.65592045", "0.6536974", "0.64620906", "0.64280206", "0.64269364", "0.64174527", "0.6396879", "0.63806605", "0.6380468", "0.6369089", "0.63682...
0.83768046
0
Set the analog model weights based on the digital model.
def get_weights_from_digital_model(analog_model, digital_model): weights = digital_model.weight.data.detach().reshape( [analog_model.out_features, analog_model.in_features]).cpu() biases = None if digital_model.bias is not None: biases = digital_model.bias.data.detach().c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_weights_from_digital_model(self, analog_model, digital_model):\n weights, biases = self.get_weights_from_digital_model(analog_model, digital_model)\n analog_model.analog_tile.set_weights(weights, biases, realistic=False)", "def setWeights(self, w):\n raise NotImplementedError", "de...
[ "0.83768046", "0.69701874", "0.6816834", "0.677921", "0.6763403", "0.67067647", "0.664186", "0.660116", "0.65940607", "0.65678084", "0.65616155", "0.65592045", "0.6536974", "0.64620906", "0.64280206", "0.64269364", "0.64174527", "0.6396879", "0.63806605", "0.6380468", "0.6369...
0.60580224
64
Test that the BatchByBatchIdResponderHandler correctly broadcasts a received request that the Responder cannot respond to, or sends a GossipBatchResponse back to the connection_id the handler received the request from.
def test_batch_by_id_responder_handler(): # The completer does not have the requested batch testResponder = TestResponder() before_message = network_pb2.GossipBatchByBatchIdRequest( id="abc", nonce="1", time_to_live=1) after_message = network_pb2.GossipBatchByBatchIdRequest( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_batch_by_id_responder_handler_requested():\n # The completer does not have the requested batch\n testResponder = TestResponder()\n\n before_message = network_pb2.GossipBatchByBatchIdRequest(\n id=\"abc\",\n nonce=\"1\",\n time_to_live=1)\n\n after_message = network_pb2.Gos...
[ "0.8130006", "0.79064727", "0.73172796", "0.7301306", "0.71850693", "0.6590739", "0.6163382", "0.6054451", "0.6043817", "0.59907013", "0.5836386", "0.58326745", "0.5807576", "0.57523", "0.5750152", "0.5730069", "0.57191217", "0.5719107", "0.56948906", "0.5591376", "0.5590005"...
0.7622639
2
Test that the BatchByTransactionIdResponderHandler correctly broadcasts a received request that the Responder cannot respond to, or sends a GossipBatchResponse back to the connection_id the handler received the request from.
def test_batch_by_transaction_id_response_handler(): # The completer does not have the requested batch with the transaction testResponder = TestResponder() before_message = network_pb2.GossipBatchByTransactionIdRequest( ids=["123"], nonce="1", time_to_live=1) after_message = ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_batch_by_transaction_id_response_handler_requested():\n # The completer does not have the requested batch with the transaction\n testResponder = TestResponder()\n\n before_message = network_pb2.GossipBatchByTransactionIdRequest(\n ids=[\"123\"],\n time_to_live=1)\n\n after_messag...
[ "0.76967067", "0.76098436", "0.726449", "0.7241992", "0.6977747", "0.6733284", "0.6105164", "0.60241616", "0.6007674", "0.5875616", "0.5836403", "0.5816904", "0.57796", "0.57321626", "0.5723795", "0.5687044", "0.5680453", "0.56615114", "0.5644592", "0.5641729", "0.558037", ...
0.7558632
2
Test that the BatchByTransactionIdResponderHandler correctly broadcasts a received request that the Responder cannot respond to, and does not rebroadcast the same request again. If we have already recieved the request, do nothing.
def test_batch_by_transaction_id_response_handler_requested(): # The completer does not have the requested batch with the transaction testResponder = TestResponder() before_message = network_pb2.GossipBatchByTransactionIdRequest( ids=["123"], time_to_live=1) after_message = network_pb2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_batch_by_id_responder_handler_requested():\n # The completer does not have the requested batch\n testResponder = TestResponder()\n\n before_message = network_pb2.GossipBatchByBatchIdRequest(\n id=\"abc\",\n nonce=\"1\",\n time_to_live=1)\n\n after_message = network_pb2.Gos...
[ "0.63218457", "0.6313474", "0.6091217", "0.6087697", "0.6042026", "0.6011666", "0.600242", "0.60018516", "0.59403586", "0.59071153", "0.5890052", "0.58576494", "0.585678", "0.58170295", "0.58023363", "0.578973", "0.56996965", "0.56849414", "0.5659666", "0.5645571", "0.5616185...
0.64663684
0
Test that the BatchByTransactionIdResponderHandler correctly broadcasts a new request with only the transaction_ids that the Responder cannot respond to, and sends a GossipBatchResponse for the transactions_id requests that can be satisfied.
def test_batch_by_transaction_id_multiple_txn_ids(): # Add batch that has txn 123 testResponder = TestResponder() transaction = transaction_pb2.Transaction(header_signature="123") batch = batch_pb2.Batch( header_signature="abc", transactions=[transaction]) testResponder.completer.add_batch(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_batch_by_transaction_id_response_handler_requested():\n # The completer does not have the requested batch with the transaction\n testResponder = TestResponder()\n\n before_message = network_pb2.GossipBatchByTransactionIdRequest(\n ids=[\"123\"],\n time_to_live=1)\n\n after_messag...
[ "0.7859367", "0.7783337", "0.7498952", "0.72765297", "0.7061208", "0.67807496", "0.59955823", "0.5991131", "0.5953589", "0.58867925", "0.58164555", "0.5802051", "0.5684354", "0.5654345", "0.56064653", "0.5600558", "0.5547513", "0.54792917", "0.5476023", "0.54533285", "0.54274...
0.7733302
2
Return the Euclidean distance between a document and a mean vector.
def distance(self, doc, mean, mean_norm): ###TODO AB = 0.0 for i in doc.keys(): if i in mean: AB = AB + (doc[i] * mean[i]) return float(math.sqrt(self.sqnorm(doc) + mean_norm - (AB * 2.0) ))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dist(mean, example):\n return np.linalg.norm(example.row - mean)", "def euclidean_distance(self, point, centroid):\n square_diff = 0.0\n for i in range(0, len(point)):\n square_diff += abs(point[i] - centroid[i]) ** 2\n return math.sqrt(square_diff)", "def euclidean_dista...
[ "0.693888", "0.6340139", "0.613514", "0.6110662", "0.6106742", "0.6087369", "0.6067589", "0.60429895", "0.6026481", "0.5987211", "0.5976277", "0.5954496", "0.593786", "0.59316176", "0.5923561", "0.5918856", "0.59100515", "0.5905876", "0.58970225", "0.58862025", "0.5869793", ...
0.799535
0
same_minute Takes two datetime objects and returns true if the occur in the same minute.
def same_minute(a, b): a_truncated = a.replace(second=0, microsecond=0) b_truncated = b.replace(second=0, microsecond=0) return a_truncated == b_truncated
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_time(startTime, endTime):\n\n now = datetime.now()\n startTimeObj = datetime.strptime(startTime, '%I:%M%p')\n endTimeObj = datetime.strptime(startTime, '%I:%M%p')\n\n if startTimeObj.hour <= now.hour <= endTimeObj.hour and \\\n startTimeObj.minute <= now.minute <= endTimeObj.minute:\n ...
[ "0.6673009", "0.6496446", "0.6262651", "0.5696382", "0.5608931", "0.55689335", "0.5427796", "0.52922493", "0.5283282", "0.5282062", "0.52708685", "0.52567935", "0.52472615", "0.5238719", "0.52354825", "0.5230162", "0.5230162", "0.5197941", "0.5186822", "0.51792204", "0.517170...
0.7683291
0
Sort by site index i, then neighbor distances, then neighbor index j.
def sort_neighbors_by_site_index_i(neighbor_count_df: pd.DataFrame) -> pd.DataFrame: return neighbor_count_df.sort_values(by=["i", "distance_bin", "j"]).reset_index( drop=True )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sort_nodes_by_height(self):\n self.node_high_to_low = np.argsort(self.height)[::-1]\n\n # Also to sort neighbour node array by height\n\n neighbour_array_lo_hi = self.neighbour_array.copy() # easiest way to get size / structure right\n\n for node in range(0,self.tri.npoints):\n ...
[ "0.6149939", "0.58844435", "0.5833009", "0.5720376", "0.56741214", "0.55732274", "0.5562403", "0.5549812", "0.55491245", "0.5524915", "0.5512536", "0.5503387", "0.54974014", "0.547236", "0.5469209", "0.5463917", "0.54574335", "0.54399097", "0.5430338", "0.54256135", "0.539316...
0.7709377
0
Iterate over all sites, grouping by siteindex pairs, subspecies pairs, and bin intervals.
def group_site_index_pairs_by_distance( neighbor_distances_df: pd.DataFrame, distance_bins_df: pd.DataFrame ) -> pd.core.groupby.DataFrameGroupBy: binned_distances: pd.Series = pd.cut( x=neighbor_distances_df["distance_ij"], bins=distance_bins_df.index ).rename("distance_bin") return neighbor_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_sites(self):\n for i in range(self.num_sites):\n indices = list()\n for dim in self.site_idxs:\n indices.append(i % dim)\n i = i // dim\n yield tuple(indices)", "def build_sites(self):\n for i in range(self.shape[0]):\n ...
[ "0.693251", "0.591848", "0.58233505", "0.58120817", "0.5702818", "0.541736", "0.52310383", "0.5213679", "0.5208376", "0.5195316", "0.5172675", "0.5164199", "0.5139917", "0.51325417", "0.5097647", "0.5049759", "0.5035706", "0.50312424", "0.50312424", "0.49905437", "0.49665344"...
0.63907796
1
Create a class for Merchant (Beta) API endpoint access
def __init__(self, merchant_username): self.merchant_username = merchant_username
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, environment=\"practice\", access_token=None):\n super(APIv20, self).__init__(environment, access_token)\n self._version = \"v3\"\n\n self.account = Account(self)\n self.orders = Orders(self)\n self.positions = Positions(self)\n self.pricing = Pricing(sel...
[ "0.657971", "0.6520606", "0.6455067", "0.6350531", "0.63298774", "0.62700933", "0.6260162", "0.62416124", "0.6207017", "0.61502635", "0.6066364", "0.606454", "0.60476595", "0.6043878", "0.6024718", "0.6023551", "0.60180074", "0.6008915", "0.59998876", "0.5999864", "0.5981772"...
0.0
-1
Calculates the distance between two data vectors. Here the euclidean distance is used.
def calc_dist(data_1, data_2): if data_1 is None or data_2 is None: return float('inf') diff = data_1 - data_2 dist = np.sqrt(np.dot(diff, diff)) return dist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _vector_dist(self, vec1, vec2):\r\n return sqrt(sum([(float(v1) - float(v2)) ** 2 for v1, v2 in\r\n zip(vec1, vec2)]))", "def dist(v1, v2):\n return ( (v1[0] - v2[0])**2 + (v1[1] - v2[1])**2 )**0.5", "def euclidean_distance(vector_1: Vector, vector_2: Vector) -> Vector...
[ "0.8112091", "0.78344536", "0.7766268", "0.7747982", "0.77435374", "0.77344143", "0.7694975", "0.76948416", "0.76640904", "0.76617783", "0.76525915", "0.7625057", "0.76199317", "0.7609416", "0.76082706", "0.7587119", "0.75764686", "0.75764686", "0.7575031", "0.7566798", "0.75...
0.80456996
1
Samples a new population of particles by perturbing an existing one. Uses a gaussian perturbation kernel.
def sample_next_population(self, ps, log_weights, obs_data, eps, logger, rng): n_particles, n_dim = ps.shape n_sims = 0 weights = np.exp(log_weights) # calculate population covariance mean = np.mean(ps, axis=0) cov = 2.0 * (np.dot(ps.T, ps) / n_particles - np.outer(mean...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_GP_posterior(x_train, y_train, x_test, mean_func, cov_func,\n\t\t\t\t\t kernel_params, sigma=0.1, seed=42, n_samples=5):\n K = cov_func(x_train, x_train, *kernel_params)\n L = np.linalg.cholesky(K + sigma**2 * np.identity((x_train.shape)[0]))\n K_star = cov_func(x_train, x_test, *kernel_para...
[ "0.67307305", "0.67226946", "0.63718194", "0.62597257", "0.6248003", "0.6235742", "0.61935484", "0.61874014", "0.61768776", "0.61123043", "0.60980356", "0.6082416", "0.60690403", "0.60543764", "0.6025534", "0.6019796", "0.60171914", "0.60070026", "0.6005304", "0.5997929", "0....
0.56450075
53
Given a rule A > B C get_instances collects all instances of rules of the form
def get_instances(rule, forest): instances = [] for r in forest: if r.lhs[1] == rule.lhs[1] and len(r.rhs)==len(rule.rhs): test = [] for i in range(len(r.rhs)): try: # if for example r.rhs[i] = '[A]' v = r.rhs[i][1] == rule.rhs[i][1] test.append(v) except IndexError: # if for exam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rules(cls) -> list:\n return [factory() for factory in cls._rules_factories]", "def rules(self):\r\n return Acls(self)", "def __iter__(self):\n return self.rules.__iter__()", "def __iter__(self):\n return self.rules.itervalues()", "def createCARs(rules):\n CARs = []\n...
[ "0.5756645", "0.56827736", "0.5645889", "0.5485005", "0.54252565", "0.5376047", "0.5358051", "0.53305244", "0.5329181", "0.53192514", "0.53169465", "0.5221203", "0.52153116", "0.5180071", "0.51761925", "0.51439047", "0.5143415", "0.512259", "0.50844115", "0.5053413", "0.50515...
0.6091476
0
Generate a dict of cinema data. The format is compatible with serializers.
def fake_cinema_data(): cinema_data = { "name": f"{faker.street_name()} Cinema", "city": faker.city(), } return cinema_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data(self):\n return dict(name=self.name, ra=self.ra, dec=self.dec, mjd=self.mjd,\n type_=self.type, cosmo= (self.cosmo.name if self.cosmo is not None else None),\n zcmb = self.zcmb, zcmb_err=self.zcmb_err)", "def get_county() -> Dict:\n model = get_data_mod...
[ "0.5992884", "0.569457", "0.56515324", "0.5617272", "0.5565463", "0.5506874", "0.55063105", "0.549541", "0.54843104", "0.54809654", "0.54741466", "0.5464763", "0.5460282", "0.54521185", "0.54120773", "0.5383592", "0.5360149", "0.53557146", "0.5326057", "0.5325837", "0.5318993...
0.6377098
0
(str, str) > bool Return True if and only if DNA sequence dna2 occurs in the DNA sequence dna1. >>> contains_sequence('ATCGGC', 'GG') True >>> contains_sequence('ATCGGC', 'GT') False
def contains_sequence(dna1, dna2): return dna2 in dna1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains_sequence(dna1, dna2):\r\n if dna2 in dna1:\r\n return True\r\n else:\r\n return False", "def contains_sequence(dna1, dna2):\n if dna1.find(dna2):\n return True", "def __contains__(self, seq):\n return bool(libhts.faidx_has_seq(self._fai, seq))", "def is_legit...
[ "0.86155546", "0.8331352", "0.64856875", "0.6073715", "0.6049054", "0.58982676", "0.5839239", "0.57882637", "0.5744029", "0.57426673", "0.56947386", "0.56876814", "0.5666197", "0.5659935", "0.56272525", "0.5624721", "0.55907726", "0.5577147", "0.5526664", "0.54999477", "0.549...
0.84902483
1
Load the source file into a DataFrame
def load_file(self): self.df = self.sqlContext.read.csv(self.source, sep=self.sep, header=True, inferSchema=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load() -> DataFrame:\n return load_file(__file__, \"default.csv.gz\")", "def load_file_to_dataframe(self, file_path: str) -> pd.DataFrame:\n return pd.read_csv(file_path, sep=\"\\t\")", "def load_data(sourcedatafile):\n with open(sourcedatafile, \"r\") as infile:\n data = pd.read_csv(in...
[ "0.7285161", "0.71072376", "0.7036338", "0.70065635", "0.6976749", "0.6962361", "0.69419557", "0.67637205", "0.67265034", "0.6706185", "0.6702248", "0.66758275", "0.66376066", "0.6633324", "0.66154045", "0.6613759", "0.6609117", "0.66066897", "0.6590614", "0.65798753", "0.657...
0.7890117
0
returns the area of a rectangle by overriding the area() method set in the BaseGeometry class
def area(self): return self.__width * self.__height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n return _property_op(arctern.ST_Area, self)", "def area(self):\n\n bbox = self.bbox\n area = Box.calculate_bbox_area(bbox, bbox_type=self.bbox_type)\n\n return area", "def area(self):\n num_rows = self.row_end - self.row_start\n num_cols = self.col_end...
[ "0.80029666", "0.79418266", "0.7847819", "0.77469397", "0.7738064", "0.7721504", "0.771905", "0.7635354", "0.7629503", "0.760423", "0.75518245", "0.75494957", "0.75418127", "0.75360024", "0.75338614", "0.7512599", "0.7510807", "0.7499542", "0.74772745", "0.74772745", "0.74705...
0.72731316
56
Maintain a heap with length == k.
def heap_select(self, arr, k): h = [] for i in range(len(arr)): if i < k: heapq.heappush(h, arr[i]) else: heapq.heappush(h, arr[i]) heapq.heappop(h) return h[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, k): \r\n self.heap_array.append(k)\r\n\r\n current_index = len(self.heap_array) - 1\r\n while (current_index > 0):\r\n parent_index = ((current_index-1)//2)\r\n\r\n if int(self.heap_array[current_index]) > int(self.heap_array[parent_index]): # if no vialation of the min hea...
[ "0.74399227", "0.72824186", "0.7115041", "0.70614606", "0.7000738", "0.6744188", "0.6692957", "0.6684956", "0.64084804", "0.637654", "0.6325616", "0.6317039", "0.6316556", "0.62876093", "0.626015", "0.6252735", "0.6250352", "0.6247557", "0.6232864", "0.62094814", "0.6199807",...
0.6638684
8
Return a logger with a default ColoredFormatter.
def setup_logger(): formatter = ColoredFormatter( "%(log_color)s%(levelname)-8s%(reset)s %(blue)s%(message)s", datefmt=None, reset=True, log_colors={ 'DEBUG': 'cyan', 'INFO': 'green', 'WARNING': 'yellow', 'ERROR': 'red', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_logger():\n log = logging.getLogger() # root logger\n log.setLevel(logging.DEBUG)\n format_str = '%(asctime)s - %(levelname)-8s - %(message)s'\n date_format = '%Y-%m-%d %H:%M:%S'\n if os.isatty(2):\n cformat = '%(log_color)s' + format_str\n colors = {'DEBUG': 'reset',\n ...
[ "0.6997327", "0.69930655", "0.69123006", "0.67099947", "0.65776837", "0.651248", "0.639512", "0.63876176", "0.63416046", "0.62690854", "0.6198342", "0.61980766", "0.61904794", "0.61826414", "0.61500585", "0.6130593", "0.61298096", "0.6112584", "0.61023426", "0.6090986", "0.60...
0.682874
3
Get an absolute time or delta and return an ISO8601 string with the absolute time.
def get_time_with_delta(string): # If it looks like an ISO time, return that. try: absolute = pscheduler.iso8601_as_datetime(string) # Default behavior is to localize naive times. if absolute.tzinfo is None: absolute = pytz.utc.localize(absolute) return pschedule...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iso_8601(self):\n return self.isoformat(timespec=\"microseconds\")", "def ISO8601(self):\n if self.timezoneNaive():\n return \"%0.4d-%0.2d-%0.2dT%0.2d:%0.2d:%0.2d\" % (\n self._year, self._month, self._day,\n self._hour, self._minute, self._second)\n ...
[ "0.65283895", "0.6426393", "0.6256046", "0.620456", "0.59902954", "0.5987449", "0.596792", "0.59570783", "0.592256", "0.59003186", "0.5864871", "0.58171153", "0.5802145", "0.5790476", "0.5790229", "0.5773619", "0.5749339", "0.57422346", "0.57319134", "0.5730626", "0.57153004"...
0.5993105
4
Current value of alpha multiplied by its corresponding parameter.
def value(self): return self._force.params[self.typepair][self.name] * ( self._cpp_obj.alpha)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alpha(self) -> float:\n return self._alpha", "def multiplyC(self, alpha):\r\n self.C *= alpha\r\n if self.dC is not self.C:\r\n self.dC *= alpha\r\n self.D *= alpha**0.5", "def alpha(self) -> float:\n return self.intrinsic_matrix[0, 1]", "def alpha(self):\n ...
[ "0.73291373", "0.70535624", "0.6943545", "0.6876968", "0.6876968", "0.6876968", "0.6819097", "0.6812921", "0.6769094", "0.6711864", "0.6630661", "0.6627566", "0.66052616", "0.65762156", "0.6566675", "0.65087765", "0.64680207", "0.6448723", "0.6396063", "0.63904136", "0.635395...
0.58261317
84
r"""Per particle forces in alchemical alpha space.
def alchemical_forces(self): return self._cpp_obj._forces
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alpha(self):\n sinOmg = np.sin(self.omega())\n return self.a1()/c.c*sinOmg", "def alpha(self):\r\n f, s, t, v_atm_n = self.f, self.shift, self.t, self.v_atm_n\r\n beta, rho, volvol = self.beta, self.rho, self.volvol\r\n # Convert ATM normal vol to ATM shifted lognormal\r\n ...
[ "0.69665647", "0.6844344", "0.6436635", "0.6362805", "0.63458216", "0.6337729", "0.6271206", "0.6252053", "0.6228934", "0.61703455", "0.61421293", "0.6124582", "0.6080381", "0.60626495", "0.6041293", "0.6015792", "0.60042095", "0.5968917", "0.5966956", "0.59666455", "0.593552...
0.0
-1
Net force in alchemical alpha space.
def net_alchemical_force(self): return self._cpp_obj.net_force
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setNormalForce(self):\n if self.onGround:\n self.fn = -self.fg\n self.vy = 0\n if self.inGround:\n self.fn = -self.fg\n self.vy = -5\n if self.hittingCeilling:\n self.fn = 1\n self.vy = 2\n if self.hittingWallRight:\n...
[ "0.5636231", "0.5565791", "0.5518376", "0.54898465", "0.54867566", "0.5480393", "0.54223824", "0.54100823", "0.5408777", "0.5406457", "0.5375773", "0.5360212", "0.53188103", "0.53066796", "0.52906924", "0.5287591", "0.5287591", "0.5287591", "0.5265565", "0.5251076", "0.52432"...
0.7046351
0
Given a tx and a Merkle tree object, retrieve its list of tx's and parse through it to arrive at the minimum amount of information required to arrive at the correct block header. This does not include the tx itself. Return this data as a list; remember that order matters!
def merkle_proof(tx, merkle_tree): proof = [] tx_ind = merkle_tree.leaves.index(tx) node = merkle_tree._root lower = 0 upper = len(merkle_tree.leaves) depth = 1 while upper - lower > 1: mid = (lower + upper) // 2 if tx_ind >= mid: if type(node._left) != str:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_transaction_proof(self, tx_hash):\n for t_json in self._transactions:\n if tx_hash == algo.hash1(t_json):\n return MerkleTree(self._transactions).get_proof(t_json)\n return None", "def get_tx_info(tx):\n\n input_addresses = []\n output_addresses = []\n pay...
[ "0.57342803", "0.5620786", "0.55236053", "0.54440534", "0.53750265", "0.5333978", "0.5327622", "0.5203928", "0.51292366", "0.5102675", "0.5099021", "0.5078219", "0.50682867", "0.5062667", "0.5043833", "0.5023844", "0.4975629", "0.4936653", "0.49354148", "0.49236715", "0.49159...
0.6277132
0
Helper function to retrieve the node with the maximum depth. Helpful for pairing nodes for hashing in verify_proof
def get_max_depth_node(nodes): curr = nodes[0] for i in range(0, len(nodes)): if nodes[i].depth > curr.depth: curr = nodes[i] return curr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deep_max(self):\r\n node = self\r\n while not node.is_leaf():\r\n node = node.children[-1]\r\n return node.keys[-1] if node.keys else None", "def maxDepth(node):\n\tif node is None: \n\t\treturn 0 \n\telse: \n\t\tlDepth=maxDepth(node.left)\n\t\trDepth=maxDepth(node.right) \n\...
[ "0.72239596", "0.71110725", "0.7028778", "0.70121855", "0.7009213", "0.69739896", "0.69647413", "0.6944186", "0.69411284", "0.6871684", "0.68397987", "0.68150574", "0.67795324", "0.6759867", "0.6731754", "0.66656417", "0.66217434", "0.65681237", "0.65566784", "0.65561384", "0...
0.8253633
0
Returns True if cached database connections are enabled for this process and thread.
def _cached_db_connections_enabled(): with _use_cache_flags_lock: return _get_cache_identifier() in _use_cache_flags
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_cached_db_connections():\n with _use_cache_flags_lock:\n _use_cache_flags.add(_get_cache_identifier())\n logging.debug(\"using cached database connections for {}\".format(_get_cache_identifier()))", "def has_cache(self):\n try:\n cache = self.get_cache()\n ret...
[ "0.7109976", "0.65336627", "0.63388395", "0.6311228", "0.62134117", "0.6206986", "0.6167429", "0.61661536", "0.61273444", "0.61150146", "0.6087256", "0.607707", "0.60521275", "0.60086036", "0.59813267", "0.58556086", "0.5809574", "0.5806598", "0.57866406", "0.5778018", "0.574...
0.8770847
0
Returns a datetime.datetime object to it's equivalent in the SLA time zone.
def _datetime_to_sla_time_zone(self, dt=None): if dt is not None: assert isinstance(dt, datetime.datetime) else: dt = datetime.datetime.utcnow() # convert to the business hour time zone dt = dt.astimezone(self._bh_tz) # because the businesshour library's m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def datetime(self, aware=False) -> dt.datetime:\n if aware is True:\n now = await self.AD.sched.get_now()\n return now.astimezone(self.AD.tz)\n else:\n return await self.AD.sched.get_now_naive()", "def setup_datetime(self):\n \n current_date_time...
[ "0.6626562", "0.651577", "0.6389735", "0.621003", "0.61848634", "0.6180154", "0.61399883", "0.6116856", "0.60864216", "0.60799867", "0.60588574", "0.60562474", "0.6024017", "0.5985689", "0.5980456", "0.5937382", "0.5934242", "0.59313345", "0.5926565", "0.5908878", "0.58944184...
0.69522595
0
Returns a time delta that represents how old this alert is in business days and hours.
def business_time(self): # remember that 1 day == _end_hour - _start_hour (default: 12) if hasattr(self, '_business_time'): return getattr(self, '_business_time') sla_now = self._datetime_to_sla_time_zone() _converted_insert_date = self._datetime_to_sla_time_zone(dt=self.ins...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def business_time_seconds(self):\n hours_per_day = self._end_hour - self._start_hour\n return ((self.business_time.days * hours_per_day * 60 * 60) + \n (self.business_time.seconds))", "def delta(self) -> timedelta:\n delta = self.data.get(\"delta\", 0)\n return timedelt...
[ "0.6663147", "0.6389352", "0.6343992", "0.6309531", "0.62879807", "0.6087558", "0.5962432", "0.594686", "0.5901345", "0.58682024", "0.5735008", "0.5667846", "0.56190646", "0.560943", "0.55526656", "0.55393034", "0.55283153", "0.5511694", "0.5508212", "0.5508212", "0.5508212",...
0.60674393
6
Returns self.business_time as a formatted string for display.
def business_time_str(self): result = "" if self.business_time.days: result = '{} day{}'.format(self.business_time.days, 's' if self.business_time.days > 1 else '') hours = int(self.business_time.seconds / 60 / 60) if hours: result = '{}, {} hour{}'.format(result...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time(self):\n return time.strftime(\"%d/%m/%y %M:%H:%S\", self.time)", "def get_time_string(self):\n return f\"{self.year} {self.month:02} \" \\\n f\"{self.start_day:02} {self.start_hour:02} 00 {self.get_duration():6}\"", "def _time_str(self):\n try:\n if not ...
[ "0.66852975", "0.6648833", "0.6548212", "0.65479994", "0.6474151", "0.64731336", "0.64665955", "0.64147174", "0.6388222", "0.63259524", "0.63003665", "0.6274333", "0.6246528", "0.622748", "0.6220999", "0.62187946", "0.620569", "0.6202486", "0.6193733", "0.6183773", "0.6136269...
0.8661103
0
Returns self.business_time as seconds (computing _end_time start_time hours per day.)
def business_time_seconds(self): hours_per_day = self._end_hour - self._start_hour return ((self.business_time.days * hours_per_day * 60 * 60) + (self.business_time.seconds))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def business_time(self):\n # remember that 1 day == _end_hour - _start_hour (default: 12)\n if hasattr(self, '_business_time'):\n return getattr(self, '_business_time')\n\n sla_now = self._datetime_to_sla_time_zone()\n _converted_insert_date = self._datetime_to_sla_time_zone(...
[ "0.7328976", "0.6572903", "0.6485031", "0.64461315", "0.6352772", "0.6322001", "0.6251789", "0.6230856", "0.6202444", "0.6190617", "0.6185208", "0.6171752", "0.6089418", "0.6074168", "0.60253394", "0.6022482", "0.60150677", "0.60102606", "0.59921974", "0.59920734", "0.5989764...
0.87700325
0
Returns True if this Alert is approaching SLA and has not been dispositioned yet.
def is_approaching_sla(self): if hasattr(self, '_is_approaching_sla'): return getattr(self, '_is_approaching_sla') if self.insert_date is None: return None if self.sla is None: logging.warning("cannot get SLA for {}".format(self)) return None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_over_sla(self):\n if hasattr(self, '_is_over_sla'):\n return getattr(self, '_is_over_sla')\n\n if self.insert_date is None:\n return None\n\n if self.sla is None:\n logging.warning(\"cannot get SLA for {}\".format(self))\n return None\n\n ...
[ "0.72351635", "0.62840503", "0.61535114", "0.61428833", "0.606279", "0.60547644", "0.6044497", "0.6044497", "0.5899532", "0.58988756", "0.5869178", "0.57977206", "0.57971275", "0.57815254", "0.57544094", "0.57499266", "0.57133967", "0.5678213", "0.5674743", "0.5672146", "0.56...
0.7842176
0
Sets the unit of this Metric.
def unit(self, unit): if self.local_vars_configuration.client_side_validation and unit is None: # noqa: E501 raise ValueError("Invalid value for `unit`, must not be `None`") # noqa: E501 self._unit = unit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_unit(self,unit):\n self.unit = unit", "def unit(self, unit):\n if unit is None:\n raise ValueError(\"Invalid value for `unit`, must not be `None`\") # noqa: E501\n\n self._unit = unit", "def set_units(self, units):\n self.units = units", "def unit(self, unit):\...
[ "0.84926", "0.78140813", "0.7796304", "0.7715254", "0.7715254", "0.74808687", "0.7407732", "0.739416", "0.739416", "0.739416", "0.7291931", "0.7291828", "0.7291828", "0.7291828", "0.7149005", "0.7134203", "0.6933228", "0.6850507", "0.6841243", "0.6824849", "0.678313", "0.67...
0.64192355
41
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Metric): 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.8089139", "0.8089139", "0.8054507", "0.79827213", "0.79669285", "0.79669285", "0.79669285", "0.79669285", "0.79669285", "0.79669285", "0.79669285", "0.79669285", "0.79669285", "0.79669285", "0.79669285", "0.79669285", "0.79669285", "0.79669285", "0.79669285", "0.79669285", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, Metric): 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
Setup the environment for the tests.
def setup_class(self): global TEST_WORKSPACE TEST_WORKSPACE = env.get_workspace('suppress') os.environ['TEST_WORKSPACE'] = TEST_WORKSPACE test_project = 'suppress' test_config = {} project_info = project.get_info(test_project) test_proj_path = os.path.join(T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n test_env_setup()", "def SetupEnvironment(self):\n pass", "def setup_environment():\n global _ENV_SETUP_DONE\n if _ENV_SETUP_DONE:\n return\n _ENV_SETUP_DONE = True\n\n _configure_libraries()\n\n custom_module_path = os.environ.get(\"DETECTRON2_ENV_MODULE\")\n\...
[ "0.85513", "0.7985477", "0.76386875", "0.76165676", "0.7568468", "0.74105126", "0.740646", "0.740646", "0.73988277", "0.7389599", "0.73784834", "0.7351523", "0.7351523", "0.7266423", "0.726281", "0.7253904", "0.7238544", "0.72049457", "0.7177899", "0.71689606", "0.7161641", ...
0.0
-1
Create a perspective transform matrix to correct for the skewed rectangles from depth. Also flips the image if needed using the same matrix.
def solve_perspective(region, flip_code): dst = np.array([ [0, 0], [algo_width, 0], [algo_width, algo_height], [0, algo_height] ], dtype="float32") if flip_code in (0, -1): # Flip vertical dst[[0, 3]] = dst[[3, 0]] dst[[1, 2]] = dst[[2, 1]] if fl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_warp_perspective(transpose_image, h_matrix, dimension):\n warped_image = np.zeros((dimension[0], dimension[1], 3))\n for index1 in range(0, transpose_image.shape[0]):\n for index2 in range(0, transpose_image.shape[1]):\n new_vec = np.dot(h_matrix, [index1, index2, 1])\n n...
[ "0.6961995", "0.67696697", "0.6688307", "0.665031", "0.66333884", "0.657592", "0.6561255", "0.6515467", "0.6427236", "0.6424072", "0.64009476", "0.63698685", "0.63671947", "0.6321484", "0.62023115", "0.61806285", "0.61546415", "0.61453867", "0.61185974", "0.5998012", "0.58896...
0.5655073
30
Get the base Synapse client. If username and api_key are provided, the client will sign all request using the provided api_key. Otherwise, all requests will be sent anonymously.
def get_base_client(*, repo_endpoint: str = SYNAPSE_DEFAULT_REPO_ENDPOINT, auth_endpoint: str = SYNAPSE_DEFAULT_AUTH_ENDPOINT, file_endpoint: str = SYNAPSE_DEFAULT_FILE_ENDPOINT, username: str = None, api_key: str = None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_client():\n return Client(__address, authkey='strumamor')", "def api_client() -> APIClient:\n return APIClient()", "def api_client() -> APIClient:\n\n return APIClient()", "def base_client(self):\n return self._client", "def client():\n return Client(**common_data.AUTH_ARGS)", ...
[ "0.69021785", "0.6854666", "0.68149334", "0.6800597", "0.6748193", "0.6516545", "0.65080124", "0.638177", "0.6324834", "0.631915", "0.63110477", "0.6304182", "0.62724036", "0.6240252", "0.621214", "0.62046695", "0.61860406", "0.61506784", "0.6136903", "0.61321086", "0.6082690...
0.7209268
0
Update the headers to include UserAgent header that capture the core client
def _enforce_user_agent(headers: dict) -> dict: headers.update(SYNAPSE_USER_AGENT_HEADER) return headers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_agent_header(self):\n self._api_client.set_default_header('User-Agent', self._api_client.user_agent)", "def _change_user_agent(self):\n index = (self.current_user_agent_index + 1) % len(_USER_AGENT_LIST)\n self.headers['User-Agent'] = _USER_AGENT_LIST[index]\n self.current_us...
[ "0.80205107", "0.75569725", "0.75509924", "0.7061009", "0.67133355", "0.65541124", "0.64873487", "0.6452161", "0.6406103", "0.63851875", "0.63821775", "0.6367635", "0.6307359", "0.62445444", "0.6218018", "0.61367893", "0.6117366", "0.60759455", "0.60286826", "0.59755355", "0....
0.68959093
4
Check for Admin permissions
def check_permission(): if IS_ADMIN: out_info("Running as Root/Admin") else: out_warning("Running without root/admin privileges")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_admin():\n\tif not current_user.is_admin:\n\t\tabort(403)", "def check_admin():\n if not current_user.is_admin:\n abort(403)", "def check_admin():\n if not current_user.is_admin:\n abort(403)", "def check_admin():\r\n if not current_user.is_admin:\r\n abort(403)", "d...
[ "0.8375341", "0.8362171", "0.8362171", "0.83435786", "0.81155133", "0.8031248", "0.7922821", "0.7887089", "0.7833625", "0.78250635", "0.779804", "0.77819574", "0.778109", "0.7772413", "0.7772413", "0.7702272", "0.7628744", "0.760626", "0.7586347", "0.7509582", "0.7501883", ...
0.7645213
16
Enable or disable CUDA
def ask_enable_cuda(): global ENABLE_CUDA i = input("Enable CUDA? [Y/n] ") if i in ("", "Y", "y"): out_info("CUDA Enabled") ENABLE_CUDA = True else: out_info("CUDA Disabled") ENABLE_CUDA = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def EnableCUDA(gpu_id=0, use_cudnn=True):\n global option\n option['device'] = 'CUDA'\n option['device_id'] = gpu_id\n option['use_cudnn'] = use_cudnn", "def cuda(self):\n for i in self.modules:\n if torch.cuda.is_available():\n self.modules[i] = self.modules[i].cuda()", "def set_cud...
[ "0.74763834", "0.7256901", "0.7115312", "0.6998752", "0.69452673", "0.66552615", "0.66175616", "0.66040975", "0.63919944", "0.63265425", "0.6286284", "0.6228537", "0.6209338", "0.61631984", "0.61372364", "0.61348337", "0.6133312", "0.6058657", "0.6024234", "0.6009775", "0.599...
0.76312745
0
makes sure a string is valid for creating file names
def valid_file_name(s: str) -> str: global UNICODE_FILENAMES, FILESYSTEM_IS_LINUX if FILESYSTEM_IS_LINUX: s = fix_linux.sub("_", s) else: s = fix_windows.sub("_", s) s = fix_windows_ending.split(s)[0] if not UNICODE_FILENAMES: s = fix_unicode.sub("_", s) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_filename(strname):\n import string\n import os\n\n fname_only, fext_only = os.path.splitext(strname)\n valid_chars = \"-_() %s%s\" % (string.ascii_letters, string.digits)\n\n # valid_chars = \"-_.() %s%s\" % (string.ascii_letters, string.digits)\n valid_fname = ''.join(c for c in fname_...
[ "0.7353584", "0.68569034", "0.6853428", "0.6841623", "0.68387455", "0.68301696", "0.6801716", "0.6738029", "0.67222613", "0.6632162", "0.66259027", "0.6583907", "0.65594625", "0.6513711", "0.6513711", "0.6513711", "0.65120465", "0.64877814", "0.64859295", "0.64484894", "0.642...
0.73898625
0
depunctuates, lowercases and wordtokenizes the argument text string and returns a list of the tokens
def tokenize(txt): Depunc = depunctuate(txt).lower() Tokens = word_tokenize(Depunc) return Tokens
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n return [token.lower() for token in simple_preprocess(text) if token not in STOPWORDS]", "def tokenize(text):\n # YOUR CODE HERE\n t = text.lower()\n words = re.findall(r'[a-z]+',t)\n return words", "def tokenize(text):\n regex = re.compile(r'\\W+')\n tokens = regex.split(...
[ "0.8067214", "0.7988553", "0.7979972", "0.78295094", "0.78251386", "0.7787325", "0.7780347", "0.77349675", "0.7708313", "0.7698988", "0.7691239", "0.7689588", "0.76839507", "0.76809317", "0.76395607", "0.76220614", "0.7617724", "0.76123786", "0.7608079", "0.75972056", "0.7579...
0.85382104
0
Judge if a btree is balanced
def isBalancedTree(root: BTNode) -> (bool, int): if root is None: return True, 0 leftBalanced, leftHeight = isBalancedTree(root.lchild) if not leftBalanced: return False, None rightBalanced, rightHeight = isBalancedTree(root.rchild) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_balanced(root):\n return depth(root) != -1;", "def _is_balanced(node):\n\n # An empty node is always balanced\n if not node:\n return True\n\n # If the heights differ by more than 1, return False\n if abs(_height(node.left) - _height(node.right...
[ "0.79907346", "0.7479768", "0.7324416", "0.72022545", "0.7192528", "0.7044994", "0.70140016", "0.70123845", "0.7007026", "0.69941306", "0.69906217", "0.6959103", "0.6936766", "0.693369", "0.69077194", "0.68656266", "0.679646", "0.67642236", "0.6760148", "0.6710104", "0.669600...
0.6780778
17
Get the (X,Y,Z) of the plane of the monolayer in the original lattice inputs
def getPlane(entry): a,b,c = getNewLattice(entry,2) a_vector = np.linalg.solve(np.array(entry[0].lattice.as_dict()['matrix']).T,a) b_vector = np.linalg.solve(np.array(entry[0].lattice.as_dict()['matrix']).T,b) fracs = np.cross(a_vector,b_vector) fracs /= min([x for x in fracs if abs(x)>1E...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plane(self):\n return plane(self.N, self.o)", "def three_dimensional(self, z): # Maybe I misunderstood the task. My method looks weird\n return (self.x, self.y, z)", "def project_onto_plane(self,z):\n U=self.U\n Q=self.Q_p\n #print(((z-Q[-2,:,[2]])/P[-2,:,[2]]).T)\n ...
[ "0.65550965", "0.65093786", "0.629044", "0.62764025", "0.6252769", "0.62058645", "0.61669266", "0.61150867", "0.6103648", "0.605824", "0.59541035", "0.5951124", "0.5939668", "0.5909655", "0.58302766", "0.5814337", "0.57972544", "0.5796691", "0.57861733", "0.5761059", "0.57565...
0.5550104
46
Adds an initial convolution layer (with batch normalization and relu6). Returns Output tensor of block.
def _conv_block(inputs, filters, kernel=(3, 3), strides=(1, 1), alpha=1.0, nl='RE'): channel_axis = 1 if K.image_data_format() == 'channels_first' else -1 filters = int(filters * alpha) x = KL.Conv2D(filters, kernel, padding='same', use_bias=False, strides=strides)(inputs) x = KL.BatchNormalization(axis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _conv_block(inputs: \"Layer\",\n filters: int,\n kernel: int or Tuple[int, int],\n strides: int or Tuple[int, int]) -> \"Layer\":\n\n layer = Conv2D(filters, kernel, padding='same', strides=strides)(inputs)\n layer = BatchNormalization()(layer)\n layer = re...
[ "0.6827578", "0.677018", "0.66241884", "0.6592786", "0.65001553", "0.6277305", "0.62663835", "0.621618", "0.6215205", "0.62015754", "0.61792654", "0.61673915", "0.6158975", "0.6152572", "0.6126272", "0.612529", "0.6094548", "0.6082707", "0.60695535", "0.60674876", "0.6053287"...
0.5881529
52
Inverted Residual Block This function defines a sequence of 1 or more identical layers. Arguments
def _inverted_residual_block(inputs, filters, kernel, t, strides, n): x = _bottleneck(inputs, filters, kernel, t, strides) for i in range(1, n): x = _bottleneck(x, filters, kernel, t, 1, True) return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_layer(self, out_channels, num_blocks):\n layers = []\n for i in range(num_blocks):\n stride = 2 if i == 0 else 1\n layers.append(InvertedResidual(in_channels=self.in_channels, out_channels=out_channels, stride=stride, conv_cfg=self.conv_cfg, norm_cfg=self.norm_cfg, act...
[ "0.6717466", "0.6475339", "0.6434296", "0.63575125", "0.61108077", "0.60318065", "0.58997923", "0.58931625", "0.5851161", "0.5827282", "0.5768704", "0.57652074", "0.5761624", "0.5755392", "0.57512003", "0.57388943", "0.5733231", "0.573243", "0.5662537", "0.56578296", "0.56480...
0.6192982
4
Adds a depthwise convolution block. A depthwise convolution block consists of a depthwise conv, batch normalization, relu6, pointwise convolution, batch normalization and relu6 activation. Arguments
def _depthwise_conv_block(inputs, pointwise_conv_filters, alpha, depth_multiplier=1, strides=(1, 1), block_id=1): channel_axis = 1 if K.image_data_format() == 'channels_first' else -1 pointwise_conv_filters = int(pointwise_conv_filters * alpha) if strides == (1, 1): x = in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _depthwise_conv_block(inputs, pointwise_conv_filters, alpha,\n depth_multiplier=1, strides=(1, 1), block_id=1,\n dilation_rate=1):\n channel_axis = 1 if K.image_data_format() == 'channels_first' else -1\n pointwise_conv_filters = int(pointwise_conv_filter...
[ "0.69339544", "0.66527593", "0.6404539", "0.6402286", "0.6395182", "0.6342808", "0.62206495", "0.6149659", "0.6149521", "0.61392134", "0.612934", "0.61282974", "0.6105343", "0.6070269", "0.6038615", "0.6032126", "0.60237867", "0.6015205", "0.6009851", "0.60064656", "0.5972131...
0.68931305
1
Jump to previous item in playlist.
def previous(self): self._select_interface(self._rc_previous, self._http_previous)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_to_prev(self):\n spotifyconnect.Error.maybe_raise(lib.SpPlaybackSkipToPrev())", "def jump_to_previous(self):\n self.nvim.command('silent! wincmd p')", "def go_to_previous_spike(self, ):\n self._jump_to_spike(-1)", "def MoveToPreviousSlide(self, event):\n pass", "def focus...
[ "0.74154335", "0.7242955", "0.71192473", "0.7085587", "0.70318866", "0.7015509", "0.7003673", "0.69842464", "0.69784224", "0.6953585", "0.69489413", "0.69377095", "0.69350433", "0.69247043", "0.6918628", "0.68042845", "0.6793262", "0.67858076", "0.6756258", "0.67546517", "0.6...
0.6638023
22
Get the length of playing title in seconds.
def get_length(self): return self._select_interface(self._rc_get_length, self._http_get_length)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title_len(self) -> int:\n return self.__title_len", "def duration(self):\n return self.sound.nframes", "def media_duration(self) -> int | None:\n if self._device.movie.title_length:\n return self._device.movie.title_length\n return None", "def get_song_length_millis...
[ "0.74023694", "0.70964867", "0.7047076", "0.7015654", "0.6854492", "0.6827531", "0.67904216", "0.6736111", "0.6713752", "0.66872424", "0.66323495", "0.65654373", "0.65030617", "0.64897597", "0.647162", "0.64645857", "0.6462148", "0.64396685", "0.64396685", "0.64267826", "0.64...
0.0
-1
Increase the volume by x.
def volup(self, x) -> int: return self._select_interface(self._rc_volup, self._http_volup, x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume_increase():\n request_command(tv_command=TVCommand.volume_increase)", "def increase_volume(self) -> None:\n for _ in range(10):\n self.media.volume_up()\n self.system.notify(f\"Jarvis::Increased Volume: {self.media.get_volume()['volume']}%\")", "def volume_up(self) -> Non...
[ "0.78315234", "0.7539641", "0.69908917", "0.68214107", "0.6648409", "0.66446245", "0.66109776", "0.66038245", "0.6520624", "0.6425236", "0.6422962", "0.6411287", "0.6386463", "0.6378897", "0.6339047", "0.6307567", "0.6293229", "0.62899977", "0.6287205", "0.628414", "0.6234269...
0.0
-1
Decrease the volume by x.
def voldown(self, x) -> int: return self._select_interface(self._rc_voldown, self._http_voldown, x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume_decrease():\n request_command(tv_command=TVCommand.volume_decrease)", "def decrease_volume(self) -> None:\n for _ in range(10):\n self.media.volume_down()\n self.system.notify(f\"Jarvis::Decreased Volume: {self.media.get_volume()['volume']}%\")", "def volume_down(self) ->...
[ "0.7709499", "0.763264", "0.7303274", "0.7104924", "0.690862", "0.6885046", "0.65447503", "0.6497919", "0.64247745", "0.63407797", "0.63010985", "0.6238971", "0.61828893", "0.6174765", "0.59696937", "0.5932848", "0.5913985", "0.5891307", "0.58183116", "0.5815198", "0.5753516"...
0.5620045
34
Generate a list of all ngrams.
def find_all_ngrams(dataset, n): return zip(*[dataset[i:] for i in xrange(n)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ngrams(self):\n return self.__ngrams(())", "def get_all_ngrams():\n grams = ()\n for i in range(0, 40):\n text_i = read_file(str(i))\n curr_grams = ngramize(text_i, n)\n grams = chain(grams, curr_grams)\n return grams", "def ngrams(self):\n return self.root.ngram...
[ "0.8387409", "0.8271651", "0.7850285", "0.7775725", "0.77123594", "0.7647909", "0.76348233", "0.7536239", "0.74404305", "0.7435254", "0.7432671", "0.7429412", "0.7412621", "0.7410481", "0.74042755", "0.7395261", "0.7379887", "0.73279345", "0.7247282", "0.723576", "0.721681", ...
0.7239333
19
Construct a ngram dictionary which maps an ngram tuple to the number of times it appears in the text.
def construct_ngrams_dict(ngrams_list): counts = {} for t in ngrams_list: key = hash_function(t) if key in counts: counts[key] += 1 else: counts[key] = 1 return counts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_ngrams(self, n):\n\n output = {}\n\n for i in range(len(self.text)-n+1):\n s = ' '.join(self.text[i:i+n])\n # if s is not already in dictionary, set value to 0\n output.setdefault(s, 0)\n output[s] += 1\n return output", "def count_ngrams(...
[ "0.7905143", "0.77849597", "0.75094116", "0.74974865", "0.7313239", "0.7273313", "0.7245066", "0.71098924", "0.7089491", "0.7055904", "0.70038086", "0.6967518", "0.6927174", "0.6926246", "0.6890894", "0.68841445", "0.68726164", "0.6861496", "0.6851239", "0.68435264", "0.68376...
0.7878325
1
Returns a dictionary structure of all Zeppelin Interpreter values from the environment starting with the token token.
def _get_interpreter_values(token='ZEPPELIN_INTERPRETER') -> dict: env_variables = {} for env_variable in os.environ: if env_variable.startswith(token): env_variables[env_variable] = os.environ[env_variable] LOG.info('%s-based token environment variables: %s', token, env_variables) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env_tokens(self):\r\n\r\n # Find the env JSON file\r\n if self.SERVICE_VARIANT:\r\n env_path = self.REPO_ROOT.parent / \"{service}.env.json\".format(service=self.SERVICE_VARIANT)\r\n else:\r\n env_path = path(\"env.json\").abspath()\r\n\r\n # If the file does n...
[ "0.6096451", "0.58284014", "0.55301124", "0.5489134", "0.54685843", "0.54489386", "0.54300034", "0.5414121", "0.54121614", "0.53899944", "0.5286179", "0.5253514", "0.5196621", "0.51857287", "0.5178122", "0.51737624", "0.5166521", "0.516521", "0.51567996", "0.5131018", "0.5103...
0.81815326
0
Does the filename extension indicate a vector graphic format?
def is_vector_graphics(self, filename: str) -> bool: ext = path.splitext(filename)[-1] return ext in VECTOR_GRAPHICS_EXTENSIONS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_file(ext, argument):\n formats = {\n 'input_dataset_path': ['csv', 'txt'],\n 'output_dataset_path': ['csv'],\n 'output_plot_path': ['png'],\n 'input_model_path': ['pkl']\n }\n return ext in formats[argument]", "def is_png(filename):\n return '.png' in filename...
[ "0.69018364", "0.6314827", "0.62815475", "0.61245453", "0.61194193", "0.60949254", "0.6040416", "0.60272706", "0.6013631", "0.6009033", "0.6002042", "0.5994415", "0.59874964", "0.59532356", "0.59416676", "0.5884777", "0.5862844", "0.583865", "0.5726719", "0.57068014", "0.5704...
0.8389207
0
Return the name of the sensor.
def name(self): return f"{self.client_name} {self._name}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._sensor.name", "def get_sensor_name(self):\n return self.data[1]", "def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'", "def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso...
[ "0.91896784", "0.9168378", "0.890185", "0.8770976", "0.8511273", "0.8479953", "0.844435", "0.8299758", "0.8186503", "0.8105667", "0.8079737", "0.8066149", "0.8049647", "0.7700968", "0.7612295", "0.7611456", "0.7600605", "0.7600605", "0.7600605", "0.75392073", "0.75166553", ...
0.0
-1
Wrapper function to validate the input for method 'categories_not_in_common' Will raise Exception if input incorrect
def _categories_not_in_common_checker(func): @wraps(func) def wrapper_checker(train, test, column_name): _CheckInput._check_database_input(train) _CheckInput._check_database_input(test) _CheckInput._check_column_name(column_name) _CheckInput._check_column...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_category_input_1(self):\n assert validation.check_category_input(1, []) == False", "def test_compare_categories_invalid_input(self):\r\n # Non-numeric categories with BEST and Moran's I.\r\n for method in self.num_methods:\r\n self.assertRaises(TypeError, compare_ca...
[ "0.6975039", "0.6901806", "0.66019106", "0.6383534", "0.61390007", "0.61076266", "0.60909015", "0.6060872", "0.5990143", "0.5952817", "0.5938029", "0.5906766", "0.58820915", "0.5878546", "0.58310956", "0.58215183", "0.58017343", "0.5776068", "0.5771825", "0.5755188", "0.57485...
0.7344708
0
Wrapper function to validate the input for method 'category_ratio' Will raise Exception if input incorrect
def _category_ratio_checker(func): @wraps(func) def wrapper_checker(database, columns_to_check=None, num_categories=5): _CheckInput._check_database_input(database) _CheckInput._check_list_tuple_None(columns_to_check) # todo: replace to a new check - list/tuple/None _...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_ratio_input(self):\n if self._ratio_bounds is None:\n return\n\n self._validate_ratio_bounds()\n self._validate_ratio_type()\n self._validate_ratio_format()\n self._validate_ratio_cols_prefixed()\n self._validate_ratio_cols_exist()", "def test_co...
[ "0.6484171", "0.61750257", "0.60815376", "0.6064631", "0.60398936", "0.60224485", "0.5936798", "0.5685414", "0.56683034", "0.55788964", "0.5547581", "0.5544896", "0.54840016", "0.54477143", "0.5415837", "0.53863585", "0.5368415", "0.5367041", "0.5356311", "0.5350169", "0.5337...
0.76096016
0
Wrapper function to validate the input for method 'category_ratio' Will raise Exception if input incorrect
def _label_encoder_features_checker(func): @wraps(func) def wrapper_checker(database, features_to_encode): _CheckInput._check_database_input(database) for column in features_to_encode: _CheckInput._check_column_in_database(column,database) return func...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _category_ratio_checker(func):\n\n @wraps(func)\n def wrapper_checker(database, columns_to_check=None, num_categories=5):\n _CheckInput._check_database_input(database)\n _CheckInput._check_list_tuple_None(columns_to_check) # todo: replace to a new check - list/tuple/None\n ...
[ "0.7608692", "0.64836884", "0.6175769", "0.60812825", "0.6065041", "0.60407495", "0.60238814", "0.59380335", "0.56842047", "0.5670069", "0.55787414", "0.5548597", "0.5545222", "0.54850626", "0.5447941", "0.541623", "0.5387369", "0.53690034", "0.5368427", "0.5356839", "0.53510...
0.0
-1
Make a square gaussian kernel. size is the length of a side of the square fwhm is fullwidthhalfmaximum, which can be thought of as an effective radius.
def makeGaussian(size, fwhm=3, center=None): x = np.arange(0, size, 1, float) y = x[:, np.newaxis] if center is None: x0 = y0 = size // 2 else: x0 = center[0] y0 = center[1] return np.exp(-4 * np.log(2) * ((x - x0)**2 + (y - y0)**2) / fwhm**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gauss_kernel(size, size_y=None):\n size = int(size)\n if not size_y:\n size_y = size\n else:\n size_y = int(size_y)\n\n x, y = mgrid[-size: size + 1, -size_y: size_y + 1]\n\n g = exp(-(x ** 2 / float(size) + y ** 2 / float(size_y)))\n return g / g.sum()", "def gaussian_kernel(...
[ "0.7613901", "0.74382085", "0.7424475", "0.7345867", "0.734362", "0.72021705", "0.70445424", "0.6979565", "0.6976055", "0.69564", "0.6911589", "0.6890734", "0.68293023", "0.68293023", "0.6825834", "0.6807211", "0.6806987", "0.67264605", "0.6706366", "0.66831493", "0.6665526",...
0.6854601
12
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(sbpl_msg, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.sbpl_wait_flag is None: self.sbpl_wait_flag = False if self.sbpl_present_x is None: self.sbpl_pre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.7794795", "0.77207875", "0.77207875", "0.7687243", "0.7625947", "0.7564293", "0.7440383", "0.74175525", "0.7352349", "0.7308313", "0.72808266", "0.72378874", "0.722805", "0.7225032", "0.7225032", "0.7219433", "0.72120637", "0.72120637", "0.72120637", "0.72120637", "0.72120...
0.7187502
32
Return Colour safe division mode. Returns
def get_sdiv_mode() -> ( Literal[ "Numpy", "Ignore", "Warning", "Raise", "Ignore Zero Conversion", "Warning Zero Conversion", "Ignore Limit Conversion", "Warning Limit Conversion", ] ): return _SDIV_MODE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grey(self):\n return sum((self.value(0), self.value(1), self.value(2)))/3", "def color_mode(self) -> ColorMode:\n if self._dimmable:\n return ColorMode.BRIGHTNESS\n return ColorMode.ONOFF", "def split_necessity(self):\n return max(self._color_var_rel) * self.n_pix\n ...
[ "0.64674604", "0.6385259", "0.62406415", "0.6184885", "0.60466033", "0.5990456", "0.5915911", "0.591502", "0.58658075", "0.57882345", "0.5762147", "0.57587147", "0.5676789", "0.5628449", "0.5628442", "0.5551674", "0.5510396", "0.5503836", "0.5491838", "0.5482173", "0.5452592"...
0.6037897
5
Test json fingerprint raw json string load error.
def test_jfpv1_json_load_error(self): with self.assertRaises(JSONLoad): create('{"foo": bar}', hash_function=hash_functions.SHA256, version=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_verifies_token_file_contains_json(self):\n\n with open(self.sample_token_file, 'w',\n encoding=\"utf8\", errors=\"surrogateescape\") as stf_h:\n stf_h.write(\"Bad JSON\")\n\n with self.assertRaises(json.decoder.JSONDecodeError):\n badgr = BadgrLite(toke...
[ "0.6658138", "0.6637772", "0.6614442", "0.65437615", "0.65316206", "0.6522995", "0.6474675", "0.641983", "0.6346865", "0.62744975", "0.626789", "0.6254307", "0.61577165", "0.61256415", "0.6017466", "0.6009978", "0.59995574", "0.5983155", "0.595433", "0.5929594", "0.5925886", ...
0.7432742
0
Test jfpv1 output format.
def test_jfpv1_sha256_output_format(self): fp = create(input='{"foo": "bar"}', hash_function=hash_functions.SHA256, version=1) self.assertRegex(fp, "^jfpv1\\$sha256\\$[0-9a-f]{64}$")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_jfpv1_sha384_output_format(self):\n fp = create(input='{\"foo\": \"bar\"}', hash_function=hash_functions.SHA384, version=1)\n self.assertRegex(fp, \"^jfpv1\\\\$sha384\\\\$[0-9a-f]{96}$\")", "def test_st_facets00123m_st_facets00123m1_p(mode, save_output, output_format):\n assert_bindings...
[ "0.6236382", "0.6114541", "0.6106052", "0.6088955", "0.60723037", "0.6063573", "0.606181", "0.60577226", "0.60489863", "0.60405564", "0.6037915", "0.60357755", "0.60300136", "0.6026049", "0.60200065", "0.59983075", "0.59976864", "0.59948015", "0.59906477", "0.598516", "0.5980...
0.6055804
8
Test jfpv1 output format.
def test_jfpv1_sha384_output_format(self): fp = create(input='{"foo": "bar"}', hash_function=hash_functions.SHA384, version=1) self.assertRegex(fp, "^jfpv1\\$sha384\\$[0-9a-f]{96}$")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_st_facets00123m_st_facets00123m1_p(mode, save_output, output_format):\n assert_bindings(\n schema=\"sunData/SType/ST_facets/ST_facets00123m/ST_facets00123m.xsd\",\n instance=\"sunData/SType/ST_facets/ST_facets00123m/ST_facets00123m1_p.xml\",\n class_name=\"Test\",\n version=...
[ "0.6114541", "0.6106052", "0.6088955", "0.60723037", "0.6063573", "0.606181", "0.60577226", "0.6055804", "0.60489863", "0.60405564", "0.6037915", "0.60357755", "0.60300136", "0.6026049", "0.60200065", "0.59983075", "0.59976864", "0.59948015", "0.59906477", "0.598516", "0.5980...
0.6236382
0
Test jfpv1 output format.
def test_jfpv1_sha512_output_format(self): fp = create(input='{"foo": "bar"}', hash_function=hash_functions.SHA512, version=1) self.assertRegex(fp, "^jfpv1\\$sha512\\$[0-9a-f]{128}$")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_jfpv1_sha384_output_format(self):\n fp = create(input='{\"foo\": \"bar\"}', hash_function=hash_functions.SHA384, version=1)\n self.assertRegex(fp, \"^jfpv1\\\\$sha384\\\\$[0-9a-f]{96}$\")", "def test_st_facets00123m_st_facets00123m1_p(mode, save_output, output_format):\n assert_bindings...
[ "0.6236382", "0.6114541", "0.6106052", "0.6088955", "0.6063573", "0.606181", "0.60577226", "0.6055804", "0.60489863", "0.60405564", "0.6037915", "0.60357755", "0.60300136", "0.6026049", "0.60200065", "0.59983075", "0.59976864", "0.59948015", "0.59906477", "0.598516", "0.59804...
0.60723037
4
Test jfpv1 json flattener's ability to handle empty dicts as values. Versions up to 0.12.2 did not acknowledge empty dicts as values.
def test_jfpv1_empty_dict_as_value(self): obj_in_1 = {"field1": "yes"} fp_1 = create(input=json.dumps(obj_in_1), hash_function=hash_functions.SHA256, version=1) obj_in_2 = {"field1": "yes", "field2": {}} fp_2 = create(input=json.dumps(obj_in_2), hash_function=hash_functions.SHA256, ver...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_json(self):\n json_data = '{ }'\n json_flattened = json_flatten(json_data)\n self.assertEqual(json.loads(json_flattened), json.loads('{ }'))", "def test_empty_list_of_dict_arg(self):\n self.assertEqual(self.obj.to_json_string([{}, {}]), '[{}, {}]')", "def test_empty_j...
[ "0.78012514", "0.7354463", "0.72752166", "0.7024606", "0.67308944", "0.6650702", "0.6650214", "0.65467834", "0.6431067", "0.6418945", "0.6357848", "0.6357116", "0.6343009", "0.6315286", "0.6314593", "0.63104314", "0.62827516", "0.6278445", "0.62395567", "0.62208843", "0.61854...
0.73827827
1
this copies `self` before adding up with `other`
def __add__(self, other): base = deepcopy(self) base += other # (+=) == __iadd__ return base
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iadd__(self, other):\n self.MergeWith(other)\n return self", "def __add__(self, other):\n return self.add(other)", "def __add__(self, other):\r\n return self.add(other)", "def __radd__(self, other):\n\n return self.__add__(other)", "def __radd__(self, other):\n ...
[ "0.82882273", "0.82321656", "0.81678754", "0.8147496", "0.8132583", "0.8132583", "0.8132583", "0.8132583", "0.8132583", "0.8132583", "0.8132583", "0.8084984", "0.80203694", "0.8018509", "0.79990524", "0.79990524", "0.7995877", "0.7978644", "0.7978644", "0.7937957", "0.7937957...
0.82803303
1
Convert AWS timestamps (ms from epoch) to datetime
def _timestamp_to_datetime(timestamp): return datetime.fromtimestamp(timestamp * 0.001, tz=timezone.utc)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epoch2datetime(t):\n return datetime.fromtimestamp(t/1000.0)", "def epoch2datetime(epoch):\n return datetime.fromtimestamp(epoch)", "def timestamp_to_datetime(value):\n if not isinstance(value, (int, long, float)):\n raise ValueError(\n 'Expecting a number, got %s instead' % type(value).__...
[ "0.75612056", "0.703143", "0.6861324", "0.668634", "0.66797495", "0.65878767", "0.6535388", "0.65221673", "0.6503209", "0.6494997", "0.6482115", "0.64607185", "0.64560115", "0.64385194", "0.6418882", "0.63924253", "0.6350973", "0.63143307", "0.63065636", "0.6279797", "0.62759...
0.71021354
1
Set _points attribute to value.
def setPoints(self, value): assert type(value) in [int, float] self._points = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_value(self, points):\n \n self.value = int(points)", "def set_points(self, val=None):\r\n self._points = self.nx*self.ny*self.nz", "def point(self, value: Point):\n self._point = value", "def addPoints(self, points):\r\n self.points = points", "def set_value(se...
[ "0.8009161", "0.79967445", "0.7807087", "0.7447254", "0.7429774", "0.7394127", "0.7366028", "0.73176867", "0.73176867", "0.71671706", "0.71660876", "0.71338725", "0.7097618", "0.70804256", "0.70313835", "0.7025031", "0.70037293", "0.68958914", "0.6819995", "0.680143", "0.6760...
0.8648026
0
Creates and serves the ball
def serveBall(self): self._ball = Ball(GAME_WIDTH/2, BALL_HEIGHT, BALL_VY, BALL_DIAMETER, colormodel.BLUE) self.draw()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_ball():\n balls.append(gen_ball())\n generate_velocity(balls)", "def __init__(self, *args, **kwargs):\n super(Ball, self).__init__(*args, **kwargs)\n self.speed = kwargs.get('speed', 5)\n self.ball_image = pyglet.image.load(os.path.join(config.ASSETS_DIR, 'ball.png'))\n ...
[ "0.71465194", "0.7063102", "0.70027703", "0.68518084", "0.6796899", "0.662628", "0.6450223", "0.63016075", "0.61807394", "0.6093104", "0.606554", "0.6063373", "0.6033004", "0.59669924", "0.59640986", "0.59581035", "0.59172046", "0.5906391", "0.58794266", "0.5836077", "0.58255...
0.80030394
0
Brings paddle back to center and resets to original speed.
def resetPaddle(self): self._paddle.setX(GAME_WIDTH/2) self._paddle.setSpeed(PADDLE_SPEED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_paddle(self):\r\n self.y = self.screen_Height // 2\r\n self.vy = 0", "def _movePaddle(self):\n self._click()\n self._game.updatePaddle(self._touch)\n self._last = self._touch", "def deactivate(self):\n self.game.paddle.transition(NormalState(self.game.paddle)...
[ "0.79214185", "0.7049125", "0.6875037", "0.6875037", "0.6727733", "0.66613483", "0.6559808", "0.6483407", "0.648136", "0.64601076", "0.6379601", "0.63568366", "0.6341753", "0.63007766", "0.6256475", "0.62540925", "0.6232363", "0.62304366", "0.6182873", "0.61411047", "0.614", ...
0.81488806
0
SPF records that include domains that are missing SPF records raise SPFRecordNotFound
def testIncludeMissingSPF(self): spf_record = '"v=spf1 include:spf.comendosystems.com ' \ 'include:bounce.peytz.dk include:etrack.indicia.dk ' \ 'include:etrack1.com include:mail1.dialogportal.com ' \ 'include:mail2.dialogportal.com a:mailrelay.jpp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testSPFMissingARecord(self):\n\n spf_record = '\"v=spf1 a ~all\"'\n domain = \"cardinalhealth.net\"\n results = checkdmarc.parse_spf_record(spf_record, domain)\n self.assertIn(\"cardinalhealth.net does not have any A/AAAA records\",\n results[\"warnings\"])", ...
[ "0.6989324", "0.6897222", "0.66502166", "0.64058965", "0.6235148", "0.60366166", "0.60045904", "0.5868015", "0.5845685", "0.5740415", "0.57162935", "0.56897223", "0.5620174", "0.5588449", "0.55849284", "0.55417484", "0.5487375", "0.5467115", "0.5449586", "0.53561616", "0.5311...
0.7424471
0
An invalid DMARC policy value raises InvalidDMARCTagValue
def testInvalidDMARCPolicyValue(self): dmarc_record = "v=DMARC1; p=foo; rua=mailto:dmarc@example.com" domain = "example.com" self.assertRaises(checkdmarc.InvalidDMARCTagValue, checkdmarc.parse_dmarc_record, dmarc_record, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testInvalidDMARCURI(self):\n\n dmarc_record = \"v=DMARC1; p=none; rua=reports@dmarc.cyber.dhs.gov,\" \\\n \"mailto:dmarcreports@usdoj.gov\"\n domain = \"dea.gov\"\n self.assertRaises(checkdmarc.InvalidDMARCReportURI,\n checkdmarc.parse_dmarc_r...
[ "0.62103057", "0.5335456", "0.50841165", "0.49841088", "0.49640828", "0.49084556", "0.49041468", "0.48634136", "0.4799499", "0.47962075", "0.4781623", "0.46826026", "0.46424735", "0.46196336", "0.4612024", "0.45880356", "0.45623398", "0.4546039", "0.45252606", "0.45135054", "...
0.79994804
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, OperationDefinitionRequestInfo): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Convert a pyarrow.Table into an xarray.Dataset
def from_table( cls, tbl, index_name="index", index=None, ): if len(set(tbl.column_names)) != len(tbl.column_names): raise ValueError("cannot convert Table with non-unique columns") if index is None: index = pd.RangeIndex(len(tbl), name=index_name) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_arrow(\n tables: Union[\"pyarrow.Table\", bytes, List[Union[\"pyarrow.Table\", bytes]]]\n) -> Dataset[ArrowRow]:\n import pyarrow as pa\n\n if isinstance(tables, (pa.Table, bytes)):\n tables = [tables]\n return from_arrow_refs([ray.put(t) for t in tables])", "def pandas_from_arrow(\n ...
[ "0.6321293", "0.6051844", "0.60429937", "0.60292304", "0.58467513", "0.58369565", "0.58361924", "0.5794922", "0.574749", "0.5718233", "0.5695152", "0.56776434", "0.56776434", "0.56776434", "0.5672433", "0.56546205", "0.5600185", "0.5592207", "0.55549395", "0.5544758", "0.5468...
0.5285078
43
Save configuration to given JSON filepath
def save(self, filepath): with open(filepath, 'w') as f: json.dump(self, f, indent=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_config(self, path):\n if os.path.isdir(path):\n path = os.path.join(path, 'config.json')\n print('Save config to {}'.format(path))\n with open(path, 'w', encoding='utf-8') as w:\n w.write(json.dumps(self.to_dict(), indent=2,\n sort_k...
[ "0.81116784", "0.79332924", "0.79223716", "0.7862402", "0.78026855", "0.76645297", "0.7651675", "0.762959", "0.76245797", "0.7616168", "0.7607954", "0.75987804", "0.7533303", "0.7513", "0.751245", "0.74876344", "0.7476835", "0.74747527", "0.74640363", "0.7458429", "0.7443648"...
0.7233888
32
Test setup.py format correct for all Python 3.x versions supported.
def test_3x_only_python_versions_deploy(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_python_version():\n assert sys.version_info.major == 3", "def test_python3(self):\n if sys.version.startswith(\"3.\"):\n self.assertTrue(_PY3)", "def test_pep8_conformance_setup(self):\n\n print(\"\\r\\n\")\n\n # Get the path to current directory\n path = os.p...
[ "0.7129026", "0.7100184", "0.6948281", "0.6919044", "0.6764296", "0.675224", "0.6640356", "0.6630136", "0.6612119", "0.6589905", "0.647185", "0.6459037", "0.64329034", "0.63645166", "0.6361396", "0.6342404", "0.6285314", "0.6255745", "0.623607", "0.62030536", "0.6202518", "...
0.72866994
0
Returns a matrix with RGB colors
def view(self, position, viewDistance = 3): minX = position[0]-viewDistance maxX = position[0]+viewDistance minY = position[1]-viewDistance maxY = position[1]+viewDistance viewMatrix = [] for x in range(minX, maxX+1): lineArray = [] for y in range(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_matrix(color):\n\t# You do not need to understand this function.\n\tif color == 'red':\n\t\tc = [[.567, .433, 0], [.558, .442, 0], [0, .242, .758]]\n\telif color == 'green':\n\t\tc = [[0.625, 0.375, 0], [0.7, 0.3, 0], [0, 0.142, 0.858]]\n\telif color == 'blue':\n\t\tc = [[.95, 0.05, 0], [0, 0.433, 0.5...
[ "0.70340693", "0.7008332", "0.69791824", "0.67080593", "0.6688322", "0.66746527", "0.66576684", "0.6628284", "0.66220915", "0.6593146", "0.6587587", "0.6581651", "0.6562248", "0.6561934", "0.6533692", "0.6414163", "0.6405936", "0.6399471", "0.6396385", "0.63748014", "0.634381...
0.0
-1
Returns the number of vowels in the string 'string'
def vowelcount(string): string = string.upper() i = string.count('A') i = i + string.count('E') i = i + string.count('I') i = i + string.count('O') i = i + string.count('U') i = i + string.count('Ä') i = i + string.count('Ö') i = i + string.count('Ü') print(string, "contains ", i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vowel_count(string):\n\n return sum(char in \"aeiouAEIOU\" for char in string)", "def count_vowels(string):\n \n vowel = 0\n \n for i in string:\n if i.lower() in 'aeiou':\n vowel = vowel + 1\n \n return vowel", "def vowelcount(string):\n allvowels = [\"a\", \"...
[ "0.8868136", "0.883838", "0.85586524", "0.85422856", "0.8244007", "0.81503254", "0.80416006", "0.7899628", "0.7424607", "0.74028724", "0.7350192", "0.73284143", "0.7305528", "0.7139239", "0.7057287", "0.68695414", "0.6845566", "0.6843752", "0.6807307", "0.67809457", "0.670224...
0.83029747
4
Set the first_name, last_name and email fields to required
def __init__(self, *args, **kwargs): super(UserCreationForm, self).__init__(*args, **kwargs) self.fields["first_name"].required = True self.fields["last_name"].required = True self.fields["email"].required = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.fields['first_name'].required = False\n self.fields['last_name'].required = False\n self.fields['institution'].required = False\n self.fields['institution_logo'].required = False\n self.fields[...
[ "0.72514975", "0.655056", "0.6498276", "0.6483129", "0.6445564", "0.6431832", "0.6418886", "0.6418876", "0.64127266", "0.639909", "0.63299793", "0.62457865", "0.6140262", "0.6132833", "0.6117831", "0.610238", "0.6063311", "0.6025149", "0.60211414", "0.60111535", "0.5986884", ...
0.7264691
0
Initializes a new EnsembleClass object when given a dictionary of variables (vardict) and a dictionary of coordinates (coorddict). See documentation for xarray on how to create an xarray object for how these dictionaries are to be formatted
def from_vardict(cls, vardict, coorddict): newstate = xarray.Dataset(vardict, coords=coorddict) newstate.__class__ = cls return newstate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, variables, dims):\n self._variables = variables\n self._dims = dims", "def __init__(self, x: Bn, X1: G1Element, y: Dict[str, Bn]):\n self.x = x\n self.X1 = X1\n self.y = y", "def __init__(self, xarray_obj: xr.DataArray | xr.Dataset) -> None:\n self._...
[ "0.64639777", "0.61461127", "0.6052188", "0.60158277", "0.59557897", "0.58954006", "0.58585006", "0.58573574", "0.5855599", "0.585009", "0.58026487", "0.57653314", "0.573801", "0.5732811", "0.5732511", "0.5719034", "0.5680695", "0.5642075", "0.5628273", "0.56183", "0.56092286...
0.6750578
0
Returns the full shape of the DataArray
def shape(self): return self.to_array().shape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shape(self):\n return self.data.shape", "def shape(self):\n return self.data.shape", "def shape(self):\n return self.data.shape", "def shape(self):\n return self.data.shape", "def shape(self):\n return self.data.shape", "def data_shape():\n return DATA_SHAPE", ...
[ "0.7712093", "0.7712093", "0.7712093", "0.7712093", "0.7712093", "0.7678415", "0.76547205", "0.7615941", "0.7615941", "0.7615941", "0.7500082", "0.74765044", "0.7417173", "0.7416704", "0.74097145", "0.73209804", "0.73209804", "0.7296727", "0.72800034", "0.7169574", "0.7157911...
0.7279369
19
Use Haversine formula to compute the distance between two latlon coordinate pairs
def haversine(self,loc1,loc2): R = 6371. # Radius of earth in kilometers lat1 = np.radians(loc1[0]) lat2 = np.radians(loc2[0]) dlat = lat2 - lat1 dlon = np.radians(loc2[1] - loc1[1]) a = np.sin(dlat/2)**2 + np.cos(lat1) * np.cos(lat2) * np.sin(dlon/2)**2 c = 2 * ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def haversine(lon1, lat1, lon2, lat2): \r\n lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) \r\n #print 34\r\n dlon = lon2 - lon1 \r\n dlat = lat2 - lat1 \r\n a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2 \r\n c = 2 * atan(sqrt(a)/sqrt(1-a)) \r\n r = 637...
[ "0.85228074", "0.82939136", "0.82713723", "0.82398856", "0.8225672", "0.8212496", "0.8212142", "0.8192028", "0.8187901", "0.81784976", "0.81765246", "0.81661695", "0.8161925", "0.8141043", "0.8139905", "0.81369007", "0.81289077", "0.8128121", "0.8120674", "0.81199825", "0.811...
0.7884983
66
Function to check if number is divisible
def is_divisible(a,b): if b == 0 or b == 1: # check if b is equal to 0 or 1 return False if a <=1 or a < b: # lesser number isn't a power of a greater number return False if a % b == 0: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_divisible(num, n):\n return num % n == 0", "def is_divisible(inpt:int, i:int) -> bool:\n return inpt%i == 0", "def is_divisible(inpt:int, i:int) -> bool:\n return inpt%i == 0", "def divisible(a, b):\n return not a % b", "def divisible(x, y):\n return x % y == 0", "def check_divi...
[ "0.8604494", "0.8200557", "0.8200557", "0.79872763", "0.79124135", "0.7731063", "0.7715594", "0.7659977", "0.7590092", "0.7590092", "0.75784403", "0.74350464", "0.7405256", "0.7273402", "0.72206396", "0.72079426", "0.7186074", "0.7172986", "0.7137369", "0.7058254", "0.7003687...
0.7586231
10
define the params used to query the search service sortAscendingBy
def get_sorted(self, collection, xmlFormat): return { "verb": "Search", "xmlFormat": xmlFormat, 'sortDescending' : '/text//itemRecord/metaMetadata/dateInfo/@lastModified', "ky": collection }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sort_by_query_string_param(self, songs):\n orderable_fields_dict = {\n 'name': Lower('name'),\n 'artist': Lower('artist__name'),\n 'avgRating': 'average_rating',\n 'year': 'year'\n }\n\n order_by = self.request.query_params.get('orderBy', None)\...
[ "0.70533735", "0.7000459", "0.6885683", "0.6753172", "0.66744417", "0.66087264", "0.6556751", "0.6505121", "0.6502259", "0.6487669", "0.6487669", "0.6446792", "0.6439063", "0.6423095", "0.63983107", "0.63084996", "0.6273133", "0.6230987", "0.6218714", "0.618299", "0.61803675"...
0.0
-1
Create a bar plot of the topN countries based on an aggregated column.
def barplot_topn_countries(df: pd.core.frame.DataFrame, feature: str, topn: int, kind: str, year: str, figsize=(12,6)) -> None: if kind != 'Import' and kind != 'Export': raise ValueError('Trade flow is not set to Import or Export') plt.figure(figsize=figsize) g = sns.barplot(x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __top_prod_countries(df, number_of_countries):\n\t\tmlb = MultiLabelBinarizer()\n\t\ttemp = pd.DataFrame(mlb.fit_transform(df['production_countries']), columns=mlb.classes_, index=df.index)\n\t\treturn temp.sum().sort_values(ascending=False)[:number_of_countries].index.values", "def value_count_top(df, cat_f...
[ "0.69539356", "0.6722308", "0.662974", "0.6567406", "0.64846843", "0.6430963", "0.6316255", "0.619134", "0.61763847", "0.61052144", "0.60450244", "0.59211516", "0.5903235", "0.58579403", "0.57695997", "0.5765394", "0.5758173", "0.5733214", "0.5714426", "0.56841993", "0.567242...
0.77026397
0
Return the name of the sensor.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._sensor.name", "def get_sensor_name(self):\n return self.data[1]", "def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'", "def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso...
[ "0.91896784", "0.9168378", "0.890185", "0.8770976", "0.8511273", "0.8479953", "0.844435", "0.8299758", "0.8186503", "0.8105667", "0.8079737", "0.8066149", "0.8049647", "0.7700968", "0.7612295", "0.7611456", "0.7600605", "0.7600605", "0.7600605", "0.75392073", "0.75166553", ...
0.0
-1
Return the message of the sensor.
def state(self): return self._state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMessage():\n return message", "def message(self) -> str:\n return pulumi.get(self, \"message\")", "def message(self) -> str:\n return pulumi.get(self, \"message\")", "def message(self) -> str:\n return pulumi.get(self, \"message\")", "def message(self) -> str:\n return...
[ "0.7501055", "0.73384315", "0.73384315", "0.73384315", "0.73384315", "0.73384315", "0.7319999", "0.73074645", "0.7158426", "0.7158426", "0.7153632", "0.71508914", "0.7126028", "0.709737", "0.709737", "0.70833623", "0.7078052", "0.7078052", "0.7078052", "0.7078052", "0.7078052...
0.0
-1
Reset the baseline and cut attributes so that the next call to the logger can repopulate them to the new values for the particular file.
def reset(self): self.baseline = None self.cut = None self.manual_push = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self._cmd_line = 0\n self._file_line = 0", "def reset(self):\n\t\tself.offsets = self.start_off.copy()", "def setBaseline(self, baseline):\n self.baseline = AmpObject(baseline, 'limb')", "def clear(self):\n self._baseline = 0\n self._sensitivity_im = 0\n ...
[ "0.6222239", "0.6004707", "0.5993614", "0.5964863", "0.5884993", "0.5802058", "0.5744422", "0.5744422", "0.5732188", "0.5729301", "0.57166827", "0.56446445", "0.56423634", "0.5637499", "0.5623825", "0.56095123", "0.5598083", "0.55822676", "0.5570243", "0.55581546", "0.5557087...
0.6884987
0
Apply the given mask to the image.
def apply_mask(image, mask, color, alpha=0.5): for c in range(3): image[:, :, c] = np.where(mask == 1, image[:, :, c] * (1 - alpha) + alpha * color[c], image[:, :, c]) return image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_mask(self, mask_band=None, mask_val=None):\n pass", "def apply_mask_to_image(image, mask, return_as_image=True):\n (n,m,k) = np.shape(image)\n image = np.reshape(image, (n*m, k))\n mask = np.ravel(mask)\n\n if return_as_image:\n image[np.invert(mask), :] = 0\n image = n...
[ "0.75504893", "0.73056287", "0.72248185", "0.72057945", "0.7145598", "0.7126981", "0.71063143", "0.70481926", "0.7020258", "0.69846356", "0.69273317", "0.68956983", "0.6871981", "0.68613625", "0.68212813", "0.67841756", "0.66909254", "0.6669622", "0.6626324", "0.66110665", "0...
0.6557619
24
Return the displacement of the iat th particle relative to the jat th particle. Unlike the distance function, here you will return a vector instead of a scalar
def displacement(iat, jat, pset, box_length): posi = pos_in_box(pset.pos(iat),box_length) posj = pos_in_box(pset.pos(jat),box_length) disp = posi.copy() L = box_length / 2 # calculate displacement of the iat th particle relative to the jat th particle # i.e. r_i - r_j # be careful about m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector(self,\n i: int,\n j: int) -> np.ndarray:\n return self[j].coord - self[i].coord", "def displacement(self):\n return np.array(self.get_current_cartesian_position().position) - self.initial_position", "def displacement(self):\n return self[0].distance(s...
[ "0.6759976", "0.6668777", "0.6467401", "0.6419406", "0.6292945", "0.6265984", "0.6193847", "0.6193847", "0.6183524", "0.61751616", "0.61688465", "0.6099386", "0.60666716", "0.6061271", "0.60359573", "0.60106695", "0.6006747", "0.60028815", "0.59531426", "0.59361434", "0.59295...
0.6827431
0
Computes the average precision at k. This function computes the average prescision at k between two lists of items.
def load_full_hina_dataset(path): root_node = ET.parse(path, parser=ET.XMLParser(encoding="utf-8")).getroot() articles = [] for newsitem_node in root_node: contentMeta_node = newsitem_node.find(TAG_PREFIX_1 + "contentMeta") if contentMeta_node is not None: topics = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\n return np.mean(r)", "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance sco...
[ "0.7475594", "0.74314404", "0.7328193", "0.7280659", "0.7271064", "0.7129832", "0.7087148", "0.6987466", "0.69284856", "0.6889254", "0.68219167", "0.6814678", "0.68059695", "0.6796172", "0.6774947", "0.6767025", "0.6767025", "0.676344", "0.66914594", "0.6675632", "0.66103244"...
0.0
-1
Add values at given indices of an array.
def assignment_by_sum(x, values, indices, axis=0): x_new = copy(x) values = array(values) use_vectorization = hasattr(indices, "__len__") and len(indices) < ndim(x) if _is_boolean(indices): x_new[indices] += values return x_new zip_indices = _is_iterable(indices) and _is_iterable(ind...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, idx, add):\n idx += 1\n while idx < len(self.array):\n self.array[idx] += add\n idx += idx & -idx #Adding the last bit", "def add(a, b):\n return np.array([x + y for x, y in zip(a, b)])", "def add_values(self, *values, rep...
[ "0.6092093", "0.58968484", "0.58858573", "0.58658147", "0.58296084", "0.5812634", "0.5800705", "0.5789713", "0.577272", "0.5748155", "0.56643295", "0.56210905", "0.5591036", "0.55679065", "0.5550506", "0.5511129", "0.5506383", "0.54794466", "0.5469704", "0.5453473", "0.545019...
0.72599316
0
Create an array of given shape, with values at specific indices. The rest of the array will be filled with zeros.
def array_from_sparse(indices, data, target_shape): return _torch.sparse.FloatTensor( _torch.LongTensor(indices).t(), _torch.FloatTensor(cast(data, float32)), _torch.Size(target_shape), ).to_dense()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zeros(shape, dtype=None, order='C'):\n a = ndarray.__new__(matrix, shape, dtype, order=order)\n a.fill(0)\n return a", "def zeros(shape, dtype=None):\n\n return full(shape, 0, dtype)", "def zero_init(self, shape):\n return np.zeros((shape[0],shape[1]))", "def value_zeros(self, shape):\...
[ "0.6966423", "0.68785775", "0.6825971", "0.6779248", "0.6771038", "0.6742257", "0.6522122", "0.6466832", "0.6449266", "0.6414598", "0.6414598", "0.6388914", "0.63610685", "0.6323839", "0.6189766", "0.6131059", "0.6079808", "0.605407", "0.60395366", "0.6019488", "0.6012163", ...
0.54999787
64
Finds last positive autocorrelation, T.
def autocorrelate_negative(autocorrelation): T = 1 for a in autocorrelation: if a < 0: return T - 1 T += 1 return T
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autocorrelation(x):\n x = (x - np.mean(x)) / (np.std(x) * np.sqrt(len(x)))\n result = np.correlate(x, x, mode='full')\n return result[int(result.size / 2):]", "def autocorrelation(x):\n x = (x - np.mean(x)) / (np.std(x) * np.sqrt(len(x)))\n result = np.correlate(x, x, mode='full')\n return ...
[ "0.6334147", "0.6334147", "0.62955016", "0.60301834", "0.5875663", "0.5837673", "0.58260024", "0.576195", "0.5708021", "0.56330526", "0.56235635", "0.55897516", "0.5580523", "0.5486925", "0.5455988", "0.542723", "0.5421766", "0.5414025", "0.5354201", "0.5336347", "0.53220165"...
0.6712155
1
Render the contact html page
def contact(request): contacts = ContactDetails.objects return render(request, 'contact_app/contact.html', {"contacts":contacts})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contact():\n return render_template('contact.html')", "def contact():\n return render_template(\n 'contact.html',\n title='Contact',\n year=datetime.now().year,\n img_tichonet = '/static/pics/tichonet.png',\n message='Your contact page.'\n )", "def contact():\n ...
[ "0.86501646", "0.82645845", "0.8205755", "0.82022136", "0.8201689", "0.8139128", "0.8139128", "0.811375", "0.811375", "0.811375", "0.811375", "0.811375", "0.811375", "0.811375", "0.811375", "0.8096137", "0.8049132", "0.80374", "0.7929535", "0.7899433", "0.7862308", "0.78160...
0.71220547
45