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 |
|---|---|---|---|---|---|---|
Convert uint8 numpy image array into [0,1] float image array | def normalize_image(img_arr_uint):
return img_arr_uint.astype(np.float64) * ONE_BYTE_SCALE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uint8_to_float(im: np.array):\n if im.dtype == np.float32:\n warnings.warn(\"Image is already np.float32\")\n return im\n im = im.astype(np.float32) / 255\n return im",
"def uint8_to_float(im: np.array):\n if im.dtype == np.float32:\n warnings.warn(\"Image is already np.float... | [
"0.84146804",
"0.84146804",
"0.7253339",
"0.7077252",
"0.7031203",
"0.70124435",
"0.7004611",
"0.69308674",
"0.6846737",
"0.6755497",
"0.67547464",
"0.66844153",
"0.66712826",
"0.6594761",
"0.65913326",
"0.65070504",
"0.64663315",
"0.64476335",
"0.6423584",
"0.6407224",
"0.63... | 0.75604707 | 2 |
Given two dicts, merge them into a new dict as a shallow copy. | def merge_two_dicts(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.85017794",
"0.844714",
"0.844019",
"0.8431087",
"0.8428637",
"0.83497995",
"0.83497995",
"0.83497995",
"0.82089055",
"0.81897765",
"0.81889284",
"0.81889284",
"0.80835843",
"0.79899365",
"0.7989572",
"0.77450234",
"0.7715417",
"0.76676947",
"0.76344365",
"0.7631627",
"0.76... | 0.83831346 | 10 |
Create an instance of the argument parser to parse commandline arguments. | def _make_argument_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(prog="pyrasaeco-render", description=__doc__)
subparsers = parser.add_subparsers(help="Commands", dest="command")
subparsers.required = True
once = subparsers.add_parser(
"once", help="Render once the scena... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_line_argument_parser() -> argparse.ArgumentParser:\n parser = argparse.ArgumentParser(\n description=description(),\n epilog=epilog(),\n formatter_class=argparse.RawDescriptionHelpFormatter,\n )\n return parser",
"def command_line_argument_parser() -> argparse.ArgumentPa... | [
"0.79516953",
"0.79516953",
"0.7793543",
"0.77724344",
"0.76279485",
"0.762619",
"0.7541328",
"0.75262517",
"0.74987364",
"0.74830705",
"0.7477329",
"0.74327964",
"0.7391257",
"0.7389797",
"0.7389039",
"0.7387323",
"0.73850703",
"0.73850703",
"0.73850703",
"0.73828155",
"0.73... | 0.0 | -1 |
Checks if the password is valid for the user. Returns True if the correct user and password are specfied. Returns False if the incorrect password was specified. Returns None if the user doesn't exist in this password store. | def check_password(self, user, password):
db = self.env.get_db_cnx()
cursor = db.cursor()
if not self.check_prereqs():
return None
query=self.create_query(self.sql_all_users_query+" WHERE %(username_field)s='%(username)s'",{'password_field':self.sql_password_field,'usernam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_password(self, user, password):\n valid, new_hash = self.pwd_context.verify_and_update(str(password), user['users_auth'])\n if not valid:\n logger.error('Invalid password for %(users_name)s', user)\n raise YKAuthError(\"Invalid password for %(users_name)s\" % user)... | [
"0.7352755",
"0.7308574",
"0.72344023",
"0.71757793",
"0.71466535",
"0.7125477",
"0.7092447",
"0.7087123",
"0.70738995",
"0.70558167",
"0.7029138",
"0.7023926",
"0.7010453",
"0.69839305",
"0.6966104",
"0.6948761",
"0.6933265",
"0.69229424",
"0.6921262",
"0.68990165",
"0.68989... | 0.6929865 | 17 |
Return the absolute path of a directory containing additional static resources (such as images, style sheets, etc). | def get_htdocs_dirs(self):
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_static():\n return os.path.abspath(os.path.dirname(__file__))+'/_static'",
"def glr_path_static():\n return os.path.join(base_path, \"static\")",
"def get_swagger_static_root():\n return os.path.join(CURDIR, \"static\")",
"def get_resource_dir(cls) -> str:\n return os.path.join(\n ... | [
"0.7699183",
"0.7484297",
"0.71711624",
"0.7002741",
"0.6919561",
"0.68631667",
"0.6814634",
"0.6772552",
"0.66359985",
"0.6633253",
"0.6631425",
"0.6540469",
"0.65200806",
"0.6490266",
"0.6407987",
"0.6387298",
"0.6354448",
"0.63465554",
"0.63328606",
"0.6332715",
"0.6321645... | 0.0 | -1 |
Return the absolute path of the directory containing the provided ClearSilver templates. | def get_templates_dirs(self):
from pkg_resources import resource_filename
return [resource_filename(__name__, 'templates')] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTemplateDir():\n return os.path.join(Configurations.getProjectRootDir(), TEMPLATE_DIR_NAME)",
"def _find_base_path(self):\n paths = [path for path, content in self._templates]\n if len(paths) == 1:\n return os.path.dirname(paths[0])\n return common_path_prefix(paths)... | [
"0.6999529",
"0.688431",
"0.68323845",
"0.6820741",
"0.662565",
"0.6617785",
"0.66054684",
"0.65744185",
"0.63397247",
"0.6332294",
"0.63302666",
"0.6284764",
"0.6281997",
"0.6201685",
"0.60613346",
"0.60517365",
"0.6047509",
"0.6045947",
"0.60384876",
"0.6030832",
"0.5977111... | 0.5836341 | 33 |
Returns True if groupname exists. | def has_group(self,groupname):
if not self.check_prereqs():
return False
db = self.env.get_db_cnx()
cursor = db.cursor()
query=self.create_query(self.sql_get_groups_query+" WHERE $groupname_field$='$groupname$'",{'groupname':groupname,'groupname_field':self.sql_groupname_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_exists(self):\n return AzureTools().group_exists(names.group_name(self))",
"def is_group(self, group_name):\n\n return group_name in self._group",
"def group_exists(self, path_to_group, groupname):\n self.open_db()\n try:\n group = self.h5file.get_node(path_to_group... | [
"0.82153803",
"0.80166024",
"0.7890802",
"0.78811616",
"0.7502196",
"0.73832816",
"0.73511165",
"0.72888064",
"0.724438",
"0.72358394",
"0.722957",
"0.7107118",
"0.70923513",
"0.70068115",
"0.6947857",
"0.6881629",
"0.68646014",
"0.6832601",
"0.68314654",
"0.6675531",
"0.6635... | 0.799018 | 2 |
Ensure some basic normalization on fqdn values | def normalize_fqdn(fqdn):
if not fqdn:
return None
if fqdn.endswith('/'):
fqdn = fqdn.strip('/')
# bare fqdn, fallback to http://
if not fqdn.startswith('http'):
fqdn = "http://%s" % fqdn
return fqdn | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ensure_fqdn(self, name):\n if name[-1:] != \".\":\n return \"%s.\" % name\n else:\n return name",
"def fqdn_f(x: Text) -> Tuple[Text, Text]:\n return \"fqdn\", x.lower()",
"def test_returns_proper_fqdn(self):\n self.mock_getaddrinfo.return_value = (\n ... | [
"0.70267797",
"0.677371",
"0.677342",
"0.66205776",
"0.6529146",
"0.6458251",
"0.6415377",
"0.64141905",
"0.63974714",
"0.6053728",
"0.60362595",
"0.6026839",
"0.5912228",
"0.5901264",
"0.5893297",
"0.5874915",
"0.586321",
"0.58477634",
"0.5844477",
"0.58164537",
"0.5760108",... | 0.751114 | 0 |
generate a random string | def random_string():
k = random.randint(5, 10)
return ''.join(random.choices(string.ascii_letters + string.digits, k=k)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateRandomString():\n return ''.join(b64encode(urandom(32)).decode('utf-8'))",
"def generate_random_string():\n return \"\".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(16)) # nosec",
"def __generate_random_string():\n return uuid4().hex[:6].upper()",
"def r... | [
"0.850504",
"0.84503955",
"0.8107285",
"0.8030303",
"0.79917127",
"0.7966936",
"0.7955794",
"0.783599",
"0.7833559",
"0.7833183",
"0.7817233",
"0.7802888",
"0.7779429",
"0.7768785",
"0.7746513",
"0.77311516",
"0.7703917",
"0.77027106",
"0.7688608",
"0.7673507",
"0.7664003",
... | 0.76068896 | 26 |
Check if two models are the same. To check equivalence, we first verify the modules are the same in each model by checking the list of attributes for each module. This checks if the same set of modules are used and if any module has been marked by adding an attribute. Next, we directly iterate over the state dict and v... | def compare_models(model_1: torch.nn.Module, model_2: torch.nn.Module, is_equal: bool = True):
with contextlib.nullcontext() if is_equal else pytest.raises(Exception):
# Compare model module attributes since algorithms like StochasticDepth monkeypatch
# on new attributes. We only check this on Compo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_modules(\n source_module: nn.Module,\n target_module: nn.Module,\n weight_only: bool,\n verbose: bool = False,\n) -> bool:\n source_dict = source_module.state_dict()\n target_dict = target_module.state_dict()\n if source_dict.keys() != target_dict.keys():\n raise ValueError(... | [
"0.6601647",
"0.65560275",
"0.6379691",
"0.63324845",
"0.6269184",
"0.62691426",
"0.61538935",
"0.6138805",
"0.6012644",
"0.6011246",
"0.6002995",
"0.5967212",
"0.5855237",
"0.5847934",
"0.58476907",
"0.58285075",
"0.58118963",
"0.5765182",
"0.575569",
"0.5744717",
"0.5743028... | 0.65358245 | 2 |
Create a dictionary of possible ambiguous annotations for all forms. | def find_annotations(forms, files):
if not type(forms) in [list, tuple]:
forms = [forms]
ambiguities = defaultdict(list)
for file_ in files:
with open(file_, 'r') as data_file:
for line in data_file:
three_first_chars = line[:3]
if three_first_char... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def annotations(cls, types: dict) -> dict:\n return {\n name: Optional[cls.type_map[types[name]]]\n for name in types\n if types[name] in cls.type_map\n }",
"def _uikwargs_from_annotated_type(hint: Any) -> dict[str, Any]:\n # hint must be an Annotated[...] type\n... | [
"0.5872695",
"0.5405484",
"0.5387594",
"0.51252747",
"0.5100902",
"0.5068358",
"0.5062797",
"0.50354344",
"0.50258124",
"0.49863327",
"0.4986224",
"0.49853978",
"0.49570417",
"0.49537036",
"0.49482334",
"0.49482334",
"0.4947191",
"0.49415976",
"0.49348265",
"0.49348265",
"0.4... | 0.64361227 | 0 |
urllib.parse.unquote acts only once. in case quotes are nested it is necessary to unquote until no further changes occur. | def fully_unquote(s):
new_s = urllib.parse.unquote(s)
c = 0
while new_s != s:
s = new_s
new_s = urllib.parse.unquote(s)
c += 1
assert c <= 10
return new_s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _unquote(s, encoding='utf-8'):\n return urllib.unquote(s).decode(encoding)",
"def _unquote(src, encoding=\"utf-8\"):\n return urllib.unquote(src).decode(encoding)",
"def _Unquote(s):\n if not hasattr(s, 'strip'):\n return s\n # Repeated to handle both \"'foo'\" and '\"foo\"'\n return s.strip(\"... | [
"0.7474205",
"0.72840935",
"0.704781",
"0.7034386",
"0.6998035",
"0.69909346",
"0.67545295",
"0.6747634",
"0.67144144",
"0.6706207",
"0.6685859",
"0.66546404",
"0.6631628",
"0.66138816",
"0.66035944",
"0.65744543",
"0.6513085",
"0.6497575",
"0.64781386",
"0.62992907",
"0.6138... | 0.70385575 | 3 |
Get k most popular annotations for ambiguous_entity. | def get_most_popular_annotations(ambiguous_entity, k=2):
freq = [(key, len(value)) for key, value in ambiguous_entity.annotated_corpus.items()]
freq = sorted(freq, key=lambda x: x[1], reverse=True)
return [x[0] for x in freq[:k]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_ambiguous_entities(n_ambiguous, files, threshold=5, k_ann=2):\n def exists_geq(k, it):\n true_it = (x for x in it if x)\n c = 0\n for _ in true_it:\n c += 1\n if c >= k:\n return True\n return False\n # dictionary of entity: {concept:c... | [
"0.6170952",
"0.59580594",
"0.5890428",
"0.5704015",
"0.56922567",
"0.5654448",
"0.5620149",
"0.5618692",
"0.5597631",
"0.5583861",
"0.5576103",
"0.55653495",
"0.555302",
"0.55428547",
"0.5519606",
"0.5496979",
"0.5474896",
"0.5456552",
"0.5420822",
"0.5401969",
"0.5383488",
... | 0.8690574 | 0 |
Provides the location of our migration directory. | def migration_directory(self) -> str:
with package_resources.path(
f"PyFunceble.data.{PyFunceble.cli.storage.ALEMBIC_DIRECTORY_NAME}",
"__init__.py",
) as file_path:
result = os.path.split(file_path)[0]
if PyFunceble.storage.CONFIGURATION.cli_testing.db_type... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _migrations_path():\n return join(dirname(dirname(dirname(sumo.__file__))), 'migrations')",
"def get_migrations_path():\n return MIGRATIONS_PATH",
"def _get_project_dir(self):\n return os.path.expanduser(\n self.sqlfluff_config.get_section(\n (self.templater_selec... | [
"0.8210593",
"0.77217036",
"0.69344693",
"0.68802124",
"0.6846819",
"0.68090975",
"0.6728393",
"0.67240715",
"0.6706829",
"0.66650563",
"0.6602771",
"0.6588322",
"0.65797484",
"0.6578663",
"0.64803314",
"0.64764637",
"0.64659077",
"0.6464724",
"0.64325905",
"0.6429245",
"0.64... | 0.8473635 | 0 |
Gets the html file that is closest to but not less than size. | def html_by_size(self, size):
filename = None
files = filter(lambda x: "html" in x[0], get_files_with_file_size(self.data_dir, reverse=True))
if files[0][1] < size:
filename = files[0][0]
else:
i = 0
while i < len(files):
if files[i][1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBiggerFileList(file_list):\n bigger_list = []\n for file in file_list:\n if os.path.getsize(file) > 50000000: # bit\n bigger_list.append(file)\n return bigger_list",
"def get_big_files(self, size_threshold=10):\n for f in self.filelist:\n if f[\"size_bytes\"] ... | [
"0.57499677",
"0.56974775",
"0.5668597",
"0.5480971",
"0.5343371",
"0.53272206",
"0.52781385",
"0.5263578",
"0.51291496",
"0.508535",
"0.5023082",
"0.5001185",
"0.4997149",
"0.4995383",
"0.49509308",
"0.4875535",
"0.48720494",
"0.48057058",
"0.4761702",
"0.47232074",
"0.47137... | 0.64351505 | 0 |
The AccessConfigurationName of the Access Configuration. The name of the resource. The name can be up to `32` characters long and can contain letters, digits, and hyphens (). | def access_configuration_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "access_configuration_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_configuration_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"access_configuration_name\")",
"def access_configuration_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"access_configuration_name\")",
"def name(self) -> str:\n name = self._confi... | [
"0.7486358",
"0.7206645",
"0.6774528",
"0.67367065",
"0.6373976",
"0.6373976",
"0.6282175",
"0.6279026",
"0.62782085",
"0.62528276",
"0.6235453",
"0.6207555",
"0.6175268",
"0.6173986",
"0.60689837",
"0.5976686",
"0.5957733",
"0.5912934",
"0.5826887",
"0.5790978",
"0.57530236"... | 0.7530321 | 0 |
The ID of the Directory. | def directory_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "directory_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def directory_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"directory_id\")",
"def directory_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"directory_id\")",
"def directory_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"directory_i... | [
"0.86193115",
"0.84758145",
"0.81507504",
"0.81507504",
"0.81507504",
"0.80275583",
"0.66744995",
"0.65655196",
"0.6565149",
"0.6513468",
"0.650948",
"0.64971465",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.64780... | 0.83013237 | 2 |
The Policy List. See `permission_policies` below. | def permission_policies(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['AccessConfigurationPermissionPolicyArgs']]]]:
return pulumi.get(self, "permission_policies") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policies(self):\n return self._data.get('policies')",
"def policies(self):\n return self._policies",
"def permission_policies(self) -> pulumi.Output[Optional[Sequence['outputs.AccessConfigurationPermissionPolicy']]]:\n return pulumi.get(self, \"permission_policies\")",
"def list_poli... | [
"0.7772358",
"0.7656785",
"0.7444302",
"0.7368247",
"0.7306872",
"0.72549087",
"0.7231609",
"0.7137215",
"0.7131873",
"0.7088239",
"0.69799507",
"0.6941363",
"0.68438494",
"0.6827397",
"0.6746049",
"0.6687032",
"0.6623487",
"0.65835625",
"0.65711325",
"0.65711325",
"0.6571132... | 0.7465447 | 2 |
The AccessConfigurationId of the Access Configuration. | def access_configuration_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "access_configuration_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_configuration_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"access_configuration_id\")",
"def config_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"config_id\")",
"def config_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"config_id\")",
"... | [
"0.85105073",
"0.7337781",
"0.709119",
"0.7068753",
"0.7039614",
"0.7039614",
"0.7039614",
"0.7039614",
"0.6994155",
"0.6778734",
"0.6778734",
"0.6778734",
"0.67664045",
"0.67664045",
"0.6760845",
"0.6697583",
"0.6677596",
"0.66682535",
"0.6607399",
"0.6607399",
"0.6606919",
... | 0.84858364 | 1 |
The AccessConfigurationName of the Access Configuration. The name of the resource. The name can be up to `32` characters long and can contain letters, digits, and hyphens (). | def access_configuration_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "access_configuration_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_configuration_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"access_configuration_name\")",
"def access_configuration_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"access_configuration_name\")",
"def name(self) -> str:\n name = self._config[\"name\"... | [
"0.7529133",
"0.7205792",
"0.67749125",
"0.6736788",
"0.6373572",
"0.6373572",
"0.628117",
"0.62788445",
"0.6277833",
"0.62517685",
"0.6234087",
"0.62066066",
"0.6174251",
"0.6173419",
"0.60693014",
"0.5975449",
"0.5957667",
"0.591256",
"0.58262837",
"0.57914597",
"0.5752966"... | 0.74854743 | 1 |
The ID of the Directory. | def directory_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "directory_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def directory_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"directory_id\")",
"def directory_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"directory_id\")",
"def directory_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"directory_id\")",
"... | [
"0.86193115",
"0.84758145",
"0.83013237",
"0.80275583",
"0.66744995",
"0.65655196",
"0.6565149",
"0.6513468",
"0.650948",
"0.64971465",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069... | 0.81507504 | 3 |
The Policy List. See `permission_policies` below. | def permission_policies(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['AccessConfigurationPermissionPolicyArgs']]]]:
return pulumi.get(self, "permission_policies") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policies(self):\n return self._data.get('policies')",
"def policies(self):\n return self._policies",
"def permission_policies(self) -> pulumi.Output[Optional[Sequence['outputs.AccessConfigurationPermissionPolicy']]]:\n return pulumi.get(self, \"permission_policies\")",
"def list_poli... | [
"0.7772358",
"0.7656785",
"0.7444302",
"0.7368247",
"0.7306872",
"0.72549087",
"0.7231609",
"0.7137215",
"0.7131873",
"0.7088239",
"0.69799507",
"0.6941363",
"0.68438494",
"0.6827397",
"0.6746049",
"0.6687032",
"0.6623487",
"0.65835625",
"0.65711325",
"0.65711325",
"0.6571132... | 0.7465447 | 3 |
Get an existing AccessConfiguration resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
access_configuration_id: Optional[pulumi.Input[str]] = None,
access_configuration_name: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n arn: Optional[pulumi.Input[str]] = None,\n description: Optional[pulumi.Input[str]] = None,\n license_count: Optional[pulumi.Input[int]] = None,\n ... | [
"0.5611114",
"0.54699504",
"0.5446683",
"0.5433451",
"0.5365181",
"0.53162813",
"0.5223345",
"0.52209836",
"0.52125925",
"0.51883566",
"0.51233906",
"0.5088257",
"0.50758934",
"0.5060097",
"0.5048961",
"0.5011356",
"0.5004265",
"0.5002715",
"0.49953216",
"0.49871352",
"0.4982... | 0.7243762 | 0 |
The AccessConfigurationId of the Access Configuration. | def access_configuration_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "access_configuration_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_configuration_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"access_configuration_id\")",
"def config_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"config_id\")",
"def config_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"config_id... | [
"0.84858364",
"0.7337781",
"0.709119",
"0.7068753",
"0.7039614",
"0.7039614",
"0.7039614",
"0.7039614",
"0.6994155",
"0.6778734",
"0.6778734",
"0.6778734",
"0.67664045",
"0.67664045",
"0.6760845",
"0.6697583",
"0.6677596",
"0.66682535",
"0.6607399",
"0.6607399",
"0.6606919",
... | 0.85105073 | 0 |
The AccessConfigurationName of the Access Configuration. The name of the resource. The name can be up to `32` characters long and can contain letters, digits, and hyphens (). | def access_configuration_name(self) -> pulumi.Output[str]:
return pulumi.get(self, "access_configuration_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_configuration_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"access_configuration_name\")",
"def access_configuration_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"access_configuration_name\")",
"def name(self) -> str:\n name = self._config... | [
"0.7530321",
"0.7486358",
"0.6774528",
"0.67367065",
"0.6373976",
"0.6373976",
"0.6282175",
"0.6279026",
"0.62782085",
"0.62528276",
"0.6235453",
"0.6207555",
"0.6175268",
"0.6173986",
"0.60689837",
"0.5976686",
"0.5957733",
"0.5912934",
"0.5826887",
"0.5790978",
"0.57530236"... | 0.7206645 | 2 |
The ID of the Directory. | def directory_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "directory_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def directory_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"directory_id\")",
"def directory_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"directory_id\")",
"def directory_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"directory_id... | [
"0.84758145",
"0.83013237",
"0.81507504",
"0.81507504",
"0.81507504",
"0.80275583",
"0.66744995",
"0.65655196",
"0.6565149",
"0.6513468",
"0.650948",
"0.64971465",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.6478069",
"0.64780... | 0.86193115 | 0 |
The Policy List. See `permission_policies` below. | def permission_policies(self) -> pulumi.Output[Optional[Sequence['outputs.AccessConfigurationPermissionPolicy']]]:
return pulumi.get(self, "permission_policies") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policies(self):\n return self._data.get('policies')",
"def policies(self):\n return self._policies",
"def permission_policies(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['AccessConfigurationPermissionPolicyArgs']]]]:\n return pulumi.get(self, \"permission_policies\")",
"def ... | [
"0.7772358",
"0.7656785",
"0.7465447",
"0.7465447",
"0.7368247",
"0.7306872",
"0.72549087",
"0.7231609",
"0.7137215",
"0.7131873",
"0.7088239",
"0.69799507",
"0.6941363",
"0.68438494",
"0.6827397",
"0.6746049",
"0.6687032",
"0.6623487",
"0.65835625",
"0.65711325",
"0.65711325... | 0.7444302 | 4 |
Allows intelligent sorting of plugin versions, for example when minor version of a plugin is 11, sort numerically so that 11 > 10, instead of alphabetically so that 2 > 11 | def smart_sort_helper(version):
def _safe_cast_to_int(obj):
try:
return int(obj)
except ValueError:
return obj
return [_safe_cast_to_int(part) for part in version.split('.')] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sorter(Plugin):\n return Plugin.order",
"def test_version_sorting(self):\n assert natsort(['1', '5', '10', '50']) == ['1', '5', '10', '50']",
"def sort_versions(version_list, reverse=True):\n # first chop off any starting 'v'\n version_list = [x.replace('v', '') for x in version_lis... | [
"0.73744696",
"0.69762975",
"0.6932507",
"0.65762275",
"0.6557709",
"0.65229607",
"0.6307488",
"0.6294604",
"0.6267091",
"0.60009575",
"0.587323",
"0.5861463",
"0.58593124",
"0.5835316",
"0.582079",
"0.5772454",
"0.57694155",
"0.5751435",
"0.57473147",
"0.5712717",
"0.5667721... | 0.6877737 | 3 |
Helper method for converting snake to camel case | def snake_to_camel_case(string: str):
return ''.join(string_component.title() for string_component in string.split('_')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snake_to_camel(snake_str):\n title_str = snake_str.split('_')\n return ' '.join(title_str).title()",
"def snake_to_camel_case(snake_str: str) -> str:\n\n words = snake_str.strip(\"_\").split(\"_\")\n return words[0] + \"\".join(word[:1].upper() + word[1:] for word in words[1:])",
"def snake_to_... | [
"0.8377386",
"0.83744806",
"0.82713926",
"0.82631797",
"0.8181906",
"0.8135152",
"0.81007415",
"0.8098992",
"0.8006989",
"0.797442",
"0.797442",
"0.79307777",
"0.7920477",
"0.78635794",
"0.7862867",
"0.7781951",
"0.7767076",
"0.7728743",
"0.7725505",
"0.7723914",
"0.76886004"... | 0.7717249 | 20 |
Tests that 'attendant' cannot sale a product thats not in the Inventory | def test_cannot_sale_nonexistant_product(self):
reply = self.admin_add_product()
resp = self.admin_create_user()
reply = self.attendant_login()
token = reply['token']
sale = dict(products = [
{
"prod_name":"Paris_heels",
"quantity":10... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_only_attendant_can_make_a_sale(self):\n resp = self.admin_add_product()\n reply = self.admin_login()\n token = reply['token']\n sale = dict(products = [\n {\n \"prod_name\":\"NY_denims\", \n \"quantity\":10\n }\n\t ])\n ... | [
"0.7248152",
"0.6875464",
"0.6853225",
"0.6754782",
"0.6526692",
"0.6388353",
"0.6356063",
"0.6256405",
"0.61947715",
"0.6130376",
"0.6106835",
"0.60571367",
"0.6025639",
"0.60199517",
"0.5946594",
"0.5914017",
"0.5894062",
"0.58458245",
"0.58246976",
"0.5822454",
"0.58029085... | 0.7103742 | 1 |
Tests that 'attendant' cannot sale a product thats out of stock | def test_cannot_sale_out_of_stock_product(self):
reply = self.admin_add_product()
resp = self.admin_create_user()
reply = self.attendant_login()
token = reply['token']
sale = dict(products = [
{
"prod_name":"NY_denims",
"quantity":20
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cannot_sell_more_than_stock(self):\n reply = self.admin_add_product()\n\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n sale = dict(products = [\n {\n \"prod_name\":\"NY_denims\", \n \... | [
"0.7425415",
"0.7088633",
"0.68254536",
"0.6818089",
"0.6790874",
"0.6755759",
"0.67325425",
"0.67019695",
"0.6675774",
"0.6602238",
"0.65940475",
"0.65272397",
"0.6438217",
"0.6368901",
"0.6306197",
"0.627452",
"0.6274079",
"0.6263499",
"0.6237906",
"0.62328583",
"0.6210398"... | 0.77287453 | 0 |
Tests that attendant can only view a sale they made | def test_attendant_can_only_view_own_sale(self):
reply = self.admin_add_product()
resp = self.admin_create_user()
reply = self.attendant_login()
token = reply['token']
sale = dict(products = [
{
"prod_name":"NY_denims",
"quantity":10
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_only_attendant_can_make_a_sale(self):\n resp = self.admin_add_product()\n reply = self.admin_login()\n token = reply['token']\n sale = dict(products = [\n {\n \"prod_name\":\"NY_denims\", \n \"quantity\":10\n }\n\t ])\n ... | [
"0.7438804",
"0.6890383",
"0.6851862",
"0.68414295",
"0.66387415",
"0.6299387",
"0.6226778",
"0.60637724",
"0.60226434",
"0.5988831",
"0.5970717",
"0.59398246",
"0.59026456",
"0.5873979",
"0.58102363",
"0.5799189",
"0.579879",
"0.5768878",
"0.5744502",
"0.57388747",
"0.573233... | 0.79987586 | 0 |
Tests that cannot view sales, if there no sales created yet | def test_cannot_get_empty_sales(self):
reply = self.admin_add_product()
resp = self.admin_create_user()
reply = self.attendant_login()
token = reply['token']
resp = self.client.get(
'/api/v1/sales/1',
headers={'Authorization': 'Bearer {}'.format(token)}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_attendant_cannot_view_all_sales(self):\n response = self.client.get(\n '/self.base_url/sales',\n headers=dict(Authorization=\"Bearer \" + self.attendant_token),\n content_type = 'application/json'\n )\n response_data = json.loads(response.data)\n self.asser... | [
"0.7195016",
"0.7113635",
"0.6890449",
"0.6749435",
"0.665207",
"0.6623715",
"0.6588043",
"0.65789324",
"0.6469925",
"0.6447932",
"0.64235264",
"0.64192915",
"0.64105976",
"0.640397",
"0.6343122",
"0.6301237",
"0.62086207",
"0.61448246",
"0.6143056",
"0.6122524",
"0.61056334"... | 0.7666679 | 0 |
Tests that attendant cannot view sale records they didnot make | def test_attendant_cannot_get_sale_record_they_didnot_make(self):
reply = self.admin_add_product()
resp = self.admin_create_user()
reply = self.attendant_login()
token = reply['token']
sale = dict(products = [
{
"prod_name":"NY_denims",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_attendant_can_only_view_own_sale(self):\n reply = self.admin_add_product()\n\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n sale = dict(products = [\n {\n \"prod_name\":\"NY_denims\", \n ... | [
"0.6870149",
"0.6765387",
"0.67329925",
"0.67074823",
"0.65558386",
"0.618115",
"0.6172162",
"0.60706395",
"0.6048232",
"0.6041283",
"0.6004212",
"0.59842944",
"0.597364",
"0.5951023",
"0.58633673",
"0.58607644",
"0.58261186",
"0.5825871",
"0.579768",
"0.57842404",
"0.5775081... | 0.7339037 | 0 |
Compute angular error as in [18] (Section 3.1). | def angular_error(v_est, v_true):
assert(v_est.shape == v_true.shape)
return 1 / PI * np.arccos(np.sum(v_est * v_true)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_error(self):\n \n delta = self.Y - self.T\n error = delta.dot(delta) / self.N\n error = format(error, '.5f')\n \n self.errors.append(error)",
"def diff_of_errors(self):\n self.e_of_e = self.azimuth_error - self.altitude_error\n return self.e_o... | [
"0.669958",
"0.6560642",
"0.64285576",
"0.63889897",
"0.6341878",
"0.6322742",
"0.6294606",
"0.6274744",
"0.626024",
"0.6233737",
"0.62297297",
"0.6209812",
"0.6175042",
"0.6161818",
"0.61436087",
"0.6127013",
"0.61130244",
"0.608749",
"0.60786134",
"0.6073097",
"0.60330784",... | 0.73857546 | 0 |
Get a collection of boards. | def get_boards(self, *args, **kwargs):
# Add columns to board if column_values are asked for.
args = list(args)
for arg in args:
if 'column_values' in arg:
args.append('columns.id')
args.append('columns.type')
args.append('columns.sett... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boards(self):\r\n return Boards(self)",
"def get_all_boards():\n return [board for board in GRAPH_DB.find(\"board\")]",
"def __boards(self, *board_ids: str) -> Sequence[wekanapi.models.Board]:\n try:\n api = self.__wekan_api(self.__url, credentials=dict(username=self.__username,... | [
"0.82174194",
"0.8085691",
"0.71364635",
"0.7132878",
"0.6797441",
"0.6682836",
"0.6315482",
"0.61737037",
"0.6132699",
"0.60354275",
"0.59992874",
"0.59893596",
"0.5982978",
"0.59424716",
"0.59404004",
"0.59322995",
"0.59211534",
"0.5847197",
"0.5822571",
"0.5820194",
"0.577... | 0.7324157 | 2 |
Get the connected user's account. | def get_account(self, *args):
account_data = api.get_account(
*args,
api_key=self.__creds.api_key_v2)
return en.Account(creds=self.__creds, **account_data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_user_account(self):\n ts = tools.get_cur_timestamp_ms()\n params = {\n \"timestamp\": str(ts)\n }\n success, error = await self.request(\"GET\", \"/api/v3/account\", params, auth=True)\n return success, error",
"def get_account(self):\n return se... | [
"0.78352773",
"0.77708846",
"0.77708846",
"0.76120067",
"0.7258302",
"0.7151977",
"0.7125791",
"0.7097977",
"0.699248",
"0.6977265",
"0.6965043",
"0.69506735",
"0.6940226",
"0.68822527",
"0.684672",
"0.68452924",
"0.68409795",
"0.6840239",
"0.68373096",
"0.68373096",
"0.68183... | 0.62058 | 91 |
Test autogenerated CSS urls | def test_css_url(self):
self.assertEquals(dirs.get_css_url(), "%s%s" % (settings.STATIC_URL, "css"))
with self.settings(MEDIABRUTE_USE_STATIC=False):
self.assertEquals(dirs.get_css_url(), "%s%s" % (settings.MEDIA_URL, "css"))
with self.settings(MEDIABRUTE_CSS_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def propeller_css_url():\n return css_url()",
"def test_css_rewrite(self):\r\n # file1 is in ./foo, file2 is in ./bar, the output will be\r\n # STATIC_ROOT = ./media\r\n self.create_files(\r\n {'foo/css': 'h1{background: url(\"file1\"), url(\"file2\")}'})\r\n self.mk... | [
"0.6696154",
"0.6524445",
"0.6505052",
"0.63023394",
"0.62804943",
"0.6252605",
"0.618983",
"0.61001724",
"0.6083529",
"0.60507435",
"0.60363334",
"0.6010044",
"0.6002027",
"0.5936329",
"0.5922343",
"0.5872907",
"0.58418113",
"0.5796644",
"0.57851654",
"0.57712543",
"0.575598... | 0.73966014 | 0 |
First, look for an APP_CSS setting, otherwise, default to "css" | def test_css_app_dirs(self):
try:
ext = settings.APP_CSS
except AttributeError:
ext = defaults.APP_CSS
for app, directory in dirs.APP_CSS_DIRS:
self.assertIn("/%s" % ext, directory) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_default_stylesheet(self):\n\n pass",
"def _get_default_stylesheet(self):\n\n pass",
"def app_style(self):\n return self.pt_app.style",
"def load_stylesheet(name):\n with suppress(FileNotFoundError):\n with open(STATIC_PATH / name, 'rt') as stylesheet:\n styl... | [
"0.5712834",
"0.5712834",
"0.5547178",
"0.5495658",
"0.5470872",
"0.5428618",
"0.5428425",
"0.5419717",
"0.54098415",
"0.53688014",
"0.5325875",
"0.52418923",
"0.52158815",
"0.51791346",
"0.5175356",
"0.5165978",
"0.51632684",
"0.5148056",
"0.5135586",
"0.5124514",
"0.5053612... | 0.52900356 | 11 |
Returns the name of this proxy | def proxytype():
return "junos" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getProxyName(self):\n return self.proxyName",
"def getproxysockname(self):\r\n return self.__proxysockname",
"def getproxysockname(self):\r\n return self.__proxysockname",
"def getproxysockname(self):\r\n return self.__proxysockname",
"def get_name(self):\n ra... | [
"0.8833641",
"0.7890554",
"0.7890554",
"0.7808405",
"0.76843923",
"0.7568221",
"0.7496598",
"0.74675167",
"0.7454763",
"0.74429435",
"0.74429435",
"0.74429435",
"0.7406573",
"0.7406573",
"0.7406573",
"0.7406573",
"0.7387529",
"0.7338878",
"0.7338878",
"0.73284036",
"0.7316832... | 0.0 | -1 |
Assert that actual equals expected while ignoring key order and extra keys not present in expected. Expected mappings may be a subset of actual mappings this can be useful to make tests less fragile so that they don't incorrectly fail when new keys are added. | def _recursively_assert_actual_result_matches_expected_result_keys(
expected, actual, description_for_error_reporting
):
if isinstance(expected, Mapping):
for expected_key in expected.keys():
assert expected_key in actual.keys(), description_for_error_reporting
_recursively_asser... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_keys_match(keys, expected, allow_missing=True):\n if not allow_missing:\n missing = expected - keys\n assert not missing, 'missing keys: %s' % missing\n extra = keys - expected\n assert not extra, 'extraneous keys: %s' % extra",
"def assertDictContainsSubset(self, expected, actu... | [
"0.76098824",
"0.7550261",
"0.73840624",
"0.7268214",
"0.7154876",
"0.7144536",
"0.7124943",
"0.7054011",
"0.7030045",
"0.6715128",
"0.6682607",
"0.66637194",
"0.6498881",
"0.648767",
"0.6460296",
"0.6395172",
"0.6361551",
"0.6341401",
"0.63289285",
"0.6317566",
"0.6312966",
... | 0.72953427 | 3 |
Return absolute path with leading ~ expanded | def cleanpath(path):
path = os.path.expanduser(path)
path = os.path.abspath(path)
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relativeToAbsoluteHomePath(path):\n if \"~\" in path:\n return path.replace(\"~\",expanduser(\"~\"))\n else:\n return path",
"def absolute_path(path):\n path = re.sub('~', os.environ['HOME'], str(path))\n if path[0] != '/':\n path = str(sh.pwd()).strip() + '/' + path\n ret... | [
"0.76966226",
"0.70892733",
"0.6866002",
"0.6820123",
"0.66921955",
"0.6604635",
"0.6601054",
"0.65875393",
"0.6555216",
"0.65448976",
"0.6465076",
"0.6437381",
"0.64303565",
"0.63877475",
"0.6386826",
"0.6376812",
"0.63711154",
"0.6361652",
"0.63268846",
"0.629416",
"0.62493... | 0.59627086 | 48 |
Quote an argument for the shell | def shellquote(arg):
if re.match('^[-_.:/=a-zA-Z0-9]*$', arg):
return arg
else:
return "'%s'" % arg.replace("'", r"'\''") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _quote(self, arg):\n arg = arg.replace('\\\\', '\\\\\\\\')\n arg = arg.replace('\"', '\\\\\"')\n return '\"%s\"' % arg",
"def sh_quote_safe(arg):\n return (\"'\" + str(arg).replace(\"'\", r\"'\\''\") + \"'\")",
"def _escapeArg(arg):\n #XXX There is a *lot* more that we should esc... | [
"0.77673554",
"0.76793677",
"0.76440316",
"0.7537206",
"0.7503303",
"0.73312765",
"0.6972545",
"0.6837365",
"0.68200713",
"0.6779207",
"0.6711798",
"0.66048396",
"0.6591173",
"0.65714985",
"0.6532162",
"0.65079796",
"0.6494683",
"0.6461761",
"0.64036244",
"0.6383636",
"0.6380... | 0.8021843 | 0 |
Builds the operators calling BEMPP routines, according to the rules for building a block operator from the accompanying paper. Each operator is also accompanies with a key (usually just default) in case there is more than one operator in a cell. This allows them to be differentiated later on. Returns these operators as... | def _compile_ops(self, parameters, space_group):
ke = self.wave_numbers[0]
kw = self.wave_numbers[1]
ki = self.wave_numbers[2:]
mu = 1
cavities = self.cavities
ops = {}
def add(i, j, op, key='default'):
if (i, j) not in ops:
ops[(i, j)]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cexpr_operands(self):\n\n if self.op >= cot_comma and self.op <= cot_asgumod or \\\n self.op >= cot_lor and self.op <= cot_fdiv or \\\n self.op == cot_idx:\n return {'x': self.x, 'y': self.y}\n\n elif self.op == cot_tern:\n return {'x': self.x, 'y': self.y, 'z': self.z}\n\n ... | [
"0.5893202",
"0.5735879",
"0.5481861",
"0.53870815",
"0.53514844",
"0.5330947",
"0.5285688",
"0.5281344",
"0.5264745",
"0.51900685",
"0.5186409",
"0.5170233",
"0.5168371",
"0.5160872",
"0.51132566",
"0.50995725",
"0.50847685",
"0.50779724",
"0.5052127",
"0.5023777",
"0.502245... | 0.59664774 | 0 |
Creates a Block Operator from the boundary operators of the system, but it only contains the block diagonal components. | def get_diagonal(self, parameters=None, space_group='default'):
operators = self.get_ops(parameters, space_group)
D = assembly.BlockedOperator(self.N * 2, self.N * 2)
for (row, col), ops_dict in operators.items():
if row == col:
ops = list(ops_dict.values())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_block_op(mfie, efie, k, mu):\n A = assembly.BlockedOperator(2, 2) # empty operator object\n A[0,0] = mfie\n A[0,1] = mu/k * efie\n A[1,0] = -k/mu * efie\n A[1,1] = mfie\n return A",
"def get_operator_to_make_TOD(self):\n if len(self) == 1:\n return self.get_operator()\n... | [
"0.63582325",
"0.61143786",
"0.60582596",
"0.5910971",
"0.5883823",
"0.5854873",
"0.5760708",
"0.5665299",
"0.56312656",
"0.55951005",
"0.5582301",
"0.55224216",
"0.54668546",
"0.5331099",
"0.53071433",
"0.52994144",
"0.5283294",
"0.52762717",
"0.52339995",
"0.5209892",
"0.51... | 0.5751354 | 7 |
Returns the operator in the space required of the preconditioner. For the Default System this is exactly the same as the normal operator. | def get_op_as_preconditioner(self, preconditioner_parameters):
return self.operator | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operator(self) -> Optional[str]:\n return pulumi.get(self, \"operator\")",
"def operator(self) -> Optional[str]:\n return pulumi.get(self, \"operator\")",
"def operator(self) -> Optional[str]:\n return pulumi.get(self, \"operator\")",
"def operator(self) -> Optional[str]:\n re... | [
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"0.7059218",
"... | 0.7006569 | 24 |
Wrapper to the blockoperator constructor for this system. | def multitrace_operator(self, k, mu, base, target=None, parameters=None, space_group='default'):
if target is None:
target = base
return get_simple_block_op(base, target, k, mu, parameters, space_group) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_block_op(mfie, efie, k, mu):\n A = assembly.BlockedOperator(2, 2) # empty operator object\n A[0,0] = mfie\n A[0,1] = mu/k * efie\n A[1,0] = -k/mu * efie\n A[1,1] = mfie\n return A",
"def construct_block_expr(terms):\n strength = None\n if terms[0] == '!':\n strength = STRONG... | [
"0.6583789",
"0.64062196",
"0.63646835",
"0.63283795",
"0.6318583",
"0.6276932",
"0.6276723",
"0.6237882",
"0.6216725",
"0.6196809",
"0.61807066",
"0.61598444",
"0.6150931",
"0.6139331",
"0.613865",
"0.6109183",
"0.6097381",
"0.6092743",
"0.6046292",
"0.60405976",
"0.6030784"... | 0.0 | -1 |
Gets the diagonal of the operator in weak form. | def get_diagonal(self, parameters, space_group='preconditioner'):
return super(RWGDominantSystem, self).get_diagonal(parameters, space_group).weak_form() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diagonal(self):\n return self.rep.diagonal()",
"def OwnsDiag(self):\n return _hypre.HypreParMatrix_OwnsDiag(self)",
"def get_diagonal(matrix):\n\tdegree_vector = tf.reduce_sum(matrix, 1)\n\tdiagonal = tf.diag(degree_vector, name = 'diagonal')\n\treturn diagonal",
"def GetDiag(self, *args):\... | [
"0.7419739",
"0.7196712",
"0.7038815",
"0.68381894",
"0.6638823",
"0.65074354",
"0.65070236",
"0.6460818",
"0.6440337",
"0.64398414",
"0.64100885",
"0.63857585",
"0.6349503",
"0.63473094",
"0.6269284",
"0.6225267",
"0.61805403",
"0.6162216",
"0.6158724",
"0.6146115",
"0.61372... | 0.72286934 | 1 |
Assigns the 4 elements of a to the 2x2 block of A specified by the indexes i and j. | def assign_in_place_subblock(A, a, i, j):
bi = 2*i
bj = 2*j
A[bi, bj] = a[0, 0]
A[bi, bj+1] = a[0, 1]
A[bi+1, bj] = a[1, 0]
A[bi+1, bj+1] = a[1, 1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap_elements(i: int, j: int, arr: List[int]) -> None:\n arr[i], arr[j] = arr[j], arr[i]",
"def fixA(self,i,j,value):\n if self.coeffPattern[0] == None:\n m,n=self.m,self.n\n self.coeffPattern[0] = [[None]*m for i in range(m)]\n self.coeffPattern[0][i][j]=value\n ... | [
"0.5988163",
"0.5719772",
"0.5670304",
"0.56104136",
"0.56104136",
"0.56097054",
"0.55601346",
"0.5555983",
"0.55024356",
"0.55021626",
"0.5471639",
"0.54603964",
"0.54194343",
"0.5392315",
"0.5317444",
"0.53152883",
"0.5305633",
"0.5291478",
"0.52861106",
"0.52719754",
"0.52... | 0.7977656 | 0 |
Shows a figure, illustrating the placement of the cavities. | def show_domains(self):
show_domains(self.system.cavity_gri) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show():\n\tplt.show()",
"def show():\n setup()\n plt.show()",
"def show():\n plt.show()",
"def show():\n plt.show()",
"def show():\n plt.show()",
"def show_figure(self):\n pylab.show()",
"def show(self):\n plt.show()",
"def display(self, show=True):\n fig = plt... | [
"0.66921693",
"0.6588608",
"0.6574683",
"0.6574683",
"0.6574683",
"0.6488894",
"0.6481582",
"0.64786506",
"0.6208725",
"0.62080896",
"0.61660254",
"0.61351764",
"0.6129275",
"0.61184",
"0.6108316",
"0.6047591",
"0.6044118",
"0.6038729",
"0.6038435",
"0.5998007",
"0.5991908",
... | 0.0 | -1 |
The header level of this section. For example, ``1`` corresponds to an "H1" section. | def header_level(self) -> int:
return len(self.headers) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header_level(line):\n i = 0\n title = line + \"e\"\n while title[0] == \"#\":\n i += 1\n title = title[1:]\n return i",
"def get_hierarchy_section_header(self, path):\n section_index = len(path) - 1\n section = path[section_index][0]\n html = f\"Section {section... | [
"0.6788258",
"0.66003263",
"0.6525944",
"0.6445729",
"0.6410488",
"0.64026666",
"0.64026666",
"0.6395351",
"0.6395351",
"0.6395351",
"0.6395351",
"0.63431275",
"0.6257601",
"0.6240129",
"0.6240129",
"0.6228456",
"0.62196475",
"0.6211855",
"0.6211855",
"0.6155049",
"0.6126309"... | 0.7229805 | 0 |
Merge two deep dicts nondestructively Uses a stack to avoid maximum recursion depth exceptions | def deep_merge(a, b):
assert quacks_like_dict(a), quacks_like_dict(b)
dst = a.copy()
stack = [(dst, b)]
while stack:
current_dst, current_src = stack.pop()
for key in current_src:
if key not in current_dst:
current_dst[key] = current_src[key]
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_recursive_merge(self):\n dict_1 = {\n 'key': {\n 'deep_key_1': 'original_value_1',\n 'deep_key_2': 'original_value_2'\n }\n }\n dict_2 = {\n 'key': {\n 'deep_key_2': 'new_value_2',\n 'deep_key... | [
"0.77183336",
"0.7539621",
"0.7457451",
"0.7411913",
"0.7409686",
"0.7375019",
"0.7363719",
"0.7346429",
"0.73255676",
"0.73252344",
"0.72771823",
"0.7269041",
"0.72622204",
"0.7188361",
"0.71485114",
"0.70634043",
"0.7060802",
"0.7043696",
"0.7031465",
"0.7011736",
"0.699662... | 0.7919061 | 0 |
Returns the sign of a number (0 if number == 0) | def _sign(self, number):
return cmp(number,0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign(num: float):\n return 1 if num >= 0 else -1",
"def sign(x):\n if x >= 0:\n return 1\n else:\n return -1",
"def sign(x):\n if x >= 0:\n return 1\n return -1",
"def sign(n):\n return (n > 0) - (n < 0)",
"def sign(n: float) -> int:\n return 1 if n > 0 else -1... | [
"0.8846393",
"0.8253473",
"0.82252234",
"0.81191397",
"0.8048113",
"0.78813577",
"0.7646705",
"0.75298065",
"0.75174963",
"0.75102514",
"0.7491994",
"0.74387145",
"0.72314626",
"0.7026278",
"0.6858945",
"0.6849571",
"0.68468064",
"0.6693261",
"0.65666646",
"0.65666646",
"0.64... | 0.8269828 | 1 |
Returns the sigmoid likelihood p(y=label|features; weights) | def _sigmoidLikelihood(self, x, label):
logit = sigmoid(np.dot(x, self.weights))
if label == 0:
return (1-logit)
elif label == 1:
return logit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid_cross_entropy(y, label):\r\n losses = - np.log(y + g_epsilon) * label - np.log(1.0 - y + g_epsilon) * (1.0 - label)\r\n return losses",
"def sigmoid(x):\n\treturn 1 / (1 + m.exp(-x))",
"def sigmoid(X,W,b):\n preActivation = np.dot(X, W) + b\n return (1.0)/(1.0 + np.exp(-preActivation))"... | [
"0.729855",
"0.69825923",
"0.69369835",
"0.69181186",
"0.69181186",
"0.69135976",
"0.69070375",
"0.69070375",
"0.68618244",
"0.6859569",
"0.6858837",
"0.6856167",
"0.6856167",
"0.6856167",
"0.6856167",
"0.6856167",
"0.6856167",
"0.6845131",
"0.68388313",
"0.6837727",
"0.68328... | 0.8198142 | 0 |
Returns a JSON string of the numpy array. | def json_serialize_numpy_array(array):
return json.dumps(json_ready_numpy_array(array)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def np2str(a: np.ndarray) -> str:\n return json.dumps(a.tolist())",
"def _serialize_array(self, array):\n buffer = io.BytesIO()\n np.save(buffer, array)\n return buffer.getvalue()",
"def to_json(self) -> str:\n data_dict = self._to_list_dict()\n return json.dumps(data_dict... | [
"0.799594",
"0.7397114",
"0.7389336",
"0.6879777",
"0.6696065",
"0.6653273",
"0.6613344",
"0.65226185",
"0.6520773",
"0.6504252",
"0.6500195",
"0.6465842",
"0.6430254",
"0.638252",
"0.6379951",
"0.63638395",
"0.6360075",
"0.6359046",
"0.6354674",
"0.63410234",
"0.63245213",
... | 0.86472636 | 1 |
Turns a JSONified numpy array back into a regular numpy array. | def load_numpy_json(array_json):
return json.loads(array_json, object_hook=json_numpy_obj_hook)[constants.NUMPY_JSON_KEY] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_serialize_numpy_array(array):\n return json.dumps(json_ready_numpy_array(array))",
"def json_serialize_numpy_array(array):\n return json.dumps(json_ready_numpy_array(array))",
"def _json_numpy_obj_hook(dct):\n if isinstance(dct, dict) and '__ndarray__' in dct:\n data = base64.b64decode... | [
"0.76810354",
"0.76810354",
"0.728426",
"0.72562265",
"0.72562265",
"0.72562265",
"0.7108978",
"0.7102766",
"0.6881204",
"0.68316835",
"0.68022573",
"0.67565626",
"0.663613",
"0.66238236",
"0.66061014",
"0.6459423",
"0.644984",
"0.6412981",
"0.640372",
"0.636493",
"0.63274676... | 0.7598423 | 3 |
Convert a string from camel case (``StringsThatLookLikeThis``) to snake case (``strings_that_look_like_this``). This is useful for matching names of | def CamelCase_to_snake_case(text):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', text)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_snake_case(camel_case_string):\n s1 = re.sub('(.)([A-Z][a-z]+)', r'\\1_\\2', camel_case_string)\n s2 = re.sub('([a-z0-9])([A-Z])', r'\\1_\\2', s1).lower()\n return s2.replace('__', '_')",
"def convert_to_snake_case(string: str) -> str:\n\n s1 = re.sub('(.)([A-Z][a-z]+)', r'... | [
"0.82583845",
"0.8144382",
"0.81090605",
"0.808966",
"0.8071609",
"0.8065401",
"0.80421495",
"0.8038782",
"0.8017019",
"0.79698503",
"0.7966784",
"0.79185176",
"0.7909839",
"0.7893667",
"0.7890556",
"0.7866909",
"0.78602934",
"0.7840908",
"0.77912164",
"0.77760285",
"0.773191... | 0.74763054 | 31 |
Saves dictionary to `path`. | def save(self, path='dict.pic'):
with open(path, 'wb') as f:
pickle.dump(self.__dictionary, f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, path):\n with open(path, 'wb') as f:\n pkl.dump(self, f)",
"def save(self, path: Path, data: dict):\n self.info(data)\n os.makedirs(path.parent, exist_ok=True)\n\n # Force conversion of object (classes) to string\n # preventing json dumps error\n ... | [
"0.7953801",
"0.768384",
"0.7581396",
"0.7581248",
"0.75155604",
"0.7381979",
"0.7381979",
"0.7381979",
"0.73681736",
"0.7358943",
"0.73051476",
"0.7278362",
"0.7254895",
"0.7218447",
"0.7218447",
"0.7218447",
"0.7216866",
"0.72022194",
"0.7089567",
"0.7060961",
"0.6965888",
... | 0.8284187 | 0 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in xrange(0, len(l), n):
yield l[i:i+n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.0 | -1 |
Returns true if the final state in `x_tape` is close to the upright equilibrium. | def is_success(x_tape):
return final_state_cost(x_tape) < 1e-3 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_safe_to_back_up(self):\n # Only back up if we're far enough away from home for it\n # to be safe. Don't want to back up into the nest!\n home_loc = self.swarmie.get_home_odom_location()\n current_loc = self.swarmie.get_odom_location().get_pose()\n dist = math.sqrt((home_l... | [
"0.62607926",
"0.62046903",
"0.604087",
"0.6008538",
"0.60054195",
"0.5994796",
"0.59558123",
"0.58947736",
"0.5797723",
"0.57893115",
"0.578242",
"0.57633156",
"0.5754844",
"0.57171524",
"0.56903493",
"0.56660575",
"0.5647655",
"0.5628699",
"0.5611879",
"0.56039697",
"0.5602... | 0.62455726 | 1 |
Returns the empirical distribution function of a sample | def ecdf(a):
xs = np.sort(np.array(a))
ys = np.arange(1, len(xs) + 1) / float(len(xs))
return xs, ys | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f(x):\n res = np.real(np.exp(-1j*x[1])*sum(y_obs[k+sample_size]*np.exp(1j*k*x[0]) \\\n for k in range(-sample_size,sample_size+1))) \n res = -res/np.sqrt(2*sample_size+1) \n return res",
"def pdf(x):\n return - np.exp(sel... | [
"0.6741654",
"0.66404825",
"0.66323036",
"0.6623222",
"0.6461853",
"0.64487815",
"0.63817114",
"0.6344847",
"0.63335454",
"0.62851405",
"0.62846255",
"0.62623703",
"0.62606734",
"0.62429696",
"0.62148833",
"0.6214822",
"0.62119687",
"0.6165578",
"0.6149329",
"0.61365724",
"0.... | 0.0 | -1 |
Convert dictionaries to dataframes. | def createDataFrames(self):
self._atmDF = pd.DataFrame.from_dict(self._atmDict, orient='index')
self._clientDF = pd.DataFrame.from_dict(self._clientDict, orient='index')
self._clientDF['longAccount'] = self._clientDF.client.map(str) +\
'_' + self._clientDF.account.map(str)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dict_to_DataFrame(data):\n return pd.DataFrame.from_dict(data)",
"def create_dataframe(dictionary_to_convert, cols):\n\n dataframe_converted = pd.DataFrame.from_dict(dictionary_to_convert, orient='index', columns = cols)\n dataframe_converted = dataframe_converted.reset_index()\n dataframe_converted = ... | [
"0.7666539",
"0.7529991",
"0.7466553",
"0.7443088",
"0.7405587",
"0.7254434",
"0.7221952",
"0.71460557",
"0.714324",
"0.7060138",
"0.7048105",
"0.6971769",
"0.6824629",
"0.6794479",
"0.6704474",
"0.65304077",
"0.6463527",
"0.6449462",
"0.64297295",
"0.6354926",
"0.6323553",
... | 0.6145735 | 28 |
Initialize this hash table with the given initial size. | def __init__(self, init_size=8):
# Create a new list (used as fixed-size array) of empty linked lists
self.buckets = [LinkedList() for _ in range(init_size)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.size = 1000\n self.hash_table = [None] * self.size",
"def __init__(self, init_size=8):\n self.size = 0\n self.buckets = [LinkedList() for i in range(init_size)]",
"def __init__(self):\n self.size = 997\n self.hash_set = [None] * self.size",
... | [
"0.74037224",
"0.7025798",
"0.69059783",
"0.68911815",
"0.68485546",
"0.6660078",
"0.65367204",
"0.650115",
"0.650115",
"0.6499438",
"0.646832",
"0.64589006",
"0.6457175",
"0.6432366",
"0.6424357",
"0.6424357",
"0.6424357",
"0.64176285",
"0.63766193",
"0.632741",
"0.6280732",... | 0.6865993 | 4 |
Return a formatted string representation of this hash table. | def __str__(self):
items = ['{!r}: {!r}'.format(key, val) for key, val in self.items()]
return '{' + ', '.join(items) + '}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n sorted_table = InferenceUtils.get_n_best(self._table, max(len(self._table), 1))\n\n result = []\n for key, value in sorted_table.items():\n result.append('P(%s):=%f\\n' % (str(key), value))\n\n return ''.join(result)[:-1] if len(result) > 0 else ''",
"d... | [
"0.77814215",
"0.75057065",
"0.7503586",
"0.74861544",
"0.7359343",
"0.7330707",
"0.7242706",
"0.7209188",
"0.7207309",
"0.71858925",
"0.7178411",
"0.7178411",
"0.7178411",
"0.7178411",
"0.7178411",
"0.7178411",
"0.7178411",
"0.7178411",
"0.7178411",
"0.7178411",
"0.7178411",... | 0.0 | -1 |
Return a string representation of this hash table. | def __repr__(self):
return 'HashTable({!r})'.format(self.items()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\r\n tmp = \"\"\r\n for (name, value) in self.__table__.items():\r\n tmp += str(name) + \"\\n\" + str(value) + \"\\n\"\r\n return(tmp)",
"def __repr__(self):\n # return 'HashTable({})'.format(self.length())\n return 'HashTable({})'.format(str(self.b... | [
"0.7585399",
"0.7550028",
"0.75045323",
"0.7424399",
"0.7365568",
"0.73169637",
"0.71784306",
"0.71053326",
"0.7104455",
"0.7056047",
"0.7031742",
"0.7026082",
"0.7025677",
"0.7016113",
"0.700521",
"0.69940746",
"0.69775313",
"0.69716567",
"0.69681686",
"0.6953906",
"0.693674... | 0.79319084 | 0 |
Return a list of all values in this hash table. | def values(self):
# Loop through all buckets
# Collect all values in each bucket
values_list = []
for linked_list in self.buckets:
for key_value_tuple in linked_list.items():
values_list.append(key_value_tuple[1])
return values_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def values(self):\n return [self[k] for k in self.keys()]",
"def values(self):\n x = []\n for k in list(self.keys()):\n x.append(self[k])\n return x",
"def values(self):\n values = []\n for key in self.keys():\n values.append(self[key])\n r... | [
"0.8135252",
"0.8112594",
"0.8085648",
"0.80784297",
"0.80784297",
"0.80784297",
"0.7986978",
"0.7927104",
"0.7842868",
"0.7802295",
"0.7759052",
"0.77515906",
"0.77483326",
"0.7736613",
"0.7705094",
"0.7681643",
"0.76603836",
"0.764805",
"0.7502727",
"0.7489405",
"0.7457833"... | 0.753664 | 18 |
Return a list of all items (keyvalue pairs) in this hash table. | def items(self):
# Collect all pairs of key-value entries in each bucket
all_items = []
for bucket in self.buckets:
all_items.extend(bucket.items())
return all_items | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def items(self):\n x = []\n for k in list(self.keys()):\n x.append((k, self[k]))\n return x",
"def items(self):\n return list(zip(self.keys(), self.values()))",
"def items(self):\n return list(zip(self.keys(), self.values()))",
"def items(self):\n return [... | [
"0.7969277",
"0.78762543",
"0.78762543",
"0.7839336",
"0.78322667",
"0.78322667",
"0.7790361",
"0.7790361",
"0.7766233",
"0.7694919",
"0.7624244",
"0.7619145",
"0.75920576",
"0.75920576",
"0.75920576",
"0.75565696",
"0.7553456",
"0.7504629",
"0.75040257",
"0.7496775",
"0.7476... | 0.7871284 | 3 |
calculate area of polygon | def calculate_areas(polygon):
project = ft.partial(pj.transform,
pj.Proj(init='epsg:4326'),
pj.Proj('+proj=eck4 +lat_0=' + str(polygon.centroid.y) + ' +lon_0=' + str(polygon.centroid.x)))
field_projected = transform(project, polygon)
# convert from square me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def area_polygon(polygon):\n o = centroid_points(polygon)\n u = subtract_vectors(polygon[-1], o)\n v = subtract_vectors(polygon[0], o)\n a = 0.5 * length_vector(cross_vectors(u, v))\n for i in range(0, len(polygon) - 1):\n u = v\n v = subtract_vectors(polygon[i + 1], o)\n a += 0... | [
"0.838024",
"0.8332946",
"0.83119696",
"0.8278338",
"0.8132351",
"0.7852854",
"0.7851663",
"0.78332025",
"0.78132635",
"0.7791441",
"0.7746361",
"0.77407634",
"0.7718457",
"0.7704755",
"0.7689313",
"0.7669272",
"0.76399606",
"0.75400877",
"0.74397665",
"0.73758876",
"0.737582... | 0.78732973 | 5 |
Return the interval to the next unavailability check. | def get_unavailability_interval(ping: int) -> float:
return timedelta(minutes=ping, seconds=PING_INTERVAL_MARGIN).total_seconds() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_interval_of_checking(self):\n return int(self.config['interval_of_checking'])",
"def getcheckinterval(): # real signature unknown; restored from __doc__\n pass",
"def check_interval(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"check_interval\")",
"def check_interval(self)... | [
"0.7202929",
"0.71089166",
"0.68150556",
"0.66477007",
"0.66477007",
"0.65991896",
"0.64958453",
"0.6446387",
"0.6409852",
"0.6235484",
"0.618871",
"0.6148308",
"0.61434907",
"0.61312264",
"0.60922515",
"0.60757303",
"0.607292",
"0.60189104",
"0.59787947",
"0.59632504",
"0.59... | 0.70462584 | 2 |
Create the attributes dict from a SIAEvent. | def get_attr_from_sia_event(event: SIAEvent) -> dict[str, Any]:
timestamp = event.timestamp if event.timestamp else utcnow()
return {
ATTR_ZONE: event.ri,
ATTR_CODE: event.code,
ATTR_MESSAGE: event.message,
ATTR_ID: event.id,
ATTR_TIMESTAMP: timestamp.isoformat()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_event_data_from_sia_event(event: SIAEvent) -> dict[str, Any]:\n return {\n \"message_type\": event.message_type.value\n if isinstance(event.message_type, MessageTypes)\n else event.message_type,\n \"receiver\": event.receiver,\n \"line\": event.line,\n \"account... | [
"0.69846684",
"0.6902529",
"0.6494896",
"0.64512265",
"0.6432297",
"0.6313962",
"0.6125665",
"0.61175746",
"0.5924921",
"0.5920397",
"0.58662486",
"0.5862455",
"0.5812077",
"0.58101314",
"0.5782121",
"0.57471323",
"0.573764",
"0.5722068",
"0.57152414",
"0.5710958",
"0.5690977... | 0.8124081 | 0 |
Initialize the ImageTranslator class. Use default test options but could be via commandline. Load and setup the model | def __init__(self, use_wasserstein=True):
opt = WassersteinCycleGANTestOptions if use_wasserstein else CycleGANTestOptions
opt.checkpoints_dir = os.path.join(
pathlib.Path(__file__).parent.absolute(), opt.checkpoints_dir
)
tf_properties = {
"load_size": opt.loa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n cwd = os.path.join(os.path.dirname(__file__), config.vosk_model_dir)\n self.model = Model(cwd)\n logger.info(f'Loaded speech recognition model from {cwd}')",
"def __init__(self, model_path: str = None):\n\n self.img_size = 128\n self.tranform = transforms.... | [
"0.70468384",
"0.68506277",
"0.68373543",
"0.6638725",
"0.6598074",
"0.65940535",
"0.6571226",
"0.653568",
"0.6527748",
"0.64348656",
"0.63723695",
"0.6302592",
"0.6269127",
"0.62652797",
"0.6223265",
"0.62133527",
"0.6193632",
"0.6188107",
"0.6173518",
"0.6154471",
"0.612056... | 0.0 | -1 |
Constructs a line in the robot's coordinate system to represent the wall. The line connects the estimated front and back points. This line is published to the /Marker rostopic | def vizualize_wall(self):
#Points are converted from polar to cartesian here
point1 = Point()
#(-math.pi/4) represents the 45 degree rotation of the front point
#from the front of the robot
point1.x = math.cos((-math.pi/4))*self.front_point
point1.y = math.sin((-math.pi/4))*self.front_point
point2 = Poin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_layer(self):\n screen_origin = self.ids.mapview.get_window_xy_from(lat1, lon1, self.ids.mapview.zoom)\n screen_destination = self.ids.mapview.get_window_xy_from(lat2, lon2, self.ids.mapview.zoom)\n point_list = [screen_origin[0], screen_origin[1], screen_destination[0], screen_destina... | [
"0.6869763",
"0.64922535",
"0.6442461",
"0.60172665",
"0.59739035",
"0.5932236",
"0.59138554",
"0.59116477",
"0.58740014",
"0.58395725",
"0.5784475",
"0.5784208",
"0.5781963",
"0.57784486",
"0.57567674",
"0.57567674",
"0.57533145",
"0.57519233",
"0.57227993",
"0.57163435",
"0... | 0.67118496 | 1 |
Remove m from untriedMoves and add a new child node for this move. Return the added child node | def addChild(self, m, s):
name = ''
if str(m[0]).find("playItem") != -1:
if len(m) > 2:
if m[1] == 'p':
name = s.playerHand[m[2]].Name
elif str(m[0]).find("playSupporter") != -1:
if len(m) > 2:
if m[1] == 'p':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_child(self, m, s):\n n = Node(move=m, parent=self, state=s)\n self.untried_moves.remove(m)\n self.child_nodes.append(n)\n return n",
"def AddChild(self, m, s):\n n = Node(move=m, parent=self, state=s)\n self.untriedMoves.remove(m)\n self.childNodes.append(... | [
"0.8013249",
"0.795096",
"0.795096",
"0.74227214",
"0.7070273",
"0.70642006",
"0.6815417",
"0.6320943",
"0.6197757",
"0.5786182",
"0.5729174",
"0.56762654",
"0.5616453",
"0.55719686",
"0.5411102",
"0.53162205",
"0.52886",
"0.5279109",
"0.5279109",
"0.5279109",
"0.5279109",
... | 0.70220196 | 6 |
format given timestamp, if no timestamp is given, return a call time string | def str_timestamp(time_value=None):
if time_value is None:
time_value = datetime.datetime.now()
return time_value.strftime("%Y-%m-%d_%H-%M-%S") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(timestamp=None, format=r\"%Y%m%d-%H%M%S\"):\n time_str = time.strftime(format, time.localtime(timestamp if timestamp else time.time()))\n return time_str",
"def timestamp(fmt, timestruct=None):\n return _time.strftime(fmt, timestruct or _time.gmtime())",
"def _format_ts(cls, timestamp)... | [
"0.76393425",
"0.7556399",
"0.74862665",
"0.7289302",
"0.71907604",
"0.71815753",
"0.7058068",
"0.69569105",
"0.69532424",
"0.6924186",
"0.68380827",
"0.68307835",
"0.6799542",
"0.677661",
"0.67738104",
"0.67638355",
"0.67638355",
"0.6761985",
"0.67580783",
"0.6744854",
"0.67... | 0.68645257 | 10 |
Create a JWT token representing an access claim to any Django object, discovered by id and ContentType. | def create_object_access_jwt(obj, ttl=None):
if not ttl:
ttl = settings.JWT_AUTH['JWT_EXPIRATION_DELTA']
now = datetime.utcnow()
expiry = now + ttl
content_type = ContentType.objects.get_for_model(obj).model
token = jwt.encode({'id': obj.id,
'content_type': content_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_jwt(request, user, expires_in):\n oauth_application = _get_login_oauth_client()\n access_token = create_dot_access_token(\n # Note: Scopes for JWT cookies do not require additional permissions\n request, user, oauth_application, expires_in=expires_in, scopes=['user_id', 'email', 'pr... | [
"0.673689",
"0.6488388",
"0.6478574",
"0.6410467",
"0.6391189",
"0.6283191",
"0.62827283",
"0.6232166",
"0.61912197",
"0.6102086",
"0.6083244",
"0.606837",
"0.60568225",
"0.5983197",
"0.5964632",
"0.5957673",
"0.5955177",
"0.58575815",
"0.58516276",
"0.58512706",
"0.58381796"... | 0.76091444 | 0 |
This give admins the ability to unban a user. The bot must be a Channel Operator for this command to work. | def unban (phenny, input):
if not input.admin: return
text = input.group().split()
argc = len(text)
if argc < 2: return
opt = text[1]
banmask = opt
channel = input.sender
if opt.startswith('#'):
if argc < 3: return
channel = opt
banmask = text[2]
banmask = configureHostMask(banmask)
if b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def unban(self, ctx, name: str):\n try:\n bans = await self.bot.get_bans(ctx.message.server)\n user = discord.utils.get(bans, name=name)\n if user is not None:\n await self.bot.unban(ctx.message.server, user)\n except discord.Forbidden:\n ... | [
"0.79887706",
"0.75836766",
"0.7536529",
"0.7529073",
"0.7448535",
"0.73961204",
"0.7323483",
"0.7179153",
"0.71239245",
"0.70542496",
"0.7051835",
"0.70358706",
"0.6873853",
"0.68292934",
"0.68262166",
"0.678508",
"0.67546624",
"0.67374307",
"0.6670195",
"0.66440004",
"0.663... | 0.7174649 | 8 |
This gives admins the ability to change the topic. | def topic(phenny, input):
if not input.admin:
return
text = input.group().split()
topic = ' '.join(text[1:])
if topic == '':
return
channel = input.sender
phenny.write(['PRIVMSG', 'ChanServ'], 'TOPIC %s %s' % (input.sender, topic))
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topic(self, msg):\n self.make_topic(msg, new_topic=msg.args[0])\n self.bot.log.info(\"Topic changed by \" + msg.user)",
"def topic(self, topic):\n self.connection.topic(str(self), topic)",
"def edit_topic():\n topic = db.topic(request.args(0))\n form = SQLFORM(db.topic, record=to... | [
"0.7685089",
"0.7295342",
"0.7213926",
"0.7022198",
"0.70087504",
"0.6961861",
"0.68993086",
"0.687016",
"0.6716526",
"0.6615837",
"0.6596852",
"0.6591815",
"0.64925885",
"0.6425334",
"0.63696593",
"0.6319757",
"0.6251143",
"0.6229887",
"0.6223174",
"0.6183888",
"0.6155036",
... | 0.6542836 | 12 |
Turn the light off. | def turn_off(self, **kwargs):
self._client.set_brightness(self._id, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self):\n GPIO.output(self.gpio, False) # turn off light",
"def lightning_turnoff(self):\n self.turnOff()",
"def set_light_off(self):\n self._light = \"OFF\"",
"def turn_off(self, **kwargs):\n self._light.set_color(0, 0, 0, 0)",
"def set_light_off(self):\r\n ... | [
"0.9158525",
"0.88893706",
"0.88740003",
"0.8852116",
"0.8842971",
"0.87965184",
"0.864986",
"0.85981315",
"0.85843927",
"0.85641575",
"0.8526551",
"0.8403609",
"0.83990663",
"0.8292084",
"0.82411224",
"0.81950665",
"0.8189084",
"0.8162265",
"0.8066985",
"0.8010293",
"0.80100... | 0.8271316 | 14 |
Return the state attributes. | def device_state_attributes(self):
data = {}
if self._is_dimmable and self._brightness_pct:
data = {ATTR_BRIGHTNESS_PCT: self._brightness_pct}
data.update({#'alarm': self._alarm,
'operation_mode': self.operation_mode,
'rssi': self._rssi,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_attributes(self):\... | [
"0.8953404",
"0.8953404",
"0.85239846",
"0.8366765",
"0.8366765",
"0.8363429",
"0.83362615",
"0.8334551",
"0.8310377",
"0.8292682",
"0.8289349",
"0.8289349",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.828... | 0.7612127 | 58 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Connections):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Retrieves the value from the WindowedValue. The Python SDK passes elements as WindowedValues, which may not match the coder for that particular PCollection. | def remove_windowed_value(self, el: Union[WindowedValue, Any]) -> Any:
while isinstance(el, WindowedValue):
el = el.value
return el | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_value(self):\n \n return self._value",
"def getValue(self):\n \n return self._value",
"def get_value(self):\n return self._value",
"def get_value(self):\n return self._value",
"def get_value(self):\n return self._value",
"def get_value(sel... | [
"0.5928007",
"0.5877326",
"0.5872794",
"0.5872794",
"0.5867571",
"0.5867571",
"0.5867571",
"0.5794031",
"0.5769353",
"0.5764415",
"0.5751704",
"0.5751704",
"0.5751704",
"0.57337356",
"0.57337356",
"0.57228184",
"0.57213354",
"0.5714421",
"0.5714421",
"0.5714421",
"0.5714421",... | 0.6499704 | 0 |
Returns the OutputSampler for the given output. | def sampler_for_output(self, transform_id: str,
output_index: int) -> Optional[OutputSampler]:
try:
with self._samplers_lock:
outputs = self._samplers_by_output[transform_id]
return outputs[output_index]
except KeyError:
_LOGGER.warning(
f'Out-of-bo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sampler(self):\n return self.sampler",
"def getSampler(self, *args):\n return _osgAnimation.Channel_getSampler(self, *args)",
"def get_dataset_sampler(self):\n return None",
"def output(self):\n try:\n return self.outputs[-1]\n except IndexError:\n ... | [
"0.6972826",
"0.634131",
"0.59927243",
"0.59617037",
"0.58354443",
"0.57917243",
"0.557195",
"0.5525515",
"0.5446687",
"0.54157025",
"0.54050374",
"0.540233",
"0.5353887",
"0.53054255",
"0.53054255",
"0.53054255",
"0.53054255",
"0.53054255",
"0.53054255",
"0.52717966",
"0.524... | 0.7226501 | 0 |
Creates the OutputSamplers for the given PTransform. This initializes the samplers only once per PCollection Id. Note that an OutputSampler is created per PCollection and an ElementSampler is created per OutputSampler. This means that multiple ProcessBundles can and will share the same ElementSampler for a given PColle... | def initialize_samplers(
self,
transform_id: str,
descriptor: beam_fn_api_pb2.ProcessBundleDescriptor,
coder_factory) -> List[OutputSampler]:
transform_proto = descriptor.transforms[transform_id]
with self._samplers_lock:
if transform_id in self._samplers_by_output:
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_samplers(self, samplers):\n self._derived_properties[\"samplers\"] = samplers\n self.nsamplers = len(self.samplers)",
"def create_sampler(self, inputs, targets, input_reader=None, target_reader=None, \n input_transform=None, target_transform=None, co_transform=None,\n input_re... | [
"0.5575458",
"0.55535567",
"0.54327726",
"0.5358295",
"0.5299804",
"0.52995074",
"0.5276758",
"0.5269046",
"0.5239582",
"0.5227583",
"0.5167421",
"0.5124479",
"0.50449735",
"0.497701",
"0.4879007",
"0.48534706",
"0.48281923",
"0.48171192",
"0.47992283",
"0.4791926",
"0.477551... | 0.7684812 | 0 |
make a horizontal line at the given height and return. | def beam(t, n, height):
hollow(t, n*height)
fdbk(t, n)
hollow(t, -n*height) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hline(self, x, y, width, color):\n self.rect(x, y, width, 1, color, fill=True)",
"def hline(self, x, y, length, color):\n self.fill_rect(x, y, length, 1, color)",
"def horizontal_line(t,n, h):\n lt(t)\n pu(t)\n fd(t,h)\n pd(t)\n lt(t)\n fd(t,n)\n rt(t)",
"def _createlin... | [
"0.7865199",
"0.73905563",
"0.7142556",
"0.6694721",
"0.6600058",
"0.6524005",
"0.6522874",
"0.640309",
"0.6377431",
"0.6368514",
"0.6286061",
"0.6259979",
"0.62285596",
"0.61624163",
"0.61415577",
"0.6021781",
"0.6020568",
"0.6005226",
"0.59550995",
"0.5948636",
"0.5909656",... | 0.0 | -1 |
Set up user models in datastore for use in testing. | def setUp(self) -> None:
super().setUp()
user_models.CompletedActivitiesModel(
id=self.USER_1_ID,
exploration_ids=self.EXPLORATION_IDS_1,
collection_ids=self.COLLECTION_IDS_1,
story_ids=self.STORY_IDS_1,
learnt_topic_ids=self.TOPIC_IDS_1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n User.users = {}\n self.app = User('demo@email.com', 'admin', 'admin')\n # Set some default user data\n self.user_data = {\n 1: {\n 'email': 'demo@email.com',\n 'username': 'admin',\n 'password': 'admin' \n ... | [
"0.7431468",
"0.72336006",
"0.7151766",
"0.7148876",
"0.7084903",
"0.70493686",
"0.7039855",
"0.7011619",
"0.69870436",
"0.6986593",
"0.6972773",
"0.69417924",
"0.69251126",
"0.68905944",
"0.68863076",
"0.6883448",
"0.68774414",
"0.6876042",
"0.6874921",
"0.6874583",
"0.68645... | 0.0 | -1 |
Set up user models in datastore for use in testing. | def setUp(self) -> None:
super().setUp()
user_models.IncompleteActivitiesModel(
id=self.USER_1_ID,
exploration_ids=self.EXPLORATION_IDS_1,
collection_ids=self.COLLECTION_IDS_1,
story_ids=self.STORY_IDS_1,
partially_learnt_topic_ids=self.TOPIC_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n User.users = {}\n self.app = User('demo@email.com', 'admin', 'admin')\n # Set some default user data\n self.user_data = {\n 1: {\n 'email': 'demo@email.com',\n 'username': 'admin',\n 'password': 'admin' \n ... | [
"0.7431468",
"0.72336006",
"0.7151766",
"0.7148876",
"0.7084903",
"0.70493686",
"0.7039855",
"0.7011619",
"0.69870436",
"0.6986593",
"0.6972773",
"0.69417924",
"0.69251126",
"0.68905944",
"0.68863076",
"0.6883448",
"0.68774414",
"0.6876042",
"0.6874921",
"0.6874583",
"0.68645... | 0.0 | -1 |
Set up user models in datastore for use in testing. | def setUp(self) -> None:
super().setUp()
user_models.LearnerGoalsModel(
id=self.USER_1_ID,
topic_ids_to_learn=self.TOPIC_IDS,
topic_ids_to_master=[]
).put()
user_models.LearnerGoalsModel(
id=self.USER_2_ID,
topic_ids_to_learn=s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n User.users = {}\n self.app = User('demo@email.com', 'admin', 'admin')\n # Set some default user data\n self.user_data = {\n 1: {\n 'email': 'demo@email.com',\n 'username': 'admin',\n 'password': 'admin' \n ... | [
"0.7431993",
"0.72342557",
"0.71516097",
"0.71499354",
"0.70848846",
"0.70497024",
"0.70391804",
"0.7012227",
"0.6987798",
"0.69866395",
"0.69731295",
"0.6942106",
"0.6925338",
"0.689116",
"0.6885926",
"0.68834615",
"0.68768346",
"0.6876335",
"0.68754286",
"0.68749166",
"0.68... | 0.0 | -1 |
Set up user models in datastore for use in testing. | def setUp(self) -> None:
super().setUp()
user_models.LearnerPlaylistModel(
id=self.USER_ID_1,
exploration_ids=self.EXPLORATION_IDS_1,
collection_ids=self.COLLECTION_IDS_1
).put()
user_models.LearnerPlaylistModel(
id=self.USER_ID_2,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n User.users = {}\n self.app = User('demo@email.com', 'admin', 'admin')\n # Set some default user data\n self.user_data = {\n 1: {\n 'email': 'demo@email.com',\n 'username': 'admin',\n 'password': 'admin' \n ... | [
"0.7431468",
"0.72336006",
"0.7151766",
"0.7148876",
"0.7084903",
"0.70493686",
"0.7039855",
"0.7011619",
"0.69870436",
"0.6986593",
"0.6972773",
"0.69417924",
"0.69251126",
"0.68905944",
"0.68863076",
"0.6883448",
"0.68774414",
"0.6876042",
"0.6874921",
"0.6874583",
"0.68645... | 0.6496369 | 73 |
Set up user models in datastore for use in testing. | def setUp(self) -> None:
super().setUp()
# User A has no created explorations, one edited exploration.
# User B has two created and edited explorations.
self.signup(self.USER_A_EMAIL, self.USER_A_USERNAME)
self.user_a_id = self.get_user_id_from_email(self.USER_A_EMAIL)
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n User.users = {}\n self.app = User('demo@email.com', 'admin', 'admin')\n # Set some default user data\n self.user_data = {\n 1: {\n 'email': 'demo@email.com',\n 'username': 'admin',\n 'password': 'admin' \n ... | [
"0.7431468",
"0.72336006",
"0.7151766",
"0.7148876",
"0.7084903",
"0.70493686",
"0.7039855",
"0.7011619",
"0.69870436",
"0.6986593",
"0.6972773",
"0.69417924",
"0.69251126",
"0.68905944",
"0.68863076",
"0.6883448",
"0.68774414",
"0.6876042",
"0.6874921",
"0.6874583",
"0.68645... | 0.0 | -1 |
Set up user models in datastore for use in testing. | def setUp(self) -> None:
super().setUp()
user_models.UserEmailPreferencesModel(id=self.USER_ID_1).put()
user_models.UserEmailPreferencesModel(
id=self.USER_ID_2,
deleted=True
).put()
user_models.UserEmailPreferencesModel(
id=self.USER_ID_3,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n User.users = {}\n self.app = User('demo@email.com', 'admin', 'admin')\n # Set some default user data\n self.user_data = {\n 1: {\n 'email': 'demo@email.com',\n 'username': 'admin',\n 'password': 'admin' \n ... | [
"0.7431468",
"0.72336006",
"0.7151766",
"0.7148876",
"0.7084903",
"0.70493686",
"0.7039855",
"0.7011619",
"0.69870436",
"0.6986593",
"0.6972773",
"0.69251126",
"0.68905944",
"0.68863076",
"0.6883448",
"0.68774414",
"0.6876042",
"0.6874921",
"0.6874583",
"0.68645203",
"0.68444... | 0.69417924 | 11 |
Set up user models in datastore for use in testing. | def setUp(self) -> None:
super().setUp()
user_models.UserSettingsModel(
id=self.USER_ID_1,
email='some@email.com'
).put()
user_models.UserSettingsModel(
id=self.USER_ID_2,
email='some_other@email.com'
).put()
user_models.Us... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n User.users = {}\n self.app = User('demo@email.com', 'admin', 'admin')\n # Set some default user data\n self.user_data = {\n 1: {\n 'email': 'demo@email.com',\n 'username': 'admin',\n 'password': 'admin' \n ... | [
"0.7431468",
"0.72336006",
"0.7151766",
"0.7148876",
"0.7084903",
"0.70493686",
"0.7039855",
"0.7011619",
"0.69870436",
"0.6986593",
"0.6972773",
"0.69417924",
"0.69251126",
"0.68905944",
"0.68863076",
"0.6883448",
"0.68774414",
"0.6876042",
"0.6874921",
"0.6874583",
"0.68645... | 0.66472024 | 49 |
Set up user models in datastore for use in testing. | def setUp(self) -> None:
super().setUp()
user_models.UserSettingsModel(
id=self.USER_ID_1,
email='some@email.com'
).put()
user_models.UserSettingsModel(
id=self.USER_ID_2,
email='some_other@email.com'
).put()
user_models.U... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n User.users = {}\n self.app = User('demo@email.com', 'admin', 'admin')\n # Set some default user data\n self.user_data = {\n 1: {\n 'email': 'demo@email.com',\n 'username': 'admin',\n 'password': 'admin' \n ... | [
"0.7431468",
"0.72336006",
"0.7151766",
"0.7148876",
"0.7084903",
"0.70493686",
"0.7039855",
"0.7011619",
"0.69870436",
"0.6986593",
"0.6972773",
"0.69417924",
"0.69251126",
"0.68905944",
"0.68863076",
"0.6883448",
"0.68774414",
"0.6876042",
"0.6874921",
"0.6874583",
"0.68645... | 0.6750266 | 38 |
Set up user models in datastore for use in testing. | def setUp(self) -> None:
super().setUp()
user_models.UserRecentChangesBatchModel(id=self.USER_ID_1).put()
user_models.UserRecentChangesBatchModel(
id=self.USER_ID_2,
deleted=True
).put() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n User.users = {}\n self.app = User('demo@email.com', 'admin', 'admin')\n # Set some default user data\n self.user_data = {\n 1: {\n 'email': 'demo@email.com',\n 'username': 'admin',\n 'password': 'admin' \n ... | [
"0.7431219",
"0.72328997",
"0.71506834",
"0.7148078",
"0.70840037",
"0.7049671",
"0.7038679",
"0.70115983",
"0.69866675",
"0.6986276",
"0.6972337",
"0.694187",
"0.6925343",
"0.68907785",
"0.68858373",
"0.6881855",
"0.6876031",
"0.68754953",
"0.6875467",
"0.68742645",
"0.68656... | 0.0 | -1 |
Set up user models in datastore for use in testing. | def setUp(self) -> None:
super().setUp()
user_models.UserStatsModel(
id=self.USER_ID_1,
impact_score=self.USER_1_IMPACT_SCORE,
total_plays=self.USER_1_TOTAL_PLAYS,
average_ratings=self.USER_1_AVERAGE_RATINGS,
num_ratings=self.USER_1_NUM_RATING... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n User.users = {}\n self.app = User('demo@email.com', 'admin', 'admin')\n # Set some default user data\n self.user_data = {\n 1: {\n 'email': 'demo@email.com',\n 'username': 'admin',\n 'password': 'admin' \n ... | [
"0.74295896",
"0.7232164",
"0.7149358",
"0.71476305",
"0.7083519",
"0.7049069",
"0.7038129",
"0.7011422",
"0.6986197",
"0.6985603",
"0.6972157",
"0.69410336",
"0.69240844",
"0.688938",
"0.6885475",
"0.6881373",
"0.687593",
"0.6874517",
"0.687417",
"0.687369",
"0.68645084",
... | 0.0 | -1 |
Test if export_data works when user is in data store. | def test_export_data_on_existing_user(self) -> None:
user_data = user_models.UserStatsModel.export_data(self.USER_ID_1)
test_data = {
'impact_score': self.USER_1_IMPACT_SCORE,
'total_plays': self.USER_1_TOTAL_PLAYS,
'average_ratings': self.USER_1_AVERAGE_RATINGS,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_export_data_on_existent_user(self) -> None:\n user_data = user_models.LearnerPlaylistModel.export_data(self.USER_ID_1)\n expected_data = {\n 'exploration_ids': self.EXPLORATION_IDS_1,\n 'collection_ids': self.COLLECTION_IDS_1\n }\n self.assertEqual(expecte... | [
"0.6838902",
"0.65668905",
"0.655504",
"0.6553854",
"0.65019727",
"0.6487359",
"0.63924736",
"0.6354943",
"0.6343474",
"0.6339543",
"0.63308877",
"0.6321284",
"0.63162756",
"0.62883615",
"0.62426114",
"0.6226335",
"0.6204801",
"0.6124794",
"0.6095454",
"0.6032656",
"0.6020608... | 0.6661535 | 1 |
Set up user models in datastore for use in testing. | def setUp(self) -> None:
super().setUp()
user_models.UserQueryModel(
id=self.QUERY_1_ID,
submitter_id=self.USER_ID_1
).put()
user_models.UserQueryModel(
id=self.QUERY_2_ID,
submitter_id=self.USER_ID_2,
deleted=True
).pu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n User.users = {}\n self.app = User('demo@email.com', 'admin', 'admin')\n # Set some default user data\n self.user_data = {\n 1: {\n 'email': 'demo@email.com',\n 'username': 'admin',\n 'password': 'admin' \n ... | [
"0.7431562",
"0.7233536",
"0.7152321",
"0.71499455",
"0.70850384",
"0.70485115",
"0.7039308",
"0.7010934",
"0.6987078",
"0.69863683",
"0.6971666",
"0.6941314",
"0.69256526",
"0.68903524",
"0.68852496",
"0.6883963",
"0.6876665",
"0.68765515",
"0.6875273",
"0.6874537",
"0.68642... | 0.0 | -1 |
Set up user models in datastore for use in testing. | def setUp(self) -> None:
super().setUp()
user_models.UserBulkEmailsModel(id=self.USER_ID_1).put()
user_models.UserBulkEmailsModel(id=self.USER_ID_2, deleted=True).put() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n User.users = {}\n self.app = User('demo@email.com', 'admin', 'admin')\n # Set some default user data\n self.user_data = {\n 1: {\n 'email': 'demo@email.com',\n 'username': 'admin',\n 'password': 'admin' \n ... | [
"0.7431468",
"0.72336006",
"0.7151766",
"0.7148876",
"0.7084903",
"0.70493686",
"0.7039855",
"0.7011619",
"0.69870436",
"0.6986593",
"0.6972773",
"0.69417924",
"0.69251126",
"0.68905944",
"0.68863076",
"0.6883448",
"0.68774414",
"0.6876042",
"0.6874921",
"0.6874583",
"0.68645... | 0.0 | -1 |
Set up user models in datastore for use in testing. | def setUp(self) -> None:
super().setUp()
user_models.UserContributionProficiencyModel(
id='%s.%s' % (self.SCORE_CATEGORY_1, self.USER_1_ID),
user_id=self.USER_1_ID,
score_category=self.SCORE_CATEGORY_1,
score=1.5,
onboarding_email_sent=False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n User.users = {}\n self.app = User('demo@email.com', 'admin', 'admin')\n # Set some default user data\n self.user_data = {\n 1: {\n 'email': 'demo@email.com',\n 'username': 'admin',\n 'password': 'admin' \n ... | [
"0.7431219",
"0.72328997",
"0.71506834",
"0.7148078",
"0.70840037",
"0.7049671",
"0.7038679",
"0.70115983",
"0.69866675",
"0.6986276",
"0.6972337",
"0.694187",
"0.6925343",
"0.68907785",
"0.68858373",
"0.6881855",
"0.6876031",
"0.68754953",
"0.6875467",
"0.68742645",
"0.68656... | 0.0 | -1 |
Set up user models in datastore for use in testing. | def setUp(self) -> None:
super().setUp()
user_models.PendingDeletionRequestModel(
id=self.USER_1_ID,
email=self.USER_1_EMAIL,
).put() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n User.users = {}\n self.app = User('demo@email.com', 'admin', 'admin')\n # Set some default user data\n self.user_data = {\n 1: {\n 'email': 'demo@email.com',\n 'username': 'admin',\n 'password': 'admin' \n ... | [
"0.74295896",
"0.7232164",
"0.7149358",
"0.71476305",
"0.7083519",
"0.7049069",
"0.7038129",
"0.7011422",
"0.6986197",
"0.6985603",
"0.6972157",
"0.69410336",
"0.69240844",
"0.688938",
"0.6885475",
"0.6881373",
"0.687593",
"0.6874517",
"0.687417",
"0.687369",
"0.68645084",
... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.