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
The average distance between pickets in mm.
def mean_picket_spacing(self) -> float: sorted_pickets = sorted(self.pickets, key=lambda x: x.dist2cax) return float( np.mean( [ abs(sorted_pickets[idx].dist2cax - sorted_pickets[idx + 1].dist2cax) for idx in range(len(sorted_pickets) -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_speed(self):\n return self.total_distance * 3600 / self.total_time", "def avg(self):\n return sum(self.times) / len(self.times)", "def avg(self):\n return sum(self.times) / len(self.times)", "def avg(self):\n return sum(self.times) / len(self.times)", "def __calculat...
[ "0.720495", "0.7176429", "0.7176429", "0.7176429", "0.7090043", "0.70274293", "0.6939896", "0.6757843", "0.6734553", "0.66875595", "0.66816336", "0.6669746", "0.6589455", "0.6560972", "0.6550995", "0.6513164", "0.65075666", "0.64711857", "0.6451891", "0.64515245", "0.64347", ...
0.7886344
0
Whether the MLC kiss or leaf was within the action tolerance.
def passed_action(self) -> Sequence[bool] | None: return ( [abs(error) < self._action_tolerance for error in self.error] if self._action_tolerance is not None else [True, True] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_within_tolerance(value, tolerance):\n return tf.norm(tensor=value, ord=np.inf) <= tolerance", "def test_c(self):\n self.failIf(cgs.speed_of_light/mks.speed_of_light!=100)", "def check_convergency(self):\n if self.vars['ema_trace'][self.vars['step']] <= self.settings[\"emaSpeedTol\"]:\...
[ "0.599993", "0.59770584", "0.5826378", "0.5764174", "0.5745309", "0.5721654", "0.5715853", "0.5693261", "0.5648559", "0.5624089", "0.56200594", "0.56022257", "0.559757", "0.55726653", "0.55663204", "0.55658275", "0.55565643", "0.55435985", "0.55417293", "0.55231345", "0.55116...
0.57128626
7
The color of the measurement when the PF image is plotted, based on pass/fail status.
def bg_color(self) -> Sequence[str]: colors = [] for idx, passed in enumerate(self.passed): if not passed: colors.append("r") elif self._action_tolerance is not None: colors.append("b" if self.passed_action[idx] else "m") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def success_failure_color(self, evaluation):\n return \"#60f979\" if evaluation.passes else \"#f96c60\"", "def calc_color(temp, dewtemp, humid):\n if temp == hw.MISSING_VAL or dewtemp == hw.MISSING_VAL or humid == hw.MISSING_VAL:\n status = 'grey'\n istatus = 0\n else:\...
[ "0.6999983", "0.66403234", "0.6491453", "0.63503504", "0.63288516", "0.62895894", "0.62804717", "0.624412", "0.6233284", "0.6228217", "0.6169255", "0.61688036", "0.6158413", "0.61556077", "0.61527073", "0.61318594", "0.61192286", "0.61166966", "0.6103516", "0.6070495", "0.605...
0.57587945
91
The maximum absolute error
def max_abs_error(self) -> float: return np.max(np.abs([self.error]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_error(self) -> float:\n return float(np.max(np.abs(self._flattened_errors())))", "def normalizedpeakerror():\r\n peak_simulation = max(hydrograph)\r\n peak_observation = max(obs_data)\r\n peak_error = abs(peak_simulation - peak_observation)/(peak_observation + peak_simulation)\r\n retu...
[ "0.81715286", "0.73436207", "0.7337153", "0.7277897", "0.72558767", "0.70459545", "0.69274753", "0.68522155", "0.6809412", "0.6791413", "0.67229855", "0.66728926", "0.66246414", "0.6618412", "0.6604788", "0.65991706", "0.6594345", "0.65608907", "0.6539218", "0.6533751", "0.65...
0.8654193
0
Initialize and instance of Hero.
def __init__(self, settings, screen): self.screen = screen self.settings = settings # Load the hero and get its rect. self.image = pygame.image.load('images/Aaing2.bmp') self.rect = self.image.get_rect() self.screen_rect = screen.get_rect() # Start each new hero in the center of the screen. self.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_hero(self):\n self.hero = Hero(self.frame_width/2, self.frame_height/2, 0, 0, 15, 1, (0,255,0))", "def __init__(self) -> None:\n self.heroes: List[Hero] = []", "def add_hero(self, Hero):\n self.heroes.append(Hero)", "def create_hero(self, name: str, hp: int, mp: int) -> None:\n ...
[ "0.7560989", "0.70737356", "0.6304138", "0.628163", "0.5886278", "0.5812815", "0.5641673", "0.56165683", "0.5563993", "0.5517137", "0.5509454", "0.5471082", "0.5463943", "0.5445688", "0.5443265", "0.5413882", "0.5408704", "0.5408621", "0.540844", "0.540844", "0.54046845", "...
0.6224794
4
Decay learning rate by a factor of 0.1 every lr_decay_epoch epochs.
def lr_scheduler(optimizer, epoch, init_lr=0.1, lr_decay_epoch=100): if epoch % lr_decay_epoch == 0 and epoch > 1: for param_group in optimizer.param_groups: param_group['lr'] = param_group['lr'] * 0.1 return optimizer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step_decay(epoch):\n # initial_lrate = 1.0 # no longer needed\n #drop = 0.5\n #epochs_drop = number_epoch_drop\n #lrate = init_lr * math.pow(drop,\n #math.floor((1+epoch)/epochs_drop))\n lr = learning_rate\n if epoch >= 60:\n lr *= 1e-1\n print('Learning rate: ', lr)\n return ...
[ "0.8267355", "0.817801", "0.7811282", "0.7761358", "0.77191705", "0.7691683", "0.7691683", "0.7604844", "0.7585767", "0.75532204", "0.75233716", "0.74977565", "0.7488197", "0.74663943", "0.7409523", "0.7392131", "0.7390558", "0.7389717", "0.73854584", "0.7382199", "0.7374641"...
0.0
-1
Provide the Celery queue name as a string.
def get_queue(self, window_info, original_kwargs): if callable(self.queue): return str(self.queue(self, window_info, original_kwargs)) return str(self.queue) or settings.CELERY_DEFAULT_QUEUE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queue_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"queue_name\")", "def queue_name(is_parallel):\n return QUEUE_NAMES[int(bool(is_parallel))]", "def get_queue_name(self):\n return self._graph_executor.get_queue_name()", "def get_short_queue_name(cls):\n i...
[ "0.8129115", "0.7726936", "0.74620956", "0.7188101", "0.7154515", "0.7141062", "0.701317", "0.69697696", "0.6963009", "0.67845607", "0.6517226", "0.64798194", "0.63388366", "0.62759286", "0.61870426", "0.6077965", "0.6077965", "0.6032207", "0.6032207", "0.6010448", "0.5993389...
0.6920307
9
Return a Tensor for a batch of image input
def neural_net_image_input(image_shape): # TODO: Implement Function shape = (None,image_shape[0],image_shape[1],image_shape[2]) x = tf.placeholder(tf.float32,shape,name = 'x') return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_batch():\n return np.zeros((2, 1, 4, 4))", "def process_batch_input_for_RNN(self, batch_input):\n batch_input_ = tf.transpose(batch_input, perm=[2, 0, 1])\n x = tf.transpose(batch_input_)\n return x", "def preds(self, input_batch):\n raw_output = self._create_network(tf.cast(input_...
[ "0.6982396", "0.697684", "0.69677955", "0.69143456", "0.67242986", "0.67011863", "0.6678814", "0.6667556", "0.66644204", "0.66474915", "0.65924495", "0.6586891", "0.65809345", "0.65522945", "0.6539906", "0.64710915", "0.647023", "0.64531785", "0.6436162", "0.64322406", "0.640...
0.6337969
32
Flatten x_tensor to (Batch Size, Flattened Image Size)
def flatten(x_tensor): # TODO: Implement Function shape = x_tensor.get_shape().as_list() reshape = tf.reshape(x_tensor, (-1, shape[1] * shape[2] * shape[3])) return reshape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(x_tensor):\n # TODO: Implement Function\n b, w, h, d = x_tensor.get_shape().as_list()\n img_size = w * h * d\n return tf.reshape(x_tensor, [-1, img_size])", "def flatten(self, x_tensor):\n shape = x_tensor.get_shape().as_list()\n assert len(shape) >= 4, 'shape of image is no...
[ "0.8306523", "0.81393874", "0.7994936", "0.7953008", "0.7898106", "0.7661622", "0.7661622", "0.76227397", "0.76207435", "0.76207435", "0.76103663", "0.7570651", "0.7138425", "0.6951441", "0.6934111", "0.69291353", "0.6927618", "0.6910582", "0.68756753", "0.67927945", "0.66872...
0.76849484
5
Apply a output layer to x_tensor using weight and bias
def output(x_tensor, num_outputs): # TODO: Implement Function y = tf.layers.dense(x_tensor,num_outputs) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_layer_activation(x):\n return x", "def output(x_tensor, num_outputs):\n shape = x_tensor.get_shape().as_list()\n weight = tf.Variable(tf.truncated_normal([shape[-1], num_outputs], stddev=0.1))\n bias = tf.Variable(tf.zeros(num_outputs))\n return tf.add(tf.matmul(x_tensor, weight), bias)...
[ "0.73880553", "0.7379001", "0.73780525", "0.6867772", "0.6791421", "0.67592424", "0.6727423", "0.6698643", "0.6686149", "0.66421616", "0.66083896", "0.66023237", "0.65648735", "0.6524778", "0.6484271", "0.6477665", "0.64373136", "0.64364195", "0.6411001", "0.6399274", "0.6375...
0.67101616
7
Create a convolutional neural network model
def conv_net(x, keep_prob): # TODO: Apply 1, 2, or 3 Convolution and Max Pool layers # Play around with different number of outputs, kernel size and stride # Function Definition from Above: # conv2d_maxpool(x_tensor, conv_num_outputs, conv_ksize, conv_strides, pool_ksize, pool_strides) conv1 =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modelbuilder():\n model = Sequential()\n # Add a convolution layer with with a sigmoid activation function\n model.add(layers.Conv2D(1, (2, 2), strides=(1, 1), activation='sigmoid', padding='same', input_shape=(256, 256, 3)))\n model.compile(optimizer='adam', loss='mse', metrics=['accuracy'])\n ...
[ "0.75773156", "0.7567404", "0.75622874", "0.75140065", "0.74852747", "0.7301987", "0.72218347", "0.72133356", "0.7211507", "0.70942575", "0.70884156", "0.7073757", "0.70734185", "0.7007771", "0.6986", "0.69768095", "0.6970537", "0.69632465", "0.6934773", "0.6929505", "0.69213...
0.0
-1
Return a dictionary that holds all the "edges" that connected from this node, each edge is represented using a pair (key, edge weight).
def get_connections_out(self) -> dict: return self.__ni_out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edges(self):\n return [(k, val) for k, v in self.dict.iteritems() for val in v]", "def __generate_edges(self):\n edges = []\n for vertex in self.__graph_dict:\n for neighbour in self.__graph_dict[vertex]:\n edges.append({vertex, neighbour})\n return edges...
[ "0.7494759", "0.74656856", "0.74132395", "0.74018794", "0.73976076", "0.7396767", "0.7384819", "0.7376244", "0.73582506", "0.73430485", "0.731381", "0.7276895", "0.72707134", "0.7248501", "0.72362185", "0.71549207", "0.715016", "0.7092057", "0.70646775", "0.70553654", "0.7029...
0.0
-1
Return a dictionary that holds all the "edges" that connected to this node, each edge is represented using a pair (key, edge weight).
def get_connections_in(self) -> dict: return self.__ni_in
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edges(self):\n return [(k, val) for k, v in self.dict.iteritems() for val in v]", "def get_graph_dictionary(self):\n nodes = {}\n n = 0\n for node in self.__nodes:\n nodes[n] = tuple(node.get_data())\n n += 1\n\n edges = set()\n for edge in self...
[ "0.7498321", "0.747965", "0.7465022", "0.74236894", "0.74005044", "0.7371986", "0.7367763", "0.73498714", "0.7346512", "0.7343881", "0.7295427", "0.72401905", "0.72192204", "0.72166675", "0.72004956", "0.7165379", "0.71198124", "0.7065798", "0.70637155", "0.70608985", "0.7002...
0.0
-1
Return this node key.
def get_key(self) -> int: return self.__key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key(self) -> str:\n return self.__key", "def key(self) -> str:\n return self._key", "def get_key(self):\n return self.key", "def get_key(self):\n return self.key", "def key(self) -> Key:\n return self._key", "def key(self):\n return key_for_name(self.name)", ...
[ "0.8228227", "0.82279736", "0.81963325", "0.81963325", "0.81818503", "0.8180789", "0.8152228", "0.8117105", "0.810925", "0.810925", "0.810925", "0.810925", "0.80827564", "0.80775774", "0.807395", "0.8067931", "0.8021243", "0.8014959", "0.8014959", "0.8014959", "0.8014959", ...
0.80628055
16
Return this node location as a 3DPoint (x, y, z).
def get_location(self) -> tuple: return self.__location
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def position3d(self) -> Point3:\n return Point3.from_proto(self.proto.pos)", "def point(self):\n return self.x, self.y, self.z", "def readPoint3( node ):\r\n return Point3( float( node.getAttribute( 'x' ) ),\r\n float( node.getAttribute( 'y' ) ),\r\n float( ...
[ "0.7921555", "0.7792765", "0.7428888", "0.736966", "0.71432513", "0.70529634", "0.7000371", "0.7000371", "0.6991376", "0.6920194", "0.6871631", "0.6823903", "0.67951953", "0.6781226", "0.6710987", "0.66407794", "0.66310436", "0.6629564", "0.66293484", "0.6620904", "0.6614884"...
0.0
-1
Constructor for the Donkey object.Assigns the donkey at the given left,bottom position.Ensures that the donkey does motions whithin the specified boundary.
def __init__(self,left,bottom,left_boundary,right_boundary): super(Donkey,self).__init__(0,0,69,71,'p1_duck.png') self.rect.left = left self.rect.bottom = bottom self.left_boundary = left_boundary self.right_boundary = right_boundary self.move_right() # Variable for keeping track so as to when to change t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, pos, direction, right):\n self.position = pos\n self.direction = direction\n self.right = right", "def __init__(self, key, left, right):\n self._key = key\n self._left = left\n self._right = right", "def __init__(self, room_number, door_position, nex...
[ "0.6039424", "0.59601015", "0.58931935", "0.5882831", "0.5872673", "0.57396173", "0.56455666", "0.56289726", "0.55579424", "0.5533562", "0.55232173", "0.5492462", "0.54686123", "0.54392135", "0.54232097", "0.5387212", "0.53773636", "0.5369674", "0.5366423", "0.53505486", "0.5...
0.76331025
0
Create a function which computes the Mahalanobis distance to the centroid of `X`.
def mahalanobis_dist_factory(X): # compute the average vector location avg = class_average(X) # compute the variance-covariance matrix of the input matrix varcovar = np.cov(X, rowvar=False) # compute the inverse of the variance-covariance matrix inv_varcovar = np.linalg.pinv(varcovar) # function to compute Maha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_mahalanobis_distance(point, centroid, sd, dimension):\n x = 0 # initialize\n for i in range(dimension):\n x += ((point[i]-centroid[i]) / sd[i]) ** 2 # calculate sum of squares\n\n return x ** 0.5 # return mahalanobis distance", "def mahalanobis_distance(self, x: np.ndarray) -...
[ "0.80062526", "0.76956147", "0.74504286", "0.6931805", "0.6917119", "0.6716946", "0.65251684", "0.6396617", "0.63804144", "0.6375465", "0.6283751", "0.625268", "0.61924225", "0.6163279", "0.60419476", "0.6009397", "0.572834", "0.5692503", "0.5658761", "0.56504315", "0.5622229...
0.85946
0
Cycling values for CUDA_VISIBLE_DEVICES environment variable Examples >>> cuda_visible_devices(0, range(4)) '0,1,2,3' >>> cuda_visible_devices(3, range(8)) '3,4,5,6,7,0,1,2'
def cuda_visible_devices(i, visible=None): if visible is None: try: visible = list(map(int, os.environ["CUDA_VISIBLE_DEVICES"].split(","))) except KeyError: visible = list(range(get_n_gpus())) L = visible[i:] + visible[:i] return ",".join(map(str, L))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CUDA_VISIBLE_DEVICES(self):\n return self._CUDA_VISIBLE_DEVICES", "def _display_cuda_devices():\n\n cuda_query_output = subprocess.run(\"nvidia-smi --query-gpu=gpu_uuid,gpu_name,compute_mode --format=csv\", shell=True, capture_output=True, text=True)\n # Check if command worked\n ...
[ "0.71483153", "0.67880553", "0.6231721", "0.6147401", "0.6147401", "0.6117387", "0.6032154", "0.59766114", "0.5964383", "0.5944328", "0.59030193", "0.58976525", "0.58821213", "0.58509773", "0.584881", "0.58349365", "0.58263767", "0.58263767", "0.58176845", "0.5815118", "0.580...
0.7361588
0
Attempts to find a known provider that provides this backend.
def get_provider_from_backend(backend): known_providers = { 'BasicAerProvider': 'qiskit.BasicAer', 'AerProvider': 'qiskit.Aer', 'IBMQProvider': 'qiskit.IBMQ', } if isinstance(backend, BaseBackend): provider = bac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_provider(self) -> Optional[Provider]:\n if not self.provider:\n return None\n return Provider.objects.get_subclass(pk=self.provider.pk)", "def provider(self):\n try:\n return self._db.providers[self._dbattr('provider')]\n except KeyError:\n # P...
[ "0.7383723", "0.724896", "0.7118434", "0.70988643", "0.7047297", "0.6991946", "0.69118774", "0.68692195", "0.6869072", "0.682666", "0.6823176", "0.6770754", "0.66557777", "0.665497", "0.6636448", "0.66183615", "0.6565929", "0.6486393", "0.6447731", "0.6438282", "0.64285177", ...
0.8040166
0
Ensure that both objects are in the same coordinate frame.
def validate_and_maintain_frames(func): def decorator(self, *args, **kwargs): if len(args) == 0 and len(kwargs) == 0: obj2 = None elif len(args) == 0: obj2 = next(iter(kwargs.values())) else: obj2 = args[0] if ( not hasattr(obj2, "_fr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_same_as(self, other) -> bool:\n return self.x == other.x and self.y == other.y", "def compare_frames(frame1, frame2):\n for attr in (\"naxes\", \"axes_type\", \"axes_order\", \"unit\", \"axes_names\"):\n assert getattr(frame1, attr) == getattr(frame2, attr)", "def __eq__...
[ "0.6764435", "0.633246", "0.6327639", "0.6315239", "0.6270404", "0.6213408", "0.61932087", "0.6148152", "0.6135621", "0.6124898", "0.612064", "0.612064", "0.61115456", "0.6110232", "0.60880756", "0.60876024", "0.60464627", "0.60064185", "0.59905815", "0.59845847", "0.597935",...
0.5745466
49
Load the pretrained ResNet152 and replace top fc layer.
def __init__(self, embed_size): super(Encoder, self).__init__() resnet = models.resnet152(pretrained=True) modules = list(resnet.children())[:-1] # delete the last fc layer. self.resnet = nn.Sequential(*modules) self.linear = nn.Linear(resnet.fc.in_features, embed_size)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resnet152(pretrained=False, **kwargs):\n model = ResNet(Bottleneck, [3, 8, 36, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet152']))\n fc = transfer_fc(model.fc)\n model.fc = fc\n return model", "def resnet152(pretrained=False):\n model =...
[ "0.7173052", "0.6806408", "0.67975897", "0.67849594", "0.67489475", "0.67489475", "0.67489475", "0.67489475", "0.67324644", "0.6507087", "0.6507087", "0.64752775", "0.63904417", "0.62846625", "0.62234324", "0.61872536", "0.6139846", "0.61031175", "0.6084447", "0.60670197", "0...
0.0
-1
Create the initial hidden and cell states for the decoder's LSTM based on the encoded images.
def init_hidden_states(self, encoder_out): mean_encoder_out = encoder_out.mean(dim=1) h = self.init_h(mean_encoder_out) # (batch_size, decoder_dim) c = self.init_c(mean_encoder_out) return h, c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_lstm_init_state(combiner_outputs: Dict[str, torch.Tensor], sequence_reducer: SequenceReducer, num_layers: int) ->Tuple[torch.Tensor, torch.Tensor]:\n if 'encoder_output_state' not in combiner_outputs:\n decoder_hidden_state = combiner_outputs[HIDDEN]\n decoder_cell_state = torch.clone(deco...
[ "0.69797754", "0.6908568", "0.68752253", "0.67930186", "0.67352873", "0.6725381", "0.67085093", "0.65640026", "0.65566957", "0.6542631", "0.6542631", "0.6542631", "0.6448912", "0.63782275", "0.63424253", "0.6337343", "0.632744", "0.6317356", "0.6301102", "0.6256171", "0.62549...
0.64179176
13
Initialize a new FabricWireless object with the provided RestSession.
def __init__(self, session, object_factory, request_validator): check_type(session, RestSession) super(FabricWireless, self).__init__() self._session = session self._object_factory = object_factory self._request_validator = request_validator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, session, object_factory, request_validator):\n check_type(session, RestSession)\n\n super(NetworkSettings, self).__init__()\n\n self._session = session\n self._object_factory = object_factory\n self._request_validator = request_validator", "def __init__(self,...
[ "0.6339938", "0.62236387", "0.5970704", "0.5928398", "0.5800701", "0.5761", "0.5702965", "0.5572579", "0.55697143", "0.5569302", "0.55562943", "0.5543459", "0.55183643", "0.54799944", "0.5459695", "0.54456615", "0.54389364", "0.54276127", "0.5404118", "0.5396407", "0.5332134"...
0.7724003
0
Filter the dataset and return data for the specified day
def filter_according_to_travel_day(self,day): """First check it the data has any mising values""" dataset = os.path.abspath('./dataset/train_revised.csv') if not self.check_for_missing_values(dataset): #Understand the dataset # self.understand_the_data(self.df) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_data(city, data_filter, Month, Day):\r\n directory = 'C:/Users/The Presence/Documents/Personal Document/Personal Development/Data Science and Analytics/Udacity (Python Course)/Labs Tasks-20200924T221854Z-001/Lab Results/Capstone Project/bikeshare-2/' + city \r\n df = pd.read_csv(directory)\r\n ...
[ "0.6815661", "0.6812926", "0.66410613", "0.6532257", "0.64852613", "0.64530045", "0.644367", "0.64383453", "0.6364097", "0.63367534", "0.62975246", "0.6239565", "0.6219231", "0.6196815", "0.61913604", "0.6114854", "0.6091944", "0.6055895", "0.6051388", "0.60365444", "0.603325...
0.74232054
0
Return image data from a raw PGM file as numpy array.
def read_pgm(filename, byteorder='>'): with open(filename, 'rb') as f: buffer = f.read() try: header, width, height, maxval = re.search( b"(^P5\s(?:\s*#.*[\r\n])*" b"(\d+)\s(?:\s*#.*[\r\n])*" b"(\d+)\s(?:\s*#.*[\r\n])*" b"(\d+)\s(?:\s*#.*[\r\n]\s)*...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_pgm(filename, byteorder='>'):\r\n with open(filename, 'rb') as f:\r\n buffer = f.read()\r\n try:\r\n header, width, height, maxval = re.search(\r\n b\"(^P5\\s(?:\\s*#.*[\\r\\n])*\"\r\n b\"(\\d+)\\s(?:\\s*#.*[\\r\\n])*\"\r\n b\"(\\d+)\\s(?:\\s*#.*[\\r\\n...
[ "0.7749053", "0.7730209", "0.7712785", "0.7545392", "0.7438314", "0.69341975", "0.6734124", "0.6438227", "0.6428955", "0.6366676", "0.6233822", "0.62268645", "0.62166804", "0.62110674", "0.61484826", "0.61406547", "0.6133888", "0.6133888", "0.61317486", "0.6106871", "0.608439...
0.7727764
2
Find date from provided timestamp
def from_all(self): print ('\nGuessing Date from Timestamp: ' + sys.argv[2] + '\r') print ('Outputs which do not result in a date/time value are not displayed.\r') print ('\033[1;31mMost likely results (results within +/- 5 years) are highlighted.\n\033[1;m'.format()) self.from_unix_sec(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_from(timestamp): \n return datetime.fromtimestamp(timestamp)", "def fromtimestamp(cls, timestamp):\n return date()", "def date_from_timestamp(ts):\n datetime = dt.datetime.fromtimestamp(ts, tz=dt.timezone.utc)\n date = datetime.date()\n if datetime.hour < 10:\n date -= dt.tim...
[ "0.7385107", "0.6896689", "0.67935044", "0.6544174", "0.6387441", "0.61780596", "0.6106755", "0.6055911", "0.6044258", "0.6043295", "0.6010523", "0.59412974", "0.5918496", "0.58604383", "0.5839041", "0.58285046", "0.5814404", "0.58119684", "0.5768278", "0.5704741", "0.5700379...
0.0
-1
Convert date to a Unix Millisecond value
def to_unix_milli(self): try: dt_obj = duparser.parse(timestamp) self.out_unix_milli = str(int((dt_obj - self.epoch_1970).total_seconds()*1000)) except Exception as e: if not args.log: pass else: logging.error(str(type(e)) +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unix_time_millisecond(date):\r\n return unix_time(date, float=True) * 1e3", "def datetimeToUnix(date):\n return int(time.mktime(date.timetuple())*1000)", "def datetimeToUnixSec(date):\n return int(time.mktime(date.timetuple()))", "def timestamp_to_unix(timestamp):\n return timestamp / 1e6", ...
[ "0.8280864", "0.7759105", "0.7531209", "0.71843815", "0.7148199", "0.70802647", "0.70420897", "0.7022228", "0.6888493", "0.68401295", "0.68169695", "0.6815644", "0.6813733", "0.6754109", "0.66760653", "0.6658181", "0.66414756", "0.6638612", "0.66038525", "0.657088", "0.656244...
0.701064
8
Convert a Mac Absolute timestamp to a date Also used for Safari plist timestamps
def from_mac(self): try: dt_obj = self.epoch_2001 + timedelta(seconds=int(mac)) self.in_mac = dt_obj.strftime('%Y-%m-%d %H:%M:%S.%f') except Exception as e: if not args.log: pass else: logging.error(str(type(e)) + "," + str(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adapt_timestamp(data):\n return str(time.mktime(data.timetuple()))", "def timestamp(self, t):\n if isinstance(t, datetime):\n t = time.mktime(t.timetuple())\n return t - 631065600", "def forge_timestamp(value) -> int:\n assert isinstance(value, str)\n dt = datetime.strptim...
[ "0.6957061", "0.67166257", "0.6635387", "0.6629763", "0.6615539", "0.6569701", "0.65391505", "0.6509989", "0.65003264", "0.64808965", "0.6455768", "0.6420866", "0.63824975", "0.6335044", "0.63162863", "0.62875044", "0.62746406", "0.6263174", "0.62613475", "0.6261011", "0.6249...
0.0
-1
Convert a Microsoft 128 bit SYSTEMTIME timestamp to a date
def from_systime(self): try: to_le = str(hexlify(unhexlify(systime)[::-1])).strip("b'").strip("'") converted = [to_le[i:i + 4] for i in range(0, len(to_le), 4)][::-1] stamp = [] for i in converted: dec = int(i, 16) stamp.append(dec)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ldap_to_datetime(timestamp: float):\n from datetime import datetime, timedelta\n return datetime(1601, 1, 1) + timedelta(timestamp/10000000)", "def convert_timestamp(data):\n try:\n return datetime.datetime.fromtimestamp(float(data))\n except ValueError:\n return datetime.datetime.f...
[ "0.66577643", "0.6596023", "0.6540892", "0.65250826", "0.6524062", "0.65179926", "0.64881873", "0.6435791", "0.64049625", "0.63893646", "0.6365323", "0.6330325", "0.6260079", "0.62502205", "0.6247519", "0.6205827", "0.61929625", "0.6184619", "0.6165707", "0.6165265", "0.61460...
0.601181
37
Convert a date to a Microsoft 128 bit SYSTEMTIME timestamp
def to_systime(self): try: dt_obj = duparser.parse(timestamp) micro = int(dt_obj.microsecond / 1000) full_date = dt_obj.strftime('%Y, %m, %w, %d, %H, %M, %S, ' + str(micro)) stamp = [] if sys.version_info >= (3, 0): for value in full_da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_to_timestamp(date):\n return int(calendar.timegm(date.utctimetuple()))", "def system_to_ntp_time(date):\n return date + NTP_DELTA", "def timestamp(self, t):\n if isinstance(t, datetime):\n t = time.mktime(t.timetuple())\n return t - 631065600", "def _datetime_to_ti...
[ "0.6894483", "0.6668733", "0.65802664", "0.65694404", "0.6506593", "0.6502286", "0.6486623", "0.648158", "0.6450348", "0.6443139", "0.6324786", "0.632053", "0.63054234", "0.6258919", "0.6201119", "0.6150786", "0.6142224", "0.61408305", "0.613929", "0.6095592", "0.6077106", ...
0.60715127
21
Convert a Microsoft FILETIME/LDAP timestamp to a date
def from_filetime(self): try: dt_obj = dt.utcfromtimestamp((float(ft) - self.epoch_as_filetime) / self.hundreds_nano) self.in_filetime = dt_obj.strftime('%Y-%m-%d %H:%M:%S.%f') except Exception as e: if not args.log: pass else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ldap_to_datetime(timestamp: float):\n from datetime import datetime, timedelta\n return datetime(1601, 1, 1) + timedelta(timestamp/10000000)", "def ole_timestamp(binblob):\n try:\n td,ts = str(struct.unpack(\"<d\",binblob)[0]).split(\".\")\n dt = datetime.datetime(1899,12,30,0,0,0) + d...
[ "0.7521619", "0.6723393", "0.66237974", "0.6582824", "0.6581104", "0.65597296", "0.6548048", "0.6525962", "0.65127486", "0.64833313", "0.64430183", "0.6411698", "0.6411056", "0.63988113", "0.6351106", "0.6339823", "0.63081187", "0.6267478", "0.62551963", "0.6239316", "0.62338...
0.0
-1
Convert an iOS 11 timestamp to a date
def from_ios_time(self): try: dt_obj = (int(ios) / int(self.nano_2001)) + 978307200 self.in_iostime = dt.utcfromtimestamp(dt_obj).strftime('%Y-%m-%d %H:%M:%S.%f') except Exception as e: if not args.log: pass else: logging.er...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromtimestamp(cls, timestamp):\n return date()", "def _convert_timestamp(timestamp):\n extract_time = re.match('(.*?\\+\\d{2}):(.*)', timestamp)\n formated = datetime.strptime('{}{}'.format(extract_time.group(1), extract_time.group(2)),\n '%Y-%m-%dT%H:...
[ "0.716403", "0.68267757", "0.68258494", "0.6821402", "0.68055016", "0.677414", "0.67386466", "0.6690118", "0.66589516", "0.6658844", "0.66268545", "0.6602538", "0.65678626", "0.6557426", "0.6552822", "0.64536494", "0.64246416", "0.6412377", "0.63869846", "0.63568366", "0.6352...
0.0
-1
Pad setences during training or prediction
def pad_sentences(sentences, padding_word="<PAD/>", forced_sequence_length=None): if forced_sequence_length is None: # Train sequence_length = max(len(x) for x in sentences) else: # Prediction logging.critical('This is prediction, reading the trained sequence length') sequence_length =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_dataset(dataset, padding=0):\n max_l = max(len(x) for x in dataset[\"input_ids\"])\n for name in PADDED_INPUTS:\n dataset[name] = [x + [padding if name != \"lm_labels\" else -100] * (max_l - len(x)) for x in dataset[name]]\n return dataset", "def paddingSequence(X_train, X_test, maxLen=30...
[ "0.6810606", "0.6755292", "0.6332891", "0.62951875", "0.6234442", "0.6204185", "0.615709", "0.6151445", "0.6062087", "0.6028578", "0.6023542", "0.6007432", "0.5987225", "0.598166", "0.59643656", "0.5959602", "0.5931776", "0.5906455", "0.5895524", "0.5885358", "0.5873079", "...
0.5514172
45
Assert empty dict is returned, from Get request.
def test_get_login_view_is_empty_dict(dummy_request): from learning_journal.views.default import login_view assert login_view(dummy_request) == {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_dict(self):\n read_on_template = field_template_read({})\n self.assertFalse(read_on_template)\n self.assertEqual(read_on_template, {})", "def test_trucks_api_empty_food(self):\n resp = self.app.get('/trucks?food=asfdasdf')\n self.assertEqual(resp.status_code, 200...
[ "0.6586842", "0.65291643", "0.6474818", "0.6464325", "0.64516366", "0.6350558", "0.632255", "0.6316733", "0.62955374", "0.62821835", "0.6276742", "0.62717545", "0.62418705", "0.62272745", "0.6219723", "0.62144274", "0.6212847", "0.62110513", "0.6199541", "0.6194575", "0.61612...
0.6411408
5
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, CorePrimitive): 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.8457179", "0.8393067", "0.81457263", "0.8140635", "0.8133462", "0.8094992", "0.8093376", "0.8093376", "0.8093376", "0.80863357", "0.80863357", "0.8077303", "0.8077303", "0.8066831" ]
0.0
-1
Returns an initial state of the RNN all zeros
def make_initial_state(self): return { 'h_rec':Variable(np.zeros((1, self.n_hidden), dtype=np.float32)), 'c_rec':Variable(np.zeros((1, self.n_hidden), dtype=np.float32)), 'h_gen':Variable(np.zeros((1, self.n_hidden), dtype=np.float32)), 'c_gen':Variable(np.zeros((...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_hidden_state(self):\n initializer = tf.keras.initializers.Zeros()\n rnnten = initializer(shape=(self.batch, self.units))\n return rnnten", "def initial_state(self, parameters = None):\n if parameters is not None:\n raise NotImplementedError('Dynamically specifying RNN ...
[ "0.7525748", "0.74903667", "0.71165377", "0.70784265", "0.7029868", "0.69894075", "0.69888306", "0.6987151", "0.68254983", "0.6807929", "0.6807929", "0.6722552", "0.6702969", "0.66924655", "0.6683905", "0.66791815", "0.6678694", "0.66681474", "0.66342866", "0.66288906", "0.65...
0.0
-1
Return the name of the BloomSky device and this sensor.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._sensor.name", "def name(self) -> str:\n return f\"{self.platform_name} {self._sensor_name}\"", "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.se...
[ "0.738719", "0.7373163", "0.7337761", "0.7295362", "0.72284335", "0.7199388", "0.709583", "0.70807475", "0.70807475", "0.70807475", "0.70103264", "0.69815964", "0.69559777", "0.6939741", "0.69265395", "0.69127023", "0.68736386", "0.6871922", "0.68709695", "0.68358546", "0.678...
0.0
-1
Return the sensor units.
def unit_of_measurement(self): return SENSOR_UNITS.get(self._sensor_name, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def units(self):\n return self._units", "def units(self):\n return self._units", "def unit_of_measurement(self):\n return self.sensor_type[\"unit\"]", "def unit_of_measurement(self):\n return self._units", "def _get_units(self):\n #assert self.ser.isOpen()\n\n self...
[ "0.8183791", "0.8183791", "0.8125538", "0.81162256", "0.80243766", "0.7990112", "0.79814714", "0.7968463", "0.7949393", "0.79344296", "0.79256827", "0.79248387", "0.79200816", "0.79200816", "0.7916174", "0.7916174", "0.7904311", "0.7894594", "0.78914607", "0.78555286", "0.785...
0.82949847
1
Get top left coordinate information of patches from original image.
def _get_patch_top_left_info(img_shape, input_size, output_size): in_out_diff = input_size - output_size nr_step = np.floor((img_shape - in_out_diff) / output_size) + 1 last_output_coord = (in_out_diff // 2) + (nr_step) * output_size # generating subpatches index from orginal output_tl_y_list = np.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_top_left_coordinates(height, width, patch_size):\n\n n_h = math.ceil(height / patch_size)\n n_w = math.ceil(width / patch_size)\n tops = np.linspace(0, height - patch_size, n_h, dtype=int)\n lefts = np.linspace(0, width - patch_size, n_w, dtype=int)\n\n return product(tops, lefts)", "def ...
[ "0.74993706", "0.6426762", "0.6220696", "0.6110853", "0.6075238", "0.6055196", "0.6011379", "0.6000418", "0.5960915", "0.5904197", "0.5904197", "0.5892315", "0.58771145", "0.58740354", "0.58325875", "0.58195746", "0.58085096", "0.5779697", "0.5767549", "0.5767549", "0.5726579...
0.7982845
0
Evaluate Gaussian model at a given ``y`` position.
def _evaluate_y(self, y, pars): return Gaussian1D.evaluate(y, **pars)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def y_model(self, x):\n x = np.asanyarray(x, dtype=float)\n parvals = self.parvals(x)\n return Gaussian1D(**parvals)", "def eval_inv(self, y):\n\n x_hat = (y - self.beta.get_value(borrow=True)) * np.exp(-self.log_gamma.get_value(borrow=True))\n x = np.sqrt(self.bv.get_value(bor...
[ "0.6420815", "0.6100982", "0.5866464", "0.5855536", "0.58145005", "0.57746893", "0.5736197", "0.5703807", "0.5690165", "0.56057906", "0.56052727", "0.5579858", "0.55702215", "0.55416375", "0.5526467", "0.5514051", "0.55105793", "0.54939246", "0.54939246", "0.54889137", "0.548...
0.7420885
0
Create model at a given ``x`` position.
def y_model(self, x): x = np.asanyarray(x, dtype=float) parvals = self.parvals(x) return Gaussian1D(**parvals)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, x, **kwargs):\n return self.model(x)", "def construct(self, y, x):\n\n raise NotImplementedError()", "def move_stage_to_x(self, x):\n raise NotImplementedError", "def model(self, x):\n pyro.module('decoder', self.decoder)\n # Note: plate automatically set...
[ "0.58288854", "0.58076024", "0.5785077", "0.57364976", "0.5700326", "0.5656319", "0.557494", "0.5518077", "0.55146194", "0.54919815", "0.54678744", "0.5414503", "0.54130846", "0.5408341", "0.53989804", "0.53989804", "0.5392206", "0.5383618", "0.5381531", "0.5381298", "0.53768...
0.0
-1
Create `EnergyOffsetBackgroundModel` from `~astropy.table.Table`.
def from_table(cls, table): offset_edges = _make_bin_edges_array(table['THETA_LO'].squeeze(), table['THETA_HI'].squeeze()) offset_edges = Angle(offset_edges, table['THETA_LO'].unit) energy_edges = _make_bin_edges_array(table['ENERG_LO'].squeeze(), table['ENERG_HI'].squeeze()) energy_edge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_table(cls, table):\n theta_lo = table[\"THETA_LO\"].quantity[0]\n theta_hi = table[\"THETA_HI\"].quantity[0]\n offset = (theta_hi + theta_lo) / 2\n offset = Angle(offset, unit=table[\"THETA_LO\"].unit)\n\n energy_lo = table[\"ENERG_LO\"].quantity[0]\n energy_hi = ...
[ "0.612502", "0.5769339", "0.56298745", "0.5528021", "0.5247027", "0.5232389", "0.5166305", "0.51234365", "0.50915533", "0.5052797", "0.50513947", "0.49745876", "0.49739397", "0.49359122", "0.48861483", "0.48749655", "0.48749655", "0.4866256", "0.48651654", "0.4850702", "0.484...
0.70645463
0
Check if the graph has any cycles.
def hasCycle(self, vertex, visited, parent): visited[vertex] = True for i in self.graph[vertex]: if not visited[i]: if self.hasCycle(i, visited, vertex): return True elif parent != i: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_cycles(self, graph):\n if list(nx.simple_cycles(graph)):\n raise AbstractGraphError('Cycles in graph')", "def has_cycles(graph):\n path = set()\n\n def visit(node):\n path.add(node)\n for neighbour in graph.edges[node]:\n if neighbour in path or visit(n...
[ "0.8277688", "0.8112336", "0.7991218", "0.744913", "0.7403725", "0.73323137", "0.7322986", "0.73166233", "0.7172144", "0.71607846", "0.714058", "0.7051733", "0.6994611", "0.69436145", "0.6902383", "0.6853606", "0.6845814", "0.6751294", "0.674111", "0.67003477", "0.66949975", ...
0.663254
22
Compute the euclidean distance of coords[my_index] and all other members. Returns the index of the element with the shortest distance to my_index.
def nearestNeighbor(self, coords, my_index, blacklist): min_index, min_distance = 0, 999999999 my_col, my_row = coords[my_index] for i, (col, row) in enumerate(coords): if i in blacklist: continue distance = math.sqrt((my_col-col)**2 + (my_row-row)**2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_euclidean_coordinates_from_index(self, index):\n if index < 0:\n return (-1, -1)\n y = self._weights.shape[1]\n coords = self.convert_map_to_euclidean((index % y, int(index/y)))\n return coords", "def minimum_image_distance(self, index, coordinates):\n if in...
[ "0.70474946", "0.5616283", "0.55508554", "0.5509439", "0.5440937", "0.5437399", "0.5424878", "0.540946", "0.5405059", "0.53996086", "0.5396037", "0.5364426", "0.53588015", "0.53488976", "0.53012383", "0.5258454", "0.5258454", "0.5248285", "0.5244714", "0.52325785", "0.5229146...
0.663401
1
The transparent option makes all zeros transparent, and all ones red (expects image with only 1s and 0s)
def plot_pet_volume(pet_image, pixel_shape, pixel_spacing, mask=None, patient="?", mask_name="?"): # create axis for plotting pixel_shape = pet_image.shape x = np.arange(0.0, (pixel_shape[1] + 1) * pixel_spacing[0], pixel_spacing[0]) y = np.arange(0.0, (pixel_shape[0] + 1) * pixel_spacing[1], pixel_spac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_transparent(img):\n assert img.shape[-1] == 4\n white_pix = np.all(img == [255, 255, 255, 255], axis=-1)\n # print(white_pix)\n img[white_pix, -1] = 0\n # return img", "def transparency(img):\n \n black_mask_undistorted_file = open(os.path.join(settings.BASE_DIR, 'static', 'mask_undi...
[ "0.7990784", "0.6845133", "0.6769595", "0.6594898", "0.6480677", "0.64602685", "0.63998324", "0.6337914", "0.6187336", "0.6172233", "0.6038508", "0.60338336", "0.60233325", "0.6011373", "0.60059357", "0.59093106", "0.58834046", "0.587682", "0.5853227", "0.58483946", "0.584428...
0.0
-1
The transparent option makes all zeros transparent, and all ones red (expects image with only 1s and 0s)
def plot_pet_image(pet_image, yz_slice_pos, xz_slice_pos, xy_slice_pos, pixel_shape, pixel_spacing, mask=None): # create axis for plotting x = np.arange(0.0, (pixel_shape[0] + 1) * pixel_spacing[0], pixel_spacing[0]) y = np.arange(0.0, (pixel_shape[1] + 1) * pixel_spacing[1], pixel_spacin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_transparent(img):\n assert img.shape[-1] == 4\n white_pix = np.all(img == [255, 255, 255, 255], axis=-1)\n # print(white_pix)\n img[white_pix, -1] = 0\n # return img", "def transparency(img):\n \n black_mask_undistorted_file = open(os.path.join(settings.BASE_DIR, 'static', 'mask_undi...
[ "0.7991519", "0.6845003", "0.6769248", "0.65958136", "0.64802855", "0.6460187", "0.6399936", "0.63370085", "0.6186221", "0.6171474", "0.6037121", "0.603348", "0.6021914", "0.60108435", "0.60055166", "0.59093386", "0.58830273", "0.587606", "0.58547205", "0.58485574", "0.584535...
0.0
-1
previous_encoded_c of shape (batch_size, max_words, 1024) sim_weights os shape (batch_size, max_words)
def forward(self, previous_encoded_m, sim_weights, soft = False): if not soft: sim_weights_c = sim_weights.detach() value, max_indices = torch.max(sim_weights_c,1) # (batch_size) value = value.unsqueeze(1) # (batch_size,1) mask = torch.zeros_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_propagate(word, previous_state):\n # Embedding layer\n word_vector = self.weights_ie[:, word]\n\n # GRU layer\n update_gate = T.nnet.hard_sigmoid(\n self.weights_eh[0].dot(word_vector) +\n self.weights_hh[0].dot(previous_state) +...
[ "0.5821994", "0.5635608", "0.5623582", "0.5613903", "0.555712", "0.5554827", "0.5521184", "0.5468302", "0.54641026", "0.54074866", "0.53863704", "0.5376703", "0.5374853", "0.53443676", "0.53334093", "0.5321952", "0.53100747", "0.5305468", "0.5249059", "0.52398026", "0.5211004...
0.7011647
0
Sets user.is_active to True
def test_activate_active_user(self): activate_user(self.user, self.request) self.assertEqual(self.user.is_active, True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activate_user(self, user):\n if not user.active:\n user.active = True\n return True\n return False", "def toggle_active(self, user):\n user.active = not user.active\n return True", "def toggle_active(self, user):\n user.active = not user.active\n ...
[ "0.8371676", "0.82205725", "0.8142238", "0.80616146", "0.7826943", "0.7773412", "0.75890183", "0.7485442", "0.7311586", "0.72669524", "0.7244611", "0.72345626", "0.7108176", "0.7108176", "0.7108176", "0.7108176", "0.70847315", "0.6994057", "0.6974592", "0.69696516", "0.692485...
0.744445
8
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(Drone, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.name is None: self.name = '' if self.type_name is None: self.type_name = '' if self.home is No...
{ "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.7794532", "0.771984", "0.771984", "0.7685841", "0.76261926", "0.7563172", "0.7439402", "0.7416625", "0.73522186", "0.73088753", "0.7280711", "0.7237753", "0.722683", "0.7223247", "0.7223247", "0.7219359", "0.7211174", "0.7211174", "0.7211174", "0.7211174", "0.7211174", "...
0.0
-1
Tests that when both the lower and upper bound of the routing function have the same sign, then the output is either 0 (when positive) and 1 (when negative).
def test_calculate_class_2_individuals_best_response_markov_upper_and_lower_bounds(): assert ( calculate_class_2_individuals_best_response( lambda_2=2, lambda_1_1=1, lambda_1_2=1, mu_1=2, mu_2=2, num_of_servers_1=3, num_of_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign(a) :\n return (a>0) - (a<0)", "def sign(x):\n if x >= 0:\n return 1\n else:\n return -1", "def sign(x):\n if x >= 0:\n return 1\n return -1", "def sign(a):\n return (a > 0) - (a < 0)", "def samesign ( a , b ) :\n return ( 0 < a and 0 < b ) or ( 0 >...
[ "0.6642891", "0.6541612", "0.65165484", "0.6497186", "0.63950735", "0.6290676", "0.62638414", "0.619625", "0.6172515", "0.6075034", "0.5956528", "0.59431463", "0.5921977", "0.5863811", "0.5853832", "0.5845314", "0.58412176", "0.58142364", "0.57892156", "0.5778994", "0.5747570...
0.0
-1
Verifies that the user isn't trying to test Windows containers under Windows 10 when in Linux container mode (or vice versa)
def _checkPlatformMistmatch(self, logger, containerPlatform): prefix = self.getPrefix() dockerInfo = DockerUtils.info() dockerPlatform = dockerInfo["OSType"].lower() if containerPlatform == "windows" and dockerPlatform == "linux": logger.error( "[{}] Error: at...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_skip_if_windows(self):\n pass", "def test_skip_unless_windows(self):\n pass", "def test_guest_os(self):\n self.check_guest_os()", "def test_guest_os(self):\n self.check_guest_os()", "def test_guest_os(self):\n self.check_guest_os()", "def test_guest_os(self):\n...
[ "0.7166059", "0.7139077", "0.68346125", "0.68346125", "0.68346125", "0.68346125", "0.68346125", "0.68346125", "0.68346125", "0.68346125", "0.68346125", "0.68346125", "0.68346125", "0.68346125", "0.68346125", "0.68346125", "0.68346125", "0.68346125", "0.66991925", "0.6648137", ...
0.65342283
21
Get or update the item record of a project by project_id and item name.
def handle_project_item_records(project, item): db_api = flask.request.db_api record = {} if flask.request.method == 'GET': try: records = db_api.get_project_item_record_by_name(project_id=project, item_name=item) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_project_item_record_by_name(project_id, item_name,\n deleted=False, session=None):\n session = session or get_session()\n if not item_get_by_name(item_name, session=session):\n item_create(item_name, session=session)\n\n item = item_get_by_name(item_name, ...
[ "0.75429827", "0.7015521", "0.6821756", "0.68016136", "0.63736606", "0.62258315", "0.61081773", "0.60852194", "0.60791063", "0.6067687", "0.5962019", "0.59535795", "0.5949411", "0.5902678", "0.58968616", "0.5840588", "0.5837466", "0.58345145", "0.5825177", "0.5762052", "0.573...
0.71817136
1
Encode entity labels into integers. Convert characters in a text to integers according to the entity labels provided and label_to_int dictionary where the dictionary gives a mapping between an entity label and an integer.
def label_encoder( text_length: int, entities: List[Entity], label_to_int: Dict[str, int], ) -> List[int]: # note 0 means negative labels code = [0] * text_length for span in entities: label_name = span.entity_type try: label_code = label_to_int[label_name] except Ke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int_to_text(self, labels):\n string = []\n for i in labels:\n string.append(self.index_map[i])\n return ''.join(string).replace('', ' ')", "def convert_labels_to_int(labels): \n if not len(labels):\n raise ValueError(\"Nothing to convert!\")\n\n if isinstance(labe...
[ "0.63895965", "0.6194113", "0.60456085", "0.59288", "0.58300567", "0.568179", "0.565656", "0.5641569", "0.55291486", "0.54936796", "0.5492864", "0.54545414", "0.5388275", "0.5353546", "0.5348476", "0.53424805", "0.53339297", "0.53163546", "0.5281264", "0.5274489", "0.52669984...
0.75274545
0
Compute precision for every entity in prediction.
def compute_entity_precisions_for_prediction( text_length: int, true_entities: List[Entity], pred_entities: List[Entity], label_mapping: Dict, ) -> List[EntityPrecision]: true_code: List[int] = label_encoder(text_length, true_entities, label_mapping) precisions = [] for pred_entity in pred_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(y_true, y_pred):\n true_positives = bk.sum(bk.round(bk.clip(y_true * y_pred, 0, 1)))\n predicted_positives = bk.sum(bk.round(bk.clip(y_pred, 0, 1)))\n precision = true_positives / (predicted_positives + bk.epsilon())\n return precision", "def get_precisio...
[ "0.7430163", "0.7419302", "0.7371651", "0.73427016", "0.7301947", "0.7288655", "0.72535414", "0.72535414", "0.72535414", "0.72535414", "0.72535414", "0.72535414", "0.72234374", "0.72234374", "0.72234374", "0.72234374", "0.72234374", "0.72234374", "0.72234374", "0.72234374", "...
0.7439835
0
Compute recall for every entity in ground truth.
def compute_entity_recalls_for_ground_truth( text_length: int, true_entities: List[Entity], pred_entities: List[Entity], label_mapping: Dict, ) -> List[EntityRecall]: pred_code: List[int] = label_encoder(text_length, pred_entities, label_mapping) recalls = [] for true_entity in true_entitie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recall(y_true, y_pred):\n true_positives = backend.sum(backend.round(backend.clip(y_true * y_pred, 0, 1)))\n possible_positives = backend.sum(backend.round(backend.clip(y_true, 0, 1)))\n recall = true_positives / (possible_positives + backend.epsilon())\n return recall", "def reca...
[ "0.71589637", "0.70962185", "0.6991758", "0.6938774", "0.6894228", "0.68659854", "0.68659854", "0.68659854", "0.68659854", "0.68659854", "0.68659854", "0.6864705", "0.684957", "0.684957", "0.684957", "0.684957", "0.684957", "0.684957", "0.684957", "0.684957", "0.684957", "0...
0.6304296
55
Converts any Windows cp1252 or unicode characters in a string to ASCII equivalents
def zap_string(self, the_string): the_string = self.kill_gremlins(the_string) if isinstance(the_string, str): the_string = unidecode(the_string) return the_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_ascii(string):\n\tfor key in UNICODE_TO_ASCII:\n\t\tstring = string.replace(key, UNICODE_TO_ASCII[key])\n\n\treturn string", "def string_to_ascii(string):\n if string is None:\n return\n\n if isinstance(string, str):\n string = string.decode('utf-8')\n\n return normalize('NFKD', str...
[ "0.7610534", "0.7411552", "0.7275117", "0.72164524", "0.7192002", "0.71763045", "0.70898664", "0.7036634", "0.7009581", "0.6873844", "0.683578", "0.6817368", "0.6786621", "0.6762332", "0.6722891", "0.66941625", "0.66534585", "0.6568905", "0.6460054", "0.6330581", "0.6319588",...
0.0
-1
Creates a plane from 3 points, expects the points as a np arrays For intersertion detection, it assumes plane is normal to one of x, y or z axis
def __init__(self, a, b, c): self.normal = np.cross(a - b, c - b) self.offset = np.sum(b * self.normal) self.xbounds = sorted(list(set([a[0], b[0], c[0]]))) self.ybounds = sorted(list(set([a[1], b[1], c[1]]))) self.zbounds = sorted(list(set([a[2], b[2], c[2]])))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_3d_points_to_plane(points, p1, p2 ,p3, numpoints):\n p1 = np.asarray(p1)\n p2 = np.asarray(p2)\n p3 = np.asarray(p3)\n\n # get vectors in plane\n v1 = p3 - p1\n v2 = p2 - p1\n\n # compute cross product\n cp = np.cross(v1, v2)\n a, b, c = cp # normal to plane is ax + by + cz\n...
[ "0.77498144", "0.7309693", "0.7158128", "0.70206904", "0.70206904", "0.6922515", "0.6871519", "0.6864326", "0.6797485", "0.6759645", "0.675029", "0.6708802", "0.6656291", "0.6656291", "0.66499865", "0.66351587", "0.65763927", "0.65413296", "0.6529056", "0.6476305", "0.6454881...
0.0
-1
Pad setences during training or prediction
def pad_sentences(sentences, padding_word="<PAD/>", forced_sequence_length=None): if forced_sequence_length is None: # Train sequence_length = max(len(x) for x in sentences) else: # Prediction logging.critical('This is prediction, reading the trained sequence length') sequence_length = forced_sequence_length l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_dataset(dataset, padding=0):\n max_l = max(len(x) for x in dataset[\"input_ids\"])\n for name in PADDED_INPUTS:\n dataset[name] = [x + [padding if name != \"lm_labels\" else -100] * (max_l - len(x)) for x in dataset[name]]\n return dataset", "def paddingSequence(X_train, X_test, maxLen=30...
[ "0.6811813", "0.6756918", "0.6333849", "0.6296382", "0.62359804", "0.62053674", "0.61575395", "0.61532676", "0.60639745", "0.6027797", "0.60237944", "0.6009327", "0.5988328", "0.5981693", "0.59657866", "0.59606075", "0.59334004", "0.5905888", "0.58960974", "0.58863276", "0.58...
0.55173486
43
Test fail launch with a wrong argument for JSON topology file.
def test_fail_launch_json(self): args = self.args.copy() # Pass a string instead of a list args["lipid_jsons"] = str(PATH_ROOT_DATA / "Berger_POPC.json") with pytest.raises(TypeError) as err: UI.launch(**args) assert "a list is expected for argument 'lipid_jsons'" in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fail_main_coord_topology_mismatch(self):\n args = self.args.copy()\n\n lipids_tops = lipids.read_lipids_topH([lipids.PATH_JSON/\"CHARMM36_POPC.json\"])\n dic_lipid = lipids_tops[\"CHARMM36_POPC\"]\n args[\"dic_lipid\"] = dic_lipid\n\n with pytest.raises(BuildHError) as e...
[ "0.70512414", "0.67797405", "0.66755354", "0.64805764", "0.639918", "0.6380258", "0.6358397", "0.6348924", "0.633285", "0.6318311", "0.63104254", "0.6287557", "0.627666", "0.62352645", "0.61781204", "0.6178037", "0.6101389", "0.60435796", "0.60431653", "0.6006253", "0.5995346...
0.72606194
0
Select a checkpoint to load to resume training.
def SelectTrainingCheckpoint( log_dir: Path, ) -> Tuple[epoch_pb2.Epoch, checkpoint_pb2.Checkpoint]: epoch_num = -1 for path in (log_dir / "epochs").iterdir(): if path.name.endswith(".EpochList.pbtxt"): epoch = pbutil.FromFile(path, epoch_pb2.EpochList()) if not epoch.epoch[0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resume(self, checkpoint):\n model_dict = paddle.load(checkpoint)\n self.model.set_state_dict(model_dict)", "def _resume_checkpoint(self, resume_path):\n resume_path = str(resume_path)\n self.logger.info(\"Loading checkpoint: {} ...\".format(resume_path))\n checkpoint = torc...
[ "0.75206304", "0.73607624", "0.7334925", "0.7325896", "0.726916", "0.7222227", "0.7120622", "0.7034583", "0.70133954", "0.6964548", "0.67128015", "0.66309077", "0.6566428", "0.6492816", "0.64233214", "0.6418433", "0.63720304", "0.6333217", "0.62915045", "0.6195033", "0.618666...
0.5909408
33
The name of the command policy.
def set_policyname(self, policyname): self.options["policyname"] = policyname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy_name(self):\n return self._policy_name", "def policy_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"policy_name\")", "def policy_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"policy_name\")", "def policy_name(self) -> pulumi.Input[str]:\n re...
[ "0.8321798", "0.8139905", "0.8139905", "0.8139905", "0.8139905", "0.8139905", "0.8139905", "0.8139905", "0.80340105", "0.80318177", "0.7909626", "0.7909626", "0.7352069", "0.7352069", "0.734428", "0.7296127", "0.7296127", "0.7296127", "0.7227456", "0.70231503", "0.70231503", ...
0.61629903
44
The name of the command policy.
def get_policyname(self): return self.options["policyname"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy_name(self):\n return self._policy_name", "def policy_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"policy_name\")", "def policy_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"policy_name\")", "def policy_name(self) -> pulumi.Input[str]:\n re...
[ "0.8321798", "0.8139905", "0.8139905", "0.8139905", "0.8139905", "0.8139905", "0.8139905", "0.8139905", "0.80318177", "0.7909626", "0.7909626", "0.7352069", "0.7352069", "0.734428", "0.7296127", "0.7296127", "0.7296127", "0.7227456", "0.70231503", "0.70231503", "0.70231503", ...
0.80340105
8
Get the current status of AIMP. The return value is one of the strings 'playing', 'paused' or 'stopped'.
def GetPlayingStatus(self): iStatus = self.SendCommand(WM_USER, 0, 104) if iStatus == 1: return 'playing' elif iStatus == 3: return 'paused' else: return 'stopped'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_play_status(self):\n return self.get(COMMAND_UIC, 'GetPlayStatus')", "def status(self):\n msg = None\n if self.is_playing():\n msg = \"[Playing]\"\n else:\n msg = \"[Paused]\"\n metadata = self._call_player_proxy('GetMetadata', None).unpack()[0]\n ...
[ "0.75403047", "0.7337679", "0.6807965", "0.67946386", "0.6544834", "0.64080316", "0.6404097", "0.6377517", "0.6377517", "0.6377517", "0.6377517", "0.6377517", "0.6377517", "0.6377517", "0.6377517", "0.6377517", "0.6377517", "0.6377517", "0.6377517", "0.6377517", "0.6377517", ...
0.7558147
0
Given a Coord object, calculates distance from lat, lng
def distance_from_coords(self, lat, lng, system='imperial'): # TODO re-do this with coords list # lat1 is the ai, lat2 is the param if self.lat and self.lng: lat1 = radians(self.lat) lng1 = radians(self.lng) lat2 = radians(lat) lng2 = radians(lng)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_distance(self, coords):\n return distance.distance(coords, (self.lat, self.long)).m", "def distance(self, lat: float, lon: float) -> float:\n return distance((self.lat, self.lon), (lat, lon))", "def distance(self, coord1, coord2):\n sinsin_lat = coord1.lat.sin() * coord2.lat.sin()\n ...
[ "0.74048144", "0.72016567", "0.71007895", "0.7042798", "0.69678915", "0.694673", "0.6923824", "0.6919646", "0.68787616", "0.68759567", "0.6871707", "0.68310785", "0.681889", "0.6736902", "0.67287374", "0.66907966", "0.6665959", "0.66597515", "0.65909797", "0.6578634", "0.6578...
0.72495896
1
Helper to generate a random name of n characters.
def _gen_rand_name(n=10): # Ensure the name starts with a letter. return ''.join([random.choice(LETTER_LIST)] + random.choices(CHAR_LIST, k=n-1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_generator(size=8, chars=string.ascii_uppercase + string.digits):\n return ''.join(random.choice(chars) for _ in range(size))", "def random_name(size=6):\r\n chars = string.ascii_uppercase + string.digits\r\n return 'test-' + ''.join(random.choice(chars) for x in range(size))", "def gen_rand_s...
[ "0.85553813", "0.8530234", "0.84940225", "0.8315678", "0.81517273", "0.8070606", "0.7974023", "0.7950569", "0.7928394", "0.7839016", "0.7826571", "0.7799704", "0.7798972", "0.7782455", "0.77347004", "0.7664048", "0.7655837", "0.76246434", "0.7621716", "0.75852", "0.758013", ...
0.90884703
0
Detect if a type of object (e.g. inverter) is present. Returns True if the object_type is found, False otherwise.
def object_type_present(self, object_type): # Check input. if not isinstance(object_type, str): raise TypeError('object_type must be a string.') # Lookup object type and return. return object_type in self.model_map['object']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_type(self, obj):\n return isinstance(obj, self.type_)", "def isinstance_blender_object(self, b_obj):\n # lame and slow, but functional\n return b_obj in Blender.Object.Get()", "def is_type(obj):\n return type(obj) is type or type(obj) is types.ClassType", "def is_type(obj: ...
[ "0.7200224", "0.71671087", "0.712769", "0.6975016", "0.6948754", "0.69310874", "0.68714213", "0.6785887", "0.6708049", "0.6685954", "0.66145986", "0.6553815", "0.65352017", "0.6447252", "0.6426626", "0.63977593", "0.6388211", "0.63703996", "0.63603544", "0.63396895", "0.63264...
0.84510404
0
Retrieve current input buffer in string form.
def input_buffer(self): return self.edit.toPlainText()[self._prompt_pos:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buffer_string(self):\n return \"\\n\".join(self.buf) + \"\\n\"", "def _get_input_buffer(self):\n return ConsoleWidget._get_input_buffer(self)", "def _get_string(self):\n result = sys.stdin.readline().rstrip('\\n')\n return result", "def _get_string():\n result = sys.std...
[ "0.73088473", "0.7050501", "0.67882276", "0.6700045", "0.66555655", "0.6644165", "0.6530334", "0.6483679", "0.6420547", "0.64198655", "0.6347521", "0.63406336", "0.63236254", "0.629889", "0.6286403", "0.6204645", "0.620429", "0.6192095", "0.61520296", "0.61247635", "0.6124763...
0.6876911
2
Restores the model and optimizer to their initial states.
def reset(self): checkpoint = torch.load( 'model_lr_finder.pth.tar', map_location=self.device) self.model.load_state_dict(checkpoint['state_dict']) self.optimizer.load_state_dict(checkpoint['optimizer']) self.model.to(self.device) self.model.train()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.best_model = None\n self.best_res = -1", "def reset(self):\n \n s = self\n s.step_counter = 0\n \n # TODO: initialize first layer activations here, and not everywhere else\n # self.model.initialize_local_vars()\n # self.model.initialize_global_vars...
[ "0.7462873", "0.7441567", "0.7349743", "0.7252147", "0.7214998", "0.7075496", "0.70064104", "0.69066596", "0.69057864", "0.68438566", "0.6827934", "0.6749382", "0.6722334", "0.6715925", "0.67096066", "0.66950375", "0.66920483", "0.6690903", "0.6673025", "0.6657675", "0.665767...
0.80304915
0
Build a layer of the model. p(h_layer | h_above) = Bernoulli(h_layer; sigmoid(w^T h_above + b))
def build_stochastic_layer(self, n, h_above): cfg = self.config n_samples = h_above.get_shape().as_list()[0] h_above = tf.reshape( h_above, [n_samples * cfg['batch_size'], cfg['p/h_dim']]) logits = slim.fully_connected(h_above, cfg['p/h_dim'], activation_fn=None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_layer(self) :\n inputsWithBias = self.input_count + 1\n self.weights = np.random.rand(inputsWithBias, self.node_count)\n self.weights_and_activations = (self.weights, self.activations)", "def build(bottom_model, num_classes):\n\n top_model = bottom_model.output\n top_model = ...
[ "0.6723083", "0.6511757", "0.6477188", "0.63526386", "0.63361466", "0.6325239", "0.63211584", "0.63102317", "0.6286605", "0.62595195", "0.6253439", "0.62318915", "0.62102175", "0.61897993", "0.61770236", "0.61598736", "0.6152707", "0.61441886", "0.6090675", "0.60889035", "0.6...
0.68266386
0
Get all operation classes.
def all_operations(): return OperationHandler().get_all_classes()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_classes(self):\n return self._classes", "def get_classes(self):\n return", "def get_op_types(self):\n return self.cur_config['ops']", "def get_classes(self):\n query = read_query('structure exploration/classes')\n response = self._submit_query(query)\n\n retu...
[ "0.6762586", "0.6722294", "0.6478772", "0.64290303", "0.6405854", "0.63941467", "0.63941467", "0.63941467", "0.63941467", "0.63941467", "0.63941467", "0.63941467", "0.63941467", "0.63941467", "0.63941467", "0.63941467", "0.63941467", "0.63941467", "0.63941467", "0.63941467", ...
0.8915402
0
Copy TensorFlow batch normalization params weights to Chainer model.
def copy_bn(sess, tftensor, layer): gamma = sess.graph.get_tensor_by_name('{}/gamma:0'.format(tftensor)).eval() beta = sess.graph.get_tensor_by_name('{}/beta:0'.format(tftensor)).eval() avg_mean = sess.graph.get_tensor_by_name('{}/moving_mean:0'.format(tftensor)).eval() avg_var = sess.graph.get_tensor_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_parameters(self):\n self.entity_embeddings.weight.data = normalize(self.entity_embeddings.weight.data,\n p=self.norm_type, dim=1)", "def normalize_parameters(self):\n self.entity_embeddings.weight.data = normalize(self.entity_embed...
[ "0.723366", "0.6802309", "0.67202914", "0.6649555", "0.6378509", "0.6378509", "0.6378509", "0.62932724", "0.62921965", "0.6206307", "0.60904115", "0.60893893", "0.6062609", "0.6050533", "0.60472804", "0.6035019", "0.6035019", "0.59659564", "0.5957332", "0.5942991", "0.5914373...
0.0
-1
Copy weights and params from the graph in the given TensorFlow session to the Chainer chain.
def copy_inception(sess, model): print('Copying first layers ...') copy_conv(sess, 'conv', model.conv) copy_bn(sess, 'conv/batchnorm', model.bn_conv) copy_conv(sess, 'conv_1', model.conv_1) copy_bn(sess, 'conv_1/batchnorm', model.bn_conv_1) copy_conv(sess, 'conv_2', model.conv_2) copy_bn(se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_params(self):\n tf.get_default_session().run(self.copy_ops)", "def copy_network_parameters(sess):\n e1_params = [t for t in tf.trainable_variables() if t.name.startswith('q_network')]\n e1_params = sorted(e1_params, key=lambda v: v.name)\n e2_params = [t for t in tf.trainable_variables()...
[ "0.6457076", "0.59719586", "0.5878138", "0.5803329", "0.5782668", "0.5750543", "0.57143885", "0.5628671", "0.56185555", "0.56156", "0.558618", "0.5563755", "0.5537649", "0.5509412", "0.5468578", "0.54683", "0.5466813", "0.5466675", "0.5459883", "0.5456898", "0.5432675", "0....
0.0
-1
Recursively apply a formatting dict to all strings in a configuration. Note that it skips applying the formatting if the string appears to contain latex (specifically, if it contains an "$"), since the formatting fails on nested brackets.
def apply_formatting_dict(obj: Any, formatting: Dict[str, Any]) -> Any: # logger.debug("Processing object of type {}".format(type(obj))) new_obj = obj if isinstance(obj, str): # Apply the formatting options to the string. # We explicitly allow for missing keys. They will be kept so they can...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursively_update_config(config, string_formatting_dict):\n\n for k in _iterate_list_or_dict(config):\n v = config[k]\n if isinstance(v, dict) or isinstance(v, list):\n recursively_update_config(v, string_formatting_dict)\n else:\n if _key_in_string(v, string_form...
[ "0.72879493", "0.6207643", "0.56822747", "0.55818796", "0.54392344", "0.5394973", "0.53865546", "0.5284291", "0.5234413", "0.5201787", "0.5177622", "0.5173156", "0.5119361", "0.51155764", "0.5091752", "0.5082112", "0.5064434", "0.5042223", "0.49967426", "0.49924043", "0.49768...
0.5996255
2
Centers the surface, making the center of surface stay in the same place regardless of size
def blit_surface_centered(surface: pygame.Surface, pos: tuple, m): ss = surface.get_size() offsetx = ss[0] / 2 offsety = ss[1] / 2 blit_pos = (pos[0] - offsetx, pos[1] - offsety) blit_surface_on_background(surface, blit_pos, m)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center(self):\n if self.pos != 0.0:\n self.pos = 0.0", "def blit_center(screen, source_surface, pos_x, pos_y):\n screen.blit(source_surface, (pos_x - source_surface.get_width() / 2, pos_y - source_surface.get_height() / 2))", "def update_center(self): \r\n \r\n self.grfx[0].cente...
[ "0.7148227", "0.7049959", "0.70094866", "0.68771684", "0.6737539", "0.66818374", "0.66727215", "0.6649626", "0.64498496", "0.6449143", "0.64100146", "0.64066976", "0.6340279", "0.63358927", "0.63358927", "0.6319994", "0.631114", "0.6297253", "0.6293939", "0.62549764", "0.6254...
0.69673914
3
This returns just one np.array with +{halite} for friendly ships and {halite} for enemy ships.
def get_frame_ship_state_basic(self, obs, current_player): entities_map = np.zeros((self.MAP_SIZE, self.MAP_SIZE)) for player, (_, sy, ships) in enumerate(obs.players): for ship in ships.values(): ship_pos, halite = ship[0], ship[1] row = ship_pos // self.MA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_halite_move(game, ship, args = None):\n if args is None:\n args = {}\n\n move = \"o\"\n\n if DEBUG & (DEBUG_NAV): logging.info(\"Nav - ship {} is getting a density based move\".format(ship.id))\n\n moves = []\n for blocks in game.game_map.get_cell_blocks(ship.position, 3, 3): # return...
[ "0.55672044", "0.554706", "0.5381262", "0.53400916", "0.51238316", "0.5106726", "0.5094532", "0.5066407", "0.5038184", "0.50207096", "0.50010455", "0.49866703", "0.4986063", "0.4950139", "0.49409392", "0.49194115", "0.4911748", "0.48821753", "0.48678878", "0.48657033", "0.486...
0.46344095
51
Gets acceleration data and calculates angles for X and Y
def get_anglesXY( self ): [accel_xout_scaled, accel_yout_scaled, _] = self.get_accelXYZ() rot_x = get_x_angle( accel_xout_scaled, accel_yout_scaled, accel_zout_scaled ) rot_y = get_y_angle( accel_xout_scaled, accel_yout_scaled, accel_zout_scaled ) return [rot_x, rot_y]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_acceleration(self, x, y):\n a_x = G * self.m / (x*x + y*y) * -x/(np.sqrt(x*x + y*y))\n a_y = G * self.m / (x*x + y*y) * -y/(np.sqrt(x*x + y*y))\n return np.array([a_x, a_y])", "def get_accel_data(self):\n x = self.read_i2c_word(self.ACCEL_XOUT0)\n y = self.read_i2c_...
[ "0.7310501", "0.6987066", "0.68521965", "0.678724", "0.6650465", "0.66330063", "0.65935165", "0.6428553", "0.6387257", "0.62658757", "0.6263087", "0.62563705", "0.6253415", "0.6253413", "0.6246678", "0.62452394", "0.6241185", "0.61460674", "0.6091013", "0.60710657", "0.604123...
0.67524683
4
list_of_arrays is a nonempty list of numpy arrays (with arbitrary number of dimensions) with the SAME shape
def concat(list_of_arrays): shape = np.shape(list_of_arrays) newShape = [ shape[0]*shape[1] ] if len(shape)>2: for i in range(2,len(shape)): newShape.append(shape[i]) array_concat = np.zeros(newShape) s=0 e=shape[1] for i in range(0,shape[0]): array_concat[s:e] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_arrays(self, array_list, ndim=1, dtype=None, zeros=True):\n for array in array_list:\n self._create_array(array, ndim, dtype, zeros)", "def arraylistcat(arraylist):\n if len(arraylist) < 1:\n \n return None\n \n nx = 0\n for x in arraylist:\n \n ...
[ "0.70547235", "0.6826023", "0.676612", "0.6544973", "0.63776475", "0.6242667", "0.62184113", "0.61642694", "0.61642176", "0.6107972", "0.59678614", "0.59547114", "0.5950986", "0.59383535", "0.59221053", "0.58658034", "0.5856752", "0.5854151", "0.5828483", "0.58279985", "0.579...
0.7216473
0
Split the message into up to length char lines
def split(long_string, length): lines = [] words = long_string.split(' ') line = '' while len(words) != 0: if line == '': line = words.pop(0) elif len(line) + len(words[0]) + 1 < length: line += ' ' + words.pop(0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunk_split(cls, text):\n parts = []\n current = []\n for line in text.splitlines():\n size = sum(len(part) + 1 for part in current)\n extra = len(line)\n if size + extra >= 2000:\n if current:\n # The message is full, spli...
[ "0.7255442", "0.7190964", "0.68198085", "0.67212665", "0.65531075", "0.64914316", "0.6482892", "0.64518684", "0.63417435", "0.6232623", "0.62295634", "0.6222435", "0.6190231", "0.61692125", "0.61521065", "0.61156744", "0.6069069", "0.5970497", "0.5964947", "0.5926623", "0.591...
0.6600637
4
Constructor, new node is indirectly created by Op object __call__ method. Instance variables
def __init__(self): self.inputs = [] self.op = None self.const_attr = None self.name = "" self.dtype = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\r\n new_node = Node()\r\n new_node.op = self\r\n return new_node", "def __call__(self):\n new_node = Node()\n new_node.op = self\n return new_node", "def __init__(self, node_def, op, message, error_code):\n ...", "def __call__(self):\r\n ...
[ "0.8296807", "0.8252858", "0.7778686", "0.7766668", "0.76373076", "0.7632972", "0.7154859", "0.69841194", "0.69637954", "0.69582844", "0.69400877", "0.69353133", "0.6918601", "0.69141066", "0.6905606", "0.6902581", "0.688759", "0.68815005", "0.6875365", "0.68752134", "0.68646...
0.6564638
47
Creates a node that represents a np.zeros array of same shape as node_A.
def __call__(self, node_A): new_node = Op.__call__(self) new_node.inputs = [node_A] new_node.name = "Zeroslike(%s)" % node_A.name return new_node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, node_A):\n new_node = Op.__call__(self)\n new_node.inputs = [node_A]\n new_node.name = \"Zeroslike(%s)\" % node_A.name\n return new_node", "def zeros(*shape, **kwargs):\n return Tensor(np.zeros(shape), **kwargs)", "def zero(self):\n return np.zeros([...
[ "0.7663554", "0.65630096", "0.6548745", "0.6521809", "0.6474439", "0.6428771", "0.63982576", "0.6385404", "0.63762736", "0.6373774", "0.6308839", "0.62520796", "0.6243805", "0.62234515", "0.622252", "0.62024605", "0.6142172", "0.6116945", "0.60908544", "0.6047405", "0.6046895...
0.7654026
1
Returns zeros_like of the same shape as input.
def compute(self, node, input_vals): #print((input_vals[0])) #assert(isinstance(input_vals[0], np.ndarray)) return np.zeros(input_vals[0].shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zeros_like(data):\n return _make.zeros_like(data)", "def zeros_like(a):\n if isinstance(a, np.ndarray):\n return np.zeros_like(a)\n else:\n return K.zeros_like(a)", "def zeros(shape, dtype=None):\n\n return full(shape, 0, dtype)", "def zeros_like(tensor):\n raise NotImple...
[ "0.8106684", "0.8017027", "0.7727477", "0.74738044", "0.7434409", "0.73835105", "0.7344697", "0.7255019", "0.7235715", "0.7172771", "0.7172771", "0.7126236", "0.7115438", "0.6981785", "0.69669735", "0.6935935", "0.68780476", "0.68646675", "0.6861637", "0.6861637", "0.68542683...
0.0
-1
Returns ones_like of the same shape as input.
def compute(self, node, input_vals): input_vals[0]=np.array(input_vals[0]) #assert(isinstance(input_vals[0], np.ndarray)) return np.ones(input_vals[0].shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ones(shape, dtype=None):\n\n return full(shape, 1, dtype)", "def _ones_like(x):\n # Should only be used for small vectors.\n if x.get_shape().is_fully_defined():\n return array_ops.ones(x.get_shape().as_list(), dtype=x.dtype)\n return array_ops.ones_like(x)", "def ones(shape, dtype=None):\n ...
[ "0.7908135", "0.78526306", "0.77506083", "0.7741227", "0.76042706", "0.7337113", "0.7287019", "0.7176025", "0.7176025", "0.69863707", "0.6896035", "0.6854805", "0.68481356", "0.6842902", "0.68413734", "0.6791106", "0.6742559", "0.67410547", "0.6679051", "0.6673973", "0.664221...
0.0
-1
Creates an instance of `SubstructureAssemblyLine`.
def __init__(self, assigned, takt_time, attach_time, target, num): super().__init__(f"Substation Assembly Line {num}") self.assigned = assigned self.takt_time = takt_time self.attach_time = attach_time self.target = target
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assembly(self, **kwargs) -> \"SubAssembly\":\n\t\treturn SubAssembly(self, kwargs)", "def createFromLine(cls, line, **kwargs):\n angle = line.angle\n x, y = cls.cartesian([1, angle])\n return cls(x, y, **kwargs)", "def createLineSegment(self):\n return _libsbml.Layout_createLine...
[ "0.5864888", "0.57998246", "0.57969165", "0.5732586", "0.5583929", "0.5567263", "0.5526695", "0.5503149", "0.5466095", "0.54406", "0.5433178", "0.5431386", "0.54162234", "0.5342237", "0.53214014", "0.5316644", "0.52741295", "0.52399886", "0.52399296", "0.5214961", "0.5214926"...
0.5430077
12
Creates an instance of `Substructure`.
def __init__(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_submodule(self, *args: Any, **kwargs: Any) -> Submodule:\n return Submodule.add(self, *args, **kwargs)", "def create(self):\n statusList = []\n ## generating the different substructures\n for s in self.substructures:\n ## create the data substructure object\n ...
[ "0.60775167", "0.5939752", "0.58945906", "0.5698878", "0.5694465", "0.56767756", "0.5522687", "0.539407", "0.53774405", "0.53463525", "0.5247658", "0.52233547", "0.52117044", "0.5210099", "0.5161309", "0.51427543", "0.5123247", "0.5119758", "0.51143163", "0.51024264", "0.5102...
0.0
-1
Model admin root does not have a view per se so we redirect to admin root.
def view__model_admin_root(context, request): return HTTPFound(request.resource_url(context.__parent__))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n self.redirect('/admin')", "def get(self):\n self.redirect('/admin')", "def post(self) :\n self.redirect('/admin')", "def goToAdmin(request):\n\n\ttemplate = '../admin'\n\treturn HttpResponseRedirect(template)", "def admin():\n return redirect(url_for(\"user\", name=...
[ "0.7985887", "0.7985887", "0.7709704", "0.7472954", "0.7389496", "0.7202746", "0.709773", "0.7065975", "0.70108604", "0.6891129", "0.6838579", "0.67827296", "0.6764646", "0.6735883", "0.6557917", "0.6461977", "0.6459943", "0.6394069", "0.6392595", "0.63877046", "0.63827956", ...
0.76466686
3
Return the API Version for this implementation
def version(self): return BOSS_API_VERSION
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version(self):\n return self.api_version", "def api_version(self):\n\n\t\treturn self._api_version", "def api_version(self):\n\n return self._api_version", "def api_version(self) -> Optional[str]:\n return pulumi.get(self, \"api_version\")", "def api_version(self) -> Optional[s...
[ "0.9099211", "0.88299054", "0.88193214", "0.87111694", "0.87111694", "0.87111694", "0.87111694", "0.87111694", "0.87111694", "0.87111694", "0.87111694", "0.87111694", "0.87111694", "0.87111694", "0.87111694", "0.87111694", "0.87111694", "0.87111694", "0.87111694", "0.87111694",...
0.0
-1
This test confirms that the Archeologist's view of the historic annotations is consistent with CMFEdition's APIs.
def test_ftw_journal_is_not_versioned_archeologist(self): self.login(self.regular_user) self.create_version(self.document) repo_tool = api.portal.get_tool('portal_repository') shadow_history = repo_tool.getHistoryMetadata(self.document) self.assertEquals(2, len(shadow_history))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exac_annotator_1(test_scheme, setup_annotator, get_test_file,\n get_test_vcf_record, get_empty_maf_record):\n vcf_path = get_test_file('fake_exac.vcf.gz')\n annotator = setup_annotator(test_scheme, source=vcf_path) \n\n vcf_record = get_test_vcf_record(\n chrom='chr1...
[ "0.6208681", "0.6098832", "0.6094248", "0.6092599", "0.5733991", "0.57122", "0.57119906", "0.5632859", "0.5603229", "0.5546937", "0.55375457", "0.55329263", "0.55167747", "0.55129784", "0.5508894", "0.5505907", "0.5505544", "0.5479057", "0.5463353", "0.5462395", "0.54427904",...
0.5574416
9
Prepares a mock for Salesforce instance
def salesforce_instance(): with mock.patch('salesforce_bulk_api.Salesforce') as Salesforce: Salesforce.return_value.session_id = 'the-session-id' Salesforce.return_value.sf_version = '34.0' Salesforce.return_value.base_url = 'https://salesforce/services/data/v34.0/' Salesforce.retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n super(TestRiskSnapshotting, self).setUp()\n self.api = ExternalApiClient(use_ggrcq_service_account=True)\n self.objgen = ObjectGenerator()", "def setup_class(cls):\n cls.mock_get_patcher = patch('project.services.requests.get')\n cls.mock_get = cls.mock_get_patcher.start...
[ "0.6621294", "0.6619728", "0.65941167", "0.65616304", "0.6558193", "0.6558193", "0.6558193", "0.6558193", "0.6558193", "0.6558193", "0.6551103", "0.6544787", "0.6495975", "0.64642566", "0.64467937", "0.63625747", "0.6333644", "0.6258872", "0.6221287", "0.6210627", "0.6196746"...
0.72931445
0
Read image using its path. Default value is grayscale, and image is read by YCbCr format as the paper said.
def imread(path, is_grayscale=True): if is_grayscale: #flatten=True 以灰度图的形式读取 return scipy.misc.imread(path, flatten=True, mode='YCbCr').astype(np.float) else: return scipy.misc.imread(path, mode='YCbCr').astype(np.float)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imread(path, is_grayscale=True):\n if is_grayscale:\n return scipy.misc.imread(path, flatten=True, mode='YCbCr').astype(np.float)\n else:\n return scipy.misc.imread(path, mode='YCbCr').astype(np.float)", "def imread(path, is_grayscale=True):\n if is_grayscale:\n # flatten=True: 形成單層的灰階通道\n ...
[ "0.77684826", "0.77258337", "0.7639162", "0.7520595", "0.7467305", "0.7457439", "0.73671496", "0.72278494", "0.7214487", "0.72123486", "0.7200269", "0.7183444", "0.70766175", "0.7058211", "0.7026866", "0.70162314", "0.6943889", "0.69430184", "0.69332045", "0.6900042", "0.6891...
0.77840906
0
Helper function for generating a random string
def __generate_random_string(): return uuid4().hex[:6].upper()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateRandomString():\n return ''.join(b64encode(urandom(32)).decode('utf-8'))", "def generate_random_string():\n return \"\".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(16)) # nosec", "def randomstr(ctx, nbytes=\"\"):\n # deprecated function\n logger.info(\"Dep...
[ "0.85894465", "0.85492206", "0.8190487", "0.8147589", "0.8116277", "0.8027642", "0.79199487", "0.788436", "0.78808117", "0.7870456", "0.78343445", "0.78186613", "0.78159225", "0.779071", "0.77800965", "0.7778551", "0.77776915", "0.777435", "0.7768781", "0.7766585", "0.7759173...
0.8280882
2
Deactivates the option of dual TTS depending on internet connection
def disable_dual_TTS(self): self.isActiveDualTTS = False self.change_TTS_engine()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_TTS_engine(self):\n\t\t\n\t\tif self.isActiveDualTTS:\n\t\t\t#dual TTS\n\t\t\tpath_to_file = '/var/lib/snips/skills/snips_app_pilldispenser/settings/dual_TTS.sh'\n\t\t\tsubprocess.call([path_to_file])\n\t\t\tprint('Dual TTS is enabled. Using Amazon Polly TTS in case of internet connection, else use offl...
[ "0.6985197", "0.65773094", "0.6142466", "0.6048877", "0.5781478", "0.5762552", "0.5547855", "0.54477835", "0.5440111", "0.54377174", "0.53925616", "0.53925616", "0.5301444", "0.5267295", "0.52324533", "0.52055764", "0.5161625", "0.514115", "0.5136032", "0.5130612", "0.5106833...
0.7121904
0
Tests that an oauth client is loaded correctly by ID
def test_get_oauth_client(self): client = OAuthClient(self.client, "2737bf16b39ab5d7b4a1", {}) self.assertEqual(client.id, "2737bf16b39ab5d7b4a1") self.assertEqual(client.label, "Test_Client_1") self.assertFalse(client.public) self.assertEqual( client.redirect_uri, "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_client(oauth_client, response):\n response.get(f\"https://api.mollie.com/v2/clients/{CLIENT_ID}\", \"client_single\")\n\n client = oauth_client.clients.get(CLIENT_ID)\n assert isinstance(client, Client)\n assert client.id == CLIENT_ID\n assert client.resource == \"client\"\n assert c...
[ "0.7168287", "0.68318075", "0.6824498", "0.67315394", "0.6657325", "0.66558766", "0.6626583", "0.66247857", "0.65802926", "0.65705293", "0.6532619", "0.6523901", "0.6478303", "0.64468914", "0.643962", "0.64096385", "0.64008284", "0.63845205", "0.6333631", "0.6327334", "0.6311...
0.79279506
0
Return the next value from the Trie.
def __next__(self): self._iteration_index += 1 if self._iteration_index < self._length: return self._child_values[self._iteration_index] raise StopIteration
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next(self) -> int:\n node = self.list.pop()\n t = node.right\n while (t):\n self.list.append(t)\n t = t.left\n\n return node.val", "def __next__(self):\n\n nxt = next(self.tree)\n if nxt is not None:\n return nxt.key", "def get_next...
[ "0.71009237", "0.68747216", "0.6785338", "0.67089003", "0.6682583", "0.664996", "0.6600616", "0.65859354", "0.6582357", "0.6558696", "0.6537711", "0.65320635", "0.65152586", "0.65075475", "0.6473029", "0.6473029", "0.64635473", "0.64578986", "0.64560354", "0.645346", "0.64507...
0.5938572
80
Adds crud_template_name to default template names.
def get_template_names(self): names = super(CRUDMixin, self).get_template_names() if self.crud_template_name: names.append(self.crud_template_name) return names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_crud_template(name):\n template = Template(CRUD_TEMPLATE)\n msg = template.render(name=name)\n return msg", "def get_crud_template_dict():\n return CRUD_TEMPLATE_DICT", "def template_name(self):\n\t\traise NotImplementedError('template_name must be defined')", "def _custom_template_nam...
[ "0.6442361", "0.5885462", "0.5721086", "0.5702185", "0.5622897", "0.5622897", "0.55930513", "0.55642444", "0.55222213", "0.5442309", "0.5402841", "0.5323866", "0.5315627", "0.5269766", "0.5258141", "0.5254774", "0.5250271", "0.5164065", "0.51328415", "0.51317126", "0.5129803"...
0.65259725
0
Opens a JSON file
def openFile(self, path): with open(path) as f: return json.load(f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_json(path):\n with open(path, \"r\") as json_data_file:\n data = json.load(json_data_file)\n return data", "def openJson(self):\n json_file = open(self.file, 'r')\n json_data = json_file.read()\n result = json.loads(json_data)\n return result", ...
[ "0.7764946", "0.74575746", "0.72270334", "0.7089345", "0.70492184", "0.69865084", "0.695505", "0.6951792", "0.69328076", "0.69049406", "0.6880673", "0.6848421", "0.6845763", "0.6832441", "0.68209547", "0.68209547", "0.6789817", "0.6777519", "0.6762135", "0.6757298", "0.675700...
0.764135
1
GET and POST routes for searching and adding an individual stock
def stock_view(request): if request.method == 'GET': try: symbol = request.GET['symbol'] except KeyError: return {} try: response = requests.get(API_URL + '/stock/{}/company'.format(symbol)) data = response.json() return {'company':...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_stock():\r\n print(\"<add_stock()>\")\r\n body = request.get_json()\r\n stocks = Stock(**body).save()\r\n return jsonify(stocks)", "def stock(request, s_id):\n assert isinstance(request, HttpRequest)\n\n try:\n #Get the requested stock with (stock_id)\n sto...
[ "0.67846984", "0.6500751", "0.6418376", "0.62548095", "0.62410027", "0.62189937", "0.6182033", "0.607406", "0.60599333", "0.60283244", "0.60126793", "0.5995253", "0.59755194", "0.59723", "0.5970819", "0.59525305", "0.59521157", "0.593805", "0.5936667", "0.5936113", "0.5933646...
0.7430679
0
Total amount of posts loaded.
def count_total(self): with self._c_lock: # I can't believe I implemented a lock for a counter. Safety first, I guess... return self._total_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_posts(self):\n\n return FlicketTicket.query.filter_by(started_id=self.id).count() + FlicketPost.query.filter_by(\n user_id=self.id).count()", "def posts_count(self):\n return Post.objects.filter(user__username = self.user.username).count()", "async def _set_total_posts_in_domai...
[ "0.7457904", "0.73846537", "0.69664824", "0.6819613", "0.6797854", "0.67948675", "0.6775799", "0.6681046", "0.66759866", "0.6626322", "0.66191894", "0.65930974", "0.6592763", "0.65409946", "0.65301406", "0.65273756", "0.64973515", "0.6465976", "0.6465976", "0.6465976", "0.646...
0.60689
91
Gets the next element in the list. Returns Null on timeout, or raises Empty when finished.
def next_ele(self): try: ret = self._queue.get(block = True, timeout=0.5) self._queue.task_done() return ret except queue.Empty: if not self.is_running(): raise else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_ele(self):\n\t\ttry:\n\t\t\tret = self._queue.get(block=True, timeout=0.5)\n\t\t\tself._queue.task_done()\n\t\t\treturn ret\n\t\texcept queue.Empty:\n\t\t\tif not self.isAlive():\n\t\t\t\traise\n\t\t\telse:\n\t\t\t\treturn None", "def get_next_item(self, timeout=None):\n if self.current_item is n...
[ "0.8091959", "0.7184955", "0.7161255", "0.6977266", "0.67948735", "0.67310977", "0.6637295", "0.66078466", "0.65023255", "0.64671266", "0.64244825", "0.63978547", "0.6389176", "0.6373475", "0.6369736", "0.63513553", "0.6347818", "0.63171256", "0.62923235", "0.62816614", "0.62...
0.80532634
1
Function that calculates the shortest distance between two houses.
def shortest(house1, house2): # x coordinate 1 of house 1 x1h1 = house1.x1 # x 1 of house 2 x1h2 = house2.x1 # x 2 of house 1 x2h1 = house1.x2 # x 2 of house 2 x2h2 = house2.x2 # y 1 of house 1 y1h1 = house1.y1 # y 1 of house 2 y1h2 = house2.y1 # y 2 of house 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortest(self, word1, word2):\n a, b = self.d[word1], self.d[word2]\n m, n, i, j, res = len(a), len(b), 0, 0, float('inf')\n while i < m and j < n:\n res = min(res, abs(a[i] - b[j]))\n if a[i] > b[j]:\n j += 1\n else:\n i += 1\...
[ "0.7146799", "0.68874836", "0.6805211", "0.67185205", "0.671614", "0.6668262", "0.66314065", "0.66271657", "0.6588853", "0.658055", "0.6492303", "0.6492303", "0.64920735", "0.6487057", "0.64616334", "0.6440952", "0.64372396", "0.6428301", "0.6419579", "0.6387855", "0.6385743"...
0.7729523
0