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 |
|---|---|---|---|---|---|---|
Function to convert a single input infix string to postfix notation. It is assumed that tokens in the string are separated by whitespace. Returns the postfix expression on success; raises ExpressionError if the input expression is erroneous. | def infix_to_postfix(string):
# Validate and tokenize the string
tokens = validate(string)
# Initialize the stack
s = Stack()
# Ready the final postfix expression
postfix = ''
# List of operators that have to be handled
operators = ['+', '-', '*', '/', '^', 'sqrt', 'u-', ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def infix_to_postfix(string):\n tokenlist = string.split()\n output = []\n stack = create_stack()\n for token in tokenlist:\n if token == '(':\n stack.push(token)\n elif token == ')':\n toptoken = stack.pop()\n while toptoken != '(':\n outpu... | [
"0.82886326",
"0.8267429",
"0.8116412",
"0.80532104",
"0.79317456",
"0.7838054",
"0.78235006",
"0.7815421",
"0.77934223",
"0.7734474",
"0.7727248",
"0.7694409",
"0.7610501",
"0.7605938",
"0.75745595",
"0.75698835",
"0.74956685",
"0.7477651",
"0.7460197",
"0.7417434",
"0.73968... | 0.8161909 | 2 |
Returns config for tf.session | def get_config():
config = tf.ConfigProto(allow_soft_placement=True)
config.gpu_options.allow_growth=True
return config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _config_session(self):\n config = tf.ConfigProto()\n config.gpu_options.allow_growth = True\n config.gpu_options.visible_device_list = str(self.device_num)\n return tf.Session(config=config)",
"def get_config():\n config = tf.ConfigProto(allow_soft_placement=True)\n config.g... | [
"0.7999958",
"0.7535755",
"0.72901034",
"0.7119736",
"0.6969369",
"0.6781894",
"0.65969217",
"0.64716965",
"0.6348045",
"0.6322737",
"0.631881",
"0.62444156",
"0.6241746",
"0.6201172",
"0.61908853",
"0.61729336",
"0.6153548",
"0.6133191",
"0.6101502",
"0.6080999",
"0.6076644"... | 0.75894344 | 1 |
Defines an initializer for the Xavier distribution. Specifically, the output should be sampled uniformly from [epsilon, epsilon] where epsilon = sqrt(6) / e.g., if shape = (2, 3), epsilon = sqrt(6 / (2 + 3)) This function will be used as a variable initializer. | def xavier_weight_init(shape):
lim = np.sqrt(6. / sum(shape))
out = np.random.uniform(-lim, lim, shape)
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def XavierInit(self):\n\n raw_std = (2 / (self.num_input + self.num_output))**0.5\n if 'relu' == self.act_function:\n init_std = raw_std * (2**0.5)\n elif 'sigmoid' == self.act_function:\n init_std = raw_std\n else:\n init_std = raw_std # * 4\n\n ... | [
"0.713179",
"0.694579",
"0.6937731",
"0.6779628",
"0.6648162",
"0.6642838",
"0.6642838",
"0.65998244",
"0.6546982",
"0.6546982",
"0.6505124",
"0.64154625",
"0.64006364",
"0.6392973",
"0.6384507",
"0.63683206",
"0.62566024",
"0.622814",
"0.6173743",
"0.6173743",
"0.61022276",
... | 0.6419569 | 11 |
Creates an optimizer and applies the gradients to all trainable variables. | def add_training_op(self, loss, global_step):
# Calculate and clip gradients
params = tf.trainable_variables()
gradients = tf.gradients(loss, params)
clipped_gradients, _ = tf.clip_by_global_norm(
gradients,
self.config.max_gradient_norm
)
# Opti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _optimize(self):\n # Retrieve all trainable variables\n train_variables = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)\n\n # Compute the gradient (return a pair of variable and their respective gradient)\n grads = self.optimizer.compute_gradients(loss=self.loss, var_list=trai... | [
"0.7602666",
"0.747355",
"0.73952514",
"0.7230327",
"0.7107085",
"0.7087083",
"0.7053867",
"0.69550973",
"0.68434846",
"0.68424076",
"0.68309206",
"0.6783665",
"0.6721693",
"0.67049515",
"0.66924775",
"0.6641975",
"0.6584569",
"0.6563159",
"0.65391326",
"0.6534081",
"0.652209... | 0.6325796 | 36 |
Creates an optimizer and applies the gradients to all trainable variables. | def add_training_op(self, loss, global_step):
# Calculate and clip gradients
params = tf.trainable_variables()
gradients = tf.gradients(loss, params)
clipped_gradients, _ = tf.clip_by_global_norm(
gradients,
self.config.max_gradient_norm
)
# Opti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _optimize(self):\n # Retrieve all trainable variables\n train_variables = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)\n\n # Compute the gradient (return a pair of variable and their respective gradient)\n grads = self.optimizer.compute_gradients(loss=self.loss, var_list=trai... | [
"0.76019984",
"0.74737346",
"0.73964405",
"0.7229506",
"0.710572",
"0.7086818",
"0.70538044",
"0.69551605",
"0.68436944",
"0.6842918",
"0.6831712",
"0.6783377",
"0.67218363",
"0.67048717",
"0.66930056",
"0.6641727",
"0.65861505",
"0.6564599",
"0.6539085",
"0.65337276",
"0.652... | 0.63445395 | 32 |
convert MySQL timestamp to datetime | def convert_timestamp(ts):
format = '%Y-%m-%d %H:%M:%S'
return datetime.strptime(ts, format) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mysql_timestamp_converter(timestamp):\n if timestamp[4] == '-':\n return datetime_or_None(timestamp)\n timestamp += \"0\"*(14-len(timestamp)) # padding\n year, month, day, hour, minute, second = \\\n int(timestamp[:4]), int(timestamp[4:6]), int(timestamp[6:8]), \\\n int(timestamp[... | [
"0.77829003",
"0.7010029",
"0.6845619",
"0.67591673",
"0.6717474",
"0.67072576",
"0.6706572",
"0.6541347",
"0.640038",
"0.63838106",
"0.63502055",
"0.6260463",
"0.6218308",
"0.6216306",
"0.6183532",
"0.6134314",
"0.61161196",
"0.61146975",
"0.61005396",
"0.6095403",
"0.608007... | 0.6650869 | 7 |
Number of items in this container. | def __len__(self):
return len(self.items) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def items_num(self):\n return len(self.items)",
"def items_count(self):\n return len(self.items)",
"def items_num(self):\n\t\treturn len(self.items)",
"def items_num(self):\n\t\treturn len(self.items)",
"def size(self) -> int:\n return self.num_items",
"def get_num_items(self):\r\n ... | [
"0.8741414",
"0.870422",
"0.8616444",
"0.8616444",
"0.8564642",
"0.8551799",
"0.84417975",
"0.8433523",
"0.83744204",
"0.8125933",
"0.81075835",
"0.8097785",
"0.8085924",
"0.8085924",
"0.8085924",
"0.8085924",
"0.8085924",
"0.80436784",
"0.8008414",
"0.8006885",
"0.79698616",... | 0.7501497 | 49 |
Get the kind of this token. | def kind(self):
return self._kind | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kind(self):\r\n return TokenKind.from_value(conf.lib.clang_getTokenKind(self))",
"def token_type(self) -> str:\n return self._token_type",
"def token_type(self) -> str:\n return self._token_type",
"def token_type(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self,... | [
"0.7913713",
"0.7874426",
"0.7874426",
"0.77519107",
"0.7514257",
"0.7514257",
"0.7482885",
"0.7372285",
"0.7361082",
"0.7339658",
"0.73053753",
"0.73053753",
"0.73053753",
"0.73053753",
"0.73053753",
"0.73053753",
"0.73053753",
"0.73053753",
"0.73053753",
"0.73053753",
"0.73... | 0.7303887 | 36 |
Get the value of this token. | def value(self):
return self._value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getValue(self):\n \n return self._value",
"def get(self):\n return self._value",
"def get_value(self):\n return self._value",
"def get_value(self):\n return self._value",
"def get_value(self):\n return self._value",
"def get_value(self):\n return s... | [
"0.7911703",
"0.78716505",
"0.7860829",
"0.7860829",
"0.7860829",
"0.7810166",
"0.7810166",
"0.7808797",
"0.7806703",
"0.7791883",
"0.7758687",
"0.7758687",
"0.7758687",
"0.775261",
"0.7745407",
"0.7717471",
"0.77137625",
"0.7697193",
"0.76841635",
"0.76841635",
"0.76841635",... | 0.75800484 | 48 |
String representation of this Parser. | def __repr__(self):
if self.tokenizer is not None:
tok = self.tokenizer.__repr__()
else:
tok = None
if self.grammar is not None:
gr = self.grammar.__repr__()
else:
gr = None
return "%s(%s, %s)" % (self.__class__.__name__, tok, gr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return self.str_parse_tree(0)",
"def __str__(self) :\n if not self.parsed :\n return \"\"\n mybuffer = []\n mybuffer.append(\"IPP version : %s.%s\" % self.version)\n mybuffer.append(\"IPP operation Id : 0x%04x\" % self.operation_id)\n mybu... | [
"0.7421955",
"0.7210431",
"0.7145681",
"0.71311057",
"0.7080356",
"0.7047601",
"0.7026195",
"0.70037293",
"0.6999853",
"0.6991449",
"0.6958756",
"0.6935437",
"0.6929929",
"0.6928658",
"0.6918804",
"0.6912121",
"0.6911741",
"0.6909374",
"0.68920237",
"0.6884707",
"0.6884707",
... | 0.69677925 | 10 |
Fully expand a path, optionally with an explicit cwd. | def expand_path(path, cwd=None):
expand = lambda path: path_utils.realpath(path_utils.expanduser(path))
with cd(cwd):
return expand(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expandpath(path):\n return os.path.abspath(os.path.expanduser(path))",
"def expand_path(path):\n return expanduser(expandvars(path))",
"def ExpandPath(path):\n return os.path.realpath(os.path.expanduser(path))",
"def expand_path(path):\n\n return os.path.abspath(os.path.expanduser(os.path.expan... | [
"0.74701923",
"0.73939276",
"0.73707473",
"0.7219343",
"0.7219343",
"0.71664995",
"0.7078088",
"0.6832545",
"0.6721617",
"0.6641923",
"0.6560282",
"0.655823",
"0.65138286",
"0.65120006",
"0.6336295",
"0.62854826",
"0.62736595",
"0.62604237",
"0.61930496",
"0.6163498",
"0.6128... | 0.85340816 | 0 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.7448925 | 77 |
Check that we only render content once or if it has been marked as dirty. | def test_dirty_cache() -> None:
content = [
Strip([Segment("foo")]),
Strip([Segment("bar")]),
Strip([Segment("baz")]),
]
rendered_lines: list[int] = []
def get_content_line(y: int) -> Strip:
rendered_lines.append(y)
return content[y]
styles = Styles()
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dirty(self):\n return not self.consistent",
"def isDirty(self):\n\t#@DEBUG christophe have to fix denoising optionnal issue prior to set isDirty() to True\n return False",
"def dirty(self) -> bool:\n return self.__dirty",
"def isdirty(self):\n\n return not not self._olddata",
... | [
"0.6831709",
"0.6653389",
"0.6605487",
"0.65676063",
"0.6544088",
"0.6544088",
"0.6519632",
"0.6519632",
"0.64638853",
"0.63433987",
"0.63317883",
"0.63255334",
"0.63002825",
"0.62966454",
"0.6286773",
"0.62516475",
"0.6181001",
"0.6179943",
"0.61733055",
"0.61635214",
"0.612... | 0.55647093 | 66 |
Returns the sign of `x`. | def signum(x: float) -> float:
if x < 0:
return -1.0
elif x > 0:
return 1.0
return 0.0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign(x):\n if x >= 0:\n return 1\n else:\n return -1",
"def sign(x):\n return(copysign(1, x))",
"def sign(x):\n if x >= 0:\n return 1\n return -1",
"def sign(x):\n if x < 0.0:\n sign = -1\n elif x == 0.0:\n sign = 0\n elif x > 0.0:\n sign ... | [
"0.8346233",
"0.82875556",
"0.8269807",
"0.7635054",
"0.735797",
"0.7207477",
"0.70154953",
"0.6905191",
"0.6843425",
"0.68372285",
"0.68205696",
"0.6807225",
"0.6597398",
"0.65678513",
"0.65187556",
"0.64728045",
"0.64074284",
"0.6390278",
"0.6282725",
"0.62244296",
"0.62036... | 0.759822 | 4 |
The name of the application. | def application_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "application_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name():\n return config.APP_NAME",
"def app_name(self) -> str:\n return self._app_name",
"def app_name(self):\n return self._app_name",
"def app_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"app_name\")",
"def app_name(self): # pylint:disable=funct... | [
"0.88987994",
"0.8826656",
"0.87065256",
"0.8581351",
"0.85392845",
"0.8536273",
"0.8536273",
"0.82712877",
"0.8257125",
"0.8210752",
"0.82000256",
"0.8166687",
"0.81319946",
"0.7960315",
"0.7956777",
"0.7956144",
"0.7917794",
"0.7791835",
"0.76966834",
"0.7654247",
"0.761626... | 0.8217089 | 11 |
The ID of the resource group. | def resource_group_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "resource_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(se... | [
"0.86649776",
"0.86649776",
"0.86649776",
"0.86649776",
"0.86649776",
"0.8630538",
"0.8593075",
"0.8593075",
"0.85067636",
"0.84712285",
"0.82789487",
"0.82789487",
"0.82789487",
"0.82233447",
"0.82016224",
"0.82015216",
"0.82015216",
"0.82015216",
"0.8195097",
"0.81241107",
... | 0.7949326 | 29 |
The name of the application. | def application_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "application_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name():\n return config.APP_NAME",
"def app_name(self) -> str:\n return self._app_name",
"def app_name(self):\n return self._app_name",
"def app_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"app_name\")",
"def app_name(self): # pylint:disable=funct... | [
"0.88987994",
"0.8826656",
"0.87065256",
"0.8581351",
"0.85392845",
"0.8536273",
"0.8536273",
"0.82712877",
"0.8257125",
"0.8217089",
"0.8217089",
"0.8217089",
"0.8217089",
"0.8210752",
"0.82000256",
"0.8166687",
"0.81319946",
"0.7960315",
"0.7956144",
"0.7917794",
"0.7791835... | 0.7956777 | 18 |
The ID of the resource group. | def resource_group_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "resource_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(se... | [
"0.8665304",
"0.8665304",
"0.8665304",
"0.8665304",
"0.8665304",
"0.86281866",
"0.859016",
"0.859016",
"0.85036665",
"0.84688574",
"0.8275475",
"0.8275475",
"0.8275475",
"0.8220084",
"0.820102",
"0.820102",
"0.820102",
"0.819787",
"0.81914556",
"0.8124308",
"0.80705386",
"0... | 0.79497033 | 27 |
Provides a OOS Application resource. | def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
application_name: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
resource_group_id: Optional[pulumi.Input[s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_app(self):\n return Application()",
"def app():\n app = create_app()\n return app",
"def app():\n return aplicattion",
"def app(self):\n if self._application is None:\n self._application = Application(client=self)\n return self._application",
"def get_app(se... | [
"0.73059857",
"0.7058227",
"0.7043523",
"0.70319784",
"0.7018068",
"0.6977092",
"0.69748026",
"0.6823485",
"0.6793263",
"0.6662604",
"0.6583928",
"0.6583928",
"0.6533822",
"0.64895785",
"0.6478171",
"0.6468239",
"0.6433674",
"0.6426639",
"0.64216334",
"0.6416922",
"0.6408542"... | 0.0 | -1 |
Provides a OOS Application resource. | def __init__(__self__,
resource_name: str,
args: ApplicationArgs,
opts: Optional[pulumi.ResourceOptions] = None):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_app(self):\n return Application()",
"def app():\n app = create_app()\n return app",
"def app():\n return aplicattion",
"def app(self):\n if self._application is None:\n self._application = Application(client=self)\n return self._application",
"def get_app(se... | [
"0.73088515",
"0.7060569",
"0.70460725",
"0.7033564",
"0.7020643",
"0.6979786",
"0.6975532",
"0.6826027",
"0.67952526",
"0.666471",
"0.6585517",
"0.6585517",
"0.6536473",
"0.6490091",
"0.6480043",
"0.64701754",
"0.643532",
"0.6428545",
"0.6422514",
"0.6417917",
"0.6409242",
... | 0.60446274 | 48 |
Get an existing Application resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
application_name: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
resource_group_id: Optional[pulumi.Input[str]] = None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n app_name: Optional[pulumi.Input[str]] = None,\n bundle_id: Optional[pulumi.Input[str]] = None,\n encoded_icon: Optional[pulumi.Input[str]] = None,\n ... | [
"0.630705",
"0.62093353",
"0.5937807",
"0.5906766",
"0.58660024",
"0.5842525",
"0.5815528",
"0.5810119",
"0.57605904",
"0.5707702",
"0.56638414",
"0.5595551",
"0.5584274",
"0.5507556",
"0.54897803",
"0.54602087",
"0.545936",
"0.5440434",
"0.5406404",
"0.53876024",
"0.5386581"... | 0.6578928 | 0 |
The name of the application. | def application_name(self) -> pulumi.Output[str]:
return pulumi.get(self, "application_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name():\n return config.APP_NAME",
"def app_name(self) -> str:\n return self._app_name",
"def app_name(self):\n return self._app_name",
"def app_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"app_name\")",
"def app_name(self): # pylint:disable=funct... | [
"0.88987994",
"0.8826656",
"0.87065256",
"0.8581351",
"0.85392845",
"0.82712877",
"0.8257125",
"0.8217089",
"0.8217089",
"0.8217089",
"0.8217089",
"0.8210752",
"0.82000256",
"0.8166687",
"0.81319946",
"0.7960315",
"0.7956777",
"0.7956144",
"0.7917794",
"0.7791835",
"0.7696683... | 0.8536273 | 5 |
The ID of the resource group. | def resource_group_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "resource_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(se... | [
"0.86649776",
"0.86649776",
"0.86649776",
"0.86649776",
"0.86649776",
"0.8630538",
"0.8593075",
"0.8593075",
"0.85067636",
"0.84712285",
"0.82789487",
"0.82789487",
"0.82789487",
"0.82233447",
"0.82016224",
"0.8195097",
"0.81241107",
"0.8074215",
"0.80596274",
"0.7949326",
"0... | 0.82015216 | 17 |
returns a list of paragraphs contained in the text | def get_paragraphs(text):
return [LINE_START.sub(' ', p) for p in PARAGRAPH_SEP.split(text)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paragraph(self, text):\n return [text]",
"def split_text_into_paragraphs(text: str) -> List[str]:\n text_aux = text.strip()\n paragraphs = text_aux.split('\\n\\n') # Strip any leading whitespaces\n\n for p in paragraphs:\n p = p.strip()\n\n return [p.strip() for p in paragraphs if l... | [
"0.83955187",
"0.8125166",
"0.73720586",
"0.73144215",
"0.72213405",
"0.72148705",
"0.7213667",
"0.71561956",
"0.7006088",
"0.69887197",
"0.6966877",
"0.6940387",
"0.6864319",
"0.67950994",
"0.6791216",
"0.6780613",
"0.67112476",
"0.6685332",
"0.66705334",
"0.6630639",
"0.656... | 0.84038633 | 0 |
Ensure that every item in the response contains an array of tags. | def items_should_contain_array_of_tags(context):
items = context.response.json()['items']
for item in items:
assert 'tags' in item
assert isinstance(item['tags'], list)
assert len(item['tags']) > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_badge_should_have_tags(self):\n\n badge = self.get_sample_badge()\n # It's a string, even though it is used as a URL\n self.assertIsInstance(badge.tags, list)",
"def tags(self, val: list):\n self._tags = []\n if val is not None:\n for item in val:\n ... | [
"0.65274763",
"0.6096695",
"0.60390615",
"0.6012579",
"0.59465754",
"0.5924211",
"0.5851703",
"0.58414054",
"0.58393604",
"0.574799",
"0.5740444",
"0.57277584",
"0.57275933",
"0.5697522",
"0.568074",
"0.56763333",
"0.5671604",
"0.56634396",
"0.56573635",
"0.5625177",
"0.56193... | 0.8310971 | 0 |
Ensure that every item in the response contains a valid Owner object. | def items_should_contain_owner_object(context):
items = context.response.json()['items']
existing_owner_fields = [
'accept_rate', 'display_name', 'link', 'profile_image', 'reputation',
'user_id', 'user_type'
]
non_existing_owner_fields = ['display_name', 'user_type']
for item in ite... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_owner(self):\n self.business_item_class.businesses_list = [{\"owner\": \"chairman\", \"business_name\":\"Maendeleo\", \"category\":\"Backaend\", \"location\":\"myhomecity\"},\n {\"owner\": \"chairmanwe\", \"business_name\":\"NshMaendeleo\", \"category... | [
"0.67120254",
"0.628647",
"0.626169",
"0.6243804",
"0.6208822",
"0.62073964",
"0.61624324",
"0.6073476",
"0.58263224",
"0.5776256",
"0.5770972",
"0.5699032",
"0.56948596",
"0.56849164",
"0.568436",
"0.5622189",
"0.5601501",
"0.55977744",
"0.55893403",
"0.5566115",
"0.5523703"... | 0.746889 | 0 |
Ensure that every item in the response has all required fields. | def items_should_contain_required_values(context):
items = context.response.json()['items']
item_fields = [
'answer_count', 'creation_date', 'is_answered', 'last_activity_date',
'last_edit_date', 'link', 'question_id', 'score', 'title', 'view_count'
]
for item in items:
all(field... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_required_fields(self):\n assert self.title\n assert self.format",
"def validate_get_openings_result(self, result):\n\n\n requiredFields = {'company', 'title', 'url', 'locations'}\n #optionalFields = {'department', 'description'}\n\n for r in result:\n if not requiredField... | [
"0.68737304",
"0.68655205",
"0.66592115",
"0.6587089",
"0.64782315",
"0.64589465",
"0.64533013",
"0.6435127",
"0.64257926",
"0.64171165",
"0.63953066",
"0.6352463",
"0.6342748",
"0.62600017",
"0.6251869",
"0.62157905",
"0.61955905",
"0.6174185",
"0.6167766",
"0.6143471",
"0.6... | 0.7643728 | 0 |
Ensure that every existing owner has a valid profile link. | def every_existing_owner_should_have_valid_profile_link(context):
items = context.response.json()['items']
for item in items:
owner = item['owner']
if owner['user_type'] == 'does_not_exist':
continue
link = owner['link']
assert validators.url(link), (
'Own... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def every_existing_owner_should_have_valid_profile_image_link(context):\n items = context.response.json()['items']\n for item in items:\n owner = item['owner']\n if owner['user_type'] == 'does_not_exist':\n continue\n link = owner['profile_image']\n assert validators.ur... | [
"0.81346124",
"0.7327867",
"0.70217496",
"0.57078815",
"0.56042165",
"0.5574404",
"0.5555378",
"0.5555031",
"0.5531482",
"0.55212975",
"0.54598325",
"0.5458646",
"0.54356337",
"0.5423258",
"0.54028314",
"0.53994626",
"0.5353369",
"0.5349723",
"0.5343116",
"0.5318732",
"0.5305... | 0.8567939 | 0 |
Ensure that every nonexisting owner does not have a profile link. | def every_non_existing_owner_should_not_have_profile_link(context):
items = context.response.json()['items']
for item in items:
owner = item['owner']
if not owner['user_type'] == 'does_not_exist':
continue
assert 'link' not in owner
logging.debug(
'Not exi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def every_non_existing_owner_should_not_have_profile_image_link(context):\n items = context.response.json()['items']\n for item in items:\n owner = item['owner']\n if not owner['user_type'] == 'does_not_exist':\n continue\n assert 'profile_image' not in owner\n logging.... | [
"0.7915558",
"0.7725596",
"0.732559",
"0.5984721",
"0.5927636",
"0.5710254",
"0.56239164",
"0.561968",
"0.55680996",
"0.5519447",
"0.5508988",
"0.55037135",
"0.5468769",
"0.54237384",
"0.5405099",
"0.5354824",
"0.5347382",
"0.5337534",
"0.5323421",
"0.5308325",
"0.5308029",
... | 0.8253403 | 0 |
Ensure that every existing owner has a valid profile image link. | def every_existing_owner_should_have_valid_profile_image_link(context):
items = context.response.json()['items']
for item in items:
owner = item['owner']
if owner['user_type'] == 'does_not_exist':
continue
link = owner['profile_image']
assert validators.url(link), (
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def every_existing_owner_should_have_valid_profile_link(context):\n items = context.response.json()['items']\n for item in items:\n owner = item['owner']\n if owner['user_type'] == 'does_not_exist':\n continue\n link = owner['link']\n assert validators.url(link), (\n ... | [
"0.79280406",
"0.7527706",
"0.6885025",
"0.60402876",
"0.6003037",
"0.59512144",
"0.5904009",
"0.56071186",
"0.5574767",
"0.5533807",
"0.5490869",
"0.5467004",
"0.54500294",
"0.5436294",
"0.5308155",
"0.530222",
"0.5301662",
"0.52993053",
"0.5294203",
"0.5291245",
"0.52869546... | 0.8664172 | 0 |
Ensure that every nonexisting owner does not have a profile image link. | def every_non_existing_owner_should_not_have_profile_image_link(context):
items = context.response.json()['items']
for item in items:
owner = item['owner']
if not owner['user_type'] == 'does_not_exist':
continue
assert 'profile_image' not in owner
logging.debug(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def every_existing_owner_should_have_valid_profile_image_link(context):\n items = context.response.json()['items']\n for item in items:\n owner = item['owner']\n if owner['user_type'] == 'does_not_exist':\n continue\n link = owner['profile_image']\n assert validators.ur... | [
"0.7888664",
"0.7846485",
"0.7278047",
"0.5966033",
"0.577156",
"0.56805646",
"0.5594332",
"0.55319285",
"0.55122435",
"0.55100256",
"0.54839927",
"0.54645336",
"0.5443735",
"0.5442845",
"0.5432065",
"0.5430972",
"0.54200304",
"0.5411189",
"0.538969",
"0.53602254",
"0.5352974... | 0.8378017 | 0 |
Ensure that we have a list of tags without duplicates. | def tags_list_should_have_no_duplicates(context):
assert context.tags
# converting a list to a set will remove all the duplicates
# then we need to:
# * convert it back to a list
# * sort both lists
# and finally compare both lists
unique_tags = list(set(context.tags))
assert sorted(cont... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_duplicate(self):\r\n self.elements = list(set(self.elements))\r\n self.elements = [e for e in self.elements if e != '']",
"def remove_duplicates_badSolution( li ):\n newli=[]\n seen = set()\n for item in li:\n if item not in seen:\n seen.add( item )\n ... | [
"0.66453546",
"0.6560592",
"0.6466691",
"0.64423674",
"0.6351733",
"0.6341819",
"0.6310374",
"0.6308325",
"0.6288973",
"0.6214205",
"0.6203075",
"0.6181489",
"0.6177429",
"0.61650187",
"0.61602896",
"0.61400074",
"0.61346847",
"0.61290574",
"0.61288965",
"0.6081481",
"0.60346... | 0.8150041 | 0 |
Compare original JSON with its modified copy. | def compare_original_response_with_copy(context):
original = context.response.json()
copy = context.response_copy
def compare_top_level_values():
# get the list of fields that are JSON values not arrays
keys = [val for val in original.iterkeys() if not isinstance(original[val], (dict, list,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_json(json1, json2):\r\n return JsonType.eq(json1, json2)",
"def compare_json_to_json(json1, json2): # , json_object, filters):\n return ordered(json1) == ordered(json2)",
"def compare_json(js1, js2):\n return js1.items() <= js2.items()",
"def __eq__(self, other) -> bool:\n if jso... | [
"0.76559675",
"0.7507114",
"0.7321742",
"0.680047",
"0.6643478",
"0.6392799",
"0.6192952",
"0.61904955",
"0.6173847",
"0.6120342",
"0.6098039",
"0.6032834",
"0.60087913",
"0.59683764",
"0.5956568",
"0.58886045",
"0.5844679",
"0.57932216",
"0.5773257",
"0.57683474",
"0.5761158... | 0.71568364 | 3 |
Return the min node of a BST subtree. | def _min_node(node):
if not node:
return None
i = node
while i.left:
i = i.left
return i | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_min(self) -> TreeNode:\n node = self.root\n while True:\n if not node.left:\n return node\n node = node.left",
"def _find_smallest(node):\n if node.left:\n return BinarySearchTree._find_smallest(node.left)\n else:\n r... | [
"0.8181223",
"0.7754536",
"0.7699864",
"0.7666253",
"0.7632981",
"0.76130587",
"0.7516755",
"0.75156",
"0.7462528",
"0.7420651",
"0.73975736",
"0.73489773",
"0.7188644",
"0.7147024",
"0.71064144",
"0.7091051",
"0.70677614",
"0.706635",
"0.70491433",
"0.7002115",
"0.69909126",... | 0.79107755 | 1 |
Return True if the update happened, False if it did not | def update(db, spec, doc):
resp = db.sole.sole.update(spec, doc, upsert=False, safe=True)
if (resp.get('updatedExisting') == False):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_updated(self):\n return self.timestamp > 0",
"def needs_update(self) -> bool:\n return False",
"def hasChanged(self):\r\n if self.is_updated:\r\n self.is_updated = False\r\n return True\r\n else:\r\n return False\r\n\r\n # if not self.h... | [
"0.82221776",
"0.81986374",
"0.8170888",
"0.80791825",
"0.7879904",
"0.7732131",
"0.76466054",
"0.7580046",
"0.7571564",
"0.754413",
"0.7488154",
"0.746068",
"0.7378105",
"0.7359835",
"0.73528314",
"0.7308108",
"0.72857326",
"0.72699004",
"0.7263354",
"0.72479844",
"0.7240922... | 0.0 | -1 |
Pad x and y so that the results have the same length (second dimension). | def _pad_tensors_to_same_length(x, y):
with tf.compat.v1.name_scope("pad_to_same_length"):
x_length = tf.shape(input=x)[1]
y_length = tf.shape(input=y)[1]
max_length = tf.maximum(x_length, y_length)
x = tf.pad(tensor=x, paddings=[[0, 0], [0, max_length - x_length], [0, 0]])
y = tf.pad(tensor=y, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad_vals(x, y):\n\n xshapes = []\n for x_arr in x:\n\n x_arr = np.array(x_arr)\n xshapes.append(x_arr.shape[0])\n\n x_max_shape = np.max(xshapes)\n for i, x_arr in enumerate(x):\n\n pad_len = x_max_shape - x_arr.shape[0]\n x[i] = np.pad(x_arr, (0, pad_len), mode='constan... | [
"0.72084653",
"0.64343303",
"0.6101265",
"0.6084313",
"0.60171574",
"0.5993216",
"0.5956909",
"0.59541947",
"0.59405696",
"0.59165305",
"0.5867438",
"0.58579695",
"0.5835595",
"0.58168256",
"0.5816696",
"0.5811862",
"0.57709336",
"0.5734227",
"0.5715207",
"0.5693807",
"0.5685... | 0.7147605 | 1 |
Percentage of times that predictions matches labels on non0s. | def padded_accuracy(logits, labels):
with tf.compat.v1.variable_scope("padded_accuracy", values=[logits, labels]):
logits, labels = _pad_tensors_to_same_length(logits, labels)
weights = tf.cast(tf.not_equal(labels, 0), dtype=tf.float32)
outputs = tf.cast(tf.argmax(input=logits, axis=-1), dtype=tf.int32)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_accuracies(preds, labels):\n num_correct = num_correct_fun(preds, labels)\n return (num_correct / preds.size(0)) * 100.0",
"def percent_accuracy(self, true_values, predicted_values):\n\n correct = 0\n size = len(true_values)\n for i in range(len(true_values)):\n tr... | [
"0.76227057",
"0.7379493",
"0.72297883",
"0.722671",
"0.71479374",
"0.71069294",
"0.7047552",
"0.70354223",
"0.7023279",
"0.7022213",
"0.70219743",
"0.6970781",
"0.6960516",
"0.69523424",
"0.69481045",
"0.6926855",
"0.692359",
"0.6909524",
"0.68767715",
"0.68717813",
"0.68661... | 0.0 | -1 |
Percentage of times that topk predictions matches labels on non0s. | def padded_accuracy_topk(logits, labels, k):
with tf.compat.v1.variable_scope("padded_accuracy_topk", values=[logits, labels]):
logits, labels = _pad_tensors_to_same_length(logits, labels)
weights = tf.cast(tf.not_equal(labels, 0), dtype=tf.float32)
effective_k = tf.minimum(k, tf.shape(input=logits)[-1])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topk_accuracies(preds, labels, ks):\n num_topks_correct = topks_correct(preds, labels, ks)\n return [(x / preds.size(0)) * 100.0 for x in num_topks_correct]",
"def topk_errors(preds, labels, ks):\n num_topks_correct = topks_correct(preds, labels, ks)\n return [(1.0 - x / preds.size(0)) * 100.0 fo... | [
"0.78908753",
"0.73390025",
"0.7233049",
"0.72291976",
"0.7195095",
"0.70900184",
"0.7036402",
"0.70240974",
"0.69874215",
"0.6977213",
"0.6972062",
"0.6952351",
"0.6952351",
"0.69479007",
"0.69431925",
"0.69333524",
"0.69322234",
"0.6922573",
"0.6919798",
"0.6919798",
"0.691... | 0.0 | -1 |
Percentage of times that predictions matches labels everywhere (non0). | def padded_sequence_accuracy(logits, labels):
with tf.compat.v1.variable_scope("padded_sequence_accuracy", values=[logits, labels]):
logits, labels = _pad_tensors_to_same_length(logits, labels)
weights = tf.cast(tf.not_equal(labels, 0), dtype=tf.float32)
outputs = tf.cast(tf.argmax(input=logits, axis=-1),... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_accuracies(preds, labels):\n num_correct = num_correct_fun(preds, labels)\n return (num_correct / preds.size(0)) * 100.0",
"def accuracy(predictions, labels):\n predictions = list(predictions)\n labels = list(labels)\n count = 0\n for i in range(len(labels)):\n if labels[i] == ... | [
"0.7791173",
"0.7454314",
"0.73788065",
"0.7339361",
"0.73184043",
"0.72473156",
"0.7175092",
"0.7150846",
"0.71485466",
"0.71371794",
"0.70903116",
"0.7048925",
"0.7027989",
"0.6983812",
"0.6973967",
"0.6961783",
"0.6957565",
"0.6949172",
"0.6945957",
"0.6927787",
"0.6919117... | 0.0 | -1 |
Extracts all ngrams up to a given maximum order from an input segment. | def _get_ngrams_with_counter(segment, max_order):
ngram_counts = collections.Counter()
for order in xrange(1, max_order + 1):
for i in xrange(0, len(segment) - order + 1):
ngram = tuple(segment[i:i + order])
ngram_counts[ngram] += 1
return ngram_counts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_ngrams(line, min_order=1, max_order=BLEU.NGRAM_ORDER) -> Counter:\n\n ngrams = Counter() # type: Counter\n tokens = line.split()\n for n in range(min_order, max_order + 1):\n for i in range(0, len(tokens) - n + 1):\n ngram = ' '.join(tokens[i: i + n])\n ... | [
"0.6581706",
"0.65742457",
"0.64183784",
"0.62482524",
"0.6233594",
"0.6122576",
"0.6087275",
"0.6044856",
"0.6036233",
"0.59712744",
"0.59699684",
"0.5965845",
"0.59467024",
"0.59328526",
"0.5909492",
"0.59071153",
"0.5855572",
"0.58542573",
"0.5828259",
"0.5820391",
"0.5790... | 0.62992704 | 3 |
The homepage is loaded using a combination of .write and .markdown. Contains description how app works | def load_homepage() -> None:
st.image("iwakka.png",
use_column_width=True)
st.header("Hello! This dashboard will help you to analize data from iWakka device")
st.write("Here are some step to process data: ")
st.header(" II. Download data")
st.write("Here you can download data")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home() :\n st.markdown(\"This application provides 3 mains modules :\")\n st.markdown(\"* **The prediction module :** enables you to assess client's liability based on its file\")\n st.markdown(\"* **The explorer module :** enables you to dig deeper into your client informations,\"\n \"... | [
"0.80281425",
"0.71578765",
"0.6982044",
"0.68896574",
"0.6870078",
"0.68403995",
"0.6818947",
"0.6801335",
"0.6782138",
"0.6779921",
"0.6769249",
"0.6699216",
"0.6699216",
"0.6691474",
"0.6685022",
"0.6680601",
"0.66717446",
"0.66556436",
"0.6655127",
"0.6645696",
"0.6633345... | 0.7181079 | 1 |
Create an upconvolution block. The UpConv block is described as two 3x3x3 convolutions followed by a 1x2x2 upsampling and a 1x2x2 convolution. | def upconv_block(i, filters, shape, activation='relu', padding='same',
data_format='channels_first'):
c1 = Conv3D(filters, shape, activation=activation,
padding=padding, data_format=data_format)(i)
c2 = Conv3D(filters, shape, activation=activation,
padding=paddin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TransitionUp(skip_connection, block_to_upsample, n_filters_keep):\n\n # Upsample\n l = ConcatLayer(block_to_upsample)\n l = Deconv2DLayer(l, n_filters_keep, filter_size=3, stride=2,\n crop='valid', W=HeUniform(gain='relu'), nonlinearity=linear)\n # Concatenate with skip connect... | [
"0.75059754",
"0.7405827",
"0.7343056",
"0.7191787",
"0.7009756",
"0.67640203",
"0.6476993",
"0.6149223",
"0.61063606",
"0.60550946",
"0.6042839",
"0.5964783",
"0.5945483",
"0.58963466",
"0.5880264",
"0.58630115",
"0.58589673",
"0.5828326",
"0.5823696",
"0.5789642",
"0.576217... | 0.70525795 | 4 |
Creates a dataset for given indices. | def create_dataset(f, idxs, dir, prefix, column_types):
vertex_offsets = f['NumberVertices']['value'].cumsum() - f['NumberVertices']['value']
N_vertices_squared = f['NumberVertices']['value']**2
distances_offsets = N_vertices_squared.cumsum() - N_vertices_squared
N_events = idxs.shape[0]
N_vertice... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_tf_dataset(arraysets,\n keys: Sequence[str] = None,\n index_range: slice = None,\n shuffle: bool = True):\n warnings.warn(\"Dataloaders are experimental in the current release.\", UserWarning)\n gasets = GroupedAsets(arraysets, keys, index_ran... | [
"0.69580275",
"0.6838277",
"0.6562803",
"0.65386677",
"0.6451008",
"0.6352824",
"0.6223742",
"0.617341",
"0.61549306",
"0.6129327",
"0.6103181",
"0.6091469",
"0.6040924",
"0.5985238",
"0.59806925",
"0.59120625",
"0.5899482",
"0.58715457",
"0.5867696",
"0.5812711",
"0.5798089"... | 0.60707647 | 12 |
The container identifier specified by the remote peer for this connection. | def remote_container(self):
return pn_connection_remote_container(self._impl) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def containerID(self):\n return self._container",
"def container_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"container_id\")",
"def cont_to_id(self):\n return self.client.containers.get(self.container).id",
"def container_id(self) -> Optional[pulumi.Input[str]]:... | [
"0.7823247",
"0.7631334",
"0.7505652",
"0.72765577",
"0.6903428",
"0.6780837",
"0.6612907",
"0.6609533",
"0.6499414",
"0.64055985",
"0.6392983",
"0.6380359",
"0.63076925",
"0.63030875",
"0.6295007",
"0.62870884",
"0.6277265",
"0.6234463",
"0.61574477",
"0.6150299",
"0.6100687... | 0.5996209 | 27 |
Returns a new session on this connection. | def session(self):
ssn = pn_session(self._impl)
if ssn is None:
raise (SessionException("Session allocation failed."))
else:
return Session(ssn) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_session(self):\n return self.Session()",
"def new_session(self):\n return self._SessionLocal()",
"def session(self):\n if not self._session: #Create new session if none exists\n return self._new_session()\n return self._session",
"def new_session(self):\n ... | [
"0.87472516",
"0.8538848",
"0.82636046",
"0.8147998",
"0.7816199",
"0.78104186",
"0.7774068",
"0.7762847",
"0.77171135",
"0.7702307",
"0.76919633",
"0.76516485",
"0.76498824",
"0.76144505",
"0.7558834",
"0.7452149",
"0.7364417",
"0.7301111",
"0.7244297",
"0.72338074",
"0.7216... | 0.7744462 | 8 |
Check type of X and y. It updates the format of X and y (such as dtype, convert sparse matrix to matrix format etc) if necessary. `X` and `y` might be array (numpy.ndarray or sparse matrix) for sklearn interface, but `X` might be chainer dataset. | def _check_X_y(self, X, y=None):
return X, y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_x_y(X, y):\n return check_X_y(X, y,\n accept_sparse=['csr', 'csc'], # Accept sparse csr, csc\n order=None, # Make no C or Fortran imposition\n copy=False, # Do not trigger copying\n force_all_fini... | [
"0.7357704",
"0.71228385",
"0.6991068",
"0.68687665",
"0.67003375",
"0.6683965",
"0.66768664",
"0.6642364",
"0.66209364",
"0.6410842",
"0.638924",
"0.6302818",
"0.6280338",
"0.6188695",
"0.6162823",
"0.614365",
"0.61106133",
"0.61106133",
"0.61106133",
"0.6007301",
"0.5995192... | 0.60455394 | 19 |
Forward computation without backward. Predicts by the model's output by returning `predictor`'s output | def _forward(self, *args, calc_score=False):
with chainer.using_config('train', False), chainer.no_backprop_mode():
if calc_score:
self(*args)
return self.y
else:
if self.predictor is None:
print("[ERROR] predictor is no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x: torch.Tensor) -> torch.Tensor:\n x = self.cnn.extractor.forward(x)\n return self.cnn.regressor(x)",
"def predict(self):\n\n self.eval()\n return self.forward(self.data)",
"def _forward(self, inputs):\n if is_tf_available():\n # TODO trace model... | [
"0.6860968",
"0.68073976",
"0.669606",
"0.6645282",
"0.6645282",
"0.6601591",
"0.65974206",
"0.6564332",
"0.65571326",
"0.6553761",
"0.6515261",
"0.64808273",
"0.64766705",
"0.64733636",
"0.6463601",
"0.6450425",
"0.6378297",
"0.63688016",
"0.63637966",
"0.6338201",
"0.631666... | 0.65510225 | 10 |
Return eigenvalues of the normalized Laplacian of G | def normalized_laplacian_spectrum(G, weight="weight"):
import scipy as sp
return sp.linalg.eigvalsh(
nx.normalized_laplacian_matrix(G, weight=weight).todense()
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalized_laplacian_eig(A, k=None):\n n, m = A.shape\n ##\n ## TODO: implement checks on the adjacency matrix\n ##\n degs = _flat(A.sum(axis=1))\n # the below will break if\n inv_root_degs = [d ** (-1 / 2) if d > _eps else 0 for d in degs]\n inv_rootD = sps.spdiags(inv_root_degs, [0], ... | [
"0.7213387",
"0.7147146",
"0.7072728",
"0.6660331",
"0.6454285",
"0.64340556",
"0.64190364",
"0.63966185",
"0.637547",
"0.63489413",
"0.62351114",
"0.6224991",
"0.61925143",
"0.61410123",
"0.61347854",
"0.6046363",
"0.60389954",
"0.6030647",
"0.6021971",
"0.5990303",
"0.59651... | 0.75299346 | 0 |
split \in {'train', 'valid'} | def _init_dataset(self, data_config, split='train'):
assert split in {'train', 'valid'}
# load datasets
print(f'Load {split} dataset')
if data_config['type'] == 'npy':
dataset = MSDMelDataset(
data_config['mel_root'], data_config[f'{split}_tids_fn'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def separate_train_valid(positives, validation_split):\n val_set = []\n shuffled_positives = shuffle_annotations(positives)\n upper = int(round(len(shuffled_positives)*validation_split))\n subset = shuffled_positives[0:upper]\n for each in subset:\n val_set.append(each)\n shuffled_pos... | [
"0.69135565",
"0.68534917",
"0.6759432",
"0.6724169",
"0.67077535",
"0.66944796",
"0.6665047",
"0.6556334",
"0.65530443",
"0.65233886",
"0.6499054",
"0.64943826",
"0.6471824",
"0.64580566",
"0.64397043",
"0.6389182",
"0.6363752",
"0.6351248",
"0.6340043",
"0.6307576",
"0.6287... | 0.0 | -1 |
Displays profile image in list view | def display_image(obj):
# Hard code 30x30 due to Django admin template list size.
return format_html(
'<img src=%s alt="Profile picture" width="30" height="30" />' %
(obj.image.url if obj.image else static("images/users/default-profile.jpg"))
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_thumb_tag(self):\n u = self.user\n uf = self.app.url_for\n image = None\n if u.image is not None and u.image!=\"\":\n try:\n image = uf(\"asset\", asset_id = self.app.module_map.uploader.get(u.image).variants['userlist']._id)\n except Asse... | [
"0.7129653",
"0.6621689",
"0.65483373",
"0.64459544",
"0.64231795",
"0.6406237",
"0.61998725",
"0.6183474",
"0.6164791",
"0.6151082",
"0.61323947",
"0.61049163",
"0.6097735",
"0.60965633",
"0.60905015",
"0.608497",
"0.60434407",
"0.6034201",
"0.5944758",
"0.59322846",
"0.5925... | 0.7441247 | 0 |
Gets all active virtual licenses account. | def get_active_virtual_licenses(self):
_mask = """billingItem[categoryCode,createDate,description],
key,id,ipAddress,
softwareDescription[longDescription,name,manufacturer],
subnet"""
return self.client['SoftLayer_Account'].getActiveVirtualLi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_active_account_licenses(self):\n\n _mask = \"\"\"billingItem,softwareDescription\"\"\"\n\n return self.client['SoftLayer_Account'].getActiveAccountLicenses(mask=_mask)",
"def getLicenseList(self):\n\n res = self.getRequest('licenses')\n licenses = list()\n if res:\n ... | [
"0.70768636",
"0.7066329",
"0.67577124",
"0.6587934",
"0.6521783",
"0.6378101",
"0.62645566",
"0.6172615",
"0.6158004",
"0.61289406",
"0.61268145",
"0.60705614",
"0.59099764",
"0.5833182",
"0.575935",
"0.57415587",
"0.5683667",
"0.56785446",
"0.5653936",
"0.55529094",
"0.5528... | 0.7763799 | 0 |
Return the value of the given state | def get_state_value(self, state):
values = self.get_all_state_action_values(state)
policy = self.target_policy(values)
return (values @ policy.probs.t()).item() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getValue(self, state):\n return self.values[state]",
"def getValue(self, state):\r\n return self.values[state]",
"def getValue(self, state):\n return self.values[state]",
"def getValue(self, state):\n return self.values[state]",
"def getValue(self, state):\n return self.v... | [
"0.8866701",
"0.8836032",
"0.87983",
"0.87983",
"0.87983",
"0.87983",
"0.87983",
"0.87983",
"0.87983",
"0.87983",
"0.87983",
"0.87983",
"0.87983",
"0.87983",
"0.8606197",
"0.8606197",
"0.8229139",
"0.8229139",
"0.81572795",
"0.7989323",
"0.79809093",
"0.78574026",
"0.7807... | 0.8202456 | 18 |
Return the value of the given stateaction pair | def get_state_action_value(self, state, action):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_value(self, state, action):\n return self.value_function[to_table_index(state, action)]",
"def getQValue(self, state, action):\n \"*** YOUR CODE HERE ***\"\n\n return self.values[(str(state), action)]",
"def getValue(self, state):\n return self.values[state]",
"def getQValu... | [
"0.80276626",
"0.7872588",
"0.76328826",
"0.75749767",
"0.75744814",
"0.7549472",
"0.7418124",
"0.73807997",
"0.73807997",
"0.73807997",
"0.73807997",
"0.73456675",
"0.7332363",
"0.73264176",
"0.73264176",
"0.73264176",
"0.73264176",
"0.73264176",
"0.73264176",
"0.73264176",
... | 0.795146 | 1 |
Return a probability distribution over actions | def get_behaviour_policy(self, state):
return self.behaviour_policy(state) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_probs(self, states, actions):\n # YOUR CODE HERE\n \n # So we need to determine for every input state-action pair, what the resulting policy distribution is\n # This means that the input will be a single state and a single action per index. \n # We then need to determine ... | [
"0.75595576",
"0.74884176",
"0.74101245",
"0.7358138",
"0.735802",
"0.7321238",
"0.7288396",
"0.71977127",
"0.71067834",
"0.7035673",
"0.6961088",
"0.6902661",
"0.6881273",
"0.68251896",
"0.68138194",
"0.67901003",
"0.6788828",
"0.67773473",
"0.67678297",
"0.6754605",
"0.6737... | 0.0 | -1 |
Return a probability distribution over actions | def get_target_policy(self, state):
values = self.get_all_state_action_values(state)
return self.target_policy(values) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_probs(self, states, actions):\n # YOUR CODE HERE\n \n # So we need to determine for every input state-action pair, what the resulting policy distribution is\n # This means that the input will be a single state and a single action per index. \n # We then need to determine ... | [
"0.75595576",
"0.74884176",
"0.74101245",
"0.7358138",
"0.735802",
"0.7321238",
"0.7288396",
"0.71977127",
"0.71067834",
"0.7035673",
"0.6961088",
"0.6902661",
"0.6881273",
"0.68251896",
"0.68138194",
"0.67901003",
"0.6788828",
"0.67773473",
"0.67678297",
"0.6754605",
"0.6737... | 0.0 | -1 |
A context manager yielding a database session. | def db_session_ctx(Session):
session = Session()
try:
yield session
session.commit()
except:
session.rollback()
raise
finally:
session.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_session() -> Generator:\n _session = session()\n try:\n yield _session\n finally:\n _session.close()",
"def db_session_context(db_name):\n try:\n db = psycopg2.connect(database=db_name)\n yield db\n finally:\n db.close()",
"def db_session():\n engine ... | [
"0.84718585",
"0.8074009",
"0.8037839",
"0.79979485",
"0.7983582",
"0.79507846",
"0.7949184",
"0.79094654",
"0.78912413",
"0.7855268",
"0.78155154",
"0.778266",
"0.7614033",
"0.7607433",
"0.7593117",
"0.7573233",
"0.75403404",
"0.7413446",
"0.74086285",
"0.7384218",
"0.737463... | 0.7547423 | 16 |
Checks that the version of the Solr core ``core`` matches the one in the schema. | def solr_version_check(core):
expected_version = SCHEMA[core].version
solr_uri = config.CFG.get("solr", "uri")
u = urllib2.urlopen("%s/%s/schema/version" % (solr_uri, core))
content = loads(u.read())
seen_version = content["version"]
if not seen_version == expected_version:
raise Version... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_solr_cores_version(cores):\n map(solr_version_check, cores)",
"def test_compare_schemas_major(self):\n status = schema_utils.compare_schemas(\n self.base_schema,\n self.major_removed_value\n )\n\n assert status == schema_utils.Update.major",
"def test_sch... | [
"0.6779413",
"0.5996153",
"0.5828003",
"0.57171905",
"0.57140726",
"0.56064177",
"0.55985236",
"0.55739886",
"0.5499899",
"0.54828817",
"0.5461677",
"0.5393078",
"0.53798366",
"0.53707933",
"0.5345438",
"0.5344237",
"0.5337947",
"0.5317535",
"0.5295003",
"0.5281345",
"0.52062... | 0.8537369 | 0 |
Gets gives you a string in base less than 20 | def dec2base(n, base):
convertstring = "0123456789ABCDEF"
if n < base:
return convertstring[n]
else:
return dec2base(n // base, base) + convertstring[n % base] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str(x):\n return str(x)[:200]",
"def getString(self, int: int, int2: int) -> str:\n ...",
"def str_base(num, base=36, numerals=\"0123456789abcdefghijklmnopqrstuvwxyz\"):\n if base < 2 or base > len(numerals):\n raise ValueError(\"`base` must be between 2 and %i\")\n\n if num == 0... | [
"0.61306405",
"0.5743126",
"0.5712135",
"0.56840897",
"0.56803316",
"0.5613111",
"0.55956316",
"0.5487813",
"0.5485353",
"0.54662246",
"0.5421135",
"0.5419046",
"0.5384076",
"0.53730214",
"0.53664714",
"0.53429157",
"0.5332639",
"0.53188115",
"0.53121996",
"0.5304874",
"0.530... | 0.0 | -1 |
Gets gives you a string in base less than 20 | def padded_dec2base(n, q, base):
convertstring = "0123456789ABCDEF"
if n < base:
return convertstring[n].zfill(q)
else:
return (dec2base(n // base, base) + convertstring[n % base]).zfill(q) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str(x):\n return str(x)[:200]",
"def getString(self, int: int, int2: int) -> str:\n ...",
"def str_base(num, base=36, numerals=\"0123456789abcdefghijklmnopqrstuvwxyz\"):\n if base < 2 or base > len(numerals):\n raise ValueError(\"`base` must be between 2 and %i\")\n\n if num == 0... | [
"0.6130242",
"0.5743642",
"0.57067406",
"0.56830925",
"0.5679255",
"0.5610704",
"0.5591267",
"0.5486736",
"0.54818887",
"0.5463564",
"0.541896",
"0.5418778",
"0.5381753",
"0.5369742",
"0.53678566",
"0.53397405",
"0.5329653",
"0.5317555",
"0.5309176",
"0.53040755",
"0.5300111"... | 0.0 | -1 |
This generates a string that is used to construct tensor products terms in Hamiltonian with a certain kind of interaction term. For example suppose we have an ising Hamiltonian with 4 qubits. We generate strings in a list 1100, 0110,0011. The zero will be used to tensor an identity and the 1 will be used to tensor the ... | def generatehamiltoniantring(n, s, onestring=None, pos=None, pad=None):
label = []
if onestring is None:
if isinstance(s, str):
for i in range(0, n):
strs = s
strs = strs.ljust(n-i, '0')
strs = strs.rjust(n, '0')
label.append(st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generatetensorstring(n, *args):\n out = ''\n label = 0\n arg = array(args) - 1\n\n for i in range(0, n):\n if i in arg:\n label += 1\n out += str(label)\n else:\n out += '0'\n return out",
"def generate_str (obj):\n d = obj.dim(obj)\n units ... | [
"0.67071134",
"0.6188811",
"0.61187154",
"0.60962516",
"0.60897434",
"0.5981579",
"0.59358764",
"0.57879096",
"0.57309914",
"0.57123774",
"0.5700587",
"0.56701165",
"0.5653385",
"0.5609417",
"0.55606216",
"0.55426735",
"0.55394495",
"0.5516998",
"0.5511794",
"0.550661",
"0.54... | 0.6213781 | 1 |
Return the given HTML with all tags stripped. | def strip_tags(value):
# Note: in typical case this loop executes _strip_once once. Loop condition
# is redundant, but helps to reduce number of executions of _strip_once.
value = str(value)
while "<" in value and ">" in value:
new_value = _strip_once(value)
if value.count("<") == new_va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stripHTMLTags (html):\r\n import re\r\n text = html\r\n \r\n # apply rules in given order!\r\n rules = [\r\n { r'>\\s+' : u'>'}, # remove spaces after a tag opens or closes\r\n { r'\\s+' : u' '}, # replace consecutive spaces\r\n { r'\\s*<br\\s*/?>\\s*' : u'\\n'},... | [
"0.82184535",
"0.81930643",
"0.81557626",
"0.8141694",
"0.81045276",
"0.81004316",
"0.803043",
"0.79539573",
"0.7940033",
"0.7934653",
"0.7933371",
"0.79037124",
"0.78986967",
"0.7886259",
"0.7878473",
"0.7878473",
"0.7841912",
"0.78334934",
"0.78334934",
"0.78146344",
"0.780... | 0.0 | -1 |
Construct a Game bean beanContext is an instance of nova.beanContext.BeanContext | def createBean(self, beanContext):
currentTime = DateTime.now()
return game.Game().construct(self.serialNum(), self.startTime(), self.endTime(), currentTime, nextProductionTime(currentTime, self), \
self.deathProbeCost(), self.spyProbeCost(), self.factoryCost(), self.speedCost(), self.rangeCost(), self.pro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,context=''):\n if context=='': \n context_name=self.__class__.__name__\n else: \n context_name=context+'.'+self.__class__.__name__ \n if not (context_name in self.__class__._nInstancesContextList):\n self.__class__._nInstancesContextList.appen... | [
"0.5429802",
"0.5398456",
"0.52547485",
"0.51466453",
"0.5145113",
"0.5114401",
"0.5002459",
"0.49618447",
"0.49233636",
"0.49038294",
"0.4899187",
"0.48675564",
"0.48630452",
"0.48493588",
"0.4817039",
"0.4813379",
"0.48067135",
"0.48053434",
"0.48048058",
"0.480347",
"0.479... | 0.77193683 | 0 |
Determine the sheet name needed based on the source. | def get_sheet_name(self, has_verbal_autopsy):
source_to_sheet = {
"India_MCCD_Orissa_ICD10": "India_MCCD_states_ICD10",
"India_MCCD_Delhi_ICD10": "India_MCCD_states_ICD10",
"Thailand_Public_Health_Statistics": "ICD10_tabulated",
"India_SRS_states_report": "India_S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sheet_name(self):\n\n xl = pd.ExcelFile(self.excel_file)\n sheet_names = xl.sheet_names\n for item in sheet_names:\n if re.match('(.*)Current primers', item, re.IGNORECASE): # Only extracts most recent primers.\n sheet_name = item\n return shee... | [
"0.7164989",
"0.6308564",
"0.61821693",
"0.603946",
"0.59906214",
"0.5879506",
"0.58683854",
"0.5754971",
"0.57401884",
"0.5708304",
"0.57011294",
"0.55058926",
"0.54911",
"0.5414342",
"0.5403765",
"0.53900576",
"0.5371769",
"0.5352899",
"0.53527546",
"0.5343347",
"0.5297994"... | 0.7110151 | 1 |
Quote a string or list of strings using the Condor submit file "new" argument quoting rules. Returns str The arguments in a quoted form. Warnings You will need to surround the result in doublequotes before using it in the Arguments attribute. Examples >>> quote_arguments(["3", "simple", "arguments"]) '3 simple argument... | def quote_arguments(args):
if isinstance(args, str):
args_list = [args]
else:
args_list = args
quoted_args = []
for a in args_list:
qa = _double_up_quotes(a)
if " " in qa or "'" in qa:
qa = "'" + qa + "'"
quoted_args.append(qa)
return " ".join(quo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argument_list_quote(arguments):\n args = []\n for arg in arguments:\n args.append(argument_quote(arg))\n return '\"%s\"' % ' '.join(args)",
"def _quote_arguments(args):\n return map(lambda x: '\"{}\"'.format(x) if ' ' in x else '{}'.format(x), args)",
"def argument_quote(argument):\n... | [
"0.7215548",
"0.6580144",
"0.6086504",
"0.5937315",
"0.5752094",
"0.56268567",
"0.55315644",
"0.544126",
"0.54088515",
"0.533452",
"0.5203533",
"0.5165263",
"0.51386887",
"0.51292366",
"0.5123674",
"0.50810844",
"0.5078379",
"0.5072677",
"0.50487226",
"0.50456464",
"0.5013752... | 0.74514025 | 0 |
Determine if fname is backup file name. | def isbackup(fname):
return bool(BACKUP_RE.search(fname)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_backuped_file(file_name):\n return str(file_name).endswith(BACKUPED_FILES)",
"def check_base_filename(self, record):\n time_tuple = time.localtime()\n\n if self.file_name_format:\n pass\n\n if self.suffix_time != time.strftime(self.suffix, time_tuple) or not os.path.exis... | [
"0.7815696",
"0.6688547",
"0.64778984",
"0.6264358",
"0.62476087",
"0.61512923",
"0.60459733",
"0.5963137",
"0.59307975",
"0.5864477",
"0.57959646",
"0.5760985",
"0.57010245",
"0.5660149",
"0.5625667",
"0.5619978",
"0.56119597",
"0.5611512",
"0.55985445",
"0.55823183",
"0.558... | 0.83070534 | 0 |
Return the fix word in table table at index index. | def _read_fix_word_in_table(self, table, index):
return self.stream.read_fix_word(self._position_in_table(table, index)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_word_with_index(index):\n return reverse_word_index[index-3]",
"def word_at(self, index, signed = False):\n return 0",
"def _position_in_table(self, table, index):\n\n return self.word_ptr(self.table_pointers[table], index)",
"def get_next_word(self, index, orignal=False):\n try:\... | [
"0.7023475",
"0.6607199",
"0.63332784",
"0.62407106",
"0.61667347",
"0.5965174",
"0.59546214",
"0.5891202",
"0.58116204",
"0.56669796",
"0.5634454",
"0.5632258",
"0.5579958",
"0.5555492",
"0.55403674",
"0.5468816",
"0.5456604",
"0.5415371",
"0.5396345",
"0.5366563",
"0.536528... | 0.8199197 | 0 |
Return the extensible recipe, four numbers, at index index. Extensible characters are specified by an extensible recipe, which consists of four bytes called top, mid, bot, and rep (in this order). These bytes are the character codes of individual pieces used to build up a large symbol. If top, mid, or bot are zero, the... | def _read_extensible_recipe(self, index):
return self._read_four_byte_numbers_in_table(tables.extensible_character, index) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _extract_extension_info(self, data, counter):\n try:\n if data[counter+47] == 11 or data[counter+50:counter+53] == b\"\\x0e\\xac\\x0b\" or data[82:85] == b\"\\x0f\\xf0\\x0b\":\n return \"|||\"\n\n count = 49 + counter\n length = int.from_bytes(data[counter... | [
"0.5214011",
"0.49292856",
"0.47483248",
"0.46619806",
"0.4635413",
"0.44699928",
"0.44410896",
"0.4437927",
"0.44217527",
"0.43964815",
"0.43601838",
"0.43417162",
"0.4337935",
"0.43295974",
"0.43120626",
"0.43041757",
"0.4291322",
"0.42824116",
"0.42597744",
"0.42349783",
"... | 0.76511264 | 0 |
Given a technique object, find examples in malware using technique, tools using technique and groups using technique. Return list with example data | def get_examples_table_data(technique, reference_list, next_reference_number):
# Creating map to avoid repeating the code 3 times
examples_map = [
{ 'example_type': config.tools_using_technique },
{ 'example_type': config.malware_using_technique },
{ 'example_type': config.groups_using... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_techniques(db):\n\n techniques = []\n for element in db:\n for technique in element['techniques_used']:\n if technique not in techniques:\n techniques.append(technique)\n \n return sorted(techniques)",
"def get_techniques_used_by_groups():\n global techniqu... | [
"0.628506",
"0.62599236",
"0.6136026",
"0.60789555",
"0.5992689",
"0.5951035",
"0.5889614",
"0.5713279",
"0.563185",
"0.5599353",
"0.5587775",
"0.55412316",
"0.5538815",
"0.5419111",
"0.5401357",
"0.5392721",
"0.53859246",
"0.5369623",
"0.5243388",
"0.52172226",
"0.521398",
... | 0.659891 | 0 |
Fill in blank areas on the edges of images Applies a Gaussian kernel with width `sigma` to fill in the the first `sigma` width of unfilled points. Then apply a `2 sigma` width Gaussian to fill the next `2 sigma` width of unfilled points. Etc. | def fill(img, sigma=1, erosion=2):
img = img.copy()
img = skimage.img_as_float(img)
h, w, d = img.shape
assert d == 4, "image must be RGBA"
raw_mask = (img[:, :, 3] != 0)
if raw_mask.sum() == 0:
return img
mask = morphology.binary_erosion(raw_mask, selem=morphology.disk(erosion))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian_kernel(size, sigma): \n \n kernel = np.zeros((size, size))\n\n #####################################\n # START YOUR CODE HERE #\n #####################################\n k = (size - 1) / 2\n sigma_sq = sigma ** 2\n pi_sigma = 1/(2 * np.pi * sigma_sq)\n for i in... | [
"0.61494803",
"0.60855705",
"0.5982485",
"0.5890864",
"0.58883697",
"0.5880866",
"0.586728",
"0.5848967",
"0.5832641",
"0.58226866",
"0.5791329",
"0.5754669",
"0.5750084",
"0.57419986",
"0.5730211",
"0.5723482",
"0.57178754",
"0.5703451",
"0.57008785",
"0.569052",
"0.56896883... | 0.71587646 | 0 |
take 1D float array of rewards and compute discounted reward | def discount_rewards(r, gamma=0.99):
discounted_r = np.zeros_like(r)
running_add = 0
for t in reversed(xrange(0, r.size)):
if r[t] != 0: running_add = 0 # reset the sum, since this was a game boundary (pong specific!)
running_add = running_add * gamma + r[t]
discounted_r[t] = running_add
return disc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discount_rewards(rewards):\r\n discounted_r = np.zeros_like(rewards)\r\n running_add = 0\r\n for t in reversed(range(0, len(rewards))): \r\n running_add = running_add * reward_discount + rewards[t]\r\n discounted_r[t] = running_add\r\n return discounted_r",
"def discoun... | [
"0.8100923",
"0.78397125",
"0.7792625",
"0.7742053",
"0.7653779",
"0.75987715",
"0.7583268",
"0.75820553",
"0.7579539",
"0.7536054",
"0.7519005",
"0.75047183",
"0.7467692",
"0.7456702",
"0.7433794",
"0.7426565",
"0.74062765",
"0.73950297",
"0.7370545",
"0.73564714",
"0.732851... | 0.67952156 | 33 |
Required property for the query path. | def query_path(self):
return '/search/{query}/{page}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def limit_path_query(self):\n return self._limit_path_query",
"def get_resource_query(self):\n pass",
"def get_resource_query(self):\n pass",
"def get_query(self):\r\n\r\n split = self.path_s.split(\"?\", 1)\r\n if len(split) == 1: return \"\"\r\n else: return split[... | [
"0.6866704",
"0.6247657",
"0.6247657",
"0.6202711",
"0.618199",
"0.6165729",
"0.6132307",
"0.6062342",
"0.6062342",
"0.6062342",
"0.6062342",
"0.6062342",
"0.6062342",
"0.6062342",
"0.6062342",
"0.6062342",
"0.6062342",
"0.6062342",
"0.5907455",
"0.5873216",
"0.5873216",
"0... | 0.5374146 | 79 |
Verifies that the email is unique | def clean_email_address(self):
c_d = self.cleaned_data
if User.objects.exclude(id=c_d['id']).filter(
email=c_d['email_address']):
raise forms.ValidationError(u'The email is already registered.')
return c_d['email_address'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_duplicate_email(self):\n self.signup('Bo', 'Theo', 'Bo_theo5@example.com', 'Bo1995', 'Bo1995')\n rv = self.signup('Bo', 'Theo', 'Bo_theo5@example.com', 'Bo1995', 'Bo1995')\n self.assertIn(b'Sorry email already exist', rv.data)",
"def validate_unique_email(email):\n if AssociatedE... | [
"0.77355355",
"0.76942474",
"0.75334007",
"0.75327843",
"0.7430414",
"0.7345387",
"0.7316601",
"0.72318655",
"0.72308826",
"0.72283435",
"0.7225057",
"0.71606964",
"0.71580625",
"0.7145288",
"0.71169734",
"0.71132576",
"0.71028686",
"0.7101186",
"0.7093278",
"0.7093278",
"0.7... | 0.6720548 | 51 |
Create a new queue. | def create_queue(self, queue_name='', exclusive=True, queue_size=10,
message_ttl=60000, overflow_behaviour='drop-head',
expires=600000):
args = {
'x-max-length': queue_size,
'x-overflow': overflow_behaviour,
'x-message-ttl': message_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _queue_create(self, **kwargs):\n name = self.generate_random_name()\n return self.clients(\"zaqar\").queue(name, **kwargs)",
"def new_queue() -> Queue:\n return multiprocessing.Queue()",
"def create_queue(self):\n queue_name = self.generate_name()\n try:\n queue = ... | [
"0.84256244",
"0.80481786",
"0.7837237",
"0.7533506",
"0.7467886",
"0.717403",
"0.7129509",
"0.7068409",
"0.70213354",
"0.6993228",
"0.68516374",
"0.6833725",
"0.6795976",
"0.676159",
"0.67119175",
"0.6704848",
"0.6704265",
"0.66924536",
"0.6631918",
"0.6602393",
"0.65828705"... | 0.7167157 | 6 |
Returns the transport used by the client instance. | def transport(self) -> TraceServiceTransport:
return self._client.transport | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transport(self):\n return self._transport",
"def transport(self) -> ServiceControllerTransport:\n return self._client.transport",
"def transport(self) -> MetadataServiceTransport:\n return self._client.transport",
"def transport(self) -> Controller2Transport:\n return self._cl... | [
"0.82946277",
"0.773594",
"0.773068",
"0.76806635",
"0.7674273",
"0.76357967",
"0.7558095",
"0.7551682",
"0.75303864",
"0.74958986",
"0.7488142",
"0.7436853",
"0.7423566",
"0.7368433",
"0.73340607",
"0.721926",
"0.7109823",
"0.7102308",
"0.68808985",
"0.68144",
"0.6671675",
... | 0.7887542 | 1 |
Test the DepartmentUserResource detail response | def test_detail(self):
# Test detail URL using ad_guid.
url = '/api/users/{}/'.format(self.user1.ad_guid)
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
# Test URL using email also.
url = '/api/users/{}/'.format(self.user1.email.lower())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_data_dept_user(self):\n url = '/api/options/?list=dept_user'\n response = self.client.get(url)\n self.assertEqual(response.status_code, 200)\n # User 1 will be present in the response.\n self.assertContains(response, self.user1.email)\n # Make a user inactive to t... | [
"0.722836",
"0.6757754",
"0.66205096",
"0.6576246",
"0.6565223",
"0.64823437",
"0.6452468",
"0.640094",
"0.63558656",
"0.6343852",
"0.62996393",
"0.6298576",
"0.629484",
"0.62794876",
"0.6237302",
"0.62220615",
"0.6208703",
"0.6194712",
"0.6190152",
"0.6186738",
"0.61780584",... | 0.66737914 | 2 |
Test the DepartmentUserResource org_structure response | def test_org_structure(self):
url = '/api/users/?org_structure=true'
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
# User 1 will be present in the response.
self.assertContains(response, self.user1.email)
# Division 1 will be present in the r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_data_org_structure(self):\n url = '/api/options/?list=org_structure'\n response = self.client.get(url)\n self.assertEqual(response.status_code, 200)\n # Division 1 will be present in the response.\n self.assertContains(response, self.div1.name)\n # Response can be... | [
"0.7079402",
"0.6818299",
"0.66625524",
"0.64964676",
"0.63513947",
"0.6324385",
"0.6287517",
"0.624722",
"0.6163514",
"0.607215",
"0.6066868",
"0.6002692",
"0.60003984",
"0.5983165",
"0.59071344",
"0.5842544",
"0.58366925",
"0.58230346",
"0.5792428",
"0.57868",
"0.57077533",... | 0.7828602 | 0 |
Test the sync_o365=true request parameter | def test_org_structure_sync_0365(self):
self.div1.sync_o365 = False
self.div1.save()
url = '/api/users/?org_structure=true&sync_o365=true'
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
# Division 1 won't be present in the response.
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update(self):\n tz = pytz.timezone(settings.TIME_ZONE)\n self.assertFalse(self.user1.o365_licence)\n url = '/api/users/{}/'.format(self.user1.ad_guid)\n data = {\n 'Surname': 'Lebowski',\n 'title': 'Bean Counter',\n 'o365_licence': True,\n\n ... | [
"0.5523401",
"0.5490021",
"0.5473076",
"0.5389904",
"0.5329667",
"0.5279898",
"0.5278388",
"0.52731276",
"0.5264166",
"0.5212756",
"0.520137",
"0.5167739",
"0.5163394",
"0.5136898",
"0.5109988",
"0.509473",
"0.5079237",
"0.5046441",
"0.50332296",
"0.5016915",
"0.50153786",
... | 0.63471866 | 0 |
Returns a future date string that is the closest to the current day | def get_closest_due_date(self, due_dates: List[DueDate], current_day=None) -> DueDate:
if current_day is None:
current_day = Today()
diff_list = []
# calculate the difference between current day and date string
for due_date in due_dates:
if len(due_date.date_stri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getfuturedate(runningdate, futuredays):\n d = (runningdate + datetime.timedelta(days=(futuredays-1))).strftime('%d-%m')\n return str(d)",
"def least_current_date():\n # This is not the right way to do it, timezones can change\n # at the time of writing, Baker Island observes UTC-12\n return da... | [
"0.7042028",
"0.6739802",
"0.6684847",
"0.6435696",
"0.64088297",
"0.6390447",
"0.62545943",
"0.624605",
"0.62121683",
"0.60754883",
"0.6039635",
"0.599666",
"0.59774864",
"0.5965249",
"0.5883925",
"0.5881052",
"0.5848764",
"0.58483094",
"0.58483094",
"0.5839244",
"0.57240605... | 0.63654786 | 6 |
Gets all the days from today until the end of the month. | def get_days(start_day, month_count: int = 1) -> List[Day]:
assert type(start_day) is Day
assert type(month_count) is int
start = start_day.to_date_time()
days = list(rrule(MONTHLY, count=month_count * 2, bymonthday=(-1, 1,), dtstart=start))
return Calendar.fill(Day(days[0]), Da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAllDays(self):\n start = str(self.current[0:10])\n end = str(self.dueDate[0:10])\n daysRange = pd.date_range(start = start, end = end).tolist()\n daysRange = daysRange[1:len(daysRange)-1]\n days = []\n for i in daysRange:\n day = str(i)\n day =... | [
"0.69140226",
"0.6511607",
"0.638647",
"0.6041111",
"0.59826064",
"0.59621537",
"0.5925641",
"0.5920649",
"0.58771974",
"0.5869278",
"0.58284515",
"0.5811526",
"0.581057",
"0.5739362",
"0.5698352",
"0.5691271",
"0.5685953",
"0.56856126",
"0.56745434",
"0.56403077",
"0.5640276... | 0.6592042 | 1 |
Test that a ``GET /account/settings`` returns the settings for the session user. | async def test_get_settings(spawn_client):
client = await spawn_client(authorize=True)
resp = await client.get("/account/settings")
assert resp.status == 200
assert await resp.json() == {
"skip_quick_analyze_dialog": True,
"show_ids": True,
"show_versions": True,
"quic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_account_settings(self):\n settings = AccountSettings(self.client, False, {})\n\n self.assertEqual(settings.longview_subscription.id, \"longview-100\")\n self.assertEqual(settings.managed, False)\n self.assertEqual(settings.network_helper, False)\n self.assertEqual(se... | [
"0.7293422",
"0.6904159",
"0.68857753",
"0.67829",
"0.6742984",
"0.6587807",
"0.65675956",
"0.65069836",
"0.6502907",
"0.6484014",
"0.6447866",
"0.6412865",
"0.6388406",
"0.6352493",
"0.6341707",
"0.6281831",
"0.62814415",
"0.62814415",
"0.6279597",
"0.6249542",
"0.6220485",
... | 0.71580607 | 1 |
Test that account settings can be updated at ``POST /account/settings`` and that requests to ``POST /account/settings`` return 422 for invalid JSON fields. | async def test_update_settings(data, status, spawn_client, resp_is, snapshot):
client = await spawn_client(authorize=True)
resp = await client.patch("/account/settings", data)
assert resp.status == status
assert await resp.json() == snapshot(name="response") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_save_rule_settings_fail(self):\n # Not including any required filters\n rule_settings_params = {}\n response = self.app.post('/v1/save_rule_settings/', rule_settings_params, expect_errors=True,\n headers={'x-session-id': self.session_id})\n self.... | [
"0.64927924",
"0.6425838",
"0.6378065",
"0.6341072",
"0.62973046",
"0.6262483",
"0.61875397",
"0.6182209",
"0.617659",
"0.6137747",
"0.6127384",
"0.59938157",
"0.59098905",
"0.58919597",
"0.58788544",
"0.58646953",
"0.58451706",
"0.5840452",
"0.5826956",
"0.58254063",
"0.5811... | 0.641091 | 2 |
Test that a '401 Requires authorization' response is sent when the session is not authenticated. | async def test_requires_authorization(method: str, path: str, spawn_client):
client = await spawn_client()
if method == "GET":
resp = await client.get(path)
elif method == "POST":
resp = await client.post(path, {})
elif method == "PATCH":
resp = await client.patch(path, {})
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unauthenticated_request(self):\n url = self.get_url(self.active_user.id)\n response = self.client.get(url)\n\n expected_status_code = 401\n self.assertEqual(response.status_code, expected_status_code)",
"def test_unhappy_path_unauthorized(self):\n\n response = self.cli... | [
"0.8175428",
"0.79936105",
"0.795609",
"0.79258925",
"0.7866128",
"0.7854916",
"0.78037983",
"0.7783581",
"0.77625",
"0.77625",
"0.77625",
"0.77370256",
"0.7729856",
"0.771603",
"0.7693628",
"0.76369053",
"0.7625064",
"0.7607438",
"0.75973517",
"0.7575885",
"0.75604343",
"0... | 0.0 | -1 |
Tests that when an invalid email is used, validators.is_valid_email raises a 422 error. | async def test_is_valid_email(value, spawn_client, resp_is):
client = await spawn_client(authorize=True)
data = {
"email": "valid@email.ca" if value == "valid_email" else "-foo-bar-@baz!.ca",
"old_password": "old_password",
"password": "password",
}
resp = await client.patch("/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_email(self):\n with self.client:\n response = register_user(\n self, 'Dalin', 'Oluoch', 'anothergmail.com', 'aaaAAA111')\n data = json.loads(response.data.decode())\n self.assertTrue(data['status'] == 'fail')\n self.assertTrue(data[... | [
"0.7987133",
"0.78519726",
"0.7842617",
"0.7782488",
"0.7780942",
"0.7752983",
"0.7626841",
"0.7611363",
"0.75869507",
"0.7532575",
"0.7456714",
"0.7392861",
"0.7391124",
"0.73835063",
"0.73661447",
"0.7342488",
"0.73311436",
"0.7228408",
"0.7206134",
"0.7202689",
"0.7202689"... | 0.66390425 | 61 |
Configure qos feature in the subscriber channel. | async def qos(
self,
prefetch_size: int = 0,
prefetch_count: int = 0,
connection_global: bool = False,
):
await self.channel.basic_qos(
prefetch_size=prefetch_size,
prefetch_count=prefetch_count,
connection_global=connection_global,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_qos(self, on_ok):\n self._channel.basic_qos(\n prefetch_count=self._prefetch_count, callback=on_ok)",
"def qos_type(self, qos_type):\n\n self._qos_type = qos_type",
"def set_qos(self, qos, set_specs_args):\n self._impl.set_qos(qos.id, set_specs_args)\n return self... | [
"0.6994104",
"0.6917727",
"0.66590065",
"0.64854676",
"0.6458646",
"0.64513636",
"0.6413767",
"0.62722945",
"0.6259844",
"0.6248928",
"0.6144506",
"0.60625154",
"0.6042893",
"0.5847944",
"0.58474493",
"0.58474493",
"0.58474493",
"0.5847176",
"0.57718706",
"0.57582027",
"0.568... | 0.695466 | 1 |
Remove stop words from list of tokenized words | def remove_stopwords(words):
new_words = []
for word in words:
if word not in stopwords.words('english'):
new_words.append(word)
return new_words | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stop_words(stop_list, tokens):\n return [t for t in tokens if len(t) > 2 and not t in stop_list]",
"def remove_stopwords(tokens):\n stop_words = set(stopwords.words('english'))\n\n tokens = [w for w in tokens if w not in stop_words]\n\n return tokens",
"def remove_stop_words(tokenized_wo... | [
"0.86630034",
"0.86183923",
"0.85973936",
"0.8596811",
"0.8580546",
"0.8363658",
"0.8350171",
"0.8328014",
"0.8318595",
"0.8263289",
"0.82468146",
"0.820217",
"0.81783086",
"0.81630206",
"0.8158307",
"0.8138284",
"0.81271654",
"0.8113883",
"0.8099041",
"0.8048383",
"0.8027641... | 0.8002353 | 25 |
Lemmatize verbs in list of tokenized words | def lemmatize_verbs(words):
lemmatizer = WordNetLemmatizer()
lemmas = []
for word in words:
lemma = lemmatizer.lemmatize(word, pos='v')
lemmas.append(lemma)
return lemmas | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lemmatization(tokenized_word_list):\n porter=nltk.stem.PorterStemmer()\n filtered_tokens = [porter.stem(word) for word in tokenized_word_list]\n return filtered_tokens",
"def lemmatize_verbs(self):\n lemmas = []\n # lemmas = \"\"\n for word in self.words:\n lemma = wn.lemmatize(word, p... | [
"0.80288726",
"0.7971245",
"0.79286313",
"0.7890332",
"0.7825369",
"0.77554196",
"0.77338827",
"0.7710709",
"0.7703906",
"0.7699137",
"0.7638337",
"0.7630645",
"0.75690055",
"0.7545449",
"0.75376844",
"0.75229007",
"0.74909216",
"0.7470532",
"0.7464851",
"0.7436286",
"0.73693... | 0.77416253 | 11 |
Extract single scale patches from the given image. This op is implemented purely in Tensorflow and so may be more memory efficient when only singlescale patches are required. | def extract_patches_single_scale(
patch_size: int,
stride: int,
image_lt: lt.LabeledTensor,
name: str = None,
) -> Tuple[np.ndarray, lt.LabeledTensor]:
with tf.compat.v1.name_scope(name, "extract_patches_single_scale", [image_lt]) as scope:
image_lt = lt.transpose(image_lt, ["batch", "row", "colum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _extract_patches_and_positions_from_image(\n image, patch_size, patch_stride, hse_grid_size,\n n_crops, h, w,\n c, scale_id, max_seq_len):\n p = tf.image.extract_patches(\n image, [1, patch_size, patch_size, 1], [1, patch_stride, patch_stride, 1],\n [1, 1, 1, 1],\n padding='SAME')\n\n ... | [
"0.6790287",
"0.65466",
"0.6151751",
"0.6099914",
"0.59317386",
"0.5905685",
"0.57604104",
"0.5746815",
"0.573609",
"0.5610079",
"0.56077653",
"0.56040645",
"0.5576093",
"0.5573452",
"0.5562469",
"0.5551167",
"0.5530099",
"0.55173755",
"0.54859334",
"0.5467564",
"0.54598343",... | 0.7401282 | 0 |
Sets the package_id of this PackageNote. | def package_id(self, package_id):
self._package_id = package_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package_id(self, package_id):\n if package_id is None:\n raise ValueError(\"Invalid value for `package_id`, must not be `None`\") # noqa: E501\n\n self._package_id = package_id",
"def package(self, package):\n\n self._package = package",
"def set_package(self, pkg): ... | [
"0.75330186",
"0.66790247",
"0.6289974",
"0.5844584",
"0.5844584",
"0.5831869",
"0.5829048",
"0.58280915",
"0.5799856",
"0.5799856",
"0.5799856",
"0.5799856",
"0.5799856",
"0.5799856",
"0.5775636",
"0.5762894",
"0.57389355",
"0.5732315",
"0.571768",
"0.57117283",
"0.5708129",... | 0.8552788 | 0 |
Sets the feed_id of this PackageNote. | def feed_id(self, feed_id):
self._feed_id = feed_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_feed(self, feed: None | Feed = None) -> None:\n self.current_feed = feed\n self.refresh()",
"def setID(self, idf):\n self.id = idf",
"def package_id(self, package_id):\n\n self._package_id = package_id",
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(... | [
"0.625687",
"0.5923461",
"0.5919375",
"0.5891008",
"0.5732699",
"0.57217383",
"0.55821204",
"0.55821204",
"0.55821204",
"0.55821204",
"0.55821204",
"0.55821204",
"0.55821204",
"0.55821204",
"0.55821204",
"0.55821204",
"0.55821204",
"0.55821204",
"0.55821204",
"0.55821204",
"0... | 0.8309776 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, PackageNote):
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.80885184",
"0.80885184",
"0.805514",
"0.7983044",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
... | 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.8457179",
"0.8393067",
"0.81457263",
"0.8140635",
"0.8133462",
"0.8094992",
"0.8093376",
"0.8093376",
"0.8093376",
"0.80863357",
"0.80863357",
"0.8077303",
"0.8077303",
"0.8066831"
] | 0.0 | -1 |
consistent with R print correct_pvalues_for_multiple_testing([0.0, 0.01, 0.029, 0.03, 0.031, 0.05, 0.069, 0.07, 0.071, 0.09, 0.1]) | def correct_pvalues_for_multiple_testing(pvalues, correction_type = "Benjamini-Hochberg"):
pvalues = array(pvalues)
n = int(pvalues.shape[0])
new_pvalues = empty(n)
if correction_type == "Bonferroni":
new_pvalues = n * pvalues
elif correction_type == "Bonferroni-Holm":
values = [ (pv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_correct_p_values(self):\r\n exp = [0.003, 0.006, 0.003]\r\n obs = self.mc._correct_p_values([0.001, 0.002, 0.001])\r\n assert_almost_equal(obs, exp)",
"def test_correct_p_values_no_change(self):\r\n exp = [None, 0.008]\r\n obs = self.mc._correct_p_values([None, 0.008])... | [
"0.783897",
"0.74392277",
"0.7198531",
"0.7181438",
"0.71745723",
"0.70671207",
"0.6688648",
"0.6676265",
"0.66302013",
"0.65230614",
"0.6508956",
"0.6374666",
"0.6314954",
"0.62354577",
"0.61699605",
"0.6153693",
"0.6120595",
"0.6110194",
"0.6095493",
"0.6084531",
"0.6079362... | 0.72098184 | 2 |
Test case with only valid requests. | def test_case1(self):
email = "test1@email.com"
password = "testtesttest"
first_name = "name1"
family_name = "name2"
gender = "Male"
city = "Testcity"
country = "Testcountry"
# test sign up
response = test_sign_up(email, password, first_name, fam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request_invalid(self, nosleep, method):\n # Dummies for K8s API URL and `requests` session.\n url = 'http://localhost:12345/'\n client = k8s.requests.Session()\n\n urls = [\n \"localhost\", # missing schema like \"http://\"\n \"httpinvalid://localho... | [
"0.71860117",
"0.71185094",
"0.69164205",
"0.687908",
"0.6855383",
"0.68520737",
"0.6842052",
"0.6829176",
"0.67974967",
"0.6791964",
"0.67868394",
"0.67697984",
"0.674673",
"0.6720797",
"0.6718986",
"0.66736305",
"0.66663545",
"0.6637583",
"0.66289175",
"0.6617394",
"0.66114... | 0.0 | -1 |
Helper function to normalize version Returns a comparable object | def normalize_version(v):
rv = []
for x in v.split("."):
try:
rv.append(int(x))
except ValueError:
for y in re.split("([0-9]+)", x):
try:
if y != '':
rv.append(int(y))
except ValueError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __cmp__(self, other):\n\n from distutils.version import LooseVersion\n return cmp(self.version, LooseVersion(other))",
"def __lt__(self, compareto: Union[str, float, int, \"AwesomeVersion\"]) -> bool:\n if isinstance(compareto, (str, int)):\n compareto = AwesomeVersion(compareto)\n ... | [
"0.6619351",
"0.6102797",
"0.58966285",
"0.587306",
"0.58682376",
"0.5844353",
"0.58272856",
"0.5782349",
"0.5742186",
"0.570351",
"0.56979656",
"0.5681768",
"0.56780016",
"0.5670993",
"0.56692773",
"0.56069744",
"0.5596596",
"0.55778956",
"0.5548947",
"0.553731",
"0.553731",... | 0.0 | -1 |
Deprecated! use set_pad instead. Pad a hyperspy Image of navigation dimension <= 1. This is a wrapper for numpy.pad function. Additionally, as the padding information is stored in metadata, it is possible to reverse the effect of this function with a call to the unset_padding method. | def set_padding(self, pad_width=None, *erps, **kw):
if pad_width is None:
# If padding == None:
# Same signal is returned, nothing else done
return self
# Store padded data and exit
s = self.deepcopy()
if self.axes_manager.navigation_dimension == 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_padding(im, pad):\n\n return np.pad(im, pad_width=((pad, pad), (pad, pad), (0, 0)), mode='symmetric')",
"def pad(self, *args, **kwargs):\n return _image.image_pad(self, *args, **kwargs)",
"def _pad_image(self, img: ndarray, pad_width: int = 10) -> ndarray:\n self.padded_img = np.zeros(... | [
"0.66617864",
"0.63132435",
"0.6255937",
"0.61713904",
"0.6079077",
"0.6016708",
"0.59918535",
"0.59772426",
"0.5958085",
"0.58424485",
"0.5815568",
"0.58081615",
"0.58037835",
"0.58019966",
"0.5799036",
"0.579806",
"0.57655376",
"0.57642895",
"0.5691326",
"0.56810474",
"0.56... | 0.6223679 | 3 |
Extract the HTTP method (verb). | def _get_method(**params):
try:
return params['data']['method']
except KeyError:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Method(self):\n if self._method is None:\n return \"GET\"\n if len(self._method) == 0:\n return \"GET\"\n return self._method",
"def derive_http_method(method, data):\n d_method = method\n # Method not provided: Determine method from params\n if d_method is... | [
"0.7052383",
"0.70282394",
"0.69070685",
"0.68064755",
"0.6790538",
"0.67193097",
"0.66884536",
"0.6649832",
"0.6584823",
"0.6567419",
"0.65616393",
"0.65538675",
"0.6433594",
"0.63127154",
"0.6285363",
"0.6224932",
"0.614173",
"0.61409837",
"0.6097039",
"0.6093583",
"0.60785... | 0.6191887 | 16 |
Exract the loglevel if any. | def _get_loglevel(self, **params):
try:
preamble = params['data']['preamble']
return self.loglevel[preamble.split(" ")[1]]
except KeyError:
return logging.DEBUG | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_level(self) -> str:\n return self._log_level",
"def get_log_level(self) -> int:\n logging.debug(self.args)\n return getattr(logging, self.args.loglevel.upper(), None)",
"def log_level(self) -> LogLevel:\n if self.is_quiet:\n return LogLevel.NONE\n return Lo... | [
"0.71440595",
"0.7115335",
"0.70547235",
"0.7044677",
"0.6965893",
"0.689958",
"0.6778168",
"0.66731536",
"0.6649942",
"0.66494226",
"0.6648323",
"0.66457236",
"0.66069865",
"0.6597975",
"0.6559364",
"0.6517581",
"0.6471883",
"0.6426118",
"0.63355327",
"0.63347626",
"0.630757... | 0.6218874 | 30 |
A property to get app_name. | def app_name(self): # pylint:disable=function-redefined
return self._app_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_name(self):\n return self._app_name",
"def get_app_name(self):\n return getattr(self, '_app_name', None)",
"def app_name(self) -> str:\n return self._app_name",
"def app_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"app_name\")",
"def _get_app_n... | [
"0.8461145",
"0.83975774",
"0.8362276",
"0.8137533",
"0.80653477",
"0.80430937",
"0.794933",
"0.7917377",
"0.78962976",
"0.77739835",
"0.77739835",
"0.75463516",
"0.7408752",
"0.7396903",
"0.736828",
"0.7339389",
"0.7303341",
"0.7224766",
"0.7214806",
"0.7214806",
"0.7214806"... | 0.83528364 | 3 |
A property to set app_name. | def app_name(self, value):
self._app_name = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, application_name):\r\n self._name = application_name",
"def app_name(self): # pylint:disable=function-redefined\n return self._app_name",
"def app_name(self) -> str:\n return self._app_name",
"def app_name(self):\n return self._app_name",
"def get_app_name(self):... | [
"0.8052632",
"0.7475715",
"0.7391802",
"0.73524487",
"0.70498663",
"0.6980208",
"0.68868506",
"0.68658864",
"0.68388855",
"0.68288594",
"0.6658145",
"0.6656157",
"0.6442664",
"0.6341187",
"0.6341187",
"0.6341187",
"0.6341187",
"0.6313927",
"0.6284561",
"0.6284561",
"0.6255553... | 0.8609961 | 0 |
Send the confirmation/welcome email to an invited user. | def do_send_confirmation_email(
invitee: PreregistrationUser,
referrer: UserProfile,
email_language: str,
invite_expires_in_minutes: Union[Optional[int], UnspecifiedValue] = UnspecifiedValue(),
) -> str:
activation_url = create_confirmation_link(
invitee, Confirmation.INVITATION, validity_in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invite_user(request):\n moderator = request.user\n site = get_current_site(request)\n\n invitation_form = InviteMemberForm(request.POST)\n\n if invitation_form.is_valid():\n\n # Invite user\n full_name = invitation_form.cleaned_data['full_name']\n email = invitation_form.cleane... | [
"0.7346516",
"0.72446835",
"0.70171934",
"0.6960602",
"0.6957098",
"0.6936659",
"0.6883166",
"0.6844213",
"0.68284136",
"0.67969984",
"0.67891234",
"0.67865217",
"0.67692316",
"0.6737126",
"0.6736438",
"0.66549635",
"0.66490686",
"0.66337293",
"0.6633354",
"0.66317874",
"0.66... | 0.60488564 | 94 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.