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 external surface area of the pellet | def ext_surface_area(self, rho_p, d_p):
ac = 6./(d_p*rho_p)
return ac | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def surface_area(self):\n return self._surface_area",
"def getSurfaceArea(self) -> float:\n return self.area()",
"def surfaceArea(self):\n surfaceArea = self.sideLength**2 * 6\n return surfaceArea",
"def surface_area(self) -> float:\n return 4 * np.pi * self.radius**2",
"... | [
"0.7772343",
"0.7727901",
"0.7684873",
"0.74368155",
"0.7350132",
"0.70398146",
"0.7031911",
"0.6880375",
"0.6826012",
"0.67985076",
"0.6782684",
"0.6760408",
"0.6744692",
"0.6731239",
"0.66464466",
"0.6613434",
"0.66047347",
"0.6579136",
"0.65604836",
"0.654483",
"0.6541671"... | 0.6580192 | 17 |
Remove protected fields from object (dict or list). | def scrub_object(obj):
if isinstance(obj, list):
return [scrub_object(item) for item in obj]
if isinstance(obj, dict):
clean_dict = {key: scrub_object(value)
for key, value in obj.items()
if not key.startswith('_')}
return clean_dict
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _drop_protected_attrs(model_class, values):\n for attr in model_class.__protected_attributes__:\n if attr in values:\n del values[attr]",
"def strip_unwanted_fields(self, data, many, **kwargs):\n unwanted_fields = [\"resource_type\"]\n for field in unwanted_fields:\n ... | [
"0.73466676",
"0.6300492",
"0.6233149",
"0.6173888",
"0.6129625",
"0.6091405",
"0.6074838",
"0.59453696",
"0.59296423",
"0.57935745",
"0.5789426",
"0.5781288",
"0.5778098",
"0.57723516",
"0.57266027",
"0.57174355",
"0.5685181",
"0.5677998",
"0.5615463",
"0.5601841",
"0.560116... | 0.6255143 | 2 |
Function takes in a list of ints, compares them to a single int and returns the index value at which the list encounters a value greater than, or equal to, the value of interest. | def greater_than_index(numlist, singnum):
try:
for elem in numlist:
if elem >= singnum:
e_val = numlist.index(elem)
return e_val
except ValueError:
return 'None. Try a value contained within the list.' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closest_value_index(val, lst):\n index = 0\n for item in lst:\n if item > val:\n return index\n index += 1\n return index-1",
"def max_index_of_smaller_number(list, number):\n for i, element in enumerate(list):\n if element >= number:\n retur... | [
"0.746532",
"0.7328806",
"0.7101292",
"0.70529854",
"0.70351714",
"0.6980567",
"0.6962992",
"0.6925573",
"0.68856275",
"0.68856275",
"0.6882159",
"0.6855916",
"0.6841852",
"0.6802597",
"0.6790609",
"0.6789923",
"0.6781714",
"0.676327",
"0.6739212",
"0.66578895",
"0.66387284",... | 0.69324523 | 7 |
Function takes in a list of ints, compares them to a single int and returns the index value at which the list encounters a value greater than, or equal to, the value of interest. | def less_than_index(numlist, singnum):
try:
for elem in numlist:
if elem <= singnum:
e_val = numlist.index(elem)
return e_val
except ValueError:
return 'None. Try a value contained within the list.' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closest_value_index(val, lst):\n index = 0\n for item in lst:\n if item > val:\n return index\n index += 1\n return index-1",
"def max_index_of_smaller_number(list, number):\n for i, element in enumerate(list):\n if element >= number:\n retur... | [
"0.7464263",
"0.7328147",
"0.71001375",
"0.70483917",
"0.7034782",
"0.6980818",
"0.69644755",
"0.69319695",
"0.69241714",
"0.6884466",
"0.6884466",
"0.6880314",
"0.6854844",
"0.6838808",
"0.6803329",
"0.6791891",
"0.67863107",
"0.67801815",
"0.676073",
"0.6659436",
"0.6635483... | 0.6737784 | 19 |
Visualizes input image, segmentation map and overlay view. | def vis_segmentation(image, seg_map, url, back_url):
plt.figure(figsize=(15, 5))
grid_spec = gridspec.GridSpec(1, 4, width_ratios=[6, 6, 6, 6])
plt.subplot(grid_spec[0])
plt.imshow(image)
plt.axis('off')
plt.title('input image')
plt.subplot(grid_spec[1])
seg_image = label_to_color_image(seg_map).astyp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vis_segmentation(image, seg_map):\n plt.figure(figsize=(15, 5))\n grid_spec = gridspec.GridSpec(1, 4, width_ratios=[6, 6, 6, 1])\n\n plt.subplot(grid_spec[0])\n plt.imshow(image)\n plt.axis('off')\n plt.title('input image')\n\n plt.subplot(grid_spec[1])\n seg_image = label_to_color_image(seg_map).astyp... | [
"0.6990848",
"0.6975726",
"0.69608253",
"0.6958933",
"0.69530576",
"0.687038",
"0.68683505",
"0.68540424",
"0.6674954",
"0.6645975",
"0.66438764",
"0.6633382",
"0.6621907",
"0.66138",
"0.6602533",
"0.6570072",
"0.64627975",
"0.645434",
"0.6397248",
"0.6393414",
"0.63874334",
... | 0.6665718 | 9 |
Convenience function for adding artifacts. The current artifact values are only an example. Should be manually edited for different worlds. | def add_artifacts(cells_info):
# Add fire extinguishers
cells_info[(1, 0)].add_artifact("Extinguisher@2.1 2.1 0.004 0 0 0")
cells_info[(1, 14)].add_artifact("Extinguisher@2.1 -2.1 0.004 -90 0 90")
cells_info[(7, 6)].add_artifact("Extinguisher@2.1 -3 0.004 0 0 0")
cells_info[(7, 0)].add_artifact("Ext... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_artifact(args, artifact: Artifact):\n if artifact.producing_task_name not in args._artifacts:\n args._artifacts[artifact.producing_task_name] = []\n\n # Replace an artifact if it already exists\n for art in args._artifacts[artifact.producing_task_name]:\n if art.name == artifact.name... | [
"0.71734387",
"0.693994",
"0.6601801",
"0.6547209",
"0.6507709",
"0.64302945",
"0.6300197",
"0.62197524",
"0.6194309",
"0.6169765",
"0.6084588",
"0.6057944",
"0.5933684",
"0.5890478",
"0.5890478",
"0.5890478",
"0.5890478",
"0.5825959",
"0.5811488",
"0.57861865",
"0.5757485",
... | 0.5741648 | 21 |
Add blockers to cells where appropriate | def add_blockers(cells_info):
# intersection tiles
inter_tiles = (TunnelTiles.INTR, TunnelTiles.INTR_DEB)
tsv = {}
for key, cell_info in cells_info.items():
# If is the staring cell
if cell_info is None:
tsv[key] = ""
continue
row, col = key
# Ch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_blockers(self):\n blockers = []\n\n if self.state == 'resting' or self.state == 'autoresting':\n blockers.append(pg.Rect(self.rect.x, self.rect.y, 32, 32))\n\n elif self.state == 'moving' or self.state == 'automoving':\n if self.rect.x % 32 == 0:\n ... | [
"0.6404504",
"0.6141503",
"0.58528054",
"0.58091587",
"0.57064474",
"0.5655872",
"0.56188303",
"0.55906427",
"0.5568895",
"0.55570704",
"0.5476506",
"0.5420456",
"0.54127187",
"0.5404694",
"0.5381889",
"0.5364611",
"0.5338512",
"0.5329922",
"0.52618676",
"0.52474326",
"0.5223... | 0.7166973 | 0 |
Formats a date into a string representing the time of the date that can be included in a sentence. For example, time_format_time(datetime(hour=15, minute=14)) would | def format_time(time):
hour, minute = time.hour, time.minute
period = "am" if hour < 12 or hour == 24 else "pm"
hour = hour % 12
if hour == 0:
hour = 12
return ":t:" + str(hour) + ":" + str(minute).rjust(2, "0") + period | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_datetime(date_time):\n return date_time.strftime(\"%Y-%m-%d %H:%M:%S\")",
"def format_time(t):\r\n # again, workaround dateformat input requirement\r\n dt = aware_datetime(2000, 1, 1, t.hour, t.minute, t.second)\r\n return dateformat.format(dt, 'H:i:s O')",
"def format_date(date, time_fo... | [
"0.7485179",
"0.74553084",
"0.72549623",
"0.71170133",
"0.6866325",
"0.6784639",
"0.673472",
"0.67283106",
"0.6702937",
"0.6700654",
"0.6685791",
"0.6673576",
"0.6671937",
"0.66485274",
"0.6580954",
"0.6576182",
"0.6568013",
"0.6566315",
"0.65335995",
"0.65332717",
"0.6525373... | 0.71403825 | 3 |
Formats a date into a string representing the month and day of the date that can be included in a sentence. For example, time_format_month_day(datetime(month=3, day=14)) would | def format_month_day(time):
month = ["january", "february", "march", "april",
"may", "june", "july", "august",
"september", "october", "november", "december"
][time.month - 1]
day = str(time.day)
return month + " :n:" + day | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_template_formatted_date(date):\n return date.strftime(str(month(date.month)) + ' ' + str(date.day) + ', %Y')",
"def when_text(d, t=None):\n if d is None:\n return ''\n # fmt = 'yyyy MMM dd (EE)'\n # txt = d.strftime(settings.SITE.date_format_strftime)\n txt = format_date(d, 'EE ... | [
"0.730893",
"0.72433585",
"0.69493955",
"0.6885138",
"0.6871063",
"0.6861595",
"0.6826973",
"0.67573786",
"0.67381275",
"0.67021096",
"0.6673206",
"0.6552698",
"0.651386",
"0.6494735",
"0.64793587",
"0.6458117",
"0.6424651",
"0.6418195",
"0.64011586",
"0.6395268",
"0.6388781"... | 0.7085073 | 2 |
Allow ``Users`` to authenticate by email in addition to username. Be very careful if you allow atsigns in usernames as this backend will treat anything containing an atsign as an email address. Proper measures should also be taken to ensure the uniqueness of email addresses as this is not done by Django. | def authenticate(self, username=None, password=None):
if '@' in username:
lookup = { 'email__iexact': username }
else:
lookup = { 'username': username }
# There's no unique constraint on email addresses in the default
# implementation of auth.User. Failing on Mul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_email(self, value):\n if not User.objects.filter(email=value).exists():\n raise serializers.ValidationError('User with this email does not exist.')\n return value",
"def validate_email(self, value):\n if not User.objects.filter(email=value).exists():\n rais... | [
"0.6654309",
"0.6654309",
"0.6588625",
"0.6501224",
"0.64859474",
"0.6483729",
"0.6468589",
"0.6450045",
"0.644504",
"0.64140254",
"0.63905126",
"0.63477093",
"0.6333435",
"0.6319003",
"0.6318372",
"0.6317752",
"0.6293327",
"0.62817657",
"0.6279704",
"0.6279704",
"0.6258608",... | 0.5999359 | 39 |
Residual BC network in Sonnet, equivalent to residual policy network. | def make_bc_network(
action_spec,
policy_layer_sizes=(256, 256, 256),
policy_init_std=1e-9,
binary_grip_action=False):
num_dimensions = np.prod(action_spec.shape, dtype=int)
if policy_layer_sizes:
policy_network = snt.Sequential([
tf_utils.batch_concat,
networks.LayerNormMLP([int... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _residual(self, x):\n h = x\n h = self.c1(h)\n h = self.activation(h)\n h = self.c2(h)\n h = F.avg_pool2d(h, 2)\n\n return h",
"def _residual(self, x):\n h = x\n h = self.b1(h)\n h = self.activation(h)\n h = self._upsample_conv(h, self.c1)... | [
"0.6312862",
"0.61547756",
"0.6074767",
"0.60610604",
"0.6033894",
"0.59667933",
"0.58933",
"0.5885936",
"0.58756286",
"0.5851993",
"0.5851631",
"0.585133",
"0.5827894",
"0.58015406",
"0.57912004",
"0.578732",
"0.57828486",
"0.5782244",
"0.5766512",
"0.5764347",
"0.5751768",
... | 0.0 | -1 |
Get the prediction as the class name from trained model. | def predict(model, x):
# Set model to evalution state to turn off dropout
model.eval()
x = to_Variable(x)
yhat = model(x)
_, tag = yhat.max(1)
return tag.data.cpu().numpy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return 'Predict model (classification map)'",
"def predict(model, X):\n\tmodel.eval()\n\t# make the predictions\n\tscores = model.forward(X)\n\n\t# scores contains, for each example, two scores that can be interpreted as the\n\t# probability of each example belonging to each of the class... | [
"0.71154845",
"0.6432133",
"0.63170284",
"0.62641156",
"0.62177086",
"0.6201655",
"0.61879426",
"0.618479",
"0.6184252",
"0.6177435",
"0.61362827",
"0.6134041",
"0.61289924",
"0.6114938",
"0.6113953",
"0.6095195",
"0.60919523",
"0.6056852",
"0.6020343",
"0.6008221",
"0.600307... | 0.0 | -1 |
Mutate given individuals with some probability | def _mutate(self, individuals):
for cur in individuals:
if random.random() < self.mutation_probability:
self.op.mutate(cur['individual'])
cur['fitness'] = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mutate1(self, probability):\n for i in range(self.number_of_transitions):\n shape = np.shape(self.weights[i])\n size = self.weights[i].size\n weights = self.weights[i].flatten()\n for j in range(len(weights)):\n if np.random.uniform(0, 1) < prob... | [
"0.7026635",
"0.69632226",
"0.68725437",
"0.66308904",
"0.660976",
"0.65976524",
"0.65768373",
"0.6520392",
"0.6505777",
"0.64324313",
"0.63923305",
"0.63178074",
"0.629649",
"0.6178893",
"0.6173577",
"0.61732405",
"0.61587286",
"0.61531484",
"0.610842",
"0.6084726",
"0.60345... | 0.7389409 | 0 |
Reduce BERT output to a single document embedding depending on pooling strategy. | def get_pooled_embedding(self, bert_out, strategy: Optional[PoolingStrategy] = None):
if strategy is None:
# use class property by default
strategy = self.pooling_strategy
if strategy == PoolingStrategy.CLS:
return bert_out.last_hidden_state[:, 0, :] # [CLS] token
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embed(documents, ctx_encoder, ctx_tokenizer, device):\n input_ids = ctx_tokenizer(\n documents[\"title\"],\n documents[\"text\"],\n truncation=True,\n padding=\"longest\",\n return_tensors=\"pt\",\n )[\"input_ids\"]\n embeddings = ctx_encoder(\n input_ids.to(d... | [
"0.5833425",
"0.57311535",
"0.5543497",
"0.5352152",
"0.534469",
"0.5341967",
"0.5270668",
"0.5253457",
"0.5247286",
"0.5236442",
"0.5152077",
"0.5149258",
"0.5139233",
"0.5135812",
"0.51014996",
"0.50941086",
"0.5090539",
"0.5085752",
"0.5066375",
"0.50635767",
"0.50415945",... | 0.5964784 | 0 |
Initializes the weights of a model in place. | def initialize_weights(model: nn.Module, transformer: bool = False) -> None:
for param in model.parameters():
if param.dim() == 1:
if transformer:
nn.init.constant_(param, 0.01)
else:
nn.init.constant_(param, 0)
else:
nn.init.xavier... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(model):\n ...",
"def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)",
"def initialize_weights(self):\n weights_initializer.WeightsInitializer.initialize_layer_or_model(\n self._batch)",
"def _initialize_weights(self):\n pass"... | [
"0.8876495",
"0.85241234",
"0.8506802",
"0.84758335",
"0.84584105",
"0.8176034",
"0.8142834",
"0.8037715",
"0.8013496",
"0.7943779",
"0.7936361",
"0.7913588",
"0.7913588",
"0.7913588",
"0.7904003",
"0.7854628",
"0.7834638",
"0.7821252",
"0.7821252",
"0.7812618",
"0.77866375",... | 0.72430027 | 68 |
Loads the IMDB train/test datasets from a folder path. | def load_train_test_imdb_data(data_dir):
print("... IMDB loading \t\n")
data = {}
for split in ["train", "test"]:
data[split] = []
for sentiment in ["neg", "pos"]:
score = 1 if sentiment == "pos" else 0
path = os.path.join(data_dir, split, sentiment)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(path='./data/train'):\n print(\"Loading IMDB Data...\")\n data = []\n\n dir = os.path.dirname(__file__)\n file_list = glob.glob(os.path.join(dir, path + '/pos/*'))\n file_list.extend(glob.glob(os.path.join(dir, path + '/neg/*')))\n print(\"Parsing %s files\" % len(file_list))\n f... | [
"0.73538184",
"0.6987929",
"0.6802678",
"0.6745866",
"0.6584659",
"0.65519303",
"0.6512844",
"0.6485132",
"0.6423616",
"0.64122844",
"0.6398312",
"0.6391403",
"0.6369378",
"0.63365614",
"0.6331135",
"0.63181895",
"0.6300329",
"0.62802756",
"0.6279003",
"0.6268812",
"0.625715"... | 0.6989267 | 1 |
Red getter. Checks if square is red | def red(self):
return self._red | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_red(self):\n return \"red\" == self.color",
"def is_red(self):\n return self.color == Color.RED",
"def _get_red(self):\n return self.__red",
"def _get_red(self):\n return self.__red",
"def _get_red(self):\n return self.__red",
"def red(self, new_value):\r\n if self.em... | [
"0.7640465",
"0.75501317",
"0.74309474",
"0.74309474",
"0.74309474",
"0.72531843",
"0.7075118",
"0.70237",
"0.70123446",
"0.69881505",
"0.6782467",
"0.6712581",
"0.67056036",
"0.6658898",
"0.6605079",
"0.66030437",
"0.6562053",
"0.65043294",
"0.6460107",
"0.6427777",
"0.63875... | 0.72696733 | 5 |
Yellow getter. Checks if square is yellow | def yellow(self):
return self._yellow | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yellow(self, new_value):\r\n if self.empty is True and self.yellow is False and self.red is False and new_value is True:\r\n self._yellow = new_value\r\n self.empty = False\r\n else:\r\n raise DomainError('Square already full! ')",
"def dark_square(self, square)... | [
"0.74757993",
"0.7121159",
"0.6810648",
"0.66788447",
"0.6648902",
"0.65221745",
"0.6442578",
"0.63538617",
"0.63475204",
"0.6290597",
"0.6263106",
"0.62426656",
"0.62196636",
"0.6194233",
"0.6127966",
"0.6127966",
"0.6127966",
"0.61247724",
"0.611893",
"0.60984313",
"0.60911... | 0.7448547 | 1 |
Gets the object_type of this AssetContractInformation. The concrete type of this complex type. The ObjectType property must be set explicitly by API clients when the type is ambiguous. In all other cases, the ObjectType is optional. The type is ambiguous when a managed object contains an array of nested documents, and ... | def object_type(self):
return self._object_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_type(self):\n if not self.Flags & gdef.ACE_OBJECT_TYPE_PRESENT:\n return None\n return self.ObjectType",
"def object_type(self) -> Optional[str]:\n return pulumi.get(self, \"object_type\")",
"def object_type(self) -> Optional[str]:\n return pulumi.get(self, \"o... | [
"0.704317",
"0.6918762",
"0.6918762",
"0.68990946",
"0.68990946",
"0.68990946",
"0.68990946",
"0.68990946",
"0.68990946",
"0.68990946",
"0.68990946",
"0.68990946",
"0.68990946",
"0.68990946",
"0.68990946",
"0.68990946",
"0.68990946",
"0.68990946",
"0.68990946",
"0.6839837",
"... | 0.70399654 | 3 |
Sets the object_type of this AssetContractInformation. The concrete type of this complex type. The ObjectType property must be set explicitly by API clients when the type is ambiguous. In all other cases, the ObjectType is optional. The type is ambiguous when a managed object contains an array of nested documents, and ... | def object_type(self, object_type):
self._object_type = object_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_type(self, object_type: str):\n allowed_values = [\"actuator\", \"sensor\", \"human\", \"service\", \"skill\", \"task\", \"action\", \"healthdata\",\n \"humanrole\", \"message\", \"permission\", \"preference\", \"property\"] # noqa: E501\n if object_type not in al... | [
"0.70631874",
"0.5755296",
"0.5719337",
"0.5663921",
"0.56559736",
"0.56221604",
"0.5571315",
"0.5571315",
"0.55533206",
"0.54762447",
"0.54762447",
"0.54762447",
"0.54762447",
"0.54762447",
"0.54762447",
"0.54762447",
"0.54762447",
"0.54762447",
"0.54762447",
"0.54762447",
"... | 0.7454179 | 3 |
Gets the bill_to of this AssetContractInformation. BillTo address of listed for the contract. | def bill_to(self):
return self._bill_to | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bill_to(self, bill_to):\n\n self._bill_to = bill_to",
"def bcc_email_address(self):\n return self._bcc_recipients",
"def to(self) -> Address:\n return self._to",
"def get_bank_accounts(self):\n spec = {'owner': DBRef(self.collection_name, self._id)}\n return BankAccount... | [
"0.5997391",
"0.5492604",
"0.5428989",
"0.5316452",
"0.52660596",
"0.5259536",
"0.5166623",
"0.5036077",
"0.5036077",
"0.5036077",
"0.5029496",
"0.50041676",
"0.4938565",
"0.49068496",
"0.48920402",
"0.48642504",
"0.4826543",
"0.482006",
"0.47910878",
"0.47763047",
"0.4727087... | 0.7730394 | 0 |
Sets the bill_to of this AssetContractInformation. BillTo address of listed for the contract. | def bill_to(self, bill_to):
self._bill_to = bill_to | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bill_to(self):\n return self._bill_to",
"def set_bill_account(self, bill_account_list):\n self.multiple_items_selection_from_kendo_dropdown(self.bill_account_kendo_dropdown_locator, bill_account_list)\n page_header_element = self.wait().until(EC.element_to_be_clickable(self.page_header_l... | [
"0.6622299",
"0.5472589",
"0.53921884",
"0.5228487",
"0.5146901",
"0.5046447",
"0.496614",
"0.49546304",
"0.49082676",
"0.49066508",
"0.48790646",
"0.486337",
"0.48164213",
"0.4807188",
"0.47398406",
"0.47232476",
"0.4711835",
"0.47056603",
"0.46733794",
"0.46711746",
"0.4666... | 0.8090133 | 0 |
Gets the bill_to_global_ultimate of this AssetContractInformation. BillToGlobalUltimate information listed in the contract. | def bill_to_global_ultimate(self):
return self._bill_to_global_ultimate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bill_to_global_ultimate(self, bill_to_global_ultimate):\n\n self._bill_to_global_ultimate = bill_to_global_ultimate",
"def bill_to(self):\n return self._bill_to",
"def upper_global(self):\n return self.get_dim_attribute('upper')",
"def _get_eur_gbp_last_month(self) -> None:\n ... | [
"0.6892778",
"0.48896882",
"0.48835945",
"0.47585672",
"0.47350633",
"0.46606815",
"0.46538147",
"0.4642403",
"0.45811716",
"0.4571031",
"0.45653877",
"0.45432332",
"0.45143822",
"0.45100954",
"0.44714588",
"0.44690955",
"0.44609243",
"0.44471198",
"0.44380367",
"0.44187826",
... | 0.7950199 | 0 |
Gets the contract_number of this AssetContractInformation. Contract number for the Cisco support contract purchased for the Cisco device. | def contract_number(self):
return self._contract_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contract_number_partyA_21N(self):\n instrument = self.acm_obj.Trade().Instrument()\n instrument_id = instrument.Oid()\n currency = instrument.Currency().Name()\n contract_number = \"{instrument_id}-{currency}\".format(\n instrument_id=instrument_id,\n currency=... | [
"0.59258217",
"0.584531",
"0.5640801",
"0.5450351",
"0.54406613",
"0.54225516",
"0.5410251",
"0.5410251",
"0.5388157",
"0.53817827",
"0.53759074",
"0.5293066",
"0.52914536",
"0.5276952",
"0.5253492",
"0.5230767",
"0.5157721",
"0.51468384",
"0.50585556",
"0.5055464",
"0.505286... | 0.8110814 | 0 |
Sets the contract_number of this AssetContractInformation. Contract number for the Cisco support contract purchased for the Cisco device. | def contract_number(self, contract_number):
self._contract_number = contract_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contract(self, contract):\n\n self._contract = contract",
"def update_contract_balance(self, contract_balance):\n self.contract_balance = contract_balance",
"def contract_number(self):\n return self._contract_number",
"def set_contract_addr(self, addr):\n\t\tself.contract_addr = addr... | [
"0.6741479",
"0.62899786",
"0.59026676",
"0.58867043",
"0.55965984",
"0.5590048",
"0.53946733",
"0.5357157",
"0.5251647",
"0.5251647",
"0.5219463",
"0.51607794",
"0.51578164",
"0.51300824",
"0.51289797",
"0.50343776",
"0.5025832",
"0.50000995",
"0.4977413",
"0.4977023",
"0.49... | 0.8434056 | 0 |
Gets the line_status of this AssetContractInformation. Contract status as per the Cisco Contract APIx. | def line_status(self):
return self._line_status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contract_status(self) -> ContractStatus:\n if not self.cfg.is_attached:\n return ContractStatus.UNENTITLED\n entitlement_cfg = self.cfg.entitlements.get(self.name, {})\n if entitlement_cfg and entitlement_cfg['entitlement'].get('entitled'):\n return ContractStatus.ENT... | [
"0.66290027",
"0.56924903",
"0.5377987",
"0.535771",
"0.5295297",
"0.5259196",
"0.52107644",
"0.5189223",
"0.51714134",
"0.51402825",
"0.50830877",
"0.50828904",
"0.5060169",
"0.50471246",
"0.5029664",
"0.5007104",
"0.5005772",
"0.50049436",
"0.49931568",
"0.49786314",
"0.497... | 0.7191819 | 0 |
Sets the line_status of this AssetContractInformation. Contract status as per the Cisco Contract APIx. | def line_status(self, line_status):
self._line_status = line_status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_status(self, new_status):\n if new_status == self.status:\n return\n\n old_status = self.status\n\n if new_status not in self.available_statuses():\n raise exceptions.InvalidLineStatus(\n _(\n \"'%(new_status)s' is not a valid sta... | [
"0.6037366",
"0.5846891",
"0.5759345",
"0.56974405",
"0.56711024",
"0.5607109",
"0.5487611",
"0.5487611",
"0.5487611",
"0.54532564",
"0.54065496",
"0.53897524",
"0.5376416",
"0.5367098",
"0.53363335",
"0.5331669",
"0.530693",
"0.530147",
"0.526819",
"0.52601427",
"0.5242032",... | 0.7671556 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, AssetContractInformation):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Compute the density of traj in atoms/nm^3 | def compute_density(
traj,
area,
surface_normal_dim=2,
pore_center=0.0,
max_distance = 1.0,
bin_width = 0.01
):
distances = traj.xyz[:,:,surface_normal_dim] - pore_center
bin_centers = []
density = []
for bin_center in np.arange(-max_distance, max_distance, bin_width):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def electron_density_per_m3(self):\n return self.electron_density * 1e6",
"def density(self):\n return (1e-3*self.molar_mass) * self.pressure / (gas_constant * self.temperature) # kg/m^3",
"def electron_density(self):\n return N_avo * self.num_electrons * self.density / self.molar_mass",
... | [
"0.69847125",
"0.66880167",
"0.6444939",
"0.64008796",
"0.63585484",
"0.6358287",
"0.6272691",
"0.6254376",
"0.6202966",
"0.61552936",
"0.61232495",
"0.610893",
"0.609129",
"0.6069121",
"0.6060912",
"0.59814245",
"0.59663284",
"0.59616756",
"0.58860856",
"0.585174",
"0.581968... | 0.6014862 | 15 |
Bin reward to {+1, 0, 1} by its sign. | def reward(self, reward):
return np.sign(reward) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reward(self, reward):\r\n return np.sign(reward)",
"def reward(self, reward):\n return float(np.sign(reward))",
"def sign(x):\n return(copysign(1, x))",
"def sign(self):\n return 1 - 2 * self._ltz()",
"def sign(self, inputs):\n pass",
"def sign(self, inputs):\n pass"... | [
"0.7170663",
"0.6652758",
"0.6516397",
"0.61955494",
"0.60499823",
"0.60499823",
"0.6048698",
"0.60147136",
"0.5961627",
"0.5949438",
"0.59057444",
"0.5822291",
"0.5816496",
"0.57978296",
"0.57128024",
"0.5707449",
"0.56889117",
"0.56587505",
"0.5643741",
"0.56297874",
"0.562... | 0.70812565 | 3 |
Computation of encodings has to be done in batches due to the large size of the dataset. Otherwise the kernel will die! For downscaling pick np.mean (average pooling) or np.max (max pooling) respectively. If downscaling is not required choose downscale_factor=1. Keep in mind the network expects an input image size of 6... | def encode_dataset(batch_size,downscale_factor,dataset, pooling_function):
n,l=np.shape(dataset)
f=downscale_factor
n_batches=n//batch_size
batches=np.linspace(1,n_batches,n_batches, dtype=int) * batch_size
gaf = GramianAngularField(image_size=1., method='summation')
print('Encoding s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autoencode(self, imgs):\n x = tf.layers.conv2d(imgs, filters=32, kernel_size=3, strides=1, padding='same', activation=tf.nn.relu)\n shape2 = x.shape\n x = tf.layers.max_pooling2d(x, pool_size=2, strides=2)\n x = tf.layers.conv2d(x, filters=64, kernel_size=3, strides=1, padding='same... | [
"0.58314115",
"0.5685731",
"0.56497496",
"0.56484973",
"0.5554049",
"0.55209684",
"0.5485943",
"0.54627454",
"0.54137504",
"0.5396578",
"0.53885907",
"0.5366336",
"0.5357764",
"0.53196335",
"0.5313715",
"0.5311812",
"0.5310088",
"0.5306535",
"0.53041184",
"0.5299925",
"0.5294... | 0.6929917 | 0 |
Construct the resource manager. | def __init__(self, reactor, logger):
super(ManagerThread, self).__init__()
self.logger = logger
self._requests = []
self.request_queue = Queue()
self._reactor = reactor
self._stop_flag = False
self._requests_handlers = {StopTest: self.stop_test,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _configure_manager(self):\n self._manager = CloudDatabaseManager(self,\n resource_class=CloudDatabaseInstance, response_key=\"instance\",\n uri_base=\"instances\")\n self._flavor_manager = BaseManager(self,\n resource_class=CloudDatabaseFlavor, respons... | [
"0.6268288",
"0.6262003",
"0.61965317",
"0.6191669",
"0.6174097",
"0.61394644",
"0.6089736",
"0.59159756",
"0.58417094",
"0.5840344",
"0.58061874",
"0.57950366",
"0.57855695",
"0.57750463",
"0.5771833",
"0.5764935",
"0.57622284",
"0.57540655",
"0.5752814",
"0.5748506",
"0.574... | 0.5890053 | 8 |
Returns the suitable request handler. | def _get_request_handler(self, request):
try:
message_type = type(request.message)
return self._requests_handlers[message_type]
except KeyError:
raise ServerError("Invalid message type %r" % message_type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_request_handler(self, headers):\n api_version = self.get_api_version(headers)\n\n if api_version == '1.0.0':\n request_handler = V1_0_0_HelperHandler()\n else:\n request_handler = V1_0_0_HelperHandler()\n\n return request_handler",
"def _find_url_handler(... | [
"0.75433934",
"0.7513775",
"0.7414342",
"0.72202986",
"0.716436",
"0.6982843",
"0.6956317",
"0.6880665",
"0.6838173",
"0.6739354",
"0.6524218",
"0.6508437",
"0.63846564",
"0.6342752",
"0.6265904",
"0.61902636",
"0.61887336",
"0.6188333",
"0.61220944",
"0.6119327",
"0.59964764... | 0.7682702 | 0 |
Find least common multiple of multiple numbers >>> lcm(range(1, 4)) 6 >>> lcm(2,3,4) 12 | def lcm(*nums):
factors_list = [factors(i) for i in nums]
all_factors = set(chain(*factors_list))
factor_counts = [{n: fl.count(n) for n in set(fl)} for fl in factors_list]
result = 1
for factor in all_factors:
max_occurences = max([fc.get(factor, 0) for fc in factor_counts])
result ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lcm(multiple_list):\n res = 1\n for n in multiple_list:\n if res % n != 0:\n res *= n//fractions.gcd(res,n)\n return res",
"def lcm(*numbers): \n def lcm(a, b):\n return (a * b) // gcd(a, b)\n return reduce(lcm, numbers, 1)",
"def lcm(\n numbers: List[int]\... | [
"0.82370895",
"0.8139086",
"0.8112922",
"0.8094182",
"0.80820936",
"0.8077356",
"0.80414236",
"0.80167836",
"0.799231",
"0.7961098",
"0.7961098",
"0.7961098",
"0.7961098",
"0.7961098",
"0.7961098",
"0.7961098",
"0.7961098",
"0.7961098",
"0.7956724",
"0.79299915",
"0.7926433",... | 0.71793056 | 66 |
True/False list of primes from 0 to n1 >>> prime_cache(10) [False, False, True, True, False, True, False, True, False, False] | def prime_cache(n):
cache = [False, False] + [True] * (n-2)
cache[4::2] = [False] * ((n-3)//2)
for i in range(3, int(n**0.5)+1, 2):
if cache[i]:
cache[i*i::2*i] = [False]*((n-i*i-1)//(2*i)+1)
return cache | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primes(n):\n return [i for i, v in enumerate(prime_cache(n)) if v]",
"def list_primes(n):\n\tarr = [True] * n\n\tarr[0] = False\n\tarr[1] = False\n\tfor i in range(2, int(math.sqrt(n)) + 1):\n\t\tif is_prime(i):\n\t\t\tfor j in range(2 * i, n, i):\n\t\t\t\tarr[j] = False\n\tprimes = []\n\tfor i in range(l... | [
"0.7786344",
"0.7479495",
"0.7283646",
"0.72117764",
"0.7081768",
"0.7051076",
"0.70361274",
"0.70210874",
"0.6971093",
"0.6968755",
"0.68762267",
"0.68680173",
"0.6826943",
"0.68215346",
"0.6818231",
"0.6800172",
"0.6800172",
"0.6782817",
"0.6766824",
"0.6764123",
"0.674851"... | 0.80716157 | 0 |
Returns number of natural numbers which are less than and relatively prime to n. >>> phi(2) 1 >>> phi(7) 6 | def phi(n, cache=None):
if n == 1:
return 1
elif n < 1:
raise AssertionError('Please enter an int > 0')
else:
return int(n * prod([1 - 1/p for p in set(factors(n, cache))])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phi(n: int) -> int:\n result = 1\n for i in range(2, n):\n if gcd(i, n) == 1:\n result += 1\n return result",
"def phi(n):\n sieve = [i if i & 1 else i // 2 for i in range(n + 1)]\n for i in range(3, n + 1, 2):\n if sieve[i] == i:\n for j in range(i, n + 1, ... | [
"0.7770902",
"0.7068459",
"0.6984532",
"0.6903707",
"0.68247056",
"0.68076813",
"0.67985",
"0.678393",
"0.6774111",
"0.67077446",
"0.670429",
"0.6633385",
"0.6526214",
"0.6457188",
"0.64528984",
"0.64256597",
"0.6412896",
"0.6411824",
"0.6406967",
"0.63579386",
"0.6336251",
... | 0.6964897 | 3 |
n = (3 x2 x)/2 for x to be int, (1 + sqrt(24n + 1)/2 must be int >>> is_pent(5) True >>> is_pent(6) False | def is_pent(n):
pen_test = (1 + sqrt(24*n + 1))/6
if pen_test == int(pen_test):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_pentagonal(n):\r\n if ((1+(24*n+1)**0.5) / 6)%1 == 0:\r\n return True\r\n return False",
"def is_pentagonal(n: int) -> bool:\r\n root = (1 + 24 * n) ** 0.5\r\n return ((1 + root) / 6) % 1 == 0",
"def is_pentagonal_number(n):\n _, x = quadratic.solve(3, -1, -2 * n)\n return is_nu... | [
"0.76181537",
"0.7594795",
"0.7569422",
"0.7541353",
"0.7057518",
"0.70542014",
"0.7038212",
"0.68479776",
"0.67720413",
"0.67626107",
"0.6677112",
"0.66408694",
"0.6466515",
"0.6408253",
"0.63678056",
"0.6362122",
"0.6309668",
"0.6235348",
"0.6193418",
"0.61733454",
"0.61711... | 0.8513671 | 0 |
get the balance of the wallet address | def balance_of_address(self, address):
balance = 0
for block in self.chain:
for transaction in block.transactions:
if transaction.walletoffrom == address:
balance -= transaction.amount
if transaction.walletofto == address:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_balance(address: str) -> int:\n return base.Balances(balance_of).get(address)",
"def get_balance(self, address):\n balance = 0\n for block in self.chain:\n for t in block['transactions']:\n if t['recipient'] == address:\n balance += t['amount'... | [
"0.8287113",
"0.80935556",
"0.79650754",
"0.7763347",
"0.77534664",
"0.7689457",
"0.76580805",
"0.75750595",
"0.75557035",
"0.7478612",
"0.7470099",
"0.7393678",
"0.7393145",
"0.7377592",
"0.7367802",
"0.73228997",
"0.73216796",
"0.7254056",
"0.72263384",
"0.7220544",
"0.7217... | 0.7729702 | 5 |
Actually create a ResolverOp instance with JSON properties. | def create_from_json(cls, config_json: str) -> 'ResolverOp':
return cls.create(**json_utils.loads(config_json)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(cls, **props: Any) -> 'ResolverOp':\n real_instance = super().__call__()\n cls._check_kwargs(props)\n for name, value in props.items():\n setattr(real_instance, name, value)\n return real_instance",
"def create(cls, **props: Any) -> 'ResolverOp':\n real_instance = super().__call__(... | [
"0.6811909",
"0.6811909",
"0.59342283",
"0.5440334",
"0.52872497",
"0.5275193",
"0.5216687",
"0.5179934",
"0.5133534",
"0.51172435",
"0.5096819",
"0.50834227",
"0.5080239",
"0.5080239",
"0.50634116",
"0.5060461",
"0.50579053",
"0.5044059",
"0.5029246",
"0.5028303",
"0.5025152... | 0.7118747 | 0 |
Custom isinstance() that supports Generic types as well. | def _isinstance(self, value: Any, typ: Any) -> bool:
typ_args = getattr(typ, '__args__', ())
if hasattr(typ, '__origin__'):
# Drop subscripted extra type parameters from generic type.
# (e.g. Dict[str, str].__origin__ == dict)
# See https://www.python.org/dev/peps/pep-0585 for more information... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _isinstance(cls, x):\n return isinstance(x, cls.PYTHON_TYPE_CHECK)",
"def isinstance_safe(value, type_):\n try:\n return isinstance(value, type_)\n except TypeError:\n # Cannot perform isinstance on some types\n return False",
"def _isinstance(obj, cls, bound_Generic=None,... | [
"0.78249437",
"0.75625736",
"0.7124543",
"0.70815945",
"0.7045748",
"0.6844922",
"0.6786576",
"0.67683727",
"0.6756633",
"0.6647368",
"0.66187394",
"0.65770924",
"0.6531242",
"0.6418529",
"0.6407348",
"0.64029634",
"0.6393635",
"0.6391096",
"0.6391096",
"0.6391096",
"0.639109... | 0.77370906 | 1 |
Gets the subject field | def getSubject(self):
return self.msg["Subject"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject(self):\n return self.get(\"subject\")",
"def get_subject(self):\n return self._subject",
"def subject(self):\n if \"subject\" in self._prop_dict:\n return self._prop_dict[\"subject\"]\n else:\n return None",
"def subject(self):\n return sel... | [
"0.8546978",
"0.8421207",
"0.82273424",
"0.81908196",
"0.809099",
"0.8078224",
"0.8078224",
"0.7975218",
"0.7774466",
"0.7695352",
"0.7694589",
"0.7672639",
"0.7185678",
"0.7185678",
"0.7149557",
"0.7146025",
"0.7026891",
"0.70241207",
"0.6989606",
"0.6841878",
"0.6841451",
... | 0.8022054 | 7 |
Gets the ReturnPath field | def getReturnPath(self):
return self.msg["Return-Path"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_path(self):\n return self.path",
"def __get_path(self):\n return self.path",
"def path(self):\n return self._path",
"def path(self):\n return self._path",
"def path(self):\n return self._path",
"def path(self):\n return self._path",
"def path(self):\n ... | [
"0.77010435",
"0.7643022",
"0.7491303",
"0.7491303",
"0.7491303",
"0.7491303",
"0.7491303",
"0.7491303",
"0.7491303",
"0.7491303",
"0.7491303",
"0.7491303",
"0.7491303",
"0.7491303",
"0.74904346",
"0.74675363",
"0.7466091",
"0.74599016",
"0.7452162",
"0.7429111",
"0.7370727",... | 0.8237621 | 0 |
Search or self for the specified Python version and return the first match. | def find_python_version(self, major, minor=None, patch=None, pre=None, dev=None):
version_matcher = operator.methodcaller(
"matches", major, minor=minor, patch=patch, pre=pre, dev=dev
)
is_py = operator.attrgetter("is_python")
py_version = operator.attrgetter("as_python")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_py_atleast( minver ):\n wantver = canon_ver(minver)\n\n for pyexe, info in get_python_verlist():\n \n thisver = canon_ver(info[2])\n\n if thisver >= wantver:\n return pyexe\n\n # can't satisfy requirement\n return None",
"def which(self, name):\n if not... | [
"0.66143304",
"0.6599875",
"0.6301774",
"0.6229755",
"0.6012448",
"0.5920252",
"0.5911101",
"0.5869988",
"0.5861554",
"0.5848118",
"0.58446807",
"0.5824409",
"0.58117074",
"0.5803315",
"0.5795893",
"0.5772869",
"0.5723488",
"0.57016146",
"0.5671283",
"0.56623363",
"0.5646084"... | 0.6995244 | 0 |
Reads, converts and returns the dataset_part in numpy format. | def convertDatasetToNumpy(self, x_train, y_train, x_eval, y_eval, x_test, y_test, shape, dataset_size, num_classes,
depth_first, onehot):
if (x_eval is None) and (x_test is None):
input = x_train
labels = y_train
elif x_eval is None:
inpu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataConvertToNumpy( self ):\n self.featureNumpy = np.asarray( self.feature )\n self.ClassNumpy = np.asarray( self.Class )",
"def load_data(file_to_read):\n\n data = np.recfromtxt(file_to_read)\n data = np.asarray(data)\n\n return data",
"def test_read(self):\n dt = np.dtype('(... | [
"0.64081466",
"0.6149978",
"0.613725",
"0.6133393",
"0.61110336",
"0.60563695",
"0.6039322",
"0.5997475",
"0.5976839",
"0.59523314",
"0.59523314",
"0.592794",
"0.59222144",
"0.59132695",
"0.58542794",
"0.5848898",
"0.5839309",
"0.583343",
"0.5831749",
"0.58311224",
"0.5826216... | 0.0 | -1 |
Returns the path to the "raw" data of the dataset. | def _getDatasetPath(self):
return self.__dataset_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataPath(self):\n return ''",
"def path(self):\n return self._data_file",
"def data_path(self):\n raise NotImplementedError",
"def get_raw_path(self):\n\n return self.raw_img_path",
"def dataPath(self):\n\t\treturn fl.File( self._path + '/renderLayerData.data' )",
"def get... | [
"0.7656258",
"0.740497",
"0.7395588",
"0.70975006",
"0.70782423",
"0.7063438",
"0.70100456",
"0.70041394",
"0.7002504",
"0.6907189",
"0.68645567",
"0.68163466",
"0.6640086",
"0.6612662",
"0.6595232",
"0.65896946",
"0.64992857",
"0.64818364",
"0.6454146",
"0.6444598",
"0.64216... | 0.7168106 | 3 |
Find the unique elements of an array. Returns the sorted unique elements of an array. There are three optional | def unique(ar, return_index=False, return_inverse=False,
return_counts=False, axis=None):
ar = np.asanyarray(ar)
if axis is None:
ret = _unique1d(ar, return_index, return_inverse, return_counts)
return _unpack_tuple(ret)
# axis was specified and not None
try:
ar = np.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_of_an_array(an_array):\n temp_array=an_array.copy()\n u=[]\n for i in range(temp_array.shape[0]):\n for j in range(temp_array.shape[1]):\n if temp_array[i][j] not in u:\n u.append(temp_array[i][j])\n return sorted(u)",
"def get_uniques(array):\n uniques ... | [
"0.77543914",
"0.7670805",
"0.74704456",
"0.74485576",
"0.71950716",
"0.6994082",
"0.6824562",
"0.6817919",
"0.6748691",
"0.6729596",
"0.6593372",
"0.65626484",
"0.6488506",
"0.6486476",
"0.6483136",
"0.6474781",
"0.63803935",
"0.6358661",
"0.6348984",
"0.6347082",
"0.6325797... | 0.56109124 | 61 |
Find the unique elements of an array, ignoring shape. | def _unique1d(ar, return_index=False, return_inverse=False,
return_counts=False):
ar = np.asanyarray(ar).flatten()
optional_indices = return_index or return_inverse
if optional_indices:
perm = ar.argsort(kind='mergesort' if return_index else 'quicksort')
aux = ar[perm]
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_of_an_array(an_array):\n temp_array=an_array.copy()\n u=[]\n for i in range(temp_array.shape[0]):\n for j in range(temp_array.shape[1]):\n if temp_array[i][j] not in u:\n u.append(temp_array[i][j])\n return sorted(u)",
"def get_uniques(array):\n uniques ... | [
"0.7753883",
"0.7658077",
"0.72149765",
"0.7067209",
"0.7036766",
"0.6949334",
"0.6934617",
"0.69215995",
"0.6761227",
"0.6736673",
"0.6652539",
"0.6556754",
"0.65484476",
"0.6543439",
"0.6540323",
"0.6481448",
"0.6480239",
"0.6419212",
"0.6361706",
"0.635556",
"0.63507366",
... | 0.6057915 | 31 |
Returns the model's attributes as a dictionary. We override the standard method in order to hide the id column, since this only exists to provide the table with a primary key. | def to_dict(self):
d = {}
for attr in self.__class__.attributes:
d[attr] = getattr(self, attr)
return d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_dict(self):\n return {c.key: getattr(self, c.key)\n for c in inspect(self).mapper.column_attrs}",
"def attributes(self):\n return { k: getattr(self, k) for k in self.__class__.columns().keys() }",
"def to_dict(self):\n\n # Check if is the right instance.\n if i... | [
"0.7592019",
"0.7496649",
"0.7437434",
"0.7398515",
"0.7329788",
"0.7329788",
"0.7329788",
"0.72838235",
"0.72838235",
"0.72838235",
"0.72838235",
"0.72838235",
"0.7246838",
"0.7246838",
"0.7246838",
"0.7246838",
"0.7215808",
"0.71539736",
"0.71409357",
"0.71232826",
"0.71226... | 0.6935873 | 27 |
Convert the spaces in any keyword with '_', so they can be treated as a single word by the algorithm. | def handle_kw_phrases(self, text: str
) -> str:
for kw in self.spaces:
if kw in text:
text = text.replace(kw, self.spaces[kw])
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_word(word: str) -> str:\r\n return re.compile(r\"[\\W_]+\").sub(\"\", word.lower())",
"def crawler_format(keyword):\r\n tmp = re.sub('[^0-9a-zA-Z]', '_', keyword).strip('_')\r\n return re.sub('_+', ' ', tmp).lower()",
"def underscore(text):\n # return '__'+text.replace(' ','__') + '__'\... | [
"0.7375396",
"0.7207189",
"0.7205651",
"0.6996784",
"0.6988654",
"0.69130224",
"0.67588764",
"0.67115027",
"0.66977113",
"0.6663665",
"0.66399133",
"0.6634489",
"0.6634096",
"0.6625953",
"0.66021514",
"0.6558772",
"0.65455896",
"0.6536678",
"0.6520544",
"0.64475626",
"0.64465... | 0.61668664 | 43 |
A list of the "target words" which are the key words but with the filtering/preprocessing applied. | def target_words(self) -> List[str]:
return list(map(
lambda w: self.spaces[w.lower()]
if w.lower() in self.spaces else w.lower(),
self.keywords
)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_words( corpus, key, ignore_words = Ignore_words ) :\n return list(set(chain.from_iterable( (words(c,key,ignore_words) for c in corpus ) ) ) )",
"def get_filter_word_list(self):\n self.filter_words = self.read_word_file(self.filter_word_file)",
"def interestingWords(self):\n words = set([])... | [
"0.682682",
"0.6811436",
"0.6803833",
"0.67600375",
"0.673478",
"0.67239624",
"0.6700556",
"0.66194886",
"0.65833056",
"0.65680504",
"0.6558761",
"0.6506947",
"0.63702095",
"0.63696253",
"0.63618857",
"0.63268524",
"0.6326281",
"0.63234484",
"0.6318066",
"0.6290989",
"0.62801... | 0.83127296 | 0 |
Dictionary that maps the original key words onto their "encoded" equivalent (i.e., with lower case, with spaces replaced with '_') | def target2original(self) -> Dict[str, str]:
return {
self.target_words[i]: self.keywords[i]
for i in range(len(self.keywords))
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform(legacy_data: dict) -> dict:\n return {v.lower(): key for key, value in legacy_data.items()\n for v in value}",
"def get_corrected_words_map(correct_sentence: str, original_sentence: str) -> Dict[str, str]:\n words_map = {}\n correct_words = correct_sentenc... | [
"0.65383524",
"0.64053553",
"0.6347604",
"0.6275971",
"0.6270091",
"0.626951",
"0.625333",
"0.6150934",
"0.60922694",
"0.60567355",
"0.60436726",
"0.6030458",
"0.60149914",
"0.5999181",
"0.5995143",
"0.59917426",
"0.59843",
"0.5973049",
"0.5960603",
"0.5959533",
"0.59392214",... | 0.6009112 | 13 |
The important sigmoid function for squashing the values between 0 and 1. | def sigmoid(x: np.ndarray
) -> np.ndarray:
return 1/(1+np.exp(-x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + math.exp(-x))",
"def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))",
"def sigmoid(x):\n return 1 / (1 + math.exp(-x))",
"def sigmoid(x):\n return 1 / (1 - (power(e,-... | [
"0.8307103",
"0.8307103",
"0.82910836",
"0.8268776",
"0.8266369",
"0.8264087",
"0.8232575",
"0.8232575",
"0.822608",
"0.8220571",
"0.8220571",
"0.8220571",
"0.8220571",
"0.8220571",
"0.8220571",
"0.82194525",
"0.82156944",
"0.82127756",
"0.8202055",
"0.81971574",
"0.81926733"... | 0.7612219 | 77 |
apply gaussian blur on the image. | def gaussianblur_transform(im):
im_gblur = cv2.GaussianBlur(im,(5,5),0)
return im_gblur | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian_blur(self,img):\n return cv2.GaussianBlur(img, (self.kernel_size, self.kernel_size), 0)",
"def __gaussian_blur(self, img, kernel_size=3):\n return cv2.GaussianBlur(img, (kernel_size, kernel_size), 0)",
"def gaussian_blur(self, img):\n kernel_size = self.gaussian_blur_params[\"... | [
"0.84170055",
"0.8351707",
"0.829353",
"0.81630987",
"0.81620103",
"0.81620103",
"0.81620103",
"0.81620103",
"0.81620103",
"0.81620103",
"0.81620103",
"0.81620103",
"0.81620103",
"0.81620103",
"0.81620103",
"0.81620103",
"0.81620103",
"0.81620103",
"0.81620103",
"0.81185824",
... | 0.770138 | 26 |
Save best model weights in SegmentationTrainTask. | def save_model(self, output_model: ModelEntity):
logger.info("called save_model")
buffer = io.BytesIO()
hyperparams_str = ids_to_strings(cfg_helper.convert(self._hyperparams, dict, enum_to_str=True))
labels = {label.name: label.color.rgb_tuple for label in self._labels}
model_ckp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_model(self, is_best, state, epoch):\n path = os.path.join(self.logpath_models, 'model-%d.pth.tar' % epoch)\n torch.save(state, path)\n if is_best:\n shutil.copyfile(path, path + 'model_best.pth.tar')",
"def save_model(self):\n save_folder = os.path.join(self.log_pa... | [
"0.6650038",
"0.6643347",
"0.6598322",
"0.6518796",
"0.6507951",
"0.6491708",
"0.64696395",
"0.64233774",
"0.63872117",
"0.6382903",
"0.63751495",
"0.6360432",
"0.6342814",
"0.633039",
"0.6327655",
"0.6308364",
"0.62994194",
"0.62989074",
"0.62692106",
"0.62669325",
"0.625638... | 0.5797751 | 92 |
return parsed dic of attributes | def getParsedDic(self):
return {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_attrs(attrs):\n if attrs.getLength() == 0:\n return {}\n tmp_dict = {}\n for name in attrs.getNames():\n tmp_dict[name] = attrs.getValue(name)\n return tmp_dict",
"def get_attributes(self) -> Dict[str, str]:\n pass",
"def _get_attribute_dic(self, attrs):\n at... | [
"0.78939116",
"0.78733903",
"0.7617347",
"0.7591473",
"0.7510816",
"0.7366241",
"0.73438156",
"0.7340827",
"0.72419924",
"0.7192755",
"0.7143592",
"0.7062585",
"0.70397705",
"0.7024373",
"0.7017498",
"0.69949126",
"0.6984929",
"0.6918649",
"0.69153214",
"0.69153214",
"0.69153... | 0.63478583 | 57 |
Returns boolean value depending on whether the aggregation method requires server data or not. | def requiresData():
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_aggregation(self) -> ConfigNodePropertyBoolean:\n return self._query_aggregation",
"def dynamic(self):\n return bool(self.data.get('dynamic') == 'true')",
"def has_data_flow(self) -> bool:\n return self.graph_count and not self.data_flow_null_count",
"def statistics_enabled(self) -... | [
"0.6899004",
"0.5701535",
"0.56353027",
"0.55603594",
"0.5503864",
"0.54962474",
"0.54927695",
"0.54514027",
"0.5426389",
"0.5426389",
"0.54034734",
"0.5399808",
"0.5397731",
"0.538908",
"0.5370074",
"0.5338207",
"0.532616",
"0.53131884",
"0.53120226",
"0.5305916",
"0.5304717... | 0.0 | -1 |
Reads an image, decodes, and pads its spatial dimensions, all in TensorFlow | def decode_image_with_padding(im_file, decode_fn=tf.image.decode_image,
channels=3, pad_upto=500):
# TODO(student): Write code.
content = tf.io.read_file(im_file)
raw_img = functools.partial(decode_fn, channels=channels)(content)
raw_shape = tf.shape(raw_img)
paddings = [[0, pad_upto-raw_shape[0]], ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess(image, gt_image, height, width):\n\n # Convert the image dtypes to tf.float32 if needed\n if image.dtype != tf.float32:\n image = tf.image.convert_image_dtype(image, dtype=tf.float32)\n\n # Convert the image dtypes to tf.int32 if needed\n if gt_image.dtype != tf.int32:\n gt... | [
"0.6252908",
"0.62050575",
"0.6179051",
"0.61633486",
"0.6159363",
"0.61564153",
"0.6126811",
"0.61189336",
"0.6110866",
"0.60893",
"0.6087152",
"0.60381603",
"0.60061234",
"0.5960366",
"0.59399766",
"0.59102744",
"0.5910235",
"0.5882494",
"0.58616",
"0.5856179",
"0.58486575"... | 0.60109043 | 12 |
Given tf.int Tensor matrix with shape [N, 2], make N 2D binary masks. These binary masks will be used "to mask the loss". Specifically, if the image is shaped as (300 x 400) and therefore so its labels, we only want to penalize the model for misclassifying within the image boundary (300 x 400) and ignore values outside... | def make_loss_mask(shapes):
# TODO(student): Write code.
masks = tf.sequence_mask(shapes, 500)
masks.set_shape([None, 2, 500])
n_sample = tf.shape(shapes)[0]
v1 = tf.cast(tf.broadcast_to(tf.expand_dims(masks[:, 0, :], 2), (n_sample, 500, 500)), tf.float32)
v2 = tf.cast(tf.broadcast_to(tf.expand_dims(masks[:, 1,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def masked_bilinearsigmoid_cross_entropy(preds, labels, mask, negative_mask):\r\n\r\n loss = tf.nn.sigmoid_cross_entropy_with_logits(logits=preds, labels=labels)\r\n mask += negative_mask\r\n mask = tf.cast(mask, dtype=tf.float32)\r\n # mask /= tf.reduce_mean(mask)\r\n mask = tf.reshape(mask, shape=... | [
"0.6790927",
"0.645134",
"0.6316921",
"0.6236827",
"0.621911",
"0.62181616",
"0.61947864",
"0.6192165",
"0.6186134",
"0.6169222",
"0.6165109",
"0.6130671",
"0.6121818",
"0.6119625",
"0.6089915",
"0.6089915",
"0.6089915",
"0.6087548",
"0.6074675",
"0.6045873",
"0.6040182",
"... | 0.638773 | 2 |
Upsamples an input. Conv2DTranspose => Batchnorm => Dropout => Relu | def upsample(filters, size, norm_type='batchnorm', apply_dropout=False):
initializer = tf.random_normal_initializer(0., 0.02)
result = tf.keras.Sequential()
result.add(
tf.keras.layers.Conv2DTranspose(filters, size, strides=2,
padding='same',
kernel_initializer=initializer,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upsample(x, filters):\n x = tf.keras.layers.Conv2DTranspose(\n filters, kernel_size=3, strides=2, padding='same', use_bias=True)(\n x)\n x = tf.keras.layers.LeakyReLU(alpha=0.2)(x)\n return x",
"def model_with_upsample2d():\n inputs = tf.keras.Input(shape=(8, 8, 3,))\n x = tf.keras.lay... | [
"0.7356043",
"0.70594096",
"0.7051095",
"0.68866855",
"0.6857871",
"0.68239325",
"0.6801166",
"0.6719487",
"0.66626257",
"0.6577877",
"0.65380526",
"0.6507813",
"0.649182",
"0.64477557",
"0.6435186",
"0.6398476",
"0.63846356",
"0.63844824",
"0.6378015",
"0.63583744",
"0.63358... | 0.65413594 | 10 |
r""" Load slow weights from Lookahead optimizer. Useful for performing evaluation on the slow weights (which typically generalize better). This method backs up fast weights to load them after evaluation. No need to call this method if evaluation happens just after a lookahead step. | def load_slow_weights(self):
for group in self.optimizer.param_groups:
for p in group["params"]:
param_state = self.state[p]
param_state["backup_params"] = torch.zeros_like(p.data)
param_state["backup_params"].copy_(p.data)
p.data.copy_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_and_fuse_pretrained_weights(model: torch.nn.Module, opt: argparse.ArgumentParser) -> torch.nn.Module:\n model.optimize_for_inference(fuse_all_layers=False)\n fused_state_dict = load_weights(opt.weights)\n fused_state_dict = map_key_names(fused_state_dict, model.state_dict())\n model.load_state... | [
"0.6219279",
"0.6157501",
"0.6107372",
"0.60793597",
"0.6042776",
"0.6017316",
"0.5927115",
"0.5865936",
"0.5856344",
"0.58440804",
"0.58319896",
"0.57923555",
"0.57865983",
"0.57641697",
"0.57228976",
"0.57228976",
"0.5722838",
"0.5689933",
"0.5689933",
"0.5684171",
"0.56768... | 0.7571822 | 0 |
Finds the language to use. | def get_lang(self):
props = getToolByName(self.context,
'portal_properties')
return props.site_properties.getProperty('default_language') or 'en' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lang(self):\n\n path = self.get_lang_path()\n for language in self.languages:\n if language in path:\n return language",
"def language(self, target):\n self._check_target(target)\n return target.language or self._default_language",
"def get_language(self, w... | [
"0.7614697",
"0.7256594",
"0.7068705",
"0.7020586",
"0.6923419",
"0.690966",
"0.6863909",
"0.6860054",
"0.68478864",
"0.68461674",
"0.68394077",
"0.68213046",
"0.68182886",
"0.6799507",
"0.6795163",
"0.67949075",
"0.6787875",
"0.67871153",
"0.6756067",
"0.6755635",
"0.6741693... | 0.64463913 | 47 |
Returns the currently loggedin user's fullname. | def get_user_fullname(self):
member = self.get_user()
if member:
return member.getProperty('fullname') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_fullname(self):\n return self.applicant.userprofile.display_name()",
"def full_name(self):\n return self.user.get_full_name() or None",
"def get_full_name(self):\n full_name = '%s %s' % (self.user.first_name.strip(), self.user.last_name.strip())\n if len(full_name.strip... | [
"0.8744586",
"0.85566866",
"0.85148585",
"0.8471631",
"0.8471631",
"0.84389234",
"0.8413501",
"0.83892184",
"0.8317775",
"0.82832503",
"0.82324886",
"0.8129175",
"0.80030346",
"0.7898646",
"0.7864632",
"0.7841731",
"0.77861416",
"0.7778589",
"0.7774969",
"0.77318317",
"0.7729... | 0.8931949 | 0 |
Returns the currently loggedin user's email. | def get_user_email(self):
member = self.get_user()
if member:
return member.getProperty('email') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_useremail(self):\n return self.user.email",
"def user_email(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"user_email\")",
"def _get_user_email_address(self, request):\n return request.session.get(SESSION_VAR_EMAIL_ADDRESS, not request.user.is_anonymous() and request.user... | [
"0.8379027",
"0.81323075",
"0.80568236",
"0.7832865",
"0.76932305",
"0.76874566",
"0.76799136",
"0.75456905",
"0.74209106",
"0.7403161",
"0.7397628",
"0.7372335",
"0.7372335",
"0.7372335",
"0.73187095",
"0.72495985",
"0.7246041",
"0.72017705",
"0.7191343",
"0.7191343",
"0.719... | 0.8816536 | 0 |
Check that the filename given in the request can be accessed by the user. | def check_pdf_accessibility(self):
if not 'pdf_name' in self.request.form:
# Should not happen.
self.errors.append('file_not_specified')
return
filename = self.request.form['pdf_name']
prefix = self.generate_filename_prefix()
if not filename.startswit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_manage(self, filename):\n return False",
"def _is_file(value: str) -> bool:\n file_in = os.path.expanduser(value)\n return os.path.isfile(file_in) and os.access(file_in, os.R_OK)",
"def allowed_file(filename):\n return '.' in filename and filename.rsplit('.', 1)[1] in app.config['ALLOWED_... | [
"0.6892758",
"0.6466298",
"0.6337543",
"0.63061893",
"0.62859195",
"0.62746865",
"0.62479365",
"0.6225352",
"0.6225166",
"0.62169814",
"0.6212721",
"0.6203378",
"0.61763483",
"0.6169834",
"0.6159644",
"0.61447984",
"0.6123333",
"0.61109895",
"0.6104643",
"0.60899186",
"0.6060... | 0.65723616 | 1 |
Return the logging level from the config | def get_logging_level():
try:
level = rcp.get("logging","level").upper()
return convert_logging_level(level)
except:
logging.warning("[logging] section of the config malformed.")
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_logging_level(self):\n return self.logging_level",
"def log_level(self) -> str:\n return pulumi.get(self, \"log_level\")",
"def get_module_log_level(name):\n try:\n log_level = Config.get('logs', 'level.{}'.format(name))\n except configparser.NoSectionError:\n # if the... | [
"0.7806044",
"0.77202046",
"0.76625264",
"0.75131935",
"0.7480852",
"0.74385816",
"0.7420677",
"0.72653157",
"0.71835965",
"0.7169424",
"0.71563476",
"0.71133",
"0.70998436",
"0.70287544",
"0.7022276",
"0.69687706",
"0.680321",
"0.67957276",
"0.6791889",
"0.67572546",
"0.6754... | 0.79857594 | 0 |
Initialize customized collater for PyTorch DataLoader. | def __init__(self,
batch_max_steps=20480,
out_dim=1,
hop_size=256,
aux_context_window=2,
use_noise_input=False,
use_f0=False,
use_chroma=False
):
if batch_max_steps % hop_size ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n super(AudioDataLoader, self).__init__(*args, **kwargs)\n self.collate_fn = _collate_fn",
"def collater(self, samples):\r\n raise NotImplementedError",
"def view(\n self,\n collate_fn: Union[callable, str] = \"batch_of_g_and_y\",\n ... | [
"0.6804272",
"0.66190547",
"0.6598865",
"0.6449612",
"0.61927533",
"0.60146725",
"0.58487827",
"0.5788716",
"0.5761844",
"0.5754699",
"0.5736155",
"0.57300377",
"0.57117707",
"0.56966656",
"0.5690784",
"0.56643194",
"0.5622481",
"0.56123805",
"0.5607976",
"0.5525408",
"0.5514... | 0.0 | -1 |
Initialize customized collater for PyTorch DataLoader. | def __init__(self,
batch_max_steps=20480,
out_dim=1,
hop_size=256,
aux_context_window=2,
use_noise_input=False,
use_f0=False,
use_chroma=False
):
if batch_max_steps % hop_size ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n super(AudioDataLoader, self).__init__(*args, **kwargs)\n self.collate_fn = _collate_fn",
"def collater(self, samples):\r\n raise NotImplementedError",
"def view(\n self,\n collate_fn: Union[callable, str] = \"batch_of_g_and_y\",\n ... | [
"0.6804272",
"0.66190547",
"0.6598865",
"0.6449612",
"0.61927533",
"0.60146725",
"0.58487827",
"0.5788716",
"0.5761844",
"0.5754699",
"0.5736155",
"0.57300377",
"0.57117707",
"0.56966656",
"0.5690784",
"0.56643194",
"0.5622481",
"0.56123805",
"0.5607976",
"0.5525408",
"0.5514... | 0.0 | -1 |
Get the current player. | def turn(self):
return self._turn | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_player(self) :\n return self.current_player",
"def get_current_player(self):\n return self.current_player",
"def get_current_player(self):\n\n # Return the current player\n return self._current_player",
"def getCurrentPlayer(self):\r\n return self.currentPla... | [
"0.9140813",
"0.91059935",
"0.9081512",
"0.90577304",
"0.90299124",
"0.8836855",
"0.8741567",
"0.8701439",
"0.8701439",
"0.86955357",
"0.86725014",
"0.8656731",
"0.8586361",
"0.8550054",
"0.8250051",
"0.8232484",
"0.812834",
"0.7939426",
"0.7906533",
"0.7892074",
"0.7610969",... | 0.0 | -1 |
Get the valid actions for the current player. | def options(self):
if self._state == GameState.PLAY_OR_DRAW:
return [NopAction(), DrawAction()] + self._play_options()
elif self._state == GameState.PLAY:
return [NopAction()] + self._play_options()
elif self._state == GameState.PLAY_DRAWN:
res = [NopAction()]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_legal_actions(self):\n return self.game.get_legal_actions()",
"def all_actions(self, player):\n return [m for m in MOVES if m.norm() == 1]",
"def valid_actions(self) -> List[str]:\n return list(self.action_map().keys())",
"def legal_actions(self):\n\n if self.player == TE... | [
"0.7698183",
"0.7369443",
"0.73172694",
"0.72736067",
"0.7273271",
"0.7182354",
"0.69626474",
"0.69124615",
"0.68962735",
"0.688576",
"0.6878289",
"0.6873924",
"0.67958814",
"0.6751898",
"0.6748659",
"0.6728603",
"0.6649211",
"0.6624239",
"0.66022456",
"0.65996534",
"0.659965... | 0.5854239 | 85 |
This function checks to see if the zip code string is valid by seeing if it has at least 5 digits. If any of the characters are not numbers, it will be classified as bad. | def CheckZipCode(zipcode):
# see if there are enough digits
if (len(zipcode) >= 5):
# check if numerical
try:
int(zipcode)
return True
except:
return False
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_zipcode(line):\n zipcode = line.o_zip_code\n invalid_zip = len(zipcode) not in [5, 9] and zipcode.isdigit()\n if invalid_zip:\n rule = 'Zipcode length'\n new_row = Error(e_name=rule, order_key=line.primary_key)\n line.errors.append(new_row)\n return False\n return ... | [
"0.74941456",
"0.70066833",
"0.6883973",
"0.6880193",
"0.6817789",
"0.6730279",
"0.6673749",
"0.6639829",
"0.64391536",
"0.6405675",
"0.6404798",
"0.6402405",
"0.63738847",
"0.63609207",
"0.621709",
"0.61623204",
"0.60969347",
"0.60953027",
"0.60707206",
"0.60619885",
"0.6022... | 0.84120035 | 0 |
converts single dict to YAML, and iterable of dicts to YAML stream | def toYAML(cls, obj):
if isinstance(obj, dict):
return yaml.dump(obj, default_flow_style=False)
else:
return yaml.dump_all(obj, default_flow_style=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform_snapcraft_yaml(snapcraft_yaml):\n for key in snapcraft_yaml:\n stream = StringIO()\n data = {}\n data[key] = snapcraft_yaml[key]\n helpers.dump_yaml(data, stream, typ=\"rt\")\n stream = stream.getvalue()\n\n # Assuming content starts with yaml key name, wr... | [
"0.6725231",
"0.66849774",
"0.65306723",
"0.6498946",
"0.63987565",
"0.62410545",
"0.62367934",
"0.6232669",
"0.6141377",
"0.6114527",
"0.6101865",
"0.6099311",
"0.609121",
"0.6087621",
"0.6074702",
"0.60311085",
"0.60041046",
"0.5974798",
"0.59002495",
"0.5862261",
"0.584754... | 0.67671245 | 0 |
Crop im patches in roi to roi_shape, for roi exceed the image border, the exceeded part will be padded with CONSTANT | def crop_image(im, roi, roi_shape):
roi = [int(v) for v in roi]
cut_roi = limit_roi(roi, im.shape[0], im.shape[1])
if len(im.shape) == 3:
im_roi = im[cut_roi[1]:cut_roi[3]+1, cut_roi[0]:cut_roi[2]+1, :]
else:
im_roi = im[cut_roi[1]:cut_roi[3]+1, cut_roi[0]:cut_roi[2]+1]
im_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cropCircleROI(image, additionalCut = 5):\n Rmin = np.min(image.shape[:-1])/3\n Rmin = 1250 / 3040 * image.shape[0]\n Rmax = 1400 / 3040 * image.shape[0]\n\n #downscale image for better performance\n reduceFactor = 5 # squared\n hough_radii = np.arange(Rmin/reduceFactor, Rmax/reduceFactor, dty... | [
"0.68385917",
"0.66451854",
"0.6622556",
"0.6521294",
"0.643662",
"0.6343203",
"0.63340867",
"0.6326632",
"0.6288151",
"0.624164",
"0.6209751",
"0.6176221",
"0.6164662",
"0.6159501",
"0.61467105",
"0.612943",
"0.61096877",
"0.6103646",
"0.60849315",
"0.60848236",
"0.6033581",... | 0.73100436 | 0 |
Open the folder where the user can find the index.html | def BtnOpenOverlayFolder():
location = os.path.join(os.path.dirname(__file__), "Overlay")
os.startfile(location)
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n path = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__))))\n return flask.send_from_directory(path, 'index.html')",
"def open_manual() -> None:\n\n path = os.path.abspath(\n os.path.join(\"docs\", \"_build\", \"html\", \"index.html\"))\n webbrowser.open(\"... | [
"0.719159",
"0.709692",
"0.70734644",
"0.70467585",
"0.6931037",
"0.68601835",
"0.6748647",
"0.6679702",
"0.66267544",
"0.65869564",
"0.65509415",
"0.65325326",
"0.6487669",
"0.64654833",
"0.6386996",
"0.6386996",
"0.6382093",
"0.6362538",
"0.6344262",
"0.63437283",
"0.634191... | 0.0 | -1 |
Return the next incoming message, or None. | def get(self) -> Optional[Message]:
self._recv()
if not self.inq:
return None
return self.inq.popleft() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_message(self) -> Optional[MessageQueueItem]:\n if self._message_queue:\n return self._message_queue[0]\n return None",
"def next(self):\n return self.read_message()",
"def _next_message(self):\n msg = yield self._read_message()\n message = self._slack_to_c... | [
"0.76224434",
"0.7564444",
"0.73862785",
"0.73065007",
"0.7271155",
"0.6760277",
"0.6714227",
"0.6644705",
"0.6556972",
"0.65248907",
"0.65015286",
"0.64481586",
"0.64481586",
"0.6423073",
"0.64031965",
"0.6354807",
"0.6292259",
"0.62855977",
"0.62801737",
"0.6219951",
"0.621... | 0.6633631 | 8 |
Returns a list with tangents. | def tangents(amount, start, stop, truncated, sequence):
for x in range(start, amount):
y = abs(round(stop * math.tan(x)))
if truncated and y >= stop:
sequence.append(stop)
elif y < start:
sequence.append(start)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sort_tans(self):\n tan = []\n for layer in self.structure:\n tan.append(layer.losstangent)\n tan = np.asarray(tan)\n return tan",
"def tones(self) -> List[JustInterval]:\n tones = []\n self.lattice.to_node(self._root)\n root_tone = self.lattice.ton... | [
"0.63627243",
"0.6088749",
"0.6019941",
"0.60162455",
"0.5794604",
"0.57543457",
"0.5738281",
"0.5691239",
"0.5656807",
"0.56420535",
"0.5641739",
"0.5607816",
"0.56041116",
"0.559891",
"0.55412775",
"0.55209935",
"0.5512424",
"0.5488213",
"0.5480994",
"0.54768986",
"0.546889... | 0.6897741 | 0 |
Method to price the title whose price is greater than 10 | def print_test2(limit): # can use paramaters
for item in data:
if(item["price"] > limit):
print(f"{item['title']} - ${item['price']}") #can be double or single quote marks | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_chepest_price_from_title():\n movie_title = request.args.get('title', type=str)\n\n price = MovieComparer().get_cheapest_price(movie_title)\n\n if price is None:\n return json.dumps({\"Message\": \"Movie: {} not found in Database\".format(movie_title)})\n\n return json.dumps({\"Cheapest ... | [
"0.6196011",
"0.57131463",
"0.5539565",
"0.5521254",
"0.5416705",
"0.5416705",
"0.54031914",
"0.5355749",
"0.5255636",
"0.5178842",
"0.51746535",
"0.51074684",
"0.50964427",
"0.5087415",
"0.50726736",
"0.5067845",
"0.5049526",
"0.5046129",
"0.50360125",
"0.50360125",
"0.50159... | 0.62904495 | 0 |
Get all data out of a given window and specified datatype as one concatenated numpy array | def get_data(windows, datatype='eeg', trials_from=1, trials_to='end', normalize_per_trial=True, sparse=1):
print('Assembling %s-data...' % datatype)
data = None
trials = None
led = None
data_length = 0
for trial, win in enumerate(windows):
if((trial+1 >= trials_from) and ((trials_to ==... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_window(ds, window):\n\n img = ds.read(window=window)\n img = np.nan_to_num(img)\n return np.dstack(img)",
"def window_data(X, window_length):\n return X[int(len(X)/2-window_length/2):int(len(X)/2+window_length/2)]",
"def extract_window_data(df, window_len=30, zero_base=True):\n window_d... | [
"0.64554316",
"0.63469887",
"0.6268066",
"0.61989725",
"0.6115951",
"0.60341376",
"0.6033179",
"0.58277965",
"0.58127755",
"0.58004457",
"0.5738708",
"0.5728878",
"0.57101095",
"0.568578",
"0.56524074",
"0.5640277",
"0.55730796",
"0.55456245",
"0.55336714",
"0.54446507",
"0.5... | 0.6122942 | 4 |
Return a random item from objects, with the weighting defined by weights (which must sum to 1). | def weightedChoice(weights, objects, apply_softmax=False, alpha=None):
if apply_softmax: weights = softmax(weights)
if alpha: weights = normalize([w**alpha for w in weights])
cs = np.cumsum(weights) #An array of the weights, cumulatively summed.
idx = sum(cs < np.random.rand()) #Find the index of the fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weighted_random_item(items, weight):\n if not items:\n return None\n\n weight_sum = sum(weight(item) for item in items)\n if weight_sum <= 0:\n return None\n\n choice = random.random() * weight_sum\n for item in items:\n choice -= weight(item)\n if choice < 0:\n ... | [
"0.8232875",
"0.8023901",
"0.7976897",
"0.7829642",
"0.74939483",
"0.73604226",
"0.72422147",
"0.72010034",
"0.70591706",
"0.7030185",
"0.69868577",
"0.694016",
"0.6894556",
"0.68806297",
"0.67831165",
"0.6754186",
"0.671347",
"0.661183",
"0.65937495",
"0.65907925",
"0.657915... | 0.79973876 | 2 |
Branch (add value to PC) iff reg.V is 0 Value in this case should be an actual signed Python integer! ("relative" addressing) | def BVC(self, value):
if not self.reg.V:
self.reg.PC += value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jmp_to_val_plus_v0(self):\n addr = self.opcode & 0xFFF\n self.pc = addr + self.registers[0]\n logger.info(\"Jumped to {} + V0 = {}\".format(\n hex(addr),\n hex(self.pc)))",
"def BVS(self, value):\n if self.reg.V:\n self.reg.PC += value",
"def bvc... | [
"0.695059",
"0.66901183",
"0.64954895",
"0.63175493",
"0.59379774",
"0.58913374",
"0.57707363",
"0.5744501",
"0.5618458",
"0.56126374",
"0.55065113",
"0.5506359",
"0.5483078",
"0.5482279",
"0.5463976",
"0.5438677",
"0.5381537",
"0.5365968",
"0.5348135",
"0.5345493",
"0.533532... | 0.6949504 | 1 |
Subtract value from A with borrow. There is no "subtract without carry" instruction. The result depends on the C flag, so when performing single precision math, or just before the first operation of multi precision math, the C flag must be set with SEC before this operation. The D flag changes the behavior of this oper... | def SBC(self, value):
if self.reg.D:
result = bcd(self.reg.A) - bdc(value) - 1 if not self.reg.C else 0
self.reg.V = result > 99 or result < 0
else:
result = self.reg.A - value - 1 if not self.reg.C else 0
self.reg.V = result > 127 or result < 128
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subtract(self):\n return self._do_calc(self.subtracter)",
"def subtract(self):\n return self._do_calc(self.subtracter)",
"def subtract(self):\n return self._do_calc(self.subtracter)",
"def subtract(self, value):\n return self.number - value",
"def subtract(lhs, rhs):\n ... | [
"0.6452207",
"0.6452207",
"0.6452207",
"0.62459534",
"0.6044543",
"0.5926639",
"0.5926639",
"0.5880037",
"0.5836115",
"0.583594",
"0.5803806",
"0.57861006",
"0.5756675",
"0.56939757",
"0.5678376",
"0.5666259",
"0.56644523",
"0.56499827",
"0.5639662",
"0.5623465",
"0.55997086"... | 0.0 | -1 |
Initializes a new environment from a Markov Decision Process. Here, the environment is simply a wrapper around the MDP, to avoid modelfree agents from accessing the mdp. | def __init__(self,mdp):
self._mdp = mdp
self._prev_state = None # What was the previous state?
self._cur_state = None # What was is the current state?
self.reset() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, mdp: MDP, gamma: float):\n self.mdp: MDP = mdp\n self.gamma: float = gamma\n\n self.action_dim: int = len(self.mdp.actions)\n self.state_dim: int = len(self.mdp.states)",
"def __init__(self, num_states, observation_states, prior_probabilities,\n transition_ma... | [
"0.63633066",
"0.5757695",
"0.5756405",
"0.57562727",
"0.56806624",
"0.5668479",
"0.5593309",
"0.5574381",
"0.55500495",
"0.55363524",
"0.5524511",
"0.5509023",
"0.55053985",
"0.5485119",
"0.5463489",
"0.54363626",
"0.5436168",
"0.5435984",
"0.5420028",
"0.54045576",
"0.53939... | 0.5553192 | 8 |
Gets the id of this BundleData. | def id(self):
return self._id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id(self):\n return self.data.id",
"def id(self):\n return self.get_data(\"id\")",
"def id(self):\n return self.cached_data[\"id\"]",
"def id(self):\n return self.data[\"id\"]",
"def getId(self):\n\n return self.__id",
"def getId(self):\n return self.identifie... | [
"0.7993542",
"0.78020614",
"0.7697586",
"0.7644942",
"0.7557508",
"0.754782",
"0.753856",
"0.75210863",
"0.75117254",
"0.75117254",
"0.75117254",
"0.75117254",
"0.75117254",
"0.75117254",
"0.75058424",
"0.74651766",
"0.74651766",
"0.7458155",
"0.7399949",
"0.7399949",
"0.7373... | 0.0 | -1 |
Sets the id of this BundleData. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id):\n self.data['id'] = id",
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id_):\n\n self.id_ = id_",
"def SetId(self, id):\n self.id = int(id)",
"def set_id(self, id):\n\n\t\tif id is not None and not isinstance(id, int):\n\t\t\traise SDKExceptio... | [
"0.80261594",
"0.76955223",
"0.7620066",
"0.7560615",
"0.7512953",
"0.73404366",
"0.7221408",
"0.7221408",
"0.7221408",
"0.7221408",
"0.7221408",
"0.7221408",
"0.7221408",
"0.7221408",
"0.7221408",
"0.7221408",
"0.72040695",
"0.72040695",
"0.72040695",
"0.72040695",
"0.720406... | 0.0 | -1 |
Gets the name of this BundleData. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._data.get('name')",
"def name(self):\n return self._data.get('name')",
"def name(self) -> str:\n return self.data['name']",
"def name(self):\r\n return self._data['name']",
"def get_name(self):\n return self._assets[0].get_name()",
"def nam... | [
"0.78380805",
"0.78380805",
"0.77565706",
"0.76592207",
"0.7658586",
"0.75244033",
"0.74948406",
"0.7459877",
"0.72983783",
"0.7269484",
"0.7269484",
"0.72646105",
"0.72646105",
"0.72646105",
"0.7263745",
"0.7263745",
"0.7260355",
"0.7260355",
"0.7260355",
"0.7260355",
"0.726... | 0.0 | -1 |
Sets the name of this BundleData. | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n # XXX: convert name to unicode, if it's a plain string?\n d = analyze_name(name, canonical=0)\n self.data.update(d)",
"def set_name(self, name):\n self.__name = name",
"def set_name(self, name):\n self.__name = name",
"def set_name(self, name):\n... | [
"0.7634631",
"0.75935215",
"0.75935215",
"0.75646794",
"0.7558559",
"0.7533571",
"0.7533571",
"0.7533571",
"0.7533571",
"0.7533571",
"0.7512393",
"0.7501782",
"0.74841654",
"0.7484142",
"0.74551815",
"0.7428904",
"0.7364356",
"0.7364356",
"0.7310273",
"0.729297",
"0.72824687"... | 0.0 | -1 |
Gets the fragment of this BundleData. | def fragment(self):
return self._fragment | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fragment(self):\n return self.fragment",
"def fragment(self, i):\n return self.__fragments[i]",
"def get_fragment2(self):\n return self.atom2.fragment",
"def get_fragment1(self):\n return self.atom1.fragment",
"def fragment(self):\n ret = libxml2mod.xmlURIGetFragm... | [
"0.8382749",
"0.7109965",
"0.70525736",
"0.70437914",
"0.69657123",
"0.6365712",
"0.6173683",
"0.6054858",
"0.60012895",
"0.5999351",
"0.5891066",
"0.58721024",
"0.5869638",
"0.5759417",
"0.5730933",
"0.5730933",
"0.5695475",
"0.56554663",
"0.5653807",
"0.5630593",
"0.561723"... | 0.8277337 | 2 |
Gets the state_raw of this BundleData. | def state_raw(self):
return self._state_raw | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_state(self):\n return self.state.read()",
"def get_raw_data(self):\n return self.__data",
"def get_state(self, flatten=True):\n if flatten:\n return self.data.flatten()\n return self.data",
"def raw_data(self):\n return self._raw_data",
"def raw_data(s... | [
"0.6994774",
"0.6834259",
"0.68261534",
"0.6793049",
"0.6793049",
"0.6771857",
"0.6771857",
"0.6767914",
"0.67132974",
"0.67132974",
"0.67132974",
"0.67063105",
"0.6705976",
"0.6693949",
"0.6693949",
"0.665564",
"0.665564",
"0.665564",
"0.665564",
"0.665564",
"0.6640231",
"... | 0.8296527 | 0 |
Gets the state of this BundleData. | def state(self):
return self._state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getState(self):\n return self._state",
"def getState(self):\n return self._state",
"def getState(self):\n return self.state",
"def getState(self):\n return self.state",
"def getState(self):\n return self.state",
"def getState(self) :\n return self.state",
"... | [
"0.7211643",
"0.7211643",
"0.71866286",
"0.71866286",
"0.71866286",
"0.71478736",
"0.71189123",
"0.7111284",
"0.7111284",
"0.7108327",
"0.70718616",
"0.7062254",
"0.70592684",
"0.70592684",
"0.70592684",
"0.70592684",
"0.70592684",
"0.70095944",
"0.7002295",
"0.70010406",
"0.... | 0.6889595 | 92 |
Gets the version of this BundleData. | def version(self):
return self._version | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version(self):\n self._get_latest_content()\n return self._data.get('version', None)",
"def get(self):\n return self._version",
"def get_version(self):\n return self.bot_data_file[\"version\"]",
"def get_version(self):\n return self.version",
"def get_version(self):\n... | [
"0.7986123",
"0.7842065",
"0.78287953",
"0.7810673",
"0.7808112",
"0.7808112",
"0.77169",
"0.7612671",
"0.7504083",
"0.74991596",
"0.74904627",
"0.744253",
"0.7440762",
"0.74134725",
"0.7407533",
"0.7395193",
"0.7395193",
"0.7385138",
"0.7369674",
"0.7328445",
"0.73139316",
... | 0.73966914 | 24 |
Gets the symbolic_name of this BundleData. | def symbolic_name(self):
return self._symbolic_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name(self):\n return self._assets[0].get_name()",
"def getName(self):\n return _libsbml.SBase_getName(self)",
"def getName(self):\n dataDict = self.__dict__\n result = self.varName\n if result is None:\n result = self.chemComp.name\n return result",
"def name(self) -> '... | [
"0.69435036",
"0.680412",
"0.680226",
"0.6674899",
"0.6644658",
"0.6644658",
"0.6644658",
"0.6628439",
"0.6628439",
"0.6628439",
"0.6628439",
"0.6628439",
"0.6628439",
"0.6628439",
"0.6628439",
"0.6628439",
"0.6628439",
"0.6617772",
"0.657846",
"0.6565835",
"0.6563871",
"0.... | 0.8044188 | 0 |
Sets the symbolic_name of this BundleData. | def symbolic_name(self, symbolic_name):
self._symbolic_name = symbolic_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n # XXX: convert name to unicode, if it's a plain string?\n d = analyze_name(name, canonical=0)\n self.data.update(d)",
"def symbolic_name(self):\n return self._symbolic_name",
"def name(self, name):\n self.__name = name",
"def name(self, name):\n ... | [
"0.64977175",
"0.62238514",
"0.62230414",
"0.62172896",
"0.62172896",
"0.62172896",
"0.62172896",
"0.62172896",
"0.62172896",
"0.62172896",
"0.62172896",
"0.62172896",
"0.62172896",
"0.62172896",
"0.62172896",
"0.6214377",
"0.6200131",
"0.6196828",
"0.6196828",
"0.6196828",
"... | 0.8104645 | 0 |
Sets the category of this BundleData. | def category(self, category):
self._category = category | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_category(self, category):\n\n\t\tif category is not None and not isinstance(category, str):\n\t\t\traise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: category EXPECTED TYPE: str', None, None)\n\t\t\n\t\tself.__category = category\n\t\tself.__key_modified['category'] = 1",
"def category(self, category: s... | [
"0.7663887",
"0.75193095",
"0.7253486",
"0.721092",
"0.6711975",
"0.66497165",
"0.65914714",
"0.6495867",
"0.6369205",
"0.6305242",
"0.6304786",
"0.61549175",
"0.6100933",
"0.60296327",
"0.5979948",
"0.5969043",
"0.596822",
"0.5872289",
"0.5727447",
"0.5719059",
"0.56897515",... | 0.749508 | 6 |
Deprecated. For large values of (ba), this algorithm does not produce integers uniformly at random. Generate random integers between a (inclusive) and b (exclusive). size controls the number of ints generated. If size=None, just one is produced. >>> r = SHA256(12345678901234567890) >>> r.randint_trunc(0, 5, size=3) arr... | def randint_trunc(self, a, b, size=None):
assert a <= b, "lower and upper limits are switched"
if size == None:
return a + (int_from_hash(self.nextRandom()) % (b-a))
else:
return np.reshape(np.array([a + (int_from_hash(self.nextRandom()) % (b-a)) \
for i ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def int_rand(a=0, b=0, size=None):\n \n return np.random.randint(a, b + 1, size)",
"def unique_sample_of_int(max,size):\n idxs=set()\n num_left = size - len(idxs)\n while num_left > 0:\n idxs = idxs.union(set(np.random.random_integers(0,max,size=num_left)))\n num_left = size - len(id... | [
"0.7028638",
"0.6232695",
"0.621887",
"0.6110286",
"0.60755926",
"0.6027315",
"0.60070103",
"0.59265006",
"0.58912647",
"0.5865617",
"0.5823179",
"0.5817858",
"0.5789675",
"0.57682735",
"0.5765373",
"0.5760699",
"0.57520103",
"0.5747073",
"0.57384336",
"0.5712901",
"0.5711520... | 0.7679753 | 0 |
Loads the experiment from the last checkpoint saved on disk. | def load(self):
checkpoint = torch.load(self.checkpoint_path,
map_location=self.device)
self.load_state_dict(checkpoint)
del checkpoint | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore(self, checkpoint_path):\n start_time = time.time()\n latest_checkpoint = train_util.get_latest_chekpoint(checkpoint_path)\n if latest_checkpoint is not None:\n checkpoint = tf.train.Checkpoint(model=self)\n checkpoint.restore(latest_checkpoint).expect_partial()\n logging.info('L... | [
"0.7074558",
"0.69380623",
"0.6897599",
"0.6731044",
"0.67247134",
"0.6719498",
"0.67053634",
"0.66839665",
"0.66660076",
"0.66653275",
"0.66326165",
"0.6632461",
"0.6618413",
"0.6605635",
"0.6596994",
"0.65559614",
"0.654627",
"0.654627",
"0.6541026",
"0.65285873",
"0.652751... | 0.65949893 | 15 |
Filters out the noningredient text from ingredient_list | def filter_non_ingredient(ingredient_list):
stop_words = set(stopwords.words('english'))
filtered_list = []
add_list = 0 #a dummy variable to add a text to filtered list
for phrases in set(ingredient_list): #run through only one item in set (removes duplicates)
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_ingredients(self):\n ingredients = self.cleaned_data['ingredients']\n if len(ingredients) < 1:\n v_err('no_ing')\n return ingredients",
"def format_ingredients(self, ingredients):\n\t\tto_replace = {'cointreau': 'triple sec', '&': 'and'}\n\t\tupdated_ingredients = []\n\t... | [
"0.6433739",
"0.6341366",
"0.6117501",
"0.6065277",
"0.6030242",
"0.6029495",
"0.59791374",
"0.5891693",
"0.58692497",
"0.58037376",
"0.57633567",
"0.5692679",
"0.56882447",
"0.56532246",
"0.56524545",
"0.56494087",
"0.5577311",
"0.557316",
"0.5557149",
"0.5539052",
"0.553758... | 0.82023585 | 0 |
Either get the nonempty string from the given arg or None if it is not a nonempty string. | def get_nonempty_str(arg: Any) -> Optional[str]:
if isinstance(arg, str):
if len(arg) > 0:
return str(arg)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_or_none(val):\n return str(val) if val is not None else None",
"def pr_str(inp_string):\n if inp_string is None:\n return ''\n else:\n return str(inp_string)",
"def _coerce_str_unless_none(value):\n return str(value) if value is not None else None",
"def s2s(s):\n if (s is None): ret... | [
"0.7335188",
"0.6678961",
"0.665863",
"0.66474926",
"0.6614511",
"0.65398073",
"0.65166414",
"0.65152097",
"0.6483067",
"0.6417797",
"0.6320014",
"0.6248574",
"0.6188248",
"0.6172345",
"0.61203074",
"0.60948366",
"0.6094116",
"0.60602725",
"0.60536414",
"0.60196376",
"0.60143... | 0.90577847 | 0 |
Return the mapping of valid actions > functions for each action of the commandline driver. | def action_map(self) -> Dict[str, CLIActionType]:
return add_dicts({
"dump": self.dump_action,
"dump-macrosizes": self.dump_macrosizes_action,
"dump_macrosizes": self.dump_macrosizes_action,
"synthesis": self.synthesis_action,
"syn": self.synthesis_act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_action_functions_map():\n actions = {\n 'interact': measure_interaction_effects,\n 'countdata': count_data_points,\n 'filter': filter_operation,\n 'explain': explain_operation,\n 'predict': predict_operation,\n 'self': self_operation,\n 'previousfilte... | [
"0.7790003",
"0.7093",
"0.70017946",
"0.68463665",
"0.6616161",
"0.65874755",
"0.6495295",
"0.64654446",
"0.6436248",
"0.64319164",
"0.6387486",
"0.6387062",
"0.63831264",
"0.63044566",
"0.62964267",
"0.62928563",
"0.62753963",
"0.6253231",
"0.6249312",
"0.6233403",
"0.623294... | 0.7570941 | 1 |
Get the action associated with hierarchical synthesis for the given module (in hierarchical flows). | def get_hierarchical_synthesis_action(self, module: str) -> CLIActionConfigType:
return self.hierarchical_synthesis_actions[module] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hierarchical_synthesis_par_action(self, module: str) -> CLIActionConfigType:\n return self.hierarchical_synthesis_par_actions[module]",
"def get_hierarchical_par_action(self, module: str) -> CLIActionConfigType:\n return self.hierarchical_par_actions[module]",
"def get_hierarchical_lvs_ac... | [
"0.7943216",
"0.69501436",
"0.69203",
"0.6841573",
"0.68044233",
"0.6352806",
"0.527317",
"0.5265334",
"0.5186572",
"0.51720726",
"0.5132428",
"0.5107374",
"0.5105747",
"0.5105747",
"0.50707525",
"0.50657314",
"0.50553584",
"0.50553584",
"0.50553584",
"0.50553584",
"0.5054452... | 0.839434 | 0 |
convert the str to idx | def convert_to_idx(lines):
for idx, l in enumerate(lines):
line_temp = []
for v in l:
try:
line_temp.append(vocab_idx[v])
except KeyError:
line_temp.append(vocab_idx['<unk>'])
lines[idx] = line_temp
return lines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word2idx(self, str):\n return self._tokens.get(str)",
"def string_to_index(s):\n s = Unquote(s)\n if s == \".\":\n return ()\n return tuple(s.split(\"/\"))",
"def get_index(s):\n return int(s[s.find(\"[\")+1:s.find(\"]\")])",
"def create_dict_str_... | [
"0.72031957",
"0.69162637",
"0.69039434",
"0.63824725",
"0.6349515",
"0.63313925",
"0.6326018",
"0.6311505",
"0.62847304",
"0.62830055",
"0.62416375",
"0.62346184",
"0.61912984",
"0.6161285",
"0.61554456",
"0.6149349",
"0.6138915",
"0.6112269",
"0.61050415",
"0.6065613",
"0.6... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.