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 |
|---|---|---|---|---|---|---|
Return a relative version of a path | def relpath26(path, start=os.curdir):
if not path:
raise ValueError("no path specified")
start_list = os.path.abspath(start).split(os.path.sep)
path_list = os.path.abspath(path).split(os.path.sep)
if start_list[0].lower() != path_list[0].lower():
unc_path, rest = splitunc(path)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative(self, path):\n return re.sub(self.path_regex, '', path).lstrip(os.sep)",
"def relativize(path: str):\n return join('.', path)",
"def relativePath(path):\n spath = pathSplit(path)\n return spath[-1]",
"def get_relative_path(path: str):\n return os.path.relpath(path, get_project... | [
"0.7916205",
"0.77834916",
"0.77383643",
"0.765349",
"0.7530642",
"0.7522436",
"0.7415771",
"0.7404095",
"0.729165",
"0.72837",
"0.7279967",
"0.723366",
"0.7217335",
"0.71864855",
"0.7178365",
"0.7105353",
"0.7092798",
"0.70900303",
"0.70873284",
"0.70858437",
"0.70681816",
... | 0.0 | -1 |
Test that the Zassenhaus algorithm raises an error when the input has inconsistent dimension. | def test_zassenhaus_inconsistent_dim(input_bases):
with pytest.raises(ValueError):
zassenhaus(*input_bases) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unknown_weigh_exception(self):\n z_matrix = np.array(\n [[0.0, 0.0, 1.0],\n [0.1, 0.2, 0.8],\n [0.2, 0.4, 0.6],\n [0.3, 0.7, 0.3],\n [0.6, 0.8, 0.2],\n [0.8, 0.9, 0.1],\n [1.0, 1.0, 0.0]],\n dtype=np.float... | [
"0.67524713",
"0.6719426",
"0.66936415",
"0.6620208",
"0.66172826",
"0.6609881",
"0.6603864",
"0.6579804",
"0.656651",
"0.65514654",
"0.6547087",
"0.6520995",
"0.65174687",
"0.6507072",
"0.64990294",
"0.6497248",
"0.64500827",
"0.64472127",
"0.6443199",
"0.6373365",
"0.636905... | 0.8237013 | 0 |
Turn off the LED light | def off(self, color='all'):
if color in ['all', 'r']:
self.__send('r', 'off')
if color in ['all', 'g']:
self.__send('g', 'off')
if color in ['all', 'b']:
self.__send('b', 'off') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self):\n GPIO.output(self.gpio, False) # turn off light",
"def turn_off(self):\n print(\"Turning the lights off\")\n self.led.all_off()\n self.client.publish(STATE_TOPIC, OFF) #publish",
"def turn_off(self, **kwargs: Any) -> None:\n self._device.power_on = False... | [
"0.9098916",
"0.87860805",
"0.863714",
"0.85260457",
"0.8431987",
"0.84233093",
"0.8382514",
"0.8363099",
"0.8342604",
"0.8337329",
"0.8312644",
"0.8291258",
"0.82482105",
"0.8243882",
"0.82085174",
"0.8207159",
"0.811875",
"0.8092324",
"0.8034994",
"0.8020193",
"0.7994777",
... | 0.0 | -1 |
Toggle the LED light. Turn off while the light on status and turn on while the light off. | def toggle(self, color='all'):
if color in ['all', 'r']:
self.__send('r', 'toggle')
if color in ['all', 'g']:
self.__send('g', 'toggle')
if color in ['all', 'b']:
self.__send('b', 'toggle') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def led_toggle(self):\n if self.state == GPIO.LOW:\n self.state = GPIO.HIGH\n else:\n self.state = GPIO.LOW\n return self.update_status()",
"def turn_on(self):\n GPIO.output(self.gpio, True) # turn on light",
"def toggle(self):\n self._interrupt_flash()... | [
"0.8128857",
"0.79605216",
"0.76151997",
"0.7484463",
"0.7410243",
"0.73769903",
"0.7369239",
"0.732776",
"0.7300347",
"0.7296502",
"0.7268717",
"0.7263247",
"0.72266966",
"0.7218166",
"0.72032404",
"0.71941334",
"0.71164215",
"0.7116177",
"0.71115065",
"0.7090818",
"0.706841... | 0.0 | -1 |
If 'mantis_id' is None, add all issues If `add_after` is False, add issues with IDs less than `mantis_id`. If `add_after` is True, add issues with IDs greater than `mantis_id`. | def add_issues(self, mantis_id=None, add_after=False, database=None,
pause_count=None, pause_seconds=None, report_progress=None,
verbose=False):
issues = []
for inum in self.__project_issue_numbers:
if mantis_id is not None:
if not add_af... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_orders_after(user, after_date, items):\n order_dates = get_order_dates(after_date)\n for order_date in order_dates:\n if not order_date.is_editable:\n continue\n\n for item in items:\n order = BreadOrder(\n user=user,\n date=order_date... | [
"0.50791806",
"0.48217428",
"0.4815567",
"0.4730302",
"0.46686578",
"0.46100894",
"0.4567516",
"0.45626375",
"0.45396146",
"0.44809577",
"0.44540864",
"0.4449402",
"0.4442932",
"0.44306818",
"0.43877757",
"0.43731502",
"0.43698195",
"0.4355999",
"0.43274876",
"0.4326846",
"0.... | 0.7036041 | 0 |
Method for spliting dataset to the training and test. | def split_dataset(self, test_size=0.20):
(self.training_data, self.test_data, self.training_labels, self.test_labels) = train_test_split(self.training_data, self.training_labels, test_size=test_size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n self.valid, self.test, _, _ = train_test_split(self.valid, self.valid, test_size=0.5)",
"def split_data(self, data):\n\n train_df, test_df = train_test_split(data, test_size=se... | [
"0.89554304",
"0.82610244",
"0.82391465",
"0.8219358",
"0.8165741",
"0.81357616",
"0.8107226",
"0.79983044",
"0.795695",
"0.79256755",
"0.7915028",
"0.79078156",
"0.7877868",
"0.7861761",
"0.7856721",
"0.7838992",
"0.7808851",
"0.7779093",
"0.7777716",
"0.77745175",
"0.773286... | 0.8575196 | 1 |
Method that creates the pipeline for only important feature extraction with univariate_feature_selection. | def univariate_feature_selection(self, method, scoring, number):
self.scoring_functions = {
"f_classif": f_classif,
"mutual_info_classif": mutual_info_classif,
"chi2": chi2
}
self.selection_methods = {
"select_k_best": SelectKBest(self.scoring_functions[scoring], k=number),
"select_percentile": Se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pipeline(self):\n\n transformers = []\n\n custom = self.CustomFeature()\n #transformers.append(('custom', custom))\n n_features = int(self.n_features/2)\n\n #kbest = SelectKBest(score_func=chi2, k=n_features)\n #transformers.append(('kbest', kbest))\n\n # pca = ... | [
"0.691752",
"0.6515457",
"0.6514647",
"0.64553595",
"0.6396666",
"0.6391689",
"0.63481605",
"0.62624484",
"0.6191567",
"0.6166328",
"0.61137426",
"0.61040705",
"0.6085444",
"0.607597",
"0.6019646",
"0.59978026",
"0.5990065",
"0.59273946",
"0.5851573",
"0.584903",
"0.5838492",... | 0.5807853 | 24 |
Returns the value to which the specified key is mapped, or 1 if this map contains no mapping for the key | def get(self, key: int) -> int:
pos = self.hash(key)
if key in self.table[pos]:
return self.table[pos][key]
else:
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, key: int) -> int:\n if key not in self.map:\n return -1\n return self.map[key]",
"def get(self, key: int) -> int:\n if key in self.hashmap.keys():return self.hashmap[key]\n else:return -1",
"def get(self, key: int) -> int:\n sh = key % 37\n if ... | [
"0.80029744",
"0.79090077",
"0.76285666",
"0.75648946",
"0.7555506",
"0.752899",
"0.7525261",
"0.74916106",
"0.7293888",
"0.72929615",
"0.7221035",
"0.7216307",
"0.7180106",
"0.7176812",
"0.7160988",
"0.6980195",
"0.69278413",
"0.67843336",
"0.67558086",
"0.67320067",
"0.6611... | 0.7373553 | 8 |
Gets the full set of targets supported by this builder. Used in automatic target name transformations, and also in offering the user choices. | def GetTargets(self):
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def targets(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['PlanTargetsArgs']]]]:\n return pulumi.get(self, \"targets\")",
"def Targets(self):\n return self._targets",
"def targets(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ContactTargetsArgs']]]]:\n return pulumi.get(self... | [
"0.7267673",
"0.72533965",
"0.7115405",
"0.69083786",
"0.6887221",
"0.684837",
"0.67811924",
"0.67587334",
"0.64828795",
"0.6480067",
"0.6447007",
"0.64061385",
"0.6405271",
"0.6329794",
"0.6288235",
"0.619657",
"0.61855984",
"0.6152486",
"0.61432",
"0.6072367",
"0.6062667",
... | 0.62242705 | 15 |
Returns a list of closest matching targets for a named target. | def GuessTargets(self, target_name):
return difflib.get_close_matches(target_name, self.GetTargets(), 10, 0.4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_closest(self, targets):\n min_distance = None\n closest = None\n targets = filter(lambda x: not x.owner or x.owner is self, targets)\n for target in targets:\n # If target currently in use, skip it\n if target.occupied_by:\n print(f\"{t... | [
"0.6920748",
"0.6278692",
"0.6217341",
"0.6204103",
"0.61921126",
"0.6167426",
"0.6105352",
"0.60744244",
"0.60616773",
"0.59815866",
"0.58965415",
"0.5893583",
"0.5890426",
"0.58796626",
"0.5878019",
"0.58761984",
"0.5838707",
"0.58263904",
"0.5734014",
"0.5723764",
"0.57050... | 0.7324836 | 0 |
Functor to return a uppercase string. | def upper(value):
return value.upper() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upper(value): # Only one argument.\n return value.upper()",
"def uppercase(str):\n \n return str.upper()",
"def upper(self) -> String:\n pass",
"def uppercase(string):\n\n return str(string).upper()",
"def UPPER(text):\n return text.upper()",
"def to_upper(self, text):\n\t\treturn te... | [
"0.7736215",
"0.751684",
"0.74385214",
"0.7289567",
"0.7086765",
"0.70487165",
"0.7014051",
"0.6949512",
"0.6941151",
"0.6875285",
"0.68643904",
"0.68633956",
"0.6825572",
"0.6812113",
"0.6797524",
"0.6794077",
"0.6755859",
"0.6737372",
"0.66871476",
"0.6634358",
"0.6487766",... | 0.748002 | 2 |
Functor to return a whitespace stripped string. | def strip(value):
return value.strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_space():\n pass",
"def trim_whitespace(str):\n return str.strip()",
"def _clean(s):\n return re.sub(r'\\s+', ' ', s.strip())",
"def strip_whitespace(self, text):\n\t\treturn text.strip()",
"def strip_space(string):\n return string.replace(' ', '')",
"def _StripWS(s):\r\n return re.... | [
"0.72803855",
"0.708484",
"0.6857887",
"0.6845617",
"0.68302655",
"0.6736759",
"0.6736759",
"0.66933715",
"0.66795033",
"0.66662675",
"0.66065574",
"0.65711504",
"0.6561733",
"0.65381485",
"0.65308195",
"0.6514705",
"0.64818996",
"0.64725375",
"0.64662844",
"0.64420325",
"0.6... | 0.6425698 | 21 |
Name the league champion for this season. | def _name_champion(self):
# TODO BREAK TIES
return max(self.teams, key=lambda team: len(team.wins)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def team_name(self):\n return 'Team Name'",
"def get_champion_name(champion_id, api_key=read_key(), region='na'):\n response = urllib2.urlopen('https://global.api.pvp.net/api/lol/static-data/'+region+'/v1.2/champion/' +\n str(champion_id)+'?api_key=' + api_key)\n champi... | [
"0.68287086",
"0.66475165",
"0.6388904",
"0.6247523",
"0.6240383",
"0.6227796",
"0.6180316",
"0.60847265",
"0.6078636",
"0.60367405",
"0.60168505",
"0.60109186",
"0.59963465",
"0.59931976",
"0.59854746",
"0.59711856",
"0.5929514",
"0.59019774",
"0.5875374",
"0.5856296",
"0.58... | 0.72963077 | 0 |
The number of rows applied, plus the number of rows in error. | def total_count(self):
return self.applied_count + self.error_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumRows(self) -> int:\n ...",
"def num_rows(self):\n return (len(self.rows))",
"def row_count(self) -> int:\n return len(self.rows)",
"def row_count(self) -> int:\n return len(self.rows)",
"def num_rows(self):\n return len(self.rows)",
"def rowcount(self):\n\t\tr... | [
"0.77358806",
"0.7658716",
"0.7552611",
"0.7552611",
"0.75167227",
"0.7471678",
"0.74319524",
"0.7423443",
"0.7343645",
"0.73394495",
"0.7335471",
"0.73140174",
"0.7270245",
"0.7251893",
"0.7219502",
"0.7217385",
"0.7215328",
"0.72083944",
"0.7122091",
"0.70914394",
"0.704539... | 0.69896233 | 22 |
Checks the values of a WindowPair. If any problems are found, it flags them in red. Returns True / False for ok / not ok. | def check(self):
# get values
ystart, xleft, xright, nx, ny = self.get()
# are they all OK individually?
ok = self.ystart.ok() and self.xleft.ok() and self.xright.ok() and \
self.nx.ok() and self.ny.ok()
# now come cross-value checks:
# is rightmost pixel ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check(self):\n\n ok = True\n\n # check that each pair is ok on its own\n for winp in self.winps:\n if not winp.check():\n ok = False\n\n # check that no pairs overlap in the Y direction\n ystart0,xleft0,xright0,nx0,ny0 = self.winps[0].get()\n ... | [
"0.7280459",
"0.64105046",
"0.6135781",
"0.6016167",
"0.5988482",
"0.59411937",
"0.5928348",
"0.5897497",
"0.5861804",
"0.5850843",
"0.579835",
"0.5797004",
"0.5731858",
"0.5723502",
"0.5701964",
"0.57005197",
"0.5695273",
"0.56533974",
"0.5628439",
"0.56216186",
"0.560936",
... | 0.65346867 | 1 |
Instantiate an account. This constructor should only be directly called when it's desired to create a new account using just a password and a randomly generated private key, otherwise use the alternative constructors | def __init__(self, password: str,
private_key: Optional[bytes] = None,
watch_only: bool = False,
address: Optional[str] = None,
label: Optional[str] = None,
lock: bool = False,
contract: Optional[contracts.Contract] = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new(cls, password, key=None, uuid=None, path=None):\n if key is None:\n key = mk_random_privkey()\n\n # [NOTE]: key and password should be bytes\n if not is_string(key):\n key = to_string(key)\n if not is_string(password):\n password = to_string(pass... | [
"0.78722817",
"0.7258734",
"0.6898454",
"0.67368233",
"0.6699483",
"0.6698168",
"0.6669464",
"0.6666555",
"0.6654865",
"0.66117704",
"0.65626335",
"0.65057623",
"0.6499423",
"0.64622176",
"0.6368004",
"0.63259524",
"0.63200647",
"0.62456703",
"0.62340075",
"0.6196716",
"0.616... | 0.6454271 | 14 |
Instantiate and returns an account from a given wif and password. | def from_wif(cls, wif: str, password: str) -> Account:
return cls(password=password, private_key=cls.private_key_from_wif(wif)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,account,username, password):\n self.account = account\n self.username = username\n self.password = password",
"def __init__(self,Account,username,password):\n self.Account = Account\n self.username = username\n self.password = password",
"def create_a... | [
"0.65044117",
"0.6310783",
"0.62864006",
"0.62818706",
"0.6231221",
"0.62165356",
"0.6215969",
"0.61335546",
"0.6118962",
"0.5977061",
"0.586638",
"0.5833336",
"0.57898766",
"0.5760846",
"0.5753914",
"0.57516044",
"0.5743921",
"0.57119364",
"0.56248856",
"0.5603027",
"0.55973... | 0.84263015 | 0 |
Get numeral values from a column. | def get_column(in_f, column=0):
for line in in_f:
value = line.split()[column]
try:
value = float(value)
except ValueError:
value = None
yield value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_number(self, rows: List[Row], column: NumberColumn) -> Number:\n numbers: List[float] = []\n for row in rows:\n cell_value = row.values[column.name]\n if isinstance(cell_value, float):\n numbers.append(cell_value)\n\n return numbers[0] if numbers... | [
"0.6913897",
"0.6599753",
"0.6514567",
"0.64090616",
"0.6285983",
"0.6182886",
"0.6075679",
"0.60131425",
"0.5956224",
"0.58398235",
"0.581068",
"0.5797837",
"0.5731052",
"0.57033914",
"0.5601626",
"0.5601626",
"0.5601626",
"0.5601626",
"0.55814517",
"0.5526401",
"0.55178505"... | 0.5326149 | 36 |
Generates the environment variables list for an application of type SSER | def generateEnvList( self, index ):
EnvList = [
("GLOBUS_DUROC_SUBJOB_INDEX", "%d" % index),
("LD_LIBRARY_PATH", "/usr/local/globus/globus-3.2/lib/")
]
return EnvList | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_environment(self):\n envvars = {}\n for key in self.envvars:\n try:\n envvars[key] = os.environ[key]\n except KeyError:\n continue\n\n # Warn the user that we cannot support secrets\n if envvars:\n logger.warni... | [
"0.7046139",
"0.70148987",
"0.6612566",
"0.6599169",
"0.6573192",
"0.6566125",
"0.6431719",
"0.64266616",
"0.6393218",
"0.63826114",
"0.6378862",
"0.634711",
"0.6345269",
"0.63368773",
"0.6226397",
"0.6204843",
"0.6181352",
"0.61801493",
"0.6159335",
"0.615245",
"0.61086816",... | 0.6713219 | 2 |
Creates a node with the given label. The label must be a string for use with the PQGram algorithm. | def __init__(self, label):
self.label = label
self.children = list() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n(label):\n global id\n node = pydot.Node(name=id, obj_dict=None, label=label)\n id += 1\n graph.add_node(node)\n return node",
"def create_node(self, *labels, **props):\n component = Node(*labels, **props)\n self.graph.create(component)\n return component",
"def create_new_node(s... | [
"0.67834806",
"0.6396251",
"0.6215353",
"0.61980563",
"0.6132489",
"0.61282533",
"0.6104603",
"0.60961515",
"0.60835075",
"0.6052563",
"0.59633195",
"0.5948374",
"0.5892859",
"0.5891874",
"0.5883719",
"0.58648664",
"0.58566564",
"0.5849776",
"0.5836935",
"0.5782482",
"0.57588... | 0.52988166 | 47 |
Computes the edit distance between two PQGram Profiles. This value should always be between 0.0 and 1.0. This calculation is reliant on the intersection method. | def edit_distance(self, other):
union = len(self) + len(other)
return 1.0 - 2.0*(self.intersection(other)/union) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gram_edit_distance(self, gram1, gram2):\r\n distance = 0.0\r\n if gram1 == gram2:\r\n distance = 1.0\r\n return distance",
"def gram_edit_distance(self, gram1, gram2):\n distance = 0.0\n if gram1 == gram2:\n distance = 1.0\n return distance",
... | [
"0.6954483",
"0.6954117",
"0.6331403",
"0.6307539",
"0.6120704",
"0.61015373",
"0.5989113",
"0.5968466",
"0.594435",
"0.5941943",
"0.5940011",
"0.59327114",
"0.5907452",
"0.5903014",
"0.58983225",
"0.58959496",
"0.5885451",
"0.58801675",
"0.58702207",
"0.5868561",
"0.5867697"... | 0.627328 | 4 |
Creates an internal list of the specified size and fills it with the default value of "". Once a ShiftRegister is created you cannot change the size without concatenating another ShiftRegister. | def __init__(self, size):
self.register = list()
for i in range(size):
self.register.append("*") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _resize_list(self, new_size: int):\n for _ in range((new_size + 1) - len(self)):\n self.append(0)",
"def __init__(self, size: int):\r\n self.l = []\r\n self.sz = size\r\n self.sm = 0",
"def testRegisterCreation(self):\n sizes = list()\n for i in range(10... | [
"0.6161752",
"0.60480016",
"0.58815473",
"0.58761644",
"0.5761343",
"0.5758599",
"0.5650796",
"0.5643129",
"0.5624663",
"0.5615912",
"0.5596628",
"0.5538347",
"0.5499173",
"0.54861355",
"0.5458629",
"0.54465675",
"0.54397625",
"0.5435063",
"0.5413335",
"0.5389931",
"0.5387299... | 0.63082594 | 0 |
Concatenates two ShiftRegisters and returns the resulting ShiftRegister. | def concatenate(self, reg):
temp = list(self.register)
temp.extend(reg.register)
return temp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testRegisterConcatenation(self):\n reg_one = ShiftRegister(2)\n reg_one.shift(\"a\")\n reg_one.shift(\"b\")\n reg_two = ShiftRegister(3)\n reg_two.shift(\"c\")\n reg_two.shift(\"d\")\n reg_two.shift(\"e\")\n reg_cat = reg_one.concatenate(reg_two)\n ... | [
"0.67564994",
"0.5837776",
"0.5616268",
"0.55135673",
"0.5468361",
"0.54525924",
"0.5439346",
"0.5371612",
"0.5352196",
"0.5324187",
"0.5293746",
"0.5288235",
"0.5288235",
"0.5256369",
"0.5252603",
"0.524575",
"0.52294064",
"0.5221462",
"0.5187699",
"0.5187699",
"0.5175249",
... | 0.5613873 | 3 |
This method will take a normal tree structure and the given values for p and q, returning a new tree which represents the socalled PQExtendedTree. | def build_extended_tree(root, p=1, q=1):
original_root = root # store for later
# Step 1
for i in range(p-1):
node = Node(label="*")
node.addkid(root)
root = node
# Steps 2 and 3
list_of_children = original_root.children
if(len(list_of_children) == 0):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nltk_to_qtree(tree):\n return \"\\\\\"+\"Tree {}\".format(_compute_repr(tree))",
"def isSameTree(self, p, q):\n # Initialize two queues for each tree with root nodes\n q1, q2 = deque([p]), deque([q])\n\n # Loop while q1 and q2 len(q1) == len(q2)\n while (q1 and q2) and (len(q1)... | [
"0.6004092",
"0.56338376",
"0.55847466",
"0.55218244",
"0.5488793",
"0.54671514",
"0.5432379",
"0.54169387",
"0.54126024",
"0.5398982",
"0.5360151",
"0.5334569",
"0.5309979",
"0.52630544",
"0.5259419",
"0.5203182",
"0.5194728",
"0.51930785",
"0.5190961",
"0.51853263",
"0.5129... | 0.7214988 | 0 |
Ensure that two different PQGram Profile are actually the same. Used in later tests to compare dynamically created Profiles against preset Profiles. | def checkProfileEquality(self, profile1, profile2):
if len(profile1) != len(profile2) or len(profile1[0]) != len(profile2[0]):
return False
for gram1 in profile1:
contains = False
for gram2 in profile2:
if gram1 == gram2:
contains =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkProfileEquality(self, profile1, profile2):\r\n if len(profile1) != len(profile2) or len(profile1[0]) != len(profile2[0]):\r\n return False\r\n for gram1 in profile1:\r\n contains = False\r\n for gram2 in profile2:\r\n if gram1 == gram2:\r\n ... | [
"0.7128957",
"0.6806193",
"0.6779668",
"0.60975534",
"0.586982",
"0.57932186",
"0.5639829",
"0.5503911",
"0.5437295",
"0.54024154",
"0.5368421",
"0.53682536",
"0.5355948",
"0.5344326",
"0.53417224",
"0.53026056",
"0.5295276",
"0.5286694",
"0.52284336",
"0.522824",
"0.52236074... | 0.71741575 | 0 |
Normalizes a Wikidata item identifier >>> to_q('Q1234') 'Q1234' | def to_q(url):
if type(url) != str:
return
match = config.q_re.match(url.strip())
if match:
return match.group(config.q_re_group_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qid(self) -> str:\n return self._itempage.title()",
"def quat_normalize(q):\n if q[0] < 0:\n q = -q\n q_norm = math.sqrt(q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3])\n qn = q / q_norm\n return qn",
"def normalize(item):\n item = item.lower().strip().rstrip('_')\n r... | [
"0.6520814",
"0.63027114",
"0.57867503",
"0.57641643",
"0.5662145",
"0.55990016",
"0.55610466",
"0.5509767",
"0.5407902",
"0.5377882",
"0.53394204",
"0.52613723",
"0.524593",
"0.5225572",
"0.52095103",
"0.5202225",
"0.51897955",
"0.51742655",
"0.51638603",
"0.51584107",
"0.51... | 0.5180563 | 17 |
Normalizes a Wikidata property identifier >>> to_p('P1234') 'P1234' | def to_p(url):
if type(url) != str:
return
match = config.p_re.match(url.strip())
if match:
return match.group(config.p_re_group_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_pmid(val):\n m = pmid_regexp.match(val)\n return m.group(2)",
"def _a_to_pid(self, link):\n title = link.get('title')\n match = property_re.match(title)\n if match:\n return match.group(2)",
"def _sanitize_to_identifer(name):\n n = name.strip()\n n = re... | [
"0.65713704",
"0.56733394",
"0.56100345",
"0.5556826",
"0.54838204",
"0.5454807",
"0.54023707",
"0.54013544",
"0.53587043",
"0.5339857",
"0.53060675",
"0.52711654",
"0.5255018",
"0.52454776",
"0.5211262",
"0.52029216",
"0.5169888",
"0.51516956",
"0.5118911",
"0.51147336",
"0.... | 0.55868983 | 3 |
Replace substrings in s according to mapping (a sequence of | def replace_substrings(s, mapping):
for (s1, repl) in mapping:
s = s.replace(s1, repl)
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_many(text: str, /, mapping: _Mapping[str, str], *, ignore_case: bool = False) -> str:\n if not mapping:\n return text\n\n if ignore_case:\n normalize: _Callable[[str], str] = lambda s: s.lower()\n re_mode = _re.IGNORECASE\n\n mapping = {normalize(key): val for key, val... | [
"0.7268492",
"0.70326984",
"0.7008759",
"0.6968927",
"0.6762078",
"0.6729505",
"0.66941446",
"0.6669461",
"0.6647284",
"0.65870917",
"0.6471583",
"0.6429247",
"0.6412923",
"0.63938326",
"0.63737065",
"0.63635397",
"0.62747",
"0.6252348",
"0.6248728",
"0.6240093",
"0.6238764",... | 0.89654297 | 0 |
Sort an OrderedDict inplace. | def _ordered_dictionary_sort(d, key=None):
items = [(k, d[k]) for k in sorted(d, key=key)]
d.clear()
d.update(items) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dictorder():\n d = {1: 'a', 3: 'c', 2: 'b'}\n d.sort()\n print(d)",
"def sort(self):\n self.keys = sorted(self.keys)\n self.keys.reverse()",
"def order_dict_alphabetically(d):\n od = OrderedDict()\n for key in sorted(list(d.keys())):\n assert key not in od\n od[ke... | [
"0.63416475",
"0.628851",
"0.6270603",
"0.6100329",
"0.5850811",
"0.58167475",
"0.5747687",
"0.5739225",
"0.5731727",
"0.5729787",
"0.57237804",
"0.5710882",
"0.57041484",
"0.55458856",
"0.5521257",
"0.551189",
"0.5501789",
"0.5500597",
"0.54872984",
"0.5466565",
"0.5466144",... | 0.68532526 | 0 |
Adds CA certificates from 'ca_certs' to the systemwide CA store (if available on the platform). Returns True if the operation succeeded, False otherwise. | def insert_ca_certs_into_systemwide_ca_store(self, ca_certs):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_ca_certs(s3_client, certs):\n logger.info(\"Fetching CA certs and writing to filesystem\")\n\n # Determine which update-ca command to use and directory to store CAs in\n if command_exists(\"update-ca-trust\"):\n logger.info(\"update-ca-trust available\")\n update_ca_cmd = \"update-ca... | [
"0.68859243",
"0.62767655",
"0.61505914",
"0.6095542",
"0.60781914",
"0.5956906",
"0.5892409",
"0.5761105",
"0.5700852",
"0.5621966",
"0.54755276",
"0.54685503",
"0.54224426",
"0.5332096",
"0.5309037",
"0.51828796",
"0.5157283",
"0.51554203",
"0.5149179",
"0.50269085",
"0.495... | 0.73149234 | 0 |
Verify that value is a positive number. | def _is_positive_float(item):
if not isinstance(item, (int, float)):
return False
return item > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def must_be_positive_or_zero(cls, value):\n if value < 0:\n raise ValueError('must be positive or zero')\n return value",
"def validate_positive(value: float):\n if value < 0:\n err = f\"{value} n`est pas positif\"\n raise ValidationError(err)",
"def check_positive(val... | [
"0.79806185",
"0.7925833",
"0.77110785",
"0.7561893",
"0.7406155",
"0.7362765",
"0.7329012",
"0.7320382",
"0.7311145",
"0.73064244",
"0.7277063",
"0.7270226",
"0.7263722",
"0.72005403",
"0.71868134",
"0.71601546",
"0.71065044",
"0.71034455",
"0.709753",
"0.7041604",
"0.700824... | 0.7039701 | 20 |
Get an existing Product 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) -> 'Product':
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = dict()
__props__["approval_required"] = None
__props__["descripti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n accept_language: Optional[pulumi.Input[str]] = None,\n arn: Optional[pulumi.Input[str]] = None,\n created_time: Optional[pulumi.Input[str]] = None,\n ... | [
"0.69742733",
"0.60021263",
"0.57728904",
"0.56428784",
"0.5618183",
"0.5606345",
"0.5597542",
"0.55726314",
"0.5548431",
"0.550479",
"0.55019826",
"0.5498372",
"0.54713905",
"0.5461784",
"0.54028386",
"0.53916764",
"0.5386808",
"0.53728896",
"0.5372836",
"0.536194",
"0.53294... | 0.6703615 | 1 |
whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. | def state(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "state") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_public_published(self):\n if hasattr(self, 'public_published_cache'):\n # if it was cached in change list, return cached value\n return self.public_published_cache\n # othervise make db lookup\n if self.public:\n return self.public.published\n #re... | [
"0.6795369",
"0.67713946",
"0.65852404",
"0.65618056",
"0.6321038",
"0.6229848",
"0.6142038",
"0.60721225",
"0.59382844",
"0.5852014",
"0.57760906",
"0.57723063",
"0.5764882",
"0.5692409",
"0.5662366",
"0.5642007",
"0.56359017",
"0.5624442",
"0.5610189",
"0.560383",
"0.560196... | 0.0 | -1 |
Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included i... | def subscription_required(self) -> pulumi.Output[Optional[bool]]:
return pulumi.get(self, "subscription_required") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscription_required(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"subscription_required\")",
"def isrequired(self, typename):\n return typename in self.required_products",
"def allow_purchase_order(self):\n return self._allow_purchase_order",
"def is_proprietary():... | [
"0.7043986",
"0.5886566",
"0.57689476",
"0.57401973",
"0.57140994",
"0.5704844",
"0.55955976",
"0.55401134",
"0.553812",
"0.5503626",
"0.547906",
"0.5457311",
"0.5450119",
"0.53810483",
"0.53543466",
"0.53438616",
"0.5331839",
"0.53170943",
"0.53009504",
"0.52960557",
"0.5295... | 0.6832563 | 1 |
Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of true. | def subscriptions_limit(self) -> pulumi.Output[Optional[int]]:
return pulumi.get(self, "subscriptions_limit") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscription_required(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"subscription_required\")",
"def subscription_required(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"subscription_required\")",
"def subscriptions(self) -> Optional[pulumi.Input[Seque... | [
"0.69928175",
"0.6903692",
"0.61321527",
"0.6063184",
"0.59141153",
"0.55955404",
"0.55230147",
"0.54307324",
"0.5314592",
"0.52450216",
"0.51267433",
"0.51140934",
"0.50804025",
"0.50139475",
"0.49988398",
"0.49809965",
"0.49796617",
"0.4960402",
"0.49478364",
"0.49319953",
... | 0.64298 | 2 |
Retourne la valeur l'attribut 'mise' en lecture seule. Ne pas surcharger ! | def mise(self):
return self._mise | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minimum(self):\n return self.cleaning('Mínimo')",
"def isMetre(self):\n return _libsbml.Unit_isMetre(self)",
"def M(self):\n return self._properties['M']",
"def getM(self):\r\n return self.M",
"def get_mass(self):\n return self.m",
"def mass(self):\n return self.... | [
"0.55395454",
"0.55174774",
"0.5470984",
"0.54400706",
"0.5272502",
"0.52657515",
"0.52194315",
"0.5205189",
"0.5160615",
"0.515912",
"0.5121621",
"0.51193744",
"0.5101799",
"0.5099681",
"0.5067106",
"0.50647163",
"0.50589836",
"0.5038421",
"0.50373274",
"0.503598",
"0.503484... | 0.75931937 | 0 |
Gets the current list of alarms. | def get_alarms() -> List[Dict[str, Any]]:
return __alarm_info.values() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_alarms(self) -> List[Dict[str, Any]]:\n return [alarm.to_dict() for alarm in self._get_backend().get_alarms()]",
"def get_alarm_info(self):\n response = self.get(COMMAND_UIC, 'GetAlarmInfo')\n\n return response_list(response['alarmList']['alarm'])",
"def _active_arms(self):\n ... | [
"0.7703647",
"0.75001156",
"0.73608094",
"0.7314355",
"0.7160552",
"0.714314",
"0.7061736",
"0.6991116",
"0.6555422",
"0.6493329",
"0.63688284",
"0.63156277",
"0.6259843",
"0.6223005",
"0.6094764",
"0.6090626",
"0.6085706",
"0.60797906",
"0.59144175",
"0.58075523",
"0.5768915... | 0.7756937 | 0 |
Assumes d1 is a "full DOI", like '10.1145/1166253.1166292', and d2 is a partial DOI, like '1166292' or '1166253.1166292'. Returns true if they match and false otherwise. Note that in the previous case, a partial like '292' would be a negative match. The partial must contain full subsections. | def partialDOIMatch(d1, d2):
if (d2.find('.') >= 0):
return d2 == d1.split('/')[-1]
return d2 == d1.split('.')[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partial_path_match(path1, path2, kwarg_re=r'\\{.*\\}'):\n split_p1 = path1.split('/')\n split_p2 = path2.split('/')\n pat = re.compile(kwarg_re)\n if len(split_p1) != len(split_p2):\n return False\n for partial_p1, partial_p2 in zip(split_p1, split_p2):\n if pat.match(partial_p1) o... | [
"0.6014786",
"0.56956816",
"0.5662353",
"0.5500623",
"0.5473948",
"0.54247487",
"0.5415583",
"0.54035217",
"0.53829956",
"0.5355803",
"0.52952635",
"0.52876115",
"0.52532464",
"0.5248896",
"0.52389824",
"0.52248555",
"0.5220483",
"0.5198634",
"0.5177238",
"0.5177077",
"0.5156... | 0.79501957 | 0 |
returns a |DataFrame| with the boundary rays for all fields | def trace_all_fields(opt_model):
osp = opt_model.optical_spec
fld, wvl, foc = osp.lookup_fld_wvl_focus(0)
fset = []
for f in osp.field_of_view.fields:
rset = trace_field(opt_model, f, wvl, foc)
fset.append(rset)
fdf = pd.concat(fset, keys=osp.field_of_view.index_labels,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ray_df(ray):\n r = pd.DataFrame(ray, columns=['inc_pt', 'after_dir',\n 'after_dst', 'normal'])\n r.index.names = ['intrfc']\n return r",
"def get_borough_boundaries():\n df = update_borough_boundaries()\n return {\"data\": df.to_dict(orient=\"records\")}",
"... | [
"0.65361434",
"0.59676796",
"0.57851183",
"0.5736684",
"0.5432055",
"0.5259642",
"0.52134967",
"0.51573277",
"0.5024834",
"0.50156873",
"0.49824193",
"0.48824582",
"0.487294",
"0.48670003",
"0.4863748",
"0.4827349",
"0.4796878",
"0.47901168",
"0.4777756",
"0.47774118",
"0.475... | 0.4648217 | 31 |
intersect 2 nonparallel lines, returning distance from P1 s = ((P2 P1) x V1).(V1 x V2)/\|(V1 x V2)\|2 `Weisstein, Eric W. "LineLine Intersection." From MathWorldA Wolfram Web | def intersect_2_lines(P1, V1, P2, V2):
Vx = np.cross(V1, V2)
s = np.dot(np.cross(P2 - P1, V1), Vx)/np.dot(Vx, Vx)
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(p1, p2):\n if isparallel(p1, p2):\n # lines are parallel\n l = np.cross(p1.w, p1.v - p2.v * np.dot(p1.w, p2.w) / dot(p2.w, p2.w)) / np.linalg.norm(p1.w)\n else:\n # lines are not parallel\n if abs(p1 * p2) < 10*_eps:\n # lines in... | [
"0.7984512",
"0.7703972",
"0.77021426",
"0.750219",
"0.7471955",
"0.7402277",
"0.73771644",
"0.7363731",
"0.7286477",
"0.72673047",
"0.72651136",
"0.7248636",
"0.7235739",
"0.72180456",
"0.72157663",
"0.7187971",
"0.71844125",
"0.7167012",
"0.71630144",
"0.7162702",
"0.713186... | 0.80740553 | 0 |
Create api client and construct API headers | def create_api_client(base_path, access_token):
api_client = ApiClient()
api_client.host = base_path
api_client.set_default_header(header_name="Authorization",
header_value=f"Bearer {access_token}")
return api_client | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_common_headers(apikey: str):\n return {\n \"Authorization\": f\"token {apikey}\",\n \"User-Agent\": \"sharing-api-fetcher\",\n \"Accept-Encoding\": \"gzip\",\n \"Accept\": \"application/json\",\n }",
"def _build_headers(self, params: Dict) -> N... | [
"0.6716841",
"0.6632479",
"0.6585274",
"0.65273464",
"0.65174973",
"0.65110296",
"0.64546186",
"0.6444354",
"0.64215404",
"0.64006066",
"0.6381962",
"0.6373149",
"0.6367229",
"0.63553387",
"0.6311216",
"0.6295633",
"0.6279288",
"0.62528956",
"0.62363464",
"0.6221914",
"0.6221... | 0.74126905 | 0 |
Calculates the probability density at the observed point of a gaussian distribution with the specified mean and covariance The probability density at an observed point is, given a distribution, what is the likelihood of observing the provided point. The mean and covariance describe a gaussian distribution. | def multivariate_gauss_prob(observed, mean, covariance):
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian(z, mean=0, stdev=None, sigma=1):\n sigma = stdev if stdev is not None else sigma\n norm = stats.norm(loc=mean, scale=sigma)\n pdf = norm.pdf(z, loc=mean, scale=sigma)\n return z, pdf",
"def gaussian(x, mean, sigma):\n return np.exp(-np.square(x-mean)/(2*np.square(sigma))) / (np.sqrt(2... | [
"0.7076718",
"0.695932",
"0.68181866",
"0.6816641",
"0.68077284",
"0.6659633",
"0.66336644",
"0.660347",
"0.6548794",
"0.6403903",
"0.6401023",
"0.63993347",
"0.6374524",
"0.63698596",
"0.6356623",
"0.6336011",
"0.6319167",
"0.6315058",
"0.62899816",
"0.62808084",
"0.62674785... | 0.6684921 | 5 |
Samples randomly from a gaussian (normal) distribution | def gauss_sample(mean, covariance):
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand_sample_gauss():\n mean = float(NUM_UNIQUE_VALUES + 1) / 2\n while True:\n r = random.normalvariate(mean, DIST_PARAM)\n value = int(round(r))\n # Rejection sampling to cut off Gaussian to within [1, NUM_UNIQUE_VALUES]\n if 1 <= value <= NUM_UNIQUE_VALUES:\n break\n\n return value # tru... | [
"0.75420827",
"0.7472586",
"0.7387461",
"0.73843616",
"0.73308533",
"0.73060536",
"0.72585607",
"0.7211958",
"0.71785474",
"0.7171299",
"0.7146328",
"0.71457875",
"0.7133743",
"0.7131446",
"0.7098366",
"0.7090585",
"0.7090404",
"0.70685804",
"0.701407",
"0.6968865",
"0.693823... | 0.7190876 | 8 |
Calculates the target's azimuth and elevation given its ENU position. target_pos The target's position in the ENU coordinate system. Returns the target's azimuth and elevation. | def _ENU_to_AzEl(self, target_pos):
# Calculate the target's azimuth and elevation
target_e = target_pos[0]
target_n = target_pos[1]
target_u = target_pos[2]
target_az = atan2(target_e, target_n)
target_az = degrees((target_az + 2*pi) if target_az < 0 else target_az)
target_el = degrees(at... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_target_azimuths(radar_in):\n sweep_start = radar_in.sweep_start_ray_index['data'][0]\n sweep_end = radar_in.sweep_end_ray_index['data'][0]\n target_azimuths = np.sort(\n radar_in.azimuth['data'][sweep_start:sweep_end+1])\n az_tol = np.median(target_azimuths[1:]-target_azimuths[:-1])\n\n... | [
"0.59828514",
"0.5775981",
"0.56484556",
"0.5497794",
"0.5335439",
"0.52951586",
"0.5265463",
"0.52368045",
"0.52313495",
"0.5229205",
"0.52013355",
"0.49970043",
"0.49947467",
"0.4991102",
"0.49614742",
"0.49529862",
"0.4919147",
"0.49130073",
"0.4863262",
"0.4863262",
"0.48... | 0.772992 | 0 |
obtain the feature set of a tensor | def base_sample(self, tns_dir):
lib = CDLL('./libsample.so')
input_dir = tns_dir.encode()
lib.getBaseFeatures.argtypes = [c_char_p]
lib.getBaseFeatures.restype = c_float_p
baseFeatures = lib.getBaseFeatures(input_dir)
return baseFeatures | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_features(input_feature_map, points=conv43Points):\n arr = []\n for y,x in points:\n arr.append(input_feature_map[:,y,x,:])\n return tf.stack(arr, axis=1, name=\"extracted_features\"), len(points)",
"def get_model_feature(\n model,\n batch_x\n):\n features = model.get_feature(ba... | [
"0.66642237",
"0.6563432",
"0.65360254",
"0.624109",
"0.6222723",
"0.62105286",
"0.6172606",
"0.61175543",
"0.60785043",
"0.6077659",
"0.60567254",
"0.6049704",
"0.6047908",
"0.6039491",
"0.6018224",
"0.60164773",
"0.60151154",
"0.6008665",
"0.5987548",
"0.5984549",
"0.594984... | 0.0 | -1 |
obtain the feature set of a tensor | def csf_sample(self, tns_dir):
lib = CDLL('./libsample.so')
input_dir = tns_dir.encode()
lib.getCsfFeatures.argtypes = [c_char_p]
lib.getCsfFeatures.restype = c_float_p
csfFeatures = lib.getCsfFeatures(input_dir)
return csfFeatures | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_features(input_feature_map, points=conv43Points):\n arr = []\n for y,x in points:\n arr.append(input_feature_map[:,y,x,:])\n return tf.stack(arr, axis=1, name=\"extracted_features\"), len(points)",
"def get_model_feature(\n model,\n batch_x\n):\n features = model.get_feature(ba... | [
"0.6664263",
"0.6565329",
"0.65363914",
"0.6241583",
"0.6222612",
"0.62112486",
"0.6170799",
"0.6118415",
"0.60803896",
"0.607755",
"0.6055672",
"0.6049822",
"0.60478497",
"0.60400766",
"0.60189",
"0.6016816",
"0.60156876",
"0.6008345",
"0.5987119",
"0.59845614",
"0.5951214",... | 0.0 | -1 |
obtain the feature set of a batch of tensors | def tns_batch(self, tensorlist):
filenames = []
ftset_batch = []
## record the file dir
filelist = open(tensorlist)
for line in filelist:
list_seg = line.split()
filenames.append(list_seg[-1])
filelist.close()
## record the feature sets o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_feature(\n model,\n batch_x\n):\n features = model.get_feature(batch_x, training=False)\n return features",
"def get_ensemble_model_feature(\n models,\n batch_x\n):\n batch_feature_list = []\n for model in models:\n batch_feature = model.get_feature(batch_x, training=False)\n ... | [
"0.6872066",
"0.6695601",
"0.6676771",
"0.6630831",
"0.65582216",
"0.6557546",
"0.64915574",
"0.64251524",
"0.6375864",
"0.63708925",
"0.6325119",
"0.6310564",
"0.6296545",
"0.6290175",
"0.62837833",
"0.6231989",
"0.6167522",
"0.6161451",
"0.6143088",
"0.61331475",
"0.6115151... | 0.6377178 | 8 |
Check if the weight(and bias) is all zero. | def all_zeros(modules):
weight_zero = torch.equal(modules.weight.data,
torch.zeros_like(modules.weight.data))
if hasattr(modules, 'bias'):
bias_zero = torch.equal(modules.bias.data,
torch.zeros_like(modules.bias.data))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_null_weight_with_nonzeros() -> None:\n sample_weight = np.ones_like(y_toy)\n sw_out, X_out, y_out = check_null_weight(sample_weight, X_toy, y_toy)\n np.testing.assert_almost_equal(sw_out, sample_weight)\n np.testing.assert_almost_equal(X_out, X_toy)\n np.testing.assert_almost_equal(y_... | [
"0.7341079",
"0.72111833",
"0.69303536",
"0.6882128",
"0.68332803",
"0.6832085",
"0.6830218",
"0.68012315",
"0.6775479",
"0.6775216",
"0.6760953",
"0.6629957",
"0.6629592",
"0.6627388",
"0.65673006",
"0.65472466",
"0.65326476",
"0.6426862",
"0.6423972",
"0.6420071",
"0.641342... | 0.79077387 | 0 |
Embed categorical variables with onehot. | def one_hot(org_input):
# Create the embedding list
for f in range(Config.num_feature):
num_cat_value = Config.schema[f]
if num_cat_value == 1:
pass
elif num_cat_value > 1:
embed_dict[f] = tf.Variable(np.identity(
n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(df):\r\n # One-hot encode into \r\n cols = ['job', 'marital', 'education', 'month', 'day_of_week', 'poutcome']\r\n for each in cols:\r\n dummies = pd.get_dummies(df[each], prefix=each, drop_first=False)\r\n df = pd.concat([df, dummies], axis=1)\r\n df = df.drop(cols,axis=1)\r\... | [
"0.7793252",
"0.7686966",
"0.7509871",
"0.7490291",
"0.7461447",
"0.74399245",
"0.74275523",
"0.7419072",
"0.7411135",
"0.7397537",
"0.73827565",
"0.7372006",
"0.7364942",
"0.7363173",
"0.734486",
"0.7343188",
"0.73188174",
"0.73098856",
"0.7304188",
"0.7290859",
"0.7288098",... | 0.0 | -1 |
Sanitise string for use as group/directory name | def sanitise(string: str) -> str:
return "_".join(re.findall(re.compile("[^ @&()/]+"), string)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_or_group_name(name):\r\n s = str(name).strip()\r\n if ' ' in s or ':' in s:\r\n raise ValueError(\"Invalid name: \" + repr(name))\r\n return s",
"def __sanitize(name):\n if name[-1] == \"/\":\n return name[:-1]\n return name",
"def sanitize_luxcore_name(stri... | [
"0.69937134",
"0.6942757",
"0.6923409",
"0.6739956",
"0.6704685",
"0.6686966",
"0.6639211",
"0.66019833",
"0.6591186",
"0.65446335",
"0.65408367",
"0.652787",
"0.6504911",
"0.6490723",
"0.6466227",
"0.6442929",
"0.6434002",
"0.638021",
"0.63787466",
"0.63305604",
"0.63200516"... | 0.6242357 | 23 |
Return attribute ``name``. Will return a widget if present. | def __getattr__(self, name: str) -> WidgetVar:
for widget in self._list:
if name == widget.name:
return widget
return object.__getattribute__(self, name) # type: ignore | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_widget(self, name):\n return self.params[name].widget",
"def name(self) -> \"str\":\n return self._attrs.get(\"name\")",
"def name(self) -> \"str\":\n return self._attrs.get(\"name\")",
"def name(self) -> \"str\":\n return self._attrs.get(\"name\")",
"def get_attr(self, ... | [
"0.7518205",
"0.69048035",
"0.69048035",
"0.69048035",
"0.6801233",
"0.6753137",
"0.66779834",
"0.6672801",
"0.6634435",
"0.6602681",
"0.65999603",
"0.6575435",
"0.6559737",
"0.65589046",
"0.6499128",
"0.6478199",
"0.64001954",
"0.63081235",
"0.63009286",
"0.62743723",
"0.626... | 0.7388688 | 1 |
Set attribute ``name``. Prevents changing widget if present, (use del). | def __setattr__(self, name: str, value: Any) -> None:
if self._initialized:
for widget in self._list:
if name == widget.name:
raise AttributeError(
"Cannot set attribute with same name as a widget\n"
"If you are tryi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setName(self, name):\n # type: (str)->None\n self._validator.validate_one('name', VALID_OPTS['name'], name)\n self._ifAttributes['name'] = str(name)",
"def setName(self, name):\n self.name = str(name)",
"def setName(self, name): \n\n self._name = name",
"def setN... | [
"0.7399976",
"0.7368965",
"0.7340324",
"0.7337265",
"0.7337265",
"0.7337265",
"0.7337265",
"0.7335747",
"0.7329216",
"0.7329216",
"0.7286056",
"0.728038",
"0.728038",
"0.728038",
"0.728038",
"0.728038",
"0.72574246",
"0.72574246",
"0.7244431",
"0.72427636",
"0.7209517",
"0.... | 0.74426407 | 0 |
Insert widget at ``key``. | def insert(self, key: int, widget: WidgetVar) -> None:
if isinstance(widget, (ValueWidget, ContainerWidget)):
widget.changed.connect(lambda: self.changed.emit(self))
_widget = widget
if self.labels:
from magicgui.widgets._concrete import _LabeledWidget
# no ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _insert(self, key):\n self.tree.insert(key)",
"def __setitem__(self, key: Any, widget: Component) -> None:\n if not isinstance(widget, Widgets):\n self._add(widget, *self._key_to_rows_columns(key))",
"def insert(self, key):\r\n index = self.search(key)\r\n self.keys.i... | [
"0.74977267",
"0.72943276",
"0.70248306",
"0.6816359",
"0.663488",
"0.6604347",
"0.658162",
"0.6396453",
"0.6333509",
"0.6331519",
"0.62363946",
"0.6233498",
"0.62247455",
"0.62040496",
"0.6191764",
"0.6189095",
"0.6132108",
"0.6104652",
"0.60987896",
"0.60983926",
"0.6089103... | 0.8277953 | 0 |
Return margin between the content and edges of the container. | def margins(self) -> tuple[int, int, int, int]:
return self._widget._mgui_get_margins() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contentsMargins( self ):\n return self._margins",
"def margin(self):\r\n return self._generate_spacing_info(self.config['margin'])",
"def get_margin(self):\n _pal.lib.geometry_get_margin.restype = c.c_float\n return _pal.lib.geometry_get_margin(self._geometry)",
"def getMargin... | [
"0.71554303",
"0.7149228",
"0.7104188",
"0.6999216",
"0.6874192",
"0.6824018",
"0.67398703",
"0.64800406",
"0.64658856",
"0.61194366",
"0.5920113",
"0.5898274",
"0.588148",
"0.58542335",
"0.58154404",
"0.5724995",
"0.5639125",
"0.55490357",
"0.5467832",
"0.545791",
"0.5391666... | 0.6802002 | 6 |
Reset choices for all Categorical subWidgets to the default state. If widget._default_choices is a callable, this may NOT be the exact same set of choices as when the widget was instantiated, if the callable relies on external state. | def reset_choices(self, *_: Any) -> None:
for widget in self._list:
if hasattr(widget, "reset_choices"):
widget.reset_choices() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAll(self):\n self.setValue(self._choices_)",
"def initDefaultChoices(self):\n return []",
"def _reset(self, _recursive=False):\n if self._isDefault:\n self.options = self.__class__.options.copy()\n if _recursive:\n for child in self._children:\n c... | [
"0.6236825",
"0.6147855",
"0.59383166",
"0.5937631",
"0.5839361",
"0.53093266",
"0.5213739",
"0.52118415",
"0.5211805",
"0.52071846",
"0.520566",
"0.51978725",
"0.51608455",
"0.509057",
"0.5082559",
"0.50553024",
"0.50463384",
"0.5035311",
"0.50323635",
"0.5012139",
"0.501117... | 0.7414776 | 0 |
Restore the state of the widget from previously saved file at `path`. | def _load(self, path: str | Path, quiet: bool = False) -> None:
import pickle
from pathlib import Path
path = Path(path)
if not path.exists():
if quiet:
return
raise FileNotFoundError(f"Widget state file does not exist: {path}")
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore(self, path, name=None):\n name = name or self.name\n path = os.path.join(path, name)\n with open(path, 'rb') as pickle_file:\n saved = pickle.load(pickle_file)\n self.__dict__.update(saved.__dict__)",
"def _restore(self, a_path):\n super(RDPAnalyzer, self... | [
"0.7195376",
"0.68001056",
"0.6709525",
"0.66451806",
"0.66451806",
"0.66451806",
"0.6470373",
"0.6408319",
"0.63664085",
"0.60548496",
"0.6044801",
"0.5989243",
"0.5943166",
"0.5943166",
"0.5929317",
"0.591915",
"0.58787197",
"0.5872494",
"0.58546984",
"0.5853393",
"0.583949... | 0.5762056 | 30 |
Change categorical labels with some integers. | def string_converter(X):
encoder = LabelEncoder()
for column in X.select_dtypes(include=['object']):
X[column] = encoder.fit_transform(X[column])
return X | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setIntegerLabels():\n dislin.intax()",
"def to_categorical(index_label, num_classes):\n return index_label, np.eye(num_classes, dtype='uint8')[index_label]",
"def category_string_of_label_int(self, label_integer):\n if len(self.ints_to_strings) < len(self.label_vocab):\n self.ints_to_strings ... | [
"0.6711416",
"0.6431477",
"0.6415793",
"0.6367324",
"0.6301755",
"0.6229059",
"0.6198448",
"0.612619",
"0.61099815",
"0.6076366",
"0.6072507",
"0.60207933",
"0.6009409",
"0.59942836",
"0.5955582",
"0.59382176",
"0.5936906",
"0.59165394",
"0.58953613",
"0.58778775",
"0.587513"... | 0.0 | -1 |
Generate onehot encoded class vector. | def one_hot_converter(column):
# encode class values as integers
encoder = LabelEncoder()
encoder.fit(column)
encoded_ = encoder.transform(column)
# convert integers to dummy variables, i.e., one-hot encoded
encoded_column = to_categorical(encoded_)
return encoded_column | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(x, n_classes):\n return np.eye(n_classes)[x]",
"def one_hot(y, num_classes):\n return np.eye(num_classes)[y]",
"def one_hot(y_):\n y_ = y_.reshape(len(y_))\n n_values = int(np.max(y_)) + 1\n n_values = 6\n return np.eye(n_values)[np.array(y_, dtype=np.int32)] # Returns FLO... | [
"0.8248339",
"0.8198288",
"0.8008788",
"0.798322",
"0.79610676",
"0.79600346",
"0.7958679",
"0.79526263",
"0.79490805",
"0.7909179",
"0.7908739",
"0.78891355",
"0.7864662",
"0.78570116",
"0.784551",
"0.7784665",
"0.7784665",
"0.777746",
"0.776651",
"0.7764797",
"0.7743757",
... | 0.0 | -1 |
set the learning rate | def set_lr(optimizer, lr):
for param_group in optimizer.param_groups:
param_group['lr'] = lr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_learning_rate(self, rate):\n self.SGD.set_learning_rate(rate)",
"def adjust_lr(self):\n learning_rate = self.params.base_lr * (1 - float(self.epoch) / self.params.num_epoch) ** self.params.power\n for param_group in self.opt.param_groups:\n param_group['lr'] = learning_rat... | [
"0.8475554",
"0.77922183",
"0.77061725",
"0.7705153",
"0.7653821",
"0.76475346",
"0.76475346",
"0.76323247",
"0.7563035",
"0.7526534",
"0.75165945",
"0.75116456",
"0.7480992",
"0.7465035",
"0.7451768",
"0.7451768",
"0.74436015",
"0.7438059",
"0.7427731",
"0.7413679",
"0.74035... | 0.0 | -1 |
Computes the accuracy over the k top predictions for the specified values of k | def accuracy(output, target, topk=(1,)):
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)",
"def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua... | [
"0.8331214",
"0.8284662",
"0.82381004",
"0.8229767",
"0.82202226",
"0.81864446",
"0.81847763",
"0.8175173",
"0.8171541",
"0.81699467",
"0.81664646",
"0.81645083",
"0.81637454",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"... | 0.7847017 | 94 |
Get a copy of the current attributes dictionary. | def GetAttributes(self):
return dict(self._attrs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return AttrDict(dict(self).copy())",
"def get_attributes(self):\n return dict(self.attributes) # return the attributes",
"def get_attributes(self):\n return dict(self.attributes) # return the attributes",
"def get_attributes(self):\n return dict(self.attributes... | [
"0.84263563",
"0.7721028",
"0.7721028",
"0.7721028",
"0.7617698",
"0.760092",
"0.7590136",
"0.7506497",
"0.7405794",
"0.7388799",
"0.7299701",
"0.72899675",
"0.72865224",
"0.72066426",
"0.7111404",
"0.7039502",
"0.70130455",
"0.7012649",
"0.6998842",
"0.6996243",
"0.6947482",... | 0.74433565 | 8 |
set the weights and the bias of the model | def set_parameters(self, x):
params = x.reshape((-1, self.Y.shape[1]))
if self.add_bias:
self.bias = params[0:1]
self.W = params[1:]
else:
self.W = params | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_weights(self, weights):\n self.model.set_weights(weights)",
"def set_weights(self, w):\n self.nn.set_param_values(w)",
"def set_weights(self, weights):\r\n self.weights = weights",
"def init_weights(model):\n ...",
"def set_parameters(self, weight, bias=None):\r\n ... | [
"0.7855509",
"0.7727223",
"0.7703758",
"0.7607408",
"0.74730814",
"0.7432303",
"0.740899",
"0.73724484",
"0.7362923",
"0.7354686",
"0.7343699",
"0.73327285",
"0.7237629",
"0.7233025",
"0.7187846",
"0.71453327",
"0.71410644",
"0.71410644",
"0.713035",
"0.7129434",
"0.7129434",... | 0.0 | -1 |
initialize the model parameters The bias is set to the mean of self.Y. The W vector is set to a zero mean random normal with standard deviation = scale | def init_params(self, scale=1e-4):
if self.add_bias:
self.bias = self.Y.mean(0)[np.newaxis,:]
self.W = np.random.normal(scale=scale, size=(self.X.shape[1],self.Y.shape[1])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_parameters(self):\n stdv = 1. / math.sqrt(self.weight.data.size(1))\n self.weight.data.uniform_(-stdv, stdv)\n if self.bias is not None:\n self.bias.data.uniform_(-stdv, stdv)",
"def init_weights(self):\n \n self.w = np.random.randn(self.D) / np.sqrt(self.D)... | [
"0.8181459",
"0.748455",
"0.7481587",
"0.7390689",
"0.7365083",
"0.7334129",
"0.73298407",
"0.7327724",
"0.73068106",
"0.730381",
"0.730381",
"0.7300364",
"0.7240218",
"0.7238535",
"0.7238535",
"0.7238535",
"0.7224468",
"0.71588415",
"0.7156189",
"0.7139337",
"0.7136962",
"... | 0.8557049 | 0 |
Cleans the tweets and makes a set of all the words | def make_dict_pickle(f_name, out_fname):
logging.info('Making pickle for the dictionary')
word_set = set()
for tweet in load_pickle(f_name)['dat']:
words, _ = clean_tweet(tweet['text'])
for word in words:
word_set.add(word)
logging.info('Number unique words: {}'.format(len(wo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_all_tweets(self):\n clean_tweets = []\n for tweet in self.tweets:\n clean_tweets.extend(self.clean_tweet(tweet).split())\n return clean_tweets",
"def clean_all(self, tweet):\n tweet = self.clean_urls(tweet)\n tweet = self.clean_hashtags(tweet)\n twee... | [
"0.72377753",
"0.71261615",
"0.70121723",
"0.69805133",
"0.69693035",
"0.69652164",
"0.6947083",
"0.6898583",
"0.687569",
"0.6853566",
"0.68455225",
"0.6836043",
"0.6786327",
"0.67730886",
"0.6744922",
"0.6730578",
"0.6696421",
"0.6589141",
"0.6567265",
"0.65516764",
"0.65347... | 0.0 | -1 |
the function to test the function of updating the beneficiary entity without a ID | def test_beneficiaries_update_withoutID_that_will_fail(self):
print('the test function name: {}'.format(sys._getframe().f_code.co_name))
try:
url = reverse('beneficiary:beneficiary-entity-by-id-update')
response = self.client.get(url, content_type='application/json')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_beneficiaries_update_that_will_pass(self):\n print('the test function name: {}'.format(sys._getframe().f_code.co_name))\n url = reverse('beneficiary:beneficiary-entity-by-id-update', kwargs={'pk': 1})\n response = self.client.post(url, content_type='application/json')\n return ... | [
"0.77336633",
"0.72154415",
"0.71757287",
"0.71694785",
"0.71415323",
"0.6948796",
"0.6934264",
"0.6863995",
"0.68329513",
"0.68329513",
"0.68329513",
"0.68132126",
"0.67864555",
"0.672461",
"0.67134356",
"0.66681844",
"0.6665831",
"0.66343844",
"0.6615086",
"0.65882564",
"0.... | 0.768389 | 1 |
Sets the id of this RegisteredFaceWithFaceSnaps. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id_):\n\n self.id_ = id_",
"def id(self, id):\n self._id = id",
"def id(self, id):\n self._id = id"
] | [
"0.6488453",
"0.64652675",
"0.6348114",
"0.6348114"
] | 0.6352402 | 65 |
Sets the registered_face_id of this RegisteredFaceWithFaceSnaps. | def registered_face_id(self, registered_face_id):
self._registered_face_id = registered_face_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setFace(self, value):\n self.face = value",
"def setFace(self, value):\n self.face = value",
"def change_face(self, face):\n if self.face is not None:\n self.face.remove_point(self)\n\n self.face = face\n self.face.add_point(self)",
"def add_face(self, face):... | [
"0.58917874",
"0.58917874",
"0.54671526",
"0.54602313",
"0.5451022",
"0.5242556",
"0.52268106",
"0.51698357",
"0.5094764",
"0.50829196",
"0.50829196",
"0.50829196",
"0.505928",
"0.505928",
"0.5056116",
"0.50340617",
"0.49553692",
"0.49553692",
"0.49553692",
"0.49246573",
"0.4... | 0.8254062 | 0 |
Sets the full_name of this RegisteredFaceWithFaceSnaps. | def full_name(self, full_name):
self._full_name = full_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_fullname(self, value):\n self.fullname = value",
"def user_full_name(self, user_full_name):\n\n self._user_full_name = user_full_name",
"def set_fullname(self, value):\n raise NotImplementedError('set_fullname')",
"def getname(self, full: bool = False) -> str:\n return sel... | [
"0.64851123",
"0.6422021",
"0.6260016",
"0.6017037",
"0.5753263",
"0.5751759",
"0.56307304",
"0.5622065",
"0.55616325",
"0.54762983",
"0.54762983",
"0.54762983",
"0.54762983",
"0.54762983",
"0.5465241",
"0.54576063",
"0.54576063",
"0.54576063",
"0.54501486",
"0.54501486",
"0.... | 0.76909584 | 0 |
Sets the face_snaps of this RegisteredFaceWithFaceSnaps. | def face_snaps(self, face_snaps):
self._face_snaps = face_snaps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def screenshots(self, screenshots):\n self._screenshots = screenshots",
"def snap(self, snap):\n\n self._snap = snap",
"def ifaces(self, ifaces):\n \n self._ifaces = ifaces",
"def manifestations_shoots(self, manifestations_shoots):\n\n self._manifestations_shoots = manifest... | [
"0.5244599",
"0.5218898",
"0.51472676",
"0.5071176",
"0.5008355",
"0.46705747",
"0.46705747",
"0.46705747",
"0.46705747",
"0.45809054",
"0.44767794",
"0.44584414",
"0.44417167",
"0.44373494",
"0.43795556",
"0.4360621",
"0.43574172",
"0.4342645",
"0.43396005",
"0.43237007",
"0... | 0.887337 | 0 |
Sets the age of this RegisteredFaceWithFaceSnaps. | def age(self, age):
self._age = age | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_age(self, age):\n self.__age = age",
"def setAge(self, age):\n self._age = age",
"def set_age(self, age):\n self.age = float(age)",
"def set_age(self, newage):\n self.age = newage",
"def setAge(self, age):\r\n self.age = age",
"def age(self):\n self._age... | [
"0.7408455",
"0.73629194",
"0.7062379",
"0.70445997",
"0.6954864",
"0.6512156",
"0.6507787",
"0.6427091",
"0.642616",
"0.6103652",
"0.6099601",
"0.6032122",
"0.5772501",
"0.5721763",
"0.57093084",
"0.56830156",
"0.56341314",
"0.56304514",
"0.56185305",
"0.5616488",
"0.5517378... | 0.73833 | 2 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, RegisteredFaceWithFaceSnaps):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8456063",
"0.83918154",
"0.8144437",
"0.8140196",
"0.8132038",
"0.8093834",
"0.80918837",
"0.80918837",
"0.80918837",
"0.80852824",
"0.80852824",
"0.807626",
"0.807626",
"0.80657643"
] | 0.0 | -1 |
Get the source template files directory | def getSrcDir(self):
if self.srcdir == None:
tmpl = self.getTmplDir()
self.srcdir = os.path.join(tmpl, 'template', self.args.tmpl)
return self.srcdir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTemplateDir():\n return os.path.join(Configurations.getProjectRootDir(), TEMPLATE_DIR_NAME)",
"def get_templates_dir(self):\n return self.templates_dir",
"def templates_folder(self):\n return os.path.join(\n os.path.dirname(__file__), \"default_config\", \"divvy_templates... | [
"0.78034294",
"0.7770891",
"0.7554223",
"0.7232547",
"0.7142863",
"0.7097075",
"0.70330364",
"0.70065504",
"0.6955735",
"0.69521964",
"0.6943259",
"0.69353086",
"0.6917054",
"0.68860227",
"0.68817574",
"0.6861956",
"0.6797765",
"0.67940515",
"0.67331064",
"0.6722607",
"0.6722... | 0.81686807 | 0 |
Retrieve camera parameters and 3D coordinates. | def optimized_params(params, n_cameras, n_points_per_frame):
tmp = params[:n_cameras * 9].reshape((n_cameras, 9))
cameras = []
for c in tmp:
R, t = revert_camera_build(c)
cameras.append(Camera(R, t))
points3d = []
range_counter = 0
for r in n_points_per_frame:
range_poin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_camera_metadata(self):\n return self.camera.getHeight(), self.camera.getWidth(), 4 # channels",
"def read_camera_params(h5_dataset):\n fx = h5_dataset[0]\n fy = h5_dataset[1]\n skew = h5_dataset[2]\n cx = h5_dataset[3]\n cy = h5_dataset[4]\n K = np.array([[fx, skew, cx],\n ... | [
"0.6542464",
"0.6417448",
"0.626672",
"0.62348",
"0.61959046",
"0.6163532",
"0.61304396",
"0.61248636",
"0.61239195",
"0.6123729",
"0.6114265",
"0.6076176",
"0.6076176",
"0.5992724",
"0.5981369",
"0.5965596",
"0.5945441",
"0.59410375",
"0.59268504",
"0.5913921",
"0.59042203",... | 0.57563376 | 28 |
Encode given columns of X based on the learned features. | def fit_transform(self, X: pd.DataFrame, y=None) -> pd.DataFrame:
self.fit(X, y)
return self.transform(X) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(self, columns):\n if not columns:\n return None\n\n logging.info('one-hot-encoding columns: %s' % ','.join(columns))\n\n both_sets = pd.concat((self.train[columns], self.test[columns]))\n encoder = preprocessing.OneHotEncoder()\n encoded = encoder.fi... | [
"0.6647285",
"0.65819275",
"0.6553035",
"0.6539307",
"0.64955664",
"0.64740604",
"0.64628875",
"0.6456644",
"0.64290786",
"0.6427065",
"0.6360779",
"0.63579065",
"0.63483477",
"0.6312137",
"0.6286197",
"0.6271494",
"0.6252841",
"0.6241294",
"0.6235882",
"0.62332755",
"0.62330... | 0.0 | -1 |
Read a dataframe from a CSV file using pandas. | def df_read(path: pathlib.Path, **kwargs) -> pd.DataFrame:
# Always specify the datatype so pandas does not have to infer it--much
# faster.
return pd.read_csv(path, sep=';', float_precision='high', **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_data_from_csv(filename):\n df = pd.read_csv(filename)\n return df",
"def _parse_csv(csv_file: str) -> pd.DataFrame:\n return pd.read_csv(csv_file, header=0)",
"def csv_to_df(self, path=None):\n # reads the csv file and puts it to the dataframe\n df = pd.read_csv(path)\n ... | [
"0.79322445",
"0.79194576",
"0.77785325",
"0.77730066",
"0.76640373",
"0.76077795",
"0.75767684",
"0.7570743",
"0.75273764",
"0.74582297",
"0.74400705",
"0.74130535",
"0.7375998",
"0.73672867",
"0.73646027",
"0.73432344",
"0.73432344",
"0.73432344",
"0.7298824",
"0.72938806",
... | 0.7194139 | 23 |
Write a dataframe to a CSV file using pandas. | def df_write(df: pd.DataFrame, path: pathlib.Path, **kwargs) -> None:
df.to_csv(path, sep=';', float_format='%.8f', **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_tocsv(file_name, dataframe) :\n print(\"\\nSaved result to {}\\n\".format(file_name))\n dataframe.to_csv(file_name, mode='a', header=False,index=False)",
"def write_dataframe_to_csv(filename: str, df: pandas.DataFrame) -> None:\n print('\\nWriting to csv file: ' + filename + '... ', end='', fl... | [
"0.8079099",
"0.80030954",
"0.7982537",
"0.78449696",
"0.7796473",
"0.7676012",
"0.76063156",
"0.7544861",
"0.7517614",
"0.7511816",
"0.7484378",
"0.74792945",
"0.7419916",
"0.73280257",
"0.7312606",
"0.7276958",
"0.7202785",
"0.7191054",
"0.718852",
"0.71448267",
"0.7143549"... | 0.7732134 | 5 |
Whether interactability checks will be applied to file type input elements. The default is false. | def strict_file_interactability(self, value: bool):
self._caps['strictFileInteractability'] = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supports_rescoring(self):\r\n return all('filesubmission' not in responder.allowed_inputfields for responder in self.responders.values())",
"def file_allowed(self):\n if self._allowed_ext:\n if self.get_ext() not in self._allowed_ext:\n return False\n \n r... | [
"0.6314451",
"0.62356764",
"0.59860724",
"0.5693379",
"0.56021535",
"0.55845374",
"0.54977125",
"0.54533404",
"0.5451383",
"0.54463464",
"0.538172",
"0.53462267",
"0.5315613",
"0.5309475",
"0.53040415",
"0.52930903",
"0.5244472",
"0.5235056",
"0.52224654",
"0.52160406",
"0.52... | 0.66873574 | 0 |
Group a list of elements into tuples of size n. | def group_tuples(l, n):
assert len(l) % n == 0
ret = []
for i in range(0, len(l), n):
v = l[i:i + n]
ret.append(tuple(v))
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grouper(n, iterable):\n args = [iter(iterable)] * n\n return list((tuple([e for e in t if e != None]) for t in zip_longest(*args)))",
"def group(lst, n):\n return zip(*[lst[i::n] for i in range(n)])",
"def grouper(iterable, n):\n args = [iter(iterable)] * n\n return zip(*args)",
"def chunk... | [
"0.7895249",
"0.7572651",
"0.7503761",
"0.74917966",
"0.74416924",
"0.73648375",
"0.7201025",
"0.70826304",
"0.7065605",
"0.7054971",
"0.7054084",
"0.7026747",
"0.6967191",
"0.6898973",
"0.68613786",
"0.68413454",
"0.6835167",
"0.6828687",
"0.67922187",
"0.67667115",
"0.67431... | 0.86011666 | 0 |
Sets initial parameters as zeros | def set_initial_params(model: LogisticRegression):
n_classes = 15 # threat types
n_features = 33 # Number of features in dataset
model.classes_ = np.array([i for i in range(15)])
model.coef_ = np.zeros((n_classes, n_features))
if model.fit_intercept:
model.intercept_ = np.zeros((n_classes,)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_parameters(self,z0):\n self._set_z0(z0)\n self._set_parameters()",
"def setZeroModeParameters(self, zmp):\n\t\tif not len(zmp) == 2*self.nZero:\n\t\t\traise IndexError(\"Number of zero mode parameters does not match\")\n\t\tself.hasZMP = True\n\t\tself.zeroModeParameters = zmp... | [
"0.7390067",
"0.73613685",
"0.7184451",
"0.71802145",
"0.71612483",
"0.70880985",
"0.70771194",
"0.70280796",
"0.6991509",
"0.69013304",
"0.6874983",
"0.68693817",
"0.68398345",
"0.6763932",
"0.6763932",
"0.6763932",
"0.67557013",
"0.6742511",
"0.6736647",
"0.6732402",
"0.672... | 0.62557304 | 66 |
resize image to a size multiple of 32 which is required by the network | def resize_image(self, im, max_side_len=512):
h, w, _ = im.shape
resize_w = w
resize_h = h
# limit the max side
if max(resize_h, resize_w) > max_side_len:
ratio = float(max_side_len) / resize_h if resize_h > resize_w else float(max_side_len) / resize_w
else:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __resize_to_32x(input_data):\n rate = 1\n while min(input_data['img'].shape[:2])>736:\n test_size = 736\n if input_data['img'].shape[0] > input_data['img'].shape[1]:\n if True: # input_data['img'].shape[1] < 512:\n rate = test_size / input_... | [
"0.70825875",
"0.7021497",
"0.69271106",
"0.68081397",
"0.66379243",
"0.66232806",
"0.6529377",
"0.6525579",
"0.6510065",
"0.65004414",
"0.64680946",
"0.64599925",
"0.6458243",
"0.6455653",
"0.6437946",
"0.64353275",
"0.64297265",
"0.6396388",
"0.6383566",
"0.6377056",
"0.627... | 0.0 | -1 |
Gets a native docker image flag and returns its mapped native image name from the 'docker_native_image_config.json' file. If the requested docker image flag doesn't have a mapped native image in the config file write to the logs. | def _get_native_image_name_from_config_file(
self,
docker_image_flag: str,
) -> Union[str, None]:
native_image_config = (
NativeImageConfig()
) # parsed docker_native_image_config.json file (a singleton obj)
if native_image := native_image_config.flags_versions_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_versioned_native_image(\n self,\n native_image: str,\n ) -> Union[str, None]:\n logger.info(\n f\"{self._pack_name} - Get Versioned Native Image - {native_image} - Started\"\n )\n\n native_image_config = (\n NativeImageConfig()\n ) # pars... | [
"0.6022707",
"0.5634478",
"0.5631012",
"0.52040356",
"0.51978153",
"0.5037897",
"0.501338",
"0.4984199",
"0.49565476",
"0.49448016",
"0.4941051",
"0.48314983",
"0.48207644",
"0.4813704",
"0.48090866",
"0.48082003",
"0.47982135",
"0.47972023",
"0.47861397",
"0.4774008",
"0.475... | 0.8335949 | 0 |
Gets a versioned native image name, and finds it's reference (tag) in the docker_native_image_config.json file. | def _get_versioned_native_image(
self,
native_image: str,
) -> Union[str, None]:
logger.info(
f"{self._pack_name} - Get Versioned Native Image - {native_image} - Started"
)
native_image_config = (
NativeImageConfig()
) # parsed docker_native_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_native_image_name_from_config_file(\n self,\n docker_image_flag: str,\n ) -> Union[str, None]:\n native_image_config = (\n NativeImageConfig()\n ) # parsed docker_native_image_config.json file (a singleton obj)\n\n if native_image := native_image_config.fl... | [
"0.76866686",
"0.73347646",
"0.67115",
"0.6559359",
"0.64129794",
"0.6269719",
"0.6239601",
"0.61873376",
"0.60529107",
"0.59456474",
"0.59262145",
"0.59131044",
"0.5895089",
"0.5894241",
"0.5891443",
"0.58681995",
"0.58671135",
"0.5859722",
"0.5798949",
"0.57781386",
"0.5745... | 0.80080914 | 0 |
Sets the key_manager_status of this EncryptionKeyManagerInfo. | def key_manager_status(self, key_manager_status):
self._key_manager_status = key_manager_status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_manager(self, key_manager):\n\n self._key_manager = key_manager",
"def key_manager_info(self, key_manager_info):\n\n self._key_manager_info = key_manager_info",
"def on_key_status(self, key):\n self.core.log.info(\"Key Manager key update\")\n client_proto = self.core.get_cli... | [
"0.65761554",
"0.6564906",
"0.57830924",
"0.5533103",
"0.5406321",
"0.5239027",
"0.52350456",
"0.52350456",
"0.52350456",
"0.5202071",
"0.5194683",
"0.5191662",
"0.5098668",
"0.5052411",
"0.5024152",
"0.501601",
"0.5010872",
"0.5007042",
"0.49562296",
"0.49360225",
"0.4936022... | 0.8637964 | 0 |
Sets the action_needed of this EncryptionKeyManagerInfo. | def action_needed(self, action_needed):
self._action_needed = action_needed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_required(self, action_required):\n\n self._action_required = action_required",
"def setUseAction(self, action):\n def do(toUpdateList):\n self.useAction = action\n self.actions.addAction(do)",
"def set_action(self,action):\n self.__action = action",
"def set_... | [
"0.5930235",
"0.5133524",
"0.49000227",
"0.4764496",
"0.4764496",
"0.47547382",
"0.47405764",
"0.47340602",
"0.47340602",
"0.47340602",
"0.47340602",
"0.47340602",
"0.47340602",
"0.46857134",
"0.46467784",
"0.46454233",
"0.46234223",
"0.46214762",
"0.46170697",
"0.45745027",
... | 0.7251819 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, EncryptionKeyManagerInfo):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, EncryptionKeyManagerInfo):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Inserts node at beginning of linked list. | def prepend(self, x):
self.insert(0, x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_start(self, data):\n\n if self.head is None:\n self.head = ListNode(data)\n else:\n temp = self.head\n self.head = ListNode(data)\n self.head.next = temp",
"def prepend(self, value):\r\n if self.head is None:\r\n self.head = N... | [
"0.8129536",
"0.7683391",
"0.76653755",
"0.7664685",
"0.763414",
"0.7597075",
"0.75797606",
"0.7565086",
"0.75576365",
"0.7549218",
"0.7541743",
"0.7515407",
"0.7418321",
"0.73824435",
"0.7310312",
"0.72734404",
"0.72648054",
"0.72352403",
"0.72060174",
"0.71992254",
"0.71769... | 0.6768356 | 39 |
Inserts node at end of linked list. | def append(self, x):
self.insert(len(self), x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_end(self, data):\n\n if self.head is None:\n self.head = ListNode(data)\n else:\n temp = self.head\n while temp.next is not None:\n temp = temp.next\n temp.next = ListNode(data)",
"def insert_after(self,node,new_node):\n n... | [
"0.81369025",
"0.7400838",
"0.7368428",
"0.7308944",
"0.72780937",
"0.72697634",
"0.7198543",
"0.70404124",
"0.7015562",
"0.6943148",
"0.6905299",
"0.69019985",
"0.68692124",
"0.6867615",
"0.682679",
"0.679146",
"0.67738575",
"0.6769764",
"0.66958255",
"0.66952467",
"0.669502... | 0.0 | -1 |
Traverses linked list to return the payload of node at requested index value. If index value is out of range an error message is displayed. | def __getitem__(self, i):
try:
return self.__getIthNode(i).getPayload()
except IndexError:
print("ERROR: Index value out of range.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, index=0):\n\n # Error case: Index out of acceptable range\n if index < 0 or index >= self._size:\n raise RangeError(\"index out of range.\")\n\n i = 0\n current_node = self._head\n\n while(i < index):\n current_node = current_node.next\n ... | [
"0.72877437",
"0.72538054",
"0.72352177",
"0.7169649",
"0.71562105",
"0.70674276",
"0.7052232",
"0.70235115",
"0.6994789",
"0.69922054",
"0.6972242",
"0.69682443",
"0.69496",
"0.69441646",
"0.6935038",
"0.6903717",
"0.6871632",
"0.6851099",
"0.6842729",
"0.6818132",
"0.679766... | 0.72976935 | 0 |
set the owner in the payload and also used for victims | def set_owner(self, data):
self._owner = self._uni(data)
self.add_payload('owner', data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_owner(self, owner):\n self.settings[\"owner\"] = owner",
"def owner(self, owner):\n self._owner = owner",
"def owner(self, owner):\n self._owner = owner",
"def owner(self, owner):\n self._owner = owner",
"def owner(self, owner):\n self._owner = owner",
"def owne... | [
"0.7266226",
"0.7238346",
"0.7238346",
"0.7238346",
"0.7238346",
"0.72242475",
"0.7169581",
"0.7086285",
"0.7086285",
"0.7086285",
"0.7086285",
"0.69276613",
"0.6885551",
"0.6862052",
"0.66897625",
"0.6606244",
"0.65946996",
"0.64924765",
"0.6333816",
"0.6333816",
"0.6333816"... | 0.82212836 | 0 |
indicate if this request supports owners | def set_owner_allowed(self, data):
self._owner_allowed = self._uni(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def cog_check(self, ctx:utils.Context):\n\n if ctx.author.id in self.bot.config['owners']:\n return True\n raise commands.NotOwner",
"def has_ownership(self):\n user = self.request.user\n object = self.get_object()\n if object.owned_by(user):\n retur... | [
"0.662087",
"0.65712994",
"0.6502403",
"0.6445665",
"0.6441956",
"0.64249283",
"0.6384449",
"0.6351287",
"0.6337761",
"0.63308",
"0.6293859",
"0.6249096",
"0.62407714",
"0.6234601",
"0.6234601",
"0.6209713",
"0.6189197",
"0.617085",
"0.6143529",
"0.6110992",
"0.6093328",
"0... | 0.6089248 | 21 |
Basic text clean and creating list of tokens Really basic cleaning. One big one missing is stopwords | def mapper(list_of_textlines):
text = [i.lower() for i in list_of_textlines]
text = [re.subn("\s+|\n+", " ", i)[0] for i in text]
text = [re.subn("[.!@#$%^&*()-_+=,./?\"'|\}{:;]+", " ", i)[0] for i in text]
text = [re.split("\s+", i) for i in text]
text = [[i for i in j if i != ''] for j in text]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_stopwords(text):\n tokens = tokenize(text)\n tokens = stopwordsRem(tokens)\n return tokens",
"def processes_and_tokenize(raw_document):\n\ttokenizer = RegexpTokenizer(r'\\w+')\n\ttokens = tokenizer.tokenize(raw_document.lower())\t\t# tokens = nltk.word_tokenize(corpus.lower()) # without removi... | [
"0.81097025",
"0.78711426",
"0.7840307",
"0.7787952",
"0.7713275",
"0.76837844",
"0.7656022",
"0.7638737",
"0.7638566",
"0.76237935",
"0.75959116",
"0.75959116",
"0.75924206",
"0.75757957",
"0.7566537",
"0.7562676",
"0.7547082",
"0.7541691",
"0.74590874",
"0.74234074",
"0.738... | 0.0 | -1 |
Restores a previously saved model. | def load_model(self, directory):
with tf.Session() as sess:
tf.saved_model.loader.load(sess, [tf.saved_model.tag_constants.SERVING], directory)
self.model = tf.contrib.predictor.from_saved_model(directory) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore(self):\n if self._restored_model:\n return\n with self.eval_graph.graph.as_default():\n last_checkpoint = self._find_last_checkpoint()\n # TODO(rbharath): Is setting train=False right here?\n saver = tf.train.Saver()\n saver.restore(self._get_shared_session(train=False), ... | [
"0.7627033",
"0.7383768",
"0.7218079",
"0.7200881",
"0.7194437",
"0.70792776",
"0.7075553",
"0.70614964",
"0.7019826",
"0.70197797",
"0.70011765",
"0.68946534",
"0.68306",
"0.67819273",
"0.67714393",
"0.6716831",
"0.66678756",
"0.6637887",
"0.6637105",
"0.6612508",
"0.6610946... | 0.0 | -1 |
Check whether a given string is a number | def is_number(self,val):
try:
float(val)
return True
except ValueError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_number(s):\r\n try:\r\n int(s)\r\n return True\r\n except ValueError:\r\n return False",
"def is_valid_numeric(inString):\r\n return is_int(inString) or is_float(inString)",
"def is_number(s):\n try:\n int(s)\n return True\n except ValueError:\n r... | [
"0.8599215",
"0.8594775",
"0.8590061",
"0.85404444",
"0.8518628",
"0.8328218",
"0.83216244",
"0.82936364",
"0.82936364",
"0.82936364",
"0.8271122",
"0.82399917",
"0.81856",
"0.8179802",
"0.80999064",
"0.80885744",
"0.80733865",
"0.8015332",
"0.7957879",
"0.795744",
"0.7951730... | 0.72543204 | 65 |
Extract features of the loaded sample. | def extract_features(self):
self.extract_features_static()
self.extract_features_dynamic() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _extract_features(self):\n # print(os.getpid())\n return {n:self._extract_feature(f) for (n,f) in self.features.items()}",
"def extractFeatures(self, datum):\n abstract",
"def load_features(self, features):\n pass\n # self.features = features",
"def extract_features(sel... | [
"0.736281",
"0.7257807",
"0.7232119",
"0.70687616",
"0.70373356",
"0.6754617",
"0.6754617",
"0.67102116",
"0.6704189",
"0.6697711",
"0.6641419",
"0.6640016",
"0.6628544",
"0.6551657",
"0.65497965",
"0.6530647",
"0.65214807",
"0.6497448",
"0.64748424",
"0.6471052",
"0.6450408"... | 0.7804912 | 0 |
Create features form results return by heuristic tools. Not available for current JSON content. | def feature_static_heuristic(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_features(self):\n self.extract_features_static()\n self.extract_features_dynamic()",
"def generateFeatures(self, data):\n pass",
"def extractFeatures(self, datum):\n abstract",
"def to_features(self):\n to_return = dict()\n\n to_return['bias'] = 1.0\n ... | [
"0.6555898",
"0.6405811",
"0.6138835",
"0.6118346",
"0.6083954",
"0.6080781",
"0.5991696",
"0.59778917",
"0.5952428",
"0.59330773",
"0.59279025",
"0.59266144",
"0.5886324",
"0.5866058",
"0.5846722",
"0.5834687",
"0.5818833",
"0.58111763",
"0.57806045",
"0.5755879",
"0.5750794... | 0.0 | -1 |
Tests if this resource is a group. A resource that is a group can be used in the group sessions. | def is_group(self):
# Implemented from template for osid.resource.Resource.is_group_template
return self._my_map['group'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_group(self):\n return self._is_group",
"def is_group(obj) -> bool:\n return hasattr(obj, IOConstants.GROUP_ATTR_NAME)",
"def is_group(self, group_name):\n\n return group_name in self._group",
"def can_group(self) -> bool:\n return (\n self.all_icon is not None and\n ... | [
"0.8004295",
"0.77944714",
"0.7665563",
"0.7171541",
"0.7098044",
"0.69698185",
"0.67225504",
"0.66702867",
"0.6638505",
"0.65491295",
"0.6529278",
"0.64755046",
"0.63670874",
"0.6301761",
"0.6290568",
"0.62850153",
"0.6273045",
"0.6272149",
"0.6267542",
"0.6267542",
"0.62629... | 0.8218186 | 0 |
Tests if this resource is a demographic. A resource that is a demographic can be used in the demographic service and the group sessions. | def is_demographic(self):
return self._demographic | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_demo_property(self) -> None:\n demo = collection_domain.Collection.create_default_collection('0')\n self.assertEqual(demo.is_demo, True)\n\n notdemo1 = collection_domain.Collection.create_default_collection('a')\n self.assertEqual(notdemo1.is_demo, False)\n\n notdemo2... | [
"0.56513476",
"0.5539796",
"0.53276396",
"0.5253306",
"0.51560223",
"0.51426125",
"0.51358867",
"0.51073253",
"0.50527936",
"0.5031034",
"0.50178134",
"0.50139415",
"0.49925047",
"0.49802807",
"0.49349448",
"0.49217823",
"0.4911247",
"0.4902479",
"0.48927996",
"0.48890322",
"... | 0.81982607 | 0 |
Gets the asset ``Id``. | def get_avatar_id(self):
# Implemented from template for osid.resource.Resource.get_avatar_id_template
if not self._my_map['avatarId']:
raise errors.IllegalState('this Resource has no avatar')
else:
return Id(self._my_map['avatarId']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asset_id(self) -> str:\n return self._asset_id",
"def asset_id(self) -> str:\n return self.__asset_id",
"def get_id(asset_details):\n\n return Script.get_uid(asset_details)",
"def id(self):\n return self.raw_resource[\"id\"]",
"def sid(self) -> Asset:\n return self.as... | [
"0.8306181",
"0.82968944",
"0.73428214",
"0.7057386",
"0.7042391",
"0.7009156",
"0.6845345",
"0.68321025",
"0.6825759",
"0.67866254",
"0.6773195",
"0.6754204",
"0.67397374",
"0.67397374",
"0.67397374",
"0.67397374",
"0.67397374",
"0.67397374",
"0.6716531",
"0.6681128",
"0.668... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.