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 |
|---|---|---|---|---|---|---|
Density of the excess logreturn. | def density(self, arg):
out = 0
for weight, mean, std in zip(self.weights, self.means, self.stds):
scale = std * self.data['maturity']**.5
loc = ((mean - self.data['riskfree']) *
self.data['maturity'] - scale**2)
out += weight * scs.norm(loc, scale)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weighted_log_density(self):\n return self.rho*math.log(self.density)",
"def density( self ) :\n return self.__density",
"def density( self ) :\n return self.__density",
"def density( self ) :\n return self.__density",
"def density(self, arg):\n return self.gb2_density... | [
"0.72120595",
"0.68245167",
"0.68245167",
"0.68245167",
"0.6793508",
"0.6786592",
"0.6729758",
"0.6675245",
"0.6600844",
"0.65504026",
"0.6527812",
"0.6521712",
"0.6504028",
"0.6493991",
"0.6492609",
"0.6469018",
"0.643575",
"0.643467",
"0.64329064",
"0.6415614",
"0.6415313",... | 0.646606 | 16 |
Density of the excess logreturn. | def density(self, arg):
return self.gb2_density(np.exp(arg)) * np.exp(arg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weighted_log_density(self):\n return self.rho*math.log(self.density)",
"def density( self ) :\n return self.__density",
"def density( self ) :\n return self.__density",
"def density( self ) :\n return self.__density",
"def density(self):\n return self.get_density()",
... | [
"0.72120595",
"0.68245167",
"0.68245167",
"0.68245167",
"0.6786592",
"0.6729758",
"0.6675245",
"0.6600844",
"0.65504026",
"0.6527812",
"0.6521712",
"0.6504028",
"0.6493991",
"0.6492609",
"0.6469018",
"0.646606",
"0.643575",
"0.643467",
"0.64329064",
"0.6415614",
"0.6415313",
... | 0.6793508 | 4 |
Constructor method for a Response object. Accepts the message for this Response as a list or a string delimited by newlines. If there are no newlines, there will be only one item in the list of messages. | def __init__(self, messages=[], channel=None, private=False, \
general=False):
# If a string is passed
if messages is not None and isinstance(messages, str):
self.messages = messages.split('\n')
# If an iterable (list or tuple) is passed
elif messages is n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, message, code=None, params=None):\n super().__init__(message, code, params)\n\n if isinstance(message, ValidationError):\n if hasattr(message, 'error_dict'):\n message = message.error_dict\n elif not hasattr(message, 'message'):\n ... | [
"0.6023739",
"0.5977194",
"0.5977194",
"0.5977194",
"0.5977194",
"0.5977194",
"0.5977194",
"0.5977194",
"0.5977194",
"0.5977194",
"0.5977194",
"0.5922528",
"0.5922528",
"0.5922528",
"0.5896377",
"0.5851084",
"0.5851084",
"0.5820525",
"0.5820525",
"0.5820525",
"0.58169156",
... | 0.60938567 | 0 |
Return some 'about' information about the receiving bot. | def do_about(bot, msg, **kwargs):
channel = kwargs.get('event').get('channel')
return bot.post_msg(
text=bot.about,
channel_name_or_id=channel
)
return Response(bot.about) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def about(ctx):\n await ctx.send(get_about())",
"async def about(self, ctx):\n self.log_command_call(\"about\", ctx.message)\n embed = create_embed(description=ABOUT_TEXT)\n await ctx.send(embed=embed)",
"def on_bot_about(update, _context):\n update.message.reply_text(c.MSG... | [
"0.8156768",
"0.7781923",
"0.77351594",
"0.76259816",
"0.7500717",
"0.74436533",
"0.73946726",
"0.7337333",
"0.7313444",
"0.72523534",
"0.7102812",
"0.7102812",
"0.7102812",
"0.7102812",
"0.708492",
"0.70239246",
"0.6979883",
"0.6947882",
"0.69359815",
"0.6934634",
"0.6921833... | 0.72978705 | 9 |
Compute the sigmoid of z | def sigmoid(z):
return 1 / (1 + np.exp(-z)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(z):\r\n \r\n return vSigmoid(z);",
"def sigmoid(z): \n return 1/(1 + np.e**(-z))",
"def sigmoid(z):\r\n \r\n return 1.0 / (1.0+np.exp(-z))",
"def sigmoid(z):\n return 1 / (1 + e ** -z)",
"def sigmoid(z):\n return 1 / (1 + np.exp(-1 * z))",
"def sigmoid(self, z):\n ... | [
"0.9236619",
"0.91155094",
"0.9034886",
"0.9032656",
"0.8983236",
"0.8982324",
"0.89819604",
"0.8936817",
"0.89279467",
"0.8925133",
"0.8906126",
"0.8891459",
"0.88882077",
"0.8875157",
"0.8872043",
"0.88688284",
"0.886221",
"0.8861199",
"0.8856525",
"0.8849176",
"0.88454694"... | 0.8958828 | 7 |
This function creates a vector of zeros of shape (dim, 1) for w and initializes b to 0. | def initalize_with_zeros(dim):
return np.zeros((dim, 1)), 0.0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_with_zeros(dim):\n\n w = np.zeros((dim, 1))\n b = 0\n\n return w, b",
"def initialize_with_zeros(dim):\n \n w = np.zeros([dim, 1])\n b = 0;\n\n assert(w.shape == (dim, 1))\n assert(isinstance(b, float) or isinstance(b, int));\n \n return w,b;",
"def initialize_with_... | [
"0.78012246",
"0.7478178",
"0.7351045",
"0.72399867",
"0.71295863",
"0.66360754",
"0.66139257",
"0.656628",
"0.65285116",
"0.6507213",
"0.6424684",
"0.64066786",
"0.6385103",
"0.6334508",
"0.6271382",
"0.6271382",
"0.6271382",
"0.6232449",
"0.62184626",
"0.6200041",
"0.618950... | 0.63816994 | 13 |
Create 3 buttons that do nothign | def create_widgets(self):
#create first button, text and entry
self.instruction= Label(self, text= "Enter the coordinate:")
self.instruction.grid(row=1, column=0, columnspan=1, sticky=W)
self.instruction= Label(self, text= "Enter the angle:")
self.instruction.grid(row... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_widgets (self):\r\n # create first button\r\n self.bttn1 = Button (self, text = \"I do nothing!\")\r\n self.bttn1.grid ()\r\n\r\n # create a second button\r\n self.bttn2 = Button (self)\r\n self.bttn2.grid ()\r\n self.bttn2.configure (text = \"Me too\")\r... | [
"0.7081937",
"0.685006",
"0.68265283",
"0.6785195",
"0.6702143",
"0.6511683",
"0.64974284",
"0.64726174",
"0.6466355",
"0.6446806",
"0.64317375",
"0.632589",
"0.63232225",
"0.631675",
"0.6291543",
"0.6248276",
"0.6227935",
"0.6216295",
"0.61619437",
"0.6159674",
"0.61350095",... | 0.0 | -1 |
Read a player's name and capitalize it. This is because in some cases the last name is all capital and in others isn't and we'd rather have homogeneity. | def _capitalize_name(player_name: str) -> str:
# Remove accents and replace final sigmas with normal ones
player_name = player_name.translate(
str.maketrans(
{
"ά": "α",
"Ά": "α",
"έ": "ε",
"Έ": "ε",
"ί": "ι",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name_from_player(player):\r\n return player.name.lower()",
"def get_player_name():\n\n player = list(input(\"\\nEnter the name of the Football player: \").split(\" \"))\n player_name = \" \".join([i.capitalize() for i in player])\n return player_name",
"def capitalize_name(name):\n r... | [
"0.75361437",
"0.7001578",
"0.6987452",
"0.67938644",
"0.66436344",
"0.66173077",
"0.6616807",
"0.6591922",
"0.6521228",
"0.64590204",
"0.63868755",
"0.638252",
"0.63158727",
"0.62886333",
"0.6256583",
"0.62480116",
"0.6217644",
"0.6161444",
"0.6157898",
"0.6148962",
"0.61360... | 0.77338487 | 0 |
Implement the linear portion of backward propogation for a single layer (layer l) | def linear_backward(dZ, cache):
A_prev, W, b = cache
m = A_prev.shape[1]
dW = np.dot(dZ, cache[0].T) / m
db = np.sum(dZ, axis=1, keepdims=True)/m
dA_prev = np.dot(cache[1].T, dZ)
return dA_prev, dW, db | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def L_model_backward(AL, Y, caches):\n pass",
"def backward(self, X, Y, P, H, lmd):\n G = - (Y - P)\n _, Npts = P.shape\n n_layers = len(self.hidden_units)\n\n gradients_W = []\n gradients_b = []\n\n for i in range(n_layers, -1, -1):\n\n if i == 0:\n ... | [
"0.7440683",
"0.7384462",
"0.729791",
"0.7239661",
"0.7239661",
"0.72010136",
"0.72010136",
"0.7151086",
"0.71375775",
"0.7077656",
"0.7072655",
"0.7069114",
"0.7058614",
"0.70492136",
"0.7039029",
"0.7026553",
"0.70153105",
"0.70044154",
"0.70027673",
"0.6986541",
"0.6963999... | 0.0 | -1 |
Test that token expires if created with a lifespan. | def test_issue_token_with_lifespan(self, demo_app):
demo_app.config.get.return_value = self.jwt_key
token_lifespan = 5
token = issue_token(self.demo_user, lifespan=token_lifespan)
decoded_token = jwt.decode(token, self.jwt_key, algorithms=['HS256'])
expires_at_delta = dt.fromtim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_expires_soon(self):\n now = timezone.now()\n window = SparkSettings().RENEW_TOKEN_WINDOW\n cur = self.factory.build(access_token='good',\n expires_at=now + timedelta(seconds=window*2))\n exp = self.factory.build(access_token='expired',\n expires_at=now + t... | [
"0.8003865",
"0.7231773",
"0.7224704",
"0.7223535",
"0.7162222",
"0.702813",
"0.6973144",
"0.6959247",
"0.69123054",
"0.69020456",
"0.6861596",
"0.6839448",
"0.6773002",
"0.6771432",
"0.6733086",
"0.671016",
"0.6703048",
"0.6694169",
"0.6688207",
"0.66711783",
"0.66647714",
... | 0.7792608 | 1 |
Changes "shop_link" in request.data to "shop_id" for correct creating a new review | def create(self, request, *args, **kwargs):
request.data["shop"] = 1
self.is_review_body_valid(self.get_serializer(data=request.data)) # checks if body data is valid
shop_pk = self.get_shop_pk(request.data.pop("shop_link"))
request.data["shop"] = shop_pk
return super().create(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partial_update(self, request, *args, **kwargs):\n self.is_review_body_valid(self.get_serializer(instance=self.get_object(), data=request.data, partial=True))\n\n if \"shop_link\" in request.data:\n shop_pk = self.get_shop_pk(request.data.pop(\"shop_link\"))\n request.data[\"... | [
"0.7198662",
"0.59701",
"0.57086706",
"0.56301343",
"0.56281805",
"0.5614945",
"0.56111664",
"0.5586684",
"0.55550456",
"0.535396",
"0.5292519",
"0.52822477",
"0.52801126",
"0.5274679",
"0.52690446",
"0.5262116",
"0.5260945",
"0.5229866",
"0.519909",
"0.518952",
"0.51765454",... | 0.79764706 | 0 |
Set logger handler formatters to more detail | def set_verbose_logger_handlers():
# type: (None) -> None
global _REGISTERED_LOGGER_HANDLERS
formatter = logging.Formatter(
'%(asctime)s %(levelname)s %(name)s:%(funcName)s:%(lineno)d '
'%(message)s')
formatter.default_msec_format = '%s.%03d'
for handler in _REGISTERED_LOGGER_HANDLER... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customize_handler(handler, level, fmt=None, datefmt=None):\n # Configureer log level\n handler.setLevel(lvl_name2num(level))\n # Formatering aanpassen, indien gewenst.\n if fmt or datefmt:\n handler.setFormatter(logging.Formatter(fmt=fmt, datefmt=datefmt))\n\n return handler",
"def setF... | [
"0.71689266",
"0.6762195",
"0.65436065",
"0.64850795",
"0.64420956",
"0.63474387",
"0.6331625",
"0.62768936",
"0.6264181",
"0.6162416",
"0.6134119",
"0.6085435",
"0.6075838",
"0.6041576",
"0.60070366",
"0.5973959",
"0.5960657",
"0.5929936",
"0.5926057",
"0.58723277",
"0.58580... | 0.7471824 | 0 |
Convert a time delta to string | def convert_timedelta_to_string(td):
# type: (datetime.timedelta) -> str
days = td.days
hours = td.seconds // 3600
minutes = (td.seconds - (hours * 3600)) // 60
seconds = (td.seconds - (hours * 3600) - (minutes * 60))
return '{0}.{1:02d}:{2:02d}:{3:02d}'.format(days, hours, minutes, seconds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_str(delta, extended=False):\n\n total_seconds = delta.total_seconds()\n sign = \"-\" if total_seconds < 0 else \"\"\n nanoseconds = abs(total_seconds * _second_size)\n\n if total_seconds < 1:\n result_str = _to_str_small(nanoseconds, extended)\n else:\n result_str = _to_str_larg... | [
"0.7691549",
"0.75151044",
"0.7304691",
"0.72016037",
"0.7197249",
"0.7166316",
"0.69835144",
"0.6980241",
"0.6967261",
"0.6894169",
"0.68748504",
"0.68033403",
"0.6599179",
"0.6587508",
"0.65690595",
"0.65609056",
"0.6499395",
"0.6497562",
"0.64483225",
"0.64082533",
"0.6380... | 0.7317106 | 2 |
performs forward propagation over a pooling layer of a neural network. | def pool_forward(A_prev, kernel_shape,
stride=(1, 1), mode='max'):
m, h_prev, w_prev, c_prev = A_prev.shape
kh, kw = kernel_shape
sh, sw = stride
h_out = int((h_prev - kh) / sh) + 1
w_out = int((w_prev - kw) / sw) + 1
result = np.zeros((m, h_out, w_out, c_prev))
for i in r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n\n ########################\n # PUT YOUR CODE HERE #\n #######################\n\n x = self.pool1(F.relu(self.batch1(self.conv1(x))))\n x = self.pool2(F.relu(self.batch2(self.conv2(x))))\n x = F.relu(self.batch3a(self.conv3a(x)))\n x = self.pool3(F.relu(self.batch3b(sel... | [
"0.73700315",
"0.7133852",
"0.69845796",
"0.6968901",
"0.69477034",
"0.6927371",
"0.6896324",
"0.686536",
"0.6840059",
"0.68128806",
"0.67942584",
"0.6736299",
"0.66871786",
"0.6664562",
"0.65940136",
"0.65714574",
"0.6540853",
"0.6501088",
"0.64844966",
"0.64775",
"0.6456493... | 0.0 | -1 |
Choose the sort key we want to sort the portfolio lines by. Currently | def choose_sort_key(self):
global st_sort_key
global st_reverse_sort
sort_choices = [
('*Reverse*', None),
('Company name', stock.stock_key_name),
('Symbol', stock.stock_key_symb),
('Price', stock.stock_key_price),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_key(self):\n ...",
"def get_sort_key(self) -> str:\n return self.name",
"def sortby(self):\n ...",
"def sort(self, key_func):\n pass",
"def _grokker_sort_key(args):\n grokker, name, obj = args\n return priority.bind().get(grokker)",
"def sort_by_key(request):\n ... | [
"0.7052524",
"0.6501221",
"0.63978255",
"0.62778497",
"0.6256185",
"0.62520903",
"0.62520903",
"0.61341333",
"0.61310095",
"0.6046769",
"0.5901825",
"0.58833677",
"0.58403766",
"0.58182645",
"0.58182645",
"0.5779664",
"0.57475245",
"0.5711865",
"0.5706269",
"0.5696067",
"0.56... | 0.75692844 | 0 |
Create a router for the given routes.Mapper. | def __init__(self, mapper):
self.map = mapper
self._router = routes.middleware.RoutesMiddleware(self._dispatch,
self.map) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_routes():\n app_dir = os.path.dirname(os.path.abspath(__file__))\n controller_dir = os.path.join(app_dir, \"controllers\")\n routes = Mapper(directory=controller_dir)\n routes.connect(\"/\", controller=\"root\", action=\"index\")\n routes.connect(\"/body\", controller=\"root\", action=\"b... | [
"0.7023898",
"0.6869352",
"0.66960704",
"0.6558765",
"0.64088094",
"0.63834226",
"0.587372",
"0.58555704",
"0.5838836",
"0.5764172",
"0.5761036",
"0.575769",
"0.5736574",
"0.5709458",
"0.567898",
"0.56059575",
"0.5597138",
"0.5596471",
"0.5513991",
"0.55032444",
"0.54882777",... | 0.7157107 | 0 |
Render the home page | def home():
# netgear_dict = get_netgear()
# print(netgear_dict)
# opacity_list = parse_activity(name_list, netgear_dict)
opacity_list = [0.2, 1, 1, 0.2, 0.2, 1]
return render_template('image_column.html', name_list=name_list, opacity_list=opacity_list) | {
"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\")",
"... | [
"0.88861233",
"0.8787603",
"0.86562115",
"0.86191314",
"0.86191314",
"0.8614767",
"0.8614767",
"0.8614767",
"0.8614767",
"0.8614767",
"0.8614767",
"0.8614767",
"0.8614767",
"0.8614767",
"0.8614767",
"0.8614767",
"0.8614767",
"0.8614767",
"0.8614767",
"0.8614767",
"0.8614767",... | 0.0 | -1 |
Generate random colors. To get visually distinct colors, generate them in HSV space then convert to RGB. | def random_colors(N, bright=True):
import random
import colorsys
brightness = 1.0 if bright else 0.7
hsv = [(i / N, 1, brightness) for i in range(N)]
colors = list(map(lambda c: colorsys.hsv_to_rgb(*c), hsv))
random.shuffle(colors)
return colors | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_color_gen():\n r = randint(0, 255)\n g = randint(0, 255)\n b = randint(0, 255)\n return [r, g, b]",
"def _genRandomColor():\n b = random.randint(0, 255)\n g = random.randint(0, 255)\n r = random.randint(0, 255)\n return (b, g, r)",
"def random_color():\n colormode(255)\n ... | [
"0.8128756",
"0.78736025",
"0.7786323",
"0.77311784",
"0.7633641",
"0.7620811",
"0.7485008",
"0.7479369",
"0.7455557",
"0.7444552",
"0.7443401",
"0.7426783",
"0.7409864",
"0.7372669",
"0.73647994",
"0.73537195",
"0.73405766",
"0.73217314",
"0.73217314",
"0.73217314",
"0.73109... | 0.7226809 | 25 |
Return a list of course IDs for the upcoming semester. | def upcoming_courses(aud):
courses = [c for c in aud.all_courses() if c.grade == u"*"]
return [c.number.replace("-", "") for c in courses] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def course_id_list(self):\r\n\r\n return self.q(css='article.course').attrs('id')",
"def get_course_ids(self):\n if not self.is_course_based_activity():\n raise IllegalState()\n else:\n raise Unimplemented()",
"def upcoming_courseware(self):\n return self._get_... | [
"0.6218833",
"0.61838824",
"0.609287",
"0.6060006",
"0.5918039",
"0.58484346",
"0.5699076",
"0.56756824",
"0.5641684",
"0.5641338",
"0.5583118",
"0.552976",
"0.5502461",
"0.54907316",
"0.54665095",
"0.54661846",
"0.5464113",
"0.5462014",
"0.54143274",
"0.5380028",
"0.53710335... | 0.72253984 | 0 |
Parse a CMU course ID into a (department, id) tuple. | def parse_cid(cid):
cid = str(cid).replace("-", "").replace(" ", "").strip()
if len(cid) == 5:
return (cid[0:2], cid[2:])
else:
raise ValueError("This course ID doesn't seem to be valid.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_course_id_from_string(input_str):\r\n m_obj = re.match(r'^/courses/(?P<course_id>[^/]+/[^/]+/[^/]+)', input_str)\r\n if m_obj:\r\n return SlashSeparatedCourseKey.from_deprecated_string(m_obj.group('course_id'))\r\n return None",
"def parseID(uid):\n\n info = uid.split('_')\n if l... | [
"0.6423882",
"0.5985733",
"0.5829611",
"0.58085406",
"0.57251686",
"0.56412953",
"0.5576377",
"0.550577",
"0.54963386",
"0.5453895",
"0.54266894",
"0.53801763",
"0.5341064",
"0.52951074",
"0.5286758",
"0.52713245",
"0.52656317",
"0.51245207",
"0.5118386",
"0.51158285",
"0.508... | 0.66632795 | 0 |
Compares two Points and returns true if they are identical with some tolerance | def __comparing_points(self, point1, point2) -> bool:
return (abs(point1.x - point2.x) <= self.dirt_pos_tolerance and abs(
point1.y - point2.y) <= self.dirt_pos_tolerance) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _point_almost_equal(a,b, rtol=RTOL, atol=ATOL):\n return np.allclose(a._Point__loc, b._Point__loc,\n rtol=rtol, atol=atol)",
"def equal_points_2d(p1, p2, tol=None):\r\n if tol is None:\r\n tol = get_tol_2d()\r\n return geometry.gmEqualPointsXY(p1, p2, tol)",
"def _same... | [
"0.7232852",
"0.71239626",
"0.71057725",
"0.7054649",
"0.70429534",
"0.6997437",
"0.6924357",
"0.6901927",
"0.6901",
"0.6880455",
"0.68717444",
"0.68522775",
"0.68408144",
"0.6834082",
"0.68325925",
"0.6825637",
"0.6825637",
"0.6808248",
"0.6749902",
"0.67284614",
"0.66994363... | 0.7222283 | 1 |
Goes through the list with all currently active dirt positions and compare their positions with the given position. Returns true if there is a duplicate, false otherwise | def __check_for_duplicates(self, point) -> bool:
# Check all already published (active) dirt objects (stored and received from the goal_list)
for dirt in self.active_dirt_list:
if self.__comparing_points(point, dirt.pose.position):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains_duplicate(self, nums: List[int]) -> bool:\n if not nums:\n return\n\n nums.sort()\n\n if len(nums) == 1:\n return False\n\n for i in range(1, len(nums)):\n if nums[i - 1] == nums[i]:\n return True\n return False",
"de... | [
"0.6694221",
"0.6524081",
"0.65155137",
"0.6475332",
"0.6465864",
"0.64589274",
"0.635829",
"0.63337564",
"0.62699836",
"0.62448794",
"0.6240183",
"0.6176378",
"0.615864",
"0.6155054",
"0.61399794",
"0.61388814",
"0.61313164",
"0.61244154",
"0.61045456",
"0.60540295",
"0.6009... | 0.6909019 | 0 |
Get the front element. | def peek(self) -> int:
self._maybe_prepare_output_stack()
return self._output_stack[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass",
"def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1",
"def front(self):\n return self.queue[0] if not self.empty() else None",
"def peek_front(... | [
"0.82009244",
"0.79261875",
"0.7852642",
"0.7791182",
"0.77886623",
"0.75723046",
"0.752337",
"0.7510604",
"0.7478953",
"0.7379256",
"0.7379256",
"0.734284",
"0.7323573",
"0.7320296",
"0.7291721",
"0.72772557",
"0.7269801",
"0.72657627",
"0.7253295",
"0.72355044",
"0.72213495... | 0.0 | -1 |
Returns whether the queue is empty. | def empty(self) -> bool:
return not self._input_stack and not self._output_stack | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return self.queue == []",
"def ... | [
"0.9270249",
"0.92506766",
"0.923635",
"0.923635",
"0.9155843",
"0.9098441",
"0.9095006",
"0.90922606",
"0.90731245",
"0.9053733",
"0.89205354",
"0.89137155",
"0.8877591",
"0.88436323",
"0.88436323",
"0.8835949",
"0.88038146",
"0.8758203",
"0.87577534",
"0.87310195",
"0.86462... | 0.0 | -1 |
Create a fully connected block using batchnorm and drop out | def _fc_block(x: tf.Tensor, size: int, is_training: bool, drop: float) -> tf.Tensor:
x = tf.layers.Dense(size)(x)
x = tf.layers.BatchNormalization(fused=True)(x, training=is_training)
x = tf.nn.relu(x)
return tf.layers.Dropout(drop)(x, training=is_training) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dense_block(x, blocks, name, train_bn):\r\n for i in range(blocks):\r\n x = conv_block(x, 32, name=name + '_block' + str(i + 1), train_bn=train_bn)\r\n return x",
"def _block(args: ClusterArgs, input_dim: int) -> layers.Bijector:\n _chain: List[layers.Bijector] = []\n\n if args.inn_idf:\n ... | [
"0.6271609",
"0.61306036",
"0.6052186",
"0.60343176",
"0.599642",
"0.59929305",
"0.5979621",
"0.5975054",
"0.5974282",
"0.59710467",
"0.59595454",
"0.59558755",
"0.5933715",
"0.59171337",
"0.59017724",
"0.5894955",
"0.589008",
"0.5879468",
"0.58715796",
"0.58715796",
"0.58540... | 0.6173162 | 1 |
Load items from json file. | def import_items_from_json(dump_file, include, rectype="item"):
dump_file = dump_file[0]
model, provider = model_provider_by_rectype(rectype)
include_ids = None if include is None else include.split(',')
with click.progressbar(json.load(dump_file)) as bar:
records = []
for record in bar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_json(self, file):\n with open(file, 'r', encoding=\"utf8\") as f:\n self.extend(json.load(f))",
"def load(self):\n with io.open(self.filename, encoding='utf-8') as f:\n self.load_from_dict(json.loads(f.read()))",
"def _load(self):\n if self.file_path.exists()... | [
"0.75328845",
"0.7418431",
"0.7185172",
"0.71537507",
"0.71310943",
"0.70105064",
"0.696814",
"0.6912122",
"0.6889786",
"0.6877131",
"0.6866726",
"0.6857608",
"0.6828659",
"0.6813657",
"0.6812976",
"0.68036",
"0.6801784",
"0.6795707",
"0.6795707",
"0.6777026",
"0.67762417",
... | 0.0 | -1 |
Checks if two GridPegSolitairePuzzles are the same | def __eq__(self, other):
return (type(self) == type(other) and self._marker == other._marker and
self._marker_set == other._marker_set) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compareGrids(grid1, grid2):\n if axis_utils.areAxesIdentical(grid1.getLatitude(),\n grid2.getLatitude(), check_id=False)==False:\n return False\n if axis_utils.areAxesIdentical(grid1.getLongitude(),\n grid2.getLongitude(), check_i... | [
"0.67458224",
"0.67253697",
"0.6711307",
"0.6679304",
"0.65995824",
"0.6593252",
"0.6591636",
"0.6559211",
"0.65542746",
"0.6468737",
"0.64499635",
"0.64444107",
"0.6321164",
"0.62916327",
"0.6283498",
"0.6276327",
"0.62228435",
"0.6199649",
"0.619942",
"0.619942",
"0.6193514... | 0.0 | -1 |
Overrides Puzzle.is_solved() Returns if it has reached solved configuration. A configuration is solved when there is exactly one "" left | def is_solved(self):
i = 0
for row in self._marker:
for x in row:
if x == "*":
i += 1
if i > 1:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_solution(self):\n # Only need to check the length because the configuration expansion assesses the feasibility.\n return len(self._path) == self._N",
"def is_solved(self):\n if not self._find_empty():\n return True\n else:\n return False",
"def has_solution(self... | [
"0.7705091",
"0.7214947",
"0.7016489",
"0.7004349",
"0.69660157",
"0.69505966",
"0.6943021",
"0.6891977",
"0.6836816",
"0.6816865",
"0.6809995",
"0.6786772",
"0.677848",
"0.6772217",
"0.6741268",
"0.6717076",
"0.67116773",
"0.67116773",
"0.67116773",
"0.6683841",
"0.66251385"... | 0.65467596 | 27 |
Return a data dictionary to be used by the template. Will transform the description in the meta section using markdown. | def get_template_data(self) -> dict:
template_data = self._get_template_data()
@dataclass
class FileEntry:
"""Provides an entry into manifest object."""
name: str
size: str
md5: Optional[str]
template_data["resource_files"] = [
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data():\n file = open('./contest/content/data.md', 'r')\n rawText = file.read()\n file.close()\n content = Markup(markdown(rawText, \n extensions=['markdown.extensions.fenced_code', 'markdown.extensions.tables']))\n return render_template('markdowntemplate.html', \n ... | [
"0.69580853",
"0.6675528",
"0.6628297",
"0.66156554",
"0.6531035",
"0.6468042",
"0.6450909",
"0.6375734",
"0.62255347",
"0.62081283",
"0.61761737",
"0.61426204",
"0.6118508",
"0.6114915",
"0.6089917",
"0.60847926",
"0.6075537",
"0.60722613",
"0.6064661",
"0.606034",
"0.605946... | 0.0 | -1 |
2D gaussian mask should give the same result as MATLAB's fspecial('gaussian',[shape],[sigma]) | def der_gauss(shape,sigma):
m,n = [(ss-1.)/2. for ss in shape]
nx, ny = shape
xv = np.linspace(-1, 1, nx)
yv = np.linspace(-1, 1, ny)
x1, y1 = np.meshgrid(xv, yv)
h = np.exp( -(x1*x1 + y1*y1) / (2.*sigma*sigma) )
h[ h < np.finfo(h.dtype).eps*h.max() ] = 0
sumh ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian(size,sigma):\n a,b=np.ogrid[-size/2:size/2,-size/2:size/2]\n mask = a**2+b**2\n mask = np.exp(-mask.astype('float')/(2*float(sigma**2)))\n return mask",
"def fspecial_gaussian(shape=(3, 3), sigma=0.5):\n m, n = [(ss - 1.) / 2. for ss in shape]\n y, x = np.ogrid[-m:m + 1, -n:n + 1]\... | [
"0.7829996",
"0.7562562",
"0.7226179",
"0.7155936",
"0.69486",
"0.6848839",
"0.67880386",
"0.67694354",
"0.6750549",
"0.6750549",
"0.6715692",
"0.67122644",
"0.66872513",
"0.6681216",
"0.667548",
"0.6641507",
"0.6611443",
"0.65841174",
"0.6566251",
"0.65596884",
"0.6504947",
... | 0.0 | -1 |
Loads excel data from a supplied path into a Pandas dataframe | def load_data(path_to_file: str) -> pd.DataFrame:
print("Started loading the excel data from {0} into a datafram - this may take a while. You may want to grab a coffee.".format(path_to_file))
df = pd.read_excel(path_to_file, engine='openpyxl', header=HEADER_COLUMN)
print("Finished loading the excel data fro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_excel_df(path_datafile):\n\treturn pd.read_excel(path_datafile, sheet_name=None)",
"def preload_data_from_excel(path_to_file):\n with open(path_to_file, \"rb\") as f:\n df = pd.read_excel(f)\n\n return df",
"def load_data(self) -> pd.DataFrame:\n\n if not os.path.exists(self.file_n... | [
"0.798664",
"0.7755695",
"0.7586414",
"0.7284754",
"0.72526723",
"0.7217913",
"0.7122849",
"0.69949055",
"0.682708",
"0.6800742",
"0.67510575",
"0.67510575",
"0.6748623",
"0.6673647",
"0.66079354",
"0.65718645",
"0.65649843",
"0.6550594",
"0.6507239",
"0.6502609",
"0.6502609"... | 0.8135604 | 0 |
Gets the driver_id of this DriversSummaryResponseSummaries. ID of the driver. | def driver_id(self):
return self._driver_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def driver_id(self) -> int:\n return self._driver_id",
"def get_driver_id(self, driver_name):\n cond = SQLBinaryExpr(SQLFuncExpr(self.db_func_map[DB_FUNC_NAME_LOWER],\n COL_NAME_DRIVERS_NAME),\n OP_EQ, SQLLiteral(driver_name.lower(... | [
"0.77911115",
"0.7260621",
"0.63229",
"0.6267032",
"0.61608016",
"0.60649383",
"0.60093147",
"0.59673864",
"0.59673864",
"0.59673864",
"0.59673864",
"0.59673864",
"0.58385956",
"0.58116126",
"0.5780194",
"0.5768596",
"0.57357216",
"0.5735618",
"0.5668521",
"0.5651268",
"0.551... | 0.7834501 | 0 |
Gets the driver_name of this DriversSummaryResponseSummaries. Name of the driver. | def driver_name(self):
return self._driver_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def driverName(self):\n return Cbytestring2Python(\n self.Rf2Scor.mVehicles[self.__playersDriverNum()].mDriverName)",
"def get_driver_name(self, driverid):\n drv_cond = SQLBinaryExpr(COL_NAME_DRIVERS_DRIVERID, OP_EQ, SQLLiteral(driverid))\n entries = self.select_generic_data(selec... | [
"0.74843395",
"0.74309164",
"0.7251511",
"0.68460953",
"0.6405683",
"0.6237711",
"0.6233003",
"0.6197671",
"0.61374223",
"0.613717",
"0.6105939",
"0.6072096",
"0.60282487",
"0.60282487",
"0.60282487",
"0.5997545",
"0.598363",
"0.597689",
"0.5960675",
"0.5955113",
"0.59310436"... | 0.7731501 | 0 |
Sets the driver_name of this DriversSummaryResponseSummaries. Name of the driver. | def driver_name(self, driver_name):
self._driver_name = driver_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def driver_username(self, driver_username):\n\n self._driver_username = driver_username",
"def set_driver(self, driver):\n self.driver = driver",
"def get_driver_name(self, driverid):\n drv_cond = SQLBinaryExpr(COL_NAME_DRIVERS_DRIVERID, OP_EQ, SQLLiteral(driverid))\n entries = self... | [
"0.62255085",
"0.60733795",
"0.6064121",
"0.59891236",
"0.58379143",
"0.5727184",
"0.57232744",
"0.56362396",
"0.5623533",
"0.5623533",
"0.5474339",
"0.5417807",
"0.5391446",
"0.53896385",
"0.53457105",
"0.53457105",
"0.53457105",
"0.53457105",
"0.53457105",
"0.5336376",
"0.5... | 0.74672747 | 0 |
Gets the driver_username of this DriversSummaryResponseSummaries. Username of the driver. | def driver_username(self):
return self._driver_username | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_username(self) -> str:\n return self._username",
"def username(self) -> str:\n return self._username",
"def get_username(self):\n return self.username",
"def username(self) :\n\t\ttry :\n\t\t\treturn self._username\n\t\texcept Exception as e:\n\t\t\traise e",
"def username(self... | [
"0.6804193",
"0.6656319",
"0.6619052",
"0.65928257",
"0.6564746",
"0.6564746",
"0.6564746",
"0.65360487",
"0.65360487",
"0.65360487",
"0.6501469",
"0.6423877",
"0.6405916",
"0.6399264",
"0.63876426",
"0.6374102",
"0.6367688",
"0.62618566",
"0.62341684",
"0.62222594",
"0.61926... | 0.7917124 | 0 |
Gets the group_id of this DriversSummaryResponseSummaries. Group of the driver. | def group_id(self):
return self._group_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_identifier(self):\n return self._group_identifier",
"def get_group(self):\n return self._group",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self):\n re... | [
"0.65228224",
"0.636139",
"0.62579906",
"0.62579906",
"0.62538964",
"0.62487537",
"0.6208389",
"0.6205894",
"0.6110979",
"0.6087909",
"0.6074893",
"0.6023224",
"0.6023224",
"0.6023224",
"0.6020944",
"0.6016842",
"0.59757364",
"0.5925594",
"0.58619153",
"0.58531356",
"0.579539... | 0.6460139 | 3 |
Sets the group_id of this DriversSummaryResponseSummaries. Group of the driver. | def group_id(self, group_id):
self._group_id = group_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_group(self, group: str) -> None:\n self.group = group",
"def set_group(self, group):\n self._group = group",
"def group_identifier(self, group_identifier):\n\n self._group_identifier = group_identifier",
"def group(self, group):\n\n self._group = group",
"def group(self,... | [
"0.65882844",
"0.65286666",
"0.6475556",
"0.60730785",
"0.60730785",
"0.60730785",
"0.6054835",
"0.6037207",
"0.60198283",
"0.6009103",
"0.5999781",
"0.5979873",
"0.59509426",
"0.59242433",
"0.5803164",
"0.56597555",
"0.5658336",
"0.5621478",
"0.5610434",
"0.5572094",
"0.5485... | 0.6800697 | 4 |
Gets the active_hours of this DriversSummaryResponseSummaries. Hours spent on duty or driving, rounded to two decimal places. | def active_hours(self):
return self._active_hours | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hours(self):\n return self.config['hours']",
"def open_hours_detail(self):\n return self._open_hours_detail",
"def active_hours(self, active_hours):\n\n self._active_hours = active_hours",
"def hours(self):\n return int(self.minutes / 60)",
"def get_db_business_hours(self):\... | [
"0.62379026",
"0.60109395",
"0.56950366",
"0.55982035",
"0.5446295",
"0.5432213",
"0.54222816",
"0.5369411",
"0.53611875",
"0.5345079",
"0.5329336",
"0.526138",
"0.52562237",
"0.5237502",
"0.5231823",
"0.5210744",
"0.51966643",
"0.51400024",
"0.51216346",
"0.5089637",
"0.5030... | 0.7592765 | 0 |
Gets the distance_miles of this DriversSummaryResponseSummaries. Distance driven in miles, rounded to two decimal places. | def distance_miles(self):
return self._distance_miles | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meters_to_miles(meters):\n miles = meters / 1609.344\n return miles",
"def distance_miles(self, distance_miles):\n\n self._distance_miles = distance_miles",
"def distmeter(self):\n return self._distance.to(\"m\").value",
"def test_get_miles(self):\n miles = location_util.vincen... | [
"0.6605602",
"0.65685886",
"0.63429946",
"0.6272857",
"0.6160952",
"0.60914135",
"0.5963259",
"0.59141076",
"0.5793107",
"0.573543",
"0.57295805",
"0.57165396",
"0.5684285",
"0.5675397",
"0.56673056",
"0.5654813",
"0.5593089",
"0.5562755",
"0.55272907",
"0.545468",
"0.5451011... | 0.79049647 | 0 |
Sets the distance_miles of this DriversSummaryResponseSummaries. Distance driven in miles, rounded to two decimal places. | def distance_miles(self, distance_miles):
self._distance_miles = distance_miles | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drive_distance_meters(self, drive_distance_meters):\n\n self._drive_distance_meters = drive_distance_meters",
"def distance_miles(self):\n return self._distance_miles",
"def gps_distance_meters(self, gps_distance_meters):\n\n self._gps_distance_meters = gps_distance_meters",
"def tes... | [
"0.6899444",
"0.6678089",
"0.6418917",
"0.5678527",
"0.56387746",
"0.5538996",
"0.55294836",
"0.5362316",
"0.5362316",
"0.5362316",
"0.5269324",
"0.5217302",
"0.5216811",
"0.5210655",
"0.5200375",
"0.5113821",
"0.51135737",
"0.5082247",
"0.50753725",
"0.50737226",
"0.49954894... | 0.82698053 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, DriversSummaryResponseSummaries):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
It will open webbrowser with the given url pattern | def ButtonClick(self):
webbrowser.open_new_tab('http://www.google.com/search?btnG=1&q=%s' % e1.get())
"""To delete or clear the entry item"""
e1.delete(0, END)
e1.insert(0, "") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open(url):\r\n webbrowser.open(url)",
"def openurl(url):\n\n # Open the URL\n webbrowser.open(url)",
"def open_browser(url):\n import webbrowser\n webbrowser.open_new(url)",
"def run(self, url=''):\n if url:\n webbrowser.open(url)",
"def newtab(url):\n\n # Open the U... | [
"0.8273414",
"0.8047603",
"0.78710186",
"0.76730305",
"0.7478457",
"0.7420217",
"0.73011714",
"0.7273606",
"0.7264065",
"0.72519433",
"0.7092359",
"0.7046064",
"0.7025651",
"0.6982116",
"0.6910453",
"0.68634176",
"0.6857752",
"0.68235517",
"0.68210167",
"0.67426175",
"0.66868... | 0.0 | -1 |
This function is used to check whether the URL contains @ symbol or not | def have_at_symbol(l):
if "@" in str(l):
return 1
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_url(url):\n if not url or url.count('/') != 1 or url[0] != '@':\n return False\n return True",
"def _is_url(string):\n return \"http\" in string",
"def mention(result):\n return result.text.find('@') != -1",
"def __isUrl(self, url):\n if type(url)==str:\n ... | [
"0.74176174",
"0.65862066",
"0.65673757",
"0.6529493",
"0.63815165",
"0.6292186",
"0.6143821",
"0.61142033",
"0.6097418",
"0.6090686",
"0.60485244",
"0.59997493",
"0.5973483",
"0.5971895",
"0.5965571",
"0.593727",
"0.5935582",
"0.59348106",
"0.59225297",
"0.5911491",
"0.59087... | 0.65858084 | 2 |
If the url has symbol(//) after protocol then such URL is to be classified as phishing | def redirection(l):
l= str(l)
if l.count('//')>1:
return 1
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_fix_common_typos(url):\n if url.startswith(\"http//\"):\n url = \"http://\" + url[6:]\n elif url.startswith(\"https//\"):\n url = \"https://\" + url[7:]\n return url",
"def sanitize_url(url, require_scheme = False):\r\n if not url or ' ' in url:\r\n return\r\n\r\n url ... | [
"0.7241052",
"0.7042123",
"0.69901603",
"0.6955057",
"0.6876296",
"0.68734825",
"0.685646",
"0.68397796",
"0.68121266",
"0.67956764",
"0.6790785",
"0.6789401",
"0.67779326",
"0.67433906",
"0.6725259",
"0.66869587",
"0.66518277",
"0.66236883",
"0.66159195",
"0.6576989",
"0.657... | 0.0 | -1 |
Check if anchor symbol is present | def have_anchor_symbol(l):
if "<" in str(l) or ">" in str(l):
return 1
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isAnchor(node):\n # TODO What is considered an anchor needs to be subject to an option\n return bool((isinstance(node, nodes.target)\n or isinstance(node, nodes.Structural))\n and node[DuAttrIds]\n and not node.get(DuAttrRefuri, None))",
... | [
"0.67504984",
"0.6624801",
"0.65874046",
"0.63213766",
"0.5939809",
"0.5854384",
"0.5824761",
"0.58114713",
"0.58114713",
"0.58114713",
"0.5800779",
"0.5791976",
"0.5758889",
"0.5737585",
"0.57189655",
"0.5697081",
"0.5645697",
"0.56108457",
"0.55978346",
"0.5591738",
"0.5556... | 0.76566947 | 0 |
Check if underscore is present | def have_underscore_symbol(l):
if "_" in str(l):
return 1
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_underscore(self):\n # If something injected a '_' variable in __builtin__, delete\n # ipython's automatic one so we don't clobber that. gettext() in\n # particular uses _, so we need to stay away from it.\n if '_' in __builtin__.__dict__:\n try:\n ... | [
"0.7515757",
"0.72330016",
"0.67490107",
"0.670522",
"0.66427624",
"0.6606423",
"0.6556043",
"0.65466094",
"0.65026945",
"0.6490485",
"0.63276666",
"0.62112844",
"0.620045",
"0.620045",
"0.61535865",
"0.6151266",
"0.6145643",
"0.6103281",
"0.60718817",
"0.6008247",
"0.5985629... | 0.7748668 | 0 |
Check if space is present | def have_space_symbol(l):
if " " in str(l):
return 1
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isspace(self) -> bool:\n pass",
"def space_check(board, position):\n return board[position] == \" \"",
"def is_space(self):\n return self.pos == self.SPACE_POS",
"def check_empty_space(board, position1):\n return board[position1] == \" \"",
"def check_empty_space(self, row, column):\n ... | [
"0.7474115",
"0.7193551",
"0.7180459",
"0.7044552",
"0.70369506",
"0.69789296",
"0.6813032",
"0.6719472",
"0.6683169",
"0.653637",
"0.6502669",
"0.6497063",
"0.6469171",
"0.6452376",
"0.645045",
"0.6439031",
"0.64328647",
"0.6392643",
"0.6384546",
"0.63614815",
"0.63303465",
... | 0.67177016 | 8 |
Check if .asp extension is present | def have_asp_extension(l):
if ".asp" in str(l):
return 1
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def have_htm_extension(l):\r\n if \".htm\" in str(l):\r\n return 1\r\n else:\r\n return 0",
"def have_html_extension(l):\r\n if \".html\" in str(l):\r\n return 1\r\n else:\r\n return 0",
"def _has_extension(self, path):\r\n if re.match(r'.*\\\\.*\\..*$', path):\r\n ... | [
"0.670085",
"0.63430566",
"0.6336306",
"0.61403346",
"0.60823405",
"0.607752",
"0.60667264",
"0.6042182",
"0.6001968",
"0.59824663",
"0.5968416",
"0.59506863",
"0.59419143",
"0.5889127",
"0.58448774",
"0.5812407",
"0.5805791",
"0.5770631",
"0.5758799",
"0.5754295",
"0.5754295... | 0.8587011 | 0 |
Check if .htm extension is present | def have_htm_extension(l):
if ".htm" in str(l):
return 1
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def have_html_extension(l):\r\n if \".html\" in str(l):\r\n return 1\r\n else:\r\n return 0",
"def _has_extension(self, path):\r\n if re.match(r'.*\\\\.*\\..*$', path):\r\n return True",
"def have_asp_extension(l):\r\n if \".asp\" in str(l):\r\n return 1\r\n else:\r\n ... | [
"0.787641",
"0.6390076",
"0.6377721",
"0.62322426",
"0.6194978",
"0.61583644",
"0.6120271",
"0.6068787",
"0.6042555",
"0.60096806",
"0.59947485",
"0.59222317",
"0.59155566",
"0.5842593",
"0.57964224",
"0.5790954",
"0.5770944",
"0.57145584",
"0.570564",
"0.56756985",
"0.567324... | 0.8583605 | 0 |
Check if .mp3 extension is present | def have_mp3_extension(l):
if ".mp3" in str(l):
return 1
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_mp3_file(filename):\n ext = str(os.path.splitext(filename)[1]).lower()\n return ext == '.mp3'",
"def have_mpeg_extension(l):\r\n if \".mpeg\" in str(l):\r\n return 1\r\n else:\r\n return 0",
"def test_audio_extension(filename):\n\t\n\t# We need to make a test for extention :\n\... | [
"0.84095514",
"0.7616512",
"0.73910576",
"0.66768795",
"0.6627284",
"0.6601514",
"0.6557879",
"0.6537463",
"0.6482943",
"0.64502203",
"0.6440382",
"0.6343614",
"0.63014513",
"0.62883604",
"0.62615794",
"0.624488",
"0.62158895",
"0.62015826",
"0.6190573",
"0.61895066",
"0.6138... | 0.8822213 | 0 |
Check if .php extension is present | def have_php_extension(l):
if ".php" in str(l):
return 1
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _has_extension(self, path):\r\n if re.match(r'.*\\\\.*\\..*$', path):\r\n return True",
"def has_extension(self, filename):\n if filename is None:\n return False\n return filename.split(\".\")[-1].lower() in self.extensions",
"def check_extension(f):\n parts = f.split('.... | [
"0.7559468",
"0.7323201",
"0.72946435",
"0.7162879",
"0.6875373",
"0.6838802",
"0.67157304",
"0.66889775",
"0.6613128",
"0.65806127",
"0.6578205",
"0.6578205",
"0.6552469",
"0.6534832",
"0.64660984",
"0.6413993",
"0.63921434",
"0.63814676",
"0.6361831",
"0.634789",
"0.6336672... | 0.82687515 | 0 |
Check if .txt extension is present | def have_txt_extension(l):
if ".txt" in str(l):
return 1
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_txtfile(path):\n bFile = True if mimetypes.guess_type(path)[0] == 'text/plain' else False\n return bFile",
"def test_file(self, file: CollectedFile):\n\n return file.filename[-3:].upper() == 'TXT'",
"def check_file_type(fname):\n ext = path.splitext(fname)[1]\n return ext in all... | [
"0.7411731",
"0.7023447",
"0.6971958",
"0.6958252",
"0.69524145",
"0.6903472",
"0.6810023",
"0.6800995",
"0.67844653",
"0.6783356",
"0.6776773",
"0.6743536",
"0.6713071",
"0.6713071",
"0.66977334",
"0.66551846",
"0.66111773",
"0.6568699",
"0.65686935",
"0.65683275",
"0.652516... | 0.871058 | 0 |
Check if .xyz extension is present | def have_xyz_extension(l):
if ".xyz" in str(l):
return 1
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_extension(f):\n parts = f.split('.')\n last = parts[len(parts) - 1]\n return last in allowed_extensions",
"def has_extension(self, filename):\n if filename is None:\n return False\n return filename.split(\".\")[-1].lower() in self.extensions",
"def check_extension_fi... | [
"0.7697615",
"0.7617363",
"0.75938874",
"0.7577891",
"0.7563981",
"0.7500212",
"0.7387504",
"0.7381368",
"0.7381368",
"0.7373558",
"0.72465014",
"0.7199771",
"0.718897",
"0.71276534",
"0.71063375",
"0.7100644",
"0.7100644",
"0.7098052",
"0.70940846",
"0.70851946",
"0.70851946... | 0.8138865 | 0 |
Get delta along axis 0, zij = xi yj | def delta_matrix(x, y=None):
# 1 x N x D (1 x N if we view the last axis as a whole)
if type(y) == type(None):
y = x
x = np.expand_dims(x, axis=0)
y = np.expand_dims(y, axis=0)
return np.moveaxis(x, 0, 1) - y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delta(z, a, y):\n return (a-y)",
"def delta(z, a, y):\n\t\treturn np.subtract(a, y) * sigmoid_derivative(z)",
"def derivativeZ(self, *args):\n if self.n_dims >= 4:\n j = 3\n else:\n j = 2\n if self.i_dim == j:\n return np.ones_like(*args[0])\n ... | [
"0.6853864",
"0.6746276",
"0.670847",
"0.66801506",
"0.65674555",
"0.64952964",
"0.6458714",
"0.6430148",
"0.64164144",
"0.6375134",
"0.6298432",
"0.6266792",
"0.62510353",
"0.6209275",
"0.6207998",
"0.62046224",
"0.6195316",
"0.6148369",
"0.61231697",
"0.6115577",
"0.6073311... | 0.6384204 | 9 |
Return the dataset for the sample report. Your real code here would run adhoc sql queries and build up a dataset (list of dicts). | def getSampleDataSet():
ds = [{"name": "Denise", "sex": "F"},
{"name": "Paul", "sex": "M"}]
return ds | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_dataset(self):\n filepath = self.filepath\n agg_type = self.agg_type\n year_filter = self.year_filter\n market = self.market\n\n data = self.read_data(filepath, agg_type)\n total_subscribers = self.get_ending_subscribers(data, agg_type, market)\n report = ... | [
"0.66786206",
"0.65476584",
"0.65453774",
"0.6501773",
"0.64755976",
"0.6448157",
"0.64396286",
"0.6410712",
"0.6404189",
"0.63936657",
"0.62761855",
"0.626457",
"0.624799",
"0.6234669",
"0.622144",
"0.62213075",
"0.6218255",
"0.6169479",
"0.61407393",
"0.6123105",
"0.6096157... | 0.7444883 | 0 |
Get the current default device type for checkpointing. | def get_device_type() -> str:
return DefaultDeviceType._default_device_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_sensor_type():\n return get_sensor_type_id(DEFAULT_SENSOR_TYPE)",
"def get_default_device():\n return MXNET_DEFAULT_DEVICE",
"def get_default_device():\n global _default_device\n\n if _default_device is None:\n import wgpu.backends.rs # noqa\n\n adapter = wgpu.request... | [
"0.739723",
"0.7385406",
"0.7316812",
"0.71925366",
"0.6996825",
"0.6996825",
"0.6996825",
"0.6996825",
"0.69765925",
"0.69765925",
"0.6934155",
"0.6876804",
"0.6873421",
"0.677377",
"0.6746137",
"0.6732335",
"0.6732335",
"0.6732335",
"0.6699035",
"0.6699035",
"0.6670671",
... | 0.82281095 | 0 |
Initialize the reconstruction image. | def initialize_image(self):
# Initialize image along the input frame shape
image = np.zeros(self.frame_shape)
# Crop or expand according to the reconstruction mode
if self.mode == 'same':
pass
elif self.mode == 'full':
image = np.pad(image, self.alignmen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self) -> None:\n self.registration_method = None\n self.fixed_image = None\n self.moving_image = None\n self.transform = None",
"def setUp(self):\n self.gray_image = np.ndarray((100, 200), dtype=np.uint8)\n self.rgb_image = np.ndarray((100, 200, 3), dtype=np... | [
"0.6964892",
"0.68552655",
"0.6812949",
"0.6802166",
"0.6784955",
"0.6741615",
"0.672091",
"0.6701844",
"0.66247565",
"0.65873885",
"0.65873784",
"0.65593153",
"0.65593153",
"0.65593153",
"0.65407085",
"0.64734626",
"0.64376813",
"0.6407954",
"0.6382591",
"0.63640404",
"0.630... | 0.72257674 | 0 |
Extract the current module path and combine it with the relative path and return it. | def get_current_module_path(module_path, relative_path=""):
base_path = os.path.dirname(module_path)
file_path = os.path.join(base_path, relative_path)
file_path = os.path.normpath(file_path)
return file_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def module_path():\n try:\n this_file_path = __file__\n except NameError:\n # inside an interpreter, we can use the stack to find the file\n # path.\n tbs = traceback.extract_stack()\n this_file_path = tbs[0][0]\n # move back up to rfm directory\n dev_root = os.path.d... | [
"0.74483633",
"0.7379605",
"0.7311811",
"0.7104046",
"0.7061659",
"0.7040703",
"0.7016468",
"0.700263",
"0.700088",
"0.6982507",
"0.683077",
"0.6806889",
"0.67910415",
"0.6777622",
"0.67731386",
"0.67569584",
"0.67387164",
"0.6710791",
"0.67041916",
"0.66783524",
"0.66690326"... | 0.8139752 | 0 |
Assign 3 random avaliable names. | def assign_names(self):
if self.name_set.count() == 0:
name = Name.objects.filter(tree__isnull=True, gender=GENDER_FEMALE).order_by('?')[0]
name.tree = self
name.save()
name = Name.objects.filter(tree__isnull=True, gender=GENDER_MALE).order_by('?')[0]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand_name(self, names):\n return randint(0, len(names) - 1)",
"def get_random_names(count=3):\n if not isinstance(count, int):\n raise ValueError('Need a number!')\n first_names = ['Jane', 'Hans', 'Ella', 'Lois', 'Bernardo', 'Yolanda']\n last_names = [\n 'McKinley', 'Adams', 'Sa... | [
"0.71701413",
"0.707712",
"0.68024725",
"0.675499",
"0.66524506",
"0.66405684",
"0.660992",
"0.65385145",
"0.6522074",
"0.6461534",
"0.64296365",
"0.64015436",
"0.6328692",
"0.6233699",
"0.6233699",
"0.6184724",
"0.61038536",
"0.6097036",
"0.60936856",
"0.60791546",
"0.605656... | 0.0 | -1 |
Sets the learning rate to the initial LR decayed by 10 every 30 epochs | def adjust_learning_rate(optimizer, frame_idx):
lrr = maxlr * (0.1 ** (frame_idx//replay_size))
for param_group in optimizer.param_groups:
param_group['lr'] = lrr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr",
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l... | [
"0.7913536",
"0.7906521",
"0.7849834",
"0.777524",
"0.77338326",
"0.77306354",
"0.7722718",
"0.77224237",
"0.771982",
"0.77092624",
"0.7693604",
"0.76742035",
"0.7665748",
"0.7665748",
"0.7665748",
"0.7655329",
"0.76419765",
"0.76399755",
"0.7637868",
"0.7626077",
"0.76247585... | 0.0 | -1 |
Converts a iterator over terminal values to an instance of this type. | def unflatten(self, flat, unused_shaped_like):
return next(flat) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, iterator):\n self.iterator = iterator\n self.has_next = False\n self.next_val = None\n if self.iterator.hasNext():\n self.has_next = True\n self.next_val = self.iterator.next()",
"def __init__(self, iterator):\n self.iterator = []\n ... | [
"0.5925663",
"0.5902337",
"0.5834961",
"0.5819589",
"0.5766853",
"0.5674229",
"0.56566983",
"0.55727035",
"0.5566855",
"0.55618405",
"0.5550358",
"0.5549206",
"0.55488753",
"0.55411285",
"0.5484299",
"0.5472988",
"0.5466303",
"0.5436238",
"0.54269606",
"0.5419899",
"0.5417287... | 0.0 | -1 |
Converts an instance of this type to a flat list of terminal values. | def flatten(self, instance):
items = []
self.for_each_terminal(lambda _, item: items.append(item), instance)
return items | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tolist(self, flat=0):\n pass",
"def __str__(self):\n if len(self.children) == 0:\n return self.val\n ret = [\n self.val]\n for child in self.children:\n ret += [ '\\t' + child_s for child_s in str(child).split('\\n') ]\n\n return ('\\n').join(r... | [
"0.667305",
"0.6409368",
"0.6322777",
"0.6292976",
"0.6181283",
"0.6161293",
"0.6153494",
"0.6150171",
"0.6099992",
"0.60876405",
"0.6066738",
"0.6066738",
"0.6062828",
"0.60307384",
"0.5961525",
"0.59404",
"0.5928207",
"0.5927431",
"0.5914045",
"0.5896224",
"0.589559",
"0.... | 0.65065956 | 1 |
Returns a zeroed numpy array of this type. | def __array__(self):
return np.zeros(self.shape, self.dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeros_numpy_array(self,\n type_name,\n as_matrix = True):\n if as_matrix:\n return np.zeros((1, self.get_max_id(type_name)), dtype='float32')\n else:\n return np.zeros((self.get_max_id(type_name),), dtype='float32')",
"def zero(self):\n ret... | [
"0.7700564",
"0.7673813",
"0.7535281",
"0.7328062",
"0.73171294",
"0.7222666",
"0.7222666",
"0.71109784",
"0.7060102",
"0.69555616",
"0.695329",
"0.6933972",
"0.6931403",
"0.6871803",
"0.68358517",
"0.68275774",
"0.6819675",
"0.68108636",
"0.67284024",
"0.67222893",
"0.670606... | 0.8021051 | 0 |
Returns the input type if known, else None. | def input_type(self):
return self._input_type.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_input_type(self):\n return self.__input_type",
"def _get_input_type(self):\n return self.__input_type",
"def _get_input_type(self):\n return self.__input_type",
"def _get_input_type(self):\n return self.__input_type",
"def _get_input_type(self):\n return self.__input_type",
"def _... | [
"0.77920467",
"0.77920467",
"0.77920467",
"0.77920467",
"0.77920467",
"0.77920467",
"0.7307522",
"0.7307522",
"0.7307522",
"0.7307522",
"0.7307522",
"0.7307522",
"0.7307522",
"0.7307522",
"0.7307522",
"0.7307522",
"0.7307522",
"0.7307522",
"0.7307522",
"0.7307522",
"0.7307522... | 0.70486695 | 28 |
Returns the output type if known, else None. | def output_type(self):
return self._output_type.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_output_type(self):\n return self.__output_type",
"def _get_output_type(self):\n return self.__output_type",
"def _get_output_type(self):\n return self.__output_type",
"def _get_output_type(self):\n return self.__output_type",
"def _get_output_type(self):\n return self.__output_type"... | [
"0.818964",
"0.818964",
"0.818964",
"0.818964",
"0.818964",
"0.818964",
"0.6758128",
"0.6660697",
"0.6639053",
"0.6625773",
"0.6585136",
"0.6585136",
"0.6585136",
"0.6585136",
"0.6585136",
"0.6585136",
"0.6585136",
"0.6585136",
"0.6585136",
"0.6585136",
"0.6585136",
"0.6585... | 0.7747442 | 6 |
Returns the _actual_ data dict. Holds runtime data which is created and transformed by pyblosxom during execution. Modifying the contents of the dict will affect all downstream processing. | def getData(self):
return self._data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data(self) -> dict[str, Any]:\n raise NotImplementedError()",
"def data(self) -> dict:\n raise NotImplementedError()",
"def dict(self):\n return self.__data_dict",
"def _data(self):\n if self._data_ is None:\n self._data_ = {}\n return self._data_",
"def ge... | [
"0.6828324",
"0.6625821",
"0.6515848",
"0.6360439",
"0.63377565",
"0.6283897",
"0.62737054",
"0.62734485",
"0.6251403",
"0.6251403",
"0.62503463",
"0.625007",
"0.6247729",
"0.6215179",
"0.61761534",
"0.61091095",
"0.6100519",
"0.60977113",
"0.60648346",
"0.60446894",
"0.60228... | 0.0 | -1 |
Check exception if inconsistent number of layers | def test_cvqnn_layers_exception_nlayers(self):
shapes = expected_shapes(1, 2)
weights = [np.random.random(shape) for shape in shapes[:-1]]
weights += [np.random.random((2, shapes[-1][1]))]
dev = DummyDevice(wires=2)
@qml.qnode(dev)
def circuit():
qml.CVNeura... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_init(self):\n if self.Nlayer > 1:\n raise Exception(\"Nlayer == 1 currently\")",
"def check_layers_count(context, count):\n history = DOCKER_CLIENT.history(context.config.userdata['IMAGE'])\n if len(history) == int(count):\n return True\n\n raise Exception(\"Image does... | [
"0.74619323",
"0.72618186",
"0.6391016",
"0.63585085",
"0.63520694",
"0.63173527",
"0.6304866",
"0.61976993",
"0.6134103",
"0.6132481",
"0.6101511",
"0.60295683",
"0.6010667",
"0.59985805",
"0.594086",
"0.593563",
"0.5902125",
"0.5888738",
"0.58752745",
"0.5868893",
"0.586381... | 0.68996364 | 2 |
Build a dummy molecule with the requested number of residues and 3 atoms per residue. | def build_molecule(nresidues):
molecule = vermouth.molecule.Molecule()
residue_template = vermouth.molecule.Molecule()
residue_template.add_nodes_from(
(idx, {"chain": "", "atomname": str(idx), "resname": "DUMMY", "resid": 1})
for idx in range(3)
)
for _ i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_molecule():\n \n pos1 = np.array([[0.2],[0.2]])\n pos2 = np.array([[0.8],[0.8]])\n mol = Molecule(pos1, pos2, 10, 20, 1, 0.5)\n \n return mol",
"def __init__(self,\n num_masks=1,\n num_fake=0,\n epsilon_greedy=0.0,\n num_c... | [
"0.5838726",
"0.57771355",
"0.5753147",
"0.57031757",
"0.5514389",
"0.5508479",
"0.5247458",
"0.5243583",
"0.51776975",
"0.51776433",
"0.517483",
"0.51539636",
"0.5148754",
"0.5138741",
"0.51200485",
"0.51008326",
"0.5070581",
"0.5033445",
"0.5024389",
"0.5007222",
"0.4995540... | 0.71598434 | 0 |
Update member count stat on member leave. | async def on_member_leave(self, member: Member) -> None:
if member.guild.id != Guild.id:
return
self.bot.stats.gauge("guild.total_members", len(member.guild.members)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def update_member_count():\n guild = bot.get_guild(SERVER_ID)\n channel_prefix = \"Members\"\n vc = discord.utils.find(lambda c: channel_prefix in c.name, guild.voice_channels)\n mem_count = guild.member_count\n joined_today = len([m for m in guild.members if m.joined_at.date() == datetime.dat... | [
"0.7048229",
"0.63178515",
"0.60374373",
"0.59789634",
"0.59734625",
"0.5875092",
"0.57876676",
"0.57132447",
"0.5672767",
"0.56610173",
"0.56597245",
"0.5634726",
"0.54879117",
"0.54849833",
"0.5477888",
"0.54717714",
"0.5444495",
"0.54093844",
"0.5399907",
"0.5382539",
"0.5... | 0.7892713 | 0 |
Apply a configuration to this collection and return a generator of jobs which were added. | def update_from_config(self, job_configs, factory, reconfigure, namespace_to_reconfigure=None):
self.jobs.filter_by_name(job_configs)
def map_to_job_and_schedule(job_schedulers):
for job_scheduler in job_schedulers:
if reconfigure:
job_scheduler.schedule(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jobs(self):\n return JobCollection(client=self)",
"def job_gen(self):\n for job in self.task_manager.jobs(self.time_frame):\n if job.status == TASK.SCHEDULED:\n yield job",
"def jobs(self):\n raise NotImplementedError()",
"def jobs(self):\n return Job... | [
"0.58661145",
"0.56674886",
"0.5442988",
"0.54332024",
"0.5405109",
"0.53857446",
"0.53448224",
"0.5234443",
"0.51965976",
"0.5178457",
"0.51117986",
"0.5102671",
"0.5097425",
"0.50839084",
"0.50839084",
"0.5000561",
"0.49325982",
"0.48832348",
"0.4874357",
"0.4861996",
"0.48... | 0.5215743 | 8 |
Get the current output sample rate of the phase meter. | def get_samplerate(self):
return _PM_UPDATE_RATE / self.output_decimation | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_samp_rate(self):\n return _uhd_swig.usrp_sink_get_samp_rate(self)",
"def get_samp_rate(self):\n return _uhd_swig.usrp_sink_sptr_get_samp_rate(self)",
"def rate(self):\n if self._rate:\n return self._rate\n else:\n return self._wave.getframerate()",
"d... | [
"0.7327734",
"0.72164553",
"0.7070558",
"0.7044315",
"0.7044315",
"0.70188516",
"0.6928291",
"0.689107",
"0.6888997",
"0.6845852",
"0.6823361",
"0.68172103",
"0.6807554",
"0.6715599",
"0.662029",
"0.65780777",
"0.65090185",
"0.6417776",
"0.641015",
"0.6387711",
"0.63753223",
... | 0.74979347 | 0 |
Get the best evaluator including its score on validation problems | def get_best_evaluators(database,
domain,
planner,
candidates=evaluators.get_standard_evaluators()):
domains = database.domains.find({'name': domain, 'augmented': True})
descriptives = []
for evaluator in candidates:
d = get_des... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluator(self):\n return self.__evaluator",
"def _eval_during_training(\r\n self, evaluator, output_path, save_best_model, epoch, steps):\r\n if evaluator is not None:\r\n score = evaluator(\r\n self, output_path=output_path, epoch=epoch, steps=steps)\r\n ... | [
"0.69147897",
"0.67446387",
"0.6423559",
"0.641608",
"0.6389839",
"0.6389249",
"0.6322331",
"0.63138753",
"0.63037956",
"0.6302838",
"0.6281748",
"0.6275477",
"0.6274073",
"0.62656885",
"0.62582177",
"0.6246759",
"0.6236913",
"0.62181807",
"0.6217982",
"0.62132806",
"0.620928... | 0.6741948 | 2 |
Gets a dict representing this interaction. Only default values are provided. | def to_dict(self) -> BaseInteractionDict:
return {
'id': self.id,
'name': self.name,
'description': self.description,
'answer_type': self.answer_type,
'display_mode': self.display_mode,
'is_terminal': self.is_terminal,
'is_train... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dict(self):\n return",
"def getMyInfoAsDict(self):\n dict = self.getSelectedAttr(list(self.defaultAttributes))\n return dict",
"def get_kwargs(self):\n return {}",
"def dict(self) -> Dict:\r\n return super().dict()",
"def dict(self) -> Dict:\r\n return supe... | [
"0.68328243",
"0.6690512",
"0.6654788",
"0.6635144",
"0.6635144",
"0.65872496",
"0.6548162",
"0.6464999",
"0.64169896",
"0.64058495",
"0.64038265",
"0.63733906",
"0.633714",
"0.6334529",
"0.6310562",
"0.63071615",
"0.6294999",
"0.6294999",
"0.6294999",
"0.6294999",
"0.6294999... | 0.7553651 | 0 |
Gets a rule description, given its name. | def get_rule_description(self, rule_name: str) -> str:
if rule_name not in self.rules_dict:
raise Exception('Could not find rule with name %s' % rule_name)
else:
return self.rules_dict[rule_name]['description'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rule(self, name):\n\n return self._control_manager.get_rule(name)",
"def get_rule(self, name):\n if not self._rules:\n raise NoRulesException()\n if not name in self._rules:\n raise UnknownRuleException(name)\n return self._rules[name]",
"def get_rule(s... | [
"0.7498371",
"0.716528",
"0.69270164",
"0.664303",
"0.64924437",
"0.64924437",
"0.64766693",
"0.6466484",
"0.64315516",
"0.6263376",
"0.61720943",
"0.61619216",
"0.60339063",
"0.59488124",
"0.5940707",
"0.5821434",
"0.5664438",
"0.5664438",
"0.5664438",
"0.56180215",
"0.55131... | 0.85404474 | 0 |
Return projects for 'projects' type resource. | def _get_projects(project_ids):
if _ALL in project_ids:
return projects_lib.get_all()
return projects_lib.get_selective(project_ids) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_projects(self):\n return self.http_call(\"get\", url=f\"{self.base_url}/projects\").json()",
"def projects(self):\r\n return p.Projects(self)",
"def get_projects(self):\n response = self.request(verb=requests.get, address=\"projects\")\n # FIXME: if no results, must we raise... | [
"0.8284358",
"0.81777745",
"0.8082572",
"0.8054655",
"0.7925558",
"0.7883885",
"0.7865517",
"0.779137",
"0.7777461",
"0.7743807",
"0.7729089",
"0.7726771",
"0.76064676",
"0.759407",
"0.7535064",
"0.7520172",
"0.7443326",
"0.7434857",
"0.74314255",
"0.74223876",
"0.73168755",
... | 0.6729469 | 57 |
Teste de Envio de email | def test_send_subscribe_email(self):
#Verifica se foi enviado 1 e-mail, o este não envia e-mail
self.assertEqual(1, len(mail.outbox)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_email(self, env: yaenv.Env):\n _email = {\n 'EMAIL_BACKEND': yaenv.email.SCHEMES['dummy'],\n 'EMAIL_HOST_USER': '',\n 'EMAIL_HOST_PASSWORD': '',\n 'EMAIL_HOST': 'localhost'\n }\n assert env.email('EMAIL_URL') == _email\n _email.update... | [
"0.81317663",
"0.757354",
"0.7431149",
"0.7423502",
"0.73714507",
"0.7355716",
"0.7113407",
"0.70784223",
"0.7063532",
"0.704624",
"0.70119715",
"0.69945085",
"0.69898266",
"0.6984385",
"0.69769555",
"0.6968911",
"0.69566596",
"0.69443583",
"0.6914168",
"0.69061",
"0.68751425... | 0.6933124 | 18 |
make resnet layers(by layer i didnt mean this 'layer' was the same as a neuron netowork layer, ex. conv layer), one layer may contain more than one residual block | def _make_layer(self, out_channels, num_blocks, stride):
# we have num_block blocks per layer, the first block
# could be 1 or 2, other blocks would always be 1
strides = [stride] + [1] * (num_blocks - 1)
layers = []
for stride in strides:
type(self).current_block +=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_resnet(self):\r\n\r\n # INPUTS\r\n inputs_data = Input((self.data_rows, self.data_cols, 1),name='inputs_data')\r\n\r\n\r\n def residual_block(input, output_channels=64, kernel_size=(3, 3), stride=(1, 1)):\r\n x = Conv2D(output_channels, kernel_size, padding='same', strides... | [
"0.77695763",
"0.75228304",
"0.74328476",
"0.74296016",
"0.7288154",
"0.72440565",
"0.72113514",
"0.71193695",
"0.7111452",
"0.7087424",
"0.7084183",
"0.70556986",
"0.7053009",
"0.7037331",
"0.7022117",
"0.6994315",
"0.6990653",
"0.69755524",
"0.6967176",
"0.693066",
"0.69281... | 0.0 | -1 |
Does this WriteConcern match the server default. | def is_server_default(self):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writable(self):\n return 'w' in self._mode",
"def write_acceptable(self):\n return self.outstanding_wcount == 0",
"def writable(self):\n return self.append_connect or (self.append_send_buffer)",
"def writable(self):\n return self.append_connect or (self.append_send_buffer)",
... | [
"0.56147665",
"0.5492606",
"0.52717745",
"0.52717745",
"0.5217038",
"0.5203384",
"0.51866984",
"0.51793337",
"0.5077793",
"0.5026933",
"0.50042015",
"0.4997126",
"0.49901474",
"0.49790215",
"0.49745688",
"0.49695644",
"0.49657276",
"0.49608335",
"0.49501288",
"0.49465364",
"0... | 0.6050912 | 0 |
The document representation of this write concern. | def document(self):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n return self.document",
"def serialize(self):\r\n return {\r\n 'documentId': self.documentId,\r\n 'document_doman': self.document_doman\r\n }",
"def document(self):\n return self._modelPart.document()",
"def doc(self):\n return {'_i... | [
"0.73703086",
"0.72157747",
"0.7191321",
"0.71429086",
"0.7085856",
"0.688801",
"0.68589216",
"0.68455625",
"0.68371695",
"0.68192303",
"0.68040335",
"0.6728203",
"0.671382",
"0.66808563",
"0.65751433",
"0.65254754",
"0.6499689",
"0.645118",
"0.64205617",
"0.64066446",
"0.640... | 0.6648379 | 14 |
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes. | def add_header(r):
r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
r.headers["Pragma"] = "no-cache"
r.headers["Expires"] = "0"
r.headers['Cache-Control'] = 'public, max-age=0'
return r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response",
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m... | [
"0.82247144",
"0.8223862",
"0.8223862",
"0.8223862",
"0.8223862",
"0.81971866",
"0.8164743",
"0.8164743",
"0.8164743",
"0.8164743",
"0.8164743",
"0.8164743",
"0.8164743",
"0.8164743",
"0.8164743",
"0.8164743",
"0.8164743",
"0.8164743",
"0.8164743",
"0.8164743",
"0.8164743",
... | 0.71284086 | 56 |
Gets the repository folder path associated with this connection. If an ambiguous path has been specified, the folder path may change after a connection is established (e.g., folder item name will be appended to folder path and item name will become null if item turns out to be a folder). repository folder path or null | def getFolderPath(self) -> unicode:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path(self) -> str:\n self.__verify_repo_initialized()\n return str(self._repo_path.parent)",
"def folder(self):\n return os.path.join(\n td.project.folder.replace(\"/\", os.sep), # incase we're on windows\n \"component_repos\",\n self.name)",
"def find... | [
"0.6649795",
"0.662959",
"0.656604",
"0.62165976",
"0.62165976",
"0.61967134",
"0.6182038",
"0.61693215",
"0.61177915",
"0.6039434",
"0.6005689",
"0.6002819",
"0.59856015",
"0.59501",
"0.58998674",
"0.5871728",
"0.586297",
"0.5847666",
"0.58348435",
"0.58070576",
"0.5791073",... | 0.50081474 | 85 |
Checks if a file is an allowed extension. | def has_file_allowed_extension(filename, extensions):
filename_lower = filename.lower()
return any(filename_lower.endswith(ext) for ext in extensions) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_allowed_extension(filename):\n return '.' in filename and filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS",
"def allowed_file(filename, allowed_extension):\n return '.' in filename and get_file_ext(filename) in allowed_extension",
"def is_allowed_file(filename, allowed_ext):\n ext = filename.... | [
"0.89530855",
"0.8787055",
"0.87652296",
"0.8761566",
"0.8612342",
"0.8612342",
"0.8612342",
"0.8612342",
"0.8612342",
"0.8612342",
"0.85917485",
"0.85917485",
"0.85557264",
"0.85415006",
"0.8525353",
"0.8525353",
"0.85187334",
"0.85187334",
"0.85152656",
"0.8499068",
"0.8496... | 0.8022149 | 45 |
This interface returns a string with description of the latest error code delivered by OpenDSS. | def error_desc(self) -> str:
result = ctypes.c_char_p(self.dss_obj.ErrorDesc())
return result.value.decode('ascii') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_error_description(self, code):\n self.c.execute(\"SELECT * FROM errorcode WHERE code=%d\" % code)\n return self.c.fetchone()[1]",
"def errorNumToDesc(self, errorCode):\n for t in self.ERROR_CODES:\n if t[0] == errorCode:\n try:\n return t[... | [
"0.8082163",
"0.77054197",
"0.75265944",
"0.7501817",
"0.7499569",
"0.7155371",
"0.7005922",
"0.7001993",
"0.69731313",
"0.6890416",
"0.68874013",
"0.68827224",
"0.68762517",
"0.6870936",
"0.6870529",
"0.6853511",
"0.6852038",
"0.68339807",
"0.68254536",
"0.6808059",
"0.68012... | 0.7786625 | 1 |
Initialize a new RecordTypeData object, without metadata. parent is the parent collection from which the type data is descended. type_id the local identifier (slug) for the record type | def __init__(self, parent, type_id):
super(RecordTypeData, self).__init__(parent, type_id)
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, data_type=None):\n self.type = data_type",
"def __init__(self, raw_type: Dict):\n\n self.kind = raw_type.get(\"kind\")\n self.name = raw_type.get(\"name\")\n self.description = raw_type.get(\"description\")\n self.fields: List[SchemaTypeField] = [SchemaTypeFi... | [
"0.6475925",
"0.5932634",
"0.58939964",
"0.5801795",
"0.5790366",
"0.56934565",
"0.567446",
"0.56057215",
"0.5581928",
"0.5536057",
"0.55250424",
"0.55094147",
"0.54936475",
"0.5491311",
"0.54845417",
"0.54188347",
"0.54061246",
"0.5381144",
"0.5371242",
"0.53354156",
"0.5335... | 0.83375615 | 0 |
Close the associated file descriptor. | def close(self):
os.close(self.fd) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n\n\t\tfd = self._fd\n\t\tif fd is not None:\n\t\t\tself._fd = None\n\t\t\tos.close(fd)",
"def close(self):\r\n self._fd.close()",
"def close(self):\n os.close(self._fd)\n self._fd = None",
"def close(self):\n if hasattr(self, '_fd'):\n if self._fd is n... | [
"0.82733905",
"0.8220157",
"0.8079503",
"0.7742257",
"0.7668155",
"0.7447904",
"0.7447904",
"0.7447904",
"0.730275",
"0.72960484",
"0.72800314",
"0.7260235",
"0.7100637",
"0.7070854",
"0.7042819",
"0.7042819",
"0.698571",
"0.69479144",
"0.6913454",
"0.6844248",
"0.6839904",
... | 0.8092909 | 2 |
Constructor All cells initialized as dead (0) | def __init__(self, size):
self.size = size
self.board = []
new = []
for i in range(0, size, 1):
for j in range(0, size, 1):
new.append(0)
self.board.append(new)
new = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, width = 7, height = 7):\n self.cell = [ [EMPTY for r in range(height)] for c in range(width) ]",
"def initialize_cells(self):\n for loc in np.ndindex(*self.shape): # TODO: see if nested for loop is faster than this\n c = Cell(loc, self)\n self.cells.append(c... | [
"0.7629428",
"0.75287545",
"0.7409563",
"0.73019695",
"0.72231203",
"0.7158505",
"0.7042673",
"0.7037504",
"0.7014398",
"0.70069957",
"0.69807327",
"0.6921767",
"0.6915772",
"0.6855945",
"0.6826998",
"0.6824645",
"0.67751354",
"0.6727824",
"0.67136973",
"0.67061734",
"0.66947... | 0.0 | -1 |
Look for first element in a list that matches a criteria. | def first(data, key):
for i in data:
if key(i):
return i
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first(l: iter, predicate):\n for ele in l:\n if predicate(ele):\n return ele\n raise RuntimeError(\"Found nothing to match predicate\")",
"def _first(self, \n iterable, \n condition=lambda x: True):\n try:\n return next(x for x in iterable... | [
"0.77617466",
"0.7118747",
"0.6989567",
"0.6967298",
"0.6845904",
"0.6843584",
"0.67280954",
"0.6669882",
"0.66440064",
"0.6603926",
"0.6586117",
"0.6573961",
"0.6521331",
"0.65041816",
"0.64651984",
"0.6451164",
"0.6451164",
"0.63959444",
"0.6392481",
"0.6326857",
"0.6312229... | 0.6244501 | 25 |
Calculate the risk for coronary heart disease using the coefficients from the HKDR CHD Cohort | def hkdr_chd(age, female, cur_smoker, diab_dur,
egfr, acr, nonhdl_mmol):
xFeat = np.array([clean_age(age),
female,
cur_smoker,
clean_diab_dur(diab_dur),
np.log10(clean_egfr(egfr)),
np.log10(1+c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hkdr_hf(female, age, bmi, hba1c, acr, hb, chdHist):\n baseSurv = HKDR_HF[\"male_sm\"]\n if female:\n baseSurv = HKDR_HF[\"female_sm\"]\n xFeat = np.array([clean_age(age),\n clean_bmi(bmi),\n clean_hba1c(hba1c),\n np.log10(1+clean_ac... | [
"0.58256066",
"0.5640466",
"0.5618798",
"0.54969364",
"0.54053956",
"0.53794396",
"0.53693265",
"0.5335433",
"0.5285875",
"0.5261113",
"0.5252916",
"0.5241192",
"0.5235365",
"0.5221473",
"0.52193946",
"0.5195866",
"0.51748586",
"0.5167922",
"0.5148265",
"0.51416755",
"0.51414... | 0.5507328 | 3 |
Calculate the risk for heart failure using the coefficients from the HKDR Cohort | def hkdr_hf(female, age, bmi, hba1c, acr, hb, chdHist):
baseSurv = HKDR_HF["male_sm"]
if female:
baseSurv = HKDR_HF["female_sm"]
xFeat = np.array([clean_age(age),
clean_bmi(bmi),
clean_hba1c(hba1c),
np.log10(1+clean_acr(acr)),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def consumptionFromHashrate(data_df, eff: float=0.02, same_hr: bool=False, verbose: bool=VERBOSE):\n count = 0\n year_ends = []\n years = [str(year) for year in range(2016,2050,1)]\n for y in years:\n if int(y) % 4 == 0:\n count += 366\n else:\n count += 365\n\n ... | [
"0.58678204",
"0.5827898",
"0.57469517",
"0.57166046",
"0.5706228",
"0.56887066",
"0.56306183",
"0.5614457",
"0.55349535",
"0.5508109",
"0.54875624",
"0.54807097",
"0.5420952",
"0.541613",
"0.5343591",
"0.5321843",
"0.52965295",
"0.5237339",
"0.52361864",
"0.5137856",
"0.5104... | 0.4896509 | 54 |
Load in the data specified in the JSON file. | def load_file(self):
self._check_setup()
json_str = self.get_json_file()
if json_str is None:
return
if not self._is_json_str():
with open(json_str, 'r') as f:
jf = json.load(f)
else:
jf = json.loads(json_str)
self.jf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_data_from_json(self, filename):\n with open(filename, 'r') as f:\n self.data = json.load(f, object_pairs_hook=OrderedDict)",
"def _load(self):\n if self.file_path.exists():\n with open(self.file_path) as fid:\n self.data = json.load(fid)",
"def load(se... | [
"0.81774324",
"0.80456764",
"0.80137765",
"0.79184574",
"0.7665939",
"0.7592198",
"0.7537199",
"0.7527914",
"0.7523849",
"0.74884754",
"0.74206394",
"0.7390862",
"0.73809737",
"0.736452",
"0.7340317",
"0.7328512",
"0.73142046",
"0.7216972",
"0.7209759",
"0.7209759",
"0.720546... | 0.7000809 | 47 |
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments. | def __init__(self, *args, **kwds):
if args or kwds:
super(safeguard, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.decision is None:
self.decision = 0
if self.distance is None:
self.distance = 0.
if self.o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ... | [
"0.77939296",
"0.7720264",
"0.7720264",
"0.76866186",
"0.7626193",
"0.756387",
"0.74395823",
"0.7416946",
"0.73519075",
"0.7308225",
"0.72806025",
"0.72379386",
"0.72272825",
"0.7224187",
"0.7224187",
"0.7218873",
"0.7211484",
"0.7211484",
"0.7211484",
"0.7211484",
"0.7211484... | 0.0 | -1 |
Return a wrapped resource if a resource is requested or pass through to actual getattr. | def __getattr__(self, attr):
actual_resource = getattr(self.swagger_client, attr)
if attr in ["Authorization", "Effects", "Identify", "Info",
"PanelLayout", "State"]:
return WrappedResource(actual_resource, attr)
else:
return actual_resource | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _wrap(self, resource):\n\t\treturn ResourceWrapper(self, resource)",
"def __getattr__(self, resource):\n return ResourceManager(self, resource)",
"def get(self, resource, default=0):\n return getattr(self._resources, resource, default)",
"def get_resource(self, resource, **kwargs):\n ... | [
"0.6973141",
"0.66792685",
"0.65131533",
"0.6443276",
"0.62876576",
"0.6284875",
"0.6254384",
"0.6135523",
"0.6126132",
"0.60606384",
"0.603083",
"0.5998818",
"0.5925629",
"0.5914302",
"0.5897614",
"0.58708894",
"0.5852095",
"0.57995564",
"0.5799035",
"0.57957447",
"0.5793853... | 0.7250704 | 0 |
Calculates the confidence intervals for the kinetic temperature of the momentum of each parameter. Assumes the target temperature is 1. | def _gamma_confidence(sizes: Dict[str, int], c: Union[float, np.ndarray]=0.95) -> Dict[
str, Tuple[np.ndarray, np.ndarray]]:
d = {}
for k, df in sizes.items():
lower = scipy.stats.chi2.ppf((1-c)/2, df=df, scale=1/df)
upper = scipy.stats.chi2.ppf((1+c)/2, df=df, scale=1/df)
d[k] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confidence_interval(self):\r\n coh_var = np.zeros((self.input.data.shape[0],\r\n self.input.data.shape[0],\r\n self._L), 'd')\r\n for i in range(self.input.data.shape[0]):\r\n for j in range(i):\r\n if i != j:\r\n ... | [
"0.6205259",
"0.5695552",
"0.5508431",
"0.54851365",
"0.54544175",
"0.5437057",
"0.53997236",
"0.53994733",
"0.53020364",
"0.5294029",
"0.52832943",
"0.526648",
"0.5246613",
"0.5243764",
"0.52414465",
"0.52391744",
"0.5233639",
"0.52108276",
"0.5200518",
"0.5192832",
"0.51587... | 0.0 | -1 |
Converts an ordered datetime object to cumulative no. of days starting from 0. | def _convert_date_to_cumdays(self, series):
newseries = series.copy()
newseries[0] = 0
newseries.iloc[1:] = series.diff().iloc[1:].cumsum().dt.days
try:
return newseries.astype(float)
except:
raise TypeError('ERROR: Could not transform dates to days. Chec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dias_desde_caso_0(self):\n\n self.covidbr['dias_caso_0'] = self.covidbr['data'] - self.covidbr['data'].iloc[0]\n self.covidbr['dias_caso_0'] = self.covidbr['dias_caso_0'].apply(lambda x: x.days).astype(int)",
"def get_total_days(x):\n if not isinstance(x, dt.timedelta):\n raise TypeEr... | [
"0.6054484",
"0.59175974",
"0.58895344",
"0.5757263",
"0.57351226",
"0.5729872",
"0.57242775",
"0.5690939",
"0.56668895",
"0.56475514",
"0.5622428",
"0.56103754",
"0.5576437",
"0.5572179",
"0.5489147",
"0.5468138",
"0.542353",
"0.5420217",
"0.5420217",
"0.5409218",
"0.5409218... | 0.63527656 | 0 |
Tests creating temp directories in a 'with' statement. | def testContextManager(self):
with mock.patch('tempfile.mkdtemp', lambda: self.temp_directory):
with base.BaseRecipe('fake_recipe') as recipe:
self.assertTrue(os.path.isdir(self.temp_directory))
#pylint: disable=protected-access
self.assertEqual(recipe._workdir, self.temp_directory)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create1(self):\n fname = TempfileManager.create_tempfile()\n OUTPUT = open(fname, 'w')\n OUTPUT.write('tempfile\\n')\n OUTPUT.close()\n self.assertEqual(len(list(glob.glob(tempdir + '*'))), 1)\n fname = os.path.basename(fname)\n self.assertTrue(fname.starts... | [
"0.7157178",
"0.70598376",
"0.7017724",
"0.69121855",
"0.68321985",
"0.68128866",
"0.68035734",
"0.67829955",
"0.67669034",
"0.6742957",
"0.67035985",
"0.6702797",
"0.6682858",
"0.6662432",
"0.66588277",
"0.6640401",
"0.6607065",
"0.65893143",
"0.6577738",
"0.6565664",
"0.656... | 0.6556035 | 22 |
Get view template name. Gets the view template name. | def get_view_template_name(self, request=None, origin=None):
if not self.view_template_name_ajax:
return self.view_template_name
elif request and request.is_ajax():
return self.view_template_name_ajax
else:
return self.view_template_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"template_name\")",
"def get_template_name(self):\n if self.template_name is not None:\n return self.template_name\n model_opts = self.queryset.model._meta\n return f\"{model_opts.app_label}... | [
"0.75305253",
"0.74103487",
"0.74103487",
"0.73942137",
"0.7373375",
"0.7181039",
"0.7179843",
"0.7165786",
"0.7088642",
"0.70741016",
"0.70583117",
"0.70346624",
"0.69948375",
"0.69785607",
"0.6924856",
"0.69103044",
"0.6895677",
"0.67126304",
"0.66558516",
"0.66462547",
"0.... | 0.687448 | 17 |
Get initialized create form or page 404. Same as ``get_initialised_create_form`` but raises ``django.http.Http404`` on errors. | def get_initialised_create_form_or_404(self, data=None, files=None):
plugin_form = self.get_form()
if plugin_form:
initial_data = {}
try:
initial_data = dict(plugin_form.plugin_data_fields)
except Exception as err:
pass
try:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_initialised_create_form(self, data=None, files=None,\n initial_data=None):\n plugin_form = self.get_form()\n if plugin_form:\n try:\n kwargs = {\n 'data': data,\n 'files': files,\n ... | [
"0.6673224",
"0.587816",
"0.57939583",
"0.56270814",
"0.5433999",
"0.5300021",
"0.5269213",
"0.52191234",
"0.51292104",
"0.51106006",
"0.50850534",
"0.507714",
"0.5043444",
"0.5012844",
"0.49944293",
"0.49431872",
"0.49425727",
"0.49113268",
"0.48977068",
"0.4869273",
"0.4857... | 0.6905682 | 0 |
Get initialized edit form or page 404. Same as ``get_initialised_edit_form`` but raises ``django.http.Http404`` on errors. | def get_initialised_edit_form_or_404(self, data=None, files=None,
auto_id='id_%s', prefix=None,
error_class=ErrorList,
label_suffix=':',
empty_permitted=Fal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_edit_form(self, data):\n self.add_success(data)\n rv = self.get((data[self.id_field], self.edit_url))\n assert not is_404(rv)\n assert in_response(rv, 'Edit {}'.format(data[self.name_field]))\n for field, name in self.fields:\n assert in_response(rv, name)\n ... | [
"0.62809765",
"0.5948825",
"0.58041286",
"0.5786497",
"0.55881685",
"0.5347847",
"0.5337012",
"0.5181382",
"0.51702625",
"0.51539034",
"0.49700895",
"0.49695507",
"0.49288502",
"0.49261296",
"0.49241167",
"0.49006793",
"0.48878467",
"0.48550406",
"0.48503116",
"0.4784032",
"0... | 0.6820706 | 0 |
Get form field instances (internal method). Used internally. Do not override this method. Gets the instances of form fields, that plugin contains. | def _get_form_field_instances(self, form_element_entry=None, origin=None,
kwargs_update_func=None, return_func=None,
extra={}, request=None, form_entry=None,
form_element_entries=None, **kwargs):
# For the mome... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_form_field_instances(self, request=None, form_entry=None,\n form_element_entries=None, **kwargs):\n return []",
"def get_custom_field_instances(self,\n integrate_with,\n request=None,\n ... | [
"0.71305645",
"0.6722114",
"0.6430702",
"0.6331565",
"0.6222408",
"0.62069964",
"0.6203097",
"0.6201132",
"0.6190619",
"0.6190619",
"0.61723334",
"0.6171403",
"0.6149068",
"0.6148973",
"0.6128417",
"0.6085797",
"0.60772526",
"0.6073332",
"0.60729855",
"0.60295016",
"0.6028917... | 0.64231205 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.