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 |
|---|---|---|---|---|---|---|
Gets the ``ResourceFormRecord`` corresponding to the given ``Resource`` record ``Type``. | def get_resource_form_record(self, resource_record_type):
return self._get_record(resource_record_type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_record(self, resource_record_type):\n return self._get_record(resource_record_type)",
"def get_objective_form_record(self, objective_record_type=None):\n if not self.has_record_type():\n raise Unsupported()\n else: # This should never get called:\n rai... | [
"0.8114026",
"0.63643396",
"0.6115171",
"0.5902211",
"0.5902211",
"0.5881822",
"0.5881822",
"0.5881822",
"0.5881822",
"0.5881822",
"0.5869668",
"0.57236433",
"0.5706427",
"0.568179",
"0.5671516",
"0.565137",
"0.5612121",
"0.54968446",
"0.5375285",
"0.5368652",
"0.5360401",
... | 0.8896213 | 0 |
Gets the next set of ``Resources`` in this list which must be less than or equal to the return from ``available()``. | def get_next_resources(self, n):
# Implemented from template for osid.resource.ResourceList.get_next_resources
return self._get_next_n(n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_resource(self):\n # Implemented from template for osid.resource.ResourceList.get_next_resource\n return self.next()",
"def _get_resources(self):\n while not self.is_stopped():\n pools = self.poolsonline.get_pools()\n tx_source = self.txonline.get_txsource()... | [
"0.65612185",
"0.6401355",
"0.6121206",
"0.60583377",
"0.6016034",
"0.59600174",
"0.59473145",
"0.58860904",
"0.5828736",
"0.5770873",
"0.57343775",
"0.5688375",
"0.566502",
"0.56185544",
"0.56173027",
"0.55503136",
"0.55426097",
"0.5541751",
"0.55347824",
"0.5529835",
"0.552... | 0.6636154 | 0 |
Gets the next set of ``ResourceNode`` elements in this list which must be less than or equal to the return from ``available()``. | def get_next_resource_nodes(self, n):
# Implemented from template for osid.resource.ResourceList.get_next_resources
return self._get_next_n(n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_nodes(self, n):\n # Implemented from template for osid.resource.ResourceList.get_next_resources\n return self._get_next_n(NodeList, number=n)",
"def get_next_resource_node(self):\n # Implemented from template for osid.resource.ResourceList.get_next_resource\n return self.... | [
"0.6473394",
"0.6357391",
"0.63307804",
"0.6319509",
"0.63064384",
"0.6153868",
"0.60976076",
"0.6038041",
"0.5946407",
"0.5804482",
"0.5687243",
"0.5638405",
"0.5632529",
"0.56031364",
"0.5590442",
"0.5584528",
"0.556064",
"0.55472296",
"0.5536389",
"0.54977524",
"0.5435139"... | 0.66828656 | 0 |
Gets the ``BinFormRecord`` corresponding to the given bin record ``Type``. | def get_bin_form_record(self, bin_record_type):
raise errors.Unimplemented() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bin_record(self, bin_record_type):\n raise errors.Unimplemented()",
"def get_resource_form_record(self, resource_record_type):\n return self._get_record(resource_record_type)",
"def get_objective_bank_form_record(self, objective_bank_record_type=None):\n if not self.has_record_type... | [
"0.76395875",
"0.6350303",
"0.6322135",
"0.59491175",
"0.5929034",
"0.5660361",
"0.55663604",
"0.55266815",
"0.5522816",
"0.5234059",
"0.5126783",
"0.50803465",
"0.50496984",
"0.5048158",
"0.5013959",
"0.501297",
"0.49860224",
"0.49262288",
"0.49032575",
"0.49029773",
"0.4802... | 0.7901537 | 0 |
Gets the next set of ``BinNode`` elements in this list which must be less than or equal to the return from ``available()``. | def get_next_bin_nodes(self, n):
# Implemented from template for osid.resource.ResourceList.get_next_resources
return self._get_next_n(n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_bin_node(self):\n # Implemented from template for osid.resource.ResourceList.get_next_resource\n return self.next()",
"def get_next_bins(self, n):\n # Implemented from template for osid.resource.ResourceList.get_next_resources\n return self._get_next_n(n)",
"def get_nex... | [
"0.59445167",
"0.58556384",
"0.576406",
"0.5717004",
"0.56051326",
"0.5600046",
"0.5416213",
"0.5414245",
"0.5339423",
"0.53079945",
"0.5283764",
"0.52790844",
"0.5242928",
"0.5174627",
"0.5161861",
"0.5159243",
"0.51428765",
"0.51175845",
"0.5080029",
"0.5079916",
"0.5078348... | 0.6404579 | 0 |
Sends a 401 response that enables basic auth | def authenticate():
return Response(
'Could not verify your access level for that URL.\n'
'You have to login with proper credentials', 401,
{'WWW-Authenticate': 'Basic realm="Login Required"'}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})",
"def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )",
"def authenticate():\n return Response(\n 'You have to login with pro... | [
"0.8093736",
"0.80926424",
"0.7958403",
"0.7852648",
"0.7843114",
"0.7824419",
"0.776624",
"0.7754693",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.771945",
"0.7667712",
"0.7664151",
"0.76493174",
"0.76140213",
"0.76131... | 0.7810746 | 23 |
function [file_paths] = get_filepaths(audio_path, random_seed) % retrieves all the wav file names and relative path given the directory | def get_filepaths(audio_path, random_seed=None, forbid_list=[],ext='.wav'):
import os
import os.path as op
file_paths = []
# root
dir_list = os.listdir(audio_path)
# recursive search
for dir_ind in range(len(dir_list)):
if op.isdir(op.join(audio_path, dir_list[dir_ind])):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_paths():\n audio_folder = MY_DIR + '/assets'\n\n audio_addy_list = []\n for file in os.scandir(audio_folder):\n audio_addy_list.append(file.path)\n\n return audio_addy_list",
"def get_filepaths(directory):\n file_paths = [] # List which will store all of the full filepaths.\n\... | [
"0.79408836",
"0.73347616",
"0.6870975",
"0.68481165",
"0.68045294",
"0.6772409",
"0.6743666",
"0.6708103",
"0.6687669",
"0.6686756",
"0.6595322",
"0.6591728",
"0.6544094",
"0.6538474",
"0.65279245",
"0.6458737",
"0.6454211",
"0.6425526",
"0.6410728",
"0.64033353",
"0.6398313... | 0.834215 | 0 |
Return the path of the scikitlearn data dir. This folder is used by some large dataset loaders to avoid downloading the data several times. By default the data dir is set to a folder named 'scikit_learn_data' in the user home folder. Alternatively, it can be set by the 'SCIKIT_LEARN_DATA' environment variable or progra... | def get_data_home(data_home=None):
if data_home is None:
data_home = environ.get('SCIKIT_LEARN_DATA',
join('~', 'scikit_learn_data'))
data_home = expanduser(data_home)
if not exists(data_home):
makedirs(data_home)
return data_home | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_home(data_home=None):\n if data_home is None:\n data_home = environ.get('SCIKIT_LEARN_DATA', join('~', 'scikit_learn_data'))\n data_home = expanduser(data_home)\n if not exists(data_home):\n makedirs(data_home)\n return data_home",
"def get_default_data_dir(self):\n ... | [
"0.7657915",
"0.7147269",
"0.7098689",
"0.7096353",
"0.7079629",
"0.7064052",
"0.7050303",
"0.69244206",
"0.68462706",
"0.6803429",
"0.6788369",
"0.6781332",
"0.6775683",
"0.6769589",
"0.67064375",
"0.6695528",
"0.6679058",
"0.6678804",
"0.66667247",
"0.66593856",
"0.6659143"... | 0.7646861 | 1 |
>>> canonicalize(' stephens, michael jr.') 'Michael Stephens, Jr.' >>> canonicalize('MICHAEL, JR.') 'Michael, Jr.' >>> canonicalize('Father Michael X. y. stephens, III, u.s.c.g.') 'Father Michael X. Y. Stephens, III, U.S.C.G.' | def canonicalize(name):
prefixes, first_part, last_part, suffixes = split(name)
canonical = ""
if prefixes:
canonical = namecase(prefixes)
if first_part:
canonical += " " + namecase(first_part)
if last_part:
canonical += " " + namecase(last_part)
if suffixes:
cano... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(s):\r\n def remove_articles(text):\r\n return re.sub(r'\\b(a|an|the)\\b', ' ', text)\r\n\r\n def white_space_fix(text):\r\n return ' '.join(text.split())\r\n\r\n def remove_punc(text):\r\n exclude = set(string.punctuation)\r\n return ''.join(ch for ch in text if c... | [
"0.64167243",
"0.64167243",
"0.6341682",
"0.62192416",
"0.6200922",
"0.6119411",
"0.61097944",
"0.6052157",
"0.6021179",
"0.60111994",
"0.60080284",
"0.5901389",
"0.5871184",
"0.58688354",
"0.5848217",
"0.5847781",
"0.58303934",
"0.58262044",
"0.5794059",
"0.57823575",
"0.578... | 0.7591253 | 0 |
Generates an RTC token with the specified privilege. | def build_token_with_uid_and_privilege(app_id, app_certificate, channel_name, uid, token_expire,
join_channel_privilege_expire, pub_audio_privilege_expire,
pub_video_privilege_expire, pub_data_stream_privilege_expire):
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateToken():\n length = random.randint(8, 32)\n rdmtoken = ''.join(random.choice(string.printable) for i in range(length))\n return f'{rdmtoken}'",
"def generate(self):\n return self.rpc.call(MsfRpcMethod.AuthTokenGenerate)['token']",
"def token_gen_call(username, password, exp=None):\n... | [
"0.6177859",
"0.61124367",
"0.60145056",
"0.60012764",
"0.59970045",
"0.5931893",
"0.5929749",
"0.58733016",
"0.5835163",
"0.58077294",
"0.5805905",
"0.5768899",
"0.57535934",
"0.5749651",
"0.5745807",
"0.5737253",
"0.5701832",
"0.5674663",
"0.5657492",
"0.56534153",
"0.56466... | 0.5209797 | 65 |
Generates an RTC token with the specified privilege. | def build_token_with_user_account_and_privilege(app_id, app_certificate, channel_name, account, token_expire,
join_channel_privilege_expire, pub_audio_privilege_expire,
pub_video_privilege_expire, pub_data_stream_pri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateToken():\n length = random.randint(8, 32)\n rdmtoken = ''.join(random.choice(string.printable) for i in range(length))\n return f'{rdmtoken}'",
"def generate(self):\n return self.rpc.call(MsfRpcMethod.AuthTokenGenerate)['token']",
"def token_gen_call(username, password, exp=None):\n... | [
"0.6177859",
"0.61124367",
"0.60145056",
"0.60012764",
"0.59970045",
"0.5931893",
"0.5929749",
"0.58733016",
"0.5835163",
"0.58077294",
"0.5805905",
"0.5768899",
"0.57535934",
"0.5749651",
"0.5745807",
"0.5737253",
"0.5701832",
"0.5674663",
"0.5657492",
"0.56534153",
"0.56466... | 0.0 | -1 |
Returns a dictionary containing all relevant game data from a prespecified game URL. | def scrape_game_data(game_url):
try:
http = urllib3.PoolManager(
cert_reqs='CERT_REQUIRED', ca_certs=certifi.where())
# Get game soup object.
game_request = http.request("GET", game_url)
soup = BeautifulSoup(game_request.data, 'lxml')
# Store game data in dictio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_games(url):\n \n import urllib\n import urllib2\n import re\n\n response = urllib2.urlopen(url + 'matches')\n html = response.read()\n\n games_html = re.findall('<tr class=\"match-row custom\">(.*?)</tr', html, flags=re.MULTILINE|re.DOTALL)\n\n games = []\n\n for game_html in gam... | [
"0.69640094",
"0.67363846",
"0.6699869",
"0.66780084",
"0.64781296",
"0.6436138",
"0.6417165",
"0.63358027",
"0.62964916",
"0.6187616",
"0.6166611",
"0.616071",
"0.6006216",
"0.59907913",
"0.5968116",
"0.59670436",
"0.5942767",
"0.5936972",
"0.5904164",
"0.5886394",
"0.584255... | 0.77170837 | 0 |
The view for showing the list of Todos related to the specific/logged in user | def todo_list_view(request):
context = {}
queryset = Todo.objects.filter(user=request.user)
context['lists'] = queryset
return render(request,'todos/index.html', context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_own_todos(current_user: models.User = Depends(get_current_user),\n \tdb: Session = Depends(get_db)):\n todos = blogcrud.get_user_todos(db, current_user.id)\n return todos",
"def todos(self):\r\n return Todos(self)",
"def get(self):\n current_user = fjwte.get_current_user()... | [
"0.7033205",
"0.6709818",
"0.66809565",
"0.61853004",
"0.61743546",
"0.6079984",
"0.6020376",
"0.5945201",
"0.5935962",
"0.59119385",
"0.5876563",
"0.58759224",
"0.58131933",
"0.5804552",
"0.5762867",
"0.57591134",
"0.57350147",
"0.57276964",
"0.568772",
"0.56796557",
"0.5664... | 0.7513303 | 0 |
View for showing the send to todos | def sent_from_view(request):
context= {}
queryset_todos = Todo.objects.filter(user_id=request.user.id,send_to=True)
print(queryset_todos)
context['sent_to_tasks'] = queryset_todos
return render(request, "todos/send_to.html",context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sent_to_view(request):\n context= {}\n queryset_todos = Todo.objects.filter(user_to_id=request.user.id,send_from=True)\n context['sent_from_tasks'] = queryset_todos\n return render(request, \"todos/send_from.html\",context)",
"def sent_view(request, id):\n if request.method == \"POST\":\n ... | [
"0.75625527",
"0.6763483",
"0.6654114",
"0.633403",
"0.6321622",
"0.6223629",
"0.61309147",
"0.61185664",
"0.60374326",
"0.6028768",
"0.599504",
"0.5940193",
"0.59147215",
"0.5897176",
"0.5851755",
"0.5734201",
"0.5730541",
"0.57211554",
"0.57121557",
"0.57040745",
"0.5691619... | 0.7504154 | 1 |
Piecewise constant schedule for p (the fraction of pixels changed on every iteration). | def p_selection(p_init, it, n_iters):
it = int(it / n_iters * 10000)
if 10 < it <= 50:
p = p_init / 2
elif 50 < it <= 200:
p = p_init / 4
elif 200 < it <= 500:
p = p_init / 8
elif 500 < it <= 1000:
p = p_init / 16
elif 1000 < it <= 2000:
p = p_init / 32
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _precompute_xl(self, p: int) -> List[int]:\n res = [1]\n val = 1\n for _ in range(len(self._s)):\n val = (val * self.X) % p\n res.append(val)\n return res",
"def assign_cycle(fpc, frames):\n return np.int_(np.floor((frames - 1) / float(fpc)))",
"def P(la... | [
"0.60429853",
"0.584909",
"0.57990575",
"0.578226",
"0.5716971",
"0.5691461",
"0.56048113",
"0.558854",
"0.5567916",
"0.55380213",
"0.55248946",
"0.54820734",
"0.5477404",
"0.54684955",
"0.5456245",
"0.5453439",
"0.5447008",
"0.54366094",
"0.5429695",
"0.541954",
"0.54049426"... | 0.0 | -1 |
Given the filename of a json file `s`, load the data into a dict | def load(self, s):
self._filename = s
# self._isLoaded = True
with open(s, 'r') as f:
self._dict = json.load(f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_json(filename: str) -> Dict:\n \n with open(filename, 'r') as json_file:\n return json.load(json_file)",
"def json_dict(path):\n json_file=open(path)\n json_str = json_file.read()\n json_data = loads(json_str)\n return json_data",
"def load_json(self, filename):\n with ... | [
"0.7505042",
"0.744106",
"0.7434794",
"0.7432844",
"0.74265015",
"0.74252915",
"0.7390357",
"0.7376905",
"0.7373402",
"0.7370175",
"0.7364235",
"0.73016655",
"0.72611356",
"0.72352946",
"0.7192545",
"0.7165301",
"0.71451265",
"0.71190923",
"0.7108707",
"0.71069753",
"0.708146... | 0.7619517 | 0 |
Given the filename of a json file `s`, create an empty json file with name `s` | def create(self, s):
with open(s, 'w') as f:
json.dump({}, f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanJson(filename):\n saveFile = 'newFile.json'\n\n # check if file exists and exit if it does\n if os.path.exists(saveFile):\n return\n\n with open(filename) as f:\n contents = f.readlines()\n\n with open('newFile.json', 'a') as outfile:\n f... | [
"0.68947613",
"0.6828971",
"0.6789058",
"0.67272043",
"0.65251654",
"0.651649",
"0.6507765",
"0.6500502",
"0.64632493",
"0.646157",
"0.6432273",
"0.6413753",
"0.63709384",
"0.6318527",
"0.6298471",
"0.6250429",
"0.6246972",
"0.6240005",
"0.62293905",
"0.6223387",
"0.6217121",... | 0.71494937 | 0 |
Convert 3x4 rotation matrix to 4d quaternion vector This algorithm is based on algorithm described in | def rotation_matrix_to_quaternion(rotation_matrix, eps=1e-6):
if not torch.is_tensor(rotation_matrix):
raise TypeError("Input type is not a torch.Tensor. Got {}".format(
type(rotation_matrix)))
if len(rotation_matrix.shape) > 3:
raise ValueError(
"Input size must be a th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quaternion_to_rotation_matrix(quaternion):\n\n q_w, q_x, q_y, q_z = quaternion\n sqw, sqx, sqy, sqz = np.square(quaternion)\n norm = (sqx + sqy + sqz + sqw)\n rotation_matrix = np.zeros((3, 3))\n\n # division of square length if quaternion is not already normalized\n rotation_matrix[0, 0] = (... | [
"0.7430523",
"0.74075854",
"0.73727566",
"0.7352437",
"0.7319089",
"0.7306168",
"0.7300239",
"0.71791756",
"0.714137",
"0.7067987",
"0.6990699",
"0.6910989",
"0.6873358",
"0.6868551",
"0.6848725",
"0.6777988",
"0.6771096",
"0.67253315",
"0.6708334",
"0.6691572",
"0.66648585",... | 0.6967275 | 11 |
Convert quaternion vector to angle axis of rotation. | def quaternion_to_angle_axis(quaternion: torch.Tensor) -> torch.Tensor:
if not torch.is_tensor(quaternion):
raise TypeError("Input type is not a torch.Tensor. Got {}".format(
type(quaternion)))
if not quaternion.shape[-1] == 4:
raise ValueError("Input must be a tensor of shape Nx4 o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quaternion_to_angle_axis(quaternion):\n ha = np.arccos(quaternion[0])\n theta = 2 * ha\n if theta < np.finfo(float).eps:\n theta = 0\n axis = np.array([1, 0, 0])\n else:\n axis = quaternion[[1, 2, 3]] / np.sin(ha)\n return theta, axis",
"def angle(self, vector):\n\n ... | [
"0.7726628",
"0.7564264",
"0.7457957",
"0.7397182",
"0.7276913",
"0.7274693",
"0.71804863",
"0.71623415",
"0.7130426",
"0.71137214",
"0.7084112",
"0.70243806",
"0.69862956",
"0.69792867",
"0.69763714",
"0.6958844",
"0.6934655",
"0.6893215",
"0.6760437",
"0.6749934",
"0.672324... | 0.7805009 | 0 |
Convert an angle axis to a quaternion. | def angle_axis_to_quaternion(angle_axis: torch.Tensor) -> torch.Tensor:
if not torch.is_tensor(angle_axis):
raise TypeError("Input type is not a torch.Tensor. Got {}".format(
type(angle_axis)))
if not angle_axis.shape[-1] == 3:
raise ValueError("Input must be a tensor of shape Nx3 o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle_axis_to_quaternion(axis, theta):\n if isinstance(axis, string_types):\n axis = axis.lower()\n if axis == 'x':\n axis = np.array([1., 0., 0.])\n elif axis == 'y':\n axis = np.array([0., 1., 0.])\n elif axis == 'z':\n axis = np.array([0., 0., ... | [
"0.83636945",
"0.833984",
"0.81172186",
"0.7803691",
"0.77461237",
"0.77427244",
"0.76957905",
"0.7511654",
"0.74354535",
"0.74168724",
"0.73941493",
"0.71341485",
"0.69575065",
"0.6948961",
"0.6897747",
"0.6883086",
"0.6856147",
"0.684737",
"0.6843863",
"0.68381435",
"0.6721... | 0.83473754 | 1 |
Convert 3d vector of axisangle rotation to 4x4 rotation matrix | def angle_axis_to_rotation_matrix(angle_axis):
def _compute_rotation_matrix(angle_axis, theta2, eps=1e-6):
# We want to be careful to only evaluate the square root if the
# norm of the angle_axis vector is greater than zero. Otherwise
# we get a division by zero.
k_one = 1.0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def axis2rotmat(axis):\n return quat2rotmat(axis2quat(axis))",
"def rotation_matrix(angle, axis):\n about_z = rotation_about_z(angle)\n z_to_axis = z_to_vector(axis)\n axis_to_z = np.linalg.inv(z_to_axis)\n return reduce(np.dot, [z_to_axis, about_z, axis_to_z])",
"def get_3drotation_matrix(axis,... | [
"0.7820138",
"0.7698632",
"0.736527",
"0.7261709",
"0.7257929",
"0.7257929",
"0.72131455",
"0.7165621",
"0.7162307",
"0.7148236",
"0.7122914",
"0.70929146",
"0.703967",
"0.6977672",
"0.69135547",
"0.69001275",
"0.6888421",
"0.68580693",
"0.68488973",
"0.68031526",
"0.67919487... | 0.67611265 | 22 |
Convert axisangle representation to rotation matrix. | def rotvec_to_rotmat(rot_vecs):
l1norm = torch.norm(rot_vecs + 1e-8, p=2, dim=1)
angle = torch.unsqueeze(l1norm, -1)
normalized = torch.div(rot_vecs, angle)
angle = angle * 0.5
v_cos = torch.cos(angle)
v_sin = torch.sin(angle)
quat = torch.cat([v_cos, v_sin * normalized], dim=1)
return q... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def axis2rotmat(axis):\n return quat2rotmat(axis2quat(axis))",
"def rotation_matrix(angle, axis):\n about_z = rotation_about_z(angle)\n z_to_axis = z_to_vector(axis)\n axis_to_z = np.linalg.inv(z_to_axis)\n return reduce(np.dot, [z_to_axis, about_z, axis_to_z])",
"def angle_to_rotation_matrix(an... | [
"0.7975021",
"0.7776975",
"0.7642057",
"0.75718856",
"0.7484483",
"0.73852175",
"0.7374227",
"0.7331798",
"0.7323808",
"0.72060734",
"0.7166385",
"0.7143978",
"0.71211976",
"0.7071612",
"0.70691985",
"0.7067156",
"0.7056157",
"0.7056157",
"0.7034615",
"0.7027953",
"0.7001234"... | 0.0 | -1 |
Convert quaternion coefficients to rotation matrix. | def quat_to_rotmat(quat):
norm_quat = quat
norm_quat = norm_quat / norm_quat.norm(p=2, dim=1, keepdim=True)
w, x, y, z = norm_quat[:, 0], norm_quat[:, 1], norm_quat[:, 2], norm_quat[:, 3]
B = quat.size(0)
w2, x2, y2, z2 = w.pow(2), x.pow(2), y.pow(2), z.pow(2)
wx, wy, wz = w * x, w * y, w * z
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quaternion_to_rotation_matrix(quaternion):\n\n q_w, q_x, q_y, q_z = quaternion\n sqw, sqx, sqy, sqz = np.square(quaternion)\n norm = (sqx + sqy + sqz + sqw)\n rotation_matrix = np.zeros((3, 3))\n\n # division of square length if quaternion is not already normalized\n rotation_matrix[0, 0] = (... | [
"0.766764",
"0.74807197",
"0.7449608",
"0.74328333",
"0.7220313",
"0.72015715",
"0.7191453",
"0.707404",
"0.6943095",
"0.68846947",
"0.6883867",
"0.6883784",
"0.68494785",
"0.68053985",
"0.67934597",
"0.6773294",
"0.6758075",
"0.6731504",
"0.67070466",
"0.66784084",
"0.665743... | 0.6854609 | 12 |
Convert 6D rotation representation to 3x3 rotation matrix. Based on Zhou et al., "On the Continuity of Rotation Representations in Neural Networks", CVPR 2019 | def rot6d_to_rotmat(x):
x = x.view(-1, 3, 2)
a1 = x[:, :, 0]
a2 = x[:, :, 1]
b1 = F.normalize(a1)
b2 = F.normalize(a2 - torch.einsum('bi,bi->b', b1, a2).unsqueeze(-1) * b1)
b3 = torch.cross(b1, b2)
return torch.stack((b1, b2, b3), dim=-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rot6d_to_rotmat(x):\n x = x.view(-1,3,2)\n a1 = x[:, :, 0]\n a2 = x[:, :, 1]\n b1 = F.normalize(a1)\n b2 = F.normalize(a2 - torch.einsum('bi,bi->b', b1, a2).unsqueeze(-1) * b1)\n b3 = torch.cross(b1, b2)\n return torch.stack((b1, b2, b3), dim=-1)",
"def rotmat_to_rot6d(rotmat):\n\n ro... | [
"0.7787226",
"0.6994249",
"0.6880743",
"0.66545296",
"0.6611877",
"0.65365493",
"0.64730537",
"0.64339584",
"0.63570064",
"0.6319744",
"0.62810963",
"0.6258665",
"0.6245219",
"0.6242186",
"0.6231169",
"0.619827",
"0.61917555",
"0.618698",
"0.618135",
"0.61762416",
"0.61561465... | 0.775523 | 1 |
Convert 6D rotation representation to 3x3 rotation matrix. Based on Zhou et al., "On the Continuity of Rotation Representations in Neural Networks", CVPR 2019 | def rotmat_to_rot6d(rotmat):
rot6d = rotmat[:, :, 0:2]
rot6d = rot6d.reshape(-1, 6)
return rot6d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rot6d_to_rotmat(x):\n x = x.view(-1,3,2)\n a1 = x[:, :, 0]\n a2 = x[:, :, 1]\n b1 = F.normalize(a1)\n b2 = F.normalize(a2 - torch.einsum('bi,bi->b', b1, a2).unsqueeze(-1) * b1)\n b3 = torch.cross(b1, b2)\n return torch.stack((b1, b2, b3), dim=-1)",
"def rot6d_to_rotmat(x):\n x = x.vie... | [
"0.7787226",
"0.775523",
"0.775523",
"0.6880743",
"0.66545296",
"0.6611877",
"0.65365493",
"0.64730537",
"0.64339584",
"0.63570064",
"0.6319744",
"0.62810963",
"0.6258665",
"0.6245219",
"0.6242186",
"0.6231169",
"0.619827",
"0.61917555",
"0.618698",
"0.618135",
"0.61762416",
... | 0.6994249 | 3 |
Find camera translation that brings 3D joints S closest to 2D the corresponding joints_2d. | def estimate_translation_np(S, joints_2d, joints_conf, focal_length=5000, img_size=224):
num_joints = S.shape[0]
# focal length
f = np.array([focal_length, focal_length])
# optical center
center = np.array([img_size / 2., img_size / 2.])
# transformations
Z = np.reshape(np.tile(S[:, 2], (2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimate_translation(S, joints_2d, focal_length=5000., img_size=224.):\n\n device = S.device\n # Use only joints 25:49 (GT joints)\n S = S[:, 25:, :].cpu().numpy()\n joints_2d = joints_2d[:, 25:, :].cpu().numpy()\n joints_conf = joints_2d[:, :, -1]\n joints_2d = joints_2d[:, :, :-1]\n tran... | [
"0.70690787",
"0.58126646",
"0.5759404",
"0.5624896",
"0.5605672",
"0.552901",
"0.55187887",
"0.55167884",
"0.5466802",
"0.5453866",
"0.54513586",
"0.54390156",
"0.5427653",
"0.54241675",
"0.53923094",
"0.5372861",
"0.53454864",
"0.53385323",
"0.5319584",
"0.5280605",
"0.5268... | 0.6892444 | 1 |
Find camera translation that brings 3D joints S closest to 2D the corresponding joints_2d. | def estimate_translation(S, joints_2d, focal_length=5000., img_size=224.):
device = S.device
# Use only joints 25:49 (GT joints)
S = S[:, 25:, :].cpu().numpy()
joints_2d = joints_2d[:, 25:, :].cpu().numpy()
joints_conf = joints_2d[:, :, -1]
joints_2d = joints_2d[:, :, :-1]
trans = np.zeros(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimate_translation_np(S, joints_2d, joints_conf, focal_length=5000, img_size=224):\n\n num_joints = S.shape[0]\n # focal length\n f = np.array([focal_length, focal_length])\n # optical center\n center = np.array([img_size / 2., img_size / 2.])\n\n # transformations\n Z = np.reshape(np.ti... | [
"0.6892122",
"0.5813326",
"0.57596755",
"0.5625946",
"0.56063974",
"0.5529417",
"0.55199766",
"0.5517657",
"0.54667264",
"0.5455694",
"0.5451711",
"0.5439911",
"0.5427756",
"0.54246503",
"0.5393163",
"0.53732246",
"0.53432107",
"0.5339496",
"0.53195435",
"0.52800804",
"0.5269... | 0.70694745 | 0 |
Get the name of the output device | def name(self) -> str:
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self.devname",
"def name(self):\n return self.device.name()",
"def find_iio_device_name(self):\n self.iio_device_dir()\n self.console.runcmd(f\"cat name\", expected=\"\\r\\n\")\n iio_device_name = self.console.output()\n return iio_device_name"... | [
"0.78411305",
"0.78044116",
"0.7798721",
"0.778798",
"0.778798",
"0.7783333",
"0.77314204",
"0.77314204",
"0.77314204",
"0.77298474",
"0.7551565",
"0.7551565",
"0.7549563",
"0.7508249",
"0.750488",
"0.7475357",
"0.74127376",
"0.7391572",
"0.7327417",
"0.728114",
"0.7238483",
... | 0.0 | -1 |
List of the topology processor nodes. Processor nodes enable pipeline data to be analyzed, processed or transformed. | def processors(self) -> Optional[Sequence['outputs.EncoderProcessorResponse']]:
return pulumi.get(self, "processors") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pipeline_nodes(self) -> List[Node]:\n return [node for pipeline in self.pipelines for node in pipeline.nodes]",
"def nodes(self) -> list:\n if \"nodes\" not in self._node:\n raise ValueError(\"Pipeline is missing 'nodes' field.\")\n\n if self._nodes is None:\n nodes... | [
"0.69471765",
"0.6666744",
"0.66612315",
"0.6250078",
"0.61622036",
"0.6126117",
"0.612206",
"0.6074143",
"0.60722476",
"0.60524774",
"0.6003524",
"0.6003171",
"0.5979547",
"0.59744424",
"0.5964258",
"0.5947013",
"0.5928705",
"0.58936256",
"0.58875686",
"0.585896",
"0.584983"... | 0.60809374 | 7 |
List of the topology sink nodes. Sink nodes allow pipeline data to be stored or exported. | def sinks(self) -> Sequence['outputs.VideoSinkResponse']:
return pulumi.get(self, "sinks") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sinks(self):\n s = [node for node in self.nodes() if node.isSink()]\n s.sort(lambda x,y: cmp(x._id, y._id))\n return s",
"def sinks(self):\n return [x for x in self if self.out_degree(x)==0]",
"def get_node_output_ports(node: Node):\n consumers = []\n for port in node.out_... | [
"0.76095486",
"0.6521484",
"0.6407674",
"0.62522364",
"0.6220328",
"0.6134058",
"0.61178017",
"0.60935324",
"0.60656965",
"0.6035068",
"0.59784496",
"0.58438224",
"0.58438224",
"0.583786",
"0.5788759",
"0.57554954",
"0.5729266",
"0.570403",
"0.57000524",
"0.56986874",
"0.5698... | 0.60297143 | 10 |
Describes the properties of a SKU. | def sku(self) -> 'outputs.SkuResponse':
return pulumi.get(self, "sku") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sku(self) -> pulumi.Output[Optional['outputs.SkuDescriptionResponse']]:\n return pulumi.get(self, \"sku\")",
"def sku(self) -> pulumi.Output[Optional['outputs.SkuDescriptionResponse']]:\n return pulumi.get(self, \"sku\")",
"def sku_name(self) -> str:\n return pulumi.get(self, \"sku_nam... | [
"0.7019912",
"0.7019912",
"0.6946467",
"0.6946467",
"0.6946467",
"0.68657416",
"0.67882097",
"0.6563517",
"0.65405715",
"0.6497165",
"0.6314768",
"0.63029766",
"0.6294722",
"0.6294722",
"0.6173166",
"0.6173166",
"0.60914415",
"0.60874104",
"0.60874104",
"0.6076422",
"0.606456... | 0.6738934 | 8 |
List of the topology source nodes. Source nodes enable external data to be ingested by the pipeline. | def sources(self) -> Sequence[Any]:
return pulumi.get(self, "sources") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodes(self):\n return self.source_net.nodes()",
"def sources(self):\n s = [node for node in self.nodes() if node.isSource()]\n s.sort(lambda x,y: cmp(x._id, y._id))\n return s",
"def node_sources(self, node):\r\n node = self.coalesce_node(node)\r\n nodes =[conn[0] ... | [
"0.7569548",
"0.7363873",
"0.709364",
"0.67269886",
"0.6720993",
"0.6720993",
"0.66930693",
"0.6561356",
"0.6524585",
"0.65102804",
"0.65064704",
"0.65045726",
"0.6447643",
"0.6380139",
"0.6359751",
"0.6352205",
"0.6352205",
"0.6352205",
"0.63520706",
"0.63279724",
"0.6327972... | 0.64759976 | 12 |
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" | def type(self) -> str:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")",
"def ... | [
"0.7919224",
"0.7919224",
"0.7866745",
"0.7866745",
"0.7866745",
"0.7866745",
"0.7866745",
"0.77080005",
"0.75534594",
"0.72829205",
"0.7059116",
"0.69795716",
"0.6921357",
"0.6870514",
"0.67292506",
"0.6704277",
"0.66535586",
"0.66464674",
"0.65499043",
"0.65428495",
"0.6542... | 0.66392237 | 52 |
Returns the html layout of the index page | def index_page(data):
main_index = [html.H1("INDEX"),
html.Div([html.A("Characters", href="/character"),
" | ", html.A("Search", href="/search")]),
dcc.Loading(html.Img(src=create_wordcloud(data["tokens"]))),
get_random_quotes(data, 5)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(self):\n\t\treturn render_template('index.html')",
"def index(self):\n return render_template('main/index.html')",
"def index():\r\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def get_index():\n return render_temp... | [
"0.79176563",
"0.7821534",
"0.7768826",
"0.77575135",
"0.7753974",
"0.77426475",
"0.77426475",
"0.7717761",
"0.7712107",
"0.76737106",
"0.7666473",
"0.76535004",
"0.76535004",
"0.7632842",
"0.7611945",
"0.7611945",
"0.7611945",
"0.7608864",
"0.7601731",
"0.7589659",
"0.758853... | 0.0 | -1 |
The datetime when the certificate will expire. | def expires_on(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "expires_on") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCertificateExpireDate(self):\n cert = self.getLatestValidCertification()\n if cert == None:\n return ''\n date = cert.getValidTo()\n return date",
"def expireDate(self)->datetime:\n return self.timeEnd",
"def expireDate(self)->datetime:\n return self.... | [
"0.7996598",
"0.7624414",
"0.7602747",
"0.73954225",
"0.73954225",
"0.73954225",
"0.73884034",
"0.73314625",
"0.7275715",
"0.71795106",
"0.7112877",
"0.7112877",
"0.70704716",
"0.7051682",
"0.6955021",
"0.6901758",
"0.6847449",
"0.6798216",
"0.6784174",
"0.674227",
"0.674227"... | 0.6298694 | 39 |
Get an existing OriginCaCertificate resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
certificate: Optional[pulumi.Input[str]] = None,
csr: Optional[pulumi.Input[str]] = None,
expires_on: Optional[pulumi.Input[str]] = None,
hostnames: O... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name, id, opts=None, arn=None, certificate=None, certificate_authority_configuration=None, certificate_chain=None, certificate_signing_request=None, enabled=None, not_after=None, not_before=None, permanent_deletion_time_in_days=None, revocation_configuration=None, serial=None, status=None, tags=No... | [
"0.6085143",
"0.55975753",
"0.5536226",
"0.5517182",
"0.5480525",
"0.542427",
"0.53656787",
"0.53411645",
"0.52540755",
"0.5210516",
"0.51844025",
"0.51349145",
"0.5035235",
"0.5029797",
"0.50162375",
"0.501561",
"0.49850914",
"0.49799126",
"0.49521336",
"0.49185273",
"0.4911... | 0.7188491 | 0 |
The datetime when the certificate will expire. | def expires_on(self) -> pulumi.Output[str]:
return pulumi.get(self, "expires_on") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCertificateExpireDate(self):\n cert = self.getLatestValidCertification()\n if cert == None:\n return ''\n date = cert.getValidTo()\n return date",
"def expireDate(self)->datetime:\n return self.timeEnd",
"def expireDate(self)->datetime:\n return self.... | [
"0.7996598",
"0.7624414",
"0.7602747",
"0.73954225",
"0.73954225",
"0.73954225",
"0.73884034",
"0.73314625",
"0.7275715",
"0.71795106",
"0.7112877",
"0.7112877",
"0.70704716",
"0.7051682",
"0.6955021",
"0.6901758",
"0.6847449",
"0.6798216",
"0.6784174",
"0.674227",
"0.674227"... | 0.65918016 | 26 |
Attach a lot of summaries to a Tensor (for TensorBoard visualization). | def variable_summaries(self, var):
with tf.name_scope('summaries'):
# 计算参数的均值,并使用tf.summary.scaler记录
mean = tf.reduce_mean(var)
tf.summary.scalar('mean', mean)
# 计算参数的标准差
with tf.name_scope('stddev'):
stddev = tf.sqrt(tf.reduce_mean(tf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_summary(self):\n for k, v in self.metrics.items():\n tf.summary.scalar(k, v)\n \n self.summary_op = tf.summary.merge_all()",
"def build_summaries(self):\n\n # Loss summary.\n tf.summary.scalar('loss', self.loss)\n\n merged = tf.summary.merge_all()\n self.summary_op = merged\n ... | [
"0.7071791",
"0.6970259",
"0.6970259",
"0.6800256",
"0.67872906",
"0.67407334",
"0.66669947",
"0.66576326",
"0.66193783",
"0.66085786",
"0.6595776",
"0.65836215",
"0.6581151",
"0.655297",
"0.6500364",
"0.6459978",
"0.64145213",
"0.6294558",
"0.62718755",
"0.62713677",
"0.6265... | 0.0 | -1 |
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. Notice that the solution set must not contain duplicate triplets. | def three_sum(nums: [int]) -> [[int]]:
check_validity(nums, 0, repetitive_numbers=True)
if len(nums) <= 2 or not nums:
return []
nums.sort()
result = []
for i in range(len(nums)):
left = i
middle = left + 1
right = len(nums) - 1
while left < right and middle <... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def threesumzero(a):\n result = set() # set to eliminate deuplicates!\n a.sort() # sort it\n n = len(a) # number of items in a\n for x in a: # for each element in a, see if its part of some triplet\n target_sum = 0 - x # x and other two items must sum to 0, so other two must sum to -x\n ... | [
"0.6673759",
"0.6650337",
"0.6568846",
"0.6489479",
"0.624624",
"0.62449473",
"0.61961734",
"0.61415535",
"0.6137072",
"0.6136448",
"0.6131364",
"0.61061233",
"0.60961044",
"0.6023095",
"0.59948015",
"0.5988559",
"0.59712726",
"0.5947936",
"0.5946335",
"0.59000313",
"0.589450... | 0.6004714 | 14 |
Subtract one number from another if they both are integers. | def sub(num1: int, num2: int, verbosity: int = 4) -> int:
set_level(verbosity, logger)
if are_int(num1, num2, logger):
return num1 - num2
else:
raise TypeError(TYPE_ERROR_MESSAGE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subtract(num1, num2):\n return num1 - num2",
"def subtract(num1, num2):\n return num1 - num2",
"def subtract(x: int, y: int):\n return x - y",
"def subtraction(self, a, b):\n if not check_arguments(a, b): # check if arguments are numbers\n self.last_result = a - b",
"def sub... | [
"0.7241545",
"0.7241545",
"0.72210795",
"0.7202364",
"0.72008544",
"0.7199399",
"0.70703775",
"0.7057534",
"0.7029978",
"0.69915074",
"0.6959544",
"0.69004047",
"0.6887763",
"0.6833272",
"0.6671105",
"0.6662992",
"0.66109186",
"0.66047525",
"0.66047525",
"0.65388346",
"0.6521... | 0.6959251 | 11 |
method to get products from OFF database | def get_product_data_off(self):
list_products_name = []
for x in self.list_categories:
"""get products' data from openfoodfacts api with string as paramaters"""
parameters = {
'action': 'process',
'json': 1,
'countries': 'France',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_products(self):\n\t\tpass",
"def get_products(self):\n con = dbcon()\n cur = con.cursor()\n cur.execute(\"SELECT * FROM products;\")\n res = cur.fetchall()\n if res:\n prdcts=[]\n for prodct_item in res:\n picked_prdct = {\n ... | [
"0.79702514",
"0.75793946",
"0.7506218",
"0.738689",
"0.73322606",
"0.6991631",
"0.69784635",
"0.6917217",
"0.69064903",
"0.6905229",
"0.6879561",
"0.6859096",
"0.685783",
"0.68414444",
"0.67854404",
"0.67725986",
"0.6747747",
"0.6728125",
"0.67193264",
"0.6709279",
"0.670838... | 0.6863026 | 11 |
Given coordinates (xd, yd) in the distorted image and the center of distortion (xc, yc), returns the corresponding coordinates in the undistorted image, (xu, yu). k1 is the distortion factor. The width and height specify | def get_coordinates(xd, yd, xc, yc, k1, width, height):
r_squared = ((xd - xc)**2 + (yd - yc)**2) / (width**2 + height**2)
denominator = max(EPSILON, 1 + k1 * r_squared) # Prevent division by 0
xu = xc + (xd - xc) / denominator
yu = yc + (yd - yc) / denominator
return (round(xu), round(yu)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allDist(x0, y0, xp, yp, k1, k2, k3, p1, p2):\n # Compute distance from principal point to image point\n xbar = xp - x0\n ybar = yp - y0\n r = np.hypot(xbar, ybar)\n\n # Compute distortion corrections\n xc = xp + (p1 * (r**2 + 2 * xbar**2) + 2 * p2 * xbar * ybar) + \\\n xbar * (r**2 * k... | [
"0.6930074",
"0.6401595",
"0.591956",
"0.5654241",
"0.56215096",
"0.55544716",
"0.54758245",
"0.54734915",
"0.5468909",
"0.5458898",
"0.5456141",
"0.5423257",
"0.5370543",
"0.53686893",
"0.5347415",
"0.53090316",
"0.53013927",
"0.52865434",
"0.52652705",
"0.5245948",
"0.52405... | 0.695022 | 0 |
Update a data set. | def update_from_dict(log, session, configuration):
url_url = "{}imagesets/{}/image_url".format(
http.get_api_url(configuration['url'], configuration['project']),
configuration['id'])
replace_url = "{}datasets/{}/".format(
http.get_api_url(configuration['url'], configuration['project']),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, data):\n self.data.update(data)",
"def update(self, data):\n return self._data.update(data)",
"def update_data(self, newData):\r\n self.AllData = newData",
"def _UpdateDataSetValues( self ):\n pass",
"def update(self, data):\n pass",
"def update(self, data)... | [
"0.7296877",
"0.7279816",
"0.7156278",
"0.6872137",
"0.6854659",
"0.6854659",
"0.6854659",
"0.6854659",
"0.67697275",
"0.67552155",
"0.66865456",
"0.6626958",
"0.65765727",
"0.6537754",
"0.65033036",
"0.6496444",
"0.64812994",
"0.6427548",
"0.63807064",
"0.63690543",
"0.63598... | 0.0 | -1 |
Get the file's name | def get_file_name(self):
return str(self.get_file()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name(self):\n return self.file_name",
"def get_name(self):\n return self._file.name",
"def get_file_name(self):\n return self.path.name[6:]",
"def get_file_name(self):\n return self.file_name",
"def get_file_name(self):\n return self.__file_name",
"def get_file_... | [
"0.8727314",
"0.867787",
"0.861844",
"0.8602267",
"0.85277975",
"0.8475511",
"0.8441925",
"0.8362905",
"0.8362905",
"0.8362905",
"0.8362905",
"0.8362905",
"0.8301751",
"0.82941294",
"0.8275632",
"0.82734853",
"0.82386833",
"0.8179329",
"0.8110978",
"0.804259",
"0.8023695",
... | 0.8929407 | 0 |
This function takes a string of tweets and returns a featureSet. (For Training data) | def get_features_train(tweets):
feats = get_feature_array(tweets)
tfidf = vectorizer.fit_transform(tweets).toarray()
M = np.concatenate([tfidf,feats],axis=1)
return M | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_feature_set_SA(tweet):\n features= {}\n return features",
"def get_features_test(tweets):\n feats = get_feature_array(tweets)\n tfidf = vectorizer.transform(tweets).toarray()\n M = np.concatenate([tfidf,feats],axis=1)\n return M",
"def tweet2features(tweet):\r\n features = {\r\n ... | [
"0.6937795",
"0.6836616",
"0.682941",
"0.66486007",
"0.6623701",
"0.6614609",
"0.63056546",
"0.6299887",
"0.6278465",
"0.62684935",
"0.6194713",
"0.61835593",
"0.6155796",
"0.6093069",
"0.6087889",
"0.6020802",
"0.60054624",
"0.60017174",
"0.598438",
"0.59728307",
"0.5951399"... | 0.7142444 | 0 |
Return the id of this sequence. | def id(self):
if self.sub_children:
id_ = ','.join(
six.moves.urllib.parse.quote(child.id) for child in self.template.children())
else:
id_ = six.moves.urllib.parse.quote(self.template.id)
return id_ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id(self) -> int:\n\t\t# pylint: disable=invalid-name\n\t\treturn self._oid",
"def get_id(self) -> int:\n return self.id",
"def get_id(self) -> int:\n return self.id",
"def get_id(self):\n\n\t\treturn self.__id",
"def get_id(self):\n return self.__id",
"def get_id(self):\n ... | [
"0.7830633",
"0.78098446",
"0.78098446",
"0.7805146",
"0.7787646",
"0.7787646",
"0.77583677",
"0.77583677",
"0.77583677",
"0.77583677",
"0.77583677",
"0.77583677",
"0.7721842",
"0.76916146",
"0.76916146",
"0.76916146",
"0.76916146",
"0.76916146",
"0.76916146",
"0.76916146",
"... | 0.0 | -1 |
Calculates the distance between two trajectories. This is called when distances are not memoized. | def dist_calc(self, x, y):
p_xy = self.d2_bin(x, y)
p_x = np.sum(p_xy, axis=1)
p_y = np.sum(p_xy, axis=0)
p_x_times_p_y = np.tensordot(p_x, p_y, axes = 0)
info = np.sum(p_xy * np.ma.log(np.ma.divide(p_xy, p_x_times_p_y)))
entropy = np.sum(-1 * p_xy * np.ma.log(p_xy))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(self, first_tape, second_tape):\n pairs = zip(first_tape, second_tape)\n return math.sqrt(abs(sum(map((lambda n: self.subsq(*n)), pairs))))",
"def distance(self, a, b):\n raise NotImplementedError()",
"def _get_distance(a, b):\n return np.sqrt(np.sum((a - b) ** 2))",
... | [
"0.724267",
"0.71898127",
"0.71822906",
"0.71084523",
"0.70549697",
"0.7038178",
"0.70113784",
"0.6981584",
"0.6953429",
"0.6893008",
"0.68775797",
"0.68374026",
"0.6825737",
"0.6794347",
"0.6786009",
"0.6784951",
"0.67769456",
"0.6773832",
"0.6773336",
"0.6772586",
"0.676369... | 0.0 | -1 |
Checks if a user is getting their own results, returns true for auth | def is_self(user_id):
query_user_id = request.args.get('user_id', default=None, type=int)
return user_id==query_user_id and user_id is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user_has_access(self):\n return self.user_has_access(users.get_current_user())",
"def test_func(self):\n answer = self.get_object()\n return True if self.request.user == answer.author or self.request.user.is_superuser else False",
"def test_func(self):\n if not self.request.... | [
"0.6830791",
"0.67305815",
"0.66758776",
"0.6648134",
"0.6584638",
"0.65331006",
"0.6505666",
"0.6476608",
"0.6466238",
"0.6463398",
"0.6455103",
"0.64041394",
"0.6400391",
"0.63866115",
"0.6373713",
"0.63413876",
"0.63285804",
"0.6291915",
"0.6252789",
"0.62442213",
"0.62392... | 0.61230737 | 29 |
Gets the name of this fragment | def get_name(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name ( self ) :\n return self.__name if self.__name else ''",
"def get_name(self) -> str:\n return self.name",
"def get_name(self) -> str:\n return self.name",
"def get_name(self) -> str:\n return self.name",
"def get_name(self):\n return self.tagnode",
"def get_nam... | [
"0.7070921",
"0.703705",
"0.703705",
"0.703705",
"0.70315593",
"0.70155895",
"0.70155895",
"0.7013504",
"0.6993914",
"0.69760376",
"0.6972442",
"0.69472903",
"0.69458294",
"0.69443727",
"0.69377047",
"0.69377047",
"0.69377047",
"0.69347143",
"0.69347143",
"0.69347143",
"0.693... | 0.688392 | 57 |
Gets the charge of this fragment | def get_charge(self):
return self.charge | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_charge(self):\n\n return self._charge",
"def charge(self):\n return self._charge",
"def charge(self):\n return sum(self.charges)",
"def get_charge(self):\n return -self.get_len() - 1",
"def get_charge(self):\n return -self.get_len() - 1",
"def getCharge(self):\n... | [
"0.7840667",
"0.77558124",
"0.7120083",
"0.71053344",
"0.71053344",
"0.7019659",
"0.6885813",
"0.6814834",
"0.6725436",
"0.6510247",
"0.6493683",
"0.64562273",
"0.623075",
"0.6105341",
"0.60868716",
"0.60541993",
"0.60538113",
"0.59798276",
"0.5941452",
"0.59291065",
"0.59277... | 0.7934505 | 0 |
Rotates this Fragment using the rotation defined by the given Quaternion | def rotate(self, quaternion, origin_x = 0, origin_y = 0, origin_z = 0):
for atom in self.get_atoms():
atom.rotate(quaternion, origin_x, origin_y, origin_z) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rotate_quaternion(self, q):\n self._normalise()\n return self * q * self.conjugate",
"def rotate(self, quaternion):\n rot3d = quaternion2rot3d(quaternion)\n new_pos = np.dot(self.atom_pos, rot3d.T)\n self.set_atom_pos(new_pos)",
"def rotate(self, x=0, y=0, z=0):\n\t\tqua... | [
"0.7294405",
"0.71604484",
"0.65020615",
"0.6402911",
"0.6297939",
"0.6255514",
"0.6226626",
"0.61294395",
"0.60619843",
"0.6036311",
"0.6036311",
"0.60143197",
"0.5982547",
"0.5937332",
"0.5923354",
"0.59217966",
"0.5885588",
"0.5851342",
"0.584848",
"0.5835781",
"0.5830552"... | 0.6952967 | 2 |
Test string fractions are returns as is | def test_prepare_value_string(self):
field = DecimalFractionField()
result = field.prepare_value("1/4")
self.assertEqual("1/4", result)
result = field.prepare_value("1 1/4")
self.assertEqual("1 1/4", result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_fraction(s: Any) -> bool:\n return bool(re.match(r\"^-?\\d+/\\d+$\", s))",
"def test_prepare_value_string(self):\n field = FractionField()\n result = field.prepare_value(\"1/4\")\n self.assertEqual(\"1/4\", result)\n\n result = field.prepare_value(\"1 1/4\")\n self.as... | [
"0.77809423",
"0.721428",
"0.7103514",
"0.7020288",
"0.69332373",
"0.6911425",
"0.6892154",
"0.6722378",
"0.66270185",
"0.656522",
"0.6451055",
"0.64348006",
"0.6390703",
"0.6386209",
"0.63856786",
"0.63432753",
"0.6320059",
"0.62999994",
"0.62571466",
"0.6233242",
"0.6221291... | 0.7274636 | 1 |
Test string fractions are returns as is | def test_prepare_value_string(self):
field = FractionField()
result = field.prepare_value("1/4")
self.assertEqual("1/4", result)
result = field.prepare_value("1 1/4")
self.assertEqual("1 1/4", result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_fraction(s: Any) -> bool:\n return bool(re.match(r\"^-?\\d+/\\d+$\", s))",
"def test_prepare_value_string(self):\n field = DecimalFractionField()\n result = field.prepare_value(\"1/4\")\n self.assertEqual(\"1/4\", result)\n\n result = field.prepare_value(\"1 1/4\")\n ... | [
"0.77809423",
"0.7274636",
"0.7103514",
"0.7020288",
"0.69332373",
"0.6911425",
"0.6892154",
"0.6722378",
"0.66270185",
"0.656522",
"0.6451055",
"0.64348006",
"0.6390703",
"0.6386209",
"0.63856786",
"0.63432753",
"0.6320059",
"0.62999994",
"0.62571466",
"0.6233242",
"0.622129... | 0.721428 | 2 |
Compute boundary faces of a tetrahedral mesh. | def computeBoundaryFaces(elemsF, facesN):
# Sort indexes and add 1 position in order to use indexes as Matlab
A0 = np.sort(elemsF[:, 0]) + 1
I0 = np.argsort(elemsF[:, 0]) + 1
A1 = np.sort(elemsF[:, 1]) + 1
I1 = np.argsort(elemsF[:, 1]) + 1
A2 = np.sort(elemsF[:, 2]) + 1
I2 = np.argsort(elems... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetBoundaryEdgesTet(self):\n\n p = self.InferPolynomialDegree()\n # DO NOT COMPUTE IF ALREADY COMPUTED\n if isinstance(self.edges,np.ndarray):\n if self.edges.shape[0] > 1:\n # IF LINEAR VERSION IS COMPUTED, DO COMPUTE HIGHER VERSION\n if self.edges... | [
"0.72552776",
"0.67934704",
"0.64785093",
"0.64566654",
"0.6453625",
"0.6317649",
"0.6223292",
"0.6115779",
"0.61035174",
"0.6077661",
"0.59554404",
"0.5939486",
"0.5933464",
"0.5925715",
"0.5921041",
"0.59046197",
"0.5881553",
"0.58625",
"0.5847016",
"0.58428156",
"0.5767615... | 0.5704454 | 24 |
initializes a flask app instance | def create_app():
app = Flask(__name__)
app.config.from_pyfile('config.py')
login_manager.init_app(app) # initialize flask_login with our app
# redirect route when @login_required fails
login_manager.login_view = 'routes.signin'
db.init_app(app)
from .routes import routes
app.register... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app(self):\r\n self.app = Flask(__name__, instance_relative_config=True)\r\n\r\n # Init the secret key of the app -it is a must for flask to run\r\n self.app.config.from_mapping(\r\n SECRET_KEY='!ZNeverSayNever116Z!',\r\n MONGODB_SETTINGS= {'host': 'mongodb://l... | [
"0.8479128",
"0.8038138",
"0.7975422",
"0.7953565",
"0.7911968",
"0.79001665",
"0.78681207",
"0.78453237",
"0.77731043",
"0.7744912",
"0.7680423",
"0.76791704",
"0.76570606",
"0.765639",
"0.7635226",
"0.7610924",
"0.760185",
"0.7582008",
"0.75521374",
"0.75180256",
"0.7493075... | 0.7164925 | 71 |
Computes the precision metric, a metric for multilabel classification of how many selected items are relevant. | def precision_np(y_true: numpy.array, y_pred: numpy.array, epsilon: float = EPSILON) -> float:
true_positives = numpy.sum(y_true * y_pred)
predicted_positives = numpy.sum(y_pred)
return true_positives / (predicted_positives + epsilon) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(y_true, y_pred, average, labels):\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n # At this point, you can be sure that y_true and y_pred are one hot encoded.\n result = None\n m = len(y_true)\n n = len(labels)\n\n #call get_confusion_matrix function and pu... | [
"0.73345155",
"0.7298403",
"0.72627676",
"0.7090696",
"0.70505947",
"0.70389444",
"0.701122",
"0.69586176",
"0.6909918",
"0.6909918",
"0.6909918",
"0.6909918",
"0.6909918",
"0.6909918",
"0.68955487",
"0.6855073",
"0.6855073",
"0.6855073",
"0.6855073",
"0.6855073",
"0.6855073"... | 0.0 | -1 |
Computes the recall metric, a metric for multilabel classification of how many relevant items are selected. | def recall_np(y_true: numpy.array, y_pred: numpy.array, epsilon: float = EPSILON) -> float:
true_positives = numpy.sum(y_true * y_pred)
possible_positives = numpy.sum(y_true)
return true_positives / (possible_positives + epsilon) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recall(self):\n self.overall_recall = recall_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_recall = recall_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)",
"def recall_score(self, ... | [
"0.73898387",
"0.7297759",
"0.7269505",
"0.7111451",
"0.70694834",
"0.7048114",
"0.7047511",
"0.70038974",
"0.70038974",
"0.70038974",
"0.70038974",
"0.70038974",
"0.70038974",
"0.7002241",
"0.70014656",
"0.6993705",
"0.6984924",
"0.69737595",
"0.6938349",
"0.6938121",
"0.693... | 0.0 | -1 |
Builds the schedule of which the learning rate decreases. The schedule makes the learning rate decrease linearly. | def build_schedule(lr: float, final_lr: float, n_epochs: int) -> Callable:
delta = (lr - final_lr) / n_epochs
def schedule(epoch: int) -> float:
assert 0 <= epoch < n_epochs
return lr - delta * epoch
return schedule | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rnn_learning_rate_schedule(dataset):\n model, prefix = make_rnn(non_negative=True)\n # model.set_params(**{prefix + \"val\": 0.1})\n\n # base = no schedule\n print(\"Baseline RNN\")\n # model.set_params(**{prefix + \"history_file\": \"nn_default.csv\"})\n cross_validate(dataset, model)\n #... | [
"0.66336316",
"0.63690597",
"0.63297385",
"0.63220465",
"0.6258796",
"0.6253793",
"0.620713",
"0.6153203",
"0.60822165",
"0.60623544",
"0.6049729",
"0.604464",
"0.6044371",
"0.6038978",
"0.6038978",
"0.6038978",
"0.6038978",
"0.6037906",
"0.6018564",
"0.6016782",
"0.6014408",... | 0.6524537 | 1 |
Helper function to split a huge dataset into smaller ones to enable more frequent reports. | def create_generator_params(batch_size: int, samples_per_epoch: int, n_samples: int,
epochs: int) -> Tuple[int]:
steps_per_epoch = samples_per_epoch // batch_size
n_epochs = numpy.ceil(epochs * n_samples / samples_per_epoch)
return steps_per_epoch, n_epochs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_data(self):\r\n print('split data')\r\n np.random.shuffle(self.dataList)\r\n l = len(self.dataList)/self.fold\r\n self.dataList = [self.dataList[i*l: (i+1)*l] for i in range(self.fold-1)] + [self.dataList[(self.fold-1)*l:]] # each element in the list is splitted data list\r",... | [
"0.68325806",
"0.6719043",
"0.66812164",
"0.65784836",
"0.65560913",
"0.65425575",
"0.6532564",
"0.6470499",
"0.64588654",
"0.6456596",
"0.64458627",
"0.64394736",
"0.64272094",
"0.6405427",
"0.6385925",
"0.63804173",
"0.63804173",
"0.63794905",
"0.63666266",
"0.636225",
"0.6... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.title | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
Replace this Tetrahdedron by Tetrahedron instances NEW_TETRAHEDRA. | def replace_by(self, new_tetrahedra, world):
# All done. Just destroy self.
self.destroy(world) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_rt_set(self, all_rt):\n if isinstance(all_rt, Rototrans):\n rt_tp = []\n rt_tp.append(all_rt[:, :])\n all_rt = rt_tp\n\n if not isinstance(all_rt, list):\n raise TypeError(\"Please send a list of rt to new_rt_set\")\n\n # Remove previous acto... | [
"0.5610013",
"0.54977065",
"0.5488572",
"0.54448485",
"0.5427759",
"0.52548707",
"0.5156459",
"0.5109099",
"0.5095576",
"0.506502",
"0.5022705",
"0.49961764",
"0.49854037",
"0.49143454",
"0.48233232",
"0.47823483",
"0.47621095",
"0.47574484",
"0.47290552",
"0.47250453",
"0.47... | 0.64222157 | 0 |
Returns whether the vector is inside of the board | def in_board(self, vec):
if self.in_field(vec):
return True
for func in self.colors.values():
if func(vec, self.n):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_board(self,pos : np.ndarray) -> bool:\r\n if 0 > pos[0] or pos[0] >= BOARD_SIZE:\r\n return False\r\n if 0 > pos[1] or pos[1] >= BOARD_SIZE:\r\n return False\r\n\r\n return True",
"def inBoard(self, row, col):\n return 0 <= row < self.rows and 0 <= col <... | [
"0.7212",
"0.7185246",
"0.70871615",
"0.70771027",
"0.70234334",
"0.6946289",
"0.68932205",
"0.6879633",
"0.6874559",
"0.6864705",
"0.68536687",
"0.68081266",
"0.67276454",
"0.6673209",
"0.66710615",
"0.6647632",
"0.66226614",
"0.661512",
"0.6614641",
"0.66095644",
"0.6598182... | 0.7772189 | 0 |
Returns a list of vectors that may or may not be inside of the board. | def hexgrid(self):
n = self.n * 2
vectors = []
for u in range(-n, n+1):
us = [u] * (2*n+1)
if u < 0:
vectors.extend(zip(us, range(-n-u, n+1), range(-n, n+u+1)))
else:
vectors.extend(zip(us, range(-n, n-u+1), range(-n+u, n+1)))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def legalMoves(self):\n return [c for c in range(self.getWidth()) if len([r for r in range(self.getHeight()) if self.cell[c][r]==EMPTY])>0 ]",
"def get_empty_board_indecies(self):\n empty_indecies = []\n for row_num in range(len(self.board)):\n for col_num in range(len(self.board)):\n if... | [
"0.6610782",
"0.65623474",
"0.64860266",
"0.64014375",
"0.6315641",
"0.6310179",
"0.62271833",
"0.6195709",
"0.61830556",
"0.6166734",
"0.6125621",
"0.6112408",
"0.60734916",
"0.6043918",
"0.6020423",
"0.6017853",
"0.5987325",
"0.59772426",
"0.597702",
"0.5952441",
"0.5952441... | 0.0 | -1 |
Setup the sensor platform. | def setup_platform(hass, config, add_devices, discovery_info=None):
sensor_name = config.get(CONF_NAME)
api_key = config.get(CONF_API_KEY,None)
interval = config.get(CONF_UPDATE_INTERVAL)
if api_key == None:
_Log.error('Pls enter api_key!')
return False
road_name = config.ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_platform(hass, config, add_devices, discovery_info=None):\n thread1 = QQ(config[QQ_NUMBER])\n thread1.start()\n object_qq = Qqsensor(hass, QQ_NUMBER, thread1)\n add_devices([object_qq])",
"def setup_sensors(self, configs):\n self.__sensors = self.setup_components(configs, 'scale_clie... | [
"0.7249521",
"0.7210104",
"0.7194671",
"0.7163429",
"0.7035067",
"0.6979973",
"0.6975266",
"0.69677466",
"0.696644",
"0.6903852",
"0.690341",
"0.6835207",
"0.6825917",
"0.680988",
"0.679155",
"0.67871094",
"0.6784935",
"0.6776815",
"0.6770015",
"0.67620605",
"0.67544883",
"... | 0.6310375 | 72 |
Return the name of the sensor. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._sensor.name",
"def get_sensor_name(self):\n return self.data[1]",
"def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'",
"def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso... | [
"0.91896784",
"0.9168378",
"0.890185",
"0.8770976",
"0.8511273",
"0.8479953",
"0.844435",
"0.8299758",
"0.8186503",
"0.8105667",
"0.8079737",
"0.8066149",
"0.8049647",
"0.7700968",
"0.7612295",
"0.7611456",
"0.7600605",
"0.7600605",
"0.7600605",
"0.75392073",
"0.75166553",
... | 0.0 | -1 |
Return the state attributes. | def device_state_attributes(self):
return self.attributes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_attributes(self):\... | [
"0.8953404",
"0.8953404",
"0.8366765",
"0.8366765",
"0.8363429",
"0.83362615",
"0.8334551",
"0.8310377",
"0.8292682",
"0.8289349",
"0.8289349",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.828... | 0.85239846 | 2 |
acquire queryset. if model is presented, then return all model query instances by default. | def get_queryset(self):
# throw error if no args pass in
assert self.model or self.queryset, 'No queryset found'
if self.queryset:
return self.queryset
else:
return self.model.objects.all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n if self.queryset is None:\n return self.model.objects.all()\n return self.queryset",
"def get_queryset(self):\n if self.queryset is not None:\n queryset = self.queryset\n if hasattr(queryset, '_clone'):\n queryset = qu... | [
"0.7644273",
"0.7618205",
"0.7535147",
"0.7387494",
"0.738083",
"0.732587",
"0.72906893",
"0.71977407",
"0.708393",
"0.70817304",
"0.70669514",
"0.69840425",
"0.6976474",
"0.69260937",
"0.6898897",
"0.6810811",
"0.6804265",
"0.68033534",
"0.67867935",
"0.6778076",
"0.6723888"... | 0.7802014 | 0 |
Round a datetime object to any time lapse in seconds | def roundTime(dt=None, roundTo=60):
if dt == None : dt = datetime.datetime.now()
seconds = (dt.replace(tzinfo=None) - dt.min).seconds
rounding = (seconds+roundTo/2) // roundTo * roundTo
return dt + timedelta(0,rounding-seconds,-dt.microsecond) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def round_time(time):\n t_min = time.minute % 5\n t_sec = time.second\n t_mic = time.microsecond\n time = time - timedelta(minutes=t_min, seconds=t_sec, microseconds=t_mic)\n return time",
"def _round_time(dt=None, round_to=60):\n if hasattr(dt, 'tzinfo'):\n dt.replace(tzinfo=None)\n ... | [
"0.7320045",
"0.715309",
"0.7138651",
"0.71008414",
"0.7058292",
"0.6994194",
"0.6970844",
"0.68314713",
"0.6807531",
"0.6665522",
"0.653433",
"0.6327775",
"0.6321998",
"0.63166976",
"0.6299284",
"0.62989396",
"0.6279414",
"0.6231006",
"0.6187853",
"0.61589897",
"0.61580956",... | 0.6820072 | 8 |
Fetch one column of a row in a column family | def get_one_col(self, cf_name, key, column):
return self._Get_One_Col(cf_name=cf_name, key=key, column=column) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_column(self, name):\r\n return self.column(name)",
"def _get_column(self, column_or_label):\n c = column_or_label\n if isinstance(c, collections.Hashable) and c in self.column_labels:\n return self[c]\n else:\n assert len(c) == self.num_rows, 'column le... | [
"0.65809715",
"0.6395824",
"0.6331326",
"0.6311651",
"0.6183956",
"0.6180765",
"0.6135274",
"0.611844",
"0.6111417",
"0.61094",
"0.6099584",
"0.6052209",
"0.59760803",
"0.59675276",
"0.59591275",
"0.595855",
"0.5944605",
"0.59303564",
"0.5896189",
"0.58921236",
"0.5860364",
... | 0.63702726 | 2 |
Returns current sendesh status of the cluster. | def get_status(self):
return self._conn_state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getClusterStatus(self):\n data = self.connect('get','cluster/status', None)\n return data",
"def show_cluster_status(self, *args, **kwargs):\r\n return execute(self._show_cluster_status, *args, **kwargs)",
"def get_status(self):\n try:\n c = self._oc_command([\"status... | [
"0.8044244",
"0.7461671",
"0.71386325",
"0.6918834",
"0.6678814",
"0.65886074",
"0.650298",
"0.6475688",
"0.6466387",
"0.6464366",
"0.6391463",
"0.6388183",
"0.6369799",
"0.6355483",
"0.63423043",
"0.63423043",
"0.63423043",
"0.63423043",
"0.63423043",
"0.63423043",
"0.634230... | 0.0 | -1 |
Calculate the skyline of pruned data | def calculateUSky(self):
skyline = []
for p in self.pruned:
pastart = [self.drange[0] for i in range(self.dim)]
pamax = p.getLocationMax()
pdom = list(self.index.intersection(tuple(pastart+pamax),objects=True))
if len(pdom) == 1 and pdom[0].object == p:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_prem(r):\n\n\t#- normalised radius\n\tx = r / 6371000.0\n\n\t#- march through the various depth levels -----------------------------------------------------\n\n\t#- upper crust\n\tif (r >= 6356000.0):\n\t\trho = 2.6\n\t\tvpv = 5.8\n\t\tvph = vpv\n\t\tvsv = 3.2\n\t\tvsh = vsv\n\t\teta = 1.0\n\n\t#- lower ... | [
"0.5892707",
"0.5673361",
"0.5619614",
"0.55595136",
"0.53803533",
"0.53759634",
"0.5366281",
"0.5366115",
"0.53538483",
"0.5347818",
"0.5318919",
"0.5297589",
"0.52948004",
"0.52816844",
"0.5278574",
"0.52699864",
"0.5261957",
"0.5221317",
"0.5217847",
"0.52147764",
"0.51918... | 0.7453469 | 0 |
Returns all of the vertexes in the graph as a collection. | def get_nodes(self):
try:
return list(self._adjacency_list.keys())
except Exception as error:
print(f'An error occurred: {error}') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertices(self):\n return list(self.__graph.values())",
"def vertices(self):\n return list(self._graph)",
"def list_vertices(self):\n return list(self.graph_dict.keys())",
"def vertices(self):\r\n return list(self.__graph_dict.keys())",
"def vertices(self):\n return li... | [
"0.8442992",
"0.8437905",
"0.80978954",
"0.8062885",
"0.80320734",
"0.8027241",
"0.8027241",
"0.8027241",
"0.79487896",
"0.7837035",
"0.7822196",
"0.7815928",
"0.7676804",
"0.7663068",
"0.7611067",
"0.7565963",
"0.7558315",
"0.7526916",
"0.75248486",
"0.74665725",
"0.74665725... | 0.0 | -1 |
Sets the value of a field. | def set_value(self, value):
if self.value:
raise ValueError("Already has a Value:", self)
self.value = value
if self.value != 0:
self.possible = None
self.solved = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_value(self, field, value):\n field = self.find_first(field)\n if field is not None:\n field.value = value",
"def _setValue(self, field, value):\n self._contents[field] = value",
"def setfield(self, field, value):\n self.__setitem__(field, value)",
"def set_value... | [
"0.87944627",
"0.83795464",
"0.8153481",
"0.744799",
"0.74258125",
"0.7408449",
"0.7408449",
"0.7408449",
"0.737211",
"0.73430604",
"0.73430604",
"0.73",
"0.7291942",
"0.721044",
"0.71501756",
"0.7146078",
"0.71260786",
"0.7103469",
"0.70935476",
"0.7080875",
"0.7078103",
"... | 0.0 | -1 |
Returns string representation of self | def __str__(self):
return str(self.value) + " "
# return "[" + str(self.value) + "::" + str(self.possible) + "]"
#return "[(" + str(self.x) + ":" + str(self.y) + ")->" + str(self.value) + "]" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_string(self):\r\n return self.__str__()",
"def toString(self) -> str:\n raise NotImplementedError",
"def __str__ (self) :\n\n return self.as_string()",
"def serialize(self):\n\n\t\treturn str(self)",
"def as_string(self):\n return self.__repr__()",
"def __repr__(self):\... | [
"0.87734145",
"0.87379277",
"0.86403114",
"0.8580149",
"0.85407466",
"0.8532413",
"0.8532413",
"0.8532413",
"0.8532413",
"0.8532413",
"0.8532413",
"0.8532413",
"0.8532413",
"0.8532413",
"0.8532413",
"0.8532413",
"0.8532413",
"0.8532413",
"0.852823",
"0.85209185",
"0.8493514",... | 0.0 | -1 |
The identity block is the block that has no conv layer at shortcut. Arguments | def identity_block(input_tensor, kernel_size, filters, stage, block):
# shortcut中没有卷积层,直接进行相加
filters1, filters2, filters3 = filters
conv_name_base = "res" + str(stage) + block + "_branch"
bn_name_base = "bn" + str(stage) + block + "_branch"
x = Conv2D(filters=filters1, kernel_size=(1, 1), name=con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity_block(self, input_tensor, filters, activation, stage, block, start_with_batch_norm = True):\n\n # Set the naming convention\n conv_name_base = 'res' + str(stage) + block + '_branch'\n batch_norm_name_base = 'batch_norm' + str(stage) + block + '_branch'\n\n x_shortcut = inpu... | [
"0.71272004",
"0.7022438",
"0.6910338",
"0.68836653",
"0.68505627",
"0.6847176",
"0.6821999",
"0.680346",
"0.6799615",
"0.67849326",
"0.67714536",
"0.67158884",
"0.67146987",
"0.67137283",
"0.6664201",
"0.6624224",
"0.662218",
"0.662218",
"0.66078824",
"0.65984523",
"0.654859... | 0.68221945 | 6 |
A block that has a conv layer at shortcut. Arguments | def conv_block(input_tensor, kernel_size, filters, stage, block, strides=(2, 2)):
# 在shortcut中有一个卷积层,卷积进行升维或降维,方便相加
filters1, filters2, filters3 = filters
conv_name_base = 'res' + str(stage) + block + '_branch'
bn_name_base = 'bn'+ str(stage) + block + '_branch'
x = Conv2D(filters=filters1, kernel_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv_block(self, output_channel, filter_, activate):\n return self.add_layer(conv_block, output_channel, filter_, activate)",
"def _convolution_block(self, X, filters, f, s, stage, block):\n\n\t\tconv_layer_name = 'res' + str(stage) + block + '_branch'\n\t\tbn_layer_name = 'bn' + str(stage) + block + ... | [
"0.72210574",
"0.6797653",
"0.67508686",
"0.673468",
"0.6702727",
"0.66709983",
"0.66706705",
"0.6638113",
"0.6602907",
"0.6602907",
"0.65983295",
"0.65591985",
"0.6556552",
"0.6553555",
"0.6531844",
"0.65101147",
"0.650745",
"0.6479069",
"0.64118993",
"0.6391051",
"0.6383523... | 0.6421294 | 18 |
`features` might be a list of unweighted tokens (a weight of 1 will be assumed), a list of (token, weight) tuples or a token > weight dict. | def build_by_features(self, features):
v = [0] * self.f
masks = [1 << i for i in range(self.f)]
if isinstance(features, dict):
features = features.items()
for f in features:
if isinstance(f, basestring):
h = self.hashfunc(f.encode('utf-8'))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_features(tokens, feats):\n ###TODO\n \n for token in tokens :\n t = 'token=' + token\n \n if t not in feats.keys() : \n feats.setdefault(t,1)\n else :\n feats[t] += 1",
"def token_features(tokens, feats):\n \n count = Counter(tokens)\n fo... | [
"0.6538036",
"0.6515062",
"0.6346604",
"0.63105845",
"0.6278965",
"0.62613875",
"0.622706",
"0.61605465",
"0.61384344",
"0.61384344",
"0.61300457",
"0.6122697",
"0.6109485",
"0.60985655",
"0.6096389",
"0.6088325",
"0.6088325",
"0.6059488",
"0.6058604",
"0.60456884",
"0.601068... | 0.6396962 | 2 |
Find the Jaccard Overlap (IoU) of every box combination between two sets of boxes that are in boundary coordinates. | def find_jaccard_overlap(set_1, set_2):
# Find intersections
intersection = find_intersection(set_1, set_2) # (n1, n2)
# Find areas of each box in both sets
areas_set_1 = (set_1[:, 2] - set_1[:, 0]) * (set_1[:, 3] - set_1[:, 1]) # (n1)
areas_set_2 = (set_2[:, 2] - set_2[:, 0]) * (set_2[:, 3] - s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_iou(box, boxes):\n\n x_min_A, y_min_A, x_max_A, y_max_A = box[:4]\n x_min_B, y_min_B = boxes[:, 0], boxes[:, 1]\n x_max_B, y_max_B = boxes[:, 2], boxes[:, 3]\n # calculating the intersection\n inner_x_min = np.maximum(x_min_B, x_min_A)\n inner_y_min = np.maximum(y_min_B, y_min_A)\n ... | [
"0.7168513",
"0.7112828",
"0.70525634",
"0.7020757",
"0.6949288",
"0.6949288",
"0.6949288",
"0.6860193",
"0.6860193",
"0.677731",
"0.67404073",
"0.6721264",
"0.67108876",
"0.6706636",
"0.66358984",
"0.6622973",
"0.6622973",
"0.66052437",
"0.65899974",
"0.6587413",
"0.6581515"... | 0.6439117 | 34 |
Initializes this row with default values and a sentinel entry. | def __init__(self):
self.row_number = -1
self.next_row = None
self.row_sentinel = SparseMatrix.MatrixEntry() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, rows, cols, default_val=0):\n self.num_rows = rows\n self.num_cols = cols\n self.default = default_val\n\n self.sentinel = SparseMatrix.MatrixRow()",
"def __init__(self, value = None):\n self.column_number = -1\n self.value = value\n ... | [
"0.67260337",
"0.63815343",
"0.63809544",
"0.6340838",
"0.6260441",
"0.60686153",
"0.606482",
"0.59570277",
"0.58858204",
"0.57779187",
"0.57666415",
"0.57305354",
"0.5706646",
"0.5699942",
"0.56828165",
"0.5641227",
"0.5615847",
"0.5596644",
"0.55751085",
"0.55194175",
"0.54... | 0.60228264 | 7 |
Initializes the entry with default values. | def __init__(self, value = None):
self.column_number = -1
self.value = value
self.next_entry = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_initial_values(self):\n\n pass",
"def __init__(self, k, v):\n super(Entry, self).__init__()\n self.key = k\n self.value = v",
"def __init__(self, owner, entries=None):\n\n self.owner = owner\n # self.entries = EntriesDict({})\n self.entries =... | [
"0.64839077",
"0.6428061",
"0.6153857",
"0.6130358",
"0.6130358",
"0.61106277",
"0.6092544",
"0.60430735",
"0.6029392",
"0.6006516",
"0.5996097",
"0.5971703",
"0.5956414",
"0.59403425",
"0.59384495",
"0.5929642",
"0.5925223",
"0.58915585",
"0.5879156",
"0.58741474",
"0.587160... | 0.0 | -1 |
Initializes the matrix with a size, a default value, and a row sentinel. | def __init__(self, rows, cols, default_val=0):
self.num_rows = rows
self.num_cols = cols
self.default = default_val
self.sentinel = SparseMatrix.MatrixRow() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, rows, cols, default_val=0):\n self.num_rows = rows\n self.num_cols = cols\n\n # Initialize the 2-dimensional array\n self.rows = [[default_val] * cols for _ in xrange(rows)]",
"def matrix_init(sizex, sizey):\n return [[0]*sizey for i in range(sizex)]",
"def __i... | [
"0.7281571",
"0.69483995",
"0.6928275",
"0.6726728",
"0.6641103",
"0.655347",
"0.6530604",
"0.6498373",
"0.648758",
"0.64090204",
"0.6306809",
"0.6260346",
"0.6204775",
"0.6165205",
"0.6070078",
"0.60698414",
"0.60140264",
"0.5983178",
"0.59733385",
"0.5946259",
"0.5865526",
... | 0.7756205 | 0 |
Creates a classification model. | def create_model(model, labels, label_types, num_choices, k_size=4):
output_layer = model.get_pooled_output()
hidden_size = output_layer.shape[-1].value
with tf.variable_scope("cpc_loss"):
output = tf.reshape(output_layer, (-1, num_choices + 1, hidden_size))
contexts = output[:, 0, :]
targets = outp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_model(self):\n self.classifier = DecisionTreeClassifier(max_depth=1)",
"def create_model(self, C : float =1):\n self.classifier = RandomForestClassifier(max_depth=5)",
"def create_model():\n\n # Create a sequential model (a simple NN is created) adding a softmax activation at the en... | [
"0.7451048",
"0.716728",
"0.70753753",
"0.69427526",
"0.69337225",
"0.69306064",
"0.6929345",
"0.68631464",
"0.68004555",
"0.6769279",
"0.6737084",
"0.66838384",
"0.66709864",
"0.660953",
"0.65912193",
"0.6564333",
"0.6534873",
"0.6526978",
"0.6525293",
"0.6521778",
"0.651739... | 0.0 | -1 |
Function returns the index of the element if it exists in the array or the index at which it would have been present if it is not. The function expects the argument data to be in sorted order | def binarySearch(data, elem):
low = 0
high = len(data) - 1
while low <= high:
middle = (low + high) // 2
if elem == data[middle]:
return middle
if elem > data[middle]:
low = middle + 1
else:
high = middle - 1
return middle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __find_index(arr, val):\n if val is not None:\n return numpy.searchsorted(arr, val)\n else:\n return val",
"def find(self, data):\n index = 0\n current = self.head\n while current:\n if current.data == data:\n return index\n index += 1\n current = current.ne... | [
"0.7313242",
"0.7135801",
"0.7050882",
"0.7015456",
"0.6990773",
"0.6962582",
"0.69366205",
"0.6882193",
"0.68782043",
"0.6861308",
"0.68275255",
"0.6757039",
"0.67442787",
"0.67424434",
"0.6690114",
"0.6632292",
"0.6623185",
"0.6622726",
"0.6607247",
"0.66015273",
"0.6584637... | 0.6452699 | 25 |
creates a string representation of the incident class | def __repr__(self):
return {
'username': self.createdBy,
'createdOn': self.createdOn,
'status': self.status
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n # string representation includes values of all inner fields\n return \\\n \"Edge Weight: \" + str(self.weight) + \"\\n\" + \\\n \"Edge Attributes: \" + str(self.attributes) + \"\\n\" + \\\n \"First Incident Node: \\n\" + str(self.first_incident_no... | [
"0.6591128",
"0.64477116",
"0.6425984",
"0.6424492",
"0.64165956",
"0.64165956",
"0.6404343",
"0.638652",
"0.63775414",
"0.6372295",
"0.6355926",
"0.6327886",
"0.6322455",
"0.6317055",
"0.63161314",
"0.62926656",
"0.6280834",
"0.6280834",
"0.62319183",
"0.62098956",
"0.620989... | 0.0 | -1 |
isPubKeyHashAltScript returns whether or not the passed script is a standard paytoaltpubkeyhash script. | def isPubKeyHashAltScript(script):
pk, _ = extractPubKeyHashAltDetails(script)
return pk is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isPubKeyAltScript(script):\n pk, _ = extractPubKeyAltDetails(script)\n return pk is not None",
"def isPubKeyScript(script):\n return extractPubKey(script) is not None",
"def isScriptHashScript(pkScript):\n return extractScriptHash(pkScript) is not None",
"def extractPubKeyHashAltDetails(scrip... | [
"0.83807874",
"0.7120107",
"0.69990027",
"0.6770051",
"0.65594625",
"0.62602997",
"0.61753106",
"0.60747033",
"0.5963485",
"0.577271",
"0.5525091",
"0.5515122",
"0.5512154",
"0.5323065",
"0.53224075",
"0.53030145",
"0.5280672",
"0.5241605",
"0.5154319",
"0.5107975",
"0.499036... | 0.86994773 | 0 |
isScriptHashScript returns whether or not the passed script is a standard paytoscripthash script. | def isScriptHashScript(pkScript):
return extractScriptHash(pkScript) is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isStakeScriptHash(script, stakeOpcode):\n return extractStakeScriptHash(script, stakeOpcode) is not None",
"def isStakeSubmissionScript(scriptVersion, script):\n # The only currently supported script version is 0.\n if scriptVersion != 0:\n return False\n\n # The only supported stake submi... | [
"0.6985879",
"0.6771758",
"0.6672279",
"0.6639186",
"0.6558154",
"0.65305465",
"0.6217598",
"0.61344045",
"0.59568125",
"0.58778286",
"0.5871108",
"0.5774199",
"0.57442975",
"0.5731211",
"0.5684391",
"0.56413454",
"0.55964047",
"0.5583554",
"0.5577422",
"0.5501302",
"0.537739... | 0.8142619 | 0 |
isPubKeyScript returns whether or not the passed script is either a standard paytocompressedsecp256k1pubkey or paytouncompressedsecp256k1pubkey script. | def isPubKeyScript(script):
return extractPubKey(script) is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isPubKeyAltScript(script):\n pk, _ = extractPubKeyAltDetails(script)\n return pk is not None",
"def isPubKeyHashAltScript(script):\n pk, _ = extractPubKeyHashAltDetails(script)\n return pk is not None",
"def extractCompressedPubKey(script):\n # pay-to-compressed-pubkey script is of the form:... | [
"0.76807207",
"0.74758685",
"0.6837888",
"0.6813417",
"0.66855085",
"0.66854256",
"0.6649673",
"0.65490615",
"0.64809483",
"0.64256275",
"0.6318871",
"0.6282563",
"0.5937391",
"0.58674556",
"0.58500725",
"0.57804334",
"0.5736307",
"0.5711921",
"0.56116784",
"0.5450774",
"0.54... | 0.87469333 | 0 |
isStakeScriptHash returns whether or not the passed public key script is a standard paytoscripthash script tagged with the provided stake opcode. | def isStakeScriptHash(script, stakeOpcode):
return extractStakeScriptHash(script, stakeOpcode) is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isStakeSubmissionScript(scriptVersion, script):\n # The only currently supported script version is 0.\n if scriptVersion != 0:\n return False\n\n # The only supported stake submission scripts are pay-to-pubkey-hash and\n # pay-to-script-hash tagged with the stake submission opcode.\n stak... | [
"0.74850756",
"0.72760284",
"0.7159659",
"0.685685",
"0.6720025",
"0.65972114",
"0.65785325",
"0.6557142",
"0.65356684",
"0.65006304",
"0.6342475",
"0.6015369",
"0.5896307",
"0.58825606",
"0.58197266",
"0.5727122",
"0.5658983",
"0.5587728",
"0.54950094",
"0.5426798",
"0.54075... | 0.82549566 | 0 |
isStakeRevocationScript returns whether or not the passed script is a supported stake revocation script. | def isStakeRevocationScript(scriptVersion, script):
# The only currently supported script version is 0.
if scriptVersion != 0:
return False
# The only supported stake revocation scripts are pay-to-pubkey-hash and
# pay-to-script-hash tagged with the stake submission opcode.
stakeOpcode = op... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isStakeGenScript(scriptVersion, script):\n # The only currently supported script version is 0.\n if scriptVersion != 0:\n return False\n\n # The only supported stake generation scripts are pay-to-pubkey-hash and\n # pay-to-script-hash tagged with the stake submission opcode.\n stakeOpcode... | [
"0.6676638",
"0.65523857",
"0.6528182",
"0.5885715",
"0.57545006",
"0.57171816",
"0.570892",
"0.5288599",
"0.5230482",
"0.513883",
"0.5070677",
"0.50654864",
"0.5056044",
"0.49159798",
"0.48469758",
"0.48185316",
"0.48163933",
"0.47841194",
"0.47524068",
"0.47524068",
"0.4689... | 0.8317017 | 0 |
isNullOutpoint determines whether or not a previous transaction output point is set. | def isNullOutpoint(tx):
nullInOP = tx.txIn[0].previousOutPoint
if (
nullInOP.index == wire.MaxUint32
and nullInOP.hash == ByteArray(0, length=HASH_SIZE)
and nullInOP.tree == wire.TxTreeRegular
):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_null(self) -> bool:\n return self.allele1 == -1 and self.allele2 == -1",
"def __nonzero__(self):\n return not self.as_point == (0, 0)",
"def isnull(inputobject):\n return isinstance(inputobject, matrix) and inputobject.y == 0",
"def is_null(self):\n return self.begin >= self.en... | [
"0.572587",
"0.5494097",
"0.5468214",
"0.5427008",
"0.5427008",
"0.54117066",
"0.54117066",
"0.54117066",
"0.54117066",
"0.54117066",
"0.5410235",
"0.5354522",
"0.5306289",
"0.52994424",
"0.52847725",
"0.50248367",
"0.5020674",
"0.5019295",
"0.501641",
"0.5016285",
"0.5008537... | 0.7417642 | 0 |
isNullFraudProof determines whether or not a previous transaction fraud proof is set. | def isNullFraudProof(tx):
txIn = tx.txIn[0]
if txIn.blockHeight != wire.NullBlockHeight:
return False
elif txIn.blockIndex != wire.NullBlockIndex:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_nullable(self):\n return self._is_nullable",
"def _is_nullable(self) -> bool:\n return self.__nullable",
"def is_nullable(self) -> bool: # pragma: no cover\n pass",
"def has_unpublished_feedbackdraft(self):\n last_feedbackset = self.cached_data.last_feedbackset\n re... | [
"0.5800411",
"0.5765913",
"0.5574588",
"0.5363698",
"0.53069085",
"0.527119",
"0.52068",
"0.5203792",
"0.51953936",
"0.5179996",
"0.5179996",
"0.5179996",
"0.5179996",
"0.5179996",
"0.51507264",
"0.5068233",
"0.50369585",
"0.50369453",
"0.502015",
"0.5006343",
"0.49657416",
... | 0.73267996 | 0 |
SignatureScript creates an input signature script for tx to spend coins sent from a previous output to the owner of privKey. tx must include all transaction inputs and outputs, however txin scripts are allowed to be filled or empty. The returned script is calculated to be used as the idx'th txin sigscript for tx. subsc... | def signatureScript(tx, idx, subscript, hashType, privKey, compress):
sig = rawTxInSignature(tx, idx, subscript, hashType, privKey.key)
pubKey = privKey.pub
if compress:
pkData = pubKey.serializeCompressed()
else:
pkData = pubKey.serializeUncompressed()
script = addData(sig)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signTxOutput(\n netParams, tx, idx, pkScript, hashType, keysource, previousScript, sigType\n):\n\n sigScript, scriptClass, addresses, nrequired = sign(\n netParams, tx, idx, pkScript, hashType, keysource, sigType\n )\n\n isStakeType = (\n scriptClass == StakeSubmissionTy\n or s... | [
"0.6949658",
"0.68388593",
"0.6723117",
"0.66593707",
"0.6648539",
"0.6631726",
"0.6596259",
"0.6583522",
"0.6548207",
"0.6508995",
"0.6417073",
"0.60621965",
"0.6003982",
"0.5993239",
"0.586111",
"0.5825078",
"0.58022976",
"0.5738131",
"0.5488762",
"0.54229194",
"0.54102147"... | 0.83294255 | 0 |
rawTxInSignature returns the serialized ECDSA signature for the input idx of the given transaction, with hashType appended to it. | def rawTxInSignature(tx, idx, subScript, hashType, key):
sigHash = calcSignatureHash(subScript, hashType, tx, idx, None)
sig = signRFC6979(key, sigHash).serialize()
return sig + ByteArray(hashType) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tx_signature(tx, private_key, btc_address, hashcode=SIGHASH_ALL):\n tx_obj = deserialize(tx)\n index = None\n\n for tx_in in tx_obj['ins']:\n prev_tx_hash = tx_in['outpoint']['hash']\n prev_tx_info = get_tx_info(prev_tx_hash)\n if btc_address in prev_tx_info['to']:\n ... | [
"0.6972546",
"0.6505088",
"0.6497032",
"0.6440196",
"0.6333097",
"0.61801964",
"0.6174183",
"0.61535615",
"0.6059512",
"0.58560526",
"0.58009124",
"0.56634223",
"0.5662577",
"0.5619632",
"0.5593203",
"0.5528263",
"0.5469569",
"0.54579616",
"0.54424334",
"0.5346117",
"0.529353... | 0.8257004 | 0 |
getP2PKHOpCode returns opNonstake for nonstake transactions, or the stake op code tag for stake transactions. | def getP2PKHOpCode(pkScript):
scriptClass = getScriptClass(DefaultScriptVersion, pkScript)
if scriptClass == NonStandardTy:
raise NotImplementedError("unknown script class")
if scriptClass == StakeSubmissionTy:
return opcode.OP_SSTX
elif scriptClass == StakeGenTy:
return opcode.O... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_op_code(self):\n\t\treturn call_sdk_function('PrlJob_GetOpCode', self.handle)",
"def opcode(self):\n return struct.unpack('<H', self.pkt.payload[0:2])[0]",
"def get_opcode(self, code):\r\n opcode = int(str(code)[-2:])\r\n return opcode",
"def code(self):\n return struct.un... | [
"0.6203094",
"0.5523006",
"0.5373357",
"0.5351597",
"0.5114213",
"0.5033707",
"0.48894057",
"0.48391286",
"0.46636218",
"0.45804527",
"0.45560363",
"0.4523402",
"0.4518826",
"0.4512385",
"0.4512385",
"0.4512385",
"0.4512385",
"0.44772545",
"0.446523",
"0.44408825",
"0.4438201... | 0.76397794 | 0 |
sumOutputSerializeSizes sums up the serialized size of the supplied outputs. | def sumOutputSerializeSizes(outputs): # outputs []*wire.TxOut) (serializeSize int) {
serializeSize = 0
for txOut in outputs:
serializeSize += txOut.serializeSize()
return serializeSize | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimateSerializeSize(scriptSizes, txOuts, changeScriptSize):\n # Generate and sum up the estimated sizes of the inputs.\n txInsSize = 0\n for size in scriptSizes:\n txInsSize += estimateInputSize(size)\n\n inputCount = len(scriptSizes)\n outputCount = len(txOuts)\n changeSize = 0\n ... | [
"0.6462144",
"0.6441453",
"0.63392305",
"0.6336783",
"0.56933695",
"0.56460446",
"0.563618",
"0.54580766",
"0.5450125",
"0.5410073",
"0.5405643",
"0.53822774",
"0.5337625",
"0.526125",
"0.5225958",
"0.52254355",
"0.51846975",
"0.5157322",
"0.5126482",
"0.509488",
"0.5087747",... | 0.8745179 | 0 |
calcMinRequiredTxRelayFee returns the minimum transaction fee required for a transaction with the passed serialized size to be accepted into the memory pool and relayed. | def calcMinRequiredTxRelayFee(relayFeePerKb, txSerializeSize):
# Calculate the minimum fee for a transaction to be allowed into the
# mempool and relayed by scaling the base fee (which is the minimum
# free transaction relay fee). minTxRelayFee is in Atom/KB, so
# multiply by serializedSize (which is i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def least_coins_recursion(total, coins):\r\n\tif total == 0:\r\n\t\treturn 0\r\n\tif total < 0:\r\n\t\treturn sys.maxsize\n\tglobal tmp_hash\n\tif tmp_hash[total] > 0 :\n\t\tmin_coins = tmp_hash[total]\n\telse:\n\t\ttmp_coins_list = list()\n\t\tfor j in coins:\n\t\t\ttmp_coins_list.append(1 + least_coins_recursion... | [
"0.54296213",
"0.5402364",
"0.5326594",
"0.52346253",
"0.5222074",
"0.5158793",
"0.51351357",
"0.5104766",
"0.51001406",
"0.5097015",
"0.5094509",
"0.50822234",
"0.5063303",
"0.506004",
"0.50524974",
"0.50524974",
"0.50418204",
"0.50286967",
"0.4993014",
"0.4987602",
"0.49780... | 0.82932746 | 0 |
isDustAmount determines whether a transaction output value and script length would cause the output to be considered dust. Transactions with dust outputs are not standard and are rejected by mempools with default policies. | def isDustAmount(amount, scriptSize, relayFeePerKb):
# Calculate the total (estimated) cost to the network. This is
# calculated using the serialize size of the output plus the serial
# size of a transaction input which redeems it. The output is assumed
# to be compressed P2PKH as this is the most com... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isDustOutput(output, relayFeePerKb):\n # Unspendable outputs which solely carry data are not checked for dust.\n if getScriptClass(output.version, output.pkScript) == NullDataTy:\n return False\n\n # All other unspendable outputs are considered dust.\n if isUnspendable(output.value, output.p... | [
"0.73336434",
"0.49962622",
"0.4839288",
"0.47090313",
"0.46839118",
"0.46388775",
"0.45573536",
"0.44859535",
"0.43570438",
"0.43371817",
"0.4335205",
"0.43014026",
"0.4297905",
"0.42958722",
"0.4262649",
"0.4262649",
"0.4262649",
"0.4262649",
"0.4262649",
"0.4262649",
"0.42... | 0.79953057 | 0 |
CalcStakeVoteSubsidy returns the subsidy for a single stake vote for a block. It is calculated as a proportion of the total subsidy and max potential number of votes per block. Unlike the ProofofWork and Treasury subsidies, the subsidy that votes receive is not reduced when a block contains less than the maximum number... | def calcStakeVoteSubsidy(self, height):
# Votes have no subsidy prior to the point voting begins. The minus one
# accounts for the fact that vote subsidy are, unfortunately, based on the
# height that is being voted on as opposed to the block in which they are
# included.
if hei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcTreasurySubsidy(self, height, voters):\n # The first two blocks have special subsidy rules.\n if height <= 1:\n return 0\n\n # The subsidy is zero if there are not enough voters once voting begins. A\n # block without enough voters will fail to validate anyway.\n ... | [
"0.69584745",
"0.66622514",
"0.5768431",
"0.56122226",
"0.48438108",
"0.46693507",
"0.45416835",
"0.45111522",
"0.44976842",
"0.4465849",
"0.44501305",
"0.4430841",
"0.44259617",
"0.4419266",
"0.43843272",
"0.43695715",
"0.43643126",
"0.43569943",
"0.43547025",
"0.43445402",
... | 0.83736104 | 0 |
calcTreasurySubsidy returns the subsidy required to go to the treasury for a block. It is calculated as a proportion of the total subsidy and further reduced proportionally depending on the number of votes once the height at which voting begins has been reached. Note that passing a number of voters fewer than the minim... | def calcTreasurySubsidy(self, height, voters):
# The first two blocks have special subsidy rules.
if height <= 1:
return 0
# The subsidy is zero if there are not enough voters once voting begins. A
# block without enough voters will fail to validate anyway.
stakeVal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcStakeVoteSubsidy(self, height):\n # Votes have no subsidy prior to the point voting begins. The minus one\n # accounts for the fact that vote subsidy are, unfortunately, based on the\n # height that is being voted on as opposed to the block in which they are\n # included.\n ... | [
"0.7263882",
"0.6404135",
"0.59105176",
"0.4972756",
"0.4885666",
"0.48728204",
"0.48116675",
"0.47756618",
"0.47662276",
"0.4742092",
"0.47104034",
"0.47058353",
"0.4688445",
"0.46705577",
"0.466427",
"0.45965254",
"0.45807502",
"0.45483452",
"0.45479655",
"0.45381767",
"0.4... | 0.8650657 | 0 |
HTML/XML table to XMLTree object | def html_table_to_xmltree(html):
node = et.fromstring(re.sub(r'>\s+<', '><', html.strip()))
xml = html_table_to_xmltree_sub(node)
return XMLTree(xml) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_table_to_xmltree_sub(node):\n # Split text into Token nodes\n # NOTE: very basic token splitting here... (to run through CoreNLP?)\n if node.text is not None:\n for tok in re.split(r'\\s+', node.text):\n node.append(et.Element('token', attrib={'word':tok}))\n \n # Recursively append children\... | [
"0.74380404",
"0.65061134",
"0.61749095",
"0.6132701",
"0.6092956",
"0.60411733",
"0.5957507",
"0.5948504",
"0.5849651",
"0.5849651",
"0.5840876",
"0.5753681",
"0.5716089",
"0.5704186",
"0.5648148",
"0.5646785",
"0.5646117",
"0.556407",
"0.5557506",
"0.5521896",
"0.55053955",... | 0.8245505 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.