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 |
|---|---|---|---|---|---|---|
Return the configuration (taken from the integration). Returns Configuration | def configuration(self):
if self.integration is None:
return None
return self.integration.configuration | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_configuration(self) -> dict:\n return self.config",
"def get_config(self):\n return self.config",
"def get_config() -> Config:\n return get_or_set('config', build_configuration)",
"def getConfiguration(self):\n return self._configuration",
"def configuration(self):\n ... | [
"0.82443553",
"0.78730404",
"0.78712225",
"0.7855746",
"0.7841959",
"0.7786318",
"0.76717865",
"0.7669798",
"0.7669798",
"0.7649958",
"0.7509267",
"0.75022286",
"0.7499415",
"0.74949837",
"0.74949837",
"0.74949837",
"0.74949837",
"0.74949837",
"0.74949837",
"0.74949837",
"0.7... | 0.8421637 | 0 |
Return whether an option is set in the configuration for this filter. | def has_option(self, key):
if self.integration is None:
return False
return self.integration.has_option(f'{self.get_config_name()}.{key}') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_option(self, name):\n return self.option_settings[name]",
"def has_option(self, key):\n\n return key in self.__opt",
"def has_option(self, option):\n\t\treturn self.config_parser.has_option(self.section_name, option)",
"def has_option(self, option):\n splitvals = option.split('/'... | [
"0.7916976",
"0.76582676",
"0.750667",
"0.74609727",
"0.74476415",
"0.7342793",
"0.7038061",
"0.6925462",
"0.68961424",
"0.68368506",
"0.67645085",
"0.6763176",
"0.6761327",
"0.6756798",
"0.6728388",
"0.6719464",
"0.6675297",
"0.66628486",
"0.66315186",
"0.65886086",
"0.65395... | 0.7237785 | 6 |
Return the value for a given filter option. The given `key` relates specifically to this filter in the configuration. As such, the actual configuration will search for the configuration value associated with .. I.e., the "level" key for a whitening filter will be checked for in the configuration as "filter.whiten.level... | def option(self, key):
if self.integration is None:
return None
return self.configuration.get(f'{self.get_config_name()}.{key}') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_option_value(self, key):\n\n # Check the key.\n self.__assert_option(key)\n\n # Get and return the value.\n return self.__opt[key]",
"def paramValue(self, key):\n return self.options[key]",
"def get_option_value(self, iprop, key):\n val = _pychidg.f90wrap_get... | [
"0.6963314",
"0.6636143",
"0.6282837",
"0.6110091",
"0.60314846",
"0.6026778",
"0.59495836",
"0.5887037",
"0.58366936",
"0.5724721",
"0.5716661",
"0.5676852",
"0.56707466",
"0.5618013",
"0.5580473",
"0.55717224",
"0.5543646",
"0.5526635",
"0.5524596",
"0.5520801",
"0.5491793"... | 0.5994895 | 6 |
Return whether the filter is enabled. Returns bool | def is_enabled(self):
return self.enabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cr_filter_enabled(self):\n i = ct.c_int()\n self.lib.GetFilterMode(ct.pointer(i))\n return i.value",
"def isEnabled(self):\n return self.enabled",
"def isEnabled(self):\n return self.__enabled",
"def is_enabled(self) -> bool:\n return self._enabled",
"def is_on... | [
"0.74828875",
"0.7412238",
"0.7373475",
"0.73574406",
"0.72954416",
"0.7286708",
"0.7279016",
"0.7279016",
"0.7279016",
"0.7279016",
"0.72766453",
"0.72766453",
"0.72116965",
"0.71857435",
"0.71590126",
"0.7143524",
"0.7112321",
"0.7112321",
"0.7112321",
"0.7112321",
"0.71123... | 0.73343134 | 4 |
Return the associated channel group for the integration filter. Returns ChannelGroup | def get_channels(self):
return self.channels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group(self):\n return self._group",
"def master_channel_group(self):\n grp_ptr = c_void_p()\n ckresult(_dll.FMOD_System_GetMasterChannelGroup(self._ptr, byref(grp_ptr)))\n return get_class(\"ChannelGroup\")(grp_ptr)",
"def create_channel_group(self, name):\n name = pr... | [
"0.63630635",
"0.6222914",
"0.61287856",
"0.60879487",
"0.60630953",
"0.60630953",
"0.60630953",
"0.60338634",
"0.60280365",
"0.58595514",
"0.58448136",
"0.57952285",
"0.57819104",
"0.5757071",
"0.5727463",
"0.5704446",
"0.5702034",
"0.5699328",
"0.56898993",
"0.5681385",
"0.... | 0.5154461 | 90 |
Subtract the filtered signal from the integration frame data. | def remove(self, channels=None):
if channels is None:
channels = self.get_channels()
self.remove_from_frames(
self.data, self.integration.frames, channels) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __sub__(self, other):\n output = Spectrum(self.wavelengths, self.intensities)\n for wavelength, intensity in other:\n if output[wavelength]:\n output[wavelength] -= intensity\n else:\n output[wavelength] = -intensity\n return output",
"... | [
"0.6070997",
"0.5966689",
"0.5845027",
"0.5802662",
"0.5793645",
"0.57432556",
"0.5742054",
"0.5725839",
"0.5647996",
"0.5609639",
"0.5606088",
"0.5542987",
"0.55359983",
"0.5531648",
"0.5520673",
"0.5515592",
"0.54837567",
"0.547914",
"0.54704404",
"0.54564685",
"0.54544955"... | 0.0 | -1 |
Return the configuration name. Returns | def get_config_name(self): # pragma: no cover
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._config_name",
"def name(self):\n return self._config.get(CONF_NAME)",
"def name(self):\n return self.config[\"name\"]",
"def name(self) -> str:\n name = self._config[\"name\"]\n assert isinstance(name, str) # noqa: S101\n return name",... | [
"0.9115882",
"0.8890086",
"0.84355587",
"0.8427112",
"0.8255137",
"0.82014585",
"0.81987906",
"0.8164891",
"0.80933386",
"0.809055",
"0.78962547",
"0.78962547",
"0.7869636",
"0.7834404",
"0.7817167",
"0.7773021",
"0.7755397",
"0.76881737",
"0.76546854",
"0.7631014",
"0.754645... | 0.8660824 | 2 |
Return the mean point response of the filter. Returns | def get_mean_point_response(self): # pragma: no cover
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean(self):\n return self._lift(\"mean\")",
"def getMean(self):\n return self.mean",
"def mean(self):\r\n\t\treturn sum(self.sample)/len(self.sample)",
"def mean(self):\n return self._mean",
"def mean(self):\n return self._mean",
"def mean(self):\n\n return self._re... | [
"0.72737056",
"0.70954573",
"0.7094257",
"0.6986456",
"0.6986456",
"0.69467586",
"0.6920249",
"0.69028777",
"0.6853719",
"0.6850248",
"0.6848",
"0.68361443",
"0.6832813",
"0.6829453",
"0.68131906",
"0.6813151",
"0.68119335",
"0.67941195",
"0.6786067",
"0.6771721",
"0.6752133"... | 0.8159894 | 0 |
Sets the learning rate to the initial LR decayed by 10 at [150, 225, 300] epochs | def adjust_learning_rate(optimizer, epoch):
boundary = [args.epochs//2,args.epochs//4*3,args.epochs]
lr = args.lr * 0.1 ** int(bisect.bisect_left(boundary, epoch))
print('Learning rate: %f'%lr)
#print(epoch, lr, bisect.bisect_left(boundary, epoch))
# lr = args.lr * (0.1 ** (epoch // 30))
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #lr = start_lr * (0.1 ** (epoch // 30))\n lr = start_lr * (0.3 ** (epoch // 5))\n if epoch==total_epoch_num:\n lr = lr * 0.3\n\n for param_group in optimizer.param_groups:\n param_group['lr'] = lr",
"def adjust_lea... | [
"0.79588634",
"0.790273",
"0.787245",
"0.77925605",
"0.7779089",
"0.7775484",
"0.7755063",
"0.77470416",
"0.77213115",
"0.77162325",
"0.7715469",
"0.7708269",
"0.77053344",
"0.76985335",
"0.76706856",
"0.767015",
"0.7662084",
"0.76613384",
"0.76562357",
"0.7641095",
"0.763980... | 0.7452717 | 65 |
Sets the learning rate to the initial LR decayed by 5 at [240] epochs | def adjust_learning_rate_adam(optimizer, epoch):
boundary = [args.epochs//5*4]
lr = args.lr * 0.2 ** int(bisect.bisect_left(boundary, epoch))
print('Learning rate: %f'%lr)
#print(epoch, lr)
for param_group in optimizer.param_groups:
param_group['lr'] = lr
return lr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #lr = start_lr * (0.1 ** (epoch // 30))\n lr = start_lr * (0.3 ** (epoch // 5))\n if epoch==total_epoch_num:\n lr = lr * 0.3\n\n for param_group in optimizer.param_groups:\n param_group['lr'] = lr",
"def adjust_lea... | [
"0.77439797",
"0.76591",
"0.763805",
"0.76227254",
"0.76034486",
"0.7594642",
"0.7574494",
"0.75702024",
"0.752143",
"0.75005364",
"0.74932104",
"0.7485676",
"0.7477643",
"0.74585354",
"0.7448708",
"0.7445868",
"0.7435546",
"0.7426368",
"0.74225765",
"0.74225765",
"0.7415567"... | 0.73654777 | 32 |
Sets the weights for the consistency loss | def cal_consistency_weight(epoch, init_ep=0, end_ep=150, init_w=0.0, end_w=20.0):
if epoch > end_ep:
weight_cl = end_w
elif epoch < init_ep:
weight_cl = init_w
else:
T = float(epoch - init_ep)/float(end_ep - init_ep)
#weight_mse = T * (end_w - init_w) + init_w #linear
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_weights(self):\n\n self.weights -= self.loss_grads\n self.loss_grads = np.zeros(self.weights.shape)",
"def set_weights(self, weights):\r\n self.weights = weights",
"def update_weights(self):\n\t\tpass",
"def setWeights(self, w):\n raise NotImplementedError",
"def set_... | [
"0.74783343",
"0.74314",
"0.73715013",
"0.7324748",
"0.72120494",
"0.7135909",
"0.7069585",
"0.70343643",
"0.701198",
"0.69816536",
"0.69771284",
"0.69674456",
"0.69293034",
"0.6916661",
"0.691477",
"0.68591166",
"0.685264",
"0.6852009",
"0.68375164",
"0.6782103",
"0.6763661"... | 0.0 | -1 |
Checks if user can edit other user's profile. | def can_edit_profile(user: User, owner: User) -> bool:
return has_permission(user, "edit_profiles") or user == owner | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_edit_by(self, user2_compare):\n if user2_compare.is_superuser:\n return True\n\n if user2_compare == self.user:\n return True\n\n if (self.creator and self.creator == user2_compare) or \\\n (self.owner and self.owner == user2_compare):\n if... | [
"0.8272584",
"0.76984674",
"0.75591063",
"0.75561243",
"0.74451",
"0.7415794",
"0.74024045",
"0.73589957",
"0.7357231",
"0.7220059",
"0.71777314",
"0.6989566",
"0.6954487",
"0.6853766",
"0.67744356",
"0.6717767",
"0.67118734",
"0.6702454",
"0.65827405",
"0.65704435",
"0.65552... | 0.82477605 | 1 |
Get the image as a TensorFlow variable. | def get_image(verbose=False):
base_data = tf.constant(image_data(verbose=verbose))
base_image = tf.image.decode_image(base_data, channels=3)
base_image.set_shape((IMAGE_HEIGHT, IMAGE_WIDTH, 3))
parsed_image = tf.Variable(base_image, name='image', dtype=tf.uint8)
return parsed_image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_tensor(img_path):\n img_tensor = path_to_tensor(img_path) / 255.0\n return img_tensor",
"def display_image(image):\n image = tf.constant(image)\n image = tf.image.convert_image_dtype(image, tf.uint8)\n return PIL.Image.fromarray(image.numpy())",
"def get_image_live_image(imga):\n ... | [
"0.6731251",
"0.652751",
"0.65031195",
"0.647739",
"0.6447122",
"0.64277726",
"0.6363395",
"0.6320401",
"0.6289422",
"0.62788993",
"0.62754935",
"0.6227266",
"0.6226752",
"0.6214542",
"0.6199059",
"0.6176812",
"0.6160516",
"0.6160516",
"0.6120039",
"0.611339",
"0.6107597",
... | 0.78642124 | 0 |
Run a Sobel edge detection demonstration. See the summary description for more details. | def run_sobel(logdir, verbose=False):
if verbose:
logger.info('--- Starting run: sobel')
tf.compat.v1.reset_default_graph()
tf.compat.v1.set_random_seed(0)
image = get_image(verbose=verbose)
kernel_radius = tf.compat.v1.placeholder(shape=(), dtype=tf.int32)
with tf.name_scope('horizontal_kernel'):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n image_path = input(\"Enter path of image:\")\n # call read function to read an image\n img = Read(image_path)\n # call sobel function to detect edge on image\n sobel_image = Sobel(img)\n # call show function to show original image and edge detected image\n Show(img, sobel_image)... | [
"0.73563826",
"0.67456144",
"0.66465485",
"0.6631984",
"0.64189786",
"0.6305072",
"0.6123454",
"0.60923284",
"0.6091545",
"0.59277666",
"0.57967055",
"0.5794236",
"0.57065195",
"0.567551",
"0.56415814",
"0.5613748",
"0.55828077",
"0.5532994",
"0.55024934",
"0.54995924",
"0.54... | 0.663714 | 3 |
initialize the ship and set the starting position | def __init__(self, ai_settings, screen):
self.screen = screen
self.ai_settings = ai_settings
print(self.ai_settings.ship_speed_factor)
# load the ship image, yo it's down to get_rect()
self.image = pygame.image.load('images/ship.bmp')
self.rect = self.image.get_rect()
self.screen_rect = screen.get_rect()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setNewShip(self):\r\n self._ship = Ship(GAME_WIDTH/2,SHIP_BOTTOM+SHIP_HEIGHT/2,SHIP_WIDTH,\r\n SHIP_HEIGHT,'ship.png')",
"def __init__(self,ai_settings, screen):\n\t\tsuper(Ship,self).__init__()\n\t\tself.screen = screen\n\t\tself.ai_settings = ai_settings\n\t\t\n\t\t# Load ship and get its... | [
"0.7266144",
"0.72509325",
"0.7190304",
"0.70977545",
"0.70977545",
"0.70641685",
"0.7038977",
"0.7023186",
"0.70162636",
"0.70122916",
"0.6998931",
"0.69899637",
"0.69638795",
"0.69607675",
"0.69442326",
"0.69414335",
"0.69413394",
"0.6874519",
"0.68372655",
"0.6817816",
"0.... | 0.7042564 | 6 |
Extract the latest direction vector command sent. Returns a tuple with 2 doubles. (x,y) | def getDirection(self):
return self.listener.direction | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ending_direction_vector(self):\n\n total_length = len(self.pixel_list)\n\n if total_length < 2:\n return None\n elif total_length < 15:\n delta_x = self.pixel_list[-1].x - self.pixel_list[0].x\n delta_y = self.pixel_list[-1].y - self.pixel_list[0].y\n ... | [
"0.7029699",
"0.69252276",
"0.6493337",
"0.6418033",
"0.64026445",
"0.6399659",
"0.6375938",
"0.6284014",
"0.6221837",
"0.6151531",
"0.6143396",
"0.61387247",
"0.6136109",
"0.6129978",
"0.6102229",
"0.60957617",
"0.6086228",
"0.6065718",
"0.60555893",
"0.6017587",
"0.60020965... | 0.0 | -1 |
Extracts the latest obs information sent. Returns array of all obstacles points from occupancy grid [[x1,y1],[x2,y2] ...] | def getAllObs(self):
#print 'getAllOBS:',self.listener.allObs
return self.listener.allObs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_obstacles(self):\r\n obstacles = self.get_obstable_metrics\r\n obstacle_arrays = []\r\n\r\n for nb_obstacle in obstacles:\r\n empty_array = np.zeros(shape=(self.WINDOW_HEIGHT,\r\n self.WINDOW_WIDTH))\r\n start_location... | [
"0.70560765",
"0.67869383",
"0.6739197",
"0.65460193",
"0.6459638",
"0.6371662",
"0.62789565",
"0.6274173",
"0.62559533",
"0.62535983",
"0.62393296",
"0.6202372",
"0.61196613",
"0.6106411",
"0.60997105",
"0.6095039",
"0.6085929",
"0.6073245",
"0.6023259",
"0.5927191",
"0.5897... | 0.0 | -1 |
Create a client for the given service. | def client(
service_name: str, version: str = "v1", secrets: Secrets = None
) -> Resource:
credentials = load_credentials(secrets=secrets)
return build(service_name, version=version, credentials=credentials) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_client(service_name: str, config_name: str = None, **client_args):\n session = get_session(config_name)\n return session.client(service_name, **client_args)",
"def create_client(service, region, access_key_id, secret_access_key):\n client = boto3.client(service,\n reg... | [
"0.81592304",
"0.7683817",
"0.7683817",
"0.73774904",
"0.72367495",
"0.70047927",
"0.69786084",
"0.6935768",
"0.6911396",
"0.6882262",
"0.6869081",
"0.6818507",
"0.6807269",
"0.6768044",
"0.67313707",
"0.67067",
"0.6616005",
"0.6598508",
"0.65723044",
"0.6554205",
"0.6532773"... | 0.69225836 | 8 |
Allocate a new TensorValue and copy the data from `array` into the new array. | def __init__(self, data):
if isinstance(data, np.ndarray):
data = nd.array(data)
self.__init_handle_by_constructor__(
_make.TensorValue, data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _from_numpy(array):\n return tf.constant(array)",
"def create_from_array(cls, array: np.ndarray) -> \"TensorImage\":\n if array.dtype != np.uint8:\n raise ValueError(\"Expect numpy array with dtype=uint8.\")\n\n image_data = image_utils.ImageData(np.squeeze(array))\n return cls(image_dat... | [
"0.6639374",
"0.60928774",
"0.58820564",
"0.5828173",
"0.5797243",
"0.5793632",
"0.56997967",
"0.55633575",
"0.55527335",
"0.55462104",
"0.553464",
"0.5527442",
"0.54970634",
"0.5492853",
"0.53994834",
"0.53863704",
"0.53652257",
"0.53415895",
"0.5323749",
"0.5298797",
"0.527... | 0.48775882 | 70 |
Convert a Relay TensorValue into a numpy.ndarray. | def asnumpy(self):
return self.data.asnumpy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_decode(self, value, decode_fn):\n del decode_fn\n tensor_proto = value.numpy_value\n numpy = tensor_util.MakeNdarray(tensor_proto)\n return numpy",
"def convert_array(self, v, t):\n return interpreter.TensorValue(tvm.ndarray.array(v, self.context))",
"def to_numpy(tensor):\n ra... | [
"0.71997833",
"0.70244527",
"0.6930444",
"0.6901955",
"0.68847704",
"0.6872507",
"0.685781",
"0.6844898",
"0.6797473",
"0.67212397",
"0.66468316",
"0.6646523",
"0.66226083",
"0.6573508",
"0.6568726",
"0.64854056",
"0.6467956",
"0.63569015",
"0.63142025",
"0.63136244",
"0.6299... | 0.5638938 | 93 |
Returns the size of the dataset. | def size(self) -> int:
return self._size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataset_size(self):\n return self.dataset.size",
"def dataset_size(self):\n if not self._dataset_size:\n # pylint: disable=attribute-defined-outside-init\n self._dataset_size = count_file_lines(\n self._hparams.source_dataset.files)\n return self._dat... | [
"0.91362303",
"0.8452737",
"0.84227264",
"0.8277792",
"0.8212795",
"0.81773704",
"0.81773704",
"0.81773704",
"0.81773704",
"0.8167329",
"0.81317335",
"0.8117853",
"0.8040916",
"0.8040916",
"0.8040916",
"0.8040916",
"0.8040916",
"0.8002095",
"0.79609054",
"0.7914592",
"0.78854... | 0.7459112 | 46 |
Create a new instance of CreateJobOp from a file with json specification. | def from_file_name(cls,
name: str = None,
k8s_name: str = None,
job_name: str = None,
file_name: str = None):
with open(file_name) as json_file:
spec = json.loads(json_file.read())
return cls(name=na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json_file(cls, json_file):\n with tf.io.gfile.GFile(json_file, \"r\") as reader:\n text = reader.read()\n return cls(**json.loads(text))",
"def from_json_file(cls, json_file):\n with tf.io.gfile.GFile(json_file, \"r\") as reader:\n text = reader.read()\n return cls.fr... | [
"0.65285945",
"0.63884306",
"0.62440485",
"0.62399745",
"0.623643",
"0.6185696",
"0.6145892",
"0.61157763",
"0.6097918",
"0.6091418",
"0.6083919",
"0.60787123",
"0.6069818",
"0.6067158",
"0.60565406",
"0.6053502",
"0.601639",
"0.59622765",
"0.5939368",
"0.59305465",
"0.587402... | 0.6989138 | 0 |
`Resource` object that represents the `resource` property in `io.argoproj.workflow.v1alpha1.Template`. | def resource(self):
return self._resource | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource(self):\n return self.properties.get('resource',\n Entity(self.context, ResourcePath(\"resource\", self.resource_path)))",
"def resource(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource\")",
"def resource(self) -> Optional[pu... | [
"0.72062236",
"0.71678215",
"0.71678215",
"0.71678215",
"0.65227765",
"0.64285666",
"0.6385131",
"0.63562524",
"0.6305826",
"0.6269993",
"0.6262465",
"0.61771417",
"0.6104658",
"0.6060945",
"0.6060945",
"0.6060945",
"0.6060945",
"0.6060945",
"0.6060945",
"0.6060945",
"0.60609... | 0.65788156 | 7 |
`Resource` object that represents the `resource` property in `io.argoproj.workflow.v1alpha1.Template`. | def resource(self):
return self._resource | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource(self):\n return self.properties.get('resource',\n Entity(self.context, ResourcePath(\"resource\", self.resource_path)))",
"def resource(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource\")",
"def resource(self) -> Optional[pu... | [
"0.72025377",
"0.7165483",
"0.7165483",
"0.7165483",
"0.6526619",
"0.6427636",
"0.6389136",
"0.63534176",
"0.63096535",
"0.62687033",
"0.6265841",
"0.6180796",
"0.61063546",
"0.6059979",
"0.6059979",
"0.6059979",
"0.6059979",
"0.6059979",
"0.6059979",
"0.6059979",
"0.6059979"... | 0.6575717 | 10 |
Return a float that had the proportion of examples with correct predictions. | def testAccuracy(self):
loader = torch.utils.data.DataLoader(dataset=self.test,
shuffle=False)
acc = accuracy(self.model, loader)
self.assertEqual(acc, 1.0)
print(acc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision_score(y_true, y_pred):\n return ((y_true == 1) * (y_pred == 1)).sum() / (y_pred == 1).sum()",
"def precision(ground_truth, prediction):\n ground_truth = remove_duplicates(ground_truth)\n prediction = remove_duplicates(prediction)\n precision_score = count_a_in_b_unique(prediction, groun... | [
"0.7388285",
"0.73299646",
"0.7256688",
"0.7251971",
"0.7236028",
"0.72320396",
"0.722643",
"0.72050714",
"0.7180007",
"0.71598136",
"0.71582425",
"0.71388876",
"0.7104034",
"0.708629",
"0.70862526",
"0.7085888",
"0.70828974",
"0.70828974",
"0.70828974",
"0.70828974",
"0.7082... | 0.0 | -1 |
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes. | def add_header(r):
r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
r.headers["Pragma"] = "no-cache"
r.headers["Expires"] = "0"
r.headers['Cache-Control'] = 'public, max-age=0'
return r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response",
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m... | [
"0.8221727",
"0.8220911",
"0.8220911",
"0.8220911",
"0.8220911",
"0.81940746",
"0.8161616",
"0.8161616",
"0.8161616",
"0.8161616",
"0.8161616",
"0.8161616",
"0.8161616",
"0.8161616",
"0.8161616",
"0.8161616",
"0.8161616",
"0.8161616",
"0.8161616",
"0.8161616",
"0.8161616",
... | 0.7126684 | 64 |
Create propensities for parameters, i.e., soft assignment. | def sample_propensities(mutated_params: torch.Tensor) -> torch.Tensor:
return torch.softmax(mutated_params, -1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _gen_policy_params(self, state: State) -> Tensor:\n ...",
"def _gen_policy_params(self, state: State) -> Tensor:\n return self.network(state)",
"def create_params(self):\n\n params = {'time_step':\n DesignParameter('time_step',\n ... | [
"0.62245953",
"0.5888847",
"0.58526623",
"0.5849212",
"0.5822714",
"0.58221775",
"0.5781203",
"0.5777564",
"0.5773237",
"0.5772776",
"0.56936353",
"0.5680619",
"0.5652024",
"0.56221527",
"0.5605901",
"0.55968076",
"0.55854803",
"0.5569553",
"0.55390006",
"0.5526068",
"0.55144... | 0.57614726 | 10 |
Striped_strings property returns a collection containing the values. Then ve do a string join to have the actual value in the tag. The value might me missing, then we simply return 1 to indicate that it is missing. | def get_column_content(self, col_name):
column = self.get_column(col_name)
return "".join(column.stripped_strings if column else '-1') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v3_lstrip(iterable, strip_value):\n stripped = []\n iterator = iter(iterable)\n for item in iterator:\n if not item == strip_value:\n stripped.append(item)\n break\n for item in iterator:\n stripped.append(item)\n return stripped",
"def _get_string_list(prop... | [
"0.58035886",
"0.57048833",
"0.56560856",
"0.5639151",
"0.5630653",
"0.5615534",
"0.5601351",
"0.5446379",
"0.5438527",
"0.53921944",
"0.5380898",
"0.5303354",
"0.52037483",
"0.5190159",
"0.5187792",
"0.5156361",
"0.5136496",
"0.5131428",
"0.51241857",
"0.5114384",
"0.5075279... | 0.0 | -1 |
Return a humanreadable string representation of WordLadderPuzzle self. >>> word_set = {'came', 'case', 'cast', 'cost'} >>> s = WordLadderPuzzle("same", "cost", word_set) >>> print(s) same | def __str__(self):
return self._from_word | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n s = 'word chain: ' + '\\n'\n for word in self._used_words[:-1]:\n s += word + ' -> '\n s += self._used_words[-1] + '\\ntarget word: ' + self._target\n return s",
"def __str__(self):\n return \"{}\".format(self.word)",
"def __str__(self):\n ... | [
"0.6443087",
"0.6166379",
"0.5945324",
"0.58940065",
"0.58132815",
"0.5726692",
"0.5648855",
"0.56334305",
"0.56298417",
"0.55592585",
"0.55035686",
"0.545139",
"0.5418145",
"0.53970534",
"0.53718996",
"0.5365691",
"0.5361978",
"0.5337131",
"0.53159505",
"0.5311875",
"0.52996... | 0.57035494 | 6 |
Return a set of words that have only a 1 letter difference from self._from_word. | def _usable_word(self, filtered_words):
usable = set()
for word in filtered_words:
counter = 0
for x in range(0, len(self._to_word)):
if word[x] == self._from_word[x]:
counter += 1
if counter == len(self._to_word) - 1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _filter_len(self):\n if max([len(x) for x in self._word_set]) == len(self._to_word):\n return self._word_set\n else:\n new_words = set()\n for word in self._word_set:\n if len(self._from_word) == len(word):\n new_words.add(wor... | [
"0.7564018",
"0.7253468",
"0.7019372",
"0.6698631",
"0.65932465",
"0.65893596",
"0.657932",
"0.6423912",
"0.63638264",
"0.6338391",
"0.6285232",
"0.6269638",
"0.6241825",
"0.62410265",
"0.619664",
"0.617954",
"0.6171622",
"0.6142555",
"0.61354405",
"0.6106691",
"0.60239637",
... | 0.7070042 | 2 |
Return a set of words that have the same length as self.to_word | def _filter_len(self):
if max([len(x) for x in self._word_set]) == len(self._to_word):
return self._word_set
else:
new_words = set()
for word in self._word_set:
if len(self._from_word) == len(word):
new_words.add(word)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_words(self) -> set:\n\n words = set()\n max_word_length = int(self._restrictions['max-word-length'])\n\n def _reduce(seq):\n if self.is_word(seq):\n if len(seq) <= max_word_length and seq not in words:\n words.add(seq)\n else... | [
"0.73675174",
"0.69533366",
"0.6853156",
"0.65112805",
"0.6488525",
"0.64814836",
"0.64639664",
"0.6414775",
"0.63438076",
"0.63058966",
"0.630367",
"0.6275688",
"0.6263274",
"0.62550193",
"0.6243239",
"0.6229005",
"0.6210931",
"0.61195016",
"0.60820806",
"0.6058539",
"0.6031... | 0.84259343 | 0 |
Check User in Collection | def __is_in_collection(outer_ref, collection_id):
# NOTE: This function assume 'pending' users are members of the collection.
# So, 'pending' users don't appear on InviteToCollectionModal
return Exists(
CollectionUser.objects.filter(
user_id=OuterRef(outer_ref),
collect... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_in_users(self, obj):\n try:\n user = self.context.get('request').user\n except Exception:\n # raise serializers.ValidationError('Could not access request.user')\n return False\n if user in obj.users.all():\n return True\n else:\n ... | [
"0.7313537",
"0.6969482",
"0.68877155",
"0.6860244",
"0.67789567",
"0.6742425",
"0.66531026",
"0.6640406",
"0.6616553",
"0.65534395",
"0.65318877",
"0.6520356",
"0.6496326",
"0.646663",
"0.6405832",
"0.63929075",
"0.638589",
"0.6385705",
"0.63587505",
"0.6312121",
"0.630605",... | 0.68444026 | 4 |
generates a word cloud from a frequency dictionary Returns Nothing. Just plots | def show_wordcloud(dictionary, title, min_font = 10):
wordcloud = WordCloud(min_font_size=min_font).generate_from_frequencies(dictionary)
plt.figure(figsize = (8, 8), facecolor = None)
plt.imshow(wordcloud)
plt.axis("off")
if title:
plt.title(title)
else:
plt.title("Word Cloud... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_wordcloud(dict_, title='WordCloud', PATH=None):\n wordcloud = WordCloud(min_font_size=10).generate_from_frequencies(dict_)\n plt.figure(figsize = (8, 8), facecolor = None) \n plt.imshow(wordcloud) \n plt.axis(\"off\") \n plt.title(title, size = 24)\n plt.tight_layout(pad = 0) \n ... | [
"0.8156106",
"0.81525457",
"0.7833126",
"0.77686065",
"0.76240915",
"0.7414217",
"0.72868174",
"0.719459",
"0.7191933",
"0.7142261",
"0.71361864",
"0.7087378",
"0.7019183",
"0.6924474",
"0.68359894",
"0.6788049",
"0.67832327",
"0.6723869",
"0.67223465",
"0.6586507",
"0.652308... | 0.7821376 | 3 |
Given a dataframe, returns a set of words that are unique to the the clickbait data set and then a list of all the words used in the clickbait dataset | def get_difference(df, click_as_base=True):
click_corpus = " ".join(df[df.target==1].title.to_list())
non_corpus = " ".join(df[df.target==0].title.to_list())
tokenizer = RegexpTokenizer(r'[a-zA-Z0-9]+')
click_tokenized = tokenizer.tokenize(click_corpus)
non_tokenized = tokenizer.tokenize(n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_vocabulary(df: pd.DataFrame,\r\n token_field: str) -> Set[str]:\r\n\r\n voc = set()\r\n for _, tokens in df[token_field].items():\r\n voc |= set(tokens.split())\r\n return voc",
"def gen_bag_of_words_df(self):\n\t\tdef word_vector(doc_text):\n\t\t\tfreqs = pd.Ser... | [
"0.64377266",
"0.63648236",
"0.6319719",
"0.62900835",
"0.6242982",
"0.6238721",
"0.6235005",
"0.62043214",
"0.61623836",
"0.61290145",
"0.60729104",
"0.60151345",
"0.5958198",
"0.5956078",
"0.5944938",
"0.5939083",
"0.59301823",
"0.5926749",
"0.5925822",
"0.59048325",
"0.588... | 0.55409735 | 45 |
Test creating a new tag invalid payload | def test_create_tag_invalid(self):
payload = {'name': ''}
res = self.client.post(TAGS_URL, payload)
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_tag_invalid_payload(self):\n\n tag_payload = {'name': ''}\n response = self.client.post(URL_TAGS, tag_payload)\n\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)",
"def test_create_tag_invalid(self):\n payload = {'name':''}\n res = self.clie... | [
"0.8740486",
"0.85598385",
"0.8518836",
"0.8371665",
"0.8279957",
"0.8209688",
"0.81831217",
"0.8038488",
"0.784658",
"0.70604944",
"0.7041213",
"0.69292206",
"0.6862325",
"0.6806251",
"0.68046236",
"0.6799125",
"0.678763",
"0.67488366",
"0.67352617",
"0.67233664",
"0.6723366... | 0.84547246 | 3 |
Returns the SHA256 checksum of the file given (base64 encoded). | def GetFileSha256(file_path):
return base64.b64encode(GetFileHashes(file_path, do_sha256=True)['sha256']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checksum(file):\n\n cksm = hashlib.sha256()\n f = open(file, 'rb')\n try:\n cksm.update(f.read())\n finally:\n f.close()\n return cksm.hexdigest()",
"def get_checksum(file_path: str) -> str:\n\n # Open the file in binary mode\n with open(file_path, \"rb\") as file:\n ... | [
"0.79229546",
"0.78501946",
"0.7746277",
"0.7687252",
"0.76602024",
"0.75760615",
"0.74912596",
"0.74302036",
"0.7329181",
"0.7277499",
"0.72531855",
"0.72437584",
"0.72040826",
"0.7184004",
"0.7147594",
"0.7092289",
"0.7082789",
"0.70748854",
"0.7060559",
"0.70354915",
"0.69... | 0.7521518 | 6 |
Compares the frame size, the current frame position and screen size to make sure the frame will not be off the screen. Returns a tuple for the recommended location to draw the frame. | def _CheckBoundaries(self, frameSize):
if (frameSize[0] + self.frame_position[0] > self.display_size[0]):
return (0, self.frame_position[1])
elif (frameSize[1] + self.frame_position[1] > self.display_size[1]):
return (self.frame_position[0], 0)
else:
return se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_position(self):\n\n width = self.screen.get_width()\n height = self.screen.get_height()\n\n if self.last_screen_dimensions[\"width\"] > width:\n self.x -= self.last_screen_dimensions[\"width\"] - width\n\n if self.last_screen_dimensions[\"height\"] > height:\n ... | [
"0.62699336",
"0.60566276",
"0.5991966",
"0.5894915",
"0.58332956",
"0.57216084",
"0.5716618",
"0.5710109",
"0.55931646",
"0.557216",
"0.55460036",
"0.55398494",
"0.5524983",
"0.5524539",
"0.547536",
"0.5455707",
"0.5452616",
"0.5452616",
"0.5452616",
"0.54239136",
"0.5398792... | 0.74325615 | 0 |
Return a friendly HTTP greeting. | def hello():
return redirect( 'http://plus.google.com/hangouts/_?gid=504880202642') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_greeting(name):\n\n greeting = (f\"Hello, {name.title()}. It's nice to meet you!\")\n return greeting",
"def welcome():\n return 'Welcome to Flask!'",
"def greeting_message(name):\n print('My name is ' + name)",
"def Welcome():\n return (\n f\"Welcome to the Surf's Up API!\... | [
"0.67860854",
"0.6719625",
"0.67095745",
"0.6680697",
"0.6663219",
"0.6638394",
"0.6633062",
"0.6628187",
"0.6556032",
"0.6536937",
"0.64776874",
"0.6477268",
"0.64715713",
"0.64644194",
"0.6443056",
"0.6435385",
"0.6400719",
"0.6400167",
"0.637615",
"0.637615",
"0.6367243",
... | 0.0 | -1 |
Return a custom 404 error. | def page_not_found(e):
return 'Sorry, nothing at this URL.', 404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found():\n return HttpError(404)",
"def error_404(error):\n return '404 Error'",
"def error_404(error):\n return 'Bummer, there is nothing at this URL.'",
"def error_not_found(error):\n return 'No page here, dood. 404!', 404",
"def not_found(self, error):\n return jsonify({'error': 'NO... | [
"0.81159586",
"0.80410045",
"0.7738874",
"0.77369535",
"0.77182025",
"0.7689595",
"0.7670471",
"0.76112473",
"0.7602477",
"0.7570698",
"0.75528365",
"0.7545827",
"0.751882",
"0.74745256",
"0.7458403",
"0.7455682",
"0.74548143",
"0.74505144",
"0.7442062",
"0.7428278",
"0.74065... | 0.72672606 | 32 |
Implementations should return the picked Card. Implementations do not need to modify the state of either pack or cards_owned, as doing so will have no effect on the draft state. | def pick(self, pack, cards_owned, draft_info):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pick(self, pack):\n pack_snapshot = pack.copy()\n self.pack_history.append(pack_snapshot)\n pick = self.picker.pick(pack=pack.copy(), cards_owned=self.cards_owned.copy(),\n draft_info=self.draft_info)\n if pick not in pack:\n raise ValueErro... | [
"0.76838326",
"0.6825221",
"0.6793747",
"0.67752796",
"0.6736578",
"0.67113924",
"0.6698645",
"0.6603883",
"0.6535573",
"0.65354216",
"0.6496724",
"0.64913267",
"0.64858073",
"0.64618117",
"0.64326394",
"0.64260566",
"0.64202696",
"0.64005154",
"0.6397875",
"0.63839555",
"0.6... | 0.8040742 | 0 |
Gets a specific pack. | def get_pack(self, phase, starting_seat):
return self.pack_contents[phase][starting_seat] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_pack(self) -> Optional[\"Pack\"]:\n if in_pack := self.relationships_data[RelationshipType.IN_PACK]:\n return next(iter(in_pack)).content_item_to # type: ignore[return-value]\n if pack_name := get_pack_name(self.path):\n try:\n return BaseContent.from_path... | [
"0.6788025",
"0.5921868",
"0.58694893",
"0.58069396",
"0.56572485",
"0.55551755",
"0.5537732",
"0.55188537",
"0.5504289",
"0.5491168",
"0.5444167",
"0.5382346",
"0.53364575",
"0.53132397",
"0.5296711",
"0.52890855",
"0.5283959",
"0.5281558",
"0.5276842",
"0.52388155",
"0.5236... | 0.6934694 | 0 |
String representation of a task type. | def __str__(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"%s (uuid %s)\" % (self.task_type, self.uuid)",
"def task_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"task_type\")",
"def task_type(self):\n pass",
"def getTypeString(self):\n return '_'.join(self.types)",
"def typestr(self) -> str:\... | [
"0.7758303",
"0.7387275",
"0.71911246",
"0.70873094",
"0.6961181",
"0.6949215",
"0.69232684",
"0.6907792",
"0.68801975",
"0.6752577",
"0.6692734",
"0.66890264",
"0.6659521",
"0.661265",
"0.66110766",
"0.6565268",
"0.6564841",
"0.64726967",
"0.64726967",
"0.64726967",
"0.64469... | 0.0 | -1 |
String representation of a queue. | def __str__(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n data_str = [str(i) for i in self._data]\n return \"QUEUE { \" + \", \".join(data_str) + \" }\"",
"def __str__(self):\n data_str = [str(i) for i in self._data]\n return \"QUEUE { \" + \", \".join(data_str) + \" }\"",
"def __str__(self) -> str:\n out = \"QU... | [
"0.853821",
"0.853821",
"0.8092509",
"0.80885607",
"0.8027276",
"0.80256367",
"0.80084026",
"0.7982617",
"0.7931276",
"0.7391152",
"0.7273981",
"0.7199422",
"0.7006355",
"0.6983695",
"0.68752",
"0.6728898",
"0.6605375",
"0.66007745",
"0.66007745",
"0.6579468",
"0.64870614",
... | 0.0 | -1 |
Initialize a PointInfos instance. | def __init__(self, column_id, text: str = ""):
super(PointInfos, self).__init__(column_id, INFOSTYPE.POINT, True)
self.text = text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, points):\n self.points = points\n self.init()",
"def __init__(self, points):\n\t\tself.points = points",
"def __init__(self, x, y, n_points):\n\n self.x = x\n self.y = y\n self.n_points = n_points",
"def __init__(self, x=0, y=0):\n self.x = x\n ... | [
"0.6748178",
"0.6431932",
"0.63474303",
"0.63078725",
"0.62677866",
"0.6247885",
"0.61614525",
"0.60047483",
"0.5976132",
"0.5936122",
"0.58912504",
"0.5886038",
"0.5824213",
"0.57992244",
"0.5798605",
"0.5763191",
"0.5756328",
"0.5739071",
"0.5726423",
"0.57262194",
"0.57044... | 0.5793754 | 15 |
Initialize a GraphVisualizerItem instrance. | def __init__(self):
super(GraphVisualizerItem, self).__init__()
self.connected = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, from_item: GraphVisualizerItem,\n to_item: GraphVisualizerItem):\n self.from_item = from_item\n self.to_item = to_item",
"def __init__(self, item: Any, kind: str) -> None:\n self.item = item\n self.kind = kind\n self.neighbours = {}",
"def _... | [
"0.62275034",
"0.5771456",
"0.56162137",
"0.5596011",
"0.5509453",
"0.5509453",
"0.5503991",
"0.54283464",
"0.53921324",
"0.5374222",
"0.53728133",
"0.53319925",
"0.53288233",
"0.5322643",
"0.53222656",
"0.5318378",
"0.53075576",
"0.5293332",
"0.5284854",
"0.52603453",
"0.525... | 0.70889556 | 0 |
Initialize a GraphVisualizerPointDraw instance. | def __init__(self):
super(GraphVisualizerPointDraw, self).__init__()
self.setMinimumSize(QSize(13, 13))
self.setMaximumSize(QSize(13, 13)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n super(GraphVisualizerPoint, self).__init__()\n self._layout = QGridLayout()\n self.setLayout(self._layout)\n\n self._point_draw = GraphVisualizerPointDraw()\n self._layout.addWidget(self._point_draw, 0, 0)\n\n self._label = MathTextLabel()\n se... | [
"0.75859874",
"0.6617352",
"0.6617352",
"0.65049016",
"0.6255288",
"0.6201817",
"0.6151341",
"0.6131802",
"0.61238134",
"0.6103376",
"0.6056957",
"0.6030426",
"0.6027405",
"0.59707546",
"0.5967986",
"0.5960368",
"0.58951384",
"0.58747333",
"0.58336455",
"0.57774174",
"0.57514... | 0.6914623 | 1 |
Initialize a GraphVisualizerPoint instance. | def __init__(self):
super(GraphVisualizerPoint, self).__init__()
self._layout = QGridLayout()
self.setLayout(self._layout)
self._point_draw = GraphVisualizerPointDraw()
self._layout.addWidget(self._point_draw, 0, 0)
self._label = MathTextLabel()
self._layout.add... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_point(infos: PointInfos):\n point = GraphVisualizerPoint()\n point.connected = infos.connected\n point.set_text(infos.text)\n return point",
"def __init__(self, point=None):\n\t\tif point is None:\n\t\t\tpoint = (0,0)\n\t\tself.x = point[0]\n\t\tself.y = point[1]",
"def __init__(self):\... | [
"0.6755393",
"0.6744736",
"0.6580432",
"0.6520962",
"0.64632225",
"0.64632225",
"0.64151347",
"0.6250936",
"0.62261546",
"0.6135081",
"0.61144185",
"0.6043955",
"0.5984474",
"0.5920987",
"0.5920127",
"0.5918752",
"0.5898888",
"0.58976734",
"0.58871645",
"0.58871645",
"0.58627... | 0.76045305 | 0 |
Initialize a GraphVisualizerTimeline instance. | def __init__(self, grid, column_id, column_span=1):
super(GraphVisualizerTimeline, self).__init__(
grid, column_id, column_span)
for i in range(column_span):
self._grid.setColumnStretch(self._column_id + i, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, viewer: geoviewer.GeoGraphViewer) -> None:\n super().__init__(viewer=viewer)\n\n widget = self._create_timeline_controls()\n self.children = [widget]",
"def initialize_visualization(self) -> None:\n pass",
"def init_diagram(self):\n\n # Create a canvas for ... | [
"0.65410763",
"0.64242977",
"0.6336533",
"0.5944275",
"0.5915312",
"0.5915312",
"0.5839315",
"0.5812654",
"0.57957613",
"0.5743333",
"0.5664609",
"0.56448287",
"0.5533911",
"0.5507519",
"0.5503943",
"0.550081",
"0.5491915",
"0.5445125",
"0.54233706",
"0.5409379",
"0.5396696",... | 0.4906394 | 95 |
Render this widget in a picture and save it a filename. | def saveAsPicture(self, filename):
pixmap = QPixmap(self.size())
self.render(pixmap)
if not pixmap.save(filename):
print("Can't save as " + filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, fileName, *args):\n if self._renderRequired:\n self.render()\n self.qimage.save(fileName, *args)",
"def plot_into_img_widget(img_widget, figure):\n buf = cStringIO.StringIO()\n figure.savefig(buf, format='png', dpi=__dpi__)\n img_widget.value = buf.getvalue()\n ... | [
"0.6818394",
"0.66202605",
"0.6562862",
"0.65573454",
"0.65543747",
"0.6519556",
"0.6508477",
"0.64649343",
"0.64530504",
"0.64391905",
"0.6366751",
"0.6350355",
"0.63497293",
"0.63495547",
"0.6294648",
"0.62620676",
"0.6260106",
"0.6258038",
"0.62221724",
"0.6140853",
"0.613... | 0.7297058 | 0 |
Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter dicts. | def merge_dicts(*dict_args):
result = {}
for dictionary in dict_args:
result.update(dictionary)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _merge_dicts(*args):\n return reduce(lambda d, s: d.update(s) or d, args)",
"def _merge_dicts(*args):\n return reduce(lambda d, s: d.update(s) or d, args)",
"def merge_dict(lhs, rhs, override=True):\n if not isinstance(lhs, dict) or not isinstance(rhs, dict):\n if override:\n retur... | [
"0.76676226",
"0.7661076",
"0.74781454",
"0.74528927",
"0.74528927",
"0.74528927",
"0.73743427",
"0.73391306",
"0.73064536",
"0.72796404",
"0.7273245",
"0.72545314",
"0.7230961",
"0.72210413",
"0.7216889",
"0.71992224",
"0.7181106",
"0.71770334",
"0.71742785",
"0.71636385",
"... | 0.7252352 | 16 |
Load all extensions which are required by the user to load | def load_extensions(self, config):
loaded_extensions = []
for extension in self.extensions:
load_func = getattr(extension, "load")
loaded_extension = load_func(config)
if loaded_extension:
loaded_extensions.append(loaded_extension)
return loade... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_extensions(self):\n extension_module_name = f\"{utils.get_project_name()}.cogs\"\n for extension in CONF.LOADED_EXTENSIONS:\n try:\n self.load_extension(extension_module_name + \".\" + extension)\n LOG.debug(f\"The extension '{extension.split('.')[0]}... | [
"0.7763833",
"0.7615887",
"0.74021053",
"0.71718055",
"0.7136575",
"0.70058113",
"0.6894489",
"0.6847941",
"0.6838638",
"0.6804242",
"0.6695531",
"0.6665538",
"0.659622",
"0.6540209",
"0.6473324",
"0.64522743",
"0.64522743",
"0.6440379",
"0.6306849",
"0.62731737",
"0.6266745"... | 0.6885248 | 7 |
Returns an MLReader instance for this class. | def read(cls):
return JavaMMLReader(cls) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_reader(self) -> SpectrumReader:\n # Get the reader class\n reader_class = self.get_reader_class()\n\n # Get the common options between ourselves and the reader class\n common_options = self.get_common_options(reader_class)\n\n # Get the options sub-list corresponding to t... | [
"0.67606074",
"0.65719575",
"0.6528666",
"0.6503996",
"0.60503477",
"0.5873765",
"0.586067",
"0.5854983",
"0.58386725",
"0.5770769",
"0.577049",
"0.5730291",
"0.56816494",
"0.56610745",
"0.5620556",
"0.55785227",
"0.5539242",
"0.550706",
"0.5463413",
"0.5425498",
"0.5414667",... | 0.7062961 | 3 |
Build an actor (policy) network that maps states > actions. | def forward(self, state):
x = f.relu(self.fc1(state))
x = f.relu(self.fc2(x))
return torch.tanh(self.fc3(x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_actor_network(states, num_controls, params, scope_name):\n scope_key = scope_name + '/'\n with tf.variable_scope(scope_name):\n hidden_1 = tf.layers.dense(states,\n units=params.actor_hidden_units[0],\n activation=None,\n ... | [
"0.69356495",
"0.636351",
"0.6270465",
"0.62087923",
"0.62009275",
"0.6187312",
"0.61473614",
"0.6146225",
"0.6128509",
"0.60179603",
"0.6002386",
"0.5976266",
"0.5959938",
"0.5952642",
"0.594925",
"0.59280884",
"0.5916518",
"0.5898108",
"0.58937097",
"0.5891148",
"0.5880467"... | 0.0 | -1 |
Test the chemistry.get_atomic_mass function. | def test_atomic_masses():
first = get_atomic_mass("As")
assert first == 74.9216
second = get_atomic_mass("Be")
assert second == 9.012182
third = get_atomic_mass("Li")
assert third == 6.941 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mass(atomic_symbol: str) -> float:\n\n if atomic_symbol in _masses.keys():\n return _masses[atomic_symbol]\n\n else:\n return 0",
"def test_get_mass(self):\n self.assertEqual(get_element_mass(1), (1.00782503224, 1)) # test input by integer\n self.assertEqual(get_element... | [
"0.73009044",
"0.717684",
"0.69657695",
"0.6578779",
"0.64884204",
"0.6460955",
"0.6410369",
"0.6404469",
"0.64009523",
"0.6333164",
"0.6325908",
"0.6276191",
"0.6276191",
"0.6268116",
"0.6245157",
"0.6212941",
"0.61573255",
"0.6141217",
"0.60984826",
"0.6093991",
"0.6090203"... | 0.79807025 | 0 |
Test the chemistry.molar_mass function. | def test_molar_mass():
first = molar_mass({"H":2, "O":1})
assert first == approx(18.01528)
second = parse_formula("C6H6")
test2 = molar_mass(second)
assert test2 == approx(78.11184)
third = parse_formula("PO4H2(CH2)12CH3")
test3 = molar_mass(third)
assert test3 == approx(280.34072) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_molar_mass_method2(collector):\n avg_temp = collector.get_average_temperature()\n avg_acceleration = collector.get_average_acceleration()\n altitude_list = []\n pressure_list = []\n for altitude, pressure in\\\n collector.get_iter('altitude', 'pressur... | [
"0.7200422",
"0.7113103",
"0.7098997",
"0.68066984",
"0.67758876",
"0.6676997",
"0.6582131",
"0.6577683",
"0.6494286",
"0.64449984",
"0.6430646",
"0.63485456",
"0.6336825",
"0.6316596",
"0.62221843",
"0.6165858",
"0.6103163",
"0.6103086",
"0.6049905",
"0.6046541",
"0.6025953"... | 0.8190447 | 0 |
View for mainsite homepage | def home(request):
context = {
}
return render(request, 'classroom_main/home.html', context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage(request):\n\treturn render(request, 'core/homepage.html')",
"def homepage(request):\n return render_to_response('h1ds_core/homepage.html', \n context_instance=RequestContext(request))",
"def homepage(request):\n \n return render(request, 'homepage.html')",
"... | [
"0.8234824",
"0.80371505",
"0.80331784",
"0.798823",
"0.7933397",
"0.792083",
"0.78708285",
"0.7845517",
"0.7836334",
"0.78064257",
"0.7797392",
"0.7795665",
"0.7795665",
"0.77552426",
"0.77229136",
"0.7694404",
"0.7684144",
"0.7677106",
"0.7660346",
"0.76563215",
"0.76548594... | 0.0 | -1 |
Initialize the kinematic wave approximation overland flow component. | def __init__(
self,
grid,
mannings_n=0.03,
critical_flow_depth=0.003,
mannings_epsilon=0.33333333,
dt_max=0.3,
max_courant=0.2,
min_surface_water_depth=1.0e-8,
):
super().__init__(grid)
if not isinstance(self.grid, RasterModelGrid):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(self):\n\n self.local_energy = 0.0\n self.accumulate_energy = 0.0\n self.accumulate_energy_sq = 0.0\n self.variance = 0.0\n self.accumulate_psi_term_a = np.zeros(self.w.M)\n self.accumulate_psi_term_b = np.zeros(self.w.N)\n self.accumulate_psi_term_W ... | [
"0.6058061",
"0.59440124",
"0.5927352",
"0.5926608",
"0.5889213",
"0.58289695",
"0.5780014",
"0.57795745",
"0.5776145",
"0.5762416",
"0.5761065",
"0.5662212",
"0.5604611",
"0.55712503",
"0.5551436",
"0.55354273",
"0.5533688",
"0.5528719",
"0.55160666",
"0.5512363",
"0.5496844... | 0.0 | -1 |
Return the internal timestep last used by the kinematic wave component. | def internal_timestep(self):
try:
return self._internal_dt
except AttributeError:
# the component hasn't started running yet
_ = self.calc_grads_and_timesteps(False, False)
return self._internal_dt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time_step(self):\n return self._time_step",
"def time_step(self):\n return self._time_step",
"def timeStep(self):\n return self.params['h']",
"def current_time_step(self) -> ts.TimeStep:\n return self._current_time_step",
"def time_step(self) -> float:\n return self._... | [
"0.77051383",
"0.7520721",
"0.74067354",
"0.73053396",
"0.7284239",
"0.7281953",
"0.72694445",
"0.7145921",
"0.7131391",
"0.71231157",
"0.7015101",
"0.70028824",
"0.69709486",
"0.68870324",
"0.68284035",
"0.6819178",
"0.68108886",
"0.6797008",
"0.67548555",
"0.67242724",
"0.6... | 0.7407805 | 2 |
Get number of bytes of available physical memory | def mem_avail():
return psutil.virtual_memory().available | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def memory():\n sin = psutil.virtual_memory()\n return round((sin.total / sin.used) / 100, 3)",
"def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024",
"def get_total_memory_size(self):\n return self.drt_manager.get_total_memory_size()",
"def num_total_physical_bytes(self) -> ... | [
"0.78198177",
"0.7636939",
"0.7633274",
"0.75404435",
"0.75327307",
"0.7504551",
"0.74963623",
"0.74935097",
"0.74183565",
"0.737662",
"0.73664224",
"0.7342108",
"0.73370886",
"0.7299179",
"0.7273545",
"0.7271277",
"0.7245362",
"0.722916",
"0.72181064",
"0.7202748",
"0.718736... | 0.8225343 | 0 |
Create temporary file in desired directory. Creates and returns a temporary file in the first directory in `tempdirs` (str). Upon failure, try the next directory etc. Use the default temporary directory if all `tempdirs` fail. `kwargs` are passed on to `tempfile.TemporaryFile`. | def open_tempfile(*tempdirs, **kwargs):
for d in tempdirs:
try:
os.makedirs(d, mode=0o775, exist_ok=True)
return tempfile.TemporaryFile(dir=d, **kwargs)
except Exception:
continue
return tempfile.TemporaryFile(**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def temp_dir(**kwargs):\n temp_dir = tempfile.mkdtemp(**kwargs)\n try:\n yield temp_dir\n finally:\n # Cleanup\n # ermm... this is breaking something (maybe bootstrapping replicates?), so leaving out for now\n #shutil.rmtree(temp_dir)\n pass",
"def create_temp_dir(self... | [
"0.7424176",
"0.73316854",
"0.70917237",
"0.70126164",
"0.68205434",
"0.67668426",
"0.6643465",
"0.66383994",
"0.6634261",
"0.6601985",
"0.6530802",
"0.6491502",
"0.6449897",
"0.6437427",
"0.6357723",
"0.63290477",
"0.6317656",
"0.6315562",
"0.6282278",
"0.62794626",
"0.62711... | 0.85400444 | 0 |
Construct the NullNet object Input data (probably placeholders) must be defined elsewhere and fed as an argument. Always predicts rare class and has adapter defined precision | def __init__(self, input_placeholder, server, trivial_prob):
self.logits = self._get_null_logits(input_placeholder)
self.precision = (1-trivial_prob)*server.adapter.frequencies[1]
self.prior_threshold = 0.5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n # TODO\n self.confThreshold = 0.6\n self.nmsThreshold = 0.5\n self.inpWidth = 320\n self.inpHeight = 320\n classesFile = \"/content/drive/My Drive/tracking_course/Detection/yolo_workshop/coco.names\"\n self.classes = None\n with open(cla... | [
"0.6038519",
"0.5988296",
"0.5939648",
"0.586143",
"0.586008",
"0.5843995",
"0.5836656",
"0.58160853",
"0.58051074",
"0.57842165",
"0.57726204",
"0.57658315",
"0.5763554",
"0.5755215",
"0.57515055",
"0.574018",
"0.5722687",
"0.57153654",
"0.57067364",
"0.57067186",
"0.5693238... | 0.58966476 | 3 |
Residual unit with 2 sub layers. | def build(self, input_tensors, is_training, lengths=None, hparams=None):
input_tensor = input_tensors[-1]
net = tf_slim.conv2d(
input_tensor,
get_channel_dim(input_tensor),
kernel_size=self._kernel_size,
padding='same')
# Batch norm
if self._apply_batch_norm:
net =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _residual(self, x):\n h = x\n h = self.c1(h)\n h = self.activation(h)\n h = self.c2(h)\n h = F.avg_pool2d(h, 2)\n\n return h",
"def _compute_residuals(self):\n residuls = self.I - self.E\n return residuls",
"def _residual(self, x):\n h = x\n ... | [
"0.69261235",
"0.68209535",
"0.68047327",
"0.67518735",
"0.66490114",
"0.66150963",
"0.65589684",
"0.64988285",
"0.6449884",
"0.6403135",
"0.63582915",
"0.635291",
"0.6267276",
"0.6245287",
"0.62397623",
"0.62290406",
"0.6212799",
"0.6205259",
"0.6204095",
"0.61980945",
"0.61... | 0.0 | -1 |
Initializes a new FullyConnectedBlock instance. | def __init__(self,
max_output_size=100,
max_number_of_parameters=None,
apply_batch_norm=False,
residual_connection_type=None):
self._max_number_of_parameters = max_number_of_parameters
self._max_output_size = max_output_size
self._apply_batch_norm ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n\n pyxel.init(windowWidth, windowHeight)\n\n # generates randomly ordered list of [0, 1, 2, 3, 4, 5, 6, 7]\n self.bag = sample(list(range(7)), 7)\n\n # generates a block from last element of self.bag into self.blocks\n self.block = Block(blockData[self.bag.po... | [
"0.6375045",
"0.63155633",
"0.6205637",
"0.6123446",
"0.6112053",
"0.60518533",
"0.60507935",
"0.59825015",
"0.5976347",
"0.5964686",
"0.59585613",
"0.5949089",
"0.59431344",
"0.5924309",
"0.5913724",
"0.58949697",
"0.58938307",
"0.58886415",
"0.58785456",
"0.5864734",
"0.585... | 0.0 | -1 |
Returns a ReLU activated output of a residual unit with 2 sub layers. | def build(self, input_tensors, is_training, lengths=None, hparams=None):
input_tensor = input_tensors[-1]
net1 = tf_slim.conv2d(
input_tensor,
get_channel_dim(input_tensor),
kernel_size=self._kernel_size,
padding='same')
net = tf.nn.leaky_relu(net1)
net1 = tf_slim.conv2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_output(self, X):\n return ReLU(X)",
"def lrelu(self):\n return self.add_layer(lrelu)",
"def residual(self, input_layer, net, scale=1.0, activation='RELU'):\n input_size = input_layer.get_shape().as_list()\n num_inputs = input_size[1]\n output_layer = scale*n... | [
"0.65363574",
"0.6370599",
"0.6304807",
"0.61816233",
"0.6135286",
"0.61301523",
"0.612269",
"0.609488",
"0.60292345",
"0.59595597",
"0.58871776",
"0.5868836",
"0.5862131",
"0.5849533",
"0.5842736",
"0.5821255",
"0.5816896",
"0.5799416",
"0.57972986",
"0.5794399",
"0.5740785"... | 0.0 | -1 |
Return a list of the marginal sums of the array `a`. | def margins(a):
margsums = []
ranged = list(range(a.ndim))
for k in ranged:
marg = np.apply_over_axes(np.sum, a, [j for j in ranged if j != k])
margsums.append(marg)
return margsums | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marginalize(counts):\n\t# Sum columns\n\tx_counts = np.sum(counts, axis=0)\n\t# Sum rows\n\ty_counts = np.sum(counts, axis=1)\n\n\tmarginalized = {'theta_1': x_counts, 'theta_2': y_counts}\n\n\treturn marginalized",
"def _gu_sum(a, **kwds):\n return np.sum(np.ascontiguousarray(a), axis=-1, **kwds)",
"de... | [
"0.5666632",
"0.55615926",
"0.53328514",
"0.5291185",
"0.5247989",
"0.5226415",
"0.5217838",
"0.51923466",
"0.5190949",
"0.51617724",
"0.5132572",
"0.5116769",
"0.51132923",
"0.5109619",
"0.49790365",
"0.49684235",
"0.49497002",
"0.4921646",
"0.491476",
"0.49138618",
"0.49118... | 0.74824923 | 0 |
Equality defintion for Transactions. | def __eq__(self, other: Any) -> bool:
if not isinstance(other, Transaction):
return False
return self.to_solders() == other.to_solders() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testEquality(self):\n pass",
"def __eq__(self, other):\n if not isinstance(other, Transaction):\n return False\n\n return self.to_dict() == other.to_dict()",
"def __ne__(self, other):\n if not isinstance(other, Transaction):\n return True\n\n return ... | [
"0.72660077",
"0.70184404",
"0.6772607",
"0.66662204",
"0.65395606",
"0.6488299",
"0.64835006",
"0.6458658",
"0.64508736",
"0.6428557",
"0.6416875",
"0.6341",
"0.6312717",
"0.6276016",
"0.6275204",
"0.6236366",
"0.6223811",
"0.621318",
"0.621318",
"0.621318",
"0.621318",
"0... | 0.71351165 | 1 |
The first (payer) Transaction signature. | def signature(self) -> Signature:
return self._solders.signatures[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_signature(self):\n sig_contents = \\\n self.payload + \".\" + \\\n b64encode(b\"application/xml\").decode(\"ascii\") + \".\" + \\\n b64encode(b\"base64url\").decode(\"ascii\") + \".\" + \\\n b64encode(b\"RSA-SHA256\").decode(\"ascii\")\n sig_hash... | [
"0.70304936",
"0.7001362",
"0.68414944",
"0.6758097",
"0.66976327",
"0.66976327",
"0.66976327",
"0.6685535",
"0.66406214",
"0.66311413",
"0.65526676",
"0.6507908",
"0.64227",
"0.64227",
"0.6405552",
"0.63906175",
"0.6367432",
"0.63081545",
"0.63063955",
"0.62794757",
"0.62572... | 0.7273676 | 0 |
Get raw transaction data that need to be covered by signatures. | def serialize_message(self) -> bytes:
return self.compile_message().serialize() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sign_data(self):\n # TODO: Include more members in sign data.\n data = apply_sha256(self.sender + self.receiver + str(self.amount))\n return data",
"def get_raw_data(self):\r\n \r\n return(self.return_data)",
"def raw_get_transaction(cls, txid):\n r = requests.... | [
"0.6408698",
"0.5938417",
"0.5903179",
"0.5740833",
"0.56487834",
"0.56470317",
"0.5608596",
"0.5608596",
"0.5595747",
"0.5534429",
"0.55149513",
"0.5500302",
"0.54965436",
"0.54884875",
"0.54768354",
"0.54768354",
"0.54768354",
"0.542486",
"0.5416312",
"0.5363334",
"0.534709... | 0.0 | -1 |
Returns information about the SQS queues used by the indexer. | def queues(self):
sqs = aws.resource('sqs')
response = {'up': True}
for queue in config.all_queue_names:
try:
queue_instance = sqs.get_queue_by_name(QueueName=queue).attributes
except ClientError as ex:
response[queue] = {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_queues(self):\n return self.__queues",
"def _get_queues(self):\n return self.__queues",
"def _get_queues(self):\n return self.__queues",
"def _get_queues(self):\n return self.__queues",
"def _get_queues(self):\n return self.__queues",
"def _get_queues(self):\n return self.__que... | [
"0.7355894",
"0.7355894",
"0.7355894",
"0.7355894",
"0.7355894",
"0.7355894",
"0.7355894",
"0.7355894",
"0.7355894",
"0.7233817",
"0.69839853",
"0.6979631",
"0.69631916",
"0.68917763",
"0.6786719",
"0.67401844",
"0.66652983",
"0.66472214",
"0.66108876",
"0.6506762",
"0.645298... | 0.73200727 | 9 |
Indicates whether important service API endpoints are operational. | def api_endpoints(self):
endpoints = [
furl(path=('index', entity_type), args={'size': '1'})
for entity_type in self.entity_types
]
with ThreadPoolExecutor(len(endpoints)) as tpe:
status = dict(tpe.map(self._api_endpoint, endpoints))
status['up'] = all... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enabled(self, endpoint):\n if self._has_endpoint(endpoint):\n return self._can_access_endpoint(endpoint)\n else:\n return False",
"def endpoint_checker(url):\r\n if \"/arcgis/rest/services/\" and \"http\" in url:\r\n return True\r\n return False",
... | [
"0.6403152",
"0.6368715",
"0.63552296",
"0.6324504",
"0.62691385",
"0.6244456",
"0.6224547",
"0.6204955",
"0.6180881",
"0.61786115",
"0.6019366",
"0.6002978",
"0.59973973",
"0.59829885",
"0.59475756",
"0.59153557",
"0.5915119",
"0.5914216",
"0.58718246",
"0.5844054",
"0.58250... | 0.62562156 | 5 |
Prepare the filter expression for building the query. | def _clean_filters(self, expression):
if not expression or not isinstance(expression, dict):
return
slugs = expression.get("slugs")
if slugs:
ids = expression.get("ids", [])
ids.extend(self._slugs_to_ids(expression["object_name"], slugs))
expression["ids"] = ids
try:
expres... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_where_clause(**kwds_filter):\n clause = []\n params = []\n items = kwds_filter.items()\n items = sorted(items, key=lambda x: x[0]) # Ordered by key.\n for key, val in items:\n if nonstringiter(val):\n clause.append(key + ' IN (%s)' % (', '.jo... | [
"0.63701123",
"0.6337844",
"0.63270384",
"0.61757094",
"0.6136317",
"0.6046534",
"0.59677476",
"0.59108335",
"0.5888476",
"0.58857954",
"0.5863099",
"0.58572066",
"0.58535206",
"0.580054",
"0.5728004",
"0.57172704",
"0.5681729",
"0.5675632",
"0.56551564",
"0.56210923",
"0.560... | 0.6646757 | 0 |
Returns a value equal to 1e4 squared km independently of ``mag`` and ``rake`` values. >>> point_msr = PointMSR() >>> 1e4 == point_msr.get_median_area(4.0, 50) True >>> 1e4 == point_msr.get_median_area(9.0, 0) True | def get_median_area(self, mag, rake):
return 1e-4 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimate_median(self):\n return self.estimate_percentile(0.5)",
"def get_median(self):\n return self.serie.median()",
"def get_fitness_median(self):\n return self.get_fitness_stat(median2)",
"def findMedian(self):\n if len(self.maxq) == len(self.minq):\n return (flo... | [
"0.6425669",
"0.61125404",
"0.5964655",
"0.59410757",
"0.59080803",
"0.58084756",
"0.57980746",
"0.5791704",
"0.5767599",
"0.57241416",
"0.55921036",
"0.55907726",
"0.558951",
"0.556034",
"0.5520749",
"0.5515729",
"0.5507465",
"0.54912156",
"0.5476627",
"0.5445097",
"0.543644... | 0.80386376 | 0 |
Insert val at the head of linked list. | def push(self, val):
self.head = Node(val, self.head)
self._length += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addAtHead(self, val):\n node = ListNode(val)\n if self.head == None:\n self.head = node\n else:\n node.next = self.head\n self.head = node",
"def insert(self, val):\n new_node = Node(val)\n new_node.next = self.head\n self.head = new_... | [
"0.83619916",
"0.8318233",
"0.824877",
"0.8222785",
"0.8093144",
"0.8082743",
"0.8078379",
"0.8078379",
"0.80490434",
"0.8029199",
"0.79817533",
"0.7928387",
"0.78839386",
"0.78808147",
"0.7879472",
"0.7780009",
"0.7676289",
"0.75749433",
"0.7507849",
"0.74619853",
"0.7438763... | 0.72761524 | 32 |
Pop the first value off of the head and return it. | def pop(self):
if self.head is None:
raise IndexError("Cannot pop from an empty linked list.")
first = self.head.val
self.head = self.head.next
self._length -= 1
return first | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self):\n current = self.head\n new_head = current.next\n self.head = new_head\n return current.val",
"def pop(self):\n if not self.head:\n raise IndexError('Cannot pop from empty linked list.')\n\n popped_value = self.head.val\n self.head = self... | [
"0.8468235",
"0.82761586",
"0.8273612",
"0.8267039",
"0.8228783",
"0.817403",
"0.8173597",
"0.8042795",
"0.79969376",
"0.7952761",
"0.7915906",
"0.7909604",
"0.78931034",
"0.78909224",
"0.7882626",
"0.7842148",
"0.7842148",
"0.7842148",
"0.7838856",
"0.78371966",
"0.78255033"... | 0.8281952 | 1 |
Remove and return top of stack. | def pop(self):
try:
res = self._linkedlist.pop()
self._update_attr()
return res
except IndexError:
raise IndexError("Cannot pop from empty stack.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self):\n if not self.isEmpty():\n self.top -= 1\n return self.stack.pop()\n else:\n raise Exception(\"Stack Underflow\")",
"def top(self):\n if self.stack == []:\n return None\n return self.stack[-1]",
"def pop(stack):\n item = ... | [
"0.81173426",
"0.807389",
"0.79999846",
"0.7981072",
"0.7923219",
"0.7821409",
"0.78166336",
"0.7816199",
"0.778461",
"0.77822924",
"0.7776849",
"0.7762944",
"0.77427864",
"0.7734838",
"0.7725562",
"0.7703086",
"0.76685745",
"0.76679957",
"0.7640223",
"0.7631719",
"0.7607326"... | 0.0 | -1 |
Return a list of all nodes in the graph. | def nodes(self):
return list(self.node_dict.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nodes(self):\n\n return list(self.graph.nodes)",
"def get_node_list(self):\n return [[node] for node in self.graph.nodes]",
"def nodes(self):\n nodes = list()\n for node in self._nodes:\n if isinstance(node, Graph):\n nodes += node.nodes\n ... | [
"0.8470535",
"0.833607",
"0.83090234",
"0.8299594",
"0.820619",
"0.8199423",
"0.8134652",
"0.8117623",
"0.80705255",
"0.80466336",
"0.80246496",
"0.79974836",
"0.7943407",
"0.7838246",
"0.7838246",
"0.78137255",
"0.7759444",
"0.77276284",
"0.77044064",
"0.7667386",
"0.7665307... | 0.74880123 | 30 |
Add an edge to the graph with source, dest of 'n1', 'n2'. Add node if either not present. | def add_edge(self, n1, n2, weight=0):
self.add_node(n1)
self.add_node(n2)
if n2 in self.node_dict[n1]:
raise ValueError("Edge already exists")
self.node_dict[n1][n2] = weight | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self,node1,node2):\n # add nodes if not already in graph\n if node1 not in self.nodes():\n self.add_node(node1)\n if node2 not in self.nodes():\n self.add_node(node2)\n\n # make connections to nodes\n self.__graph[node1].append(node2)\n s... | [
"0.77676094",
"0.77200985",
"0.765448",
"0.7611213",
"0.75932425",
"0.7507148",
"0.7484455",
"0.74091077",
"0.7396875",
"0.7381088",
"0.73745966",
"0.7314301",
"0.73071796",
"0.7296473",
"0.7287274",
"0.72808945",
"0.72673666",
"0.72587836",
"0.7244793",
"0.7240416",
"0.71787... | 0.7615613 | 3 |
Checks if it is a 9x9 grid | def check_dim(gr, DIM):
l = len(gr)
if(l != DIM):
return False
for i in range(0, DIM):
if(len(gr[i]) != l):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_grid(grid: List):\n for row in range(9):\n for col in range(9):\n if grid[row][col] == 0:\n return False\n return True",
"def check_grid(self) -> None:\n if not len(self.grid) == 81:\n raise ValueError(\"Grid does not have 81 ... | [
"0.77120465",
"0.73693293",
"0.71696264",
"0.708879",
"0.6971367",
"0.69114405",
"0.68749267",
"0.68421865",
"0.6827116",
"0.68198776",
"0.6722419",
"0.6719555",
"0.6709544",
"0.6681807",
"0.6678555",
"0.6658889",
"0.6639442",
"0.6627549",
"0.66187894",
"0.659081",
"0.656958"... | 0.0 | -1 |
Transmit timestamp in system time. | def tx_time(self) -> float:
return ntp_to_system_time(self.tx_timestamp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendTime(self):\n timestamp = datetime.datetime.now().strftime(\"%A, %d. %B %Y %I:%M%p\")\n self.send(timestamp)",
"def sync_time(self, event=None):\n if self.collect: return\n time_obj= localtime()\n serial_time = strftime(\"t%Y,%m,%d,%H,%M,%S\", time_obj)\n print(s... | [
"0.7685362",
"0.7499868",
"0.7304864",
"0.7302163",
"0.7193608",
"0.7006967",
"0.6969181",
"0.6955726",
"0.69230944",
"0.69076806",
"0.6867549",
"0.68478185",
"0.6803749",
"0.67800176",
"0.67627764",
"0.6760931",
"0.6729335",
"0.66874737",
"0.6679501",
"0.6678615",
"0.6677284... | 0.67538357 | 16 |
Receive timestamp in system time. | def recv_time(self) -> float:
return ntp_to_system_time(self.recv_timestamp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp():\n return time.time()",
"def _get_timestamp():\n return str(int(time.time()))",
"def to_systime(self):\n try:\n dt_obj = duparser.parse(timestamp)\n micro = int(dt_obj.microsecond / 1000)\n full_date = dt_obj.strftime('%Y, %m, %w, %d, %H, %M, %S... | [
"0.7336624",
"0.7223282",
"0.72125137",
"0.7202369",
"0.716362",
"0.71398026",
"0.71215475",
"0.708996",
"0.7079708",
"0.70069325",
"0.69639647",
"0.68770546",
"0.68660206",
"0.6865147",
"0.6860346",
"0.685409",
"0.6849818",
"0.684834",
"0.68375933",
"0.6830915",
"0.6819475",... | 0.7396466 | 0 |
Destination timestamp in system time. | def dest_time(self) -> float:
return ntp_to_system_time(self.dest_timestamp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp():\n return datetime.now().strftime(\"%Y%m%dT%H%M%S\")",
"def timestamp():\n return datetime.utcnow().strftime(\"%F %T\")",
"def get_timestamp():\n return time.strftime('%Y-%m-%d %H:%M:%S')",
"def to_systime(self):\n try:\n dt_obj = duparser.parse(timestamp)\n... | [
"0.70465803",
"0.6981993",
"0.6926404",
"0.6916062",
"0.68561596",
"0.68470454",
"0.68363905",
"0.68363905",
"0.68175143",
"0.68149626",
"0.6814853",
"0.6770308",
"0.67674494",
"0.67349863",
"0.6672227",
"0.66678333",
"0.66645926",
"0.6613114",
"0.6567869",
"0.65538955",
"0.6... | 0.7850488 | 0 |
Check whether cache file is valid. | def valid(cache_file: Path, lifetime: int = None) -> bool:
if not cache_file.exists():
return False
if lifetime is None:
return True
mtime = datetime.fromtimestamp(cache_file.lstat().st_mtime)
if datetime.now() - timedelta(seconds=lifetime) < mtime:
return True
return Fal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_cache_valid(self):\n if os.path.isfile(self.cache_filename):\n mod_time = os.path.getmtime(self.cache_filename)\n current_time = time()\n if (mod_time + self.cache_max_age) > current_time:\n return True\n return False",
"def is_cache_valid(self... | [
"0.8098338",
"0.8044438",
"0.79111874",
"0.70949334",
"0.7034459",
"0.7021032",
"0.6966583",
"0.68908596",
"0.6759774",
"0.6715369",
"0.66384345",
"0.6630742",
"0.6592991",
"0.65405786",
"0.6534035",
"0.64985055",
"0.64404917",
"0.6408886",
"0.63888025",
"0.63513637",
"0.6299... | 0.7871775 | 3 |
Returns the ground distance in metres between two LocationGlobal objects. This method is an approximation, and will not be accurate over large distances and close to the | def get_distance_metres(aLocation1, aLocation2):
dlat = aLocation2.lat - aLocation1.lat
dlong = aLocation2.lon - aLocation1.lon
return math.sqrt((dlat*dlat) + (dlong*dlong)) * 1.113195e5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_distance_metres(aLocation1, aLocation2):\n dlat = aLocation2.lat - aLocation1.lat\n dlong = aLocation2.lon - aLocation1.lon\n return math.sqrt((dlat * dlat) + (dlong * dlong)) * 1.113195e5",
"def get_distance_metres(aLocation1, aLocation2):\n \n dlat = aLocation2.lat - aLocation1.lat\n ... | [
"0.6585969",
"0.6582926",
"0.6557264",
"0.65189123",
"0.62674785",
"0.62118316",
"0.6161472",
"0.61044204",
"0.6068722",
"0.60465467",
"0.5999862",
"0.5943727",
"0.5853424",
"0.58529764",
"0.57982713",
"0.5737839",
"0.57041925",
"0.5688377",
"0.56605136",
"0.5635555",
"0.5560... | 0.6614547 | 4 |
Initialize weights to zeros | def _initialize_weights(self, m):
self.w_ = np.zeros(1 + m)
self.w_initialized = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initializeWeightsToZero(self):\n\t\t## YOUR CODE BELOW\n\t\t\n\t\tutil.raiseNotDefined()\n\t\treturn",
"def init_weights(self) -> None:\n self.fc.bias.data.fill_(0)\n self.fc.weight.data.uniform_(-0.1, 0.1)",
"def _initialize_weights(self):\n pass",
"def init_weights(self, num_featur... | [
"0.8791406",
"0.8208217",
"0.8086016",
"0.79715824",
"0.7927534",
"0.7927534",
"0.7927534",
"0.79091275",
"0.7854274",
"0.78421515",
"0.781851",
"0.7781316",
"0.7762355",
"0.7762355",
"0.76454335",
"0.7631692",
"0.7620359",
"0.75525",
"0.751663",
"0.7461743",
"0.7454319",
"... | 0.76143503 | 19 |
Tests behavior when ach create fails. | def test_ach_create_failure(self):
with self.assertRaises(MarqetaError):
self.client.funding_sources.ach.create({}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_unexpected_problem(self):\n pass",
"def test_creation_fail(self):\n\n # Assert that a RelaxError occurs when the pipe type is invalid.\n self.assertRaises(RelaxError, pipes.create, 'new', 'x')",
"def test_create_run(self):\n pass",
"def test_create(self):\n ... | [
"0.74543756",
"0.7160455",
"0.65851295",
"0.6580056",
"0.6570013",
"0.64473534",
"0.64473534",
"0.6419119",
"0.6412604",
"0.6394797",
"0.63864315",
"0.63806146",
"0.6379693",
"0.63447106",
"0.6271534",
"0.6262713",
"0.6233999",
"0.6231408",
"0.6230933",
"0.6209751",
"0.620850... | 0.75070345 | 0 |
Write a method to replace all spaces in a string with '%20'. Trim any spaces on the end. | def URLify(s):
# Without any additional libraries and by doing it in an array as intended by the writer.
return ''.join('%20' if c == ' ' else c for c in s.strip())
# Time Complexity: O(n)
# Space Complexity: O(1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def urlify_pythonic(text, length):\n return text.rstrip().replace(\" \", \"%20\")",
"def urlify(w, length):\n return w.strip().replace(' ', '%20')",
"def urlify2(w, length):\n chars = []\n while i < len(w):\n c = w[i]\n if c == ' ':\n chars.append('%20') \n el... | [
"0.70770615",
"0.68402797",
"0.6562953",
"0.6559894",
"0.6473804",
"0.6370621",
"0.61112654",
"0.573757",
"0.56474173",
"0.5599418",
"0.55749345",
"0.5555824",
"0.5542937",
"0.54382426",
"0.54333997",
"0.5382547",
"0.53219134",
"0.5298354",
"0.52909285",
"0.5246943",
"0.52403... | 0.65695405 | 2 |
Appends a node with the value to the singly linked list. | def append(self, value):
node = SLLNode(value)
if self.head is None:
self.head = node
else:
tail_node = self.head
while tail_node.next_node is not None:
tail_node = tail_node.next_node
tail_node.next_node = node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, value):\n if not self.head:\n self.head = Node(value)\n return\n link = self.head\n while link.next_value:\n link = link.next_value\n link.next_value = Node(value)\n return",
"def append(self, value):\n current = self.hea... | [
"0.83993125",
"0.83348805",
"0.8276802",
"0.8272766",
"0.82646817",
"0.8201642",
"0.789146",
"0.7734323",
"0.7634041",
"0.760179",
"0.7570071",
"0.7543691",
"0.74666905",
"0.74546707",
"0.74454266",
"0.7419956",
"0.7379359",
"0.73783106",
"0.734161",
"0.7328202",
"0.7317245",... | 0.83328205 | 2 |
Returns node in the position given by index. Zerobased indexing is employed. Negative indexing as in Python list. | def _get_node_at(self, index):
assert isinstance(index, int)
if index >= 0:
steps = index
else:
steps = self.size() + index
if steps < 0:
return None
node = self.head
while steps > 0 and node is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_node(self, index):\r\n\t\tself._validate_index(index)\r\n\t\treturn self._traverse(lambda i, list: i < index)[\"node\"]",
"def _get_node_at(self, index):\n assert isinstance(index, int)\n from_head = True if index >= 0 else False \n if from_head: \n node = self.head\n ... | [
"0.81595385",
"0.7880716",
"0.780448",
"0.7755923",
"0.77530617",
"0.73924327",
"0.7322891",
"0.72783375",
"0.7243757",
"0.71349835",
"0.7085588",
"0.7048444",
"0.7019119",
"0.69972265",
"0.6969157",
"0.69661844",
"0.69164616",
"0.6897024",
"0.6872798",
"0.6851955",
"0.683389... | 0.76997674 | 5 |
Returns value of the node in the position given by index. | def _value_at(self, index):
node = self._get_node_at(index)
if node is None:
raise IndexError('List index out of range.')
return node.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, index: int) -> int:\n node = self.get_node(index)\n if node:\n return node.val\n else:\n return -1",
"def value_at(self, index):\n if index==0:\n return self.head.val\n\n temp_node = self.head\n for _ in range(index):\n ... | [
"0.8346051",
"0.831663",
"0.82529914",
"0.7763971",
"0.7720946",
"0.7644232",
"0.7623582",
"0.75943434",
"0.75826913",
"0.7557964",
"0.74623543",
"0.73844564",
"0.73739195",
"0.7339288",
"0.7321254",
"0.7321254",
"0.7319555",
"0.7279701",
"0.7247694",
"0.7227044",
"0.721512",... | 0.8657078 | 0 |
Returns value of the node in the position given by index. | def __getitem__(self, index):
return self._value_at(index) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _value_at(self, index):\n node = self._get_node_at(index)\n if node is None:\n raise IndexError('List index out of range.')\n return node.value",
"def _value_at(self, index):\n node = self._get_node_at(index)\n if node is None:\n raise IndexError('List... | [
"0.8657078",
"0.8657078",
"0.8346051",
"0.831663",
"0.82529914",
"0.7763971",
"0.7720946",
"0.7644232",
"0.7623582",
"0.75943434",
"0.75826913",
"0.7557964",
"0.74623543",
"0.73844564",
"0.73739195",
"0.7339288",
"0.7319555",
"0.7279701",
"0.7247694",
"0.7227044",
"0.721512",... | 0.7321254 | 16 |
Appends a node with the value to the doubly linked list. | def append(self, value):
node = DLLNode(value)
if self.head is None:
self.head = node
self.tail = node
else:
self.tail.next_node = node
node.prev_node = self.tail
self.tail = node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, value):\n if not self.head:\n self.head = Node(value)\n return\n link = self.head\n while link.next_value:\n link = link.next_value\n link.next_value = Node(value)\n return",
"def append(self, value):\n current = self.hea... | [
"0.8012629",
"0.7959485",
"0.79481673",
"0.79369324",
"0.79258406",
"0.7812238",
"0.77942187",
"0.76650965",
"0.76148707",
"0.7586029",
"0.72688097",
"0.72594833",
"0.7180817",
"0.70484036",
"0.70103496",
"0.70037353",
"0.70033926",
"0.6964139",
"0.69531614",
"0.69488454",
"0... | 0.79038954 | 5 |
Returns node in the position given by index. Zerobased indexing is employed. Negative indexing as in Python list. | def _get_node_at(self, index):
assert isinstance(index, int)
from_head = True if index >= 0 else False
if from_head:
node = self.head
steps = index
else:
node = self.tail
steps = abs(index) -1
while steps > 0 and node i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_node(self, index):\r\n\t\tself._validate_index(index)\r\n\t\treturn self._traverse(lambda i, list: i < index)[\"node\"]",
"def at(self, index):\n if index < 0 or index >= self.length:\n raise \"Index out of range\"\n node = self.head\n i=0\n while i<=index:\n if i==index:\n ... | [
"0.8160818",
"0.78057986",
"0.77575433",
"0.7755074",
"0.7700244",
"0.73928887",
"0.7323272",
"0.72790116",
"0.72448575",
"0.7136696",
"0.70866805",
"0.70492184",
"0.7020523",
"0.6998906",
"0.6970599",
"0.69671845",
"0.6917112",
"0.6898055",
"0.6874284",
"0.6849958",
"0.68353... | 0.7881974 | 1 |
Returns value of the node in the position given by index. | def _value_at(self, index):
node = self._get_node_at(index)
if node is None:
raise IndexError('List index out of range.')
return node.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, index: int) -> int:\n node = self.get_node(index)\n if node:\n return node.val\n else:\n return -1",
"def value_at(self, index):\n if index==0:\n return self.head.val\n\n temp_node = self.head\n for _ in range(index):\n ... | [
"0.8346051",
"0.831663",
"0.82529914",
"0.7763971",
"0.7720946",
"0.7644232",
"0.7623582",
"0.75943434",
"0.75826913",
"0.7557964",
"0.74623543",
"0.73844564",
"0.73739195",
"0.7339288",
"0.7321254",
"0.7321254",
"0.7319555",
"0.7279701",
"0.7247694",
"0.7227044",
"0.721512",... | 0.8657078 | 1 |
Returns value of the node in the position given by index. | def __getitem__(self, index):
return self._value_at(index) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _value_at(self, index):\n node = self._get_node_at(index)\n if node is None:\n raise IndexError('List index out of range.')\n return node.value",
"def _value_at(self, index):\n node = self._get_node_at(index)\n if node is None:\n raise IndexError('List... | [
"0.8656686",
"0.8656686",
"0.8345885",
"0.8316592",
"0.82532716",
"0.776308",
"0.7721411",
"0.76454544",
"0.76231676",
"0.7594386",
"0.75818235",
"0.75578904",
"0.74631274",
"0.73849493",
"0.73737293",
"0.73397136",
"0.731923",
"0.7279908",
"0.72479117",
"0.7226236",
"0.72142... | 0.7320801 | 17 |
Inserts node at the beginning. | def push_front(self, value):
node = DLLNode(value)
if self.head is None:
self.tail = node
else:
self.head.prev_node = node
node.next_node = self.head
self.head = node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _first_insert(self, e):\n self._start = self._Node(e, None, None)\n self._start._prev = self._start\n self._start._next = self._start\n self._size += 1",
"def insert_at_beginning(self, data: int) -> None:\n current = self.head\n new_node = Node(data)\n if current is not None:... | [
"0.7638748",
"0.7621375",
"0.7503591",
"0.7476803",
"0.74340206",
"0.72739434",
"0.72491515",
"0.72208714",
"0.72171354",
"0.7207594",
"0.7205878",
"0.72032046",
"0.7155321",
"0.7152026",
"0.7076626",
"0.70202106",
"0.7012198",
"0.7004882",
"0.69398963",
"0.69105834",
"0.6877... | 0.6223528 | 66 |
Shifts sequences to the right | def shift_sequences(seq_array):
# Sequence based on t.word_index for embedding input
shifted_seq = []
for sequence in seq_array:
shifted_seq.append(sequence[1:]) # [:-1]
return shifted_seq | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shift_right(self):\n self.pointer = (self.pointer + 1) % len(self.data)",
"def shift_aligners(self):\n for i in range(self.height-1, 1, -1):\n self.align.list[i] = self.align.list[i-1]\n self.align.list[1] = copy.deepcopy(self.align.list[0])",
"def _rel_shift_legacy(self, xs):\n ... | [
"0.71479243",
"0.6865504",
"0.66234404",
"0.6334715",
"0.6317019",
"0.6289141",
"0.6262499",
"0.6235964",
"0.6234505",
"0.6201743",
"0.6185862",
"0.6185349",
"0.61768866",
"0.61569375",
"0.61497384",
"0.6109323",
"0.61055624",
"0.60852754",
"0.605822",
"0.6045782",
"0.6021302... | 0.66770875 | 2 |
Update the agent's speed by applying the acceleration and the agent's banking angle by applying the change. Then use the updated speed and ground angle to determine the agent's next position. | def process_move(self, agent, acceleration, angle, **kwargs):
if isinstance(agent, SpeedAngleAgent):
self.speed_angle_state.modify_speed(agent, acceleration[0])
self.speed_angle_state.modify_banking_angle(agent, angle[0])
x_position = agent.speed*np.cos(np.deg2rad(agent.grou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\r\n # change in position -> velocity\r\n self.position += self.velocity\r\n # change in celocity -> acceleration\r\n self.velocity += self.acceleration\r\n \r\n # if velocity magnitude is higher than the defined limit set the velocity \r\n # magnit... | [
"0.72153354",
"0.71644586",
"0.71014476",
"0.70303893",
"0.6818241",
"0.66522104",
"0.66456413",
"0.6642038",
"0.6640391",
"0.66194093",
"0.66190565",
"0.661026",
"0.66012126",
"0.65761954",
"0.65734214",
"0.6570275",
"0.656382",
"0.65627056",
"0.6527495",
"0.6506421",
"0.650... | 0.6830903 | 4 |
Update the agent's velocity by applying the acceleration. Then use the updated velocity to determine the agent's next position. | def process_action(self, agent, action_dict, **kwargs):
acceleration = self._get_action_from_dict(action_dict)
self.velocity_state.modify_velocity(agent, acceleration)
position_before = agent.position
self.position_state.modify_position(agent, agent.velocity, **kwargs)
return age... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accelerate(self):\n\t\tself.velocity += self.direction * self.ACCELERATION",
"def update(self):\r\n # change in position -> velocity\r\n self.position += self.velocity\r\n # change in celocity -> acceleration\r\n self.velocity += self.acceleration\r\n \r\n # if veloc... | [
"0.8103785",
"0.8076967",
"0.7459148",
"0.7408268",
"0.740312",
"0.7290108",
"0.72761655",
"0.72523403",
"0.7213966",
"0.7201326",
"0.71848714",
"0.7182024",
"0.7177309",
"0.714075",
"0.7138605",
"0.7116059",
"0.70815986",
"0.7019299",
"0.70117295",
"0.69779503",
"0.68945396"... | 0.0 | -1 |
Apply pytorch's to() to all tensors in this container. | def to(self, device): # !pylint: disable=C0103
for key, value in self.__dict__.items():
if key.startswith('_'): # do not change private attributes
continue
self.__dict__[key] = value.to(device)
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to(self, device):\n for item in self.data:\n if torch.is_tensor(item):\n item.to(item)\n else:\n for subitem in item:\n subitem.to(device)\n return self",
"def to(self, *args, **kwargs):\n self._tensor = self._tensor.... | [
"0.73554397",
"0.66673666",
"0.6094792",
"0.5963896",
"0.5930037",
"0.58879876",
"0.5847272",
"0.5751427",
"0.56995875",
"0.5582571",
"0.55743486",
"0.5558622",
"0.5549765",
"0.5544488",
"0.5518395",
"0.55166596",
"0.5505444",
"0.548156",
"0.546296",
"0.5438308",
"0.5432174",... | 0.0 | -1 |
Apply pytorch's cpu() to all tensors in this container. | def cpu(self):
for key, value in self.__dict__.items():
self.__dict__[key] = value.cpu()
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cpu(self, *args, **kwargs):\n self._tensor = self._tensor.cpu(*args, **kwargs)\n return self",
"def cpu(self):\n self.reader.model.cpu()\n self.reader.device = torch.device(\"cpu\")\n return self",
"def cpu(self) -> 'BatchEmbedder':\n self.is_cuda = False\n ... | [
"0.79276174",
"0.6909093",
"0.68243873",
"0.62218916",
"0.6091364",
"0.6021522",
"0.59396166",
"0.57388794",
"0.5734339",
"0.5702991",
"0.5702991",
"0.56883657",
"0.5625652",
"0.5606741",
"0.55771506",
"0.5523671",
"0.5429665",
"0.54000217",
"0.53976935",
"0.5397638",
"0.5313... | 0.73803604 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.