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 |
|---|---|---|---|---|---|---|
Initialize a new `BaseLanePlotter` instance. | def __init__(self, vmin=0., vmax=1., cmap='viridis', norm=None):
# type: (float, float, str, Optional[colors.Normalize]) -> None
super(BaseLanePlotter, self).__init__()
self.n_vars = None
self.var_names = None
self.xs = None
self.ys = None
self.cs = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n super(vanderpol_output,self).__init__()\n\n # add figure object for further use\n fig = plt.figure()\n self.ax = fig.add_subplot(111)\n self.ax.set_xlim([-2.5,2.5])\n self.ax.set_ylim([-10.5,10.5])\n plt.ion()\n self.sframe = None",
"d... | [
"0.6286448",
"0.62294954",
"0.607236",
"0.6068059",
"0.6011955",
"0.59919643",
"0.5968347",
"0.59583604",
"0.5947224",
"0.59036577",
"0.58485496",
"0.5844103",
"0.5844103",
"0.58289087",
"0.5809677",
"0.58051646",
"0.57911026",
"0.57567734",
"0.57532144",
"0.57440764",
"0.572... | 0.725623 | 0 |
Initialize the figure, setting up axes, labels, the colorbar, etc. | def init_fig(self, fig):
# type: (Figure) -> None
self.init_vars()
self.xs, self.ys = np.meshgrid(np.arange(0., self.max_iter+.5)-.5, np.arange(0., self.n_vars+.5)-.5)
self.cs = np.zeros((self.n_vars, self.max_iter))
self.ax = fig.add_subplot(111)
self.ax.xaxis.set_majo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_plot(self):\n self.dpi = 100\n self.fig = Figure((5.0, 5.0), dpi = self.dpi)\n\n self.main_plot = self.fig.add_subplot(111)\n self.main_plot.set_axis_bgcolor('black')\n self.main_plot.set_title('Dynamic venous flow view', size = 12)\n\n pylab.setp(self.main_plot.g... | [
"0.75943357",
"0.7511165",
"0.7426772",
"0.72929573",
"0.72190505",
"0.71878165",
"0.71523213",
"0.7133514",
"0.7107856",
"0.70858306",
"0.70858306",
"0.7076263",
"0.69234425",
"0.68722236",
"0.6838714",
"0.6828186",
"0.68142134",
"0.67956245",
"0.6791702",
"0.6785772",
"0.66... | 0.68371314 | 15 |
Follow the ray through a scene. This the highest level raytracing function. It moves the ray through the scene and returns a list of rays a Monte Carlo decision events. Each decision is an interaction which alters one of the rays properties such as position, direction or wavelength. Raises TraceError If an error occurr... | def follow(ray: Ray, scene: Scene, max_iters=1000, renderer=None) -> [Tuple[Ray, Decision]]:
path = [(ray, Decision.EMIT)]
idx = 0
last_ray = ray
while ray.is_alive:
intersections = scene.intersections(ray.position, ray.direction)
points, nodes = zip(*[(x.point, x.hit) for x in intersect... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trace(self):\n\n \n assert self.scene != None, \"The photon's scene variable is not set.\"\n \n intersection_points, intersection_objects = self.scene.intersection(self.ray)\n\n \"\"\"\n #DIAGNOSTICS\n print \"\\nnew\\n\"\n print self.position, se... | [
"0.6096028",
"0.5720131",
"0.53395605",
"0.5280205",
"0.52341133",
"0.5229237",
"0.5210934",
"0.51344943",
"0.504689",
"0.49148622",
"0.48444077",
"0.48200026",
"0.4810558",
"0.4774753",
"0.4726236",
"0.47177863",
"0.47170755",
"0.46889123",
"0.46854603",
"0.46630841",
"0.466... | 0.6562233 | 0 |
Renders the home page. | def home():
return render_template(
'home.html',
title='Home Page',
year=datetime.now().year,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n\n return render_template('home_page.html')",
"def home():\n\n return render_template(\"home.html\")",
"def home():\n return render_template('home.html')",
"def home():\n return render_template('home.html')",
"def ... | [
"0.85574406",
"0.853399",
"0.8351404",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.827363",
"... | 0.82187074 | 23 |
Renders the about page. | def about():
return render_template(
'about.html',
title='About',
year=datetime.now().year,
message='Your application description page.'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85651284",
"0.85034347",
"0.844895",
"0.84050864",
"0.8394327",
"0.82936406",
"0.82678735",
"0.82434386",
"0.8239326",
"0.8224289",
"0.8208038",
"0.820477",
"0.81737614",
"0.81729555",
"0.8096616",
"0.8050326",
"0.8050326",
"0.8050326",
"0.8050326",
"0.8050326",
"0.8050326... | 0.827099 | 15 |
Takes a string representation of a date compatible with the database and returns a string representing it in a better format. | def formatTime(time):
return datetime.strptime(time, "%d/%m/%Y %H:%M:%S").strftime("%a, %d/%m/%Y %H:%M:%S") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reformat_date(mdy_date_string):\n date = mdy_date_string.split('/')\n return f\"{date[2]}-{date[0]}-{date[1]}\" # difficult to read",
"def transform_date(date):\n if type(date) == str:\n return date\n\n formatted_string = date.strftime(\"%d/%m/%Y\")\n\n return formatted_string",
"def ... | [
"0.69423914",
"0.68834925",
"0.68595445",
"0.6839644",
"0.68103737",
"0.67406017",
"0.67105925",
"0.67086565",
"0.66993916",
"0.669428",
"0.66933423",
"0.6690244",
"0.66560346",
"0.6641878",
"0.6640752",
"0.6618706",
"0.6609199",
"0.6604651",
"0.6604188",
"0.65968853",
"0.659... | 0.0 | -1 |
1.1 c) For a given set of actions map every action to its corresponding actionclass representation. Assume there are number_of_classes different classes, then every action is represented by a number_of_classesdim vector which has exactly one nonzero entry (onehot encoding). That index corresponds to the class number. | def actions_to_classes(self, actions):
# Figure out which representation means what? ex: [Steer, Gas, Brake] --> [1.,0.,0.8] --> Does what? Does it steer right while applying brake?
# Outerloop is actions
# Inner loop is this_class
# action == class returns a list of boolean values
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indices_to_one_hot(cls_indeces, nb_classes):\n targets = np.array(cls_indeces).reshape(-1)\n return np.eye(nb_classes)[targets]",
"def indices_to_one_hot(data, nb_classes):\n targets = np.array(data).reshape(-1)\n return np.eye(nb_classes)[targets]",
"def indices_to_one_hot(data, nb_classes):\n... | [
"0.7148872",
"0.70771503",
"0.70771503",
"0.70771503",
"0.70771503",
"0.7029489",
"0.7004081",
"0.7003882",
"0.69442666",
"0.688942",
"0.6880241",
"0.6868653",
"0.6807544",
"0.67937285",
"0.6779048",
"0.67430925",
"0.6716553",
"0.671614",
"0.67012924",
"0.66908157",
"0.669081... | 0.72311914 | 0 |
Returns the Django field type according to one db_code. | def get_field_type(db_code):
try:
field_type = connection.introspection.get_field_type(
db_code, 'django_musicbrainz tests')
except KeyError:
# if the db_code is not listed in
# django.db.backens.postgresql_psycopg2.introspection.\
# Databa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_type(self, field):\r\n if self.connection.settings_dict.get('STORE_RELATIONS_AS_DB_KEYS'):\r\n if field.primary_key or field.rel is not None:\r\n return 'key'\r\n\r\n # Primary keys were processed as db.Keys; for related fields\r\n # the db_type of primary key ... | [
"0.7646184",
"0.7156243",
"0.7134062",
"0.7047216",
"0.6942776",
"0.6633029",
"0.6565044",
"0.6511266",
"0.6343124",
"0.63209075",
"0.6287278",
"0.6273222",
"0.62550527",
"0.6239935",
"0.62092274",
"0.6208639",
"0.61778575",
"0.61667687",
"0.61664134",
"0.6150721",
"0.6126250... | 0.8338392 | 0 |
Returns a dictionnary presenting all the fk given a model. We return a dictionnary (wich keys are Foreignkey fields and values the related classes) of all foreign keys of the given model. We exclude the Link attribute here because it is specific to musicbrainz database. | def get_foreign_keys(self, model):
fks = {}
for field in model._meta.fields:
if field.get_internal_type() == 'ForeignKey':
related_class = field.foreign_related_fields[0].model
fks.update({
field: related_class
})
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def foreign_keys(self):\n ans = self.execute(self.commands.foreign_keys(self.db.name, self.name))\n return [ForeignKey(*tup) for tup in ans]",
"def _related_fields(self):\r\n model_class, m2m = self._get_model_class_from_table(self.model._meta.db_table) \r\n related_fields = {\r\n ... | [
"0.6706281",
"0.65210557",
"0.63893056",
"0.6351794",
"0.63229346",
"0.6299821",
"0.6169115",
"0.606853",
"0.6051908",
"0.5925734",
"0.5912857",
"0.58689386",
"0.58285373",
"0.5744976",
"0.57380694",
"0.56495386",
"0.5610692",
"0.5566528",
"0.54720426",
"0.5466197",
"0.544611... | 0.8276735 | 0 |
Returns True if the db table is filled. | def table_contains_elements(self, model):
if model.objects.count() > 1:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table_is_empty(self):\n check_query = QSqlQuery(self.reader_connection)\n query = f'SELECT * FROM {self.table_name}'\n check_query.exec(query)\n empty_table = check_query.first()\n check_query.finish()\n return not empty_table",
"def is_todo_table_empty(self):\n ... | [
"0.7989517",
"0.77740866",
"0.7401597",
"0.73780483",
"0.7313501",
"0.7149495",
"0.7124198",
"0.70741206",
"0.70411396",
"0.70403194",
"0.7038719",
"0.6972792",
"0.69166446",
"0.6834175",
"0.6828665",
"0.68257093",
"0.676939",
"0.67584777",
"0.6750119",
"0.6741276",
"0.670347... | 0.0 | -1 |
Returns the height of the image. | def height(self):
return self.__height | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getHeight(self):\n return self._image.height()",
"def height(self) -> int:\n return self._image_data.height",
"def getHeight(self):\n return _tkCall(self.image.height)",
"def get_height(self):\n height = np.size(self.img, 1)\n return height",
"def height(self):\n r... | [
"0.89506096",
"0.8874764",
"0.8610431",
"0.8515619",
"0.8030037",
"0.7947878",
"0.772436",
"0.7714758",
"0.77123135",
"0.77123135",
"0.76606",
"0.7656363",
"0.7645478",
"0.76288193",
"0.7618401",
"0.7608463",
"0.7584923",
"0.75764847",
"0.75716114",
"0.7570874",
"0.75584275",... | 0.74283624 | 46 |
Function for aggregation over a given axis with masking. If mask is not given, this reduces to regular tf.reduce_mean. If mask is given, it is assumed that the last dimension is the actual vector dimension. Mask is always expanded in the last dimension. | def masked_mean_aggregator(x, mask=None, axis=-2):
if mask is None:
return tf.reduce_mean(x, axis=axis)
return tf.math.divide_no_nan(
tf.reduce_sum(x * tf.expand_dims(mask, axis=-1), axis=axis),
tf.reduce_sum(mask, axis=axis + 1, keepdims=True)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mask_and_avg(values, padding_mask):\n\n dec_lens = tf.reduce_sum(padding_mask, axis=1) # shape batch_size. float32\n values_per_step = [v * padding_mask[:,dec_step] for dec_step,v in enumerate(values)]\n values_per_ex = sum(values_per_step)/dec_lens # shape (batch_size); normalized value for each batch mem... | [
"0.66798264",
"0.61095035",
"0.60616475",
"0.59319",
"0.5856177",
"0.58532727",
"0.58380735",
"0.5824873",
"0.57991207",
"0.5764003",
"0.57506496",
"0.57493556",
"0.57463497",
"0.5740388",
"0.57099557",
"0.56825525",
"0.56018543",
"0.56003636",
"0.55803686",
"0.5565008",
"0.5... | 0.85491186 | 0 |
Takes in a target sprite and uses that sprite as the center point for offsetting the rest of the sprites | def update(self, target):
self.state = self.camera_func(self.state, target.rect) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rot_center(self):\n loc = self.rect.center\n self.image = pygame.transform.rotate(self.current_sprite_alpha, self.rot)\n self.rect = self.image.get_rect()\n self.rect.center = loc",
"def follow_player(self, player_sprites):\n self.player_sprite = player_sprites['player'][0]... | [
"0.66826797",
"0.61527306",
"0.6144488",
"0.6129389",
"0.6125854",
"0.61147213",
"0.6084067",
"0.6084067",
"0.60491353",
"0.60326695",
"0.6012217",
"0.598216",
"0.5955773",
"0.593776",
"0.59333295",
"0.5928312",
"0.59150267",
"0.59150267",
"0.59150267",
"0.59093493",
"0.58938... | 0.0 | -1 |
Generates a monster sprite | def __init__(self, i, j, monsterObj):
pygame.sprite.Sprite.__init__(self)
#self.image = pygame.Surface([30,30])
self.image = pygame.image.load('mob.png').convert_alpha()
#self.image.fill(self.monsterColor)
self.pos = (i*30,j*30,)
self.rect = self.image.get_rect()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monster(x, y, i):\n screen.blit(monsterImg[i], (x, y))",
"def create_monsters(cls, character):\n numbers = randint(1, 3)",
"def generate_sprite():\n combinations = request.get_json() # Retrieves combinations from sliders.\n\n # Attach pose encodings to the combinations that were selected.\n... | [
"0.7201535",
"0.67219",
"0.6643753",
"0.6526032",
"0.638599",
"0.6376612",
"0.6358753",
"0.6304838",
"0.62719095",
"0.6153691",
"0.60829616",
"0.6057755",
"0.6009992",
"0.60093987",
"0.60040444",
"0.59827334",
"0.59744436",
"0.59046626",
"0.59046394",
"0.5895289",
"0.5895193"... | 0.65510964 | 3 |
Updates the position of the monster sprite | def update (self, pos):
self.rect.topleft = (pos) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_sprite(self, new_pos):\n self.rect.x = new_pos[1] * SPRITE_SIZE\n self.rect.y = new_pos[0] * SPRITE_SIZE",
"def move(self):\n assert self.is_alive, \"Sprite is dead, and should not be able to move\"\n if self.health > 3:\n self.y += random.randint(-1, 1) # change ... | [
"0.7158826",
"0.6939801",
"0.6890657",
"0.6862032",
"0.6791884",
"0.6775478",
"0.6716076",
"0.6701772",
"0.6698885",
"0.6688597",
"0.6664618",
"0.66172695",
"0.66150993",
"0.66045564",
"0.66032183",
"0.65995747",
"0.65701616",
"0.6569943",
"0.6532555",
"0.651882",
"0.65142447... | 0.6222876 | 58 |
Updates the position of the dagger sprite | def update(self, pos):
self.rect.topleft = (pos) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_sprite(self, new_pos):\n self.rect.x = new_pos[1] * SPRITE_SIZE\n self.rect.y = new_pos[0] * SPRITE_SIZE",
"def update(self):\r\n # updates the float position number of the bullet\r\n self.y -= self.settings.bullet_speed\r\n # updates the position of the rectangle\r\n ... | [
"0.70255613",
"0.6997788",
"0.6976096",
"0.69332737",
"0.68608904",
"0.6810903",
"0.6807336",
"0.6767474",
"0.6750019",
"0.6748812",
"0.6734572",
"0.6725053",
"0.6693116",
"0.66631544",
"0.66401356",
"0.663863",
"0.66374594",
"0.6610101",
"0.6608846",
"0.6608717",
"0.6592875"... | 0.6306142 | 48 |
Makes sure line edit input is an email address | def check_le_state(self, *args, **kwargs):
sender = self.sender()
validator = sender.validator()
state = validator.validate(sender.text(), 0)[0]
if state == QtGui.QValidator.Acceptable:
self.btn_next.setEnabled(True)
elif state == QtGui.QValidator.Intermediate:
self.btn_next.setEnabled(False)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter_email(self, email):\n self.selib.input_text(self.locator.email, email)",
"def validate_email(self):\n email = input(\"Email: \").strip()\n if email is None or email == \"\":\n print(self.INVALID_INPUT)\n self.display_cust_unlock()\n else:\n r... | [
"0.7289475",
"0.7058663",
"0.69433063",
"0.6903912",
"0.6848374",
"0.6846386",
"0.67948705",
"0.67809004",
"0.6696055",
"0.6694962",
"0.6678921",
"0.6678921",
"0.667121",
"0.6644674",
"0.66416204",
"0.6630371",
"0.6609187",
"0.66055584",
"0.657329",
"0.6537217",
"0.6515402",
... | 0.0 | -1 |
Parse an ImageNet record from `value`. | def parse_record(raw_record, is_training):
keys_to_features = {
'image/encoded':
tf.FixedLenFeature((), tf.string, default_value=''),
'image/format':
tf.FixedLenFeature((), tf.string, default_value='jpeg'),
'image/class/label':
tf.FixedLenFeature([], dtype... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_record(record, training):\r\n # Reshape from [depth * height * width] to [depth, height, width].\r\n depth_major = record.reshape((3, 32, 32))\r\n\r\n # Convert from [depth, height, width] to [height, width, depth]\r\n image = np.transpose(depth_major, [1, 2, 0])\r\n\r\n image = preprocess... | [
"0.64319015",
"0.6157251",
"0.6101005",
"0.6046558",
"0.6025733",
"0.6022002",
"0.59880024",
"0.5860179",
"0.5717987",
"0.5681111",
"0.5634661",
"0.5552306",
"0.55285656",
"0.55222565",
"0.5494805",
"0.54907966",
"0.5465754",
"0.53897536",
"0.53897536",
"0.53804564",
"0.53686... | 0.61877835 | 1 |
Initialize bias variables of a specific shape using a constant | def bias_variable(self, shape):
bias_var = tf.constant(0.1, shape=shape)
return(tf.Variable(bias_var)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bias_variable(shape):\n initial = tf.zeros(shape)\n return tf.Variable(initial)",
"def init_bias(b_shape, layer_index, bias_initializer):\n\n return tf.Variable(tf.constant(bias_initializer, shape=b_shape, name=\"bias{}\".format(layer_index)))",
"def bias_variable(shape):\n\n initial = tf.constant(0.... | [
"0.78289545",
"0.77637416",
"0.77108777",
"0.76951355",
"0.76951355",
"0.76951355",
"0.7671462",
"0.7671462",
"0.7671462",
"0.7671462",
"0.7671462",
"0.7671462",
"0.7671462",
"0.7671462",
"0.7671462",
"0.7671462",
"0.7583781",
"0.75617814",
"0.7557539",
"0.75549406",
"0.75378... | 0.71301633 | 32 |
Return the value of the tf variable named [var_name] if it exists, None otherwise | def get_value(self, var_name, tf_session):
if var_name in self.learning_parameters:
value = tf_session.run(self.learning_parameters[var_name])
elif var_name in self.layers:
value = tf_session.run(self.layers[var_name])
else:
print("Unknown DQN variable: "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_existing_variable(name):\n try:\n op = tf.get_default_graph().get_operation_by_name(name)\n except KeyError:\n return None\n\n # Among all cases (partitioned variable, resource variable, or regular one),\n # we assume that there's either a shape attribute to the op or to its output.\n try:\n ... | [
"0.7715287",
"0.75126535",
"0.74355227",
"0.74193746",
"0.69708085",
"0.6933095",
"0.68128526",
"0.6783163",
"0.67298526",
"0.66808903",
"0.6652503",
"0.6560626",
"0.6557995",
"0.65430015",
"0.6540453",
"0.65257984",
"0.6515488",
"0.6497716",
"0.64893275",
"0.64797187",
"0.64... | 0.69645065 | 5 |
Get the full filename for saving | def get_savename(outdir, plot_name, extension):
save_name = '.'.join([plot_name, extension])
save_name = '/'.join([outdir, save_name])
return save_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_full_path(self):\n return self.save_dir + os.sep + self.save_file_without_ext + self.save_file_ext",
"def _getSavePath(self):\n path, filename = os.path.split(self.path)\n savePath = os.path.join(path, os.path.splitext(filename)[0])\n return savePath",
"def filename(sel... | [
"0.79725504",
"0.7824443",
"0.77689654",
"0.7747547",
"0.77316093",
"0.76885384",
"0.7640925",
"0.7538406",
"0.753084",
"0.7524455",
"0.74916315",
"0.7485806",
"0.74562746",
"0.7452422",
"0.7436175",
"0.7431548",
"0.74297124",
"0.7412633",
"0.7378294",
"0.73579824",
"0.733451... | 0.7154053 | 33 |
Gets data object binding for XSD element, creating a new one if it doesn't exist. | def get_binding(self, *bases, replace_existing=False, **attrs):
if self.binding is None or replace_existing:
if not bases:
bases = (dataobjects.DataElement,)
attrs['xsd_element'] = self
class_name = '{}Binding'.format(self.local_name.title().replace('_', ''))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_binding_record(self):\n binding = self.binder.get_bindings(domain=[('id', '=', self.binding_id)])\n assert len(binding) <= 1, \"More than one binding record returned!\"\n if binding:\n assert binding.id == self.binding_id, \"Id of returned binding does not match self.bindin... | [
"0.58074105",
"0.5553996",
"0.51235455",
"0.5003926",
"0.49915308",
"0.4991172",
"0.49894753",
"0.4913071",
"0.48344436",
"0.48135903",
"0.47758353",
"0.47752652",
"0.47669658",
"0.4742835",
"0.47280192",
"0.46583763",
"0.46161988",
"0.46073112",
"0.45859587",
"0.45729214",
"... | 0.71188736 | 0 |
Gets the calories of this RecipeObjectNutrients. | def calories(self) -> List[RecipeObjectNutrientsCalories]:
return self._calories | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fat(self) -> List[RecipeObjectNutrientsCalories]:\n return self._fat",
"def daily_values(self) -> List[RecipeObjectNutrientsCalories]:\n return self._daily_values",
"def carbs(self) -> List[RecipeObjectNutrientsCalories]:\n return self._carbs",
"def calories(self, calories: List[Reci... | [
"0.72750074",
"0.70530975",
"0.6611966",
"0.6518048",
"0.6454777",
"0.6131532",
"0.5854304",
"0.5485858",
"0.5478278",
"0.547796",
"0.537675",
"0.53610563",
"0.53304446",
"0.53304446",
"0.5317418",
"0.53039867",
"0.5297933",
"0.52955186",
"0.52600896",
"0.52417797",
"0.522668... | 0.87976277 | 0 |
Gets the daily_values of this RecipeObjectNutrients. | def daily_values(self) -> List[RecipeObjectNutrientsCalories]:
return self._daily_values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def daily_values(self, daily_values: List[RecipeObjectNutrientsCalories]):\n\n self._daily_values = daily_values",
"def daily(self):\n return c.Daily(self)",
"def get_values(self, dates):\n ret = []\n for d in dates:\n ret.append(self.data[d])\n return ret",
"def... | [
"0.72305614",
"0.65636015",
"0.65295464",
"0.64923424",
"0.64029515",
"0.6391832",
"0.63654166",
"0.6297575",
"0.6297493",
"0.61941934",
"0.6169327",
"0.61227626",
"0.60183954",
"0.59031934",
"0.5860954",
"0.5802884",
"0.5787879",
"0.57442445",
"0.5687329",
"0.5687329",
"0.56... | 0.89081395 | 0 |
Sets the vitamins of this RecipeObjectNutrients. | def vitamins(self, vitamins: List[RecipeObjectNutrientsCalories]):
self._vitamins = vitamins | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vitamins(self) -> List[RecipeObjectNutrientsCalories]:\n return self._vitamins",
"def nutrients(self, nutrients: List[IngredientObjectNutrients]):\n\n self._nutrients = nutrients",
"def set_ingredients(self, ingredients: [Ingredient]):\n self.ingredients = ingredients",
"def set_inve... | [
"0.64716953",
"0.6081736",
"0.5574348",
"0.53061026",
"0.518112",
"0.5173321",
"0.5160341",
"0.51164126",
"0.49716756",
"0.49086627",
"0.4848157",
"0.4844874",
"0.48358837",
"0.48286957",
"0.48282793",
"0.48134834",
"0.47993714",
"0.4771006",
"0.47662553",
"0.4758868",
"0.475... | 0.8330108 | 0 |
Gets next available data (blocks until new datum is received) | def get(self, _type, symbol):
assert _type in self.types, "Unknown type '%s'" % _type
assert symbol in self.symbols, "Unknown symbol '%s'" % symbol
while True:
try:
return self._get_nowait(_type, symbol)
except Empty:
time.sleep(1e-6) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_data(self):\n while True:\n # self.logger.debug(\"data queue size is: {}\".format(len(self._dataqueue)))\n ans = self._parser.find_first_packet(self._dataqueue[:])\n if ans:\n self._dataqueue = ans[1]\n # self.logger.debug(\"found packe... | [
"0.72683173",
"0.71582067",
"0.6525473",
"0.65112025",
"0.648641",
"0.6431125",
"0.6395619",
"0.6376792",
"0.6356209",
"0.63528657",
"0.63524115",
"0.6345988",
"0.62975043",
"0.6263362",
"0.62547386",
"0.62542653",
"0.62379247",
"0.62351114",
"0.6231469",
"0.61916023",
"0.618... | 0.0 | -1 |
Gets the sortby of this ListIncidentTypesRequest. sort by property, create_time. | def sortby(self):
return self._sortby | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sort_by(self):\n\n\t\treturn self.__sort_by",
"def get_sort_by(self) -> SortField:\n if hasattr(self, \"json\") and isinstance(self.json, dict):\n sort_by_str = self.json.get(\"sort_by\", \"relevance\")\n if SortField.is_sort_field(sort_by_str):\n return SortFi... | [
"0.60053205",
"0.5642393",
"0.5297866",
"0.51642686",
"0.5159831",
"0.51405084",
"0.51402473",
"0.5120792",
"0.49116194",
"0.48725325",
"0.48479894",
"0.4805215",
"0.4805215",
"0.4805215",
"0.4805215",
"0.4805215",
"0.4805215",
"0.48035392",
"0.47970736",
"0.47963285",
"0.477... | 0.59303665 | 1 |
Sets the sortby of this ListIncidentTypesRequest. sort by property, create_time. | def sortby(self, sortby):
self._sortby = sortby | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_sort_by(self, sort_by):\n\n\t\tif sort_by is not None and not isinstance(sort_by, str):\n\t\t\traise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: sort_by EXPECTED TYPE: str', None, None)\n\t\t\n\t\tself.__sort_by = sort_by\n\t\tself.__key_modified['sort_by'] = 1",
"def sortby(self):\n return self... | [
"0.6257638",
"0.54993236",
"0.5464183",
"0.54627854",
"0.52495563",
"0.50132823",
"0.49685574",
"0.49542192",
"0.484542",
"0.48365948",
"0.481828",
"0.476103",
"0.4724908",
"0.46929002",
"0.46754602",
"0.46674332",
"0.4666127",
"0.46658027",
"0.46524018",
"0.4646715",
"0.4642... | 0.63901293 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ListIncidentTypesRequest):
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.8457167",
"0.8393036",
"0.81455255",
"0.8139734",
"0.81333447",
"0.8094964",
"0.8093362",
"0.8093362",
"0.8093362",
"0.80863476",
"0.80863476",
"0.8077286",
"0.8077286",
"0.806682"
] | 0.0 | -1 |
Find the proportion of states in each promoter window | def assign_promoter_states(self):
if self.verbose >= 2:
print("\r{}\rAssign states to promoters".format(' ' * 80), end='', file=sys.stderr)
# Find ranges of states for each CRE
Pranges = numpy.zeros((self.rna.shape[0], 2), dtype=numpy.int32)
for i in range(self.rna_indices.sh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_probs(self, states, actions):\n # YOUR CODE HERE\n \n probs = np.ones(len(states))/2\n return probs",
"def BWMeansEstimate(self):\n for i in range(self.noOfEmmittingStates):\n self.outputProbabilities[i,0] = ((self.L[i,:] *\n self... | [
"0.64039034",
"0.6019975",
"0.59359825",
"0.58757675",
"0.5864005",
"0.58565325",
"0.58375823",
"0.58301383",
"0.5823614",
"0.57711697",
"0.5725307",
"0.57216555",
"0.5689816",
"0.5679271",
"0.5659363",
"0.5651137",
"0.5628288",
"0.5626039",
"0.5623861",
"0.56230336",
"0.5600... | 0.523898 | 88 |
Output the list of neighbors of this vertex. | def __str__(self):
return self.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_neighbors(self):\n # return the neighbors\n # if len(self.neighbors.keys()) != 0:\n # # print('\\n')\n return self.neighbors.keys()\n # else:\n # # print(self.id)\n # raise ValueError('No neighbors')\n # return self.neighbors.keys()",
"... | [
"0.7470605",
"0.7389711",
"0.7366538",
"0.73501927",
"0.73265386",
"0.7247321",
"0.7229244",
"0.7229244",
"0.7229244",
"0.7229244",
"0.72231406",
"0.7205957",
"0.7084476",
"0.70685595",
"0.69425327",
"0.68990344",
"0.68850327",
"0.68846864",
"0.68796855",
"0.6870807",
"0.6859... | 0.0 | -1 |
Return the neighbors of this vertex. | def get_neighbors(self):
return [neighbor for neighbor,_ in self.neighbors.items()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neighbors(self):\n return self.graph.neighbors(self.id)",
"def neighbors(self):\n return self._neighbors",
"def neighbors(self):\n return self.mesh.neighbors()",
"def get_neighbors(self):\n return self.neighbors",
"def get_neighbors(self):\n return self.neighbors",
... | [
"0.8577959",
"0.85306996",
"0.850339",
"0.8190792",
"0.8190792",
"0.8190792",
"0.8190792",
"0.81690764",
"0.8124509",
"0.806112",
"0.8014107",
"0.7952302",
"0.7918339",
"0.79144543",
"0.7856372",
"0.78494",
"0.78207767",
"0.7726381",
"0.7726381",
"0.76581526",
"0.7603187",
... | 0.8030858 | 10 |
Return the id of this vertex. | def get_id(self):
return self.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vertex_id(self):\n ident = self.vid\n self.vid += 1\n return ident",
"def id(self):\n return self.proto.id",
"def vertex_id_type(self):\n return self._vertex_id_type",
"def GetId(self):\r\n\r\n return self.id",
"def getNewVertexId(self):\n \n ... | [
"0.77895564",
"0.7258614",
"0.72343844",
"0.7207161",
"0.71986246",
"0.71852297",
"0.71852297",
"0.71852297",
"0.71852297",
"0.71852297",
"0.71852297",
"0.71632475",
"0.7162792",
"0.71467817",
"0.71467817",
"0.7135609",
"0.71005",
"0.70983744",
"0.70983744",
"0.70983744",
"0.... | 0.7015745 | 56 |
Add a new vertex object to the graph with the given key and return the vertex. | def add_vertex(self, key):
vertex = Vertex(key)
self.vertices += 1
self.graph[key] = vertex
return vertex | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, key):\n #increments the number of vertices\n #creates a new vertex\n #adds the new vertex to the vertex list\n #returns the new vertex\n if key != None:\n self.num_vertices += 1\n new_vertex = Vertex(key)\n self.vert_list[key]... | [
"0.87255126",
"0.8722991",
"0.87102705",
"0.85453755",
"0.8475987",
"0.84450465",
"0.80544",
"0.7441455",
"0.7307348",
"0.7265836",
"0.7246054",
"0.72402257",
"0.7171863",
"0.71515185",
"0.7146038",
"0.71150756",
"0.7098152",
"0.708601",
"0.708601",
"0.7083525",
"0.70826155",... | 0.88643235 | 0 |
add an edge from vertex with key `key1` to vertex with key `key2` with a cost. | def add_edge(self, key1, key2, weight=0):
if key1 not in self.graph and key2 not in self.graph:
raise ValueError("Both Vertex of keys {} and {} not in Graph".format(key1, key2))
elif key1 not in self.graph or key2 not in self.graph:
raise ValueError("Either Vertex of keys {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, n1, n2, weight=0):\n self.add_node(n1)\n self.add_node(n2)\n self.dict[n1][n2] = weight",
"def add_edge(self, src_key, dest_key, weight=1):\n self.vertices[src_key].add_neighbour(self.vertices[dest_key], weight)",
"def add_edge(self, from_vert, to_vert, cost=0):\n... | [
"0.717386",
"0.7150445",
"0.71389425",
"0.7071141",
"0.705922",
"0.70546234",
"0.69653225",
"0.69523484",
"0.68723005",
"0.686017",
"0.68499327",
"0.68399173",
"0.682362",
"0.6802067",
"0.67960435",
"0.6749503",
"0.6725868",
"0.67047805",
"0.6678999",
"0.6648231",
"0.66471577... | 0.8022622 | 0 |
return all the vertices in the graph | def get_vertices(self):
return self.graph.keys() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertices(self):\n return list(self._graph)",
"def vertices(self):\n return list(self.__graph.values())",
"def vertices(self):\n return list(self.graph_dict.keys())",
"def vertices(self):\r\n return list(self.__graph_dict.keys())",
"def vertices(self):\n return list(se... | [
"0.861594",
"0.8598573",
"0.84232175",
"0.83618134",
"0.8358795",
"0.8358795",
"0.8358795",
"0.83203393",
"0.8090475",
"0.79803914",
"0.7959565",
"0.79577017",
"0.79134774",
"0.7899346",
"0.78921044",
"0.78649145",
"0.78386706",
"0.78323376",
"0.78055906",
"0.78055906",
"0.77... | 0.8461272 | 2 |
Returns self._aliens (the 2d list of aliens in the wave). | def getAliens(self):
return self._aliens | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_aliens(self):\n return self._aliens",
"def _createAlien(self):\n alien = ALIENS_IN_ROW\n rows = ALIEN_ROWS\n image = ALIEN_IMAGES\n x = ALIEN_H_SEP + ALIEN_WIDTH\n y = GAME_HEIGHT-ALIEN_CEILING - ((rows - 2)*(ALIEN_HEIGHT))+\\\n -((rows-1)*(ALIEN_V_SEP... | [
"0.8104672",
"0.6675642",
"0.60342413",
"0.59115666",
"0.5846313",
"0.5796346",
"0.56792027",
"0.5640674",
"0.5538137",
"0.5538002",
"0.5445459",
"0.5431286",
"0.54290193",
"0.5402356",
"0.5398832",
"0.5376174",
"0.53750706",
"0.53684664",
"0.5362111",
"0.53618795",
"0.535530... | 0.8181624 | 0 |
Returns self._bolts (the laser bolts currently on screen). | def getBolts(self):
return self._bolts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bolts(self):\n return self._bolts",
"def balls(self):\n return self._balls",
"def get_bolsa(self):\n return self.bolsa",
"def bos(self):\n return self.BOS",
"def bombs(self) -> List[Point]:\n\t\treturn self._bombs",
"def getBrickList(self):\n return self._bricks... | [
"0.7864393",
"0.6928204",
"0.6537481",
"0.6481848",
"0.6389745",
"0.6047762",
"0.6027601",
"0.6027601",
"0.58470184",
"0.57694155",
"0.57388294",
"0.5610215",
"0.558035",
"0.557391",
"0.55503374",
"0.55272126",
"0.5505021",
"0.54728293",
"0.5454036",
"0.5422399",
"0.5410548",... | 0.77599704 | 1 |
Returns self._lives (the number of lives left). | def getLives(self):
return self._lives | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lives(self):\n return self.__num_lives",
"def get_lives(self) -> int:\n return self.rstate.lives()",
"def lives(self) -> int:\n return self.__state.lives()",
"def get_lives(self):\n\t\treturn self._lives",
"def get_life(self):\r\n return self.__lives",
"def get_lives(s... | [
"0.8581002",
"0.8386947",
"0.8140961",
"0.7681206",
"0.7641726",
"0.75877464",
"0.75668555",
"0.74691445",
"0.72418535",
"0.67007107",
"0.6617538",
"0.66124153",
"0.65348047",
"0.6478063",
"0.64320886",
"0.6335317",
"0.6299356",
"0.62779075",
"0.62498957",
"0.61492556",
"0.61... | 0.7529445 | 7 |
Determines if there is a collision between the bolt fired from the aliens and the ship; if so, sets self._ship to None and reduces self._lives by 1 | def _shipCollision(self):
for bolt in self._bolts:
if self._ship.collides(bolt):
self._ship = None
if not self._shipexplode is None:
self._shipexplode.play()
self._bolts.remove(bolt)
self._lives -= 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _shipCollide(self):\n for s in range(self.getLengthAlien()):\n for t in range(len(self._aliens[0])):\n for b in self._bolts:\n if self._aliens[s][t] != None and + \\\n self._aliens[s][t].collides(b):\n self._alien... | [
"0.75226384",
"0.7102362",
"0.7081749",
"0.70346534",
"0.6939146",
"0.6891531",
"0.6854448",
"0.68248653",
"0.67908275",
"0.67530805",
"0.62083966",
"0.6183217",
"0.61296374",
"0.611502",
"0.60834926",
"0.6051603",
"0.6049185",
"0.60320956",
"0.59694666",
"0.5944689",
"0.5938... | 0.7962699 | 0 |
Determines if there is a collision between the bolt fired from the ship and the aliens; if so, removes the alien and changes self._alienspeed | def _aliensCollision(self):
for bolt in self._bolts:
for row in range(ALIEN_ROWS):
for col in range(ALIENS_IN_ROW):
if (not self.getAliens()[row][col] is None and
self.getAliens()[row][col].collides(bolt)):
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _alienCollide(self):\n for b in self._bolts:\n if self._ship != None and self._ship.collides(b):\n self._ship = None\n self._bolts = []\n self._key = False\n self._lives -= 1",
"def _shipCollide(self):\n for s in range(self.... | [
"0.71470374",
"0.7134334",
"0.6685112",
"0.6514891",
"0.6440438",
"0.6388077",
"0.63670146",
"0.6318223",
"0.6201097",
"0.61949414",
"0.61874723",
"0.61653256",
"0.6161717",
"0.61557",
"0.6117694",
"0.60780686",
"0.6068851",
"0.602897",
"0.60229385",
"0.60123926",
"0.59756607... | 0.6995264 | 2 |
Updates the URL category for the specified ID | def update(self, category_id, category):
path = 'urlCategories/{}'.format(category_id)
return self._session.put(path, category) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ModifyCategoryOfCost(idOfCost, category):\n\n logs.logger.debug(\"Start to modify category of Cost based on the ID.\")\n try:\n modifiedCost = session.query(Cost.Cost).filter(\n Cost.Cost.id == idOfCost).one()\n modifiedCost.category = category\n session.commit()\n ... | [
"0.6235939",
"0.6149964",
"0.61333364",
"0.60905147",
"0.60422516",
"0.5987244",
"0.5977752",
"0.5742203",
"0.57387257",
"0.56441104",
"0.5605335",
"0.5561809",
"0.5556657",
"0.55405533",
"0.5529997",
"0.5511629",
"0.55047536",
"0.5498366",
"0.54865915",
"0.5464903",
"0.54453... | 0.7331457 | 0 |
Creates a WellGrid with a center well (Gupta and King, 2010, Chapter 8) Arguments Rect0 The coordinates of left bottom corner point of the rectangle Rect1 The coordinates of right top corner point of the rectangle Qw Wellbore flow rate, stb/day Qe Outflow edge flow rate, stb/day Qe_int Internal edge flow, stb/day h Wel... | def __init__(self, Rect0=(0,0),Rect1=(1,1),Qw=1000,Qe=(250,250,250,250),h=10,phi=0.2):
#Cornor Points
self.Pts=[(Rect0[0],Rect0[1]),(Rect0[0],Rect1[1]),(Rect1[0],Rect1[1]),(Rect1[0],Rect0[1])]
#Center Well
self.Pts.append(((Rect0[0]+Rect1[0])/2,(Rect0[1]+Rect1[1])/2) )
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grid(self, northeast, southwest, density=200):\n grid = []\n\n # Determine the bounds of a standard, positive quadrant plot\n y_max, y_min = int(northeast[0]), int(southwest[0])\n x_max, x_min = int(northeast[1]), int(southwest[1])\n\n # Construct a sequence of boxes each mov... | [
"0.57113224",
"0.56533",
"0.5564657",
"0.54844874",
"0.53876007",
"0.53808355",
"0.5348111",
"0.53406596",
"0.5334034",
"0.53150934",
"0.53006643",
"0.5279142",
"0.5273976",
"0.52733064",
"0.5271755",
"0.5266967",
"0.5261731",
"0.5251025",
"0.5250112",
"0.5221351",
"0.5190285... | 0.6307257 | 0 |
Init weights for models. | def init_weights(self):
super().init_weights()
init_type = None if self.init_cfg is None else self.init_cfg.get(
'type', None)
if init_type != 'Pretrained' and self.with_tsa:
for module in [
self.fusion.feat_fusion, self.fusion.spatial_attn1,
... | {
"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)\n # Tie weights if needed\n self.tie_weights()",
"def _initialize_weights(self):\n pass",
"def init_weights(self):\n # Initialize weights\n ... | [
"0.8984091",
"0.8641805",
"0.86267096",
"0.86172",
"0.85792875",
"0.85725594",
"0.84296715",
"0.8325935",
"0.8232147",
"0.8045925",
"0.8013931",
"0.8010816",
"0.79973304",
"0.7983617",
"0.7977511",
"0.7962253",
"0.7962253",
"0.7962253",
"0.7959221",
"0.79509515",
"0.7947236",... | 0.7277725 | 90 |
Convert a raw sample (pair of sentences as tokenized strings) into a proper training sample with IDs, LM labels, input_mask, CLS and SEP tokens etc. | def convert_example_to_features_test(example, cur_time, max_seq_length, tokenizer):
tokens_a = example
# Modifies `tokens_a` and `tokens_b` in place so that the total
# length is less than the specified length.
# Account for [CLS], [SEP], [SEP] with "- 3"
tokens_a = truncate_seq_pair_test(tokens... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_sample(self, sample_raw):\n\n text, mention, candidate = sample_raw\n self._logger.debug(f'Preprocessing sample (\"{mention}\" vs. \"{candidate}\")')\n\n sample = {}\n sample['text'] = text\n sample['text_tokenized'] = None # set by add_tokens()\n sample['text_... | [
"0.6765274",
"0.6643791",
"0.6458343",
"0.6222438",
"0.6118219",
"0.60636324",
"0.60636324",
"0.6050379",
"0.6013293",
"0.59984004",
"0.59738016",
"0.5972772",
"0.59354293",
"0.5934981",
"0.593118",
"0.5915184",
"0.588585",
"0.58808494",
"0.58754045",
"0.585969",
"0.58526886"... | 0.60637873 | 5 |
Get current time with zone information | def get_now():
local_tz = timezone(os.getenv('TZ', settings.TIME_ZONE))
return datetime.datetime.now(tz=local_tz) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time(self):\n return datetime.datetime.now(self.time_zone)",
"def now(self):\n os.environ['TZ'] = conf.timezone\n time.tzset()\n return time.strftime(\"%B %d %Y %H:%M:%S IST\", time.localtime())",
"def currentTime():\n zone='America/Bogota'\n getDate = datetime.now(pytz.timezone(zone)... | [
"0.7663724",
"0.7573994",
"0.75403976",
"0.74415857",
"0.7423715",
"0.7367163",
"0.7366429",
"0.7342091",
"0.7241305",
"0.7198044",
"0.7178488",
"0.71328425",
"0.7127584",
"0.7104764",
"0.7051412",
"0.7022998",
"0.7011191",
"0.7004477",
"0.69570786",
"0.6940542",
"0.6920663",... | 0.7052575 | 14 |
Convert character level spans to IOB coding. | def to_iob(text: str, items: List[Instance]) -> List[str]:
coding = ["O"] * len(text)
for (s, e), label in items:
b = f"B-{label}"
i = f"I-{label}"
coding[s] = b
for x in range(s + 1, e):
coding[x] = i
return coding | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_span(self, span):\n raise NotImplementedError()",
"def tags_to_spans(tags):\n spans = set()\n span_start = 0\n span_end = 0\n active_conll_tag = None\n for index, string_tag in enumerate(tags):\n # Actual BIO tag.\n bio_tag = string_tag[0]\n assert bio_tag in [\"B\", \"I\", \"O\"]... | [
"0.5848588",
"0.57665783",
"0.56697834",
"0.5565456",
"0.5565406",
"0.5565406",
"0.54807836",
"0.54667664",
"0.5433932",
"0.52166694",
"0.515315",
"0.5105048",
"0.5051314",
"0.5049576",
"0.504556",
"0.5032722",
"0.5010447",
"0.49919397",
"0.49679488",
"0.49568197",
"0.4946218... | 0.6061965 | 0 |
Create and return a gRPC AsyncIO channel object. | def create_channel(
cls,
host: str = "datastore.googleapis.com",
credentials: Optional[ga_credentials.Credentials] = None,
credentials_file: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
quota_project_id: Optional[str] = None,
**kwargs,
) -> ai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grpc_channel(self) -> aio.Channel:\n # Return the channel from cache.\n return self._grpc_channel",
"def grpc_channel(self) -> aio.Channel:\n # Return the channel from cache.\n return self._grpc_channel",
"def create_channel(\n cls,\n host: str = \"aiplatform.googl... | [
"0.6003547",
"0.6003547",
"0.598714",
"0.57845247",
"0.57349795",
"0.54287446",
"0.5362631",
"0.5361543",
"0.53508186",
"0.534505",
"0.53053015",
"0.5278422",
"0.5251089",
"0.5246306",
"0.5203807",
"0.5203807",
"0.51982075",
"0.51729894",
"0.51378304",
"0.5119932",
"0.5104985... | 0.54730964 | 5 |
r"""Return a callable for the list indexes method over gRPC. Lists the indexes that match the specified filters. Datastore uses an eventually consistent query to fetch the list of indexes and may occasionally return stale results. | def list_indexes(
self,
) -> Callable[
[datastore_admin.ListIndexesRequest],
Awaitable[datastore_admin.ListIndexesResponse],
]:
# Generate a "stub function" on-the-fly which will actually make
# the request.
# gRPC handles serialization and deserialization, so we ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_indexes(self):\n return AlgoliaUtils_request(self.headers, self.read_hosts, \"GET\", \"/1/indexes/\", self.timeout)",
"def indexes(self):\n indexes = self.execute(self.commands.get_indexes(self.name))\n return [Index(*tup) for tup in indexes]",
"def list_command(*, login_manager: ... | [
"0.65112144",
"0.63108045",
"0.61528206",
"0.6124728",
"0.60733473",
"0.6064576",
"0.60611725",
"0.6015327",
"0.59854823",
"0.5822483",
"0.5798654",
"0.57317066",
"0.5712299",
"0.5712299",
"0.5712299",
"0.5712299",
"0.5712299",
"0.5712299",
"0.5712299",
"0.5712299",
"0.560859... | 0.7938675 | 0 |
get_dataset("testing"), cached for performance X,Y | def get_MNIST_training_normalized():
X, Y = get_dataset("training")
X=X/255.0
X-=0.5
return X,Y
global MNIST_training
if MNIST_training is None:
if os.path.exists("./data/MNIST_training.pkl"):
MNIST_training = cPickle.load(open("./data/MNIST_training.pkl", "r"))
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_data_for_tests():\n X = np.random.randn(100, input_dim)\n Y = np.random.randn(100, output_dim)\n X_new = np.random.randn(100, input_dim)\n return X, X_new, Y",
"def test(self) -> tf.contrib.data.Dataset:\n return self.__test_dataset",
"def get_dataset(args):\n\n if args['experime... | [
"0.6800313",
"0.6752603",
"0.6617406",
"0.65631133",
"0.65523183",
"0.647641",
"0.64684135",
"0.64507365",
"0.64411503",
"0.6392813",
"0.6391876",
"0.6386069",
"0.63373893",
"0.6328032",
"0.63069004",
"0.63014704",
"0.6300861",
"0.6297549",
"0.62668437",
"0.6259683",
"0.62514... | 0.0 | -1 |
get_dataset("training"), cached for performance X,Y | def get_MNIST_testing_normalized():
X, Y = get_dataset("testing")
X/=255.0
X-=0.5
return X,Y
global MNIST_testing
if MNIST_testing is None:
if os.path.exists("./data/MNIST_testing.pkl"):
MNIST_testing = cPickle.load(open("./data/MNIST_testing.pkl", "r"))
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_training_dataset(self):\n\n return tf.data.Dataset.zip((self.conditioned_dataset, self.dataset))",
"def get_training_data() -> GraphDataset:\n _load_data_if_needed()\n return training_data",
"def get_dataset(self):\n trainset = datasets.KMNIST('datasets/KMNIST/train/', train=True, ... | [
"0.74134755",
"0.7294511",
"0.7046089",
"0.68471146",
"0.683935",
"0.67860866",
"0.6774482",
"0.67494965",
"0.67361504",
"0.67207044",
"0.6720154",
"0.6709356",
"0.66598976",
"0.6656929",
"0.66512144",
"0.6643973",
"0.6627386",
"0.6618423",
"0.6606816",
"0.6601208",
"0.659930... | 0.0 | -1 |
Return any of the groups matched by the preceding regular expression. E.g. self.group(1) returns the first matched group. | def group(self, group_num):
if self.rematch is None:
return None
else:
return self.rematch.group(group_num) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(self):\n\n # We initate this variable which gonna contain the returned data\n result = []\n\n # We compile the regex string\n to_match = comp(self.regex)\n\n # In case we have to use the implementation of ${BASH_REMATCH} we use\n # re.find... | [
"0.62626004",
"0.59449905",
"0.57265604",
"0.57265604",
"0.5626674",
"0.56036365",
"0.557852",
"0.5534317",
"0.551097",
"0.54845226",
"0.5424557",
"0.5387493",
"0.5314206",
"0.53099436",
"0.5282944",
"0.52798736",
"0.525747",
"0.5239471",
"0.5184091",
"0.51464254",
"0.5138452... | 0.69259787 | 0 |
The reference to the toplevel PhoUIContainer for this menu where references are stored to the ui elements and their actions. | def activeMenuReference(self):
return self.root_window.ui.menus.global_window_menus.debug | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def menu(self):\n return self._menu",
"def ui(self):\n return self._ui",
"def menu(self) -> CursesMenu | None: # type: ignore[override]\n return self._menu",
"def get_menu ( self, object ):\n return self.menu",
"def ui(self):\n return ui",
"def GetMenu(self):\n ... | [
"0.6571456",
"0.644158",
"0.6439332",
"0.6308874",
"0.6308201",
"0.6180288",
"0.6136234",
"0.6020653",
"0.5883625",
"0.5823237",
"0.5801054",
"0.5743126",
"0.5726975",
"0.57137626",
"0.5712201",
"0.5691326",
"0.568709",
"0.56823146",
"0.56808054",
"0.567435",
"0.5663427",
"... | 0.5670027 | 20 |
Setup test flask app | def test_app():
param = {
'DEBUG': True,
'TESTING': True
}
_app = create_app(settings_override=param)
ctx = _app.app_context()
ctx.push()
yield _app
ctx.pop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.app = Flask(__name__)\n self.app_context = self.app.app_context()\n self.app_context.push()\n self.client = self.app.test_client()",
"def app():\n os.environ[\"FLASK_ENV\"] = \"test\"\n return create_app()",
"def create_app(test_config=\"test_config.py\... | [
"0.81158316",
"0.8108076",
"0.7822387",
"0.7777939",
"0.777101",
"0.76721895",
"0.7640931",
"0.76230794",
"0.7613913",
"0.7588766",
"0.7588766",
"0.7576101",
"0.75739956",
"0.75575405",
"0.75522625",
"0.7542036",
"0.75345105",
"0.7521277",
"0.74859345",
"0.74744576",
"0.74729... | 0.77729565 | 4 |
r""" Check if path points to a file inside a python egg file, extract the file from the egg to a cache directory (following pkg_resources convention) and return [(extracted path, egg file path, relative path inside egg file)]. Otherwise, just return [(original path, None, None)]. If path points to an egg file directly,... | def check_extract_from_egg(pth, todir=None):
rv = []
if os.path.altsep:
pth = pth.replace(os.path.altsep, os.path.sep)
components = pth.split(os.path.sep)
for i, name in enumerate(components):
if name.lower().endswith(".egg"):
eggpth = os.path.sep.join(components[:i + 1])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_compile_cache_dep_files(file_path, compile_cache_dep_files, pkg):\n with open(file_path) as fh:\n root = ast.parse(fh.read(), file_path)\n for node in ast.iter_child_nodes(root):\n module_name = \"\"\n if isinstance(node, ast.ImportFrom):\n if node.module is not None... | [
"0.6205158",
"0.6140259",
"0.5979004",
"0.5960583",
"0.5936674",
"0.57813233",
"0.5762908",
"0.5736331",
"0.5655493",
"0.5625167",
"0.5577619",
"0.55727035",
"0.5561637",
"0.55586225",
"0.5543705",
"0.5526448",
"0.5481361",
"0.5479898",
"0.5455024",
"0.54513395",
"0.54462653"... | 0.6193302 | 1 |
Daysback value is retrieved from session attributes. | def test_daysback_from_session(self):
PermissionSystem(self.env).grant_permission('user1', 'TIMELINE_VIEW')
req = MockRequest(self.env, authname='user1')
req.session.set('timeline.daysback', '45')
data = TimelineModule(self.env).process_request(req)[1]
self.assertEqual(45, data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decays(self):\n return self._base.decays",
"def last_days_results(self, days):\n return self.security['Date', 'Close', 'FinalDecision'][-days:]",
"def get_interactive_days(self):\n answer = input(\"Press return to get entries of past day or input number of days to go back in time: \")\... | [
"0.5776659",
"0.5634785",
"0.5420541",
"0.52504593",
"0.51793265",
"0.5147413",
"0.5096766",
"0.50792265",
"0.50773376",
"0.50755787",
"0.5064925",
"0.50591904",
"0.50591904",
"0.50591904",
"0.50591904",
"0.50327665",
"0.50257593",
"0.49778205",
"0.49776113",
"0.4966822",
"0.... | 0.6655547 | 0 |
Daysback minimum value is 1. | def test_daysback_less_than_min(self):
req = MockRequest(self.env, args={'daysback': '-1'})
data = TimelineModule(self.env).process_request(req)[1]
self.assertEqual(1, data['daysback']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_days(self):\n # This can be refined, as there are no more than 1 consecutive months\n # with 28 days\n days_fractional = self.number * 365.24 + self.days\n return int(np.floor(days_fractional))",
"def get_number_days(self):\r\n return 1",
"def maximum_gap_in_days(col:... | [
"0.646854",
"0.58640444",
"0.58126456",
"0.5802112",
"0.5758636",
"0.5721096",
"0.5721096",
"0.5688065",
"0.5668413",
"0.5622553",
"0.5591726",
"0.5576532",
"0.5575973",
"0.5495859",
"0.5494301",
"0.5443471",
"0.54378337",
"0.5425549",
"0.5416584",
"0.5401782",
"0.53917223",
... | 0.62440276 | 1 |
Put Slack users into JSON and dump into users.json. | def load_slack_users(message):
users = hf.get_users()
for user in users:
if user["id"] == message._get_user_id():
if user["approval_level"] != "admin":
message.reply("Insufficient privileges.")
return
with open(user_path) as outfile:
users = jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_users(self):\n users = {}\n args = self._add_user()\n #Grab info from args\n users[args[\"userID\"]] = {}\n users[args[\"userID\"]][\"name\"] = args[\"name\"]\n users[args[\"userID\"]][\"webhook_url\"] = args[\"webhook_url\"]\n users[args[\"userID\"]][... | [
"0.70719814",
"0.7036615",
"0.69473386",
"0.6768641",
"0.67458874",
"0.66404533",
"0.66269165",
"0.65267056",
"0.6502108",
"0.6288932",
"0.6280963",
"0.62153757",
"0.6208741",
"0.6207539",
"0.6201374",
"0.61616826",
"0.6099214",
"0.6097477",
"0.60967374",
"0.6087949",
"0.6085... | 0.7201386 | 0 |
Hide the subnotebook. Used for hiding Optional displays | def subnotebook_hide(self):
if self.subnotebook and self.subnotebook.winfo_ismapped():
logger.debug("Hiding subnotebook")
self.subnotebook.pack_forget()
self.subnotebook.destroy()
self.subnotebook = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnotebook_show(self):\n if not self.subnotebook:\n logger.debug(\"Showing subnotebook\")\n self.subnotebook = self.add_subnotebook()",
"def hideDisplay(self):\n if self._displayPjt:\n self._displayPjt.hide()\n if self._displayUsr:\n self._dis... | [
"0.74942166",
"0.7050231",
"0.6920742",
"0.6824968",
"0.682398",
"0.68151635",
"0.6806537",
"0.67921376",
"0.67395896",
"0.6736704",
"0.6700926",
"0.66609246",
"0.65580887",
"0.65409225",
"0.65340364",
"0.6511675",
"0.6505497",
"0.6499318",
"0.64810354",
"0.6477027",
"0.64616... | 0.8874996 | 0 |
Make sure that the password is hashed correctly | def test_user1_method3():
REGEX_MATCH_BCRYPT_HASH = r"^\$2[ayb]\$.{56}$"
hashed_password = u.password.decode()
assert re.match(REGEX_MATCH_BCRYPT_HASH, hashed_password), "Password was not hashed correctly" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_password(self):\n user = User.query.filter_by(username='eschoppik').first()\n self.assertTrue(bcrypt.check_password_hash(user.password, 'secret'))\n self.assertFalse(bcrypt.check_password_hash(user.password, 'notsecret'))",
"def verify_password(self, password):\n return che... | [
"0.7974097",
"0.75901264",
"0.7575029",
"0.7516875",
"0.751061",
"0.74560297",
"0.7450313",
"0.74328417",
"0.74039775",
"0.73979396",
"0.73920727",
"0.7386824",
"0.73759675",
"0.7348452",
"0.7287631",
"0.7270274",
"0.7268711",
"0.7255871",
"0.72513473",
"0.7237343",
"0.723734... | 0.7503901 | 5 |
Make sure that we can verify a plaintext password | def test_user1_method4():
assert u.verify_password(USER_CREDENTIALS["password"]), "Password cannot verify properly" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_password():\n assert check_password('Longpassword') == False\n assert check_password('123456') == False\n assert check_password('short') == False\n assert check_password('C0rect') == False\n assert check_password('Correct8') == True",
"def test_valid_password(self):\n pass_fi... | [
"0.79301065",
"0.7789788",
"0.7731887",
"0.77060926",
"0.7618398",
"0.7607318",
"0.7598518",
"0.7571751",
"0.7566817",
"0.75273633",
"0.7487129",
"0.7465",
"0.7409835",
"0.74024177",
"0.73076963",
"0.7299102",
"0.7288273",
"0.72623914",
"0.7251323",
"0.7242377",
"0.7237286",
... | 0.7170948 | 38 |
Convert a dataframe with pixel location (height and width) and RGB information to an image. | def df_to_image(df, rgb_cols):
# Ensure colors are uint8
df[rgb_cols] = df[rgb_cols].astype(np.uint8)
data = np.reshape(df[rgb_cols].values, (df.height.max()+1, df.width.max()+1, 3))
return Image.fromarray(data, 'RGB') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jpg_to_df(image):\n width, height = image.size\n df = pd.DataFrame(np.vstack(np.array(image)[:,:,:3]), columns=('R', 'G', 'B'))\n\n # Associate the height and width for each pixel. \n df['height'] = np.repeat(np.arange(height), width)\n df['width'] = np.tile(np.arange(width), height)\n return... | [
"0.64659077",
"0.6464889",
"0.62659717",
"0.5985716",
"0.5897487",
"0.5824227",
"0.57273203",
"0.5706351",
"0.5695631",
"0.5653905",
"0.56521446",
"0.56217664",
"0.5590714",
"0.5485873",
"0.5471054",
"0.54432553",
"0.5428131",
"0.5425394",
"0.5422454",
"0.5417311",
"0.5415322... | 0.80461997 | 0 |
Pixelate a larger image by rescaling it to a smaller image. | def pixelate(image, n_w, n_h):
image = image.resize((n_w, n_h), Image.ANTIALIAS)
return image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rescale_image(image, scale=0.50):\r\n \r\n wi = int(image.shape[1]*scale)\r\n hei = int(image.shape[0]*scale)\r\n dimension = (wi, hei)\r\n return cv.resize(image, dimension, interpolation = cv.INTER_AREA)",
"def rescale_image(image, rescale_width):\r\n\r\n # image size\r\n image_height ... | [
"0.65833485",
"0.6485271",
"0.6471172",
"0.6426345",
"0.6421628",
"0.64137304",
"0.6411001",
"0.6385056",
"0.6356421",
"0.6318233",
"0.6288993",
"0.6277775",
"0.62357616",
"0.6234547",
"0.6186448",
"0.61197674",
"0.6061309",
"0.6047742",
"0.6030527",
"0.6018693",
"0.59924424"... | 0.69843644 | 0 |
Add lego color columns to DataFrame. There are other ways to do this, but the colors are added based on the closest in Euclidean distance. Does not include Transparent, Metallic or Glow bricks and only uses the 2016 brick palette. | def add_lego_colors(df, color_df):
# Can't use uint8 for variance, numbers become too large.
df[['R', 'G', 'B']] = df[['R', 'G', 'B']].astype('int')
# Determine which lego color is closest (Euclidean distance) to the image color.
cmask = ((color_df.c_Palette2016==True) & (color_df.c_Transparent==False... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_color_table(self):\n #Color: Green Yellow Orange Red Distance:\n return [[0.70, 0.15, 0.1, 0.05], # 0\n [0.17, 0.6, 0.17, 0.06], # 1\n [0.06, 0.17, 0.6, 0.17], # 2\n [0.05, 0.12, 0.23, 0.6], # 3\n [0.05, 0.... | [
"0.59408545",
"0.5840702",
"0.5795044",
"0.5505669",
"0.5387429",
"0.5231539",
"0.52000844",
"0.51889634",
"0.51861984",
"0.50860643",
"0.5073239",
"0.50353134",
"0.5034416",
"0.5017803",
"0.50017005",
"0.49964416",
"0.49359882",
"0.49269187",
"0.4918417",
"0.49176708",
"0.48... | 0.8099222 | 0 |
Returns report details (including the reportDocumentId, if available) for the report that you specify. | def get_report(self, report_id, **kwargs):
return GetReportResponse(
**self._request(fill_query_params(kwargs.pop('path'), report_id), add_marketplace=False).json()
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_report(self, report_id: str):\n self.logger.info(f'[INFO] Retrieving OpenVAS report {report_id}...')\n params = {\n 'cmd': 'get_report',\n 'token': self.token,\n 'report_id': report_id,\n 'filter': 'apply_overrides=0 min_qod=70 autofp=0 levels=hml f... | [
"0.7089311",
"0.6978201",
"0.69638634",
"0.684062",
"0.68089885",
"0.6699905",
"0.6539877",
"0.6486073",
"0.64755267",
"0.64168626",
"0.6383716",
"0.63656604",
"0.63188547",
"0.6282777",
"0.62313056",
"0.6223874",
"0.61692595",
"0.6151564",
"0.6104303",
"0.6102375",
"0.610223... | 0.7071482 | 1 |
Return current credit limit. | def get_limit(self):
return self._limit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_limit(self):\n return self.limit",
"def get_plan_limit(self, source):\n commitment = getattr(self.get_subscription(), 'commitment', {})\n return self.get_plan().get_price_data(source, commitment)[1]",
"def charge_limit(self, limit=None):\n if limit is None:\n done... | [
"0.7069158",
"0.6973982",
"0.6839183",
"0.6818849",
"0.6815864",
"0.6487626",
"0.64842916",
"0.64700264",
"0.6450808",
"0.6445396",
"0.63999814",
"0.635713",
"0.635713",
"0.6311851",
"0.6305982",
"0.61837167",
"0.61775035",
"0.61692756",
"0.6121114",
"0.6109702",
"0.60551584"... | 0.69027054 | 2 |
Charge given price to the card, assuming sufficient credit limit. Return True if charge was processed; False if charge was denied. | def charge(self, price):
'''try:
type(price) == int or type(price) == float
except ValueError:
print 'Not a number!'
if type(price) != int or type(price) != float:
raise ValueError("Not a number!")
'''
if price < 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def charge(self, price):\n if not isinstance(price, (int, float)):\n raise TypeError('Price must be numeric')\n if price + self._balance > self._limit: # if charge would exceed limit\n return False # cannot accept charge\n self._balance += price\n... | [
"0.85520387",
"0.84601766",
"0.8349793",
"0.6463649",
"0.6245042",
"0.5892579",
"0.5885774",
"0.5780839",
"0.57770324",
"0.57604635",
"0.56510687",
"0.56393975",
"0.5617718",
"0.55500877",
"0.55427504",
"0.5533513",
"0.5521042",
"0.5483467",
"0.5452863",
"0.54159594",
"0.5361... | 0.7776878 | 3 |
Return dot for graph. | def onnx_to_graphviz(g, include_attrs=False):
def get_attribute_value(attr):
# pylint: disable=len-as-condition, no-else-return
# For Python2:
# - str(long) has 'L' as suffix, cast it to int
# - always decode from utf-8 bytes to avoid 'b' prefix
if attr.HasField('f'):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot(self) -> str:\n dot = to_pydot(self._graph)\n return dot.to_string()",
"def dot(self):\n return self.__dot",
"def get_dot(self):\n return \"digraph G{\\n%s}\" % (\"\" if self.val is None else (\n \"\\t%s;\\n%s\\n\" % (\n self.val,\n \... | [
"0.83318657",
"0.82540405",
"0.75600487",
"0.75600487",
"0.74491763",
"0.7405849",
"0.72355574",
"0.7068965",
"0.68348116",
"0.68348116",
"0.67568165",
"0.67136085",
"0.67047656",
"0.66952586",
"0.66952586",
"0.664924",
"0.6646575",
"0.6645251",
"0.6601873",
"0.6596667",
"0.6... | 0.0 | -1 |
Return a new FakedSession object from an HMC definition in a YAML file. The data format of the YAML file is validated using a schema. | def from_hmc_yaml_file(filepath, userid=None, password=None):
# pylint: disable=unspecified-encoding
with open(filepath) as fp:
hmc = FakedSession.from_hmc_yaml(fp, filepath, userid, password)
return hmc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_hmc_yaml(hmc_yaml, filepath=None, userid=None, password=None):\n\n try:\n hmc_dict = yaml.load(hmc_yaml, Loader=yamlloader.ordereddict.Loader)\n except (yaml.parser.ParserError, yaml.scanner.ScannerError) as exc:\n if filepath:\n file_str = \" in file {f}... | [
"0.82276064",
"0.6911682",
"0.6088977",
"0.5976081",
"0.5760002",
"0.5716752",
"0.56409085",
"0.5611956",
"0.54702437",
"0.5463061",
"0.54620636",
"0.5410553",
"0.5331743",
"0.53263074",
"0.53030956",
"0.52963865",
"0.52692974",
"0.52608484",
"0.5253639",
"0.52416426",
"0.524... | 0.79965574 | 1 |
Return a new FakedSession object from an HMC definition dictionary. An HMC definition dictionary can be created using | def from_hmc_dict(hmc_dict, filepath=None, userid=None, password=None):
try:
jsonschema.validate(hmc_dict, FAKED_HMC_DEFINITION_SCHEMA)
except jsonschema.exceptions.ValidationError as exc:
if filepath:
file_str = " in file {f}".format(f=filepath)
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_hmc_yaml(hmc_yaml, filepath=None, userid=None, password=None):\n\n try:\n hmc_dict = yaml.load(hmc_yaml, Loader=yamlloader.ordereddict.Loader)\n except (yaml.parser.ParserError, yaml.scanner.ScannerError) as exc:\n if filepath:\n file_str = \" in file {f}... | [
"0.66378766",
"0.63375574",
"0.5660789",
"0.5478047",
"0.53681654",
"0.529543",
"0.5206334",
"0.51733655",
"0.5162307",
"0.51562643",
"0.5151216",
"0.51190066",
"0.5117987",
"0.510836",
"0.5102242",
"0.5102242",
"0.50987774",
"0.50698274",
"0.5057171",
"0.5055784",
"0.5051591... | 0.6836698 | 0 |
load config from yaml | def load_yaml(yaml_name):
print('training network configuration file is {0}'.format(yaml_name))
util.check_file_exist(yaml_name)
config = util.load_yaml_file(yaml_name)
return config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cfg_from_yaml(self):\n try:\n with open(self.parsed_cfg_path, 'r') as cfg_yaml:\n self.from_yaml_cfg_dict = yaml.load(cfg_yaml)\n except Exception as exc:\n print(exc)\n traceback.print_exc()\n self.from_yaml_cfg_dict = {}",
"def lo... | [
"0.7932778",
"0.7905354",
"0.7778778",
"0.7775529",
"0.7703198",
"0.76914793",
"0.76733524",
"0.7668443",
"0.7653953",
"0.76442325",
"0.7618144",
"0.7508202",
"0.74901235",
"0.7482549",
"0.7470616",
"0.7390995",
"0.7380142",
"0.7366467",
"0.73381823",
"0.73311335",
"0.7309766... | 0.7793939 | 2 |
Assign input `x` to an available worker and invoke `parallizable.forward_backward` with x. | def put(self, x):
if self._num_serial > 0 or len(self._threads) == 0:
self._num_serial -= 1
out = self._parallizable.forward_backward(x)
self._out_queue.put(out)
else:
self._in_queue.put(x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward_backward(self, x):\n raise NotImplementedError()",
"def forward(self, x):\n raise NotImplementedError",
"def forward(self, x):\n raise NotImplementedError",
"def forward(self, x):\n pass",
"def forward(self, x):\n return self.activation_function(self.backbone_... | [
"0.6979647",
"0.6505514",
"0.6505514",
"0.64504945",
"0.63404757",
"0.6215585",
"0.61830115",
"0.61830115",
"0.6176673",
"0.6168372",
"0.6159038",
"0.61195976",
"0.6106797",
"0.6101886",
"0.6090476",
"0.6088728",
"0.60350174",
"0.6031973",
"0.5999682",
"0.5995222",
"0.5985669... | 0.71769464 | 0 |
Parallel applying model forward | def parallel_apply(module, inputs, kwargs_tup=None, sync=False):
if kwargs_tup is not None:
assert len(inputs) == len(kwargs_tup)
else:
kwargs_tup = ({},) * len(inputs)
lock = threading.Lock()
results = {}
def _worker(i, module, input, kwargs, results, is_recording, is_training, lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, inputs):\r\n #print (len(inputs))\r\n out = self.fc1(inputs)\r\n out = self.fc2(out)\r\n self.out = out\r\n return out\r\n #raise NotImplementedError('Implement the forward method of the model')\r",
"def forward_train(self, *args, **kwargs):\n pa... | [
"0.68545604",
"0.67817986",
"0.6745966",
"0.6683042",
"0.66758007",
"0.65857536",
"0.65681833",
"0.65619177",
"0.65139794",
"0.65139794",
"0.64773625",
"0.6462003",
"0.6444913",
"0.6373643",
"0.6371031",
"0.63577396",
"0.63464874",
"0.6345656",
"0.63450855",
"0.6340966",
"0.6... | 0.0 | -1 |
return lepton flavour vector [l_e, l_nu, l_tau] | def lepton_flavor_vec(self):
v = [0, 0, 0]
if self.is_lepton:
v[self.lepton_flavor() - 1] = self.lepton_number()
return v | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lvec(self):\n lv = ROOT.TLorentzVector()\n# if self.pt < 0 or abs(self.eta) > 6:\n# raise Exception(\"Invalid values for TLorentzVector\")\n lv.SetPtEtaPhiM(self.pt, self.eta, self.phi, self.mass)\n# if abs(lv.Pt()) > 100000 or abs(lv.Eta()) > 100000:\n# raise Exception(\"Invalid valu... | [
"0.65847385",
"0.6450575",
"0.59748626",
"0.5903857",
"0.5883675",
"0.5736578",
"0.57182205",
"0.56847394",
"0.5651799",
"0.5622394",
"0.56138295",
"0.5584103",
"0.5559427",
"0.5529041",
"0.55234283",
"0.5522512",
"0.55127025",
"0.55050933",
"0.5497215",
"0.5461632",
"0.54553... | 0.6729824 | 0 |
Reaction rate function. If only one parameter is given it is interpreted as 'outgoing' If no parameter is provided, just a deep copy of self is returned | def R(self,
I = None,
O = None):
if O is None:
if I is None:
return self()
return self(None, I)
return self(I, O) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reaction_rate (self):\n raise NotImplementedError('Subclass must implement this method')",
"def exchange_rate(self):\n res = r.get(self.url + self.current_rate)\n return self.execute(res)",
"def getRateRule(self, *args):\n return _libsbml.Model_getRateRule(self, *args)",
"def ... | [
"0.6718368",
"0.5967329",
"0.55467165",
"0.5362776",
"0.53501284",
"0.5333011",
"0.53263295",
"0.53257626",
"0.53196603",
"0.53163046",
"0.52898854",
"0.52546877",
"0.524962",
"0.52332586",
"0.52070975",
"0.5182573",
"0.51674205",
"0.51661986",
"0.51398706",
"0.51279026",
"0.... | 0.0 | -1 |
Random select some elements from the gallery. It seems that Pytorch's implementation is slower than numpy so we use numpy to randperm the indices. | def random_choice(gallery, num):
assert len(gallery) >= num
if isinstance(gallery, list):
gallery = np.array(gallery)
cands = np.arange(len(gallery))
np.random.shuffle(cands)
rand_inds = cands[:num]
if not isinstance(gallery, np.ndarray):
rand_inds... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose(n, a):\n return torch.as_tensor([a[idx] for idx in torch.randperm(len(a))[:n]])",
"def random_choice(self, gallery, num):\n assert len(gallery) >= num\n\n is_tensor = isinstance(gallery, torch.Tensor)\n if not is_tensor:\n gallery = torch.tensor(\n gal... | [
"0.7213743",
"0.6996495",
"0.67967874",
"0.6734458",
"0.67288697",
"0.6638643",
"0.65710235",
"0.6519574",
"0.65034425",
"0.6474734",
"0.64719534",
"0.6464656",
"0.6456014",
"0.6454468",
"0.64511836",
"0.64262396",
"0.64008296",
"0.63947016",
"0.63861275",
"0.6360542",
"0.635... | 0.7314613 | 0 |
Compute relative change of two values. | def relative_change(nr1, nr2):
return float(((nr2 - nr1) / nr1) * 100) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rel_diff(d1, d2):\n\n if d1 is None or d2 is None:\n return np.NaN\n if pd.isnull(d1) or pd.isnull(d2):\n return np.NaN\n try:\n d1 = float(d1)\n d2 = float(d2)\n except ValueError:\n return np.NaN\n if d1 == 0.0 and d2 == 0.0:\n return 0\n else:\n ... | [
"0.7273567",
"0.7055699",
"0.6770683",
"0.66939694",
"0.658429",
"0.65398806",
"0.6536458",
"0.6536458",
"0.6502795",
"0.63875437",
"0.6384985",
"0.63614756",
"0.6305158",
"0.6296624",
"0.62288874",
"0.6196708",
"0.6192453",
"0.6167494",
"0.6161568",
"0.61473686",
"0.6130195"... | 0.76584566 | 0 |
Get the timestamp of the build of the given job. | def get_build_timestamp(jenkins_url, job_name, build_nr):
timestamp = execute_command(
f"wget -qO- {jenkins_url}/{job_name}/{build_nr}"
)
return datetime.fromtimestamp(timestamp/1000) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_time(self):\n return self.nodes[0].get('infos').get('system_info').get('build_time')",
"def test_get_build_timestamp(self):\n pass",
"def get_git_timestamp(path):\n return int(_run_command(path, 'git log -1 --format=%ct'))",
"def last_build_processed_timestamp(log_file):\n # Get... | [
"0.6845992",
"0.67148995",
"0.662013",
"0.65567636",
"0.6403757",
"0.6346527",
"0.6230922",
"0.61645025",
"0.61568576",
"0.6145711",
"0.61007255",
"0.6096101",
"0.6073304",
"0.6063883",
"0.6058449",
"0.6051982",
"0.605188",
"0.60319495",
"0.60300505",
"0.5987647",
"0.5976673"... | 0.8144381 | 0 |
given a query in the form described in _preprocess_query, return a WHERE clause to be used in the final SPARQL queries | def _extract_where(self, query) :
query = copy.copy(query)
# discard the insert information
if self.n.sparql.insert in query :
del query[self.n.sparql.insert]
# discard the delete information
if self.n.sparql.delete in query :
del query[self.n.sparql.delete]
# build the where clause with outl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_where_clause(**kwds_filter):\n clause = []\n params = []\n items = kwds_filter.items()\n items = sorted(items, key=lambda x: x[0]) # Ordered by key.\n for key, val in items:\n if nonstringiter(val):\n clause.append(key + ' IN (%s)' % (', '.jo... | [
"0.6663203",
"0.6649268",
"0.65774363",
"0.6338004",
"0.61764884",
"0.613863",
"0.6063489",
"0.5993191",
"0.59245485",
"0.59107035",
"0.58890676",
"0.58843476",
"0.5879872",
"0.58626",
"0.58278584",
"0.5785752",
"0.57592607",
"0.57225984",
"0.5706035",
"0.5685944",
"0.5680669... | 0.74677783 | 0 |
Returns the manifests which consist of the Recordings and Supervisions | def prepare_chime6(
corpus_dir: Pathlike,
output_dir: Optional[Pathlike] = None,
dataset_parts: Optional[Union[str, Sequence[str]]] = "all",
mic: str = "mdm",
use_reference_array: bool = False,
perform_array_sync: bool = False,
verify_md5_checksums: bool = False,
num_jobs: int = 1,
n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def child_manifests(self, content_retriever):\n return None",
"def child_manifests(self, content_retriever):\n for manifest in self._parsed[\"manifests\"]:\n mbytes = json.dumps(manifest)\n yield ManifestReference(Bytes.for_string_or_unicode(mbytes))",
"def manifest(self):\n... | [
"0.6537372",
"0.64466304",
"0.62651",
"0.6194912",
"0.61442757",
"0.61442757",
"0.6077873",
"0.6057794",
"0.60380983",
"0.5973996",
"0.58993614",
"0.5888535",
"0.58871734",
"0.5877311",
"0.5748769",
"0.5728829",
"0.57231575",
"0.5655023",
"0.5643392",
"0.5632166",
"0.5599505"... | 0.0 | -1 |
Set config values on any apps instantiated while the context manager is active. This is intended to be used with cli tests where the `current_app` in the test will be different from the `current_app` when the CLI command is invoked, making it very difficult to dynamically set app config variables using mock.patch.dict ... | def app_config_cli(**kwargs):
@signals.config_complete.connect
def set_config(app):
app.config.update(kwargs)
yield | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_config(**kwargs):\n with mock.patch.dict(flask.current_app.config, **kwargs) as mocked_config:\n yield mocked_config",
"def set_config(app):\n # set config from config.py\n app.config.from_object('config')\n\n # override config from secret conf files\n pi_home = os.p... | [
"0.7380696",
"0.662815",
"0.62503123",
"0.624189",
"0.62402946",
"0.6188184",
"0.60459214",
"0.6006841",
"0.5921027",
"0.5848537",
"0.5824186",
"0.58036035",
"0.5767799",
"0.5746091",
"0.5735771",
"0.57351166",
"0.57296777",
"0.57262594",
"0.572297",
"0.5682838",
"0.5643753",... | 0.63925433 | 2 |
Test that an admin cannot fetch non existing certificate by id. | def test_get_non_existing_certificate_by_id(self):
self.client.post(
'/api/v1/certificates', data=json.dumps(new_certificate),
content_type='application/json',
headers=self.get_registrar_token())
response = self.client.get(
'/api/v1/certificates/10', conte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_render_certificate_unavailable(self):\n GeneratedCertificate.objects.create(\n user=self.student, course_id=self.course.id, status=u'unavailable')\n\n url = '{}?is_bigcourse=0'.format(reverse(\n 'completion_data_view', kwargs={\n 'course_id': self.course.... | [
"0.64274144",
"0.6318149",
"0.62549144",
"0.6222371",
"0.62162995",
"0.619847",
"0.615191",
"0.6136755",
"0.6134825",
"0.608852",
"0.602813",
"0.6027242",
"0.60104585",
"0.6001789",
"0.5969251",
"0.5966459",
"0.59632045",
"0.59540206",
"0.58608377",
"0.5858643",
"0.5841868",
... | 0.74964446 | 0 |
Test that an admin can update an existing certificate. | def test_update_certificate(self):
self.client.post(
'/api/v1/certificates', data=json.dumps(new_certificate),
content_type='application/json',
headers=self.get_registrar_token())
response = self.client.put(
'/api/v1/certificates/1', data=json.dumps(update... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_certificate_keys(self):\n self.client.post(\n '/api/v1/certificates', data=json.dumps(new_certificate),\n content_type='application/json',\n headers=self.get_registrar_token())\n response = self.client.put(\n '/api/v1/certificates/1', data=j... | [
"0.7054616",
"0.7029163",
"0.6356074",
"0.62936115",
"0.6286474",
"0.6283409",
"0.6253262",
"0.6218123",
"0.6215605",
"0.6193823",
"0.6167534",
"0.61568356",
"0.6129082",
"0.61176515",
"0.6101566",
"0.6039152",
"0.603341",
"0.6016006",
"0.6011785",
"0.60063463",
"0.5993563",
... | 0.7654876 | 0 |
An admin cannot update a certificate with invalid json keys. | def test_update_certificate_keys(self):
self.client.post(
'/api/v1/certificates', data=json.dumps(new_certificate),
content_type='application/json',
headers=self.get_registrar_token())
response = self.client.put(
'/api/v1/certificates/1', data=json.dumps(u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_non_existing_certificate(self):\n self.client.post(\n '/api/v1/certificates', data=json.dumps(new_certificate),\n content_type='application/json',\n headers=self.get_registrar_token())\n response = self.client.put(\n '/api/v1/certificates/10... | [
"0.6240814",
"0.6011732",
"0.5814165",
"0.5737645",
"0.57368433",
"0.5729594",
"0.56391555",
"0.5591399",
"0.5580593",
"0.5547237",
"0.55115926",
"0.5503743",
"0.5489525",
"0.54853344",
"0.5479121",
"0.5474182",
"0.54696816",
"0.5453102",
"0.5452225",
"0.54473406",
"0.543113"... | 0.6447251 | 0 |
An admin cannot update a certificate with invalid certificate. | def test_update_certificate_name_restrictions(self):
self.client.post(
'/api/v1/certificates', data=json.dumps(new_certificate),
content_type='application/json',
headers=self.get_registrar_token())
response = self.client.put(
'/api/v1/certificates/1',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_non_existing_certificate(self):\n self.client.post(\n '/api/v1/certificates', data=json.dumps(new_certificate),\n content_type='application/json',\n headers=self.get_registrar_token())\n response = self.client.put(\n '/api/v1/certificates/10... | [
"0.6251436",
"0.59158605",
"0.59145105",
"0.59098035",
"0.59098035",
"0.58993655",
"0.58977705",
"0.58977705",
"0.5877514",
"0.5877514",
"0.5877514",
"0.5877514",
"0.5877514",
"0.5877514",
"0.5877514",
"0.5877514",
"0.5877514",
"0.5877514",
"0.5877514",
"0.5877514",
"0.587751... | 0.5537594 | 42 |
Test that an admin can delete xisting certificate. | def test_delete_certificate(self):
self.client.post(
'/api/v1/certificates', data=json.dumps(new_certificate),
content_type='application/json',
headers=self.get_registrar_token())
response = self.client.delete(
'/api/v1/certificates/1', content_type='appli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_security_on_delete(self):\n # test the delete product url\n product = Product.objects.all()[0]\n url = '/product/xml/%s/' % product.item_number\n response = self.client.delete(url)\n self.failUnlessEqual(response.status_code, 401)",
"def test_delete_hyperflex_auto_supp... | [
"0.6972668",
"0.66758305",
"0.6664955",
"0.6595049",
"0.6590523",
"0.6577611",
"0.65708",
"0.64988315",
"0.64986354",
"0.6496917",
"0.6457663",
"0.64508206",
"0.6433555",
"0.6426404",
"0.6408594",
"0.64056116",
"0.6403886",
"0.6364619",
"0.63372344",
"0.6331445",
"0.6313985",... | 0.68777514 | 1 |
Test that an admin cannot delete non existing certificate. | def test_delete_non_existing_certificate(self):
self.client.post(
'/api/v1/certificates', data=json.dumps(new_certificate),
content_type='application/json',
headers=self.get_registrar_token())
response = self.client.delete(
'/api/v1/certificates/10', conte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cannotDeleteNonExistent(self):\n store = Store()\n self.assertFailStatus(\n 1, self._makeConfig(store),\n [\"delete\", \"--port-identifier\", \"12345\"])\n self.assertEqual(\n \"12345 does not identify an item.\\n\",\n sys.stdout.getvalue())... | [
"0.67962366",
"0.6723372",
"0.6659593",
"0.6619923",
"0.65972596",
"0.657681",
"0.65633833",
"0.6552259",
"0.651213",
"0.6509334",
"0.6507103",
"0.6498473",
"0.6415173",
"0.6408652",
"0.6398811",
"0.6370288",
"0.6365619",
"0.63629717",
"0.63573414",
"0.63573414",
"0.6329691",... | 0.70131373 | 0 |
Return a dictionary that tabulates the total number of bases associated with each CIGAR operation. cigar_tuples is a list of (op, length) tuples. | def cigar_profile(cigar_tuples):
cigar_prof = Counter()
for cigar_tuple in cigar_tuples:
cigar_prof[cigar_tuple[0]] += cigar_tuple[1]
return cigar_prof | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aligned_bases(cigar_tuple):\n aligned = 0\n for k, v in cigar_tuple:\n if k in {0, 1, 7, 8}: # query consumed\n aligned += v\n return aligned",
"def operation_counts(self) -> Dict[int, Dict[str, int]]:\n return self._operation_counts",
"def get_gc_count(dataset):\n\n g... | [
"0.6502365",
"0.5866733",
"0.57596207",
"0.5635876",
"0.5561213",
"0.53274745",
"0.5279731",
"0.5266631",
"0.5248991",
"0.52464724",
"0.5245527",
"0.5243623",
"0.52377224",
"0.5230528",
"0.52270555",
"0.5220275",
"0.5216741",
"0.5211988",
"0.51739013",
"0.5160424",
"0.5160424... | 0.6731021 | 0 |
Replace all contiguous linebreaking whitespaces with a single newline and all contiguous nonbreaking whitespaces with a single space, then strip any leading/trailing whitespace. | def normalize_whitespace(text):
return RE_NONBREAKING_SPACE.sub(" ", RE_LINEBREAK.sub(r"\n", text)).strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_newline_with_space(text):\n return re.sub(\"[\\n\\r]\", \" \", text)",
"def reduceBlank(text, keepNewLines=False):\n if text is None:\n return None\n text = text.strip()\n if not keepNewLines:\n return re.sub(r'\\s+', ' ', text)\n else:\n text = re.sub(r'\\r', '\\n... | [
"0.6854356",
"0.6823087",
"0.67730033",
"0.67649937",
"0.6722138",
"0.6706264",
"0.6665644",
"0.6614612",
"0.65361094",
"0.6527427",
"0.6464306",
"0.64546555",
"0.64450604",
"0.64145744",
"0.63598585",
"0.63453203",
"0.6327522",
"0.62979907",
"0.6285979",
"0.6271923",
"0.6270... | 0.75504297 | 0 |
Test default product price being 10. | def test_default_product_price(self):
prod = Product('Test Product')
self.assertEqual(prod.price, 10)
self.assertEqual(prod.weight, 20)
self.assertEqual(prod.flammability, 0.5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_default_product_price(self):\n prod = Product('Test Product')\n self.assertEqual(prod.price, 10)",
"def test_default_product_price(self):\n prod = Product('Test Product')\n self.assertEqual(prod.price, 10)",
"def test_default_product_price(self):\n prod = Product('Te... | [
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.8738257",
"0.87333673",
"0.8610413",
"0.7287374",
"0.72686666",
"0.72686666",
"0.72686666",
"0.72686666",
"0.72686666",
"0.72686666",
"0.726349... | 0.8580199 | 13 |
Returns 1 if gene mutated, 0 otherwise. Calls the mutator.evaluate() function to mutate the gene mutation_rate of the time. Otherwise, it does nothing. | def mutate(self):
#inlined 'flip_coin' for speed
if prng.random() < self.mutation_rate:
self._value = self.mutator.evaluate(self)
return 1
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mutate(self):\n if self.mutator.evaluate(self):\n self.evaluated = 0\n return 1\n return 0",
"def evaluate ( self, mutation ) :\n\t\tif isinstance( mutation , Mutation ):\n\t\t\tmutation = mutation.to_int()\n\n\t\tassert type( mutation ) is int , 'mutation must work out to... | [
"0.7566329",
"0.63208675",
"0.62871164",
"0.62117493",
"0.573093",
"0.57175344",
"0.5716445",
"0.5573231",
"0.5536494",
"0.55165726",
"0.551499",
"0.54927176",
"0.54775554",
"0.54382527",
"0.54232645",
"0.5395253",
"0.5391917",
"0.534778",
"0.5339351",
"0.53308773",
"0.532733... | 0.6896737 | 1 |
Gets collection export flag. | def export(self):
return self._export | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_exported(self):\r\n # TODO(John Sirois): fixup predicate dipping down into details here.\r\n return self.has_label('exportable') and self.provides",
"def exports(self):\n return ExportsCollection(client=self)",
"def export_data(self):\n return self.export_all_data()",
"def has_expo... | [
"0.6568305",
"0.609754",
"0.5942965",
"0.5855902",
"0.5798418",
"0.57834804",
"0.57816774",
"0.57271445",
"0.5693246",
"0.5640451",
"0.5613568",
"0.5607582",
"0.5590797",
"0.5561627",
"0.55341643",
"0.5484509",
"0.5443088",
"0.54322183",
"0.5383823",
"0.53817964",
"0.53802633... | 0.75006425 | 0 |
Gets related articles count. | def count(self):
return self._count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_article_count(cls):\n return int(cls.db.get(\"article_count\"))",
"def num_articles(self):\n\t\treturn len(index)",
"def associated_object_count(self):\n return self._associated_object_count",
"def relationship_count(self, r_type=None, n_ids=()):\n if r_type is None and not n_ids... | [
"0.7154706",
"0.663265",
"0.6537293",
"0.63641524",
"0.63513917",
"0.62496364",
"0.61724013",
"0.61484754",
"0.614221",
"0.60625917",
"0.6040069",
"0.60235864",
"0.6012086",
"0.6002876",
"0.5956758",
"0.59546256",
"0.5944007",
"0.5923282",
"0.59052104",
"0.5894721",
"0.588828... | 0.5464256 | 67 |
Generate a random string of letters and digits | def randomStringDigits(stringLength:int=4)->str:
lettersAndDigits = string.ascii_letters + string.digits
return ''.join(random.choice(lettersAndDigits) for i in range(stringLength)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand_string():\n out = ''\n for _ in range(24):\n out += choice(ascii_letters)\n return out",
"def get_random_alphanumeric_string():\n return get_random_string(char_choice=string.ascii_letters + string.digits)",
"def gen_rand_str(n):\n return \"\".join(random.choice(string.ascii_l... | [
"0.86016387",
"0.84852463",
"0.8366202",
"0.83620757",
"0.83602",
"0.8158604",
"0.8123532",
"0.81143093",
"0.8089975",
"0.80873764",
"0.8011259",
"0.7957295",
"0.79525083",
"0.794848",
"0.7927194",
"0.79182523",
"0.7897885",
"0.788374",
"0.787901",
"0.7854035",
"0.78254104",
... | 0.77352375 | 28 |
Returns a dictionary of variables to put in the template context for every page in the admin site. For sites running on a subpath, use the SCRIPT_NAME value if site_url hasn't been customized. | def each_context(self, request):
script_name = request.META['SCRIPT_NAME']
site_url = script_name if self.site_url == '/' and script_name else self.site_url
# 把用户的groupID传给template
# if Group.objects.filter(id = request.user.id):
# group_context = Group.objects.get(id = reque... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_context_data(self) -> dict:\n return {\n \"site\": getattr(self, \"site\")\n }",
"def extra_context(self):\n from django.conf import settings\n\n return {\n \"site_name\": (lambda r: settings.LEONARDO_SITE_NAME\n if getattr(settin... | [
"0.7044585",
"0.67757916",
"0.65934604",
"0.64145476",
"0.61818314",
"0.61569166",
"0.6140505",
"0.61285424",
"0.6073698",
"0.6058714",
"0.602411",
"0.60085976",
"0.57847315",
"0.57816535",
"0.5754466",
"0.5743778",
"0.5737129",
"0.56683666",
"0.56512374",
"0.56231827",
"0.56... | 0.60478675 | 10 |
Returns an "VG" (voltage generator) object | def parse_VG(self, line: str):
# VG node1 node2 __value
# VG name node1 node2 __value
name, node1, node2, value = self.parse_two_node_component(line,"v")
return IComponent.VG(node1, node2, value, name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_voltage(self):\n print(\"voici le voltage de la batterie\")",
"def get_V(self):\n return self.V",
"def get_voltage(self):\n self._raise_not_implemented()",
"def voltage_conversion(self):\r\n\t\tvoltage = ((self.data[0] * 256 + self.data[1]) / 65536.0) * 5.0\r\n\t\t\r\n\t\treturn ... | [
"0.6555433",
"0.6370294",
"0.6279307",
"0.6251481",
"0.62506336",
"0.6182915",
"0.6141808",
"0.6084164",
"0.60806507",
"0.60197353",
"0.5917127",
"0.587498",
"0.587498",
"0.587498",
"0.5848542",
"0.58464164",
"0.5816219",
"0.57617956",
"0.57617956",
"0.57617956",
"0.5754263",... | 0.6874309 | 0 |
Try to parse "line" as a voltage constant. If successful, the voltage constant is added to "self.voltage_constant". Returns a "success" flag. | def try_parse_as_voltage_constant(self, line: str):
tokens = line.split()
if len(tokens) != 3: return False
if tokens[1] != "=": return False
value = tokens[2]
value = self.remove_ending(value, "v")
value = self.parse_float_value(value)
self.voltage_constants[to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_v_option(self, line):\n if self._regex_helper.search_compiled(W._re_v_option, line):\n self.current_ret['RESULT'].append(self._regex_helper.group(\"V_OPTION\"))\n raise ParsingDone",
"def parse_vcf_line(line):\n\n if isinstance(line, str):\n if line.startswith('#... | [
"0.60203934",
"0.5824009",
"0.57243997",
"0.55141276",
"0.54185677",
"0.53943354",
"0.5375406",
"0.5338152",
"0.52791095",
"0.5251537",
"0.5244117",
"0.5189016",
"0.51851827",
"0.51705515",
"0.5132196",
"0.5131979",
"0.5088357",
"0.50816154",
"0.505076",
"0.5028643",
"0.50242... | 0.84792286 | 0 |
String representation of a particle. | def __repr__(self):
return "<InfectionSim Particle at: x={:.2f}, y={:.2f}>".format(self._x, self._y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\r\n ids = '\"particle_id\":' + str(self.particle_id) \r\n sizes = '\"size\":' + str(self.size)\r\n \r\n curfit = '\"current_fitness\":' + str(self.current_fitness)\r\n str_vals = \",\".join([str(v) for v in self.values])\r\n vals = '\"values\":['... | [
"0.75733525",
"0.7243114",
"0.7234177",
"0.7187854",
"0.7007811",
"0.6887691",
"0.67035365",
"0.6658763",
"0.6655783",
"0.6609124",
"0.66043884",
"0.65765965",
"0.6569645",
"0.65584147",
"0.6461166",
"0.64587766",
"0.6458517",
"0.64413023",
"0.64056456",
"0.64028347",
"0.6389... | 0.6923364 | 5 |
Getter for x coordinate of a particle. Returns float The x coordinate of a particle. | def x(self):
return self._x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getXCoordinate(self) -> float:\n return self.x_coord",
"def _get_x(self):\n return self.position.x",
"def Getxcoord(self):\n return self.x_coord",
"def get_x(self):\n return self.posX",
"def get_x(self) -> int:\n return self.__x",
"def get_pos_x(self):\n retu... | [
"0.7762516",
"0.7739218",
"0.7664077",
"0.76350003",
"0.75767094",
"0.75285286",
"0.74838805",
"0.7463313",
"0.7393887",
"0.73738706",
"0.73524827",
"0.7339402",
"0.73068553",
"0.7292453",
"0.72899973",
"0.72432137",
"0.7230601",
"0.7213645",
"0.7204912",
"0.7196008",
"0.7164... | 0.69391704 | 38 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.