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 |
|---|---|---|---|---|---|---|
Converts a string in scientific notation format to a float in regular format | def sci_notation_to_float(n):
if 'e' in n:
exponent = float(n[n.find('e') + 1:])
number = float(n[:n.find('-') - 1])
number *= 10**exponent
return number
return n | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_float(self, s: str) -> float:\n return int(s[:-1]) / 1e9 if s.endswith('n') else float(s[:-1])",
"def read_endf_float(string):\n if string.strip() == \"\":\n return 0.0\n if \".\" in string:\n strsplit = string.split('.')\n return float(strsplit[0]+\".\"+strsplit[1].repl... | [
"0.7992028",
"0.7631141",
"0.7486856",
"0.74595267",
"0.7453234",
"0.74226296",
"0.7370093",
"0.7352414",
"0.7284855",
"0.7278769",
"0.72506315",
"0.7243346",
"0.7219503",
"0.7211098",
"0.7196211",
"0.719186",
"0.7183101",
"0.7158389",
"0.71015143",
"0.70598835",
"0.6937231",... | 0.7549512 | 2 |
Add a command prefix to a guild. | async def process_prefix_add_remove(
guild: disnake.Guild,
prefix: str,
ctx: commands.Context = None,
inter: AppCmdInter = None,
allowed_mentions=None,
add=False,
):
await create_guild_model(guild)
guild = await Guild.get(guild.id)
if add:
await guild.add_prefix(prefix)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def prefix(self, ctx, prefix):\n if prefix.strip() == \"\":\n raise exceptions.Warning(\"Prefix cannot be empty.\")\n\n if prefix.startswith(\" \"):\n raise exceptions.Warning(\"Prefix cannot start with a space.\")\n\n if len(prefix) > 32:\n raise excepti... | [
"0.7765609",
"0.7438157",
"0.7337754",
"0.72621065",
"0.71957946",
"0.7084846",
"0.7023182",
"0.7022211",
"0.6995119",
"0.6882482",
"0.68795705",
"0.68495554",
"0.68444985",
"0.6843278",
"0.683003",
"0.6727373",
"0.6712273",
"0.6662263",
"0.66496396",
"0.64985317",
"0.6413639... | 0.7127585 | 5 |
Add a reaction role. | async def process_add_reaction_role(
user_id, description, ctx=None, inter=None, allowed_mentions=None
):
user = await User.get(user_id)
response_deferred = await defer_inter(inter, ephemeral=True)
view = disnake.ui.View(timeout=None)
view.add_item(RoleDropdown(description))
await send_message(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def rolemenu_add_role(self,\n interaction: discord.Interaction,\n name: str,\n role: discord.Role,\n emoji: str = None,\n description: str = None):\n ... | [
"0.74878365",
"0.7185206",
"0.7157245",
"0.71171796",
"0.70440525",
"0.7006333",
"0.6889938",
"0.68790966",
"0.6827275",
"0.6738522",
"0.67022955",
"0.6666086",
"0.6641454",
"0.662785",
"0.6625806",
"0.66136146",
"0.6613041",
"0.66006094",
"0.65936184",
"0.6589437",
"0.656451... | 0.6762945 | 9 |
Read image using its path. Default value is grayscale, and image is read by YCbCr format as the paper said. | def imread(path, is_grayscale=True):
if is_grayscale:
return scipy.misc.imread(path, flatten=True, mode='YCbCr').astype(np.float)
else:
return scipy.misc.imread(path, mode='YCbCr').astype(np.float) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imread(path, is_grayscale=True):\n if is_grayscale:\n #flatten=True 以灰度图的形式读取 \n return scipy.misc.imread(path, flatten=True, mode='YCbCr').astype(np.float)\n else:\n return scipy.misc.imread(path, mode='YCbCr').astype(np.float)",
"def imread(path, is_grayscale=True):\n if is_grayscale:\n ... | [
"0.778447",
"0.77261835",
"0.7638995",
"0.75208247",
"0.74676746",
"0.74573797",
"0.7367039",
"0.722754",
"0.721408",
"0.72122663",
"0.71996546",
"0.7183188",
"0.70761466",
"0.7057287",
"0.7026387",
"0.70155853",
"0.6943071",
"0.6942862",
"0.69331473",
"0.689974",
"0.6891293"... | 0.7768587 | 1 |
Dynamically generate options for resource group form field based on the user's selection for Environment. This method requires the user to set the resource_group parameter as dependent on environment. | def generate_options_for_resource_group(control_value=None, **kwargs):
if control_value is None:
return []
env = Environment.objects.get(id=control_value)
if CB_VERSION_93_PLUS:
# Get the Resource Groups as defined on the Environment. The Resource Group is a
# CustomField that is o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_options_for_cloudbolt_environment(group=None, **kwargs):\n envs = Environment.objects.filter(\n resource_handler__resource_technology__name='Google Cloud Platform') \\\n .select_related('resource_handler')\n if group:\n group_env_ids = [env.id for env in group.get_available_... | [
"0.6358487",
"0.5937777",
"0.55043066",
"0.54691523",
"0.54691523",
"0.54691523",
"0.54691523",
"0.54691523",
"0.54691523",
"0.54691523",
"0.54691523",
"0.54691523",
"0.54691523",
"0.54691523",
"0.54691523",
"0.54691523",
"0.54691523",
"0.54691523",
"0.54691523",
"0.54691523",
... | 0.6859024 | 0 |
Deserialize datetime object into string form for JSON processing. | def dump_datetime(value):
if value is None:
return None
return [value.strftime("%Y-%m-%d"), value.strftime("%H:%M:%S")] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize_datetime(self, obj):\r\n if isinstance(obj, datetime.datetime):\r\n return obj.isoformat()\r\n raise TypeError(\"Type not serializable\")",
"def json_datetime_serializer(obj):\n\n if isinstance(obj, datetime):\n serial = obj.isoformat()\n return serial\n ... | [
"0.69946605",
"0.69832784",
"0.6899136",
"0.6865027",
"0.6813981",
"0.6750276",
"0.6649766",
"0.6633779",
"0.65959406",
"0.6547565",
"0.65440494",
"0.6539357",
"0.6486496",
"0.6480947",
"0.64407444",
"0.63945824",
"0.6365423",
"0.63568634",
"0.6337701",
"0.6311433",
"0.629324... | 0.5694063 | 78 |
Check if the number is a valid VAT number. | def is_valid(number):
try:
return bool(validate(number))
except ValidationError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_vat_ve(self, vat, context = None):\n\n if context is None:\n context={}\n if re.search(r'^[VJEGP][0-9]{9}$', vat):\n return True\n if re.search(r'^([VE][0-9]{1,8}|[D][0-9]{9})$', vat):\n return True\n return False",
"def validate(number):\n ... | [
"0.7379781",
"0.6621894",
"0.6477692",
"0.63953686",
"0.63700813",
"0.62227714",
"0.61494124",
"0.6116051",
"0.6068463",
"0.6062278",
"0.59390646",
"0.59321815",
"0.59058887",
"0.5884056",
"0.5859397",
"0.5822421",
"0.57948935",
"0.57851166",
"0.57792175",
"0.57780504",
"0.57... | 0.5905346 | 18 |
Render website's home page. | def home():
return render_template('home.html', form=None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n return render_template('homepage.html')",
"def home():\n\n return render_template('home_page.html')",
"def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")",
"... | [
"0.8724249",
"0.85791856",
"0.850329",
"0.84860355",
"0.84612614",
"0.84362435",
"0.8429879",
"0.8419578",
"0.8396612",
"0.8396612",
"0.8374868",
"0.8356488",
"0.8350785",
"0.8340763",
"0.8340763",
"0.83374727",
"0.83374727",
"0.83374727",
"0.83374727",
"0.83374727",
"0.83374... | 0.766131 | 100 |
Render the website's about page. | def about():
return render_template('about.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def about():\n return render_template(\n 'about.html',\n title='About',\n ... | [
"0.87910306",
"0.8698105",
"0.86404276",
"0.86124563",
"0.8490408",
"0.84784615",
"0.8467779",
"0.84352976",
"0.84289914",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242... | 0.8325753 | 34 |
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes. | def add_header(response):
response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'
response.headers['Cache-Control'] = 'public, max-age=0'
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response",
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m... | [
"0.82239413",
"0.8223081",
"0.8223081",
"0.8223081",
"0.8223081",
"0.8196386",
"0.8113264",
"0.8087198",
"0.7973406",
"0.7866322",
"0.76620805",
"0.7237988",
"0.71606845",
"0.7153763",
"0.7153763",
"0.7151734",
"0.7151734",
"0.714256",
"0.7137825",
"0.71290123",
"0.71290123",... | 0.8163827 | 24 |
Connect a datacenter to this endpoint. An endpoint can only be connected to a single datacenter. | def connect_datacenter(self, dc):
self.compute.dc = dc
for ep in self.openstack_endpoints.values():
ep.manage = self.manage
logging.info \
("Connected DC(%s) to API endpoint %s(%s:%d)" % (dc.label, self.__class__.__name__, self.ip, self.port)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_dc_network(self, dc_network):\n self.manage.net = dc_network\n self.compute.nets[self.manage.floating_network.id] = self.manage.floating_network\n logging.info(\"Connected DCNetwork to API endpoint %s(%s:%d)\" % (\n self.__class__.__name__, self.ip, self.port))",
"def ... | [
"0.68350774",
"0.59132737",
"0.5732963",
"0.57322764",
"0.57078254",
"0.5706639",
"0.5680314",
"0.5666111",
"0.5593733",
"0.5567479",
"0.5567184",
"0.55639863",
"0.55574876",
"0.55011344",
"0.5458151",
"0.54542726",
"0.54163355",
"0.540785",
"0.5394772",
"0.53901094",
"0.5384... | 0.7805443 | 0 |
Creates a random string that contains numbers and letters. The size is a random number between 10 and 30 | def randomSub(seed: float):
crc = str(string.ascii_letters + string.digits)
random.seed(seed)
n = random.randint(10,30)
return "".join(random.sample(crc, n)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringGen(size, chars=string.ascii_uppercase + string.digits):\n\treturn ''.join(random.choice(chars) for _ in range(size))",
"def random_string_alphanumeric(size):\n\t# requirements = random, string\n\treturn ''.join(random.choice(string.ascii_letters + string.digits) for x in range(size))",
"def _random_... | [
"0.85948324",
"0.8484244",
"0.82903683",
"0.82625693",
"0.8126156",
"0.80316836",
"0.79779726",
"0.7961973",
"0.7956126",
"0.79325324",
"0.7896901",
"0.786111",
"0.7832646",
"0.77807236",
"0.7778246",
"0.7766766",
"0.77627265",
"0.7751188",
"0.7735884",
"0.77282315",
"0.77124... | 0.0 | -1 |
return True if |val| is a JSON primitive, False otherwise | def _is_primitive(val):
prims = [int, float, str, bool]
for prim in prims:
if isinstance(val, prim):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isJson(data):\r\n try:\r\n json.loads(data)\r\n return True\r\n except ValueError:\r\n return False",
"def is_json(self):\n # return ( True if ( \n # self.json_field_type and self.json_field_type.upper() != 'VIRTUAL' ) \n # else False )\n return True if ... | [
"0.7477848",
"0.7366013",
"0.71818185",
"0.7161975",
"0.71473515",
"0.6835757",
"0.6831207",
"0.6791649",
"0.6643828",
"0.6610344",
"0.659999",
"0.6569066",
"0.6519001",
"0.64818954",
"0.6448922",
"0.6446701",
"0.6365501",
"0.63478434",
"0.6347386",
"0.6273909",
"0.62731177",... | 0.6882537 | 5 |
return True if |wildcard| string matches |s| string. A valid wildcard | def _is_wildcard_match(s, wildcard):
wildcard = wildcard.strip()
glob_pat = re.compile(r'\*(:(?P<type>\w+))?$')
m = glob_pat.match(wildcard)
if m:
if m.group('type'):
type_to_meth = globals()['__builtins__']
type_to_meth = {k:v for k,v in type_to_meth.items()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __reWildcard(self, regexp, string):\n regexp = re.sub(\"\\*+\", \"*\", regexp)\n match = True\n if regexp.count(\"*\") == 0:\n if regexp == string:\n return True\n else:\n return False\n blocks = regexp.split(\"*\")\n start ... | [
"0.715021",
"0.67261773",
"0.6713398",
"0.6707344",
"0.6571823",
"0.6482795",
"0.6318864",
"0.6266622",
"0.623342",
"0.6226286",
"0.6225357",
"0.61540484",
"0.61485624",
"0.6146087",
"0.61196405",
"0.59138566",
"0.59130514",
"0.5899484",
"0.58328605",
"0.5817263",
"0.5811018"... | 0.76775545 | 0 |
return True if dict |d| is in one of the dicts in |dicts|, False otherwise. |dicts| is obviously just a list of dictionaries. Legal elements in the dictionaries are the typical primitives (int, float, bool, str), lists, and dicts. | def _is_dict_in_one_of_dicts(d, dicts):
for vd in dicts:
if Settings._is_in_dict(d, vd):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_in_dict(d, valid_d):\n\n for k, v in d.items():\n if k not in valid_d:\n return False\n else:\n if Settings._is_primitive(v):\n if not Settings._is_in_prim(v, valid_d[k]):\n return False\n elif Settings._is_list(v):\n ... | [
"0.64084905",
"0.60281664",
"0.5984001",
"0.5980985",
"0.59457546",
"0.5872692",
"0.57876366",
"0.57641065",
"0.5747921",
"0.57217395",
"0.5614708",
"0.5484641",
"0.54599655",
"0.53625906",
"0.5358206",
"0.5351264",
"0.533104",
"0.53166837",
"0.5306886",
"0.5287404",
"0.52817... | 0.8241347 | 0 |
return True if all elements in list |l| is in one of the lists contained in |valid_l|, False otherwise. Legal elements in the lists are the typical primitives (int, float, bool, str), lists, and dicts. | def _is_in_list(l, valid_l):
for elem in l:
if Settings._is_primitive(elem):
if not Settings._is_in_prim(elem, valid_l):
return False
elif Settings._is_list(elem):
valid_lists = [l for l in valid_l if isinstance(l, list)]
if not Settings._is_su... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _list_validity_check(l, valid_l):\n\n if not Settings._is_in_list(l, valid_l):\n raise InvalidSettingError()",
"def allIn(listA: Union[int, List[int]], listB: Union[int, List[int]]) -> bool:\n if isinstance(listA, int):\n listA = [listA]\n if isinstance(listB, int):\n ... | [
"0.7000915",
"0.6149883",
"0.61312413",
"0.6082698",
"0.59904224",
"0.5970148",
"0.5934717",
"0.5885762",
"0.5882798",
"0.5851436",
"0.5785513",
"0.5773051",
"0.57016706",
"0.5689442",
"0.56725544",
"0.5652237",
"0.5626126",
"0.56227636",
"0.5618623",
"0.56080157",
"0.5601694... | 0.7949676 | 0 |
return True if dict |d| has all keys in dict |valid_d|. False otherwise. | def _has_all_keys_from(d, valid_d):
for k, v in valid_d.items():
if k not in d:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_in_dict(d, valid_d):\n\n for k, v in d.items():\n if k not in valid_d:\n return False\n else:\n if Settings._is_primitive(v):\n if not Settings._is_in_prim(v, valid_d[k]):\n return False\n elif Settings._is_list(v):\n ... | [
"0.7827297",
"0.680757",
"0.66193026",
"0.6566625",
"0.6357033",
"0.62774754",
"0.6261642",
"0.6259637",
"0.6217635",
"0.62153924",
"0.6203975",
"0.6185486",
"0.6110884",
"0.6004363",
"0.5946864",
"0.58883274",
"0.57816666",
"0.5731112",
"0.5690174",
"0.56880385",
"0.56877536... | 0.87729234 | 0 |
Test the `reverse` kwarg. | def test_reverse(self):
iterables = [xrange(4, 0, -1), xrange(7, 0, -1), xrange(3, 6, -1)]
eq_(sorted(reduce(list.__add__, [list(it) for it in iterables]),
reverse=True),
list(collate(*iterables, reverse=True))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _can_reverse(self):\n return not bool(self._reverse_callback())",
"def set_reverse(rev):\n global is_reverse\n is_reverse = rev",
"def testSortingReverse(self):\n if self.sortingReverse.lower() in [\"1\", \"yes\", \"true\", \"on\"]:\n self.assertTrue(\n self.co... | [
"0.73392296",
"0.68163896",
"0.6537939",
"0.6523438",
"0.63412285",
"0.6307833",
"0.6299878",
"0.6275159",
"0.61790586",
"0.613202",
"0.6116976",
"0.60824007",
"0.6046022",
"0.5983002",
"0.5976699",
"0.5970638",
"0.594553",
"0.59288",
"0.59192276",
"0.58404404",
"0.574365",
... | 0.0 | -1 |
Used to generate a batch with images when training/testing/validating our Keras model. | def generate_images(self, image_idx, is_training, batch_size=16):
# arrays to store our batched data
images, ages, races, genders = [], [], [], []
while True:
for idx in image_idx:
person = self.df.iloc[idx]
age = person['age'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_batch(model, batch_size, test_data=False):\n if model == 'cnn':\n as_image = True\n else:\n as_image = False\n\n image = _read_images(test_data=test_data, as_image=as_image)\n label = _read_labels(test_data=test_data)\n\n images_batch, labels_batch = tf.train.batch([image, label],\n ... | [
"0.75774246",
"0.74922997",
"0.74519485",
"0.73910856",
"0.7325273",
"0.71627367",
"0.71103084",
"0.7077549",
"0.7029831",
"0.70131713",
"0.70102745",
"0.6954216",
"0.6947352",
"0.6941008",
"0.69298536",
"0.69187367",
"0.69123995",
"0.6905738",
"0.6889662",
"0.6868008",
"0.68... | 0.72434276 | 5 |
Creates an object from the specified configuration dictionary. | def create_object(config, base_module=None, args=None, kwargs=None):
try:
cls, args, kwargs = __clsfn_args_kwargs(config, 'class', base_module,
args, kwargs)
return cls(*args, **kwargs)
except Exception as e:
raise Exception(
'C... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_config(config: dict):\n pass",
"def from_config(cls, config):\n return cls(**config)",
"def from_config(cls, config):\n return cls(**config)",
"def from_config(cls, config: Dict):\n res = cls()\n res.validate_config(config)\n for k, v in config.items():\n ... | [
"0.7576743",
"0.7491255",
"0.7491255",
"0.74420494",
"0.7376429",
"0.7341104",
"0.73334914",
"0.7317437",
"0.7207449",
"0.71187824",
"0.7053521",
"0.7053521",
"0.7012224",
"0.70090747",
"0.70010585",
"0.6958523",
"0.6938643",
"0.6925775",
"0.6907422",
"0.6886036",
"0.68261015... | 0.0 | -1 |
Creates a zeroparameter function from the specified configuration dictionary. | def create_function(config, base_module=None, args=None, kwargs=None):
try:
fun, args, kwargs = __clsfn_args_kwargs(config, 'function', base_module,
args, kwargs)
return partial(fun, *args, **kwargs)
except Exception as e:
raise Exception(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_config(func):\n\t\n\tdef decorator(filename):\n\t\twith open(filename, 'r') as file_in:\n\t\t\tconfig = json.load(file_in)\n\n\t\t#'**' takes a dict and extracts its contents and passes them as parameters to a function.\n\t\t#returns the intial function with new arguments????\n\t\treturn func(**config)\n\... | [
"0.5940637",
"0.5463128",
"0.5432406",
"0.52039313",
"0.51201224",
"0.50930494",
"0.50807434",
"0.5038867",
"0.50207514",
"0.4972701",
"0.49464762",
"0.4940924",
"0.49071813",
"0.49036568",
"0.4877582",
"0.48682946",
"0.48465356",
"0.48246568",
"0.47884876",
"0.478831",
"0.47... | 0.4542732 | 46 |
Return 404 if page not found | def page_not_found(e):
return render_template("404.html"), 404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_not_found(e):\n return 'Sorry, nothing at this URL.', 404",
"def page_not_found(e):\n return 'Sorry, nothing at this URL.', 404",
"def page_not_found(e):\n return 'Sorry, nothing at this URL.', 404",
"def page_not_found(e):\n return 'Sorry, nothing at this URL.', 404",
"def page_not_fo... | [
"0.84974337",
"0.84974337",
"0.84974337",
"0.84974337",
"0.84974337",
"0.84974337",
"0.84974337",
"0.8477702",
"0.8477702",
"0.8477702",
"0.8477702",
"0.8477702",
"0.8477702",
"0.8477702",
"0.8477702",
"0.8476172",
"0.8475856",
"0.84114265",
"0.84114265",
"0.83721465",
"0.834... | 0.84348255 | 17 |
Loads a frozen inference graph | def _load_graph(self, graph_file):
graph = tf.Graph()
with graph.as_default():
od_graph_def = tf.GraphDef()
with tf.gfile.GFile(graph_file, 'rb') as fid:
serialized_graph = fid.read()
od_graph_def.ParseFromString(serialized_graph)
t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_frozen_graph(frozen_graph_path, graph=None, session=None):\n from diplomacy_research.utils.tensorflow import tf, tf_logging\n\n # Making sure the path exists\n if not os.path.exists(frozen_graph_path):\n LOGGER.error('The frozen graph %s does not exist.', frozen_graph_path)\n raise ... | [
"0.7145618",
"0.71300054",
"0.6952633",
"0.64996564",
"0.6480352",
"0.64554673",
"0.6437847",
"0.6419772",
"0.6419772",
"0.63925844",
"0.638914",
"0.63779676",
"0.6364601",
"0.6306616",
"0.6300151",
"0.627973",
"0.6269959",
"0.6266776",
"0.6258529",
"0.62003803",
"0.6152927",... | 0.60292816 | 29 |
Return boxes with a confidence >= `min_score` | def _filter_boxes(self, min_score, boxes, scores, classes):
n = len(classes)
idxs = []
for i in range(n):
if scores[i] >= min_score:
idxs.append(i)
filtered_boxes = boxes[idxs, ...]
filtered_scores = scores[idxs, ...]
filtered_classes ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_boxes(self, min_score, boxes, scores, classes):\n n = len(classes)\n idxs = []\n for i in range(n):\n if scores[i] >= min_score:\n idxs.append(i)\n \n filtered_boxes = boxes[idxs, ...]\n filtered_scores = scores[idxs, ...]\n filt... | [
"0.7317321",
"0.72886777",
"0.72492224",
"0.72279024",
"0.6647105",
"0.6314491",
"0.63112724",
"0.61915874",
"0.6165219",
"0.61569124",
"0.6156313",
"0.61135215",
"0.6062302",
"0.5995685",
"0.59620845",
"0.5960607",
"0.5950879",
"0.59485",
"0.5940718",
"0.5940718",
"0.5936835... | 0.72855526 | 2 |
Draw bounding boxes on the image | def _draw_boxes(self, image, boxes, classes, thickness=4):
for i in range(len(boxes)):
bot, left, top, right = boxes[i, ...]
class_id = int(classes[i]) - 1
color = self.COLOR_LIST[class_id]
cv2.rectangle(image, (left, top), (right, bot), color=color, thickness=thi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_bounding_boxes(self, image_path):\n img = cv.imread(image_path, cv.IMREAD_ANYDEPTH)\n bboxes = np.zeros((img.shape[0], img.shape[1], 3), dtype=np.uint8)\n unique, counts = np.unique(img, return_counts=True)\n for uni in unique:\n if uni == 0:\n continu... | [
"0.80207103",
"0.7730494",
"0.7663894",
"0.75815976",
"0.75812364",
"0.7569874",
"0.7564505",
"0.7560773",
"0.74707085",
"0.74676245",
"0.7462541",
"0.7429634",
"0.7386207",
"0.73359627",
"0.73075604",
"0.73066705",
"0.73026776",
"0.72940755",
"0.7275691",
"0.72722554",
"0.72... | 0.6929667 | 41 |
Locates the specified datafiles and returns the matches in a data_files compatible format. source is the root of the source data tree. Use '' or '.' for current directory. target is the root of the target data tree. Use '' or '.' for the distribution directory. patterns is a sequence of globpatterns for the files you w... | def find_data_files(source, target, patterns):
if glob.has_magic(source) or glob.has_magic(target):
raise ValueError("Magic not allowed in src, target")
ret = {}
for pattern in patterns:
pattern = os.path.join(source, pattern)
for filename in glob.glob(pattern):
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _DataSourceFromFilePattern(self,\n file_pattern,\n input_source_weights=None,\n **extra_input_kwargs):\n del input_source_weights # Unused.\n return py_utils.NestedMap(data=tf.constant(file_pattern))",
"def... | [
"0.61576617",
"0.6129363",
"0.5919765",
"0.5905183",
"0.58921427",
"0.5833857",
"0.58126956",
"0.5732098",
"0.5684496",
"0.5594679",
"0.558987",
"0.5580824",
"0.5559924",
"0.55368453",
"0.5534052",
"0.5506687",
"0.53464913",
"0.52918094",
"0.5241423",
"0.52367634",
"0.5205368... | 0.7973076 | 0 |
Yield successive nsized chunks from lst. | def chunks(lst, n):
for i in range(0, len(lst), n):
yield lst[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks(self, lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]",
"def chunks(lst: list, n: int):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]",
"def chunks(lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]",
"de... | [
"0.83071756",
"0.81939614",
"0.81910837",
"0.81910837",
"0.8190213",
"0.81267184",
"0.81218547",
"0.81218547",
"0.80773693",
"0.80526286",
"0.80526286",
"0.80526286",
"0.80526286",
"0.80526286",
"0.80042696",
"0.7871678",
"0.7845623",
"0.7828392",
"0.7827006",
"0.78138447",
"... | 0.80533457 | 22 |
Returns a list of (hash, string, indices)tuples. | def parse_korpus(self, korpus):
words = {}
index = 0
longest_word = 0
line = korpus.readline()
while line != []:
line = line[0].translate(TRANSLATE).decode(ENCODING)
if not och % 15000:
print(line)
for word in line... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_indexes(self, x):\n indexes = []\n for index_hashes in self.hash_functions:\n combined_index = []\n for idx_spec, hash_func in zip(self.config.index_specs, index_hashes):\n combined_index.append(idx_spec.distribution.get_index(hash_func(x)))\n indexes.append(tuple(combined_index... | [
"0.7082873",
"0.6868651",
"0.6675677",
"0.6668114",
"0.66508657",
"0.6611046",
"0.6400265",
"0.6339773",
"0.630122",
"0.6298387",
"0.6250481",
"0.6225739",
"0.61895305",
"0.6184987",
"0.6110571",
"0.6100887",
"0.60534286",
"0.6052246",
"0.59962",
"0.5987231",
"0.5984801",
"... | 0.0 | -1 |
Symmetric decorrelation i.e. W < (W W.T) ^{1/2} W | def _sym_decorrelation(W):
s, u = linalg.eigh(np.dot(W, W.T))
# Avoid sqrt of negative values because of rounding errors. Note that
# np.sqrt(tiny) is larger than tiny and therefore this clipping also
# prevents division by zero in the next step.
s = np.clip(s, a_min=np.finfo(W.dtype).tiny, a_max=No... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _gs_decorrelation(w, W, j):\n w -= np.linalg.multi_dot([w, W[:j].T, W[:j]])\n return w",
"def _symmetric(updates):\n sym_updates = updates[:-1] + [updates[-1]] + updates[:-1][::-1]\n coeff = [0.5]*(len(updates)-1) + [1.0] + [0.5]*(len(updates) - 1)\n return ExplicitIntegrator(coeff... | [
"0.68297875",
"0.58642405",
"0.5714483",
"0.56672794",
"0.56156206",
"0.55587417",
"0.5539916",
"0.55214864",
"0.54957104",
"0.548836",
"0.54881096",
"0.5487721",
"0.54838127",
"0.54819167",
"0.5476712",
"0.54497755",
"0.54356843",
"0.5432515",
"0.5406844",
"0.53943413",
"0.5... | 0.7474815 | 0 |
Instantiates a finite grid. The limits are specified as a list of tuples of (low, high) values, one for each grid vector. | def __init__(self, origin, grid_vectors, limits):
assert len(grid_vectors) == len(limits)
Grid.__init__(self, origin, grid_vectors)
self._Limits = limits | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grid(gmin, gmax, gstep):\n n_vals = int((gmax - gmin)/gstep + 1)\n my_grid = linspace(gmin, gmax, n_vals)\n return my_grid",
"def create_grid(xlim, ylim, step):\n x_range = np.arange(xlim[0], xlim[1], step)\n y_range = np.arange(ylim[0], ylim[1], step)\n return x_range, y_range",
"def mak... | [
"0.6845707",
"0.68128675",
"0.6641913",
"0.6626282",
"0.64288163",
"0.63951415",
"0.63662404",
"0.6347766",
"0.63329864",
"0.63275075",
"0.63241917",
"0.63241917",
"0.6310568",
"0.6308185",
"0.6199303",
"0.6160781",
"0.61287147",
"0.60951614",
"0.60779905",
"0.6064125",
"0.60... | 0.6917152 | 0 |
Given the image and label directories, returns a structured list. Input | def _load_data_worker(self,img_dir,lbl_dir):
data = []
for img,lbl in zip(glob(img_dir+"/*.jpg"),glob(lbl_dir+"/*.txt")):
im = np.array(Image.open(img))
im = make_square_image_with_padding(im, self.core_config.num_colors)
lbl_fh = open(lbl,encoding='utf-8')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_list_of_data_and_labels():\n list_of_imgs = []\n list_of_img_labels = []\n for root, dirs, files in os.walk(config[\"PathToData\"], topdown=False):\n for f in files:\n ext = os.path.splitext(f)[-1].lower()\n\n if ext in config[\"ValidImageFileExtensions\"]:\n ... | [
"0.7479282",
"0.7249914",
"0.7160709",
"0.714454",
"0.71018004",
"0.7090322",
"0.70697165",
"0.70690686",
"0.70348674",
"0.7027988",
"0.6997225",
"0.697528",
"0.69314796",
"0.69178325",
"0.6863838",
"0.6839108",
"0.68099934",
"0.68062544",
"0.679291",
"0.6754475",
"0.6735565"... | 0.61880404 | 58 |
Creates a business_report object from the dict TypedDict | def create(new_attrs: dict) -> BusinessNotification:
new_business_report = BusinessNotification()
db.session.add(new_business_report)
db.session.commit()
return new_business_report | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, odic):\n return dacite.from_dict(data_class=cls, data=odic)",
"def from_dictionary(cls,\r\n dictionary):\r\n if dictionary is None:\r\n return None\r\n\r\n # Extract variables from the dictionary\r\n id = dictionary.get('id')\r\n ... | [
"0.6308779",
"0.6164453",
"0.60887873",
"0.60887873",
"0.60887873",
"0.60887873",
"0.60887873",
"0.60887873",
"0.60887873",
"0.60887873",
"0.60887873",
"0.60887873",
"0.60887873",
"0.60887873",
"0.60887873",
"0.60887873",
"0.60887873",
"0.60887873",
"0.60887873",
"0.60887873",
... | 0.0 | -1 |
Get the SDGraphObjectFrame color | def getColor(self):
outValue = ColorRGBA()
_res = self.mAPIContext.SDGraphObjectFrame_getColor(self.mHandle, ctypes.byref(outValue))
if _res != SDApiError.NoError.value:
if _res == SDApiError.NoErrorOutputParamNotSet.value:
return None
raise APIException(S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_graph_color ( self, object ):\n return self.graph_color_",
"def _get_color(self):\n return self.__color",
"def _get_color(self):\n return self.__color",
"def _get_color(self):\n return self.__color",
"def _get_color(self):\n return self.__color",
"def getColor(self):\r\n ... | [
"0.76436764",
"0.713944",
"0.713944",
"0.713944",
"0.713944",
"0.7060627",
"0.7057942",
"0.70264846",
"0.7010687",
"0.6968809",
"0.6927457",
"0.69249076",
"0.68727857",
"0.6870275",
"0.6870275",
"0.68354243",
"0.68354243",
"0.68354243",
"0.6835348",
"0.6824584",
"0.6767909",
... | 0.765588 | 0 |
Test importing invalid config. | async def test_import_invalid(hass):
mocked_device = _create_mocked_device(True)
_create_mock_config_entry(hass)
with _patch_config_flow_device(mocked_device):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_IMPORT}, data=CONF_DATA
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_import(self):\n with self.assertRaises(ImproperlyConfigured):\n import_from_setting('TEST_SETTING')",
"def test_error_importing(self):\n with self.assertRaises(ImproperlyConfigured):\n import_from_setting('TEST_SETTING')",
"def test_broken_config(broken_conf... | [
"0.8125269",
"0.7789621",
"0.7702107",
"0.7402622",
"0.7298733",
"0.7276576",
"0.72535616",
"0.72371185",
"0.7185777",
"0.71790737",
"0.71636087",
"0.7097692",
"0.7054157",
"0.7015094",
"0.7012981",
"0.70097905",
"0.6971956",
"0.6935524",
"0.69273",
"0.6926781",
"0.68988734",... | 0.71278507 | 11 |
Splits document text into a list of sentences, given some model. | def get_sentences_list(text: str, model_type: str) -> t.List[str]:
sentences = []
sent_offsets = []
stok = SentenceTokenizer.from_type(model_type)
if isinstance(text, list):
sentences, sent_offsets = list(zip(*map(stok.tokenize, text)))
elif isinstance(text, str):
sentences, sent_off... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split(text):\n doc = nlp(text)\n sentences = [x.text_with_ws for x in doc.sents]\n return sentences",
"def get_sentences(text):\n \n return text.split('.')",
"def sentence_split(self, text):\n return split_into_sentences(text)",
"def split_sentences(self, text):\n ... | [
"0.7736216",
"0.7252213",
"0.7082826",
"0.70524997",
"0.6805155",
"0.67981815",
"0.6738876",
"0.6737422",
"0.67177343",
"0.6689931",
"0.666789",
"0.66164446",
"0.65894055",
"0.6582415",
"0.6578306",
"0.655155",
"0.65042615",
"0.6432492",
"0.641784",
"0.638252",
"0.638045",
... | 0.75723946 | 1 |
Find the closest intersection to the origin, by Manahattan distance, of two Wires. | def closest_intersect_manhattan(self, other: Wire) -> Tuple[Coordinate, int]:
intersection = sorted(self.intersect(other), key=lambda x: self.ORIGIN.dist(x.location))[0]
return intersection, self.ORIGIN.dist(intersection.location) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findIntersect(wires):\n allSets = list(map(lambda w: coordsFor(w), wires))\n baseSet = allSets[0]\n for s in allSets[1:]:\n baseSet.intersection_update(s)\n central = (0, 0)\n distances = list(map(lambda c: manhattan(central, c), baseSet))\n return min(distances)",
"def get_closest_i... | [
"0.73668647",
"0.71624225",
"0.6995059",
"0.688957",
"0.6259799",
"0.6222615",
"0.6161806",
"0.6148054",
"0.5992006",
"0.5981919",
"0.5977006",
"0.59560627",
"0.59306633",
"0.59270483",
"0.59255",
"0.5852488",
"0.58326423",
"0.5826113",
"0.58249897",
"0.5812551",
"0.5808463",... | 0.78951204 | 0 |
Shows a specific plane within 3D data. | def show_plane(axis, plane, cmap="gray", title=None):
axis.imshow(plane, cmap=cmap)
axis.set_xticks([])
axis.set_yticks([])
if title:
axis.set_title(title)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_plane(unit_normal, x_array, y_array, fore):\n # print'unit normal = ', unit_normal\n z = (((unit_normal[0] * (fore[0] - x_array)) + (unit_normal[1] * (fore[1] - y_array))) / unit_normal[2]) + fore[2]\n # print 'plane numbers\\n', z\n return z",
"def plane(self):\r\n from lsst.analysis... | [
"0.6780227",
"0.666365",
"0.6577502",
"0.6563549",
"0.63409144",
"0.624834",
"0.6219757",
"0.6199828",
"0.6173089",
"0.6126187",
"0.6115501",
"0.6100461",
"0.6099733",
"0.6040154",
"0.6024716",
"0.6006487",
"0.5987519",
"0.59277785",
"0.5921929",
"0.5920941",
"0.5902615",
"... | 0.67553663 | 1 |
Return the current container ID. | def get_current_container_id():
with open('/proc/self/cgroup', 'rt') as cgroup_file:
for line in cgroup_file.readlines():
return re.sub(r'^docker-', '', re.sub(r'\.scope$', '', re.sub(r'^.*\/', '', line.strip()))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def container_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"container_id\")",
"def containerID(self):\n return self._container",
"def container_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"container_id\")",
"def cont_to_id(self):\n r... | [
"0.86177015",
"0.85974866",
"0.822979",
"0.81850547",
"0.7676669",
"0.7595466",
"0.7591976",
"0.7085673",
"0.69835997",
"0.69442016",
"0.69008535",
"0.6894379",
"0.6839231",
"0.68319935",
"0.6813734",
"0.6774681",
"0.67729616",
"0.66315556",
"0.6575164",
"0.6575164",
"0.65332... | 0.80170023 | 4 |
A helper method that, given a valid faceValue, will update the die's currentValue and value to match the passed faceValue. | def setDieFaceValue(self, faceValue):
if faceValue in AngryDie.ANGRY_VALUES:
self.currentValue = faceValue
self.value = AngryDie.ANGRY_VALUES[faceValue] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setFace(self, value):\n self.face = value",
"def setFace(self, value):\n self.face = value",
"def test_currentValue_is_updated_to_roll_value(self):\n rolled_value = self.new_die.roll()\n if rolled_value == self.new_die.currentValue:\n self.assertTrue(True, \"currentVa... | [
"0.568083",
"0.568083",
"0.5458344",
"0.54526615",
"0.52289414",
"0.5217452",
"0.5184717",
"0.5160611",
"0.51151603",
"0.511195",
"0.50905704",
"0.506557",
"0.50020486",
"0.49880826",
"0.49478003",
"0.49093857",
"0.4904442",
"0.48498568",
"0.48484898",
"0.4839955",
"0.4830702... | 0.81279725 | 0 |
Generate N RGB colors for cmap. | def generate(N, cmap='Set1', method='matplotlib', keep_alpha=False, scheme='rgb', verbose='info'):
# Set the logger
set_logger(verbose=verbose)
listlen = 4 if keep_alpha else 3
if method=='seaborn':
sns = _check_seaborn()
color_list = sns.color_palette(cmap, N)
else:
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_n_colors(n, cmap_name='tab20'):\n pt_region_colormap = plt.get_cmap(cmap_name)\n max_i = len(pt_region_colormap.colors)\n return [pt_region_colormap(i % max_i) for i in range(n)]",
"def get_cmap(n):\n cmap_fn = plt.cm.get_cmap('hsv', n+1)\n colors = [cmap_fn(i + 1)[:3] for i in range(... | [
"0.8178953",
"0.77302057",
"0.76631385",
"0.76402104",
"0.73800164",
"0.7310844",
"0.72412497",
"0.72399986",
"0.70891625",
"0.70848805",
"0.705759",
"0.6974212",
"0.69218963",
"0.6902083",
"0.68446606",
"0.6824279",
"0.6822179",
"0.68052876",
"0.6770785",
"0.67608047",
"0.66... | 0.6841107 | 15 |
Convert RGB colorrange to hex. | def rgb2hex(colors, keep_alpha=False):
if isinstance(colors, list):
colors = np.array(colors)
if len(colors.shape)==1:
colors = np.array([colors])
if not keep_alpha:
colors = colors[:, 0:3]
hexcolors = list(map(lambda x: matplotlib.colors.to_hex(x, keep_alpha=keep_alpha), colors... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rgb_hexify(rgb: Iterable[int]) -> str:\n return ''.join(\n list(map(\n lambda x: hex(abs(x))[2:].zfill(2),\n rgb\n ))[::-1]\n )",
"def rgb_to_hex(cls, r, g, b):\n return '#%02x%02x%02x' % (int(r), int(g), int(b))",
"def rgb2hex(cls, rgb):\r\n if not t... | [
"0.7687512",
"0.7467669",
"0.74484754",
"0.7410516",
"0.7389656",
"0.7368666",
"0.7366835",
"0.73552287",
"0.73433214",
"0.73162735",
"0.7264452",
"0.7255768",
"0.7255768",
"0.7255768",
"0.7242387",
"0.7229792",
"0.72228086",
"0.7195485",
"0.71832603",
"0.7121302",
"0.7120350... | 0.6617863 | 51 |
Convert hex colorrange to RGBA. | def hex2rgba(colors):
if 'str' in str(type(colors)):
colors = np.array([colors])
rgbcolors = list(map(lambda x: matplotlib.colors.to_rgba(x), colors))
return np.array(rgbcolors) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hex_to_rgba(h, alpha):\n return tuple([int(h.lstrip('#')[i:i + 2], 16) for i in (0, 2, 4)] + [alpha])",
"def normalize_rgb_colors_to_hex(css):\n log.debug(\"Converting all rgba to hexadecimal color values.\")\n regex = re.compile(r\"rgb\\s*\\(\\s*([0-9,\\s]+)\\s*\\)\")\n match = regex.search(css)... | [
"0.74167764",
"0.70776886",
"0.6812988",
"0.6806883",
"0.66850585",
"0.66562873",
"0.66246355",
"0.66192836",
"0.6602443",
"0.6597313",
"0.6596636",
"0.65546227",
"0.65298957",
"0.6514845",
"0.6510283",
"0.65088314",
"0.64748806",
"0.6454721",
"0.6445255",
"0.64353675",
"0.64... | 0.71970624 | 1 |
Generate colors from input list. This function creates unique colors based on the input list y and the cmap. When the gradient hex color is defined, such as '000000', a gradient coloring space is created between two colors. The start color of the particular y, using the cmap and The end color is the defined gradient, s... | def fromlist(y, X=None, cmap='Set1', gradient=None, method='matplotlib', scheme='rgb', opaque_type='per_class', verbose='info'):
# Set the logger
set_logger(verbose=verbose)
# make unique
y = np.array(y)
uiy = np.unique(y)
# Get colors
colors_unique = generate(len(uiy), cmap=cmap, method=me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_color_gradient():\n colors = []\n step = 10\n for red, green in zip(range(255,-step, -step), range(0, 255, step)):\n colors.append({'red': red, 'green': green, 'blue': 0})\n for green, blue in zip(range(255,-step, -step), range(0, 255, step)):\n colors.append({'red': 0, 'green'... | [
"0.69815975",
"0.6241875",
"0.608826",
"0.6028528",
"0.5951059",
"0.58788097",
"0.58780885",
"0.58316827",
"0.5818387",
"0.5781078",
"0.56648606",
"0.5645055",
"0.5637384",
"0.56352425",
"0.56185704",
"0.55861217",
"0.5581655",
"0.5577476",
"0.5556196",
"0.5546131",
"0.554457... | 0.7146094 | 0 |
Return a gradient list of (n) colors between two hex colors. start_hex and finish_hex should be the full sixdigit color string, inlcuding the number sign ("FFFFFF") | def linear_gradient(start_hex, finish_hex="#FFFFFF", n=10):
if finish_hex=='opaque': finish_hex=start_hex
# Starting and ending colors in RGB form
s = _hex2rgb(start_hex)
f = _hex2rgb(finish_hex)
# Initilize a list of the output colors with the starting color
RGB_list = [s]
# Calcuate a colo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_color_gradient():\n colors = []\n step = 10\n for red, green in zip(range(255,-step, -step), range(0, 255, step)):\n colors.append({'red': red, 'green': green, 'blue': 0})\n for green, blue in zip(range(255,-step, -step), range(0, 255, step)):\n colors.append({'red': 0, 'green'... | [
"0.7464628",
"0.730974",
"0.6747355",
"0.64438266",
"0.6420821",
"0.6330026",
"0.6233631",
"0.61494654",
"0.614863",
"0.60044503",
"0.5992193",
"0.5977377",
"0.59677243",
"0.5953647",
"0.5910034",
"0.590775",
"0.59075046",
"0.58731186",
"0.58708364",
"0.586321",
"0.5853994",
... | 0.7984741 | 0 |
Set gradient on density color. This function determines the density of the data and adds a transparency column. If samples are in dense areas, transparency values are towards 1 (visible), whereas isn nonedense areas, the transparency values are towards 0 (not visible). | def gradient_on_density_color(X, c_rgb, labels, opaque_type='per_class', showfig=False, verbose='info'):
# Set the logger
set_logger(verbose=verbose)
if labels is None: labels = np.repeat(0, X.shape[0])
from scipy.stats import gaussian_kde
uilabels = np.unique(labels)
# Add the transparency col... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isothermal_depth_wyrtki1964_gradient(da_PT):\n\n # make land mask based on surface layer\n da_mask = da_PT.isel(z=0)*0.+1.\n\n # calculate drho/dz\n da_PT_dz = da_PT.differentiate('z') # kg/m^4\n\n # interpolate to finer vertical resolution (2.5m)\n da_interp = da_PT_dz.interp(z=np.arange(0,d... | [
"0.57073355",
"0.57073355",
"0.56205153",
"0.5285244",
"0.52843755",
"0.5108466",
"0.5072132",
"0.50284564",
"0.49939755",
"0.49933887",
"0.49889076",
"0.4987362",
"0.4982678",
"0.4981954",
"0.49721134",
"0.49690628",
"0.49479908",
"0.49206397",
"0.4919995",
"0.49167046",
"0.... | 0.65256983 | 0 |
Yield all filenames in a path. | def list_directory_files(path, folders=False):
for f in os.listdir(path):
if f[0] == '.':
continue
current_path = os.path.join(path, f)
if folders is False:
if os.path.isfile(current_path):
if os.path.getsize(current_path) != 0:
yie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_files(path):\n if os.path.isfile(path):\n yield path\n elif os.path.isdir(path):\n for dirpath, _, filenames in os.walk(path):\n for f in filenames:\n yield os.path.join(dirpath, f)\n else:\n raise RuntimeError('Path %s is invalid' % path)",
"def a... | [
"0.8316498",
"0.8162758",
"0.7978636",
"0.77177733",
"0.7645544",
"0.7496099",
"0.7371728",
"0.73671514",
"0.7325709",
"0.7240269",
"0.72048444",
"0.71422756",
"0.7079702",
"0.707557",
"0.70674306",
"0.70605344",
"0.6950866",
"0.69340396",
"0.6924985",
"0.6914971",
"0.6914575... | 0.0 | -1 |
Tests that createElementNS calls are filtered properly | def test_createElementNS():
assert not _do_test_raw("""
var x = "foo";
x.createElementNS();
x.createElementNS("foo");
x.createElementNS("foo", "bar");
""").failed()
assert _do_test_raw("""
var x = "foo";
x.createElementNS("foo", "script");
""").failed()
assert _do_test_raw... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_createElement():\n\n assert not _do_test_raw(\"\"\"\n var x = \"foo\";\n x.createElement();\n x.createElement(\"foo\");\n \"\"\").failed()\n\n assert _do_test_raw(\"\"\"\n var x = \"foo\";\n x.createElement(\"script\");\n \"\"\").failed()\n\n assert _do_test_raw(\"\"\"\n v... | [
"0.6553644",
"0.5767339",
"0.56110704",
"0.5496338",
"0.5460686",
"0.5308755",
"0.52212656",
"0.5208479",
"0.5199475",
"0.5189086",
"0.5153285",
"0.51497877",
"0.5131236",
"0.51135963",
"0.51049906",
"0.50972146",
"0.5070891",
"0.50700235",
"0.50475746",
"0.5033134",
"0.50266... | 0.7780457 | 0 |
Test that `.openDialog(bar)` throws doesn't throw an error where `bar` is a dirty object. | def test_openDialog_flag_var(self):
self.run_script("""
foo.openDialog(bar)
""")
self.assert_notices() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_openDialog_pass(self):\n self.run_script(\"\"\"\n foo.openDialog(\"foo\")\n foo.openDialog(\"chrome://foo/bar\")\n \"\"\")\n self.assert_silent()",
"def test_openWindowWithWrongSettingsFile(self):\n self.createWrongSettingsFile()\n return self.assertRaise... | [
"0.664462",
"0.6096759",
"0.5865762",
"0.56994104",
"0.5670863",
"0.5574597",
"0.5482802",
"0.54300237",
"0.5427492",
"0.53748256",
"0.5308122",
"0.52538544",
"0.5234245",
"0.52235",
"0.5222695",
"0.52182746",
"0.52126163",
"0.5170296",
"0.516994",
"0.51174134",
"0.5110923",
... | 0.63953465 | 1 |
Returns the time (total sum of timesteps) since the last reset. | def time(self) -> float:
return self.sim_scene.data.time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTime(self):\n return self.step / (self.max_step + int(self.include))",
"def getTime(self) -> float:\n return self.t",
"def get(self):\n if self.running:\n return self.accumulated_time + pg.time.get_ticks() - self.start_time\n else:\n return self.accumula... | [
"0.7168588",
"0.71211964",
"0.70225096",
"0.6981281",
"0.69380325",
"0.69172233",
"0.6909712",
"0.68915546",
"0.6887088",
"0.68044907",
"0.6802243",
"0.6790637",
"0.67853886",
"0.67688805",
"0.6760488",
"0.67461056",
"0.67229843",
"0.6677072",
"0.6672788",
"0.6668022",
"0.666... | 0.6420324 | 42 |
Returns the initial states for the given groups. | def get_initial_state(
self,
groups: Union[str, Sequence[str]],
) -> Union[RobotState, Sequence[RobotState]]:
if isinstance(groups, str):
configs = [self.get_config(groups)]
else:
configs = [self.get_config(name) for name in groups]
states = []... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_initial_states(self):\n raise NotImplementedError()",
"def initial_states(self):\n return self._initial_states",
"def initial_states(self):\n return list(self.iter_initial_states())",
"def states_initial(self):\n return self.states(\"Initial = YES\")",
"def _get_group_st... | [
"0.6517598",
"0.63916826",
"0.61768365",
"0.61699396",
"0.6043793",
"0.59128195",
"0.5887704",
"0.58768594",
"0.58085155",
"0.58085155",
"0.58085155",
"0.58085155",
"0.58085155",
"0.58085155",
"0.58085155",
"0.58085155",
"0.58085155",
"0.58085155",
"0.58085155",
"0.58085155",
... | 0.7757164 | 0 |
Sets the robot joints to the given states. | def _set_group_states(
self, group_states: Sequence[Tuple[RobotGroupConfig, RobotState]]):
for config, state in group_states:
if config.qpos_indices is None:
continue
if state.qpos is not None:
self.sim_scene.data.qpos[config.qpos_indices] = st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_joint_states(self, joints: List[str], position: List[float] = None,\n velocity: List[float] = None) -> NoReturn:\n assert all([j in self.joints.names for j in joints]), 'all values of joints must also be in self.joints'\n \n if position is not None:\n ... | [
"0.7340826",
"0.6836892",
"0.6627433",
"0.6219958",
"0.6123465",
"0.59864044",
"0.5968934",
"0.59389764",
"0.5932464",
"0.590818",
"0.58539706",
"0.5794332",
"0.57893485",
"0.57693374",
"0.57496977",
"0.5736451",
"0.57093275",
"0.56946826",
"0.56944317",
"0.5574347",
"0.55688... | 0.51125777 | 52 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, SearchResourceShareInvitationReqBody):
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.84568954",
"0.83923674",
"0.81447554",
"0.81407183",
"0.81326675",
"0.80941343",
"0.8092415",
"0.8092415",
"0.8092415",
"0.8085536",
"0.8085536",
"0.8076502",
"0.8076502",
"0.8066026"
] | 0.0 | -1 |
Create optimizer learning rate scheduler based on config. | def _create_learning_rate_scheduler(learning_rate_config, optimizer, total_step):
lr_scheduler = None
learning_rate_type = learning_rate_config.WhichOneof('learning_rate')
if learning_rate_type == 'multi_phase':
config = learning_rate_config.multi_phase
lr_phases = []
mom_phases = []
for phase_cfg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scheduler_creator(optimizer, config):\n return torch.optim.lr_scheduler.StepLR(optimizer, step_size=5, gamma=0.9)",
"def build(optimizer_config, optimizer, total_step):\n optimizer_type = optimizer_config.WhichOneof('optimizer')\n\n if optimizer_type == 'rms_prop_optimizer':\n config = optimizer_conf... | [
"0.8004487",
"0.7996875",
"0.79782903",
"0.7639045",
"0.73738545",
"0.7332055",
"0.7301991",
"0.7300177",
"0.7256197",
"0.7231383",
"0.71939045",
"0.7167134",
"0.7102816",
"0.7095163",
"0.7091584",
"0.7080664",
"0.70553064",
"0.69863945",
"0.69457966",
"0.69298434",
"0.692465... | 0.75770074 | 4 |
Normalizes string, converts to lowercase, removes nonalpha characters, and converts spaces to hyphens. From Django's "django/template/defaultfilters.py". | def _slugify(value):
import unicodedata
if not isinstance(value, unicode):
value = unicode(value)
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore')
value = unicode(_slugify_strip_re.sub('', value).strip().lower())
return _slugify_hyphenate_re.sub('-', value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize(str):\n res = str.lower()\n return res.replace(' ', '-')",
"def normalize(s):\n s = replace_whitespace(s)\n s = remove_dashes(s)\n s = s.lower()\n return s",
"def sanitize(string):\n retval = string.lower()\n retval = re.sub(r\"[^\\w\\s]\", '', retval)\n retval = re.sub(... | [
"0.8050005",
"0.7715769",
"0.7337892",
"0.7264596",
"0.7262135",
"0.7178926",
"0.7171534",
"0.714335",
"0.71391594",
"0.70830053",
"0.7070548",
"0.70457333",
"0.70426863",
"0.70101064",
"0.70101064",
"0.6989748",
"0.69828415",
"0.69823",
"0.69683266",
"0.69340587",
"0.6910592... | 0.6851728 | 28 |
Find the next empty square in the board. | def _find_empty_cell(self):
for r, row in enumerate(self._board):
for c, cell in enumerate(row):
if cell is None:
return r, c | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_empty_cell(self):\n for row in range(len(self.grid)):\n for col in range(len(self.grid[0])):\n if self.grid[row][col] == 0:\n return (row, col)\n return None",
"def find_empty_squares(board):\n for i in range(len(board)):\n for j i... | [
"0.771726",
"0.76045936",
"0.759847",
"0.74498457",
"0.72153336",
"0.70994276",
"0.6846962",
"0.67881215",
"0.67627925",
"0.67542005",
"0.6752573",
"0.6666043",
"0.6641799",
"0.66194654",
"0.6548566",
"0.6522966",
"0.6478559",
"0.64705473",
"0.6379805",
"0.63471836",
"0.63375... | 0.7049689 | 6 |
Create the test server application instance. | def create_app(self):
coverage.process_startup()
app = create_test_app()
selenium_server_url = "http://{}:{}/wd/hub".format(
os.environ.get("{{ cookiecutter.project_slug|upper }}_SELENIUM_HOST", "chrome"),
os.environ.get("{{ cookiecutter.project_slug|upper }}_SELENIUM_POR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app(test_config=None):\n app = Flask(__name__, instance_relative_config=True)\n app.config.from_mapping(\n SECRET_KEY=os.environ.get('FLASK_SECRET_KEY', 'dev'),\n # SQLALCHEMY_DATABASE_URI='sqlite:////' + os.path.join(app.instance_path, 'app.sqlite'),\n SQLALCHEMY_DATABASE_URI... | [
"0.7417531",
"0.73058623",
"0.7296637",
"0.7289872",
"0.72620034",
"0.72145504",
"0.71641845",
"0.7141066",
"0.7107825",
"0.71020865",
"0.7096506",
"0.70654595",
"0.70639825",
"0.704083",
"0.70407116",
"0.7004533",
"0.6990313",
"0.6979766",
"0.69694114",
"0.6966402",
"0.69436... | 0.7206358 | 6 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes=[],
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
plt.figure()
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
print("Normalized confusion ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8194366",
"0.8095442",
"0.8029135",
"0.8019134",
"0.7993755",
"0.7991176",
"0.79808146",
"0.79755133",
"0.79609716",
"0.7956584",
"0.79375756",
"0.79346216",
"0.79343396",
"0.7931212",
"0.7926087",
"0.7924503",
"0.7923946",
"0.79228765",
"0.79227114",
"0.7921956",
"0.79178... | 0.7835582 | 61 |
test attrs of City when created | def test_attrs(self):
city = City()
self.assertEqual(city.name, "")
self.assertEqual(City.name, "")
self.assertEqual(city.state_id, "")
self.assertEqual(City.state_id, "")
self.assertIn("id", city.__dict__)
self.assertIn("created_at", city.to_dict())
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_attributes(self):\n self.assertTrue(hasattr(self.city, 'name'))\n self.assertTrue(hasattr(self.city, 'state_id'))",
"def test_set_attrs(self):\n city2 = City()\n city2.name = \"Hawaii\"\n self.assertEqual(city2.name, \"Hawaii\")\n city2.state_id = \"<3\"\n ... | [
"0.79669297",
"0.7755154",
"0.76454324",
"0.75021863",
"0.7164923",
"0.7156203",
"0.70737207",
"0.70595056",
"0.70520234",
"0.6963021",
"0.69118476",
"0.69103384",
"0.67882353",
"0.67593557",
"0.67574525",
"0.6731778",
"0.6674009",
"0.66470456",
"0.6544833",
"0.6540936",
"0.6... | 0.76267827 | 3 |
Get the points to estimate head pose sideways | def head_pose_points(image, rotation_vector, translation_vector, camera_matrix):
rear_size = 1
rear_depth = 0
front_size = image.shape[1]
front_depth = front_size*2
val = [rear_size, rear_depth, front_size, front_depth]
point_2d = get_2d_points(image, rotation_vector, translation_vector, camera_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_oriented_points(self):\n return g.points_from_probe(self)",
"def pose_2d_pts(self,image):\n '''\n image- rgb image \n return:-\n pts - list of 2d pose landmarks as img coords\n image- rgb image on which the 2d pose landmarks are drawn\n ''' \n pts=... | [
"0.6658804",
"0.6222457",
"0.6192936",
"0.615454",
"0.61042935",
"0.60609454",
"0.6035024",
"0.6020878",
"0.60114807",
"0.59733033",
"0.5970817",
"0.59246963",
"0.58942825",
"0.58829874",
"0.5882882",
"0.5877781",
"0.58656156",
"0.58611846",
"0.58332133",
"0.5820129",
"0.5814... | 0.6316923 | 1 |
Return the urgency override state. | def isUrgencyOverrideAllowed(session_key):
notable_en = entity.getEntity(NotableEventUpdate.LOG_REVIEW_REST_URL,
'notable_editing',
namespace=NotableEventUpdate.DEFAULT_NAMESPACE,
owner=NotableEvent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def urgency(self):\n\n try:\n tts = self.raw_time_to_resolve\n except:\n tts = 666\n\n defcon = \"normal\"\n\n if tts < 1:\n defcon = \"critical\"\n elif tts < 2:\n defcon = \"warning\"\n\n return defcon",
"def get_level(self) ... | [
"0.7169567",
"0.555879",
"0.5551994",
"0.5436678",
"0.5436553",
"0.5412196",
"0.5387082",
"0.5367364",
"0.5339496",
"0.5331872",
"0.53277886",
"0.5325559",
"0.5320186",
"0.5314916",
"0.5301885",
"0.52887714",
"0.52858543",
"0.5284677",
"0.5282586",
"0.5275696",
"0.5273975",
... | 0.588646 | 1 |
Returns the status ID of the default systemwide review status. | def getDefaultStatus(session_key):
# Get the list of statuses
logger.debug("Getting the default status")
statuses_list = entity.getEntities(NotableEventUpdate.REVIEW_STATUSES_REST_URL,
namespace=NotableEventUpdate.DEFAULT_NAMESPACE,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_status(self):\n return self.bot_data_file[\"bot_status\"][\"defaultStatus\"]",
"def get_review_status(self):\n if not hasattr(self, 'credential_review'):\n status = 'Awaiting review'\n elif self.credential_review.status <= 20:\n status = 'Awaiting review... | [
"0.68067926",
"0.6296829",
"0.60826635",
"0.60303974",
"0.5814972",
"0.5710746",
"0.5666026",
"0.56644005",
"0.5596166",
"0.5588872",
"0.5538899",
"0.5532661",
"0.5532661",
"0.5532661",
"0.5532661",
"0.5532661",
"0.5532661",
"0.5532661",
"0.5532661",
"0.5532661",
"0.5516928",... | 0.7114933 | 0 |
Build a URI template using the url_key and constants from the API definition found in const.py | def build_uri_template(url_key: str) -> URITemplate:
_skeleton = ''.join([API_PATH['base'], API_PATH[url_key]])
_template = URITemplate(_skeleton)
return _template | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uri_template(app, **kwargs):\n assert len(kwargs) == 1\n\n endpoint = kwargs.keys()[0]\n parameters = kwargs.values()[0]\n\n for url in app.url_map.iter_rules():\n if url.endpoint == endpoint:\n break\n else:\n return ''\n\n ut = url.rule\n\n for param, replacement... | [
"0.709884",
"0.6977214",
"0.67404443",
"0.66753805",
"0.662737",
"0.6527455",
"0.64493567",
"0.642962",
"0.6384027",
"0.63768953",
"0.63635385",
"0.63031346",
"0.63031346",
"0.6255533",
"0.6241023",
"0.62348884",
"0.6225104",
"0.6216448",
"0.6147686",
"0.6134802",
"0.6097601"... | 0.8198724 | 0 |
Function to initialize test case data. | def init_test_cases():
test_cases = []
# add info to list in memory, one by one, following signature values
test_case_ID = 1
test_case_name = "auto-resiliency-pif-001"
test_case_JIRA_URL = "https://jira.opnfv.org/browse/AUTO-9"
test_cases.append(TestCase(test_case_ID, test_case_name, test_case_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUpTestData(cls):\n # volunteer user\n common.initialize_empty_volunteer()",
"def setUp(self):\n self.dataset = get_test_dataset()",
"def setUpTestData(cls):\n data_gen.run()",
"def setUpTestData(cls):\n data_gen.run()",
"def setUpTestData(cls):\n data_gen.ru... | [
"0.76128685",
"0.75372815",
"0.7513062",
"0.7513062",
"0.7513062",
"0.7513062",
"0.72867423",
"0.72227305",
"0.72166383",
"0.71077645",
"0.70698",
"0.7060812",
"0.68932444",
"0.68592334",
"0.6827512",
"0.6818365",
"0.68055",
"0.6784938",
"0.6728202",
"0.6699266",
"0.6694796",... | 0.6497204 | 48 |
Function to initialize test definition data. | def init_test_definitions():
test_definitions = []
# add info to list in memory, one by one, following signature values
test_def_ID = 5
test_def_name = "VM failure impact on virtual firewall (vFW VNF)"
test_def_challengeDefID = 5
test_def_testCaseID = 5
test_def_VNFIDs = [1]
test_def_as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_setup(self, test_data: list=None):\n print(\"[dataset]: using test setup ...\")\n self.vocabulary = [\"empty\"]\n self.eval_dataset = ABSADataset(data_path=self.dev_path, mode=self.in_mode, task=self.task,\n tokenizer=self.tokenizer, vocab=\"bert... | [
"0.7206878",
"0.69830936",
"0.69170666",
"0.6905432",
"0.68886626",
"0.68886626",
"0.68886626",
"0.68886626",
"0.6804058",
"0.6760746",
"0.67286724",
"0.6666416",
"0.6661453",
"0.66520184",
"0.6634772",
"0.66281074",
"0.6593501",
"0.6591871",
"0.657064",
"0.6567946",
"0.65450... | 0.7271976 | 0 |
Function to initialize recipient data. | def init_recipients():
test_recipients = []
# add info to list in memory, one by one, following signature values
recipient_ID = 1
recipient_name = "OpenStack on Arm pod"
recipient_info = "controller resolves to one of the CTL VMs"
recipient_versionInfo = ""
recipient_accessIPAddress = "172.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, fromaddr, toaddrs, subject='', body='',\n smtphost='localhost'):\n\n if isinstance(toaddrs, StringType):\n self.toaddrs = [x.strip() for x in toaddrs.split(',') if x]\n else:\n self.toaddrs = toaddrs\n \n self.fromaddr = froma... | [
"0.6428627",
"0.64235",
"0.62196666",
"0.6182053",
"0.61726594",
"0.6099804",
"0.5981679",
"0.59092396",
"0.5873928",
"0.5860588",
"0.58200073",
"0.5800448",
"0.58002824",
"0.57671815",
"0.57571095",
"0.5746232",
"0.5722598",
"0.5720659",
"0.57187426",
"0.5717267",
"0.5710726... | 0.6166087 | 5 |
Saves parameters to json file | def save(self, json_path):
with open(json_path, 'w') as f:
json.dump(self.__dict__, f, indent=4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_json(self, path=None):\n if path is None:\n path = self.parampath\n\n params = {str(key): str(value) for key, value in self.__dict__.items()}\n # with open(f'{path}/params_{self.mode}.json', 'w') as f:\n with open(os.path.join(path, f'params_{self.mode}.json'), 'w') ... | [
"0.82312053",
"0.8181947",
"0.8057166",
"0.7808885",
"0.77812463",
"0.775106",
"0.7710382",
"0.7706769",
"0.76148814",
"0.75990826",
"0.7574917",
"0.75643057",
"0.7448175",
"0.7373087",
"0.7341731",
"0.7261098",
"0.719621",
"0.7154501",
"0.714766",
"0.7143015",
"0.71297264",
... | 0.6701761 | 64 |
Compute the restricted attention using kaldi position encoding. | def compute_kaldi_restricted_attention(endpoints, params):
# Use a basic for loop
value = endpoints["value"]
key = endpoints["key"]
query = endpoints["query"]
batch_size, length, total_dim = value.shape
num_heads = params.sann_num_heads
context_size = params.sann_restricted_context_size
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attention(self, X):\n if self.bn:\n layer = 16\n else:\n layer = 14\n inputs = [K.learning_phase()] + [self.model.inputs[0]]\n _attention_f = K.function(inputs, [\n self.model.layers[layer].output])\n \n return _attention_f([0] + [X... | [
"0.6223233",
"0.6138006",
"0.6051119",
"0.60232174",
"0.60205334",
"0.5843146",
"0.5834027",
"0.57716316",
"0.57679117",
"0.56381214",
"0.5616626",
"0.5609945",
"0.5591088",
"0.5589141",
"0.5581806",
"0.5557133",
"0.55491656",
"0.553368",
"0.5524424",
"0.551581",
"0.55075306"... | 0.5936036 | 5 |
Overwritten setter functions to convert the time_struct into a real timestamp. | def set_startTime(self, startTime):
self.startTime = mktime(startTime) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateStructTime(self, t):\n self.date.UpdateStructTime(t)\n self.time.UpdateStructTime(t)",
"def timestamp(self, value):\n value = util.parse_valid_date(value)\n self._set_attr('timestamp', value)",
"def UpdateStructTime(self, t):\n if not self.Complete():\n r... | [
"0.66382796",
"0.65591556",
"0.64815944",
"0.6390295",
"0.6382825",
"0.63617474",
"0.6329803",
"0.63273144",
"0.63211745",
"0.63090664",
"0.6307001",
"0.6288048",
"0.62831414",
"0.62622255",
"0.6251193",
"0.62397015",
"0.6201132",
"0.61923033",
"0.618849",
"0.61747265",
"0.61... | 0.0 | -1 |
Overwritten setter functions to convert the time_struct into a real timestamp. | def set_stopTime(self, stopTime):
self.stopTime = mktime(stopTime) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateStructTime(self, t):\n self.date.UpdateStructTime(t)\n self.time.UpdateStructTime(t)",
"def timestamp(self, value):\n value = util.parse_valid_date(value)\n self._set_attr('timestamp', value)",
"def UpdateStructTime(self, t):\n if not self.Complete():\n r... | [
"0.66382796",
"0.65591556",
"0.64815944",
"0.6390295",
"0.6382825",
"0.63617474",
"0.6329803",
"0.63273144",
"0.63211745",
"0.63090664",
"0.6307001",
"0.6288048",
"0.62831414",
"0.62622255",
"0.6251193",
"0.62397015",
"0.6201132",
"0.61923033",
"0.618849",
"0.61747265",
"0.61... | 0.0 | -1 |
Return True if entity has to be polled for state. We overwrite coordinator property default setting because we need to poll to avoid the effect that after changing switch state it is immediately set to prev state. The async_update method here do nothing because the real update is performed by coordinator. | def should_poll(self) -> bool:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_on(self):\n if self.is_update_locked():\n return self.graceful_state\n if self._state['action'] == 1 and self._state['state'] == 2:\n return True\n return False",
"async def async_update(self) -> None:\n all_states = [self.hass.states.get(x) for x in self.... | [
"0.6846774",
"0.6731269",
"0.66712904",
"0.66300744",
"0.6437781",
"0.6404045",
"0.6392167",
"0.6353482",
"0.63164604",
"0.6313499",
"0.6303177",
"0.6263767",
"0.62205803",
"0.6157645",
"0.61570364",
"0.6144633",
"0.61069655",
"0.61067325",
"0.6105299",
"0.61030585",
"0.60936... | 0.60423785 | 66 |
Get current switch state | def _get_switch_state(self):
if self.entity_description.value_fn is not None:
return self.entity_description.value_fn(self._wrap_device)
if self._api.state:
feature = self.entity_description.key
return self._api.state.device_features.get(feature)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self):\n return self.controller.get_state()",
"def get_current_state(self):\n return self._current_state",
"def get_current_state(self):\n return self.game.get_current_state()",
"def state(self) -> bool:\n return self.get_state(self.entity_ids[\"switch\"])",
"def r... | [
"0.74889183",
"0.73827314",
"0.73482925",
"0.7328623",
"0.7303987",
"0.72895473",
"0.72895473",
"0.7262649",
"0.72144073",
"0.72110635",
"0.71496564",
"0.7141653",
"0.71394473",
"0.71338475",
"0.7104394",
"0.7095693",
"0.70940304",
"0.70775414",
"0.7067311",
"0.7067311",
"0.7... | 0.7429907 | 1 |
Takes a List of Tensors and returns a List of mask Tensor with 1 if the input was all zeros (on dimension 2) and 0 otherwise. This is used in the Attention layer to mask the padding observations. | def get_zero_entities_mask(entities: List[torch.Tensor]) -> List[torch.Tensor]:
with torch.no_grad():
if exporting_to_onnx.is_exporting():
with warnings.catch_warnings():
# We ignore a TracerWarning from PyTorch that warns that doing
# shape[n].item() will cause ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_attention_mask(input_ids): \n attention_masks = [] \n\n # 1 for input and 0 for pad\n for seq in input_ids: \n attention_masks.append([float(i>0) for i in seq])\n\n return attention_masks",
"def get_padding_mask(inputs, padding_value=0):\n mask = tf.cast(tf.equal(inputs, padding_val... | [
"0.7192867",
"0.68340164",
"0.6609743",
"0.651477",
"0.64316094",
"0.63892573",
"0.62922674",
"0.6264108",
"0.6230588",
"0.62144625",
"0.61776084",
"0.61677283",
"0.61438",
"0.6140973",
"0.61276275",
"0.611358",
"0.6040983",
"0.6023705",
"0.6021974",
"0.60033125",
"0.59760505... | 0.684822 | 1 |
Constructs a ResidualSelfAttention module. | def __init__(
self,
embedding_size: int,
entity_num_max_elements: Optional[int] = None,
num_heads: int = 4,
):
super().__init__()
self.max_num_ent: Optional[int] = None
if entity_num_max_elements is not None:
self.max_num_ent = entity_num_max_eleme... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, pretrained=True, freeze_weights=True):\n super(RaisinNet34, self).__init__()\n # Define the model's name for it's output files\n # Load a pre-trained ResNet-34 model and turn off autograd\n # so its weights won't change.\n architecture = resnet34(pretrained=pre... | [
"0.5621225",
"0.544435",
"0.53626496",
"0.5334829",
"0.5327962",
"0.5268676",
"0.523798",
"0.5227105",
"0.5201277",
"0.5181055",
"0.5148044",
"0.51474625",
"0.5142541",
"0.5127878",
"0.5121603",
"0.51125926",
"0.5108721",
"0.5103974",
"0.50641334",
"0.50507617",
"0.50487804",... | 0.0 | -1 |
Calculate the cumulative sums of all values. | def cum_sum(self):
# create cdo command and runit
cdo_command = "cdo -timcumsum"
run_this(cdo_command, self, output="ensemble") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _cumulative_sum(xs):\r\n cumsum = 0\r\n for x in xs:\r\n cumsum += x\r\n yield cumsum",
"def cumsum(self):\n return self._lift(lambda c: c.cumsum)",
"def cumulative_sum(x):\n total = 0\n sum = []\n for num in x:\n total += num\n sum.append(total)\n retur... | [
"0.76194537",
"0.75675356",
"0.7451289",
"0.7389407",
"0.7123383",
"0.70414937",
"0.7039762",
"0.69669527",
"0.69507825",
"0.69205093",
"0.69205093",
"0.69205093",
"0.6823596",
"0.68017983",
"0.67675036",
"0.672222",
"0.6675939",
"0.6646776",
"0.6646776",
"0.6646776",
"0.6630... | 0.66462934 | 20 |
Call f on each item in seq, calling inter() in between. | def interleave(inter, f, seq):
seq = iter(seq)
try:
f(next(seq))
except StopIteration:
pass
else:
for x in seq:
inter()
f(x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sequence(f, lst: list) -> list:\n ret = []\n for ele in lst:\n ret.append(f(ele))\n return ret",
"def intersperse(value, seq):\n seq = iter(seq)\n\n try:\n yield next(seq)\n except StopIteration:\n return\n\n for item in seq:\n yield value\n yield item"... | [
"0.61680573",
"0.6034688",
"0.6013112",
"0.5890083",
"0.5763176",
"0.5744706",
"0.5691687",
"0.5686545",
"0.56322396",
"0.5617056",
"0.5564194",
"0.55386853",
"0.55105126",
"0.5491585",
"0.5479231",
"0.5478667",
"0.5475974",
"0.54754245",
"0.5453396",
"0.5437749",
"0.5408432"... | 0.77389354 | 0 |
Update the graph by redrawing the internal texture data. | def update_graph(self, delta_time: float):
# Skip update if there is no SpriteList that can draw this graph
if self.sprite_lists is None or len(self.sprite_lists) == 0:
return
sprite_list = self.sprite_lists[0]
# Clear and return if timings are disabled
if not arca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _redraw_graph(self) -> None:\n self._clear_drawing()\n self.draw_graph(graph=self.graph, axes=self.subplot)\n self.draw_graph(graph=self.graph2, axes=self.subplot2)\n self.draw_mappings(self.mapping)",
"def _update_current_graph(self, **kwargs):\n\n self.current_graph.redra... | [
"0.73301584",
"0.7203513",
"0.7171285",
"0.7122468",
"0.6981086",
"0.682984",
"0.6811901",
"0.6716891",
"0.66613007",
"0.65672034",
"0.6497443",
"0.6478494",
"0.6450372",
"0.64425576",
"0.63823295",
"0.6361715",
"0.6361715",
"0.63509274",
"0.634727",
"0.6336588",
"0.6336588",... | 0.6214974 | 28 |
Remove selected items from the tree. Because data is stored separately also need to deal with it, but deleting the matching items from the data list and updating all of the data indexes is a bit of a headache, so just make them empty. | def remove_treeItem(browser, tree):
items = tree.selectedItems()
for item in items:
if item.listIndex: # Only dataset items have a listIndex
browser.ui.workingDataTree.dataItems[item.listIndex] = []
sip.delete(item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_selected(self):\n if not self.tree_widget.selectedItems():\n self.configuration_widgets.logger.warning('Nothing has been selected. Please select an item and try again.')\n return\n _selected_items = self.tree_widget.selectedItems()\n root = self.tree_widget.inv... | [
"0.72222024",
"0.67945594",
"0.6788877",
"0.6749571",
"0.66043264",
"0.6599819",
"0.65675104",
"0.6546712",
"0.6505644",
"0.634928",
"0.6347942",
"0.6327042",
"0.632324",
"0.63223594",
"0.62746567",
"0.6272785",
"0.6232611",
"0.6196286",
"0.61239",
"0.6118763",
"0.6097092",
... | 0.72647107 | 0 |
Helper function to convert SPARQL results into a Pandas data frame. | def get_sparql_dataframe(query, service = "https://query.wikidata.org/sparql"):
sparql = SPARQLWrapper(service)
sparql.setQuery(query)
sparql.setReturnFormat(JSON)
result = sparql.query()
processed_results = json.load(result.response)
cols = processed_results['head']['vars']
out = []
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sparql_dataframe(service, query):\n sparql = SPARQLWrapper(service)\n sparql.setQuery(query)\n sparql.setReturnFormat(JSON)\n result = sparql.query()\n\n processed_results = json.load(result.response)\n cols = processed_results['head']['vars']\n\n out = []\n... | [
"0.7584528",
"0.7129623",
"0.7129623",
"0.711426",
"0.7094009",
"0.7050637",
"0.70471936",
"0.6952182",
"0.6945529",
"0.6940668",
"0.6868899",
"0.6827423",
"0.6801506",
"0.6724016",
"0.67137694",
"0.6685681",
"0.6672927",
"0.6663773",
"0.66266656",
"0.6613739",
"0.6602476",
... | 0.7614764 | 0 |
Return the piece's horizontal position. Property is used here so we only compute position once when needed. | def x(self):
if self._x is None:
self.compute_coordinates()
return self._x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_horizontal(self, position):\n pass",
"def get_horizontal(self, x, y):\n\n return self._board[y]",
"def horizontal(self):\n return self._horizontal",
"def _get_x(self):\n return self.position.x",
"def get_x_position(self):\n return self.rect.x",
"def horiz_center... | [
"0.7555169",
"0.71737736",
"0.68906856",
"0.67113984",
"0.66651046",
"0.6657736",
"0.6657736",
"0.66271603",
"0.6555104",
"0.6521626",
"0.64567375",
"0.63844174",
"0.6338153",
"0.6338153",
"0.6300035",
"0.6295312",
"0.6227775",
"0.6223017",
"0.62109965",
"0.620136",
"0.615026... | 0.0 | -1 |
Return the piece's vertical position. Property is used here so we only compute position once when needed. | def y(self):
if self._y is None:
self.compute_coordinates()
return self._y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_y_position(self): \n return self.rect.y",
"def _get_y(self):\n return self.position.y",
"def get_y(self):\n return self.posY",
"def get_pos_y(self):\n return self.__pos_y",
"def get_y_position(self):\n return self.actual_coordinates[1]",
"def y(self):\r\n... | [
"0.72299945",
"0.71392894",
"0.70769536",
"0.69982135",
"0.6946308",
"0.69392604",
"0.67431444",
"0.6726614",
"0.6718979",
"0.67096394",
"0.668686",
"0.66658616",
"0.6653479",
"0.6539394",
"0.65354824",
"0.6437881",
"0.6415131",
"0.6410589",
"0.6389794",
"0.63825667",
"0.6372... | 0.0 | -1 |
Return the minimum value. | def native_min_value(self) -> float:
return TEMP_MINIMUM | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_minimum(self):\n return self._minimum",
"def find_min(self):\n return self.min",
"def find_min(self):\n return self.min",
"def min(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"min\")",
"def min(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"mi... | [
"0.87291557",
"0.8631156",
"0.8631156",
"0.85999566",
"0.85999566",
"0.85038835",
"0.8491322",
"0.8482031",
"0.8466204",
"0.8466204",
"0.8432562",
"0.8430932",
"0.8430932",
"0.8421418",
"0.8405366",
"0.8311868",
"0.82909995",
"0.8286746",
"0.8284653",
"0.8281578",
"0.8255062"... | 0.8165567 | 22 |
Return the maximum value. | def native_max_value(self) -> float:
return TEMP_MAXIMUM | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max_value(self):\n max_value = max(self.values)\n return max_value",
"def _get_maximum(self):\n return self._maximum",
"def get_max(self):\n return self._max",
"def get_max(self):\n return self.max[-1]",
"def _get_maximum_value(self):\n if hasattr(self, '_m... | [
"0.8933136",
"0.88841957",
"0.87473977",
"0.861131",
"0.8606676",
"0.85935724",
"0.8586842",
"0.8532539",
"0.8532539",
"0.8495911",
"0.8495911",
"0.8488697",
"0.8487578",
"0.8399635",
"0.83845997",
"0.836424",
"0.83359325",
"0.8262177",
"0.8261219",
"0.8261219",
"0.8256761",
... | 0.8079731 | 31 |
Return Name of device. | def name(self):
return f"{get_device_name(self._data, 0, self._name)}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._device.name",
"def name(self):\n return self._device.name",
"def name(self):\n return self._device.name",
"def name(self):\n return self.device.name()",
"def name(self):\n return self.device.device_data[self.device_id]['name']",
"def devic... | [
"0.891022",
"0.891022",
"0.891022",
"0.8865886",
"0.87226844",
"0.8687004",
"0.8687004",
"0.8627558",
"0.8609878",
"0.8509157",
"0.8509157",
"0.8476352",
"0.84732556",
"0.8449398",
"0.8261127",
"0.8234234",
"0.8221397",
"0.81503457",
"0.81250376",
"0.8083982",
"0.79021084",
... | 0.8831564 | 4 |
Return device specific attributes. | def device_info(self):
return {
"name": get_device_name(self._data, 0),
"identifiers": {(DOMAIN, get_identifier(self._data, 0))},
"manufacturer": MANUFACTURER,
"model": self._data.wiserhub.system.product_type,
"sw_version": self._data.wiserhub.system.f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes(self, device_id=0):\n\t\t\treturn cuda.Device(device_id).get_attributes()",
"def device_info(self) -> Optional[Dict[str, Any]]:\n return {ATTR_NAME: self.name, \"identifiers\": {(DOMAIN, self._device.device_id)}}",
"def device_state_attributes(self):\n attrs = {\n ATTR_A... | [
"0.80724686",
"0.7450437",
"0.742771",
"0.7409806",
"0.7293218",
"0.72523683",
"0.72523683",
"0.719905",
"0.7175151",
"0.7155777",
"0.7155777",
"0.71476424",
"0.7145971",
"0.71375567",
"0.7095317",
"0.7051197",
"0.703671",
"0.7035435",
"0.7017325",
"0.7013673",
"0.70050514",
... | 0.6574845 | 83 |
Return the minimum value. | def native_min_value(self) -> float:
return -9 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_minimum(self):\n return self._minimum",
"def find_min(self):\n return self.min",
"def find_min(self):\n return self.min",
"def min(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"min\")",
"def min(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"mi... | [
"0.87291557",
"0.8631156",
"0.8631156",
"0.85999566",
"0.85999566",
"0.85038835",
"0.8491322",
"0.8482031",
"0.8466204",
"0.8466204",
"0.8432562",
"0.8430932",
"0.8430932",
"0.8421418",
"0.8405366",
"0.8311868",
"0.82909995",
"0.8286746",
"0.8284653",
"0.8281578",
"0.8255062"... | 0.7826625 | 38 |
Return the maximum value. | def native_max_value(self) -> float:
return 9 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max_value(self):\n max_value = max(self.values)\n return max_value",
"def _get_maximum(self):\n return self._maximum",
"def get_max(self):\n return self._max",
"def get_max(self):\n return self.max[-1]",
"def _get_maximum_value(self):\n if hasattr(self, '_m... | [
"0.8933136",
"0.88841957",
"0.87473977",
"0.861131",
"0.8606676",
"0.85935724",
"0.8586842",
"0.8532539",
"0.8532539",
"0.8495911",
"0.8495911",
"0.8488697",
"0.8487578",
"0.8399635",
"0.83845997",
"0.836424",
"0.83359325",
"0.8262177",
"0.8261219",
"0.8261219",
"0.8256761",
... | 0.7767184 | 55 |
Return Name of device. | def name(self):
return f"{get_device_name(self._data, self._actuator.id)} Floor Temp Offset" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._device.name",
"def name(self):\n return self._device.name",
"def name(self):\n return self._device.name",
"def name(self):\n return self.device.name()",
"def name(self):\n return f\"{get_device_name(self._data, 0, self._name)}\"",
"def nam... | [
"0.891022",
"0.891022",
"0.891022",
"0.8865886",
"0.8831564",
"0.87226844",
"0.8687004",
"0.8687004",
"0.8627558",
"0.8609878",
"0.8509157",
"0.8509157",
"0.8476352",
"0.84732556",
"0.8449398",
"0.8261127",
"0.8234234",
"0.8221397",
"0.81503457",
"0.81250376",
"0.8083982",
... | 0.0 | -1 |
Return device specific attributes. | def device_info(self):
return {
"name": get_device_name(self._data, self._actuator.id),
"identifiers": {(DOMAIN, get_identifier(self._data, self._actuator.id))},
"via_device": (DOMAIN, self._data.wiserhub.system.name),
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes(self, device_id=0):\n\t\t\treturn cuda.Device(device_id).get_attributes()",
"def device_info(self) -> Optional[Dict[str, Any]]:\n return {ATTR_NAME: self.name, \"identifiers\": {(DOMAIN, self._device.device_id)}}",
"def device_state_attributes(self):\n attrs = {\n ATTR_A... | [
"0.80724686",
"0.7450437",
"0.742771",
"0.7409806",
"0.7293218",
"0.72523683",
"0.72523683",
"0.719905",
"0.7175151",
"0.7155777",
"0.7155777",
"0.71476424",
"0.7145971",
"0.71375567",
"0.7095317",
"0.7051197",
"0.703671",
"0.7035435",
"0.7017325",
"0.7013673",
"0.70050514",
... | 0.6660786 | 72 |
Generate center offset for crop window | def center_crop(image, source=(218, 178, 3), target=128):
height, width, channel = source
off_h = np.ceil((height - target) / 2).astype(int)
off_w = np.ceil((width - target) / 2).astype(int)
return image[off_h: off_h+target, off_w: off_w+target, :] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center(self):\n # minz to offset the heights to 0\n mz = (self.maxz-self.minz)/2\n #mz = self.minz\n return (self.minx + self.width / 2, self.miny + self.height / 2, mz)",
"def calculate_window_position(self):\n self.x = SQUARE_SIZE * self.col + SQUARE_SIZE // 2\n se... | [
"0.6784088",
"0.6756137",
"0.6714128",
"0.6631258",
"0.6611774",
"0.6609801",
"0.6596732",
"0.6587204",
"0.6557443",
"0.6556682",
"0.6531438",
"0.6452741",
"0.64465266",
"0.64361143",
"0.6413167",
"0.6385451",
"0.63821167",
"0.6377177",
"0.6372448",
"0.6344084",
"0.6343337",
... | 0.6065056 | 52 |
Get string with the sim's config_params, inputs, and outputs for the model | def _get_sim_config_str(self):
log = "[FMU Validator] The set of configuration_parameters, inputs, and outputs defined is the following:\n"
log += "\n{}: {}".format("Sim Config Params -- Brain Config ", self.sim_config_params)
log += "\n{}: {}".format("Sim Inputs -- Brain Act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_config(model_name, args):\n if model_name == 'Tacotron2':\n model_config = dict(\n # optimization\n mask_padding=args.mask_padding,\n # audio\n n_mel_channels=args.n_mel_channels,\n # symbols\n n_symbols=args.n_symbols,\n ... | [
"0.63613605",
"0.6227064",
"0.6027238",
"0.6021502",
"0.59806687",
"0.59724784",
"0.58838063",
"0.5799649",
"0.5774296",
"0.57192713",
"0.5702105",
"0.57006687",
"0.568292",
"0.56661975",
"0.5660352",
"0.5649805",
"0.56424356",
"0.56185853",
"0.56185603",
"0.5617623",
"0.5615... | 0.737774 | 0 |
Initialize model in the sequential manner required. | def initialize_model(self, config_param_vals = None):
self._is_initialized = True
self.fmu.instantiate()
self.fmu.reset()
self.fmu.setupExperiment(startTime=self.start_time)
if config_param_vals is not None:
self._apply_config(config_param_vals)
self.fmu.ente... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_model(self):\n pass",
"def init_model(self):\n pass",
"def initialize(self, model):\n pass",
"def initialize(self):\n LOG.info(\"Initializing Model.\")\n self.model = self.convert(df=self.training_df)\n if self.bootstraps is not None:\n LOG.... | [
"0.7742976",
"0.7590463",
"0.759012",
"0.74840647",
"0.7275883",
"0.70921814",
"0.6888844",
"0.68874913",
"0.68849003",
"0.6871453",
"0.68196464",
"0.6760278",
"0.67510974",
"0.6709929",
"0.66639215",
"0.6652089",
"0.6573573",
"0.6572885",
"0.6565885",
"0.6531906",
"0.6519555... | 0.6732077 | 13 |
Get var indices for each (valid) var name provided in list. If none are provided, all outputs are returned. | def get_states(self, sim_outputs: List = None):
# Ensure model has been initialized at least once
self._model_has_been_initialized("get_states")
if sim_outputs is None:
sim_outputs = self.sim_outputs
elif not len(sim_outputs) > 0:
sim_outputs = self.sim_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _var_names_to_indices(self, var_names: List):\n\n if type(var_names) is not type([]):\n # Return empty array if input is not 'list' type\n print(\"[_var_names_to_indices] Provided input is not of type list.\")\n return []\n\n indices_array = []\n names_arra... | [
"0.7106208",
"0.6794905",
"0.6497141",
"0.6025208",
"0.5968013",
"0.5913243",
"0.5865424",
"0.5832427",
"0.57964826",
"0.57409185",
"0.5729248",
"0.57017255",
"0.5681039",
"0.5604614",
"0.5604506",
"0.5603223",
"0.5594183",
"0.55620307",
"0.5516843",
"0.54871476",
"0.5463308"... | 0.0 | -1 |
Get a list of all variables in the sim (removing duplicates, if any). Note, list is kept the same from first time this method is called. | def get_all_var_names(self):
if hasattr(self, "all_var_names"):
return self.all_var_names
# Append all variables in model (defined in YAML).
aux_all_var_names = []
aux_all_var_names.extend(self.sim_config_params)
aux_all_var_names.extend(self.sim_inputs)
aux... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_variables(self):\n return []",
"def get_all_variables(self):\n out = []\n for i in self.items:\n out += i.get_all_variables()\n return out",
"def get_all_variables(self):\n out = []\n for i in self.items:\n out += i.get_all_variables()... | [
"0.7587621",
"0.74283415",
"0.74283415",
"0.74283415",
"0.74034715",
"0.73497486",
"0.73163354",
"0.71726215",
"0.7025907",
"0.6996247",
"0.6937989",
"0.6923813",
"0.67796665",
"0.6772739",
"0.67677814",
"0.67526543",
"0.6719864",
"0.6713113",
"0.6711427",
"0.67106885",
"0.66... | 0.7627399 | 0 |
Get var indices for each (valid) var name provided in list. | def _get_variables(self, sim_outputs: List = None):
# Ensure model has been initialized at least once
self._model_has_been_initialized("_get_variables")
# Ensure array is not empty
if sim_outputs is None:
return {}
elif not len(sim_outputs) > 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indices_of_var(v):\n name = v.varName\n indices = name[2:].split(',')\n i, j = int(indices[0]), int(indices[1])\n return i, j",
"def _var_names_to_indices(self, var_names: List):\n\n if type(var_names) is not type([]):\n # Return empty array if input is not 'list... | [
"0.7444971",
"0.7400322",
"0.6825618",
"0.61766595",
"0.6171719",
"0.6141269",
"0.604002",
"0.6002675",
"0.5954537",
"0.58911085",
"0.5872941",
"0.5856526",
"0.5843315",
"0.58359766",
"0.57936394",
"0.579151",
"0.5744204",
"0.5717505",
"0.57010794",
"0.56933683",
"0.5685582",... | 0.0 | -1 |
Get var indices for each var name provided in list. | def _var_names_to_indices(self, var_names: List):
if type(var_names) is not type([]):
# Return empty array if input is not 'list' type
print("[_var_names_to_indices] Provided input is not of type list.")
return []
indices_array = []
names_array = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indices_of_var(v):\n name = v.varName\n indices = name[2:].split(',')\n i, j = int(indices[0]), int(indices[1])\n return i, j",
"def index(self, variables):\n return [self._variables.index(v) for v in variables]",
"def vars(self):\n return [Var(i,self.dims[i]) for i in... | [
"0.74116653",
"0.6916294",
"0.61451054",
"0.611666",
"0.59596854",
"0.5946558",
"0.5905192",
"0.5892637",
"0.58531195",
"0.5848885",
"0.5842754",
"0.5840236",
"0.58368546",
"0.5804591",
"0.5756725",
"0.5740407",
"0.57103246",
"0.56983846",
"0.56811184",
"0.5670195",
"0.565843... | 0.72467065 | 1 |
Modify the specified group defaults. | def config(gvar):
mandatory = []
required = []
optional = ['-cc', '-ckv', '-CSEP', '-CSV', '-g', '-H', '-h', '-NV', '-ok', '-r', '-s', '-V', '-VC', '-v', '-x509', '-xA']
if gvar['retrieve_options']:
return mandatory + required + optional
# Check for missing arguments or help required.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_defaults(self, **kw):\n group = kw.pop('group', None)\n for o, v in kw.items():\n self.cfg_fixture.set_default(o, v, group=group)",
"def _getGroupDefaults(self):\n defaults = self.getDefaultGroupContainer(\n _name = \"defaults\",\n diff_command = self... | [
"0.7184848",
"0.6596516",
"0.6438077",
"0.6252312",
"0.6243312",
"0.6232612",
"0.62150013",
"0.59281456",
"0.59254956",
"0.59022254",
"0.589668",
"0.587396",
"0.58705354",
"0.58090675",
"0.58086026",
"0.5792662",
"0.5790622",
"0.5790524",
"0.5772414",
"0.5770209",
"0.57333934... | 0.0 | -1 |
Gets the current team's score from the API | def _get_current_teams_score(self):
for game in self._get_live_games():
teams_playing = [x['abbreviation'] for index, x in game['teams'].items()]
if self.team in teams_playing:
# Our team is playing in this game, get the score
return int(ga... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score(self):\n return self.client.call('GET', self.name + 'score')",
"def getScore(data):\n return score",
"def get_score(self):\n return self.score",
"def get_scores(self):\n return self.score",
"def get_score(self):\n return self.score",
"def get_score(self):\n ret... | [
"0.7527059",
"0.72310585",
"0.6813954",
"0.681293",
"0.675793",
"0.675793",
"0.675793",
"0.66784096",
"0.66253316",
"0.6584562",
"0.6568987",
"0.6539687",
"0.6478145",
"0.6478145",
"0.6478145",
"0.64599675",
"0.6432476",
"0.63932824",
"0.63802594",
"0.6361858",
"0.6353685",
... | 0.7543717 | 0 |
Determines if two polarized photons are identical (same energy, direction and polarization). | def __eq__(self, candidate):
if ((self.energy() == candidate.energy() and
self.unitDirectionVector() == candidate.unitDirectionVector()) and
self._Esigma.complexAmplitude() == candidate._Esigma.complexAmplitude() and
self._Epi.complexAmplitude() == candidate._Epi.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_similar_with(self, other):\n\n # corresponding angles are congruent\n if self.angles != other.angles:\n return False\n # corresponding sides are proportional\n proportion = self.perimeter() / other.perimeter()\n for i in range(len(self.lengths)):\n if... | [
"0.68101615",
"0.6614083",
"0.65789586",
"0.64757085",
"0.64612556",
"0.6421079",
"0.6401745",
"0.63870627",
"0.63730395",
"0.6364115",
"0.6333348",
"0.6290905",
"0.6201502",
"0.6198665",
"0.6136013",
"0.6116805",
"0.6093822",
"0.6086045",
"0.60715705",
"0.606903",
"0.6060494... | 0.5732779 | 84 |
Determines if two polarized photons are not identical (same energy, direction and polarization). | def __ne__(self, candidate):
return not (self == candidate) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_similar_with(self, other):\n\n # corresponding angles are congruent\n if self.angles != other.angles:\n return False\n # corresponding sides are proportional\n proportion = self.perimeter() / other.perimeter()\n for i in range(len(self.lengths)):\n if... | [
"0.67724645",
"0.6738176",
"0.65756047",
"0.6330637",
"0.63286847",
"0.6316591",
"0.63129854",
"0.6303219",
"0.62443715",
"0.62213105",
"0.61847687",
"0.61709136",
"0.6159082",
"0.61590666",
"0.6127881",
"0.6122283",
"0.60869306",
"0.607861",
"0.6044467",
"0.6021837",
"0.6010... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.