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 last complete shipping event for this order. | def shipping_status(self):
# As safeguard against identical timestamps, also sort by the primary
# key. It's not recommended to rely on this behaviour, but in practice
# reasonably safe if PKs are not manually set.
events = self.shipping_events.order_by("-date_created", "-pk").all()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shipping_status(self):\n status_map = self.shipping_event_breakdown\n if not status_map:\n return \"\"\n\n events = []\n last_complete_event_name = None\n for event_dict in reversed(list(status_map.values())):\n if event_dict[\"quantity\"] == self.quanti... | [
"0.64712983",
"0.6077934",
"0.6044027",
"0.6044027",
"0.6044027",
"0.60068345",
"0.5937978",
"0.5839513",
"0.5663274",
"0.563499",
"0.563499",
"0.563499",
"0.56180274",
"0.5615151",
"0.55639356",
"0.54894173",
"0.546801",
"0.536703",
"0.53506696",
"0.5346767",
"0.5310708",
... | 0.6816309 | 0 |
Return all possible statuses that this order line can move to | def available_statuses(self):
return self.pipeline.get(self.status, ()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def statuses(self):\n big = BigCommerceAPI()\n response = big.get('orderstatuses')\n return response.text",
"def get_locmove_list(self) -> dict:\n return self.wcstatus.get_locmut_dct()",
"def _get_status(self):\n\t\tstatus_list = []\n\t\tfor hand in self.player_hand:\n\t\t\tif hand.... | [
"0.6100885",
"0.60960233",
"0.6085333",
"0.6039967",
"0.59795254",
"0.5931195",
"0.59099513",
"0.58673924",
"0.57076865",
"0.56835896",
"0.5638614",
"0.5638007",
"0.56360304",
"0.56358325",
"0.56050533",
"0.55929697",
"0.5580298",
"0.55713624",
"0.5561098",
"0.54834247",
"0.5... | 0.5989082 | 5 |
Computes the forward pass for an affine (fullyconnected) layer. The input x has shape (N, d_1, ..., d_k) and contains a minibatch of N examples, where each example x[i] has shape (d_1, ..., d_k). We will reshape each input into a vector of dimension D = d_1 ... d_k, and then transform it to an output vector of dimensio... | def affine_forward(x, w, b):
out = None
###########################################################################
# TODO: Implement the affine forward pass. Store the result in out. You #
# will need to reshape the input into rows. #
################################... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affine_forward(x, w, b):\n out = None\n \n # reshape the input into (N, d_1 *...* d_k)\n input_shape = x.shape\n prod = 1\n for i in range(1,len(input_shape)):\n prod *= input_shape[i]\n\n a = x.reshape(x.shape[0],prod)\n out = np.dot(a,w) + b\n \n cache = (x, w, b)\n re... | [
"0.69982296",
"0.68829656",
"0.6688302",
"0.6511169",
"0.65057796",
"0.6458063",
"0.64142865",
"0.64064544",
"0.6357341",
"0.6355706",
"0.6348717",
"0.6345614",
"0.6335734",
"0.632228",
"0.63077736",
"0.630389",
"0.629922",
"0.6297295",
"0.6297232",
"0.62915283",
"0.62878835"... | 0.6447693 | 6 |
Computes the backward pass for an affine layer. | def affine_backward(dout, cache):
#decouple cache.
x, w, b = cache
dx, dw, db = None, None, None
###########################################################################
# TODO: Implement the affine backward pass. #
###############################################... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affine_relu_backward(dout, cache):\n fc_cache, relu_cache = cache\n da = layers.relu_backward(dout, relu_cache)\n dx, dw, db = layers.affine_backward(da, fc_cache)\n return dx, dw, db",
"def affine_backward(dout, cache):\n x, w, b = cache\n dx, dw, db = None, None, None\n ###############... | [
"0.7518896",
"0.751513",
"0.7310849",
"0.73015374",
"0.73015374",
"0.73015374",
"0.73015374",
"0.7243401",
"0.7177609",
"0.7174102",
"0.7173503",
"0.71661735",
"0.71319",
"0.7106919",
"0.70978165",
"0.708432",
"0.7068546",
"0.70449376",
"0.6993727",
"0.6986414",
"0.6983679",
... | 0.70409757 | 18 |
Computes the forward pass for a layer of rectified linear units (ReLUs). | def relu_forward(x):
out = None
###########################################################################
# TODO: Implement the ReLU forward pass. #
###########################################################################
out = np.maximum(x,0)
##############... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_relus(self):\n\n def relu_backward_hook_function(module, grad_in, grad_out):\n \"\"\"\n If there is a negative gradient, change it to zero\n \"\"\"\n # Get last forward output\n corresponding_forward_output = self.forward_relu_outputs[-1]\n ... | [
"0.67748713",
"0.66286796",
"0.66017634",
"0.65229756",
"0.6508068",
"0.6446223",
"0.6384293",
"0.6268143",
"0.62051433",
"0.61796844",
"0.615338",
"0.6138424",
"0.6061883",
"0.60544795",
"0.6047959",
"0.60466814",
"0.60187435",
"0.5995928",
"0.5991142",
"0.59697586",
"0.5963... | 0.5749351 | 46 |
Computes the backward pass for a layer of rectified linear units (ReLUs). | def relu_backward(dout, cache):
dx, x = None, cache
###########################################################################
# TODO: Implement the ReLU backward pass. #
###########################################################################
dx = dout * ((x > 0)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relu_backward(self, dUpper, cache):\n x = cache\n #############################################################################\n # TODO: Implement the ReLU backward pass. #\n #########################################################################... | [
"0.70412636",
"0.694716",
"0.6897693",
"0.6847592",
"0.6847592",
"0.6846935",
"0.6841099",
"0.68178034",
"0.6766849",
"0.6754919",
"0.67536426",
"0.67530656",
"0.67419785",
"0.6739244",
"0.6713423",
"0.6708748",
"0.6699276",
"0.6696307",
"0.6696307",
"0.66860896",
"0.6665928"... | 0.6513479 | 43 |
Forward pass for batch normalization. During training the sample mean and (uncorrected) sample variance are computed from minibatch statistics and used to normalize the incoming data. During training we also keep an exponentially decaying running mean of the mean and variance of each feature, and these averages are use... | def batchnorm_forward(x, gamma, beta, bn_param):
mode = bn_param['mode']
eps = bn_param.get('eps', 1e-5)
momentum = bn_param.get('momentum', 0.9)
N, D = x.shape
running_mean = bn_param.get('running_mean', np.zeros(D, dtype=x.dtype))
running_var = bn_param.get('running_var', np.zeros(D, dtype=x.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(self, x, train=True):\n if train is not None:\n mean, variance = tf.nn.moments(x, [0,1,2])\n assign_mean = self.mean.assign(mean)\n assign_variance = self.variance.assign(variance)\n with tf.control_dependencies([assign_mean, assign_variance]):\n return tf.nn.batch_norm_... | [
"0.73383224",
"0.7016861",
"0.69410783",
"0.69346285",
"0.6931685",
"0.6889228",
"0.6872077",
"0.68457",
"0.6766507",
"0.67566276",
"0.67158246",
"0.664559",
"0.66005903",
"0.65980434",
"0.6576821",
"0.65156204",
"0.65121484",
"0.64605176",
"0.64539593",
"0.64105016",
"0.6387... | 0.6704023 | 11 |
Performs the forward pass for (inverted) dropout. | def dropout_forward(x, dropout_param):
p, mode = dropout_param['p'], dropout_param['mode']
if 'seed' in dropout_param:
np.random.seed(dropout_param['seed'])
mask = None
out = None
if mode == 'train':
#######################################################################
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dropout_forward(x, dropout_param):\n p, mode = dropout_param['p'], dropout_param['mode']\n if 'seed' in dropout_param:\n np.random.seed(dropout_param['seed'])\n\n mask = None\n out = None\n\n if mode == 'train':\n ####################################################################... | [
"0.68019223",
"0.6788947",
"0.67881596",
"0.67838556",
"0.67719626",
"0.67665106",
"0.67513525",
"0.6644658",
"0.66206604",
"0.66206604",
"0.66206604",
"0.66206604",
"0.655159",
"0.6527662",
"0.651588",
"0.6484839",
"0.6430391",
"0.6355609",
"0.62947637",
"0.62932634",
"0.628... | 0.67262447 | 7 |
A naive implementation of the forward pass for a max pooling layer. | def max_pool_forward_naive(x, pool_param):
out = None
###########################################################################
# TODO: Implement the max pooling forward pass #
###########################################################################
N,C,H,W = x.shape
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_pool_forward_naive(x, pool_param):\n out = None\n #############################################################################\n # TODO: Implement the max pooling forward pass #\n #############################################################################\n pass\n ####... | [
"0.7984787",
"0.7866907",
"0.7854871",
"0.76688087",
"0.763123",
"0.75106704",
"0.7398416",
"0.73303866",
"0.7267503",
"0.7173863",
"0.7142943",
"0.7042369",
"0.70236975",
"0.7022948",
"0.696239",
"0.68989724",
"0.689837",
"0.68944407",
"0.6884486",
"0.6883826",
"0.688134",
... | 0.8176104 | 0 |
Return a dictionary of default cryptographic parameters. Existing keys are updated from optional kwargs. | def init_crypto_args(**kwargs):
d = {'algorithm': 'AES',
'mode': 'CBC',
'keysize': 256,
'pbkdf': 'PBKDF2HMAC',
'hash': 'SHA256',
'length': int(256/8),
'iterations': 100,
'salt': str(base64.b64encode(os.urandom(RANDOM_BYTES)), encoding='utf-8')}
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _default_params(self) -> Dict[str, Any]:\n normal_params = {\n \"temperature\": self.temperature,\n \"max_tokens\": self.max_tokens,\n \"top_p\": self.top_p,\n \"frequency_penalty\": self.frequency_penalty,\n \"presence_penalty\": self.presence_pena... | [
"0.72236526",
"0.7200065",
"0.6971475",
"0.6952699",
"0.68391204",
"0.6668044",
"0.653702",
"0.6530403",
"0.6499596",
"0.6391237",
"0.6291512",
"0.62587374",
"0.6241102",
"0.62375003",
"0.62095755",
"0.620127",
"0.6157291",
"0.61560535",
"0.6131925",
"0.61166316",
"0.6113859"... | 0.6511489 | 8 |
returns embeddings for the given `text` | def get_text_embeds(self, text):
# tokenize the text
text_input = self.tokenizer(text,
padding='max_length',
max_length=tokenizer.model_max_length,
truncation=True,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_embeddings(vectors, text, generate_missing=False, k=300):\r\n embeddings = text.apply(lambda x: get_average_vec(x, vectors, generate_missing=generate_missing, k=k))\r\n return list(embeddings)",
"def _embedding_func(self, text: str, *, engine: str) -> List[float]:\n # handle large input text... | [
"0.72294253",
"0.70859015",
"0.70370746",
"0.6904126",
"0.68540305",
"0.6752944",
"0.65998185",
"0.6438389",
"0.6350241",
"0.63457817",
"0.6336169",
"0.6322509",
"0.6304786",
"0.6247504",
"0.62020504",
"0.6165982",
"0.6150807",
"0.6121687",
"0.6104629",
"0.60774815",
"0.60685... | 0.80458707 | 0 |
convert image from pytorch tensor to PIL format | def transform_image(self, image):
image = self.image_processor.postprocess(image, output_type='pil')
return image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tensor_to_image(img):\n t = transforms.ToPILImage()\n return t(img)",
"def to_img(t):\n return torchvision.transforms.ToPILImage()(t)",
"def to_image(tensor):\n # Converts to PIL image\n unloader = transforms.ToPILImage()\n # Clone the tensor to CPU\n image = tensor.cpu().clone()\n ... | [
"0.80928534",
"0.80748105",
"0.7820823",
"0.77010036",
"0.7473561",
"0.73903084",
"0.7241145",
"0.7100627",
"0.6982142",
"0.6964258",
"0.6920993",
"0.69090575",
"0.69090575",
"0.68819386",
"0.6854666",
"0.6853223",
"0.6800277",
"0.6594",
"0.65452844",
"0.65452844",
"0.6545284... | 0.0 | -1 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! Let\'s explore some US bikeshare data!')
# TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
while True:
try:
city = str(input('Would you like to see data for Chicago, New York, or Washing... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66714007",
"0.65354675",
"0.64593667",
"0.6374057",
"0.6348314",
"0.63097656",
"0.62868035",
"0.6259136",
"0.62316",
"0.62130964",
"0.62050414",
"0.6181105",
"0.6171822",
"0.61686903",
"0.6158568",
"0.61582303",
"0.61532456",
"0.61444426",
"0.6131269",
"0.610484",
"0.61025... | 0.59590805 | 36 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
city = city.lower()
month = month.lower()
day = day.lower()
df = pd.read_csv(CITY_DATA[city])
# convert the Start Time column to datetime
df['Start Time'] = pd.to_datetime(df['Start Time'])
# extract month and day of week from Start Time to create new colum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.8131659",
"0.8108622",
"0.8045596",
"0.8042176",
"0.80088127",
"0.8007226",
"0.79990864",
"0.7998206",
"0.7988353",
"0.7979118",
"0.7973126",
"0.79608303",
"0.7955881",
"0.79469144",
"0.7945703",
"0.7907982",
"0.79077077",
"0.79041964",
"0.7900504",
"0.78928053",
"0.788891... | 0.76623476 | 71 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
df['Start Time'] = pd.to_datetime(df['Start Time'])
# TO DO: display the most common month
popular_month = df['Start Time'].dt.month.mode()[0]
print('Most popular Month:' , popular_mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80247396",
"0.80233026",
"0.7915788",
"0.78266186",
"0.7822246",
"0.78143597",
"0.77659196",
"0.7740343",
"0.773628",
"0.77344066",
"0.76867086",
"0.7668633",
"0.7651731",
"0.7644636",
"0.76399267",
"0.76367253",
"0.7625196",
"0.7623158",
"0.7612803",
"0.76002145",
"0.7583... | 0.7473153 | 37 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# TO DO: display most commonly used start station
start_station = df['Start Station'].mode()[0]
print('Most popular used start station:' , start_station)
# TO DO: display most common... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815675",
"0.7662213",
"0.7553417",
"0.74914914",
"0.74748665",
"0.7446617",
"0.7428588",
"0.74237514",
"0.74177027",
"0.7400495",
"0.7387161",
"0.7385634",
"0.73647535",
"0.735934",
"0.73566747",
"0.73548365",
"0.7351854",
"0.7351274",
"0.735057",
"0.73421645",
"0.7340198... | 0.72100854 | 42 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# TO DO: display total travel time
sum = df['Trip Duration'].sum()
print("total travel time is" , sum)
# TO DO: display mean travel time
mean = sum / len(df)
print("mean travel time is" , m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.7908032",
"0.79055744",
"0.7900715",
"0.7891682",
"0.78894734",
"0.7886722",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664... | 0.78422284 | 35 |
Setter for the fiber density list with the averages of every ring and wedge. | def set_fiber_density_average(fiber_density_average):
# Validate that the received list is not empty and has appropriate dimensions
Utils.validate_fiber_list_average(fiber_density_average)
Global_Module.global_fiber_density_with_average = fiber_density_average | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_fiber_density(fiber_density):\n # Validate that the received list is not empty and has appropriate dimensions\n Utils.validate_fiber_list(fiber_density)\n Global_Module.global_fiber_density = fiber_density",
"def get_fiber_density_average():\n return Global_Module.global_fiber_density_with_av... | [
"0.5943797",
"0.58008254",
"0.55897325",
"0.5432542",
"0.5376522",
"0.5361667",
"0.5330444",
"0.5220508",
"0.5209834",
"0.51885235",
"0.51756305",
"0.5140911",
"0.51196903",
"0.51171494",
"0.5098341",
"0.50777316",
"0.5073255",
"0.5063251",
"0.5054174",
"0.50512034",
"0.50505... | 0.71738666 | 0 |
Sets the uuid of this PrintOrder. | def uuid(self, uuid):
self._uuid = uuid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uuid(self, uuid: str):\n \n self._uuid = uuid",
"def uuid(self, uuid: str):\n\n self._uuid = uuid",
"def uuid(self, uuid: str):\n if uuid is None:\n raise ValueError(\"Invalid value for `uuid`, must not be `None`\") # noqa: E501\n \n self._uuid = uuid",... | [
"0.75979346",
"0.75206774",
"0.6758624",
"0.6683957",
"0.6526523",
"0.6526523",
"0.6434573",
"0.60533065",
"0.5821718",
"0.5813385",
"0.5796677",
"0.5768464",
"0.57332855",
"0.57140553",
"0.55985045",
"0.55606973",
"0.5557607",
"0.5554628",
"0.5549245",
"0.5480972",
"0.547653... | 0.7593875 | 4 |
Sets the total_copies of this PrintOrder. | def total_copies(self, total_copies):
self._total_copies = total_copies | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total(self, total):\n\n self._total = total",
"def total(self, total):\n\n self._total = total",
"def total(self, total):\n\n self._total = total",
"def total(self, total):\n\n self._total = total",
"def total(self, total):\n\n self._total = total",
"def total(self,... | [
"0.6113166",
"0.6113166",
"0.6113166",
"0.6113166",
"0.6113166",
"0.6113166",
"0.6113166",
"0.6113166",
"0.60333747",
"0.57732016",
"0.57388186",
"0.5689172",
"0.5634297",
"0.56337583",
"0.5516543",
"0.55044043",
"0.5485196",
"0.53769165",
"0.53684276",
"0.5348305",
"0.532252... | 0.8669012 | 0 |
Sets the print_order_number of this PrintOrder. | def print_order_number(self, print_order_number):
self._print_order_number = print_order_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_order(self, order):\n self.order = order",
"def set_order(self, order):\n self.order = order",
"def SetOrder(self, order):\n if self.__order != order:\n self.__order = order\n self.Modified()",
"def order_id(self, order_id):\n\n self._order_id = order... | [
"0.6409879",
"0.6409879",
"0.6237386",
"0.6191487",
"0.6191487",
"0.6191487",
"0.61431205",
"0.6082574",
"0.60552984",
"0.6013527",
"0.6000968",
"0.5951708",
"0.5951708",
"0.59345603",
"0.58218366",
"0.58218366",
"0.58218366",
"0.57793134",
"0.57587093",
"0.57313746",
"0.5637... | 0.79744744 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, PrintOrder):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, PrintOrder):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Returns mocked WFWXWeatherStations codes. | def mock_get_all_stations(__):
return all_station_codes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weather_test():\r\n with open('config.json', 'r') as conf:\r\n conf = json.load(conf)\r\n # Gets the API key from the config.json file\r\n weather_api_key = conf[\"weather_api_key\"]\r\n weather_city_name = conf['weather_city_name']\r\n response = requests.get(\r\n ... | [
"0.5881804",
"0.5820802",
"0.5813036",
"0.5760741",
"0.5658666",
"0.5524567",
"0.5453644",
"0.5398223",
"0.5305969",
"0.52953804",
"0.52768004",
"0.5228826",
"0.5190549",
"0.51495624",
"0.51495624",
"0.51495594",
"0.5131718",
"0.50995255",
"0.5097224",
"0.50926465",
"0.509145... | 0.643446 | 0 |
Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
hap = hass.data[DOMAIN].pop(entry.unique_id)
hap.reset_connection_listener()
await async_unload_services(hass)
return await hap.async_reset() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok",
"async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True",
... | [
"0.697284",
"0.6888074",
"0.6779855",
"0.6747459",
"0.6689002",
"0.6657831",
"0.66162205",
"0.6603433",
"0.65925974",
"0.65595686",
"0.65411645",
"0.6507643",
"0.6507643",
"0.6507643",
"0.6507643",
"0.64977276",
"0.64931643",
"0.6486601",
"0.6486601",
"0.6486601",
"0.6486601"... | 0.6057508 | 66 |
The collection of Subnets associated with this route table. | def subnets(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "subnets") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnets(self) -> Sequence[str]:\n return pulumi.get(self, \"subnets\")",
"def subnetting(self):\n ip = netaddr.IPNetwork(addr=self.subnet)\n subnets = list(ip.subnet(prefixlen=24))\n list_subnets = [str(subnet) for subnet in subnets]\n return list_subnets",
"def subnets(s... | [
"0.71657276",
"0.7023505",
"0.6913297",
"0.6913297",
"0.68888366",
"0.6719337",
"0.67022914",
"0.66911757",
"0.6690013",
"0.65455306",
"0.65207076",
"0.6471714",
"0.63513064",
"0.63412124",
"0.63073295",
"0.63073295",
"0.63073295",
"0.62113774",
"0.61977655",
"0.6111941",
"0.... | 0.6549706 | 9 |
Get an existing RouteTable resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
disable_bgp_route_propagation: Optional[pulumi.Input[bool]] = None,
location: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name, id, opts=None, destination_cidr_block=None, destination_ipv6_cidr_block=None, destination_prefix_list_id=None, egress_only_gateway_id=None, gateway_id=None, instance_id=None, instance_owner_id=None, nat_gateway_id=None, network_interface_id=None, origin=None, route_table_id=None, state=None,... | [
"0.5871627",
"0.58526504",
"0.54597586",
"0.54552907",
"0.54350156",
"0.5402898",
"0.5374085",
"0.53318334",
"0.53251505",
"0.52935326",
"0.5265902",
"0.5219427",
"0.5196864",
"0.5156814",
"0.51358294",
"0.51121175",
"0.51044965",
"0.50478804",
"0.5043819",
"0.500931",
"0.499... | 0.68457663 | 0 |
The collection of Subnets associated with this route table. | def subnets(self) -> pulumi.Output[Sequence[str]]:
return pulumi.get(self, "subnets") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnets(self) -> Sequence[str]:\n return pulumi.get(self, \"subnets\")",
"def subnetting(self):\n ip = netaddr.IPNetwork(addr=self.subnet)\n subnets = list(ip.subnet(prefixlen=24))\n list_subnets = [str(subnet) for subnet in subnets]\n return list_subnets",
"def list_subn... | [
"0.71657276",
"0.7023505",
"0.68888366",
"0.6719337",
"0.67022914",
"0.66911757",
"0.6690013",
"0.6549706",
"0.65455306",
"0.65207076",
"0.6471714",
"0.63513064",
"0.63412124",
"0.63073295",
"0.63073295",
"0.63073295",
"0.62113774",
"0.61977655",
"0.6111941",
"0.6111941",
"0.... | 0.6913297 | 3 |
Initialize weights and biases for the neural network | def initialize(self):
params = {}
for i in range(1, len(self.layer_dimensions)):
params['b_' + str(i)] = np.ones((self.layer_dimensions[i], 1))
if self.he_initialization:
params['W_' + str(i)] = np.random.randn(self.layer_dimensions[i],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_weights(self, weights_initializer, bias_initializer):\n wshapes = [\n [self.input_size, self.hidden_size[0]],\n [self.hidden_size[0], self.hidden_size[1]],\n [self.hidden_size[1], self.output_size]\n ]\n\n bshapes = [\n [1, self.hidden... | [
"0.8150532",
"0.807495",
"0.7868716",
"0.7817104",
"0.7799606",
"0.7794396",
"0.7763348",
"0.772334",
"0.77120733",
"0.768731",
"0.767836",
"0.76647717",
"0.7624336",
"0.7608823",
"0.7586095",
"0.754724",
"0.7544781",
"0.7526528",
"0.75120896",
"0.7500113",
"0.74833393",
"0... | 0.0 | -1 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.7473328 | 34 |
Public method to get a list of all actions. list of all actions (list of E5Action) | def getActions(self):
actions = self.actions[:]
return actions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_list_of_actions(self):\n return self.actions",
"def actions(self):\n return self._action_list",
"def get_actions(self):\n return []",
"def actions(self) -> list:\n if self.debug: print(f\"AState.actions()\")\n if not self._examined:\n if self.debug: print... | [
"0.82360893",
"0.8200112",
"0.81789607",
"0.7947306",
"0.782599",
"0.7823957",
"0.7751051",
"0.7736551",
"0.7727532",
"0.7727532",
"0.7727532",
"0.77144",
"0.77144",
"0.763863",
"0.76068455",
"0.75958765",
"0.7533623",
"0.74555093",
"0.7406255",
"0.7403878",
"0.74034977",
"... | 0.78777856 | 4 |
Gets the average cross entropy after having applied a sigmoid. | def sigmoid_xent(logits, targets):
# reshape them into one huge batch
logits = tf.concat(0, logits)
targets = tf.concat(0, targets)
return tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(
logits, targets)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_mean(self):\n mu = self._get_conditional_negative_energy()\n return sigmoid(mu)",
"def entropy(y):\n EPS = 0.0005\n\n # YOUR CODE HERE\n if len(y) == 0:\n return 0.\n \n pk = np.mean(y, axis=0)\n \n return - np.sum(pk * np.log(pk + EPS))",
"def cross_entropy(s... | [
"0.6759136",
"0.675079",
"0.6566973",
"0.65583605",
"0.6532379",
"0.65213853",
"0.6434185",
"0.6431398",
"0.6426622",
"0.6387513",
"0.63833225",
"0.63725597",
"0.6367368",
"0.6367368",
"0.6356879",
"0.6338973",
"0.632099",
"0.63172376",
"0.63145524",
"0.6311564",
"0.63037443"... | 0.60542774 | 93 |
The set of arguments for constructing a Zone resource. | def __init__(__self__, *,
discovery_spec: pulumi.Input['ZoneDiscoverySpecArgs'],
lake: pulumi.Input[str],
location: pulumi.Input[str],
resource_spec: pulumi.Input['ZoneResourceSpecArgs'],
type: pulumi.Input[str],
descr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: ZoneArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n args: Optional[ZoneArgs] = None,\n opts: ... | [
"0.7354836",
"0.71310985",
"0.6832822",
"0.64455605",
"0.64455605",
"0.63004786",
"0.61414325",
"0.6081677",
"0.6061686",
"0.5874698",
"0.58457977",
"0.58440346",
"0.57786363",
"0.5751368",
"0.5665804",
"0.56486547",
"0.5626863",
"0.56024945",
"0.55568105",
"0.5540788",
"0.55... | 0.553084 | 22 |
Optional. User defined labels for the zone. | def labels(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
return pulumi.get(self, "labels") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_zone_label(value):\n if not re.match(r'^[a-z0-9][\\.\\-0-9a-z]*[\\.0-9a-z]$', value):\n msg = _(\"Labels must start and end with a letter or digit, \"\n \"and have as interior characters only letters, digits, and hyphen.\")\n raise ValidationError(msg)\n if not value... | [
"0.6009139",
"0.59833145",
"0.5967806",
"0.58541787",
"0.5788232",
"0.5785354",
"0.5785354",
"0.5785354",
"0.5785354",
"0.5785354",
"0.5785354",
"0.5785354",
"0.5785354",
"0.57708",
"0.57708",
"0.5692499",
"0.5670708",
"0.5655068",
"0.5647142",
"0.5647142",
"0.5647142",
"0.... | 0.564672 | 22 |
The name of the zone. | def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zone_name(self):\n return self._zone_name",
"def name(self):\n return f\"{self.zone_name} {self.zone_variable}\"",
"def name(self) -> str | None:\n if self.zone.GroupName is not None:\n return self.zone.GroupName\n\n return self.zone.Name",
"def zone(self) -> str:\n... | [
"0.9159633",
"0.8689201",
"0.8272565",
"0.8163957",
"0.8163957",
"0.8147982",
"0.7571905",
"0.7571905",
"0.7571905",
"0.7571905",
"0.7571905",
"0.7521073",
"0.7498098",
"0.7311547",
"0.7273632",
"0.7273632",
"0.7273632",
"0.7273632",
"0.7177359",
"0.7156745",
"0.71311027",
... | 0.0 | -1 |
Output only. The time when the zone was created. | def create_time(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "create_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_time(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"create_time\")",
"def create_time(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"create_time\")",
"def create_time(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"create_time\")",
"def create_time... | [
"0.7796042",
"0.7796042",
"0.7796042",
"0.7796042",
"0.7796042",
"0.7796042",
"0.7796042",
"0.7796042",
"0.7796042",
"0.7796042",
"0.7714977",
"0.7706203",
"0.7706203",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.752945... | 0.0 | -1 |
Optional. User defined labels for the zone. | def labels(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
return pulumi.get(self, "labels") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_zone_label(value):\n if not re.match(r'^[a-z0-9][\\.\\-0-9a-z]*[\\.0-9a-z]$', value):\n msg = _(\"Labels must start and end with a letter or digit, \"\n \"and have as interior characters only letters, digits, and hyphen.\")\n raise ValidationError(msg)\n if not value... | [
"0.6009139",
"0.59833145",
"0.5967806",
"0.58541787",
"0.5788232",
"0.5785354",
"0.5785354",
"0.5785354",
"0.5785354",
"0.5785354",
"0.5785354",
"0.5785354",
"0.5785354",
"0.57708",
"0.57708",
"0.5692499",
"0.5670708",
"0.5655068",
"0.5647142",
"0.5647142",
"0.5647142",
"0.... | 0.564672 | 25 |
The name of the zone. | def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zone_name(self):\n return self._zone_name",
"def name(self):\n return f\"{self.zone_name} {self.zone_variable}\"",
"def name(self) -> str | None:\n if self.zone.GroupName is not None:\n return self.zone.GroupName\n\n return self.zone.Name",
"def zone(self) -> str:\n... | [
"0.9159633",
"0.8689201",
"0.8272565",
"0.8163957",
"0.8163957",
"0.8147982",
"0.7571905",
"0.7571905",
"0.7571905",
"0.7571905",
"0.7571905",
"0.7521073",
"0.7498098",
"0.7311547",
"0.7273632",
"0.7273632",
"0.7273632",
"0.7273632",
"0.7177359",
"0.7156745",
"0.71311027",
... | 0.0 | -1 |
Output only. The time when the zone was created. | def create_time(self) -> pulumi.Output[str]:
return pulumi.get(self, "create_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_time_utc(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"created_time_utc\")",
"def created_time(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"created_time\")",
"def created_time(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"created_time\")",
"d... | [
"0.7714977",
"0.7706203",
"0.7706203",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
"0.75294584",
... | 0.7796042 | 1 |
Optional. User defined labels for the zone. | def labels(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
return pulumi.get(self, "labels") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_zone_label(value):\n if not re.match(r'^[a-z0-9][\\.\\-0-9a-z]*[\\.0-9a-z]$', value):\n msg = _(\"Labels must start and end with a letter or digit, \"\n \"and have as interior characters only letters, digits, and hyphen.\")\n raise ValidationError(msg)\n if not value... | [
"0.6009139",
"0.59833145",
"0.5967806",
"0.58541787",
"0.5788232",
"0.5785354",
"0.5785354",
"0.5785354",
"0.5785354",
"0.5785354",
"0.5785354",
"0.5785354",
"0.5785354",
"0.57708",
"0.57708",
"0.5692499",
"0.5670708",
"0.5655068",
"0.564672",
"0.564672",
"0.564672",
"0.564... | 0.5647142 | 18 |
The name of the zone. | def name(self) -> pulumi.Output[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zone_name(self):\n return self._zone_name",
"def name(self):\n return f\"{self.zone_name} {self.zone_variable}\"",
"def name(self) -> str | None:\n if self.zone.GroupName is not None:\n return self.zone.GroupName\n\n return self.zone.Name",
"def zone(self) -> str:\n... | [
"0.9159633",
"0.8689201",
"0.8272565",
"0.8163957",
"0.8163957",
"0.8147982",
"0.7571905",
"0.7571905",
"0.7571905",
"0.7571905",
"0.7571905",
"0.7521073",
"0.7498098",
"0.7311547",
"0.7273632",
"0.7273632",
"0.7273632",
"0.7273632",
"0.7177359",
"0.7156745",
"0.71311027",
... | 0.0 | -1 |
Initialize weights with random numbers between 0 and 1 | def randomize(self):
self.weights = np.random.rand(*self.weights.shape) - 0.5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def WeightInitializer():\n return np.random.uniform(-1, 1)",
"def weightGenerate(self):\n\t\tfor i in range(0, self.numberOfInput):\n\t\t\tself.weight.append(random.random()-0.5)",
"def weights_initializer(self):\n self.weights = [np.random.normal(0, 1 / np.sqrt(x), (x, y)) for x, y in list(zip(self.... | [
"0.84551823",
"0.8309083",
"0.8242246",
"0.81139135",
"0.8112311",
"0.8101379",
"0.8051563",
"0.80439454",
"0.80034786",
"0.790312",
"0.7882631",
"0.7812948",
"0.77870333",
"0.7771946",
"0.7724537",
"0.77069384",
"0.7676862",
"0.7625745",
"0.7580956",
"0.7579977",
"0.7568427"... | 0.80293894 | 8 |
Returns the value only for a given scoreboard item. | def __getattr__(self, attr):
return LazyScoreboardEntry(self, attr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_player_item_val(self, choice_of_item, user):\n\n for key in user.player_inventory:\n\n if choice_of_item == key:\n return user.player_inventory[key]\n\n return False",
"def get_item(query, key):\r\n\tfor element in query:\r\n\t\tif (list(element)[0].get('game__name... | [
"0.70492065",
"0.6628471",
"0.63588285",
"0.6351622",
"0.6351622",
"0.6351622",
"0.6292585",
"0.628387",
"0.628387",
"0.6256097",
"0.6244072",
"0.612797",
"0.60616016",
"0.60616016",
"0.60616016",
"0.60606277",
"0.6040604",
"0.60048467",
"0.5976044",
"0.5976044",
"0.59746385"... | 0.0 | -1 |
Return value of top element without removing from stack | def top(self) -> object:
return self._data[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top(stack):\n if empty_stack(stack):\n raise IndexError(\"Stack is empty!\")\n else:\n return stack.top.value",
"def top(self):\n\t\tif self.is_empty():\n\t\t\traise Empty('Stack is empty')\n\t\treturn self._head._element",
"def top(self):\n if self.stack == []:\n retu... | [
"0.83318007",
"0.81100655",
"0.80892026",
"0.8075631",
"0.80618685",
"0.79362243",
"0.7916097",
"0.7908167",
"0.78884083",
"0.78880435",
"0.7872301",
"0.7866546",
"0.7832417",
"0.7830693",
"0.77820283",
"0.778126",
"0.7778161",
"0.77772",
"0.7749871",
"0.7746659",
"0.77423126... | 0.71825653 | 66 |
Initialize empty queue based on Python list | def __init__(self):
self._data = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_empty_queue():\n return Queue(0, None, None)",
"def __init__(self):\n self.queue = []\n self.queue.append(Queue())\n self.queue.append(Queue())\n self.tag = 0 # using to record which queue contain the data",
"def __init__(self) -> None:\n self._queue = []",
"def... | [
"0.76686674",
"0.75461084",
"0.74717855",
"0.7373376",
"0.7352881",
"0.7327719",
"0.7327719",
"0.7323243",
"0.7320393",
"0.7320393",
"0.7320393",
"0.7320393",
"0.7320393",
"0.731801",
"0.731801",
"0.7256335",
"0.7252858",
"0.72324866",
"0.7214158",
"0.71929574",
"0.71722823",... | 0.0 | -1 |
Return True if the queue is empty, return False otherwise | def is_empty(self):
return len(self._data) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return self.queue == []",
"def empty(self) -> bool: \n if(self.queue is not None and len(self.queue) > 0):\n print(\"len > 0\" )\n return False\n else:\n print(\"len = 0\" )\n return True",
"def empty(self) -> bool:\n ... | [
"0.9123533",
"0.9076229",
"0.90322787",
"0.900755",
"0.900755",
"0.89948964",
"0.8985214",
"0.89755434",
"0.890774",
"0.8907057",
"0.8879381",
"0.8855857",
"0.8773003",
"0.8752333",
"0.8752333",
"0.8737812",
"0.87300223",
"0.8718975",
"0.8668069",
"0.8608854",
"0.8599517",
... | 0.0 | -1 |
this method counts number of nodes in binary search tree w/out child leaf returning nodes w/no child leaf. | def count_leaves(self) -> int:
# binary search tree == empty
if self.root is None:
return 0
#recursive helper function +=count total leaf
return self.count_leaves_helper(self.root) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leaf_count(self) -> int:\n if self.children == []:\n return 1\n else:\n return sum([x.leaf_count() for x in self.children])",
"def count_leaf(self):\n if self.is_empty():\n return 0\n elif self.is_leaf():\n return 1\n else:\n ... | [
"0.8191787",
"0.80043274",
"0.78798944",
"0.78184474",
"0.7785466",
"0.7688838",
"0.7555164",
"0.7476981",
"0.747231",
"0.73464894",
"0.7337431",
"0.72705823",
"0.71710014",
"0.7140156",
"0.7129322",
"0.7117271",
"0.7093735",
"0.7083033",
"0.70600224",
"0.70387775",
"0.701029... | 0.78432745 | 3 |
tokenize speeches in corpus, i.e. split speeches into words | def tokenizer(self, speech, gram):
tokenized_speech = nltk.word_tokenize(speech)
if len(tokenized_speech) < gram:
pass
else:
for i in range(len(tokenized_speech) - gram):
yield (tokenized_speech[i:i + (gram + 1)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(sentence):\n return nltk.word_tokenize(sentence)",
"def tokenize(sentence):\n tokens = nltk.word_tokenize(sentence)\n return tokens",
"def processes_and_tokenize(raw_document):\n\ttokenizer = RegexpTokenizer(r'\\w+')\n\ttokens = tokenizer.tokenize(raw_document.lower())\t\t# tokens = nltk.... | [
"0.7376577",
"0.7286657",
"0.72817963",
"0.7265486",
"0.7257394",
"0.7254207",
"0.72431564",
"0.72307616",
"0.7193109",
"0.717814",
"0.7135839",
"0.71121866",
"0.7106632",
"0.71049225",
"0.7084513",
"0.7077759",
"0.70629334",
"0.7035108",
"0.70298463",
"0.7024693",
"0.7009517... | 0.0 | -1 |
Get a logger instance for the specified name. | def get_logger(name, level=None):
if not level:
level = os.environ.get('LOGGER_LEVEL', 'INFO')
logger = logging.getLogger(name)
set_formatter(logger)
try:
logger.setLevel(level.upper())
except (TypeError, ValueError) as err:
logger.setLevel('INFO')
logger.error('De... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_logger(name):\n # type: (str) -> Logger\n return logging.getLogger(name)",
"def get_logger(name: str) -> logging.Logger:\n \n return logging.getLogger(name)",
"def get_logger(name):\n return logging.getLogger(name)",
"def get_logger(name: str) -> logging.Logger:\n\n if name ... | [
"0.8718238",
"0.8652342",
"0.8634775",
"0.83877367",
"0.83760273",
"0.818896",
"0.81120336",
"0.8081596",
"0.80767435",
"0.80631524",
"0.80459535",
"0.80183995",
"0.7991212",
"0.7983424",
"0.7963621",
"0.7929301",
"0.7914633",
"0.78963315",
"0.78936064",
"0.7884218",
"0.78607... | 0.7095772 | 55 |
Get the length of the dataset | def __len__(self):
return len(self.index_complexes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __len__(self):\n return self.dataset.shape[0]",
"def __len__(self):\n return self._dataset.size(dirs=self._dirs)",
"def __len__(self):\n return len(self.dataset)",
"def __len__(self):\n return self.data.num_samples",
"def __len__(self): \r\n length = len(self.d... | [
"0.84423757",
"0.8413128",
"0.83421916",
"0.82973254",
"0.82494926",
"0.8207219",
"0.81764525",
"0.81082726",
"0.8073012",
"0.80676347",
"0.80647767",
"0.8061671",
"0.8061671",
"0.8061671",
"0.8057673",
"0.8030924",
"0.7995581",
"0.7990975",
"0.79832274",
"0.79832274",
"0.798... | 0.0 | -1 |
Get one item from its unique index. | def __getitem__(self, index):
fname, mol, angle, axis = self.index_complexes[index]
try:
if self.mapfly:
feature, target = self.map_one_molecule(
fname, mol, angle, axis)
else:
feature, target = self.load_one_molecule(fname, mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_by_index(self, index):\n if index > self.length - 1:\n return None\n else:\n return self.items[index]",
"def get_item(self, index: int) -> _T:\n return self.index_to_item[index]",
"def __getitem__(self, index):\n if index >= self.size:\n rais... | [
"0.80559474",
"0.80357444",
"0.7545081",
"0.7522034",
"0.7499732",
"0.7447198",
"0.74182665",
"0.7263781",
"0.72212",
"0.7205928",
"0.7204658",
"0.7202515",
"0.71968883",
"0.717864",
"0.71686804",
"0.71039665",
"0.70536226",
"0.7010679",
"0.7009249",
"0.69935846",
"0.69820976... | 0.0 | -1 |
Get the shape of the matrices. | def get_grid_shape(self):
if self.mapfly is False:
fname = self.train_database[0]
fh5 = h5py.File(fname, 'r')
mol = list(fh5.keys())[0]
# get the mol
mol_data = fh5.get(mol)
# get the grid size
if 'grid_points' in mol_data:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matShape(mat):\n return (len(mat),len(mat[0]))",
"def shape(self) -> (int,int):\n return (len(self.mat), len(self.mat[0]))",
"def matrix_shape(matrix):\n shape = []\n while isinstance(matrix, list):\n shape.append(len(matrix))\n matrix = matrix[0]\n return shape",
"def ma... | [
"0.7712211",
"0.7686996",
"0.7419568",
"0.74073565",
"0.74073565",
"0.73708606",
"0.721726",
"0.7146609",
"0.71406317",
"0.71241087",
"0.7092974",
"0.7066498",
"0.70445216",
"0.6992688",
"0.69610596",
"0.69430715",
"0.6930209",
"0.6930209",
"0.69042957",
"0.6901392",
"0.68774... | 0.0 | -1 |
Convert the 3D volumetric feature to a 2D planar data set. proj2d specifies the dimension that we want to consider as channel for example for proj2d = 0 the 2D images are in the yz plane and the stack along the x dimension is considered as extra channels | def convert2d(feature, proj2d):
nc, nx, ny, nz = feature.shape
if proj2d == 0:
feature = feature.reshape(-1, 1, ny, nz).squeeze()
elif proj2d == 1:
feature = feature.reshape(-1, nx, 1, nz).squeeze()
elif proj2d == 2:
feature = feature.reshape(-1, nx, n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_3d(points_2d, depth_image, image):\n fx = 525.0 # focal length x\n fy = 525.0 # focal length y\n cx = 319.5 # optical center x\n cy = 239.5 # optical center y\n factor = 5000 # for the 16-bit PNG files\n points_3d = []\n cols = []\n colors = cv2.cvtColor(image, cv2.COLOR_BGR... | [
"0.61655056",
"0.6126225",
"0.6043291",
"0.5951283",
"0.5860615",
"0.5803394",
"0.57916594",
"0.5668631",
"0.5622792",
"0.55863667",
"0.5542534",
"0.5518766",
"0.5505185",
"0.5495877",
"0.54815495",
"0.54062146",
"0.5394705",
"0.5394705",
"0.53934497",
"0.5384202",
"0.5373974... | 0.70830244 | 0 |
get TransientHydraulicProblem density law | def getDensityLaw(self):
return self.densityLaw | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def density(temp,pres):\n g_p = liq_g(0,1,temp,pres)\n dliq = g_p**(-1)\n return dliq",
"def density_by_ideal_gas_law(\n p: tf.Tensor,\n r: tf.Tensor,\n t: tf.Tensor,\n ) -> tf.Tensor:\n return p / r / t",
"def test_density(self):\n sol = Mader(p_cj=3.0e11, d_cj=8.0e5, gamma=... | [
"0.6882342",
"0.6599746",
"0.64777887",
"0.64145166",
"0.6364051",
"0.6276157",
"0.62638587",
"0.61633986",
"0.61445427",
"0.6134667",
"0.6118557",
"0.609986",
"0.609986",
"0.6077311",
"0.6074745",
"0.6074745",
"0.6074745",
"0.60665804",
"0.60298896",
"0.60230553",
"0.6017337... | 0.6749081 | 1 |
Initial condition initialisation with one or several zones a value of type Pressure | def __init__(self, zone, value):
from datamodel import Pressure
CommonInitialCondition.__init__(self,zone, value,[Pressure]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, value):\n if isinstance(value, Pressure):\n value = Pascal(value.base_value).atmosphere.value\n self.base_value = value * 101325.0\n self.value = float(value)",
"def __init__(self, value):\n if isinstance(value, Pressure):\n value = value.base_... | [
"0.62325925",
"0.60841477",
"0.607276",
"0.60101783",
"0.5897049",
"0.5880026",
"0.58534807",
"0.5802205",
"0.5765876",
"0.57585084",
"0.56963295",
"0.5653576",
"0.5649353",
"0.5635758",
"0.5556751",
"0.5543118",
"0.55222076",
"0.55205715",
"0.54853505",
"0.5484898",
"0.54151... | 0.7955421 | 0 |
Returns the minimax action using self.depth and self.evaluationFunction | def getAction(self, gameState):
bestVal = -INF
bestAction = None
searchDepth = self.depth * gameState.getNumAgents()
for action in gameState.getLegalActions(0):
state = gameState.generateSuccessor(0, action)
newVal = self.alphaBeta(state, 1, searchDepth - 1, bestV... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o... | [
"0.7482665",
"0.7383559",
"0.71806973",
"0.7110041",
"0.70884514",
"0.70694935",
"0.70683014",
"0.7048308",
"0.70055133",
"0.69651455",
"0.69642085",
"0.69604385",
"0.6945924",
"0.68998593",
"0.6895832",
"0.688605",
"0.6826282",
"0.6767276",
"0.6758028",
"0.6751636",
"0.67054... | 0.0 | -1 |
Read json file to get fixture data | def read_json_breakdown(cls, fname):
if not os.path.exists(fname):
raise RuntimeError
with open(fname, 'r') as data_file:
return cls.fixup_from_json(data_file.read()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_json_fixture(filename: str) -> Any:\n return json.loads(load_fixture(f\"jellyfin/{filename}\"))",
"def read_json_fixture(filename: str) -> Dict[str, str]:\n fixture_path = Path(__file__).resolve().parents[0] / f\"fixtures/{filename}\"\n with open(fixture_path, mode=\"r\") as f:\n data = ... | [
"0.77673066",
"0.7742995",
"0.7529772",
"0.7462663",
"0.7311161",
"0.72554153",
"0.7206685",
"0.70404714",
"0.6974985",
"0.69517463",
"0.69133985",
"0.6885586",
"0.68298525",
"0.6824825",
"0.6750456",
"0.6731613",
"0.6725586",
"0.671274",
"0.67016304",
"0.6696543",
"0.6687426... | 0.66075456 | 24 |
Add item to end of array | def enqueue(self, item):
self.__items__.append(item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, item):\n if self.full or self.pre_allocated:\n # overwrite\n self.data[self.cur] = item\n else:\n self.data.append(item)\n if not self.full:\n self.full = self.cur == self.max - 1\n self.cur = (self.cur + 1) % self.max",
"de... | [
"0.77589345",
"0.7565443",
"0.73017997",
"0.71880394",
"0.7040221",
"0.70051485",
"0.6969625",
"0.69582",
"0.69552433",
"0.6928398",
"0.692293",
"0.6874656",
"0.68484104",
"0.68166244",
"0.6810555",
"0.6788595",
"0.6787796",
"0.67822814",
"0.67619467",
"0.6753564",
"0.6724716... | 0.0 | -1 |
SUMMARY Returns a numpy array of the x (horizontal) coordinate of each feature. RETURNS A numpy array. EXAMPLE >>> img = Image("lenna") >>> feats = img.findBlobs() >>> xs = feats.x() >>> print xs | def x(self):
return np.array([f.x for f in self]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findX(self):\n return self.x",
"def get_X():\n metadata = get_dataset_metadata(['shape_X', 'type_X'])\n return get_ndarray(name='X_original',\n arr_shape=metadata['shape_X'],\n arr_type=metadata['type_X'])",
"def getBallX(state):\n region = state[... | [
"0.629154",
"0.6222868",
"0.6132022",
"0.6102949",
"0.6067411",
"0.6044597",
"0.59955394",
"0.59955394",
"0.5957154",
"0.5956193",
"0.5947403",
"0.5936269",
"0.58934754",
"0.58501095",
"0.58295965",
"0.5765225",
"0.57508916",
"0.5699015",
"0.5684263",
"0.5657271",
"0.5641937"... | 0.6366749 | 0 |
SUMMARY Returns a numpy array of the y (vertical) coordinate of each feature. RETURNS A numpy array. EXAMPLE >>> img = Image("lenna") >>> feats = img.findBlobs() >>> xs = feats.y() >>> print xs | def y(self):
return np.array([f.y for f in self]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_y(img):\n\theight = img.shape[0]\n\twidth = img.shape[1]\n\ty_data = np.empty([height,width])\n\tfor i in np.arange(height):\n\t\tfor j in np.arange(width):\n\t\t\ty_data[i][j] = img[i][j][0]\n\treturn y_data",
"def y(self) -> np.ndarray:\n return self.array[:, 2] if self.scalar_vector else self.... | [
"0.6644193",
"0.6487755",
"0.64837325",
"0.6468996",
"0.6430335",
"0.6384508",
"0.6337822",
"0.6276514",
"0.62628865",
"0.6215891",
"0.6196656",
"0.61693174",
"0.612596",
"0.61052966",
"0.605782",
"0.60460955",
"0.6036221",
"0.6036221",
"0.6004762",
"0.60015345",
"0.60007876"... | 0.66503173 | 0 |
SUMMARY Return only the features left of the region. where region can be a bounding box, bounding circle, a list of tuples in a closed polygon, or any other featutres. PARAMETERS region A bounding box of the form (x,y,w,h) where x,y is the upper left corner A bounding circle of the form (x,y,r) A list of x,y tuples def... | def left(self,region):
fs = FeatureSet()
for f in self:
if(f.left(region)):
fs.append(f)
return fs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right(self,region):\n fs = FeatureSet()\n for f in self:\n if(f.right(region)):\n fs.append(f)\n return fs",
"def register_left_feature(features):\n feature_name = 'left'\n type_ = 'paragraph-left'\n tag = 'p'\n\n control = {\n 'type': type_,\... | [
"0.57361525",
"0.56578624",
"0.5607252",
"0.5511851",
"0.53315806",
"0.52918774",
"0.5265833",
"0.51951736",
"0.51674837",
"0.5156653",
"0.5156653",
"0.5143771",
"0.51388305",
"0.50740343",
"0.50362265",
"0.50322294",
"0.502206",
"0.4992297",
"0.49749187",
"0.4962348",
"0.494... | 0.7764643 | 0 |
SUMMARY This method returns True if the feature is less than `tolerance` pixels away from the nearest edge. PARAMETERS tolerance the distance in pixels at which a feature qualifies as being on the image edge. RETURNS True if the feature is on the edge, False otherwise. EXAMPLE >>> img = Image("../sampleimages/EdgeTest1... | def onImageEdge(self,tolerance=1):
# this has to be one to deal with blob library weirdness that goes deep down to opencv
return ( self.distanceToNearestEdge() <= tolerance ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notOnImageEdge(self,tolerance=1):\n\n # this has to be one to deal with blob library weirdness that goes deep down to opencv\n return ( self.distanceToNearestEdge() > tolerance )",
"def onImageEdge(self, tolerance=1):\n fs = FeatureSet()\n for f in self:\n if(f.onImageE... | [
"0.6894663",
"0.6615612",
"0.61319155",
"0.5869453",
"0.5831345",
"0.57640666",
"0.5702552",
"0.56024694",
"0.5568165",
"0.5493514",
"0.5448794",
"0.5372206",
"0.53703314",
"0.5348079",
"0.53450143",
"0.5342618",
"0.5338717",
"0.53188705",
"0.5308406",
"0.5306649",
"0.5296579... | 0.7404134 | 0 |
SUMMARY This method return the maximum y value of the bounding box of the the feature. RETURNS An integer value of the maximum y value of the feature. EXAMPLE >>> img = Image("OWS.jpg") >>> blobs = img.findBlobs(128) >>> print blobs[1].maxY() | def maxY(self):
self._updateExtents()
return self._mMaxY | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argmaxY( self ):\n max = -1e30\n for i in range( 0, self.GetN() ):\n p = ( ROOT.Double(), ROOT.Double() )\n self.GetPoint( i, p[0], p[1] )\n if p[1] > max: max = p[1]\n return max",
"def ymax(self):\n return self.bbox[1][1]",
"def maxY(self):\n return ma... | [
"0.72934586",
"0.6561068",
"0.65189326",
"0.6359099",
"0.62487507",
"0.62027574",
"0.6197729",
"0.61772525",
"0.6175013",
"0.61732596",
"0.6125043",
"0.6117086",
"0.61033326",
"0.6095165",
"0.6095136",
"0.60769486",
"0.6065573",
"0.6015978",
"0.60016775",
"0.59914094",
"0.598... | 0.6525728 | 2 |
SUMMARY This method return the minimum x value of the bounding box of the the feature. RETURNS An integer value of the maxium x value of the feature. EXAMPLE >>> img = Image("OWS.jpg") >>> blobs = img.findBlobs(128) >>> print blobs[1].maxX() | def maxX(self):
self._updateExtents()
return self._mMaxX | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maxX(self):\n return max(self.getx())",
"def extractPeak( image, nSizeX, nSizeY, nMaxSize, nMaxNbr = 5, nErrorValue = -1 ):\n blobs = []; # will contain the center of the blob and it's max value\n nSmallerMax = 0; # the max value of the smallest peak\n nSmallerIdx = -1;\n nMaxSizeSquared ... | [
"0.674375",
"0.66041124",
"0.6271823",
"0.6265301",
"0.59958845",
"0.59888023",
"0.5986488",
"0.59683293",
"0.595866",
"0.59018505",
"0.5893133",
"0.5893133",
"0.5887316",
"0.5882395",
"0.5882395",
"0.5811771",
"0.579857",
"0.5787553",
"0.5779743",
"0.5778747",
"0.5718551",
... | 0.67716175 | 0 |
SUMMARY This method returns the top left corner of the bounding box of the blob as an (x,y) tuple. RESULT Returns a tupple of the top left corner. EXAMPLE >>> img = Image("OWS.jpg") >>> blobs = img.findBlobs(128) >>> print blobs[1].topLeftCorner() | def topLeftCorner(self):
self._updateExtents()
return (self._mMinX,self._mMinY) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_left(self, obj):\n if (obj.__class__.__name__ == 'PhysicalObject') or (issubclass(obj.__class__, laygo2.object.PhysicalObject)):\n return self.top_left(obj.bbox)\n else:\n _i = self.bbox(obj)\n return np.array([_i[0, 0], _i[1, 1]])",
"def find_boundbox(self,... | [
"0.64212155",
"0.6393445",
"0.63797563",
"0.6354153",
"0.6239047",
"0.622133",
"0.622133",
"0.62032187",
"0.61718625",
"0.61718625",
"0.616448",
"0.61640435",
"0.6102946",
"0.6091035",
"0.60876626",
"0.6086416",
"0.6085846",
"0.6078524",
"0.6075107",
"0.6074141",
"0.6073407",... | 0.6814323 | 0 |
SUMMARY This method returns the bottom left corner of the bounding box of the blob as an (x,y) tuple. RESULT Returns a tupple of the bottom left corner. EXAMPLE >>> img = Image("OWS.jpg") >>> blobs = img.findBlobs(128) >>> print blobs[1].bottomLeftCorner() | def bottomLeftCorner(self):
self._updateExtents()
return (self._mMinX,self._mMaxY) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottomRightCorner(self):\n self._updateExtents()\n return (self._mMaxX,self._mMaxY)",
"def get_bottom_corners(corners):\n bottom_corners = np.concatenate(\n [sorted(rect, key=getY)[2:] for rect in corners])\n return sorted(bottom_corners, key=getX)",
"def find_boundbox(self, poin... | [
"0.65687793",
"0.6411761",
"0.63669497",
"0.6340371",
"0.63056654",
"0.6247886",
"0.62206036",
"0.62141293",
"0.6158728",
"0.6153948",
"0.6105154",
"0.6094398",
"0.60481995",
"0.601313",
"0.6008045",
"0.59988016",
"0.59972495",
"0.59831774",
"0.59787667",
"0.5973935",
"0.5973... | 0.70150304 | 0 |
SUMMARY This method returns the top right corner of the bounding box of the blob as an (x,y) tuple. RESULT Returns a tupple of the top right corner. EXAMPLE >>> img = Image("OWS.jpg") >>> blobs = img.findBlobs(128) >>> print blobs[1].topRightCorner() | def topRightCorner(self):
self._updateExtents()
return (self._mMaxX,self._mMinY) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topRightCorners(self):\n return np.array([f.topRightCorner() for f in self])",
"def top_right(self, obj):\n if (obj.__class__.__name__ == 'PhysicalObject') or (issubclass(obj.__class__, laygo2.object.PhysicalObject)):\n return self.top_right(obj.bbox)\n else:\n _i =... | [
"0.6617693",
"0.6574888",
"0.6415957",
"0.6213901",
"0.6179905",
"0.6168113",
"0.6133508",
"0.6124997",
"0.60771847",
"0.603938",
"0.6011501",
"0.60113335",
"0.5994933",
"0.59715945",
"0.5954977",
"0.5946274",
"0.5927028",
"0.59159076",
"0.5845862",
"0.5814942",
"0.5802303",
... | 0.69554585 | 0 |
SUMMARY Return true if the feature overlaps the object, where object can be a bounding box, bounding circle, a list of tuples in a closed polygon, or any other featutres. PARAMETERS object A bounding box of the form (x,y,w,h) where x,y is the upper left corner A bounding circle of the form (x,y,r) A list of x,y tuples ... | def overlaps(self, other):
retVal = False
bounds = self.points
if( isinstance(other,Feature) ):# A feature
retVal = True
for p in other.points: # this isn't completely correct - only tests if points lie in poly, not edges.
retVal = self._pointInsidePolygo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_intersection(self, obj):\r\n obj_x, obj_y = obj.get_location()\r\n x = self.__x\r\n y = self.__y\r\n # Distance formula\r\n distance = sqrt((obj_x - x) ** 2 + (obj_y - y) ** 2)\r\n if distance <= obj.get_radius() + self.__radius:\r\n return True\r\n ... | [
"0.6347922",
"0.6319836",
"0.6293673",
"0.60669565",
"0.605203",
"0.59729743",
"0.5947666",
"0.59063464",
"0.5760402",
"0.57254195",
"0.5683913",
"0.5683913",
"0.5679624",
"0.565674",
"0.56475306",
"0.5614343",
"0.5598072",
"0.55906665",
"0.5589737",
"0.5577485",
"0.55700684"... | 0.6251695 | 3 |
Return the last segment stored in the object. | def last_segment(self):
seg_sort = sorted(self.segments, key=lambda x: stringutil.extract_numbers(x.filename))
if seg_sort:
return seg_sort[-1]
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_seg(*args):\n return _ida_segment.get_last_seg(*args)",
"def get_segment(self):\n return self.segment",
"def get_segment(self):\n return self.segment",
"def getSegment(self):\n return self.segment",
"def getLast(self):\r\n return self._data[-1]",
"def getEnd(self... | [
"0.74298626",
"0.69383943",
"0.69383943",
"0.6784911",
"0.66789234",
"0.66358966",
"0.6544928",
"0.65297973",
"0.6431696",
"0.6410653",
"0.63846254",
"0.6321637",
"0.6272501",
"0.6240716",
"0.6208334",
"0.61750114",
"0.61173475",
"0.61157143",
"0.6106273",
"0.60979",
"0.60903... | 0.74668187 | 0 |
Generate a single batch from the current cursor position in the data. | def _next_batch(self):
batch = np.zeros(shape=(self._batch_size, vocabulary_size), dtype=np.float)
for b in range(self._batch_size):
batch[b, char2id(self._text[self._cursor[b]])] = 1.0
self._cursor[b] = (self._cursor[b] + 1) % self._text_size
return batch | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _next_batch(self):\n batch = np.zeros(shape=(self._batch_size, vocabulary_size), dtype=np.float)\n for b in range(self._batch_size):\n # same id, same index of second dimension\n batch[b, char2id(self._text[self._cursor[b]])] = 1.0\n self._cursor[b] = (self._curso... | [
"0.67493474",
"0.6660024",
"0.65867865",
"0.658619",
"0.65626955",
"0.6516139",
"0.64412314",
"0.64412314",
"0.63997316",
"0.63963693",
"0.6388216",
"0.6380586",
"0.6371006",
"0.6334705",
"0.63271517",
"0.6289895",
"0.6276686",
"0.6248467",
"0.6226875",
"0.6223383",
"0.621726... | 0.66667616 | 2 |
Turn a 1hot encoding or a probability distribution over the possible characters back into its (most likely) character representation. | def characters(probabilities):
return [id2char(c) for c in np.argmax(probabilities, 1)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onehot_to_chars(self, one_hot_seq):\n gen_ints = [np.where(r==1)[0][0] for r in one_hot_seq]\n gen_chars = self.int_to_char(gen_ints)\n return gen_chars",
"def onehot_to_string(self, one_hot_seq):\n gen_ints = [np.where(r==1)[0][0] for r in one_hot_seq]\n gen_char_list = self.int_to_... | [
"0.7794495",
"0.73572046",
"0.72271067",
"0.71696323",
"0.70349836",
"0.69553447",
"0.6876608",
"0.6756664",
"0.6727349",
"0.67046124",
"0.6619752",
"0.65851325",
"0.64707804",
"0.6428075",
"0.64087",
"0.63420504",
"0.6338989",
"0.63291246",
"0.63199514",
"0.6298724",
"0.6253... | 0.60928875 | 28 |
Sample one element from a distribution assumed to be an array of normalized probabilities. | def sample_distribution(distribution):
r = random.uniform(0, 1)
s = 0
for i in range(len(distribution)):
s += distribution[i]
if s >= r:
return i
return len(distribution) - 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_one(self):\n # x = self.mean + self.sigma * np.random.normal()\n x = self.dist.sample(1)\n return x",
"def sample(self, probabilities):\n return self.sample_bernoulli(probabilities)",
"def sample(probs):\n\n probs = probs / probs.sum()\n return np.random.choice(np.arang... | [
"0.7231382",
"0.69920933",
"0.686515",
"0.6848672",
"0.6785502",
"0.6785502",
"0.6785502",
"0.65051377",
"0.6477911",
"0.6473931",
"0.64216405",
"0.64014477",
"0.6375856",
"0.63238806",
"0.6275407",
"0.6253217",
"0.6243228",
"0.6218153",
"0.6218153",
"0.62175065",
"0.6217285"... | 0.5911538 | 43 |
Turn a (column) prediction into 1hot encoded samples. | def sample(prediction):
p = np.zeros(shape=[1, vocabulary_size], dtype=np.float)
p[0, sample_distribution(prediction[0])] = 1.0
return p | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_one_hot(a):\n a = a[:, 0]\n a = a.astype(int)\n A = np.zeros((len(a), config.num_classes))\n A[np.arange(len(a)), a] = 1\n return A",
"def one_hot_encode(df, col):\n return pd.get_dummies(df, columns=[col], drop_first=True)",
"def one_hot_converter(column):\n # encode class ... | [
"0.7741421",
"0.77376133",
"0.77311134",
"0.7605853",
"0.7539538",
"0.7496446",
"0.7495923",
"0.74907154",
"0.74843967",
"0.7442956",
"0.7310723",
"0.7310169",
"0.7302923",
"0.72990006",
"0.72776663",
"0.72555137",
"0.72271734",
"0.7222733",
"0.72105426",
"0.7184412",
"0.7152... | 0.0 | -1 |
Generate a random column of probabilities. | def random_distribution():
b = np.random.uniform(0.0, 1.0, size=[1, vocabulary_size])
return b/np.sum(b, 1)[:,None] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample(self, probabilities):\n return self.sample_bernoulli(probabilities)",
"def sample(probs):\n\n probs = probs / probs.sum()\n return np.random.choice(np.arange(len(probs)), p=probs.flatten())",
"def random_distribution():\n b = np.random.uniform(0.0, 1.0, size=[1, vocabulary_size])\n re... | [
"0.6374406",
"0.6367189",
"0.621208",
"0.6099934",
"0.60623235",
"0.6043567",
"0.6032514",
"0.60292464",
"0.6012624",
"0.5984736",
"0.59398454",
"0.59206384",
"0.58835787",
"0.5838801",
"0.5838801",
"0.5836376",
"0.57978",
"0.5753392",
"0.57325506",
"0.5689183",
"0.5684144",
... | 0.62448347 | 3 |
The home page for Toeic | def index(request):
return render(request, 'Toeic/index.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)",
"def home():\n\n\treturn render_template('solai.html')",
"def home():\r\n return render_template(\r\n 'index.html',\r\n title='Home Page',\r\n year=datetime.now().year,\r... | [
"0.85302484",
"0.8487954",
"0.8391403",
"0.8375463",
"0.8373879",
"0.83453345",
"0.82867825",
"0.82867825",
"0.82867825",
"0.82867825",
"0.82867825",
"0.82867825",
"0.82867825",
"0.82867825",
"0.82867825",
"0.82867825",
"0.8271469",
"0.8246326",
"0.82209665",
"0.8117302",
"0.... | 0.7787331 | 76 |
Iters through all items of ``self._iterable_data``, yielding its data already transformed. The iterable interface is the heart of the pipeline machinery. | def __iter__(self):
for data in self._iterable_data:
yield self.transform(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n for i in range(len(self.data)):\n yield self.data[i]",
"def __iter__(self):\n return iter(self.data)",
"def __iter__(self):\n return iter(self.data)",
"def __iter__(self):\n return iter(self.data)",
"def __iter__(self):\r\n return iter(sel... | [
"0.7780013",
"0.7641839",
"0.7641839",
"0.7641839",
"0.75885725",
"0.75604516",
"0.7558404",
"0.75077176",
"0.74234104",
"0.7391247",
"0.7232183",
"0.71699744",
"0.7159896",
"0.7157508",
"0.70635194",
"0.6941785",
"0.6922579",
"0.69140595",
"0.6898908",
"0.6877208",
"0.685577... | 0.9055597 | 0 |
Wires the pipeline and returns a lazy object of the transformed data. ``data`` must be an iterable, where a full document must be returned for each loop ``rewrap`` is a bool that indicates the need to rewrap data in case iterating over it produces undesired data, for instance ``dict`` instances. ``prefetch`` is an int ... | def run(self, data, rewrap=False, prefetch=0):
if rewrap:
data = [data]
for pipe in self._pipes:
pipe.feed(data)
data = pipe
else:
iterable = self._prefetch_callable(data, prefetch) if prefetch else data
for out_data in iterable:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n logging.info(\"DataLoader __iter__()\")\n if self.enable_prefetch:\n self.join()\n self.start_async()\n else:\n self.start()\n return self",
"def __iter__(self):\n logging.info(\"DataLoader __iter__()\")\n if self.en... | [
"0.5336859",
"0.5336859",
"0.5276037",
"0.52697074",
"0.5236774",
"0.5229435",
"0.5203721",
"0.5156472",
"0.51491237",
"0.51236904",
"0.5097507",
"0.5086066",
"0.5070152",
"0.50187075",
"0.5002924",
"0.49658677",
"0.49391907",
"0.4935891",
"0.49279562",
"0.49081337",
"0.48891... | 0.7006945 | 0 |
Measure the distance errors between the contours of two segmentations. The manual contours are drawn on 2D slices. We calculate contour to contour distance for each slice. | def distance_metric(seg_A, seg_B, dx):
table_md = []
table_hd = []
X, Y, Z = seg_A.shape
for z in range(Z):
# Binary mask at this slice
slice_A = seg_A[:, :, z].astype(np.uint8)
slice_B = seg_B[:, :, z].astype(np.uint8)
# The distance is defined only when both contours e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_metric(seg_A, seg_B, dx, k):\n\n # Extract the label k from the segmentation maps to generate binary maps\n seg_A = (seg_A == k)\n seg_B = (seg_B == k)\n\n table_md = []\n table_hd = []\n X, Y, Z = seg_A.shape\n for z in range(Z):\n # Binary mask at this slice\n slic... | [
"0.62931395",
"0.61822045",
"0.5803535",
"0.5607472",
"0.5553149",
"0.5551826",
"0.54967993",
"0.54706895",
"0.54309857",
"0.5421247",
"0.5297753",
"0.5282981",
"0.52732563",
"0.52611256",
"0.5260595",
"0.5258083",
"0.5245329",
"0.5198002",
"0.51747555",
"0.51707554",
"0.5164... | 0.66678137 | 0 |
Get the largest connected component in the foreground. | def get_largest_cc(binary):
cc, n_cc = measure.label(binary)
max_n = -1
max_area = 0
for n in range(1, n_cc + 1):
area = np.sum(cc == n)
if area > max_area:
max_area = area
max_n = n
largest_cc = (cc == max_n)
return largest_cc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_max(self):\n return max(self.nodes, key=int)",
"def find_biggest_container(list_con):\n\n largest = 0\n largest_container = list_con[0]\n for container in list_con:\n y = container.rect.height\n x = container.rect.width\n # It makes no sense to swap focused with itse... | [
"0.6722301",
"0.66011536",
"0.6573844",
"0.65513253",
"0.6479203",
"0.6379458",
"0.63485515",
"0.63335824",
"0.6328763",
"0.62506276",
"0.6175628",
"0.61728555",
"0.6139547",
"0.61204165",
"0.6119893",
"0.6109045",
"0.61025226",
"0.6094777",
"0.6076939",
"0.60687226",
"0.6042... | 0.6318504 | 9 |
Set the minimum price to 500 | def filterPrice(self, minPrice = 5000):
# Check and select if price button is displayed
if commonFunctionsUI.isElementDisplayedByXPath(selector = self.locators.price):
commonFunctionsUI.clickByXPath(selector = self.locators.price)
else:
LOGGER.error("Could not click pric... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_low(self, price_low):\n\n self._price_low = price_low",
"def buy_min_amount(self, buy_min_amount):\n\n self._buy_min_amount = buy_min_amount",
"def sell_min_amount(self, sell_min_amount):\n\n self._sell_min_amount = sell_min_amount",
"def setMinValue(self, min_value):\r\n\t\tse... | [
"0.7280862",
"0.70356077",
"0.67112195",
"0.6643093",
"0.6643093",
"0.6576318",
"0.652403",
"0.6459397",
"0.6413161",
"0.64118165",
"0.63705456",
"0.6317402",
"0.6291465",
"0.62708586",
"0.62708586",
"0.62708586",
"0.6253467",
"0.6231985",
"0.623148",
"0.6227854",
"0.6227854"... | 0.6474984 | 7 |
Appends a series of strings to the fragment_list that, when concatenated, form a string that parses to this expression. This is better than implementing __str__ recursively because it avoids an O(n^2) blowup in the concatentations. | def collect_str_fragments(self, fragment_list):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_set_string_fragments(fragment_list, the_set):\n fragment_list.append(\"{\")\n first = True\n for v in the_set:\n if not first:\n fragment_list.append(\",\")\n else:\n first = False\n fragment_list.append(repr(v))\n fragment_list.append(\"}\")",
"... | [
"0.6136461",
"0.5588658",
"0.53836626",
"0.53753275",
"0.53268504",
"0.52692634",
"0.52593464",
"0.5248216",
"0.52371913",
"0.52330685",
"0.52288604",
"0.5184634",
"0.51642156",
"0.5164107",
"0.514844",
"0.51406646",
"0.5132559",
"0.5128775",
"0.5115845",
"0.50821894",
"0.506... | 0.7036386 | 0 |
Sets initial tool center point pose via inverse kinematics. | def __call__(self, physics, random_state):
if self._hand is not None:
target_site = self._hand.tool_center_point
else:
target_site = self._arm.wrist_site
initial_qpos = physics.bind(self._arm.joints).qpos.copy()
for _ in range(self._max_rejection_samples):
target_pos = variation.eval... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_init_pose(self):\n cmd = np.zeros(16 * self.n)\n self.move_joints(cmd)",
"def _set_init_pose(self):\n raise NotImplementedError()",
"def _set_init_pose(self):\n raise NotImplementedError()",
"def _set_init_pose(self):\n raise NotImplementedError()",
"def set_init... | [
"0.6608039",
"0.64210546",
"0.64210546",
"0.64210546",
"0.63607347",
"0.6086969",
"0.60619146",
"0.60391444",
"0.5883266",
"0.58819693",
"0.58557534",
"0.5774649",
"0.5759382",
"0.5693377",
"0.56587917",
"0.5626553",
"0.5608418",
"0.5583927",
"0.5564323",
"0.55479157",
"0.549... | 0.0 | -1 |
Initialize a circuit instruction to schedule mapper instance. | def __init__(self):
# The processed and reformatted circuit instruction definitions
# Do not use lambda function for nested defaultdict, i.e. lambda: defaultdict(CalibrationEntry).
# This crashes qiskit parallel. Note that parallel framework passes args as
# pickled object, however lamb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_instruction(cls, instruction):\n # Convert circuit to an instruction\n if isinstance(instruction, QuantumCircuit):\n instruction = instruction.to_instruction()\n # Initialize an identity superoperator of the correct size\n # of the circuit\n op = SuperOp(np.e... | [
"0.5845538",
"0.56532055",
"0.5652764",
"0.5614527",
"0.5595061",
"0.5566413",
"0.55574816",
"0.5530359",
"0.5463866",
"0.54522026",
"0.54402477",
"0.54326665",
"0.5399528",
"0.530253",
"0.52887285",
"0.5286731",
"0.5274246",
"0.5263917",
"0.526175",
"0.5261301",
"0.5213532",... | 0.62574184 | 0 |
Returns the URN based on the configured org_key. | def org_urn(self):
return f"psc:org:{self.credentials.org_key}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def urn(self) -> str:\n return pulumi.get(self, \"urn\")",
"def org_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"org_id\")",
"def urn(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"urn\")",
"def user_org_id(self) -> str:\n return self._user_org_id... | [
"0.66203403",
"0.65231293",
"0.640833",
"0.6401871",
"0.63262284",
"0.6297911",
"0.6237854",
"0.60658467",
"0.5753463",
"0.57502747",
"0.57391524",
"0.567016",
"0.567016",
"0.5648649",
"0.5648649",
"0.56051075",
"0.5599563",
"0.5587935",
"0.5560359",
"0.5529463",
"0.55195343"... | 0.69847727 | 0 |
Returns a dictionary containing API limiting information. | def process_limits(self):
url = "/api/investigate/v1/orgs/{}/processes/limits".format(
self.credentials.org_key
)
return self.get_object(url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_api(self, api):\n return parse_limit(self.apis.get(api))",
"def get_limit(self, request, tenant_id):\n request.setResponseCode(200)\n return json.dumps(get_limit())",
"def get_rate_limit(self):\n resp = self._session.get(self.API_ROOT + \"/rate_limit\")\n log.info(... | [
"0.66151637",
"0.6528426",
"0.64228547",
"0.6409069",
"0.6373151",
"0.6350771",
"0.63083094",
"0.6243873",
"0.62137604",
"0.6206141",
"0.6172177",
"0.6135799",
"0.60869765",
"0.6086583",
"0.60673934",
"0.5879137",
"0.5875287",
"0.58628887",
"0.5851587",
"0.5843055",
"0.582535... | 0.5545661 | 51 |
Localize a datetime object to local time. | def localize(dt):
if dt.tzinfo is UTC:
return (dt + LOCAL_UTC_OFFSET).replace(tzinfo=None)
# No TZ info so not going to assume anything, return as-is.
return dt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def utc_to_local_datetime(dt):\n return dt.astimezone(LOCAL)",
"def utc_to_local(t):\n # set utc tzinfo\n t = t.replace(tzinfo=tz.tzutc())\n # convert to local timezone\n return t.astimezone(tz.tzlocal())",
"def localize_datetime_utc(date_time):\n return pytz.utc.localize(date_time)",
"... | [
"0.6779655",
"0.6645943",
"0.6501256",
"0.6501256",
"0.6501256",
"0.63625455",
"0.6324959",
"0.6302018",
"0.6279041",
"0.6248183",
"0.62210876",
"0.6216769",
"0.6216769",
"0.61173415",
"0.61035496",
"0.60897493",
"0.602577",
"0.602577",
"0.60156065",
"0.59806293",
"0.5896957"... | 0.7197796 | 0 |
Convert a SQLAlchemy datetime string to a datetime object. | def sqlalch_datetime(dt):
if isinstance(dt, str):
return datetime.strptime(dt, "%Y-%m-%d %H:%M:%S.%f").replace(tzinfo=UTC)
if dt.tzinfo is not None and dt.tzinfo.utcoffset(dt) is not None:
return dt.astimezone(UTC)
return dt.replace(tzinfo=UTC) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orm2datetime(value, tformat=ORM_DATETIME_FORMAT, default=None):\n if not value:\n return default\n return datetime.strptime(value, tformat)",
"def str_to_datetime(self, dt_string):\n return datetime.datetime.strptime(dt_string, \"%Y-%m-%d\").replace(\n tzinfo=timezone.utc) if d... | [
"0.6831871",
"0.6552192",
"0.63817424",
"0.6308494",
"0.6301116",
"0.6269812",
"0.6249542",
"0.61903256",
"0.617449",
"0.6133557",
"0.6121954",
"0.61166495",
"0.6110288",
"0.6099799",
"0.60897034",
"0.6087355",
"0.6056805",
"0.6054196",
"0.60329926",
"0.5998856",
"0.59887975"... | 0.60824794 | 16 |
Performs masked softmax, as simply masking postsoftmax can be inaccurate | def forward(self, x, mask=None):
if mask is not None:
mask = mask.float()
if mask is not None:
x_masked = x * mask + (1 - 1 / mask)
else:
x_masked = x
x_max = x_masked.max(1)[0]
x_exp = (x - x_max.unsqueeze(-1)).exp()
if mask is not Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax_masked(x, mask=None):\n if mask is None:\n sm = K.softmax(x)\n else:\n casted_mask = K.cast(mask, dtype=x.dtype)\n # subtract min first so that, after masking, the masked elements are the smallest\n z = (x - K.min(x, axis=1, keepdims=True)) * casted_mask\n # Now sub... | [
"0.781858",
"0.7435215",
"0.73176336",
"0.7315343",
"0.72668344",
"0.71768147",
"0.7170099",
"0.71571136",
"0.715206",
"0.715206",
"0.7138204",
"0.7122304",
"0.7117313",
"0.7109927",
"0.7099279",
"0.7099279",
"0.7090583",
"0.7075449",
"0.7053529",
"0.7052899",
"0.7039341",
... | 0.0 | -1 |
Search for a provisioning policy by it's name. | def search(isim_application: ISIMApplication,
container_dn: str,
policy_name: str,
check_mode=False,
force=False) -> IBMResponse:
data = []
# Add the add the container object to the request
container_response = isimws.isim.container.get(isim_application=isim_appli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_storage_profile_by_name(profile_manager, name):\n\n profile_ids = profile_manager.PbmQueryProfile(\n resourceType=pbm.profile.ResourceType(resourceType=\"STORAGE\"),\n profileCategory=\"REQUIREMENT\"\n )\n if len(profile_ids) > 0:\n storage_profiles = profile_manager.PbmRet... | [
"0.6292723",
"0.60988647",
"0.58061117",
"0.57416856",
"0.5703952",
"0.5703952",
"0.56588227",
"0.5613207",
"0.56084025",
"0.55258685",
"0.55258685",
"0.55258685",
"0.55258685",
"0.55258685",
"0.55258685",
"0.55258685",
"0.54804397",
"0.5344982",
"0.53111094",
"0.52670735",
"... | 0.52255696 | 23 |
This is a validation test of meters() for an array variable | def test_meters_validate_list(self):
meter = inches_to.meters([1.0, 2.0, 3.0, 4.0])
comparison = np.array([0.0254, 2*0.0254, 3*0.0254, 4*0.0254])
try:
for i in range(len(comparison)):
self.assertTrue(math.isclose(meter[i], comparison[i], rel_tol=self.accepted_error))... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_micrometers_validate_list(self):\n micrometer = inches_to.micrometers([1.0, 2.0, 3.0, 4.0])\n comparison = np.array([2.54e4, 2*2.54e4, 3*2.54e4, 4*2.54e4])\n\n try:\n for i in range(len(comparison)):\n self.assertTrue(math.isclose(micrometer[i], comparison[i]... | [
"0.7361445",
"0.7129899",
"0.6972584",
"0.6941071",
"0.6876764",
"0.6801474",
"0.6392337",
"0.6235475",
"0.61532974",
"0.60732687",
"0.6050267",
"0.60348946",
"0.6034835",
"0.6024619",
"0.5958844",
"0.5942507",
"0.59338415",
"0.5914703",
"0.5892267",
"0.58575374",
"0.583774",... | 0.78410035 | 0 |
Get the top N scored objects for a given model. Yields (object, score) tuples. | def get_top(self, Model, limit=10, reversed=False):
ctype = ContentType.objects.get_for_model(Model)
query = """
SELECT object_id, SUM(vote) as %s
FROM %s
WHERE content_type_id = %%s
GROUP BY object_id""" % (
connection.ops.quote_name('score'),
con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_top(self, model, limit=10, inverted=False):\n content_type= ContentType.objects.get_for_model(model)\n\n #Get a queryset of all the objects of the model. Get their scores\n results = self.filter(content_type=content_type).values('object_id').annotate(score=Sum('vote'))\n if inve... | [
"0.71645254",
"0.65719235",
"0.60314804",
"0.59687406",
"0.59606856",
"0.58886456",
"0.5786337",
"0.5778092",
"0.5713366",
"0.5684768",
"0.5679488",
"0.5641094",
"0.56369394",
"0.56252575",
"0.56250525",
"0.5575158",
"0.553343",
"0.5522421",
"0.55107415",
"0.5508459",
"0.5492... | 0.6623575 | 1 |
Get the bottom (i.e. most negative) N scored objects for a given model. Yields (object, score) tuples. | def get_bottom(self, Model, limit=10):
return self.get_top(Model, limit, True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_top(self, model, limit=10, inverted=False):\n content_type= ContentType.objects.get_for_model(model)\n\n #Get a queryset of all the objects of the model. Get their scores\n results = self.filter(content_type=content_type).values('object_id').annotate(score=Sum('vote'))\n if inve... | [
"0.6853657",
"0.6771221",
"0.6658309",
"0.5917878",
"0.5493356",
"0.5439736",
"0.54209715",
"0.5414728",
"0.53726476",
"0.53376883",
"0.5324556",
"0.5288919",
"0.528757",
"0.52829975",
"0.52070594",
"0.5203363",
"0.5189654",
"0.51883227",
"0.518107",
"0.51727486",
"0.5165138"... | 0.52845454 | 13 |
Takes a 1D list of integers X as input and returns a list of disjoint intervals, stating at which intervals X is nonzero. Performs a single pass over X. This is an example of a compressed representation of a (1d) integer array. | def getDisjointIntervals(X: np.ndarray) -> list:
if len(X) == 0:
return []
else:
cc = 0
currentToken = -1
intervals = []
reading = False
while cc < len(X):
if (X[cc] > 0) and (not reading):
idxLeft = cc
currentToken = X... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def c(ixs):\n return sum(range(1, sum((i > 0 for i in ixs)) + 1))",
"def filter_zeros(X):\n\tnoNonzeros = np.count_nonzero(X, axis=1)\n\tmask = np.where(noNonzeros > 0)\n\treturn X[mask[0], :]",
"def segment_data(x):\n return (x.shift(1) != x).astype(int).cumsum()",
"def nonzero(x, /):\n\n if isinst... | [
"0.6136643",
"0.5802488",
"0.5770717",
"0.57433385",
"0.5736189",
"0.5705365",
"0.56562895",
"0.55886453",
"0.55829746",
"0.5546844",
"0.5536707",
"0.550248",
"0.5498295",
"0.5493478",
"0.5489795",
"0.54502374",
"0.54463476",
"0.54063517",
"0.54026884",
"0.5399505",
"0.538966... | 0.7251165 | 0 |
r"""Returns the index of the nth occurence of an element in a | def _get_index_of_nth_occurrence(input_list: list[Any],
*,
element: Any,
count: int,
) -> int:
return tuple(index for index, item in enumerate(input_list)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(a, x):\n i = bisect_left(a, x)\n if i != len(a) and a[i] == x:\n return i\n raise ValueError",
"def find_index(numbers, element):\n index = 0\n for item in numbers:\n if element != item:\n index += 1\n elif element == item:\n return index",
"d... | [
"0.6772519",
"0.6588191",
"0.6510276",
"0.6477026",
"0.6414712",
"0.6394724",
"0.63803226",
"0.62869",
"0.62698835",
"0.62587327",
"0.62331253",
"0.6232417",
"0.62123877",
"0.62089604",
"0.6182674",
"0.6173883",
"0.61673105",
"0.61657387",
"0.6161436",
"0.6154382",
"0.6127592... | 0.7488844 | 0 |
r"""If ``True`` then an initial or final empty measures will be used, otherwise the process starts/ends with a single logical tie. | def include_empty_measures(self) -> bool:
return self._include_empty_measures | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tied(self):\n for (x, y) in self.fields:\n if self.fields[x, y] == self.empty:\n return False\n return True",
"def _compute_is_terminal(self):\n # self.n_actions contains a number of unlabelled datapoints that is left\n if self.n_actions==1:\n ... | [
"0.54655546",
"0.5351739",
"0.5345202",
"0.53296787",
"0.530523",
"0.5286451",
"0.5203592",
"0.5164626",
"0.51629823",
"0.51200664",
"0.51130056",
"0.51110226",
"0.5109022",
"0.5087548",
"0.507486",
"0.50656545",
"0.50606245",
"0.50384855",
"0.5037537",
"0.5030562",
"0.498646... | 0.5967664 | 0 |
Initialize a `CategoryTransformer` object. | def __init__(
self,
subtransformer_args,
input_constraints={},
input_processor=None,
):
super(CategoryTransformer, self).__init__(subtransformer_args, input_constraints, input_processor) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, categories, prior=None, transform=None, name=None):\n if transform == \"identity\":\n self.categories = tuple([str(c) for c in categories])\n else:\n self.categories = tuple(categories)\n\n self.name = name\n\n if transform is None:\n ... | [
"0.7078951",
"0.62807745",
"0.59217",
"0.56794995",
"0.56685096",
"0.56496143",
"0.5625858",
"0.55631554",
"0.5449685",
"0.5432689",
"0.5394677",
"0.5392868",
"0.53808016",
"0.53752774",
"0.53578717",
"0.5329396",
"0.5315902",
"0.5314835",
"0.5297845",
"0.52968264",
"0.529296... | 0.74059707 | 0 |
Define the structure of the transformation record and initialize it. | def init_transformation_record(self, x):
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Transform(self, record):\n pass",
"def __init__(self, seq_record=None):\n\t\tself._record = seq_record",
"def __init__(self, record=None):\n self.record = record",
"def test_transform_record(self):\n response = {\"frequency\": 0.009112876, \"info\": {\"accessType\": \"PUBLIC\"},\n ... | [
"0.6716392",
"0.6659925",
"0.6446666",
"0.6171289",
"0.6139049",
"0.60856974",
"0.60529155",
"0.59707165",
"0.5961274",
"0.59580094",
"0.5957466",
"0.59420556",
"0.58883744",
"0.58854526",
"0.58674866",
"0.58664525",
"0.58491695",
"0.5836734",
"0.5815383",
"0.5764874",
"0.575... | 0.76916385 | 0 |
Temporarily override default values in os.environ. Yields a dictionary of the key/value pairs matching the provided keys. | def temporary_environ(
variables, override_existing: bool = True, warn_on_override: bool = False
):
old_env = os.environ.copy()
if override_existing:
overrides = set(old_env.keys()).intersection(variables.keys())
if overrides and warn_on_override:
warnings.warn(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def override_environ(**overrides):\n with override_dict(os.environ, **overrides):\n yield",
"def override_environment(**kwargs):\n overridden = {}\n for key, value in kwargs.items():\n overridden[key] = os.environ.get(key)\n if value is None:\n os.environ.pop(key, None)\n... | [
"0.7701895",
"0.74684477",
"0.7361224",
"0.6839615",
"0.6725912",
"0.67187667",
"0.66602373",
"0.66005147",
"0.6367056",
"0.636389",
"0.6347735",
"0.6255825",
"0.62457514",
"0.62387544",
"0.62294495",
"0.6227959",
"0.62208045",
"0.62157166",
"0.6197055",
"0.61713207",
"0.6168... | 0.6785084 | 4 |
Take a set of addresses and highlight the blocks starting at (or containing if start_only=False) those addresses. You can use this manually, but you'll have to clear your own highlights. bncov.highlight_set(addrs, color=bncov.colors['blue'], bv=bv) If you're using this manually just to highlight the blocks containing a... | def highlight_set(addr_set, color=None, bv=None, start_only=True):
if bv is not None:
binary_view = bv
else:
if gbv is None:
print("[!] To use manually, pass in a binary view (bv=binary_view), or set bncov.gbv first")
return
binary_view = gbv
if start_only:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_highlights(addr_set, bv):\n for addr in addr_set:\n blocks = bv.get_basic_blocks_at(addr)\n for block in blocks:\n block.set_user_highlight(HighlightStandardColor.NoHighlightColor)",
"def highlight(self):\n core = cutter.core()\n highlighter = core.getBBHighlig... | [
"0.63738877",
"0.5473969",
"0.51922953",
"0.51663077",
"0.5123824",
"0.49294856",
"0.4915261",
"0.4910261",
"0.4908065",
"0.487683",
"0.4819948",
"0.47914907",
"0.47785974",
"0.47687763",
"0.47433183",
"0.47201484",
"0.47052807",
"0.4678224",
"0.4649079",
"0.46250296",
"0.461... | 0.81892323 | 0 |
The ID of the alert policy where this condition should be used. | def policy_id(self) -> pulumi.Input[int]:
return pulumi.get(self, "policy_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policyid(self):\n return self._policyid",
"def policy_id(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"policy_id\")",
"def policy_id(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"policy_id\")",
"def policy_id(self) -> Optional[pulumi.Input[str]]:\n ... | [
"0.7621485",
"0.75163525",
"0.74066585",
"0.7342257",
"0.7328843",
"0.7284987",
"0.69406074",
"0.69406074",
"0.6639695",
"0.6572657",
"0.6375167",
"0.6201921",
"0.61860025",
"0.61285186",
"0.61283237",
"0.608911",
"0.6047822",
"0.6047822",
"0.6047202",
"0.6047202",
"0.6047202... | 0.7555805 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.