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 |
|---|---|---|---|---|---|---|
Returns the arn associated the the role name. Using this method avoids hardcoding the aws account into the arn name. | def role_arn_lookup(session, role_name):
if session is None:
return None
client = session.client('iam')
response = client.get_role(RoleName=role_name)
if response is None:
return None
else:
return response['Role']['Arn'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_role_arn(self, role, partition='aws'):\n if not role or role.startswith(\"arn:aws\"):\n return role\n if not role.startswith(\"role/\"):\n role = \"role/\" + role\n return \"arn:{0}:iam::{1}:{2}\".format(partition, self.account_id, role)",
"def role_arn(self... | [
"0.7859572",
"0.7753478",
"0.7637809",
"0.7498932",
"0.7498932",
"0.7476314",
"0.7476314",
"0.7476314",
"0.7476314",
"0.74674606",
"0.74520385",
"0.74520385",
"0.74520385",
"0.74520385",
"0.74520385",
"0.73431563",
"0.73144424",
"0.73144424",
"0.73144424",
"0.71579766",
"0.71... | 0.7266079 | 19 |
Returns the arn associated the the role name. Using this method avoids hardcoding the aws account into the arn name. | def instance_profile_arn_lookup(session, instance_profile_name):
if session is None:
return None
client = session.client('iam')
response = client.get_instance_profile(InstanceProfileName=instance_profile_name)
if response is None:
return None
else:
return response['InstanceP... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_role_arn(self, role, partition='aws'):\n if not role or role.startswith(\"arn:aws\"):\n return role\n if not role.startswith(\"role/\"):\n role = \"role/\" + role\n return \"arn:{0}:iam::{1}:{2}\".format(partition, self.account_id, role)",
"def role_arn(self... | [
"0.7861198",
"0.7756153",
"0.76403385",
"0.7501626",
"0.7501626",
"0.747887",
"0.747887",
"0.747887",
"0.747887",
"0.747008",
"0.7452663",
"0.7452663",
"0.7452663",
"0.7452663",
"0.7452663",
"0.7345726",
"0.7315004",
"0.7315004",
"0.7315004",
"0.7266874",
"0.7158131",
"0.71... | 0.0 | -1 |
gets the account id from the session using the iam client. This method will work even if you have assumed a role in another account. | def get_account_id_from_session(session):
if session is None:
return None
return session.client('iam').list_users(MaxItems=1)["Users"][0]["Arn"].split(':')[4] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_id():\n return client.get_caller_identity()['Account']",
"def id(self) -> str:\n account_id = self.__session.client(\"sts\").get_caller_identity().get(\"Account\")\n if account_id:\n return account_id\n raise ValueError(\"get_caller_identity did not return Account\"... | [
"0.716123",
"0.69258696",
"0.6868835",
"0.6868835",
"0.6868835",
"0.6868835",
"0.6868835",
"0.6868835",
"0.6868835",
"0.6868835",
"0.6804414",
"0.67929757",
"0.67919576",
"0.6678467",
"0.6673702",
"0.661376",
"0.6577138",
"0.6577138",
"0.6577138",
"0.6577138",
"0.6577138",
... | 0.797403 | 0 |
Returns the arn for a lambda given a lambda function name. | def lambda_arn_lookup(session, lambda_name):
if session is None:
return None
client = session.client("lambda")
response = client.get_function(FunctionName=lambda_name)
if response is None:
return None
else:
return response['Configuration']['FunctionArn'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lambda_arn(region: str, first_part: str, second_part: str=None) -> str:\n client = boto3.client('lambda', region_name=region)\n response = client.list_functions()\n for x in response['Functions']:\n if second_part:\n if first_part in x['FunctionArn'] and second_part in x['Functio... | [
"0.62491465",
"0.6024986",
"0.59035015",
"0.5837769",
"0.5678364",
"0.56479216",
"0.55890566",
"0.54492086",
"0.5431791",
"0.5426185",
"0.53477263",
"0.52988434",
"0.52703404",
"0.5237456",
"0.5228843",
"0.5223322",
"0.52192754",
"0.52119076",
"0.5209872",
"0.52070284",
"0.51... | 0.7466593 | 0 |
Returns a value modulo 2^m. Used to wrap the value between 0 and 2^m. | def constrain(value):
size = 2**m
return (value%size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def powermod(a, b, m):\n return mod(power(a, b), m)",
"def mod_pow(a: int, b: int, m: int) -> int:\n\tres = 1\n\twhile b > 0:\n\t\tif b % 2 != 0:\n\t\t\tres = (res * a) % m\n\t\ta = (a * a) % m\n\t\tb //= 2\n\treturn res",
"def powmod(x, k, m):\n ans = 1\n while k > 0:\n if odd(k):\n ... | [
"0.6996555",
"0.69771385",
"0.6762345",
"0.6758635",
"0.67553735",
"0.6721199",
"0.66469485",
"0.6575849",
"0.65531385",
"0.6530114",
"0.6495845",
"0.6472579",
"0.6451471",
"0.6407313",
"0.63954645",
"0.6324573",
"0.6313473",
"0.6308792",
"0.63087666",
"0.63069856",
"0.627844... | 0.61999327 | 25 |
Sends a 401 response that enables basic auth | def authenticate(self):
return Response(
'Could not verify your access level for that URL.\nYou have to login with proper credentials',
401,
{'WWW-Authenticate': 'Basic realm="Login Required"'}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})",
"def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )",
"def authenticate():\n return Response(\n 'You have to login with pro... | [
"0.8093736",
"0.80926424",
"0.7958403",
"0.7852648",
"0.7843114",
"0.7824419",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
... | 0.74499536 | 44 |
Initialises a tracker using initial bounding box. | def __init__(self, bbox, init_time, point_of_interest="centroid"):
# define constant velocity model
self.kf = KalmanFilter(dim_x=7, dim_z=4)
self.kf.F = np.array(
[[1, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 1,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, ini_image, object_bound_rect = (0,0,0,0)):\r\n \r\n self.ini_image = ini_image\r\n \r\n # if the bounding rectangle of the object is not set, than chose it manually\r\n if (object_bound_rect == (0,0,0,0)):\r\n print('Select object to track on the ima... | [
"0.6416394",
"0.6144388",
"0.6087813",
"0.60802984",
"0.60503703",
"0.6035247",
"0.60268754",
"0.59979475",
"0.59900707",
"0.5933507",
"0.57222086",
"0.5720171",
"0.57074535",
"0.570139",
"0.5682709",
"0.56483907",
"0.56464523",
"0.5633736",
"0.561775",
"0.5614379",
"0.561291... | 0.0 | -1 |
Helper property to get the name of the flow. | def name(self) -> str:
return self._root.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flow_name(self):\n # This never changes (so no read locking needed).\n return self._flowdetail.name",
"def flow_log_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"flow_log_name\")",
"def step_name(self):\n return self._step_name",
"def flow_id(self) -> ... | [
"0.89674693",
"0.79398876",
"0.69550246",
"0.6820289",
"0.68090695",
"0.68007225",
"0.6760528",
"0.6747862",
"0.67404884",
"0.67219657",
"0.6628888",
"0.6625101",
"0.6624028",
"0.6591873",
"0.6541664",
"0.653939",
"0.653911",
"0.653911",
"0.653911",
"0.6525508",
"0.6520471",
... | 0.0 | -1 |
Trigger workflows that may have command cmd as a auto_trigger or an in flight flow waiting for command. This assume cmd has been correctly executed. | def trigger(self, cmd: str, requestor: Identifier, extra_context=None) -> Optional[Flow]:
flow, next_step = self.check_inflight_flow_triggered(cmd, requestor)
if not flow:
flow, next_step = self._check_if_new_flow_is_triggered(cmd, requestor)
if not flow:
return None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_if_new_flow_is_triggered(self, cmd: str, user: Identifier) -> Tuple[Optional[Flow], Optional[FlowNode]]:\n log.debug(\"Test if the command %s is an auto-trigger for any flow ...\", cmd)\n with self._lock:\n for name, flow_root in self.flow_roots.items():\n if cmd ... | [
"0.715326",
"0.6214702",
"0.5785957",
"0.5547166",
"0.54532874",
"0.545297",
"0.5442159",
"0.5426565",
"0.54126877",
"0.54040956",
"0.5393063",
"0.5381227",
"0.53534704",
"0.5316226",
"0.5302364",
"0.5268394",
"0.5265039",
"0.5208793",
"0.5185608",
"0.51715356",
"0.5159973",
... | 0.6354978 | 1 |
Extract tweet feature vector as dictionary. | def make_tweet_dict( txt ):
txtLow = ' ' + txt.lower() + ' '
# result storage
fvec = {}
# search for each feature
for test in testFeatures:
key = test[0]
fvec[key] = False;
for tstr in test[1]:
fvec[key] = fvec[key] or (txtLow.find(tstr) != -1)
return fve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tweet2features(tweet):\r\n features = {\r\n 'len(tweet)': len(tweet),\r\n 'avg_word_length': get_avg_word_len(tweet)\r\n }\r\n return features",
"def tweets_features(tweet):\n tweet = remove_stop_words(tweet)\n return {'TWEET': tweet}",
"def get_feature_set_SA(tweet):\n feat... | [
"0.7318314",
"0.72936505",
"0.70175284",
"0.6987621",
"0.6677231",
"0.66433674",
"0.6634793",
"0.6374446",
"0.6298803",
"0.62520707",
"0.62181693",
"0.6170607",
"0.61336696",
"0.6114916",
"0.61006075",
"0.6086418",
"0.6078208",
"0.6054301",
"0.60526454",
"0.6035818",
"0.60035... | 0.61875975 | 11 |
Moves the joint to it's center position which is based on the configuration. | def center(self):
if self.pos != 0.0:
self.pos = 0.0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center(self, destination):\n self.move(destination=destination, origin=self.center)",
"def __moveCenterTo(self, x, y):\n x0, y0, w, h = self.currentBox\n x2, y2 = x - (w/2), y - (h/2)\n self.__moveTo(x2, y2)",
"def move(self, dt):\n lims = self.settings['agent']['jointLim... | [
"0.68540615",
"0.66069347",
"0.63885736",
"0.63441104",
"0.6240075",
"0.61633927",
"0.6161882",
"0.60907334",
"0.6087191",
"0.6079575",
"0.60515106",
"0.599599",
"0.5902333",
"0.5902333",
"0.5899517",
"0.5879379",
"0.5857834",
"0.5857834",
"0.5857834",
"0.5846521",
"0.5834355... | 0.6212106 | 5 |
Parses given yaml file using requirements and defaults. Required parameters are defined in this function along with parameter defaults. Parameters are grouped by package name. | def parse_config(file):
# dictionaries specifying required parameters for various modules
general = ["tube_number", "tube_radius", "collision_objects_filename"]
optimizers = {"nelder_mead": ["optimizer_precision", "optimize_iterations"]}
solvers = {"rrt": ["step_bound", "iteration_number",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_parameters(self):\n with open(INTERNAL_DATA_DIR / self.name_default_params, 'r') as f:\n return yaml.load(f, Loader=yaml.FullLoader)",
"def yamlConfigForParsingPlugins():\n parameters = \"\"\"\njoinPaths: !joinPaths\n - a\n - b\n - \"c\"\nrunPageTemplates: !findRunPageTempl... | [
"0.60205275",
"0.5976597",
"0.59591246",
"0.5929077",
"0.58939296",
"0.58272904",
"0.5821543",
"0.5787672",
"0.5710688",
"0.5634528",
"0.56288314",
"0.5624165",
"0.5618275",
"0.5608895",
"0.55601114",
"0.55350167",
"0.55314714",
"0.5524504",
"0.5521616",
"0.5514817",
"0.55096... | 0.548502 | 23 |
Returns name of class of an instance as a str | def classname(class_object):
return class_object.__class__.__name__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance_class_name(instance):\n return class_name(instance.__class__)",
"def instance_class_name(instance):\n return class_name(instance.__class__)",
"def getclassname(instance_or_cls):\n return getclass(instance_or_cls).__name__",
"def className(self):\n namevalue = self.__class__.__nam... | [
"0.8504247",
"0.8504247",
"0.83157873",
"0.8211755",
"0.8108531",
"0.8108531",
"0.8054307",
"0.7942855",
"0.7918502",
"0.7893028",
"0.7857822",
"0.7854775",
"0.77941525",
"0.7652028",
"0.75155056",
"0.75007874",
"0.7458795",
"0.74195534",
"0.74195534",
"0.7388337",
"0.7353441... | 0.76834095 | 13 |
Go to the given workspace number. | def go_to(i3: i3ipc.Connection, workspace: int):
i3.command(f"workspace number {workspace}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_workspace(num):\n LOGGER.debug('change_workspace: requested workspace {}'.format(num))\n output = get_focused_output()\n prefix = get_workspace_prefix(output)\n ws_num = get_workspace_num(prefix, num)\n workspace = get_workspace(ws_num, prefix, num)\n result = switch_workspace(f'{works... | [
"0.71325797",
"0.6187763",
"0.6157023",
"0.59943575",
"0.5943539",
"0.5912566",
"0.58262795",
"0.57753295",
"0.5770139",
"0.55275774",
"0.5519753",
"0.5467741",
"0.54426324",
"0.5431287",
"0.5407863",
"0.5407681",
"0.5323033",
"0.5264269",
"0.5262899",
"0.5244698",
"0.5241639... | 0.79520303 | 0 |
Get the number of the current workspace. | def get_current_workspace_num(i3: i3ipc.Connection):
return i3.get_tree().find_focused().workspace().num | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workspace_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"workspace_id\")",
"def workspace_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"workspace_id\")",
"def workspace_id(self) -> str:\n return pulumi.get(self, \"workspace_id\")",
"def workspace_id(self) -... | [
"0.70615363",
"0.70615363",
"0.70028317",
"0.70028317",
"0.68003416",
"0.6721158",
"0.67083037",
"0.6684436",
"0.6620677",
"0.6572125",
"0.6547534",
"0.6448233",
"0.6448233",
"0.6275984",
"0.6210025",
"0.616503",
"0.6121598",
"0.6117455",
"0.6078367",
"0.6078367",
"0.6078367"... | 0.81946534 | 0 |
Creates the name for the handler called from ``__init__`` if a name is not given. | def _create_name(self) -> str:
return self.stream.__class__.__name__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __set_name__(self, cls, name):\n pass",
"def _get_name(cls, **kwargs: Any) -> str:\n raise NotImplementedError('Subclasses must implement this method.') # pragma: no cover",
"def __init__(__self__, *,\n name: pulumi.Input[str]):\n pulumi.set(__self__, \"name\", name)",... | [
"0.62612844",
"0.61916685",
"0.6182883",
"0.61657673",
"0.6151574",
"0.61496806",
"0.6144922",
"0.61412007",
"0.61395377",
"0.61388636",
"0.61388636",
"0.61388636",
"0.61388636",
"0.61388636",
"0.61388636",
"0.6127988",
"0.6106006",
"0.60805684",
"0.60805684",
"0.60805684",
"... | 0.6380641 | 0 |
Initializes a new ``StdOutHandler`` | def __init__(
self, name: Optional[str] = "stdout", level: Optional[LogLevel] = None
):
super().__init__(name=name, level=level, stream=stdout) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, UI, strm=None):\n logging.Handler.__init__(self)\n # replace Handler's instance-specific lock with the shared class lock\n # to ensure that only one instance of this handler can write to\n # the console at a time\n self.lock = TerminalHandler.sharedlock\n ... | [
"0.7315729",
"0.6732507",
"0.66628474",
"0.6601927",
"0.64137137",
"0.63443863",
"0.6217379",
"0.61049914",
"0.60902756",
"0.5937705",
"0.5926769",
"0.5925762",
"0.5896303",
"0.5818868",
"0.5801836",
"0.5721819",
"0.57171315",
"0.5713157",
"0.5690763",
"0.56885356",
"0.568552... | 0.5459419 | 30 |
Given two dicts, merge them into a new dict as a shallow copy. | def merge_two_dicts(self, x, y):
z = x.copy()
z.update(y)
return z | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mergedict(x, y):\n z = x.copy()\n z.update(y)\n return z",
"def merge_dicts(dict_a, dict_b):\n dict_c = dict_a.copy()\n dict_c.update(dict_b)\n return dict_c",
"def merge_two_dicts(x, y):\n\tz = x.copy()\n\tz.update(y)\n\treturn z",
"def merge_two_dicts(x, y):\r\... | [
"0.8501846",
"0.84466875",
"0.84402865",
"0.84311867",
"0.8383174",
"0.8383174",
"0.8383174",
"0.8383174",
"0.8383174",
"0.8383174",
"0.8383174",
"0.8383174",
"0.83499664",
"0.83499664",
"0.83499664",
"0.82086074",
"0.81884646",
"0.81880224",
"0.81880224",
"0.8082591",
"0.799... | 0.8428829 | 4 |
Compute the Alpha Distribution Do something about | def alpha(self, state, pctx):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optimal_alpha():\n\n # When I checked all of alphas, -0.01 was the best\n alpha = -0.01\n # np.random.choice([-0.06, -0.01, 0.04, 0.1])\n return alpha",
"def alpha(self):\n if self._alpha is None:\n df = self.fdist\n alpha_ = -self._powerlaw(df.index, df.freq)\n ... | [
"0.67765987",
"0.6742169",
"0.6655793",
"0.6544725",
"0.6529802",
"0.6469974",
"0.6445292",
"0.6410639",
"0.6391583",
"0.6390676",
"0.6371379",
"0.6346702",
"0.6341216",
"0.6341216",
"0.6341216",
"0.6337032",
"0.6275701",
"0.62751776",
"0.6227204",
"0.62154394",
"0.62064844",... | 0.6381885 | 10 |
Transfer model weights to target model with a factor of Tau | def transfer_weights(self):
W, target_W = self.model.get_weights(), self.target_model.get_weights()
for i in range(len(W)):
target_W[i] = self.tau * W[i] + (1 - self.tau)* target_W[i]
self.target_model.set_weights(target_W) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_target_model(self):\n self.target_model.set_weights(self.model.get_weights())",
"def update_target_model(self):\n self.target_model.set_weights(self.model.get_weights())",
"def update_target_model(self):\n self.target_model.set_weights(self.model.get_weights())",
"def _update_... | [
"0.73884064",
"0.73884064",
"0.73884064",
"0.7025803",
"0.6765796",
"0.67450416",
"0.6741832",
"0.67204714",
"0.6674984",
"0.6514898",
"0.65123016",
"0.6492347",
"0.6492347",
"0.6467089",
"0.6460493",
"0.64421093",
"0.64420146",
"0.6416018",
"0.6381238",
"0.6341845",
"0.63382... | 0.7874975 | 0 |
Returns a path to the spec or resources file, or None if there isn't any. | def get_path(self, name):
for col in [self.specs, self.resources]:
if name in col:
return force_absolute(col['BASE'], col[name])
raise MissingFileException(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource(filename: str, path: str | None = None) -> str:\n root = Path(__file__).parent\n full_path = root if path is None else root / Path(path)\n return str(full_path / filename)",
"def source_resource_path(self) -> Optional[str]:\n return pulumi.get(self, \"source_resource_path\")",
... | [
"0.68443334",
"0.68380535",
"0.6713034",
"0.66187924",
"0.65891606",
"0.6541039",
"0.6467703",
"0.64296913",
"0.6378949",
"0.63331485",
"0.63191414",
"0.63191414",
"0.63191414",
"0.6309162",
"0.63026977",
"0.6249998",
"0.6202229",
"0.6180328",
"0.6180328",
"0.6180328",
"0.618... | 0.607958 | 32 |
Returns a dict of all expression writers available in this module. | def ewriters():
return dict(_ewriters) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exporters():\n return dict(_exporters)",
"def loggers() -> Dict[str, logging.Logger]:\n return dict(logging.root.manager.loggerDict) # type: ignore",
"def _getWriters(reactor):\n if IReactorFDSet.providedBy(reactor):\n return reactor.getWriters()\n elif \"IOCP\" in reactor.__class__.__n... | [
"0.60313106",
"0.5901297",
"0.5880711",
"0.58622074",
"0.58196956",
"0.5742172",
"0.56615275",
"0.5657879",
"0.5596137",
"0.55732113",
"0.5545482",
"0.5508399",
"0.5503588",
"0.5474215",
"0.5455626",
"0.54393846",
"0.54258674",
"0.5408531",
"0.53520226",
"0.53115875",
"0.5309... | 0.5967789 | 1 |
generates all prime numbers smaller than _n_ using the Sieve of Eratosthenes | def primes(n):
sieve = [True]*n
for p in range(2, n):
if sieve[p]:
yield p
for i in range(p*p, n, p):
sieve[i] = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primes(n):\n\tsieve = [True] * n\n\tyield 2\n\tfor i in xrange(3,int(n**0.5)+1,2):\n\t\tif sieve[i]:\n\t\t\tyield i\n\t\t\tsieve[i*i::2*i] = [False]*((n-i*i-1)/(2*i)+1)\n\tfor i in xrange(i+2,n,2):\n\t\tif sieve[i]: yield i",
"def eratosthenes_sieve(n):\r\n\tnumbers = [True for i in range(n + 1)]\r\n\t\r\n\t... | [
"0.84180295",
"0.8417532",
"0.82622313",
"0.82567656",
"0.82486343",
"0.82486343",
"0.8190478",
"0.818247",
"0.8172363",
"0.81599665",
"0.81357145",
"0.8119539",
"0.8106137",
"0.8075972",
"0.8052299",
"0.8046388",
"0.80405337",
"0.8021724",
"0.8011649",
"0.8010728",
"0.800634... | 0.8424956 | 0 |
initialize restaurant name and cuisine type attributes and sets number served attribute to a default value 0 | def __init__(self, restaurant_name, cuisine_type):
self.restaurant_name = restaurant_name
self.cuisine_type = cuisine_type
self.number_served = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, restaurant_name, cuisine_type):\n self.restaurant_name = restaurant_name\n self.cuisine_type = cuisine_type\n self.number_served = 0",
"def __init__(self, restaurant_name, cuisine_type):\n self.restaurant_name = restaurant_name\n self.cuisine_ty... | [
"0.8314235",
"0.8282508",
"0.8282508",
"0.82709175",
"0.82709175",
"0.8264752",
"0.8071585",
"0.7439493",
"0.7387792",
"0.7319224",
"0.7265492",
"0.7265492",
"0.7265492",
"0.71875435",
"0.71698016",
"0.71122634",
"0.6878828",
"0.684674",
"0.68462706",
"0.6834815",
"0.676543",... | 0.83117634 | 2 |
Compare the list of groups between two appliances | def compare(isamAppliance1, isamAppliance2):
ret_obj1 = get_all(isamAppliance1)
ret_obj2 = get_all(isamAppliance2)
return ibmsecurity.utilities.tools.json_compare(ret_obj1, ret_obj2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_groups(self):\n group0 = self.test_save('TestGroup0')\n group1 = self.test_save('TestGroup1')\n \n group0.grant('Perm1', object0)\n group0.grant('Perm3', object1)\n group1.grant('Perm2', object1)\n \n self.assert_(group0 in get_groups(object0))\n... | [
"0.64160657",
"0.63160855",
"0.628175",
"0.62237453",
"0.61753273",
"0.61753273",
"0.61045057",
"0.60945976",
"0.5951745",
"0.5942494",
"0.5942494",
"0.5940178",
"0.59220314",
"0.5886079",
"0.5881222",
"0.5855865",
"0.58520585",
"0.58456254",
"0.5836837",
"0.58087313",
"0.573... | 0.6151799 | 6 |
get the date as a string only shows month/day [bias] as days want to add on today(could be minus) defaut is zero stands for today | def get_date_str(bias=0):
today = datetime.datetime.today() # 獲得今天的日期
date = (today + datetime.timedelta(days=bias)).strftime("%m/%d") # 格式化日期
return ' ' + date[1:] if date[0] == '0' else date # 把0換成空白 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def todaystr():\n today = datetime.datetime.today()\n return f\"{today.year}{today.month:02}{today.day:02}\"",
"def getDate():\n current_time = datetime.datetime.now()\n day = current_time.day\n month = current_time.month\n year = current_time.year\n date = \"{dd}-{mm}-{yyyy}\".format(dd=day... | [
"0.77219003",
"0.7503358",
"0.7500843",
"0.7455331",
"0.7453163",
"0.7407494",
"0.73675853",
"0.73555744",
"0.7328088",
"0.7196816",
"0.7162487",
"0.70597667",
"0.7008564",
"0.6929033",
"0.6923107",
"0.6921202",
"0.68978816",
"0.6877118",
"0.6834021",
"0.68301964",
"0.6810871... | 0.8040248 | 0 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
# Extract variables from the dictionary
error = cohesity_management_sdk.models.request_error.RequestError.from_dictionary(dictionary.get('error')) if dictionary.get('error') else None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction... | [
"0.83181584",
"0.8168118",
"0.8168118",
"0.8118749",
"0.8089047",
"0.79787344",
"0.7949278",
"0.79231393",
"0.7898951",
"0.78923255",
"0.788838",
"0.7882321",
"0.7882212",
"0.7876749",
"0.78585315",
"0.7836853",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",... | 0.0 | -1 |
This function tests that object is of type Rectangle | def test_objectinheritance(self):
Square.reset_objects()
s1 = Square(5)
self.assertEqual(isinstance(s1, Square), True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_0_is_Rectangle_class(self):\r\n self.assertTrue(issubclass(type(self.S0), Rectangle) and\r\n type(self.S0) != Rectangle)",
"def test_inheritance(self):\n self.assertTrue(issubclass(Rectangle, Base))",
"def test_SquareinheritancefromRectangle(self):\n Square.... | [
"0.81240547",
"0.77088064",
"0.76751864",
"0.7652582",
"0.7423002",
"0.70680153",
"0.700833",
"0.69718456",
"0.69716054",
"0.69708675",
"0.6913482",
"0.6740271",
"0.6699377",
"0.6660337",
"0.66601557",
"0.6619761",
"0.6611006",
"0.6590472",
"0.65760404",
"0.657499",
"0.656991... | 0.6173705 | 44 |
This function tests that Typeerror is thrown when 0 arguments | def test_errorfornoarguments(self):
Square.reset_objects()
with self.assertRaises(TypeError) as e:
s1 = Square()
self.assertEqual(
str(e.exception),
"__init__() missing 1 required positional argument: 'size'") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_type_error(self):\n self._error_test(TypeError)",
"def test_value_error_for_computing_missing_type():\n with pytest.raises(ValueError):\n compute_type(\"missing_type\", {})",
"def test_badargs(self):\n self.assertRaises(TypeError, isint, [])\n self.assertRaises(TypeError... | [
"0.79296213",
"0.7687501",
"0.7513296",
"0.74324",
"0.72868884",
"0.7251024",
"0.72421396",
"0.722919",
"0.7216657",
"0.7172854",
"0.7167968",
"0.7160128",
"0.71230894",
"0.7108646",
"0.7043927",
"0.7019197",
"0.70073533",
"0.6990342",
"0.69550425",
"0.69542783",
"0.69237006"... | 0.7259122 | 5 |
This function tests that Typeerror is thrown when 0 arguments | def test_errorfortoomanyarguments(self):
Square.reset_objects()
with self.assertRaises(TypeError) as e:
s1 = Square(1, 2, 3, 4, 5)
self.assertEqual(
str(e.exception),
"__init__() takes from 2 to 5 positional" +
" arguments but 6 were given") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_type_error(self):\n self._error_test(TypeError)",
"def test_value_error_for_computing_missing_type():\n with pytest.raises(ValueError):\n compute_type(\"missing_type\", {})",
"def test_badargs(self):\n self.assertRaises(TypeError, isint, [])\n self.assertRaises(TypeError... | [
"0.79272693",
"0.76853794",
"0.7513777",
"0.7431842",
"0.7285539",
"0.7258863",
"0.72499096",
"0.72385985",
"0.72278345",
"0.72163785",
"0.71723783",
"0.71672547",
"0.71580905",
"0.7109186",
"0.704141",
"0.7019406",
"0.70061946",
"0.6987669",
"0.69550914",
"0.69545126",
"0.69... | 0.71228784 | 13 |
This function tests that Typeerror is thrown when 0 arguments | def test_negativesize(self):
Square.reset_objects()
with self.assertRaises(ValueError) as e:
s1 = Square(-1)
self.assertEqual(str(e.exception), "width must be > 0") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_type_error(self):\n self._error_test(TypeError)",
"def test_value_error_for_computing_missing_type():\n with pytest.raises(ValueError):\n compute_type(\"missing_type\", {})",
"def test_badargs(self):\n self.assertRaises(TypeError, isint, [])\n self.assertRaises(TypeError... | [
"0.79296213",
"0.7687501",
"0.7513296",
"0.74324",
"0.72868884",
"0.7259122",
"0.7251024",
"0.72421396",
"0.722919",
"0.7216657",
"0.7172854",
"0.7167968",
"0.7160128",
"0.71230894",
"0.7108646",
"0.7043927",
"0.7019197",
"0.70073533",
"0.6990342",
"0.69550425",
"0.69542783",... | 0.0 | -1 |
This function tests that ValueError is thrown for x value | def test_negativexvalue(self):
Square.reset_objects()
with self.assertRaises(ValueError) as e:
s1 = Square(1, -2)
self.assertEqual(str(e.exception), "x must be >= 0") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_value_error(self):\n self._error_test(ValueError)",
"def test_check_x_ValueError(self):\n self.assertRaisesRegex(\n ValueError,\n 'x must be >= 0',\n Rectangle,\n 4, 2, -1, 0, 12\n )",
"def test_check_X_not_int_not_float():\n with pyt... | [
"0.7744312",
"0.7628981",
"0.7376584",
"0.72498196",
"0.72077596",
"0.70309776",
"0.7029389",
"0.70177644",
"0.6965968",
"0.6950191",
"0.69336456",
"0.68996376",
"0.68669736",
"0.68582314",
"0.6836748",
"0.6823986",
"0.67863214",
"0.67758465",
"0.67752916",
"0.6768112",
"0.67... | 0.6772184 | 19 |
This function tests that ValueError is thrown for y value | def test_negativeyvalue(self):
Square.reset_objects()
with self.assertRaises(ValueError) as e:
s1 = Square(1, 2, -2)
self.assertEqual(str(e.exception), "y must be >= 0") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cast_y_axis_extrema_invalid_input(self):\r\n self.assertRaises(ValueError, _cast_y_axis_extrema, 'foo')",
"def test_check_y_not_int_not_float(wage_X_y, wage_gam):\n X, y = wage_X_y\n y_str = ['hi'] * len(y)\n\n with pytest.raises(ValueError):\n check_y(y_str, wage_gam.link, wage_g... | [
"0.7913412",
"0.76596844",
"0.7343764",
"0.715125",
"0.70271635",
"0.6917319",
"0.68697965",
"0.6854336",
"0.68402386",
"0.6826492",
"0.6811204",
"0.68028307",
"0.67962307",
"0.67844146",
"0.6748008",
"0.67324376",
"0.6724416",
"0.66972107",
"0.6679238",
"0.6655606",
"0.65666... | 0.70518243 | 4 |
This function tests for inf y value | def test_infy(self):
Rectangle.reset_objects()
with self.assertRaises(TypeError) as e:
r1 = Square(10, 10, float('Inf'), 7)
self.assertEqual(str(e.exception), 'y must be an integer') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isinf(x):\n return False",
"def isinf(data):\n return _make.isinf(data)",
"def isfinite ( x ) : \n y = float ( x ) \n return ( not math.isinf ( y ) ) and ( not math.isnan ( y ) )",
"def test_finite(self):\n \n Number_of_tests = 1000\n low = -1000\n ... | [
"0.7572634",
"0.7365011",
"0.7271661",
"0.6861912",
"0.6842959",
"0.6728323",
"0.6716243",
"0.6708114",
"0.6569021",
"0.65148795",
"0.6453983",
"0.6430336",
"0.64301854",
"0.6409512",
"0.6393196",
"0.6366821",
"0.631314",
"0.6309159",
"0.6304307",
"0.6232701",
"0.61977315",
... | 0.5810046 | 45 |
Sets the cluster_node_id of this StateSyncNode. | def cluster_node_id(self, cluster_node_id):
self._cluster_node_id = cluster_node_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster_id(self, cluster_id):\n self._cluster_id = cluster_id",
"def set_cluster(self, cluster_id=None):\n cluster = objects.Cluster.get_by_uid(\n cluster_id, fail_if_not_found=False\n )\n if cluster:\n self._cluster = cluster\n self._set_task(self... | [
"0.76118255",
"0.68488646",
"0.6685833",
"0.6680353",
"0.665979",
"0.64597934",
"0.64168763",
"0.63185054",
"0.62717867",
"0.62717867",
"0.62717867",
"0.62717867",
"0.62717867",
"0.62717867",
"0.6237502",
"0.61332864",
"0.5897969",
"0.5849075",
"0.58098924",
"0.5744126",
"0.5... | 0.8481871 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, StateSyncNode):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.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 |
Set author first name initial | def _set_first_initial(self, force=False):
if self.first_initial and not force:
return
self.first_initial = ' '.join([c[0] for c in self.first_name.split()]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def author_name(self, author_name):\n\n self._author_name = author_name",
"def first_name(self, name):\n self._first_name = name",
"def first_name_and_initial(self):\n return u\"{} {}\".format(self.pref_first_name(), self.last_name[0])",
"def _get_first_author(self):\n if not len(... | [
"0.7323572",
"0.71771324",
"0.70817894",
"0.7054424",
"0.7022617",
"0.7003764",
"0.6919942",
"0.6896514",
"0.6873318",
"0.68670076",
"0.68632287",
"0.6860131",
"0.68508995",
"0.6757529",
"0.6736017",
"0.67150563",
"0.67113507",
"0.67113507",
"0.670267",
"0.6662656",
"0.666265... | 0.6821622 | 13 |
Return author formated full name, e.g. Maupetit J | def get_formatted_name(self):
return '%s %s' % (self.last_name, self.first_initial) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_author_full_name(self, obj):\n return obj.author.get_full_name()",
"def author(self) -> str:\n return pulumi.get(self, \"author\")",
"def get_short_name(self):\n split = self.name.split(' - ')\n # author, year, and first couple of words of paper title\n return \"{} ({... | [
"0.82585573",
"0.77515906",
"0.7608914",
"0.75679374",
"0.75590986",
"0.736285",
"0.73591524",
"0.73569363",
"0.73169523",
"0.73169523",
"0.7259127",
"0.72563523",
"0.7227451",
"0.7207076",
"0.7200211",
"0.7180581",
"0.71690756",
"0.7159358",
"0.714601",
"0.70617265",
"0.7046... | 0.0 | -1 |
Internal helper to perfrom the reshape | def _Reshape(self, pdi, pdo):
# Get number of columns
cols = pdi.GetNumberOfColumns()
# Get number of rows
rows = pdi.GetColumn(0).GetNumberOfTuples()
if len(self.__names) is not 0:
num = len(self.__names)
if num < self.__ncols:
for i in r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reshape(data):\n return K.reshape(x=data, shape=(K.shape(data)[0], 1, reshape_size))",
"def _reshape(self, arr: np.ndarray) -> np.ndarray:\n return arr.reshape(self.TileHeight.value, self.TileWidth.value, self.bands,)",
"def reshape(self, *shape):\n return F.Reshape.apply(self, sha... | [
"0.7144847",
"0.68330306",
"0.6810042",
"0.663358",
"0.65176374",
"0.6502568",
"0.6428562",
"0.6419787",
"0.6401154",
"0.63567775",
"0.6333695",
"0.63271326",
"0.6304994",
"0.6303932",
"0.6302932",
"0.62272435",
"0.62223023",
"0.61971766",
"0.6173259",
"0.61662495",
"0.615951... | 0.60213363 | 28 |
Test case for networking_project_network_get | def test_networking_project_network_get(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_networking_project_network_service_get(self):\n pass",
"def test_get_network(self):\n pass",
"def test_networking_project_network_list(self):\n pass",
"def test_networking_project_network_create(self):\n pass",
"def test_networking_project_network_event_get(self):\n ... | [
"0.8632432",
"0.8508769",
"0.8449543",
"0.80295455",
"0.79398155",
"0.78251946",
"0.7792246",
"0.7602196",
"0.7560636",
"0.7488109",
"0.7394283",
"0.71187145",
"0.7039374",
"0.70385844",
"0.70047534",
"0.68530726",
"0.6823287",
"0.681199",
"0.6767339",
"0.67336947",
"0.653972... | 0.9436339 | 0 |
Validate that required_cols are in self.frame | def validate(self):
super().validate()
frame = getattr(self, 'frame', None)
if frame is None:
raise ValueError('Missing columns %s since no frame' % ', '.join(
self.required_cols))
cols = set(list(self.frame))
missing = sorted(self.required_cols - cols... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cols_valid(self,\n df: pd.DataFrame,\n req_cols: set) -> bool:\n missing_cols = req_cols.difference(df.columns)\n\n if len(missing_cols) > 0:\n logging.error(f\"{missing_cols} columns required but missing\")\n return False\n\n return Tru... | [
"0.7897676",
"0.7564741",
"0.7366434",
"0.7349003",
"0.7240517",
"0.7036314",
"0.70306194",
"0.69790363",
"0.68797225",
"0.6794021",
"0.66460437",
"0.6629376",
"0.66237783",
"0.65535456",
"0.65107137",
"0.6479833",
"0.64632124",
"0.646052",
"0.6442498",
"0.64324087",
"0.64135... | 0.8550042 | 0 |
Validate that required_cols are in self.frame | def validate(self):
super().validate()
frame = getattr(self, 'frame', None)
if frame is None:
raise ValueError('Missing columns %s since no frame' % ', '.join(
[c[0] for c in self.col_regexps]))
for col_name, c_re in self.col_regexps:
if col_name n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(self):\n super().validate()\n frame = getattr(self, 'frame', None)\n if frame is None:\n raise ValueError('Missing columns %s since no frame' % ', '.join(\n self.required_cols))\n cols = set(list(self.frame))\n missing = sorted(self.required... | [
"0.8549901",
"0.7896959",
"0.75633276",
"0.7367074",
"0.7239867",
"0.70361763",
"0.70298463",
"0.6977291",
"0.68799907",
"0.67940336",
"0.6645067",
"0.6627117",
"0.6622096",
"0.65550065",
"0.650822",
"0.64810985",
"0.6462903",
"0.6459277",
"0.6440878",
"0.64331204",
"0.641338... | 0.73491883 | 4 |
Create an S3Backend instance. | def get_backend(cls, backend=None):
return backend if backend else aws.S3Backend(
category=cls.default_category, bucket_name=cls.default_bucket) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_s3(sitename):\n return s3.S3(sitename)",
"def s3_create_bucket(self):\n self.conn.create_bucket(DEFAULT_BUCKET_NAME)",
"def get_s3_client():\n return boto3.resource('s3')",
"def s3_bucket(s3_server): # pylint: disable=redefined-outer-name\n client = s3_server.get_s3_client()\n bu... | [
"0.67337704",
"0.67020965",
"0.64005727",
"0.6341852",
"0.6122109",
"0.60842115",
"0.6067415",
"0.6063343",
"0.6048431",
"0.6045403",
"0.604531",
"0.60147995",
"0.5989435",
"0.596969",
"0.5956802",
"0.5870337",
"0.5861566",
"0.5846471",
"0.58433914",
"0.58393073",
"0.5824821"... | 0.6487786 | 2 |
Configures federated training for the EMNIST character recognition task. This method will load and preprocess datasets and construct a model used for the task. It then uses `iterative_process_builder` to create an iterative process compatible with `tff.simulation.run_training_process`. | def configure_training_federated(
task_spec: training_specs.TaskSpecFederated,
*, # Caller passes below args by name.
model: str = 'resnet18',
only_digits: bool = False,
merge_case: bool = False,
) -> training_specs.RunnerSpecFederated:
return _EmnistCharacterTask(
task_spec,
model=mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _train_model(\n self,\n dataset: DatasetEntity,\n ):\n logger.info(\"init data cfg.\")\n self._data_cfg = ConfigDict(data=ConfigDict())\n\n for cfg_key, subset in zip(\n [\"train\", \"val\", \"unlabeled\"],\n [Subset.TRAINING, Subset.VALIDATION, Subse... | [
"0.61181545",
"0.6045724",
"0.6024364",
"0.6009437",
"0.5953014",
"0.59526104",
"0.5929882",
"0.5899533",
"0.58728266",
"0.58654255",
"0.57695735",
"0.5762787",
"0.5755617",
"0.5746565",
"0.5687636",
"0.5658742",
"0.5657223",
"0.56548303",
"0.56238604",
"0.56198394",
"0.56055... | 0.61471665 | 0 |
Reshape a numpy array, which is input_shape=(height, width), as opposed to input_shape=(width, height) for cv2 | def np_resize(img, input_shape):
height, width = input_shape
return cv2.resize(img, (width, height)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def img_reshape(self, input_img):\n _img = np.transpose(input_img, (1, 2, 0)) \n _img = np.flipud(_img)\n _img = np.reshape(_img, (1, img_dim[0], img_dim[1], img_dim[2]))\n return _img",
"def numpyReshape(array):\n return np.array(array, dtype = float).reshape(1, len(array))",... | [
"0.75424194",
"0.75378686",
"0.75035334",
"0.7405382",
"0.7378981",
"0.7117111",
"0.70272535",
"0.6998127",
"0.6938943",
"0.6895453",
"0.68916667",
"0.6878874",
"0.6737582",
"0.667375",
"0.6638827",
"0.6624398",
"0.6608408",
"0.65904003",
"0.654305",
"0.65211385",
"0.64932525... | 0.72959924 | 5 |
Returns a colormap for this view. | def getColormap(self, view):
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_colormap(self):\n return colors.colormaps[self.name]",
"def get_colormap(self):\n return colors.colormaps[self.name]",
"def get_colormap(self):\n return file_io.load_viscm_colormap(self.path)",
"def get_colormap(self):\n return file_io.load_viscm_colormap(self.path)",
"d... | [
"0.8298571",
"0.8298571",
"0.81955755",
"0.81955755",
"0.8056556",
"0.7981543",
"0.764267",
"0.76329446",
"0.756393",
"0.7444203",
"0.7027589",
"0.6996905",
"0.6950566",
"0.6934548",
"0.6839568",
"0.66553605",
"0.65015465",
"0.65008515",
"0.65008515",
"0.6488026",
"0.6488026"... | 0.7707698 | 6 |
Returns a color dialog for this view. | def getColormapDialog(self, view):
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defaultColorDialog(self):\n dialog = None\n if self.__hooks is not None:\n dialog = self.__hooks.getColormapDialog(self)\n if dialog is None:\n dialog = ColormapDialog()\n dialog.setModal(False)\n return dialog",
"def colorPickerDialog(self, curren... | [
"0.75629133",
"0.68842196",
"0.62867564",
"0.6189634",
"0.61299944",
"0.6009618",
"0.59474766",
"0.58456355",
"0.5730012",
"0.5706063",
"0.57012826",
"0.5627111",
"0.55824256",
"0.55625993",
"0.5549173",
"0.5520978",
"0.55189264",
"0.5484155",
"0.546726",
"0.5448726",
"0.5443... | 0.62007624 | 3 |
Returns the data viewer hooks used by this view. | def getHooks(self):
return self.__hooks | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hooks(self):\n return tuple(self.__hooks.keys())",
"def get_extra_lvs_hooks(self) -> List[HammerToolHookAction]:\n return list()",
"def get_extra_hierarchical_lvs_hooks(self) -> Dict[str, List[HammerToolHookAction]]:\n return dict()",
"def custom_hooks(self):\n return self.con... | [
"0.69417256",
"0.6475532",
"0.6276654",
"0.624319",
"0.61839193",
"0.60875654",
"0.60875654",
"0.6062711",
"0.6000305",
"0.59981173",
"0.59789795",
"0.5936823",
"0.5913618",
"0.58525425",
"0.5787659",
"0.57738584",
"0.577255",
"0.576733",
"0.5754267",
"0.56217355",
"0.5590773... | 0.7191292 | 0 |
Returns a default colormap. | def defaultColormap(self):
colormap = None
if self.__hooks is not None:
colormap = self.__hooks.getColormap(self)
if colormap is None:
colormap = Colormap(name="viridis")
return colormap | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_colormap(self):\n return colors.colormaps[self.name]",
"def get_colormap(self):\n return colors.colormaps[self.name]",
"def get_colormap(self):\n return file_io.load_viscm_colormap(self.path)",
"def get_colormap(self):\n return file_io.load_viscm_colormap(self.path)",
"d... | [
"0.72189206",
"0.72189206",
"0.7079339",
"0.7079339",
"0.7058597",
"0.7002624",
"0.6966337",
"0.6905248",
"0.68922603",
"0.67234963",
"0.6715274",
"0.6709201",
"0.66109717",
"0.66100955",
"0.6520509",
"0.64768016",
"0.6442025",
"0.6442025",
"0.6424049",
"0.63886",
"0.63886",
... | 0.83686036 | 0 |
Returns names of axes which can be custom by the user and provided to the view. | def customAxisNames(self):
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def axesnames(self):\n return self._axesnames",
"def axesNames(self, data, info):\n return []",
"def allAxes( mv ):\n if mv is None: return None\n return mv.getAxisList()",
"def process_custom_axes(axis_names):\n return axis_names.strip().strip(\"'\").strip('\"').split(',')",
"def se... | [
"0.7648422",
"0.7616448",
"0.69971704",
"0.6937097",
"0.6732004",
"0.66294384",
"0.66294384",
"0.65201336",
"0.64523226",
"0.64523226",
"0.644479",
"0.62596124",
"0.62539476",
"0.6205868",
"0.6204709",
"0.6199804",
"0.61753386",
"0.60562867",
"0.6000825",
"0.59575087",
"0.590... | 0.7429947 | 2 |
Returns true if the widget is already initialized. | def isWidgetInitialized(self):
return self.__widget is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_initialized(self) -> bool:\n return len(self) > 0",
"def is_editor_ready(self):\r\n if self.editor_widget:\r\n window = self.editor_widget.window()\r\n if hasattr(window, 'is_starting_up') and not window.is_starting_up:\r\n return True",
"def _isinit(s... | [
"0.7549473",
"0.7125627",
"0.7058051",
"0.6861954",
"0.68026435",
"0.67455906",
"0.67142135",
"0.6673255",
"0.6608615",
"0.6608254",
"0.65874594",
"0.65844923",
"0.6568072",
"0.6543216",
"0.6534076",
"0.65151435",
"0.64635277",
"0.6377944",
"0.63721126",
"0.63586754",
"0.6357... | 0.86975914 | 0 |
Returns the direct sub views registered in this view. | def getViews(self):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def views(self):\n return self._views",
"def child_views(self):\n return self.children",
"def getViews(self):\n return list(self.__views)",
"def getViews(self):\n return list(self.__views.keys())",
"def getReachableViews(self):\n return [self]",
"def other_views(cls):\n... | [
"0.7233933",
"0.7220913",
"0.69729173",
"0.6953038",
"0.67021793",
"0.6609596",
"0.654168",
"0.6535742",
"0.64842397",
"0.62973654",
"0.6059941",
"0.60502416",
"0.6000292",
"0.5903239",
"0.5832622",
"0.57977766",
"0.57622355",
"0.55724",
"0.5553914",
"0.5470411",
"0.54599607"... | 0.69583744 | 3 |
Return VM output files in a tuple. | def get_vm_outfiles(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_output_files(self):\r\n fname = self.__get_output_filename()\r\n return [fname] if fname else []",
"def _list_outputs(self):\n outputs = self._outputs().get()\n\n out_dir = os.path.abspath(os.path.join(os.getcwd(), \"slicesdir\"))\n outputs[\"out_dir\"] = out_dir\n ... | [
"0.7118414",
"0.6668537",
"0.66680706",
"0.66119856",
"0.6590606",
"0.6571721",
"0.6446606",
"0.64158994",
"0.6320247",
"0.6251037",
"0.6235383",
"0.619133",
"0.61899394",
"0.60789007",
"0.60338473",
"0.59975857",
"0.5989016",
"0.5984177",
"0.5969433",
"0.59565455",
"0.594525... | 0.74231887 | 0 |
Parse a datatime string and return seconds since epoch. | def parse_timestr(self, timestr):
epoch = datetime.datetime(1970, 1, 1, 0, 0, 0, 0, tzutc())
return int((parsedate(timestr) - epoch).total_seconds()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_time(s):\n\n dt = dateutil.parser.parse(s)\n# epoch_time = int((dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds())\n epoch_time = int(dt.replace(tzinfo=timezone.utc).timestamp())\n\n return epoch_time",
"def datumToSeconds(timestr):\n return (datetime.datetime(int(timestr.s... | [
"0.76526344",
"0.7463628",
"0.682279",
"0.6693088",
"0.6685308",
"0.65293956",
"0.6505844",
"0.6494147",
"0.6421463",
"0.64137083",
"0.63933265",
"0.63811636",
"0.6282634",
"0.62804013",
"0.62677103",
"0.62677103",
"0.6256727",
"0.6202523",
"0.6202523",
"0.6192253",
"0.618009... | 0.76556337 | 0 |
Return a JSON list of stations from the dataset | def stations():
results = session.query(Station.station,Station.name).all()
key=[results[i][0] for i in range(len(results))]
values=[results[i][1] for i in range(len(results))]
results=dict(zip(key,values))
print(f"Route /api/v1.0/stations is being visited")
return jsonify(results) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stationdata():\n # * Return a JSON list of stations from the dataset.\n # as this should be a list, I'm just grabbing the station name\n session = Session(engine)\n results = session.query(Station.name).all()\n session.close()\n\n stations = list(np.ravel(results))\n return jsonify(stati... | [
"0.88667464",
"0.8750095",
"0.87346923",
"0.84793985",
"0.84580904",
"0.84156215",
"0.83818555",
"0.83749765",
"0.8370349",
"0.8341339",
"0.8339504",
"0.8324717",
"0.83166987",
"0.83012885",
"0.82950824",
"0.82848144",
"0.82428265",
"0.8235163",
"0.82350534",
"0.82163185",
"0... | 0.7395977 | 33 |
Return a JSON list of Temperature Observations (tobs) for the previous year | def Tobs_past_year():
results = pd.DataFrame(session.query(Measurement.date,Measurement.tobs).\
filter(Measurement.date.between(One_yrs_ago,current_time)).all());
dates_of_last_year=list(results.sort_values(by='date')['date'].unique())
aa1=results.sort_values(by='date').groupby('date')
last_year_tob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prior_year_temp():\n\n tobs_data = session.query(Measurements.tobs).all()\n return jsonify (tobs_data)",
"def tobsdata():\n # query for the dates and temperature observations from a year from the last data point.\n # * Return a JSON list of Temperature Observations (tobs) for the previous year.... | [
"0.81387526",
"0.7823207",
"0.7728094",
"0.76940525",
"0.76278925",
"0.7408873",
"0.73844993",
"0.7356113",
"0.73492384",
"0.7237004",
"0.7091124",
"0.70736796",
"0.7045663",
"0.7042862",
"0.6980327",
"0.6823793",
"0.6811926",
"0.6764229",
"0.66996694",
"0.6654598",
"0.656765... | 0.66404945 | 20 |
This Sigmoid function is used as a threshold function and mapping variables to between 0 and 1. | def sigmoid(inX):
if inX < 0:
return 1 - 1 / (1 + exp(inX))
else:
return 1 / (1 + exp(-inX)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hard_sigmoid(x):\n x = (0.2 * x) + 0.5\n x = F.threshold(-x, -1, -1)\n x = F.threshold(-x, 0, 0)\n return x",
"def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))",
"def sigmoid(x):\r\n\r\n return 1 / (1 + np.exp(-x))",
"def sigmoid(x):\r\n #pred_x = (np.exp(x) - np.exp(-x)) / (np.exp(x)... | [
"0.8308929",
"0.82602733",
"0.8204889",
"0.81876445",
"0.81802076",
"0.81802076",
"0.81802076",
"0.81802076",
"0.81802076",
"0.81802076",
"0.8174843",
"0.8173835",
"0.81575894",
"0.8142804",
"0.8142804",
"0.8138578",
"0.81346345",
"0.8126009",
"0.8078116",
"0.8075239",
"0.806... | 0.7807045 | 44 |
Similar to forward but only return features. | def extract_features(self, *args, **kwargs):
return self(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n x = self.features(x)\n return x",
"def forward(self, x):\n out = self.features(x)\n out = out.view(out.size(0), -1)\n out = self.classifier(out)\n return out",
"def feature_forward(self, x):\n raise NotImplementedError",
"def forward(se... | [
"0.7967969",
"0.760584",
"0.75046647",
"0.7499447",
"0.7416259",
"0.7416259",
"0.72424513",
"0.72424513",
"0.7232947",
"0.70870334",
"0.70865875",
"0.707531",
"0.7027191",
"0.70249134",
"0.7017389",
"0.6983659",
"0.69587934",
"0.69422793",
"0.69087887",
"0.6823038",
"0.680118... | 0.649879 | 46 |
Run the forward pass for an encoderdecoder model. First feed a batch of source tokens through the encoder. Then, feed the encoder output and previous decoder outputs (i.e., teacher forcing) to | def forward(self, src_tokens, src_lengths, prev_output_tokens, **kwargs):
encoder_out = self.encoder(src_tokens, src_lengths=src_lengths, **kwargs)
decoder_out = self.decoder(
prev_output_tokens, encoder_out=encoder_out, **kwargs
)
return decoder_out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, inputs_encoder, inputs_decoder):\n states_encoder = self.encoder(inputs_encoder)\n outputs_decoder, states_decoder = self.decoder(inputs_decoder, states_encoder)\n return outputs_decoder, states_decoder",
"def forward(self, input_token, target_token, timestep, *inputs):\n ... | [
"0.701429",
"0.69124043",
"0.6851775",
"0.67677385",
"0.6747971",
"0.66699445",
"0.6630951",
"0.66303766",
"0.66230434",
"0.6597526",
"0.6532557",
"0.64746654",
"0.6471793",
"0.64453846",
"0.6425172",
"0.6398952",
"0.63581455",
"0.63262665",
"0.6285209",
"0.62551093",
"0.6229... | 0.72772044 | 0 |
Similar to forward but only return features. | def extract_features(self, src_tokens, src_lengths, prev_output_tokens, **kwargs):
encoder_out = self.encoder(src_tokens, src_lengths=src_lengths, **kwargs)
features = self.decoder.extract_features(
prev_output_tokens, encoder_out=encoder_out, **kwargs
)
return features | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n x = self.features(x)\n return x",
"def forward(self, x):\n out = self.features(x)\n out = out.view(out.size(0), -1)\n out = self.classifier(out)\n return out",
"def feature_forward(self, x):\n raise NotImplementedError",
"def forward(se... | [
"0.79697466",
"0.76076716",
"0.75065845",
"0.7501061",
"0.74177617",
"0.74177617",
"0.7244547",
"0.7244547",
"0.72351825",
"0.7089535",
"0.7087904",
"0.707691",
"0.70283806",
"0.7025825",
"0.70186174",
"0.69859",
"0.6958993",
"0.69443464",
"0.6910774",
"0.6824163",
"0.6802641... | 0.0 | -1 |
Run the forward pass for a decoderonly model. Feeds a batch of tokens through the decoder to predict the next tokens. | def forward(self, src_tokens, **kwargs):
return self.decoder(src_tokens, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, input_token, target_token, timestep, *inputs):\n log_probs_per_model = []\n state_outputs = []\n next_state_input = len(self.models)\n vocab_reduction_module = self.models[0].decoder.vocab_reduction_module\n if vocab_reduction_module is not None:\n po... | [
"0.6603129",
"0.6492484",
"0.63717306",
"0.63408744",
"0.6279637",
"0.6271893",
"0.6234917",
"0.6129099",
"0.611657",
"0.6088647",
"0.6083846",
"0.6076934",
"0.60715055",
"0.6046105",
"0.60413575",
"0.6034035",
"0.6028133",
"0.6008129",
"0.6004112",
"0.6004112",
"0.59878695",... | 0.66097987 | 0 |
Similar to forward but only return features. | def extract_features(self, src_tokens, **kwargs):
return self.decoder.extract_features(src_tokens, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n x = self.features(x)\n return x",
"def forward(self, x):\n out = self.features(x)\n out = out.view(out.size(0), -1)\n out = self.classifier(out)\n return out",
"def feature_forward(self, x):\n raise NotImplementedError",
"def forward(se... | [
"0.7967969",
"0.760584",
"0.75046647",
"0.7499447",
"0.7416259",
"0.7416259",
"0.72424513",
"0.72424513",
"0.7232947",
"0.70870334",
"0.70865875",
"0.707531",
"0.7027191",
"0.70249134",
"0.7017389",
"0.6983659",
"0.69587934",
"0.69422793",
"0.69087887",
"0.6823038",
"0.680118... | 0.0 | -1 |
Length of data stored by tag. | def __len__(self):
if self._buffer is not None:
if self._header.value_type in b'ZBH':
return len(self._buffer)
else:
return 1
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Length(data):\n return len(data)",
"def size(self):\n if self._buffer is not None:\n length = SIZEOF_TAGHEADER\n if self._header.value_type == b'B':\n # TODO make sure this is right, need data that uses B to verify\n length += SIZEOF_UINT32 + (len... | [
"0.736296",
"0.71680456",
"0.7121816",
"0.70960975",
"0.7015388",
"0.70117235",
"0.7010031",
"0.7010031",
"0.7010031",
"0.70061755",
"0.6973364",
"0.69203866",
"0.69203866",
"0.69203866",
"0.6889017",
"0.6884412",
"0.68721616",
"0.68721616",
"0.6864763",
"0.68622303",
"0.6829... | 0.6341916 | 99 |
Parse shoot packet to get name and direction of weapon shot. | def handle_shoot(data: bytes) -> Tuple[bytes, str]:
length = struct.unpack('H', data[:2])[0]
name = data[2:length+2]
direction = struct.unpack('fff', data[length+2:length+2+12])
return data[2+length:], f'Shot {name.decode()} in direction: {direction}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shoot(self, direction):\n self.type = self.boss.get_bullet_type()\n if self.type == 'shotgun':\n try:\n dx = abs(Laser.List[-1].x - self.x)\n dy = abs(Laser.List[-1].y - self.y)\n if dx < 50 and dy < 50 and self.type == 'shotgun':\n ... | [
"0.5890974",
"0.5887054",
"0.53437346",
"0.5336487",
"0.53323966",
"0.52839124",
"0.5244903",
"0.51474124",
"0.5147154",
"0.51261395",
"0.5072278",
"0.5041751",
"0.5030743",
"0.50281894",
"0.50211716",
"0.49417537",
"0.49294055",
"0.49110854",
"0.48818228",
"0.48443696",
"0.4... | 0.6662206 | 0 |
Parse regionchange packet to get region name. Drop positions of initial actors, like GoldenEggs, is also revealed. | def handle_region_change(data: bytes) -> Tuple[bytes, str]:
region_name_length = struct.unpack('H', data[:2])[0]
region_name = data[2:2+region_name_length]
return (data[2+region_name_length:],
f'Changing to region: {region_name.decode().upper()}') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_region_name(self, i):\n for region in self.regions:\n if region['id'] == i:\n return region['name']\n return 'Unknown Matchmaking Region'",
"def region_name(self):\n return self.random_element(self._regions)[1]",
"def parse(spec: str):\n parts = spe... | [
"0.59673536",
"0.57557505",
"0.5583435",
"0.5512079",
"0.5460583",
"0.5374759",
"0.53120506",
"0.5214128",
"0.51646787",
"0.5143317",
"0.51233065",
"0.503153",
"0.5028622",
"0.49404567",
"0.49021447",
"0.4894185",
"0.4893214",
"0.48763806",
"0.48636374",
"0.48617592",
"0.4861... | 0.7242775 | 0 |
Create an expression that performs a bit_lshift operation. | def __init__(self, policy: TypePolicy, bit_offset: int, bit_size: int, shift: int, bin: TypeBinName):
self._children= (
bit_offset,
bit_size,
shift,
_GenericExpr(_ExprOp._AS_EXP_BIT_FLAGS, 0, {_Keys.VALUE_KEY: policy['bit_write_flags']} if policy is not No... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitwise_lshift(self, other: Any) -> ColumnOperators:\n\n return self.operate(bitwise_lshift_op, other)",
"def __lshift__(self, other: Any) -> ColumnOperators:\n return self.operate(lshift, other)",
"def test_bit_lshift_wrap(self):\n ops = [bitwise_operations.bit_lshift(self.test_bin_on... | [
"0.7837686",
"0.751117",
"0.74644315",
"0.7382873",
"0.7275201",
"0.70378315",
"0.6920777",
"0.6768447",
"0.6757356",
"0.6608792",
"0.6593422",
"0.65773314",
"0.6550301",
"0.64820445",
"0.64774114",
"0.6370811",
"0.6322138",
"0.63025385",
"0.62852126",
"0.62482995",
"0.624352... | 0.0 | -1 |
Test case for delete_provisioning_request Deletes a port provisioning request | def test_delete_provisioning_request(self):
response = self.client.open('/api/provisioning/port/{requestId}'.format(requestId='requestId_example'),
method='DELETE')
self.assert200(response, "Response body is : " + response.data.decode('utf-8')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_provisioning_request(requestId):\n doc = PortProvisionRequest.get(id=requestId)\n\n if doc:\n print(doc)\n doc.delete()\n return {\"status\": \"deleted\"}\n else:\n return 'Not Found', 404",
"async def test_delete(self):\n rsps = respx.delete(f'{PROVISIONING... | [
"0.8210428",
"0.6664818",
"0.6417803",
"0.6305171",
"0.6026843",
"0.6005614",
"0.60023606",
"0.5943052",
"0.5932378",
"0.59317976",
"0.59317976",
"0.5874001",
"0.58608633",
"0.57793397",
"0.57621557",
"0.57589376",
"0.57544667",
"0.57511425",
"0.5744601",
"0.5734947",
"0.5723... | 0.8789912 | 0 |
Fetch a page attribute, first trying the page class attributes, then page ctx, and lastly resorting to a default. e.g. `page.get("foo", "bar")` checks for `page.foo`, then `page.ctx["foo"]`, and falls back to `"bar"`. | def get(self, key: str, default: Any = None) -> Any:
return getattr(self, key, self.ctx.get(key, default)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _safe_getattr(value, attr, default):\n try:\n return getattr(value, attr)\n except Exception:\n return default",
"def get_cached_attr(obj, attr, default=_UNSPECIFIED):\n cache = get_cache(obj)\n try:\n return cache.values[attr]\n except KeyError as err:\n if default... | [
"0.57307297",
"0.57164514",
"0.5626412",
"0.5604301",
"0.55283195",
"0.55158997",
"0.5512732",
"0.54869676",
"0.5456371",
"0.5433508",
"0.5404067",
"0.5398676",
"0.5381506",
"0.534176",
"0.5315778",
"0.5279999",
"0.5242483",
"0.52385646",
"0.52170396",
"0.5214979",
"0.5209925... | 0.5526034 | 5 |
Sends list of texts to Perspective API for analysis and returns their toxicity scores | def processRequest(data):
text, key, lang = data[0], data[1], data[2]
prob = profanityCheck(text)
if prob >= 0.7:
return {text: prob}
print("Analysing text %s, of the language %s" % (text, lang))
return {text: makePerspectiveRequest(text, key, lang)} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analyze(self, text):\n\n score = 0.0;\n\n words = text.split(' ')\n # match each word in either the positives or negatives list adding or subtracting 1 from the score if present\n for word in words:\n for w in self.positives:\n if w == word.lower():\n ... | [
"0.6157069",
"0.6134014",
"0.61130375",
"0.6072768",
"0.60495025",
"0.60198337",
"0.60086817",
"0.5962274",
"0.5915401",
"0.5893758",
"0.5850687",
"0.58502686",
"0.5850262",
"0.58496475",
"0.58414406",
"0.5832228",
"0.58258724",
"0.579906",
"0.57907945",
"0.57819635",
"0.5761... | 0.0 | -1 |
Create the Adience Dataset class. | def __init__(self, metadata_folder='./'):
self.metadata = self.load_metadata(metadata_folder)
self.prefix = 'data/adience/faces/'
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_dataset(source=''):\n return ExperimentalDataset()",
"def datasetcreate(self, dataset_path='datasets', class_name='Demo',\n haarcascade_path='haarcascade/haarcascade_frontalface_default.xml',\n eyecascade_path='haarcascade/haarcascade_eye.xml', eye_det... | [
"0.68890107",
"0.67470795",
"0.66202754",
"0.6563503",
"0.6551748",
"0.65432465",
"0.64777726",
"0.63658005",
"0.633543",
"0.6286271",
"0.626821",
"0.6258167",
"0.6239777",
"0.62299514",
"0.61367655",
"0.6102009",
"0.60866",
"0.60773563",
"0.60701334",
"0.6030363",
"0.6027373... | 0.0 | -1 |
Given an age, what is the age group? | def adience_resolve_class_label(age):
if age == '(0, 2)' or age == '2':
age_id = 0
elif age == '(4, 6)' or age == '3':
age_id = 1
elif age == '(8, 12)' or age == '(8, 23)' or age == '13':
age_id = 2
elif age == '(15, 20)' or... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def age_group(self):\n if \"ageGroup\" in self._prop_dict:\n return self._prop_dict[\"ageGroup\"]\n else:\n return None",
"def __age_categorize(self, age):\r\n # Baby age category - most at risk, highest categorical denomination\r\n if age <= 4:\r\n se... | [
"0.7400962",
"0.6577341",
"0.65198344",
"0.64193434",
"0.6352549",
"0.6317757",
"0.63024217",
"0.61729646",
"0.6149663",
"0.60753495",
"0.60315925",
"0.6030247",
"0.6030247",
"0.60000616",
"0.5998982",
"0.59764224",
"0.59548694",
"0.594437",
"0.5929544",
"0.5929544",
"0.59042... | 0.60576355 | 10 |
Create the CCD Dataset class. | def __init__(self, metadata_folder='./'):
self.metadata = self.load_metadata(metadata_folder)
self.prefix = 'data/CCD/frames/'
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_new_dataset(self,\n dataset_dir, \n split,\n description=\"\",\n url=\"\",\n version=\"\",\n year=0,\n contributor=\"\",\n... | [
"0.71772265",
"0.6800385",
"0.67641604",
"0.67442983",
"0.6739134",
"0.66833997",
"0.6660233",
"0.66377974",
"0.6632657",
"0.66210264",
"0.6538922",
"0.6515394",
"0.63803774",
"0.63703537",
"0.63639367",
"0.63564277",
"0.6339496",
"0.6322804",
"0.6306451",
"0.62665397",
"0.62... | 0.0 | -1 |
Create the MAIP Dataset class. | def __init__(self, metadata_folder='./'):
self.metadata = self.load_metadata(metadata_folder)
self.prefix = 'data/miap/images/'
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateDataset(all_arrays):\n dataset = Dataset()\n\n dataset._addData(all_arrays[0])\n dataset._addData(all_arrays[1])\n dataset._addData(all_arrays[3])\n dataset._addData(all_arrays[5])\n dataset._addData(all_arrays[6])\n dataset._addData(all_arrays[9])\n dataset._addData(all_arrays[8]... | [
"0.6618513",
"0.6479319",
"0.6405539",
"0.63376313",
"0.6287821",
"0.62840694",
"0.6240477",
"0.6220959",
"0.61934644",
"0.6187013",
"0.61758745",
"0.61485577",
"0.61482894",
"0.6110025",
"0.6081134",
"0.6057111",
"0.6041586",
"0.6039835",
"0.60111904",
"0.60032386",
"0.59831... | 0.0 | -1 |
Create the UTK Dataset class. | def __init__(self, utkface_filenames = 'utkface_images.txt'):
self.metadata = self.load_metadata(utkface_filenames)
self.prefix = ''
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, name_dataset, reduce=False):\n dataset = TUDataset(root='data/TUDataset', name=name_dataset)\n if reduce:\n new_dataset = []\n for i in tqdm(range(len(dataset))):\n aux_graph = copy.deepcopy(dataset[i])\n aux_graph.edge_index = TU... | [
"0.7217619",
"0.7017165",
"0.69850045",
"0.6954425",
"0.68380755",
"0.67937624",
"0.6782208",
"0.6707376",
"0.66942316",
"0.66832036",
"0.65427226",
"0.6434744",
"0.64004165",
"0.6264023",
"0.6217079",
"0.6214021",
"0.61979926",
"0.617337",
"0.6130264",
"0.6122425",
"0.610881... | 0.0 | -1 |
Return the total receptive field of this model as of frames. | def receptive_field(self):
frames = 0
for f in self.pad:
frames += f
return 1 + 2 * frames | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receptive_field(self):\n return self.LocalLayer_Torso.receptive_field()",
"def total_rewards(self) -> float:\n return self.__total_rewards",
"def fields(self):\n return (self._total + self._mean + self._variance\n + self._skew + self._kurtosis)",
"def patrimony_total(self)... | [
"0.6807186",
"0.6247257",
"0.6151634",
"0.6062826",
"0.60195196",
"0.60095304",
"0.6005246",
"0.5999161",
"0.5976631",
"0.5976631",
"0.5976631",
"0.5976631",
"0.5954339",
"0.5918959",
"0.590753",
"0.589701",
"0.5859162",
"0.5844734",
"0.5844734",
"0.5828635",
"0.5827173",
"... | 0.70493305 | 0 |
Return the total receptive field of this model as of frames. | def receptive_field(self):
return self.LocalLayer_Torso.receptive_field() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receptive_field(self):\n frames = 0\n for f in self.pad:\n frames += f\n return 1 + 2 * frames",
"def receptive_field(self):\n frames = 0\n for f in self.pad:\n frames += f\n return 1 + 2 * frames",
"def total_rewards(self) -> float:\n retu... | [
"0.70506257",
"0.70506257",
"0.6246167",
"0.6150003",
"0.60605",
"0.6018066",
"0.60072565",
"0.60025686",
"0.5996756",
"0.5975303",
"0.5975303",
"0.5975303",
"0.5975303",
"0.5954303",
"0.5917253",
"0.59065473",
"0.5893803",
"0.58588445",
"0.58437896",
"0.58437896",
"0.5827709... | 0.68084574 | 2 |
returns a value, 1./sqrt(median(in_array)) | def sigma_from_weightsp(self, in_arr, takeEvenMean=False):
sigsp = self.sigmasp_from_weightsp(in_arr)
return self._median(numpy.array(sigsp), takeEvenMean) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _median(self, in_arr, takeEvenMean):\n if takeEvenMean:\n return numpy.median(in_arr)\n else:\n return numpy.sort(in_arr, axis=None)[(in_arr.size-1)/2]",
"def get_median(numlist):\n return np.median(numlist)",
"def median(array):\n sorted = [x for x in array]\n ... | [
"0.7936403",
"0.7877757",
"0.7766255",
"0.7706833",
"0.7559406",
"0.7556805",
"0.7545578",
"0.75453913",
"0.7456753",
"0.743678",
"0.74096215",
"0.7387109",
"0.7345126",
"0.73166513",
"0.7312413",
"0.72878706",
"0.72827375",
"0.72534126",
"0.7239744",
"0.7231068",
"0.72196823... | 0.0 | -1 |
Return a darker color. | def darken(color):
hue, saturation, value = rgb_to_hsv(color.red, color.green, color.blue)
value /= 1.5
saturation /= 1.25
return hsv_to_rgb(hue, saturation, value) + (color.alpha,) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def darken(hex_color: str) -> str:\n amount = 0.2\n hex_color = hex_color.replace(\"#\", \"\")\n red = max(0, int(hex_color[0:2], 16) - int(255 * amount))\n green = max(0, int(hex_color[2:4], 16) - int(255 * amount))\n blue = max(0, int(hex_color[4:6], 16) - int(255 * amount))\n darker_color = (\... | [
"0.7454738",
"0.7330892",
"0.69382864",
"0.68706894",
"0.6669197",
"0.6634606",
"0.64649427",
"0.6458235",
"0.64072514",
"0.6381072",
"0.6364707",
"0.6326756",
"0.6304574",
"0.6232114",
"0.6199844",
"0.6146135",
"0.61369884",
"0.6134376",
"0.6109642",
"0.6106515",
"0.6088504"... | 0.7346637 | 1 |
Draw the path of the border radius box. ``widths`` is a tuple of the inner widths (top, right, bottom, left) from the border box. Radii are adjusted from these values. Default is (0, 0, 0, 0). | def rounded_box_path(stream, radii):
x, y, w, h, tl, tr, br, bl = radii
if all(0 in corner for corner in (tl, tr, br, bl)):
# No radius, draw a rectangle
stream.rectangle(x, y, w, h)
return
r = 0.45
stream.move_to(x + tl[0], y)
stream.line_to(x + w - tr[0], y)
stream.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_border(self):\n\n scaled_inside = self.inside_border * self.SCALE\n scaled_outside = self.outside_border * self.SCALE\n scaled_width = self.width * self.SCALE\n\n horizontal_line = 'M {x0} {y0} h {length} v {width} h -{length} z'\n vertical_line = 'M {x0} {y0} v {length}... | [
"0.5932557",
"0.52870655",
"0.5187153",
"0.51472515",
"0.5135001",
"0.50693035",
"0.50689316",
"0.50074625",
"0.4942915",
"0.48784637",
"0.48378006",
"0.47617278",
"0.47546327",
"0.4732761",
"0.46854058",
"0.46846285",
"0.4670559",
"0.46552056",
"0.46498325",
"0.4627424",
"0.... | 0.5240151 | 2 |
Draw the box border to a ``document.Stream``. | def draw_border(stream, box):
# We need a plan to draw beautiful borders, and that's difficult, no need
# to lie. Let's try to find the cases that we can handle in a smart way.
def get_columns_with_rule():
"""Yield columns that have a rule drawn on the left."""
skip_next = True
for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_page(page, stream):\n bleed = {\n side: page.style[f'bleed_{side}'].value\n for side in ('top', 'right', 'bottom', 'left')}\n marks = page.style['marks']\n stacking_context = StackingContext.from_page(page)\n draw_background(\n stream, stacking_context.box.background, clip... | [
"0.5705386",
"0.5639399",
"0.5570043",
"0.556558",
"0.55434954",
"0.5383438",
"0.53265554",
"0.53187335",
"0.52529013",
"0.52422464",
"0.5228069",
"0.52273524",
"0.52140033",
"0.52086645",
"0.51901776",
"0.5178869",
"0.5124615",
"0.5115901",
"0.5094592",
"0.50910413",
"0.5090... | 0.69521314 | 0 |
Return the unique id of the event. | def id(self):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id(self) -> str:\n return self._event.get('id')",
"def event_id(self):\n return self._event_id",
"def getId(self):\n return _libsbml.Event_getId(self)",
"def GetEventIdentifier(self):\n return self._event_identifier",
"def getUniqueID(event):\n\tmatch = reUniqueID.search(event)\... | [
"0.84729093",
"0.8444983",
"0.82483697",
"0.8157108",
"0.77766025",
"0.7458073",
"0.7458073",
"0.7351588",
"0.7328253",
"0.7322438",
"0.7322438",
"0.7322438",
"0.7322438",
"0.7322438",
"0.7322438",
"0.7322438",
"0.7322438",
"0.7313246",
"0.729245",
"0.729245",
"0.729245",
"... | 0.0 | -1 |
The value of the feature is the min distance between any object in the extension of c1 and any object on the extension of c2, moving only along redges. | def denotation(self, model):
ext_c1 = model.uncompressed_denotation(self.c1)
ext_c2 = model.uncompressed_denotation(self.c2)
ext_r = model.uncompressed_denotation(self.r)
# (Debugging)
# ec1 = sorted(cache.universe.value(x) for x in cache.uncompress(ext_c1, self.c1.ARITY))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minimum_distance(object_1, object_2):\n\n # package import\n import numpy as np\n\n # main algorithm\n minimum_distance = 100000\n\n for coord_1 in object_1:\n for coord_2 in object_2:\n distance_btwn_coords = np.linalg.norm(coord_1 - coord_2)\n if distance_btwn_coor... | [
"0.64672554",
"0.6217276",
"0.61850023",
"0.6081567",
"0.606083",
"0.5999995",
"0.5996432",
"0.5954135",
"0.59468925",
"0.5916301",
"0.5907533",
"0.58643496",
"0.58624357",
"0.5848533",
"0.5842086",
"0.5776009",
"0.57662404",
"0.5752642",
"0.57183474",
"0.5716433",
"0.5711440... | 0.0 | -1 |
The value of the feature is f1 < f2 | def denotation(self, model):
ext_f1 = self.f1.denotation(model)
ext_f2 = self.f2.denotation(model)
return ext_f1 < ext_f2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, other):\n return self.__f > other.get_f()",
"def __ge__(self,f2):\n return self > f2 or self == f2",
"def __gt__(self, other):\n return self.x ** 2 + self.y ** 2 > other.x ** 2 + other.y ** 2",
"def threshad(f, f1, f2=None):\n\n if f2 is None: \n y = binary(f1 <=... | [
"0.7495265",
"0.74074596",
"0.73894393",
"0.7220509",
"0.71422136",
"0.7136578",
"0.71185535",
"0.70948553",
"0.70477045",
"0.69834864",
"0.69177634",
"0.686342",
"0.6826311",
"0.6817896",
"0.6801876",
"0.67579144",
"0.6755326",
"0.67524177",
"0.674877",
"0.67084754",
"0.6631... | 0.0 | -1 |
Create and return a `User` with superuser powers. Superuser powers means that this user is an admin that can do anything they want. | def create_superuser(self, username, email, password, **kwargs):
kwargs.setdefault('is_staff', True)
kwargs.setdefault('is_superuser', True)
if kwargs.get('is_staff') is not True:
raise ValueError('Superuser must have is_staff=True.')
if kwargs.get('is_superuser') is not Tru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_user_as_admin(self, *args, **kwargs):\n profile = self.create_user(*args, **kwargs)\n profile.make_administrator()\n return profile",
"def create_superuser(self, username, major, password):\r\n user = self.create_user(username, major, password=password,)\r\n user.is_admi... | [
"0.7354598",
"0.7346853",
"0.7292081",
"0.72741586",
"0.7273662",
"0.722427",
"0.7210906",
"0.7199503",
"0.71846986",
"0.7173363",
"0.7138555",
"0.71200466",
"0.7115839",
"0.7092951",
"0.70887464",
"0.708154",
"0.7074986",
"0.706979",
"0.7068387",
"0.70664716",
"0.70519775",
... | 0.0 | -1 |
Get the marker template's interactive marker server. | def server(self):
return self._server | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_server(self):\n\n pass",
"def get_mapserver(self):\n return self.get_node('//MapServer')",
"def server(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"server\")",
"def server(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"server\")",
"def server(self) ->... | [
"0.5713564",
"0.5681471",
"0.56718",
"0.56718",
"0.55612904",
"0.53901726",
"0.5360627",
"0.53534365",
"0.5328185",
"0.52752024",
"0.5226425",
"0.52251995",
"0.5196644",
"0.51267505",
"0.5064403",
"0.50298774",
"0.49947485",
"0.49527696",
"0.49257052",
"0.4907691",
"0.4877441... | 0.5278075 | 10 |
Return a next index for read client. This function implements a default behavior for get a next read client for masterslave setup. Overwrite this function if you want a specific behavior. | def get_next_client_index(self, write=True):
if write or len(self._server) == 1:
return 0
return random.randint(1, len(self._server) - 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __next_index():\n return redis_store.incr(String.__name__.lower() + '-index')",
"def get_client(self, write=True):\r\n index = self.get_next_client_index(write=write)\r\n\r\n if self._clients[index] is None:\r\n self._clients[index] = self.connect(index)\r\n\r\n return ... | [
"0.6373826",
"0.60432035",
"0.57846725",
"0.57057947",
"0.56468946",
"0.5631014",
"0.5614183",
"0.56074053",
"0.56074053",
"0.5567467",
"0.5533405",
"0.5528173",
"0.5506794",
"0.55002165",
"0.5483921",
"0.54825854",
"0.5479725",
"0.54147923",
"0.5399875",
"0.53776383",
"0.534... | 0.72630644 | 0 |
Unpickles the given value. | def unpickle(value):
try:
value = int(value)
except (ValueError, TypeError):
value = smart_bytes(value)
value = pickle.loads(value)
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unserialize(val):\n return pickle.loads(val)",
"def _decode_value(self, value):\n return pickle.loads(value.value) if value else value",
"def from_value(value):\n return pickle.dumps(value)",
"def base64unpickle(self, value):\n if value:\n return pickle.loads(self.base64decod... | [
"0.7045012",
"0.7031028",
"0.6841384",
"0.65678066",
"0.6526041",
"0.64857894",
"0.6477095",
"0.61220485",
"0.6111226",
"0.6080982",
"0.6064356",
"0.60208184",
"0.6005177",
"0.5897015",
"0.58008486",
"0.5781338",
"0.57552445",
"0.57470506",
"0.5712168",
"0.56796086",
"0.56617... | 0.7501486 | 0 |
Pickle the given value. | def pickle(self, value):
if isinstance(value, bool) or not isinstance(value, integer_types):
return pickle.dumps(value, self._pickle_version)
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_value(value):\n return pickle.dumps(value)",
"def dump_object(self, value):\n return pickle.dumps(value)",
"def _encode_value(self, value):\n return pickle.dumps(value)",
"def unserialize(val):\n return pickle.loads(val)",
"def value(self) -> Any:\n return pickle.loads(self.pi... | [
"0.77703",
"0.7441614",
"0.6958083",
"0.6798523",
"0.6667502",
"0.6574332",
"0.6568599",
"0.6552237",
"0.65478945",
"0.6544326",
"0.65061575",
"0.6471692",
"0.64400285",
"0.6392385",
"0.6310394",
"0.6301115",
"0.6247126",
"0.6234851",
"0.619252",
"0.61067325",
"0.6043083",
... | 0.75480545 | 1 |
Returns the number of prizes that will be awarded for this prize. | def num_awarded(self, floor=None):
if self.award_to in ("individual_overall", "floor_overall", "dorm"):
# For overall prizes, it is only possible to award one.
return 1
elif self.award_to in ("floor_dorm", "individual_dorm"):
# For dorm prizes, this is just the number of dorms.
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_pickets(self) -> int:\n return len(self.pickets)",
"def get_num_petals(self):\n return self._num_petals",
"def psizes(self):\n return self._cache.psizes",
"def num_votes(self):\n return sum(self.votes_per_count)",
"def size(self) -> int:\n\n return self.sizes.sum(... | [
"0.65297043",
"0.6438432",
"0.638483",
"0.625789",
"0.61884695",
"0.6187963",
"0.6182225",
"0.6173951",
"0.6150105",
"0.612123",
"0.61027765",
"0.6080633",
"0.6056884",
"0.60247165",
"0.601722",
"0.60013944",
"0.5973453",
"0.5966288",
"0.5964273",
"0.5963277",
"0.59582824",
... | 0.6676239 | 0 |
Returns the number of tickets allocated to this prize. Takes an optional argument to return the number of tickets allocated by the user. | def allocated_tickets(self, user=None):
query = self.raffleticket_set.filter(raffle_prize=self)
if user:
query = query.filter(user=user)
return query.count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_assigned(self):\n return FlicketTicket.query.filter_by(assigned=self.user).count()",
"def num_pickets(self) -> int:\n return len(self.pickets)",
"def num_attendees(self):\r\n n = sum([c.qty for c in self.contribution_set.all()])\r\n return n",
"def num_allocated_resources(... | [
"0.6878064",
"0.62725556",
"0.60077244",
"0.5967526",
"0.59303814",
"0.587535",
"0.5703093",
"0.5699997",
"0.5674289",
"0.56504005",
"0.56465405",
"0.5644256",
"0.5603991",
"0.5569141",
"0.5529344",
"0.55266505",
"0.55215555",
"0.5503645",
"0.54946893",
"0.54946893",
"0.54825... | 0.7432309 | 0 |
force the socket server to exit | def close(self):
try:
self.rpc_server.shutdown()
self.join(1.0)
except Exception:
LOGGER.warning("An error occurred while closing RPC interface") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_close(self):\n\t\tself.socket.close()",
"def server_exit():\n return",
"def exit(self):\n self._status = \"\"\n self._sock.settimeout(1.0)\n self._sock.sendto(bytes(\"bla\", \"utf-8\"), (self._cfg.host, self._cfg.port))",
"def exit(s_socket):\r\n s_socket.send(\"\")",
... | [
"0.7984393",
"0.7898972",
"0.7716949",
"0.76290375",
"0.76139414",
"0.7602799",
"0.7559701",
"0.7553095",
"0.75294524",
"0.752781",
"0.7482219",
"0.7415964",
"0.739169",
"0.73783654",
"0.73598665",
"0.73078346",
"0.72906005",
"0.7285503",
"0.7278782",
"0.7272383",
"0.72687703... | 0.0 | -1 |
about about page not fully designed | def about(request):
context = {}
return render(request, 'store/about.html', context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_about(self):\n render_about_window()",
"def on_about(self, event):\n pass",
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about_page(request):\r\n return render(request... | [
"0.81471705",
"0.774489",
"0.76973206",
"0.7627653",
"0.75630844",
"0.75003463",
"0.7499308",
"0.7405088",
"0.73876166",
"0.73860353",
"0.7378438",
"0.736227",
"0.7333406",
"0.729723",
"0.72963274",
"0.7288211",
"0.72665966",
"0.72650564",
"0.72650564",
"0.72650564",
"0.72650... | 0.6894653 | 83 |
Starts up the game by creating an instance of it and running it. main() > None | def main():
game = RiichiMahjongApp()
game.run() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n g = Game(800, 600)\n g.start()",
"def main():\n g = DemoGame(800, 600)\n g.start()",
"def main():\r\n gameclass = data.game.GameClass()\r\n gameclass.main_loop()",
"def main():\n if \"cli\" in sys.argv:\n run_cli_game()\n else:\n run_gui_game()",
"def mai... | [
"0.85635036",
"0.81876785",
"0.80455476",
"0.78687423",
"0.77845705",
"0.7681315",
"0.7620199",
"0.7465425",
"0.739541",
"0.7386681",
"0.7336826",
"0.73127043",
"0.72832006",
"0.7261894",
"0.72405136",
"0.72397304",
"0.7217755",
"0.71836495",
"0.7147536",
"0.71364313",
"0.713... | 0.7948774 | 3 |
Cleans passed string to either return a valid SVGRGBHEXnotation or an empty string. | def cleanup_passed_color_value(s):
reo = re.compile('[0-9a-f]')
cannotBeCleaned = ''
if s[0] == '#' and len(s) in [4,7] and reo.match(s[1:]):
return s
if s in colorNamesAndCodes:
col = colorNamesAndCodes[s]
if reo.match(col[1:]):
return col
else:
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_hex(text): \n return re.sub(r'&.*?;', r'', text)",
"def clean_xml_string(s):\n return VALID_XML_CHARS_REGEX.sub(\"\", s)",
"def clean_str(string):\n #just return string if already cleaned\n return string",
"def stripColor(self, s):\n return _stripColorRe.sub('', s)",
"def clea... | [
"0.60601455",
"0.59946215",
"0.59191805",
"0.58995914",
"0.581662",
"0.5805634",
"0.5798346",
"0.5726138",
"0.57169926",
"0.5714296",
"0.5709046",
"0.5709046",
"0.57067734",
"0.56963587",
"0.56107944",
"0.5573957",
"0.5571539",
"0.5549539",
"0.55424464",
"0.5520134",
"0.55162... | 0.60755706 | 0 |
If a tfq_simulate op is asked to simulate states given circuits acting on different numbers of qubits, the op should return a tensor padded with zeros up to the size of the largest circuit. The padding should be physically correct, such that samples taken from the padded states still match samples taken from the origin... | def test_simulate_state_output_padding(self, all_n_qubits):
circuit_batch = []
for n_qubits in all_n_qubits:
qubits = cirq.GridQubit.rect(1, n_qubits)
circuit_batch += util.random_circuit_resolver_batch(qubits, 1)[0]
tfq_results = tfq_simulate_ops.tfq_simulate_state(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sampling_output_padding(self, all_n_qubits, n_samples):\n op = tfq_simulate_ops.tfq_simulate_samples\n circuits = []\n expected_outputs = []\n for n_qubits in all_n_qubits:\n this_expected_output = np.zeros((n_samples, max(all_n_qubits)))\n this_expected_o... | [
"0.6290017",
"0.5681582",
"0.5681582",
"0.5676849",
"0.5593831",
"0.5576278",
"0.5497892",
"0.5487373",
"0.5466293",
"0.540858",
"0.54031944",
"0.539102",
"0.5358094",
"0.5357061",
"0.5343899",
"0.5330886",
"0.5322747",
"0.52873987",
"0.52870905",
"0.5285144",
"0.52784127",
... | 0.7703024 | 0 |
Returns best guess of prot from ACF, and height of peak Just pick first peak. | def acf_prot(self, pmin=0.1, pmax=100, delta=0.01, lookahead=30,
peak_to_trough=True, maxpeaks=1, plot=False, ax=None,
fig_kwargs=None, savefig_filename=None):
lags, ac = self.acf(pmin=pmin, pmax=pmax, smooth=pmax/10)
# make sure lookahead isn't too long if pmax is sma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_chimes(self):\n while True:\n self.recursion += 1\n if self.recursion > 10:\n self.exit_status = \"Recursion limit reached\"\n return None\n\n peaks, peaks_meta_data = find_peaks(self.amplitude, height=self.height,\n ... | [
"0.6515955",
"0.6419468",
"0.63782084",
"0.620905",
"0.61406106",
"0.61376834",
"0.6083314",
"0.5996022",
"0.59908646",
"0.59794223",
"0.59150815",
"0.5905579",
"0.5863548",
"0.5851025",
"0.5850193",
"0.58073854",
"0.580671",
"0.575892",
"0.5715282",
"0.5693668",
"0.5689746",... | 0.6102276 | 6 |
Negative Test case with dates as holidays. | def __data_set_is_payday_negative_19_20_21(cls):
_pay_cycle_object = pay_cycle_object()
date_to_check = date_class(2020,12,25) # Christmas
cls.TEST_DATA_SET.append((_pay_cycle_object, date_to_check, False))
date_to_check = date_class(2021,12,24)
cls.TEST_DATA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_holidays(self):\n # January 2nd was not public holiday between 2012 and 2017\n self.assertNotIn(date(2013, 1, 2), self.holidays)\n self.assertNotIn(date(2014, 1, 2), self.holidays)\n self.assertNotIn(date(2015, 1, 2), self.holidays)\n self.assertNotIn(date(2016, 1, 2... | [
"0.779504",
"0.73691523",
"0.72286654",
"0.67183",
"0.66527766",
"0.6636426",
"0.65799487",
"0.6547076",
"0.6546462",
"0.6545383",
"0.6477775",
"0.6447516",
"0.6444255",
"0.6366996",
"0.62766814",
"0.62688833",
"0.62644833",
"0.6260839",
"0.6253269",
"0.6246883",
"0.62329143"... | 0.5506617 | 78 |
Negative Test case with dates in between biweekly paydays. | def __data_set_is_payday_negative_22_23_24(cls):
_pay_cycle_object = pay_cycle_object()
date_to_check = date_class(2018,11,23)
cls.TEST_DATA_SET.append((_pay_cycle_object, date_to_check, False))
date_to_check = date_class(2019,1,18)
cls.TEST_DATA_SET.append((... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_payday_negative2(self):\n date_to_check = date_class(2018,11,23)\n is_payday = self.pay_cycle.is_payday(date_to_check)\n assert is_payday == False\n\n date_to_check = date_class(2019,1,18)\n is_payday = self.pay_cycle.is_payday(date_to_check)\n assert is_payday... | [
"0.77591026",
"0.77172005",
"0.7587672",
"0.7122841",
"0.7116144",
"0.69571435",
"0.67868346",
"0.6785853",
"0.67141473",
"0.6693559",
"0.66907525",
"0.6637664",
"0.6631187",
"0.6629418",
"0.6625676",
"0.65981656",
"0.65893835",
"0.6579529",
"0.65614206",
"0.6496932",
"0.6477... | 0.64175355 | 22 |
Return agent's spilling state. | def spilling(self):
return self._spilling | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPacmanState( self ):\n return self.data.agentStates[0].copy()",
"def get_agent_state(self):\n return self.world_state",
"def get_state(self):\n\t\treturn Job(SDK.PrlVm_GetState(self.handle)[0])",
"def get_state(self):\n return self.env.sim.get_state()",
"def get_tools_state(self... | [
"0.5813141",
"0.57949114",
"0.5761483",
"0.5691754",
"0.5646033",
"0.562968",
"0.5607904",
"0.5590146",
"0.557208",
"0.5541229",
"0.5484805",
"0.54764456",
"0.54454887",
"0.54454887",
"0.54454887",
"0.54454887",
"0.54454887",
"0.54454887",
"0.54454887",
"0.54454887",
"0.54454... | 0.705317 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.