query stringlengths 9 3.4k | document stringlengths 9 87.4k | metadata dict | negatives listlengths 4 101 | negative_scores listlengths 4 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Plot rank1 nearest neighbor confusion matrix. Rows and columns are different ethnicitygender. The value in row x and column y is the error rate that each image of ethnicitygender x and its rank1 nearest neighbor of ethnicitygender y is not the same person | def confusion_matrix(im_paths, dir_embeddings, save_figure_path=None):
data = pd.read_csv(im_paths)
image_list = data["path"].to_list()
feature = load_features_from_image_list(image_list, dir_embeddings, ext_feat="npy")
data = get_attribute_gender_ethnicity(data, "path")
data["id"] = (
data[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(self):\r\n interp = ClassificationInterpretation.from_learner(self.learn)\r\n interp.plot_confusion_matrix()",
"def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\... | [
"0.62481976",
"0.5850511",
"0.5787129",
"0.57802856",
"0.57566446",
"0.5724097",
"0.5712232",
"0.57106066",
"0.57067007",
"0.56925535",
"0.5681571",
"0.5677563",
"0.5672164",
"0.56678575",
"0.56661797",
"0.56371564",
"0.56120133",
"0.5598198",
"0.5593582",
"0.5592196",
"0.558... | 0.5498344 | 34 |
Using image pairs from 'image_pair_path', plot the following three plots. Violin plot the distribution of the cosine similarity score of impostor pairs (different people) and Genuine pair (same people) the plots are separated by ethnicitygender attribute of the first person of each pair. Overlapped Score Distribution p... | def create_bias_analysis_plots(
im_pair_paths,
im_paths,
dir_embeddings,
data=None,
save_data=None,
dir_output="results",
):
if data is not None:
print("load processed data")
with open(data, "rb") as f:
data_pair_df = pk.load(f)
else:
print(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_comparison(unaligned_image_ccd_lst,aligned_image_ccd_lst,stacked_img_ccd,outputs_path,obsdate):\n source_hdu = CCDData(unaligned_image_ccd_lst[0],unit='adu')\n source_image_hdr = source_hdu.header\n run_filename = source_image_hdr['RUN'].strip(' ')\n target_name = source_image_hdr['FIELD'].st... | [
"0.60212815",
"0.58584404",
"0.58527213",
"0.57937336",
"0.57918864",
"0.5790756",
"0.57834584",
"0.5701096",
"0.56923074",
"0.5685753",
"0.56194687",
"0.56160814",
"0.560447",
"0.55893874",
"0.5575749",
"0.55580103",
"0.554318",
"0.5543136",
"0.5528448",
"0.5515287",
"0.5513... | 0.63760436 | 0 |
Clean image pair csv and image list csv by deleting the rows that contain a path to an image whose embedding does not exist in embedding_dir_path | def clean_image_pair_and_image_list_csv(pair_paths, im_paths, dir_embeddings):
check_exist = lambda rel_path: os.path.exists(
os.path.join(dir_embeddings, replace_ext(rel_path))
)
# clean image pair csv
image_pair = pd.read_csv(pair_paths)
old_nrow = image_pair.shape[0]
image_pair = imag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_images_without_label(path_folder):\n\n\n #labels = os.listdir(path_folder + \"labels/val/\")\n labels = os.listdir(path_folder + \"labels/val/\")\n images = os.listdir(path_folder + \"images/val/\")\n for i in images:\n name_i = i.split(\".\")\n if name_i[0] + '.xml' not in lab... | [
"0.5739397",
"0.5736125",
"0.5692936",
"0.56318676",
"0.5618469",
"0.5549257",
"0.5507775",
"0.5480919",
"0.54733306",
"0.54409546",
"0.5440345",
"0.53812724",
"0.5352057",
"0.53235275",
"0.53018755",
"0.5283982",
"0.5273521",
"0.5258717",
"0.5249607",
"0.52281815",
"0.521329... | 0.76012003 | 0 |
Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials. | def get_credentials():
home_dir = os.path.expanduser('~')
credential_dir = os.path.join(home_dir, '.credentials')
if not os.path.exists(credential_dir):
os.makedirs(credential_dir)
credential_path = os.path.join(credential_dir,
'calendar-python-quickstart.json'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_user_credentials(self, storage):\n # Set up a Flow object to be used if we need to authenticate.\n flow = client.flow_from_clientsecrets(\n self.client_secrets,\n scope=self.api_scopes,\n message=tools.message_if_missing(self.client_secrets))\n\n # Re... | [
"0.7571535",
"0.7355913",
"0.71540344",
"0.7120326",
"0.70709026",
"0.7026004",
"0.6991126",
"0.69621813",
"0.6947445",
"0.69403243",
"0.69352114",
"0.69063586",
"0.68998873",
"0.6899442",
"0.6857314",
"0.6828924",
"0.679187",
"0.6784848",
"0.67747265",
"0.6754786",
"0.675138... | 0.677493 | 22 |
call to delete itself | def delete(self):
return self._finalize() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self):\n ...",
"def delete():",
"def delete(self):\n pass",
"def delete(self):\n pass",
"def delete(self):\n pass",
"def delete(self):\n pass",
"def __delete__(self):\n pass",
"def __del__(self) -> None:\n self.delete()",
"def delete(self)... | [
"0.8167222",
"0.79925203",
"0.78984684",
"0.78984684",
"0.78984684",
"0.78984684",
"0.782898",
"0.7797861",
"0.7563515",
"0.74841636",
"0.74841636",
"0.74841636",
"0.7449556",
"0.74464774",
"0.7430234",
"0.7424076",
"0.74127525",
"0.74127525",
"0.73500997",
"0.73500997",
"0.7... | 0.7476581 | 19 |
get the value of property _IntegrityCheck | def IntegrityCheck(self):
if self.force_auto_sync:
self.get('IntegrityCheck')
return self._IntegrityCheck | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def EnableDataIntegrity(self):\n\t\treturn self._get_attribute('enableDataIntegrity')",
"def syncheck(self) :\n\t\ttry :\n\t\t\treturn self._syncheck\n\t\texcept Exception as e:\n\t\t\traise e",
"def safety(self):\n return self._safety",
"def IsChecked(self):\r\n\r\n return self.GetValue()",
... | [
"0.65075386",
"0.5869347",
"0.58475804",
"0.5753277",
"0.56255025",
"0.56019104",
"0.55463",
"0.5503255",
"0.54740024",
"0.54402155",
"0.5437776",
"0.5430208",
"0.542952",
"0.53729284",
"0.53613406",
"0.53375405",
"0.5316777",
"0.52882695",
"0.52658975",
"0.52637374",
"0.5240... | 0.77188 | 0 |
get the value of property _VlanPriority | def VlanPriority(self):
if self.force_auto_sync:
self.get('VlanPriority')
return self._VlanPriority | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FlowStatVlanPriority(self):\n\t\treturn self._get_attribute('flowStatVlanPriority')",
"def FlowAggregatedStatVlanPriority(self):\n\t\treturn self._get_attribute('flowAggregatedStatVlanPriority')",
"def getPriority(self):\n return self.priority",
"def _get_priority(self):\n return self.__priority",
... | [
"0.79581535",
"0.7343887",
"0.6676573",
"0.6580757",
"0.6580757",
"0.6580757",
"0.6580757",
"0.64934856",
"0.6474305",
"0.64592236",
"0.6305657",
"0.6254205",
"0.6198934",
"0.61785793",
"0.6153762",
"0.6153322",
"0.6140507",
"0.6137974",
"0.61376005",
"0.61376005",
"0.6112572... | 0.81053984 | 0 |
get the value of property _Tos | def Tos(self):
if self.force_auto_sync:
self.get('Tos')
return self._Tos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_t(self):\n return self.t",
"def get_tin(self):\n return self.tin[:]",
"def get_value(self):",
"def getvalue(self):\n ...",
"def getvalue(self):\n ...",
"def get_value(self):\n pass",
"def get_property(self, client):\r\n client.getProperty()",
"def val... | [
"0.6263516",
"0.60954124",
"0.5952132",
"0.5925507",
"0.5925507",
"0.58892965",
"0.5864855",
"0.582428",
"0.5820709",
"0.5789876",
"0.5787564",
"0.5787564",
"0.5771059",
"0.5739372",
"0.5739372",
"0.5739372",
"0.5739372",
"0.5739372",
"0.5739372",
"0.5735682",
"0.5675374",
... | 0.6674808 | 0 |
get the value of property _TrafficClass | def TrafficClass(self):
if self.force_auto_sync:
self.get('TrafficClass')
return self._TrafficClass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_traffic_class_dscp(self):\n return self.__traffic_class_dscp",
"def _get_dscp_traffic_class(self):\n return self.__dscp_traffic_class",
"def _get_cos_traffic_class(self):\n return self.__cos_traffic_class",
"def _get_traffic_class_cos(self):\n return self.__traffic_class_cos",
"def Tes... | [
"0.770501",
"0.7645266",
"0.7078378",
"0.6788123",
"0.65251666",
"0.6222348",
"0.611295",
"0.60471976",
"0.5920321",
"0.5832696",
"0.58309454",
"0.5787103",
"0.5750884",
"0.5724215",
"0.57223487",
"0.5681254",
"0.5625653",
"0.5563834",
"0.5563361",
"0.5501558",
"0.5486571",
... | 0.78202903 | 0 |
get the value of property _TCPTearDown | def TCPTearDown(self):
if self.force_auto_sync:
self.get('TCPTearDown')
return self._TCPTearDown | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSTOP(self):\n return self.listener.STOP",
"def TunnelDown(self):\n if self.force_auto_sync:\n self.get('TunnelDown')\n return self._TunnelDown",
"def shutdown(self):\n return self._read(MX_SHUTDOWN)",
"def _get_mtu(self):\n return self.__mtu",
"def shutdown(... | [
"0.56405234",
"0.5586166",
"0.55796576",
"0.5548832",
"0.5526753",
"0.5505324",
"0.5388013",
"0.5388013",
"0.53842556",
"0.5268649",
"0.5263692",
"0.52432394",
"0.52288353",
"0.5213106",
"0.5203482",
"0.519355",
"0.5181534",
"0.51442873",
"0.51442873",
"0.5141946",
"0.513288"... | 0.82825774 | 0 |
get the value of property _EnableSSL | def EnableSSL(self):
if self.force_auto_sync:
self.get('EnableSSL')
return self._EnableSSL | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable_ssl(self) -> str:\n return pulumi.get(self, \"enable_ssl\")",
"def sslEnabled(self):\n return self.__ssl_enabled",
"def get(self):\n return 'SSL {0}'.format(\n 'enabled' if SSLConfig._is_enabled() else 'disabled')",
"def ssl_required(self):\n return self._ssl... | [
"0.80993605",
"0.80567116",
"0.78154695",
"0.75726104",
"0.7541991",
"0.7336931",
"0.7237109",
"0.722757",
"0.7202129",
"0.7166297",
"0.71095705",
"0.7031162",
"0.69197595",
"0.68915",
"0.682471",
"0.67986774",
"0.67887187",
"0.6783171",
"0.67683566",
"0.6761452",
"0.67551124... | 0.77632874 | 3 |
Build the corpus using a twitter name | def build_corpus(username, api):
print('getting tweets for user: ', username)
timeline = api.GetUserTimeline(screen_name=username, count=200)
tweets = [t.text for t in timeline]
corpus = ' '.join(tweets)
return corpus | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_tweet():\n\n verb = conjugate(random.choice(verbs)['present'], tense=PARTICIPLE, parse=True).title()\n animal = random.choice(animals).title()\n food = random.choice(foods).title()\n noun = random.choice(nouns).title()\n\n band = food + \" \" + noun\n track = verb + \" \" + animal\n\n featu... | [
"0.6071258",
"0.60542446",
"0.60268915",
"0.59970444",
"0.58995855",
"0.57679427",
"0.5691467",
"0.5684041",
"0.5651101",
"0.5639109",
"0.56301737",
"0.5628061",
"0.55921966",
"0.558687",
"0.55145305",
"0.5506921",
"0.5503124",
"0.5486536",
"0.5473638",
"0.54730463",
"0.54729... | 0.7513815 | 0 |
Get the Keys for Twitter account authentication | def get_keys():
keys = []
with open('keys', 'r') as file:
for line in file:
keys.append(line.strip('\n'))
return tuple(keys) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take_auth_data():\n home = str(Path.home())\n path_to_keys = '/Documents/twitter/keys/'\n\n files = [f for f in listdir(home+path_to_keys) if '.DS' not in f]\n\n tokens = []\n for f in files:\n with open(home+path_to_keys+f, 'r') as lines:\n ln = lines.readline().replace(\" \",... | [
"0.7168567",
"0.6769456",
"0.67274",
"0.6616332",
"0.63830405",
"0.63829076",
"0.6360438",
"0.63096154",
"0.6188548",
"0.6074936",
"0.6056622",
"0.5962546",
"0.59412456",
"0.59340113",
"0.591742",
"0.59063226",
"0.59026784",
"0.5899712",
"0.58931434",
"0.58654416",
"0.5858888... | 0.0 | -1 |
Get the twitter API | def get_api():
consumer_api_key, consumer_secret_key, access_token, access_secret_token = get_keys()
return twitter.Api(consumer_key=consumer_api_key,
consumer_secret=consumer_secret_key,
access_token_key=access_token,
access_token_secret=acce... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_twitter():\n \n return TwitterAPI(consumer_key, consumer_secret, access_token, access_token_secret)",
"def get_twitter():\n return TwitterAPI(consumer_key, consumer_secret, access_token, access_token_secret)",
"def get_twitter():\n return TwitterAPI(consumer_key, consumer_secret, access_tok... | [
"0.85012174",
"0.8442036",
"0.8442036",
"0.8442036",
"0.8442036",
"0.7984444",
"0.78916657",
"0.7487826",
"0.7476492",
"0.740843",
"0.7375485",
"0.73682725",
"0.73297775",
"0.7320802",
"0.7270613",
"0.7270613",
"0.71584666",
"0.7049977",
"0.7041436",
"0.7038161",
"0.6994475",... | 0.82320225 | 5 |
Call the function with new input x parameters. The order of the x parameters should be consistent with self.xName. | def __call__(self, *xpars):
# The number of input parameters should be the same as the number of x parameters.
assert len(xpars) == self.nx
kwargs = {}
#Add in the parameters for fit
for loop in range(self.nx):
kwargs[self.xName[loop]] = xpars[loop]
for parNam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f(self,x,*params):\n raise NotImplementedError",
"def fun(self, x):\n\n raise NotImplementedError",
"def call(self, x):\n x = self.d1(x)\n x = self.d2(x)\n x = self.d3(x)\n x = self.d4(x)\n return x",
"def __call__(self, x, *args, **kwargs):\n joine... | [
"0.73768646",
"0.6930063",
"0.6821158",
"0.6685062",
"0.6663396",
"0.6647318",
"0.6518275",
"0.6511807",
"0.64468753",
"0.63877535",
"0.6382419",
"0.6374568",
"0.63154984",
"0.6235397",
"0.621747",
"0.6204021",
"0.62019104",
"0.61983836",
"0.6193099",
"0.6187736",
"0.6168262"... | 0.6631616 | 6 |
Check whether the function is to add or multiply. | def if_Add(self):
if self.multiList is None:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_function(self, function, attr):\n if function == 'sum':\n if self._cast_to_number(attr):\n return True, ''\n else:\n return False, \"Invalid type for function '%s': '%s' should \"\n \"contain only number values.\" % (function, att... | [
"0.65910006",
"0.64262456",
"0.636483",
"0.62177354",
"0.6203108",
"0.6016369",
"0.59753907",
"0.59579426",
"0.5908387",
"0.5823236",
"0.58073425",
"0.57991445",
"0.571642",
"0.5710629",
"0.5688434",
"0.5678932",
"0.56659096",
"0.5664803",
"0.5654861",
"0.5653962",
"0.5649814... | 0.0 | -1 |
Get the function name. | def get_function_name(self):
return self.__function | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def function_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"function_name\")",
"def function_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"function_name\")",
"def name(self):\n\t\treturn self._func_name",
"def function_name(self) -> pulumi.Input[str]:\n ret... | [
"0.87788516",
"0.87788516",
"0.87475073",
"0.84648633",
"0.84648633",
"0.8318103",
"0.8280457",
"0.8176883",
"0.81451344",
"0.7943035",
"0.79135066",
"0.79121107",
"0.7788385",
"0.7733426",
"0.76187235",
"0.76075315",
"0.75451887",
"0.75401425",
"0.7500988",
"0.74775267",
"0.... | 0.8772266 | 2 |
Get the array of the default active variable. | def get_xList(self):
return self.__x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _default() -> list:\n if metadata is None or metadata.default is None:\n return []\n\n return self._always_array(metadata.default)",
"def get_defaults(self):\n\t\treturn self.__defaults",
"def get_all_variables(self):\n return []",
"def default_environment():\n... | [
"0.6927382",
"0.6309423",
"0.625862",
"0.61924934",
"0.61361873",
"0.6098211",
"0.60673165",
"0.59954256",
"0.598985",
"0.5945793",
"0.5945793",
"0.59089404",
"0.5878476",
"0.5828839",
"0.582109",
"0.5783564",
"0.57621723",
"0.5760533",
"0.57493",
"0.5735335",
"0.57257366",
... | 0.0 | -1 |
Get the number of x parameters. | def get_nx(self):
return self.__nx | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_parameters(self):\n return len(self.parameters)",
"def num_params(self):",
"def get_parameter_numbers(self) -> int:\n # TODO(jeikeilim): return the number of parameter list of each layers.\n n_param = sum([x.numel() for x in self.model.parameters()])\n return n_param",
... | [
"0.7864543",
"0.7801056",
"0.77672404",
"0.7739142",
"0.7721041",
"0.7702584",
"0.76707625",
"0.75962126",
"0.7563151",
"0.7558557",
"0.754442",
"0.7537821",
"0.75255305",
"0.7513958",
"0.74627036",
"0.74627036",
"0.74627036",
"0.7457744",
"0.74496347",
"0.74145794",
"0.73990... | 0.0 | -1 |
Get the shape of x parameters. | def get_xshape(self):
return self.__xshape | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_shape(self):\n return self.__x.shape",
"def get_shape(x):\n if isinstance(x, list) and len(x) > 0:\n shapes = [get_shape(subx) for subx in x]\n if any([s != shapes[0] for s in shapes[1:]]):\n raise ValueError('Parameter dimension not consistent: {}'.format(x))\n ... | [
"0.78083515",
"0.7578208",
"0.74895126",
"0.72045606",
"0.71175075",
"0.7101618",
"0.70973086",
"0.70973086",
"0.708903",
"0.70796144",
"0.7076663",
"0.7031826",
"0.69974357",
"0.6975544",
"0.69243985",
"0.6882778",
"0.6882219",
"0.68782216",
"0.68488127",
"0.68488127",
"0.68... | 0.7510969 | 2 |
Reset the default active variable array. | def set_xList(self, *xList):
assert len(xList) == self.__nx
self.__x = xList
self.__xshape = xList[0].shape # Reset the shape of the input. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n for var in self.var_list:\n var.value = None\n var.domain = copy.deepcopy(var.init_domain)",
"def reset_state(self):\n for name in self._buffers:\n self._buffers[name] = self._defaults[name]",
"def _reset(self, env_id: np.ndarray) -> None:",
"... | [
"0.7255789",
"0.7090014",
"0.69112",
"0.6903059",
"0.6891068",
"0.68513805",
"0.6849055",
"0.68317443",
"0.67998403",
"0.6725733",
"0.6725733",
"0.6725733",
"0.67236716",
"0.6677098",
"0.66755664",
"0.6662992",
"0.66542345",
"0.66349465",
"0.6629517",
"0.66013694",
"0.6567645... | 0.0 | -1 |
Return the model result combining all the components. | def combineResult(self, *xpars):
if len(xpars) == 0:
xpars = self.__x
xshape = self.__xshape
else:
assert len(xpars) == self.__nx # The input parameter number should be consistent.
xshape = xpars[0].shape
#-> Calculate the add model components
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_result(self, value):\n self.result = {}\n\n if \"ModelResult\" in type(value).__name__:\n self.result.update(value.params.valuesdict())\n self.comps = value.model.components\n elif (\"list\" or \"tuple\") in type(value).__name__:\n assert all(\"ModelR... | [
"0.68452895",
"0.67719156",
"0.64932096",
"0.6341544",
"0.61996853",
"0.60693794",
"0.60488963",
"0.5863232",
"0.5848498",
"0.58373946",
"0.5782107",
"0.57694054",
"0.5704184",
"0.56759906",
"0.55905336",
"0.5586056",
"0.55771947",
"0.55771947",
"0.5559133",
"0.55555564",
"0.... | 0.6960958 | 0 |
Return the results of all the add components multiplied by the multiplicative models correspondingly. | def componentResult(self, *xpars):
if len(xpars) == 0:
xpars = self.__x
else:
assert len(xpars) == self.__nx # The input parameter number should be consistent.
#-> Calculate the add model components
result = OrderedDict()
for modelName in self._addList:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combineResult(self, *xpars):\n if len(xpars) == 0:\n xpars = self.__x\n xshape = self.__xshape\n else:\n assert len(xpars) == self.__nx # The input parameter number should be consistent.\n xshape = xpars[0].shape\n #-> Calculate the add model com... | [
"0.6945165",
"0.6073313",
"0.5908816",
"0.5898524",
"0.5885824",
"0.5876134",
"0.58678466",
"0.5867306",
"0.58552486",
"0.584598",
"0.5729092",
"0.5700349",
"0.5661854",
"0.5661854",
"0.56593186",
"0.5658847",
"0.5640436",
"0.5640436",
"0.5640436",
"0.56191427",
"0.55759156",... | 0.663265 | 1 |
Return the original results of add models without multiplied other models. | def componentAddResult(self, *xpars):
if len(xpars) == 0:
xpars = self.__x
else:
assert len(xpars) == self.__nx # The input parameter number should be consistent.
result = OrderedDict()
for modelName in self._addList:
result[modelName] = self.__modelDi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combineResult(self, *xpars):\n if len(xpars) == 0:\n xpars = self.__x\n xshape = self.__xshape\n else:\n assert len(xpars) == self.__nx # The input parameter number should be consistent.\n xshape = xpars[0].shape\n #-> Calculate the add model com... | [
"0.6351819",
"0.6099439",
"0.608407",
"0.5877964",
"0.5865462",
"0.5590284",
"0.54903245",
"0.54499006",
"0.543893",
"0.5378611",
"0.5345194",
"0.53124535",
"0.529464",
"0.5277596",
"0.5260585",
"0.524032",
"0.5232824",
"0.5228774",
"0.5212757",
"0.5211252",
"0.5201722",
"0... | 0.56207407 | 5 |
Return the original results of multiplicative models. | def componentMltResult(self, *xpars):
if len(xpars) == 0:
xpars = self.__x
else:
assert len(xpars) == self.__nx # The input parameter number should be consistent.
result = OrderedDict()
for modelName in self._mltList:
result[modelName] = self.__modelDi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multiply(self):\n return self._do_calc(self.multiplier)",
"def multiply(self):\n return self._do_calc(self.multiplier)",
"def multiply(self):\n return self._do_calc(self.multiplier)",
"def implicit_multiplication_application(result: List[TOKEN], local_dict: DICT,\n ... | [
"0.645852",
"0.645852",
"0.645852",
"0.5988135",
"0.59588903",
"0.58137304",
"0.57959443",
"0.57895756",
"0.5757133",
"0.5751491",
"0.573615",
"0.57244587",
"0.5706437",
"0.56909853",
"0.5620931",
"0.5609001",
"0.55959624",
"0.5591617",
"0.5581469",
"0.5579038",
"0.5576296",
... | 0.0 | -1 |
Get the dict of all the models. | def get_modelDict(self):
return self.__modelDict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_models(self):\n self.load()\n return self._models",
"def models(self):\n return self.config.models()",
"def get():\n\n return {'model_ids': mgmt.get_model_ids()}",
"def availablemodels(self):\n return self.__models.keys()",
"def models(self):\n models = []\... | [
"0.7804294",
"0.76579976",
"0.75055176",
"0.74330866",
"0.74149823",
"0.7380831",
"0.7361207",
"0.7147118",
"0.70524144",
"0.701926",
"0.7019033",
"0.7019033",
"0.69760513",
"0.6950567",
"0.6934331",
"0.69281614",
"0.6834468",
"0.68259096",
"0.6761999",
"0.6757449",
"0.674159... | 0.66702574 | 24 |
Get the name list of the add models. | def get_modelAddList(self):
return self._addList | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namelist(self):\n return []",
"def get_names(self):\n return self.names",
"def namelist(self):\n return self._handle.getnames()",
"def namelist(self):\n return self._handle.getnames()",
"def getNames(self) -> List[unicode]:\n ...",
"def namelist(self):\n retu... | [
"0.69251263",
"0.6675172",
"0.6654015",
"0.6654015",
"0.6648755",
"0.65859276",
"0.65859276",
"0.65683997",
"0.6558869",
"0.655723",
"0.6532181",
"0.65298927",
"0.6516372",
"0.64144635",
"0.64045525",
"0.63822156",
"0.63694435",
"0.6307903",
"0.62908643",
"0.6270188",
"0.6267... | 0.7012186 | 0 |
Get the name list of the multiply models. | def get_modelMltList(self):
return self._mltList | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return [o.name for o in self.obs]",
"def models():\n return list(alg2module.keys())",
"def get_models(self):\n return self.P, self.Q",
"def get_models():\n all_models = gfile.Glob(os.path.join(MODELS_DIR, '*.meta'))\n model_filenames = [os.path.basename(m) for m in al... | [
"0.65496206",
"0.6457477",
"0.645453",
"0.6417669",
"0.6414149",
"0.6414149",
"0.63583237",
"0.6331773",
"0.6297725",
"0.62800676",
"0.6270667",
"0.6251162",
"0.62504286",
"0.6115593",
"0.60809386",
"0.6067986",
"0.604893",
"0.6031861",
"0.60298944",
"0.6021806",
"0.6012474",... | 0.55401224 | 75 |
Return the total number of the fit parameters. | def get_parList(self):
parList = []
for modelName in self._modelList:
model = self.__modelDict[modelName]
modelParDict = model.parFitDict
for parName in modelParDict.keys():
parList.append(modelParDict[parName]["value"])
return parList | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_num_params(self):\n num_params = 0\n for p in self.parameters():\n num_params += p.data.view(-1).size(0)\n return num_params",
"def num_parameters(self) -> int:\n if vocabulary.is_empty(self.vocab, self.config.features.configured_namespaces):\n self... | [
"0.8256133",
"0.8057667",
"0.80130637",
"0.7930417",
"0.7930417",
"0.7905649",
"0.79000545",
"0.7869243",
"0.78551686",
"0.77996755",
"0.77976376",
"0.77878475",
"0.77690184",
"0.77349365",
"0.7727258",
"0.7699605",
"0.7695125",
"0.7685741",
"0.7685741",
"0.7685741",
"0.76708... | 0.0 | -1 |
Return the total number of the fit parameters that can vary. | def get_parVaryList(self):
parList = []
for modelName in self._modelList:
model = self.__modelDict[modelName]
modelParDict = model.parFitDict
for parName in modelParDict.keys():
if modelParDict[parName]["vary"]:
parList.append(model... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_num_params(self):\n num_params = 0\n for p in self.parameters():\n num_params += p.data.view(-1).size(0)\n return num_params",
"def count_parameters(self):\n return sum(p.numel() for p in self.parameters() if p.requires_grad)/1e6",
"def count_parameters(self... | [
"0.80753046",
"0.78143567",
"0.78143567",
"0.7733341",
"0.7727463",
"0.7721681",
"0.76891345",
"0.7672453",
"0.7670126",
"0.76645464",
"0.76645464",
"0.76645464",
"0.76370347",
"0.75803334",
"0.7551698",
"0.7531879",
"0.7505909",
"0.75039953",
"0.74949235",
"0.74933374",
"0.7... | 0.0 | -1 |
Return a list of ranges for all the variable parameters. | def get_parVaryRanges(self):
parRList = []
for modelName in self._modelList:
model = self.__modelDict[modelName]
modelParDict = model.parFitDict
for parName in modelParDict.keys():
if modelParDict[parName]["vary"]:
parRList.append(m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_var_ranges(self):\n\n var_ranges = {}\n for var in self.variables:\n min_to_max = list(range(int(var['min']), int(var['max']) + 1))\n if (var['zero_ok'] == False and 0 in min_to_max):\n min_to_max.remove(0)\n\n var_ranges[var['variable']] =... | [
"0.715183",
"0.7062537",
"0.6783174",
"0.67691493",
"0.6764227",
"0.67036676",
"0.66722566",
"0.6641818",
"0.657569",
"0.6426652",
"0.6426652",
"0.6426652",
"0.6426652",
"0.6420814",
"0.6420814",
"0.6420814",
"0.6420814",
"0.63718146",
"0.6364531",
"0.6338458",
"0.6329085",
... | 0.6713926 | 5 |
Return a list of names for all the variable parameters. The latex format is preferred. If the latex format is not found, the variable name is used. | def get_parVaryNames(self, latex=True):
parNList = []
for modelName in self._modelList:
model = self.__modelDict[modelName]
modelParDict = model.parFitDict
for parName in modelParDict.keys():
if modelParDict[parName]["vary"]:
if lat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_all_parameter_names():\n a = list(titles)\n a.append(r\"$\\chi^{2}$ per degree of freedom\")\n b = list(labels)\n b.append(\"chi2_per_dof\")\n return a, b",
"def return_parameter_names():\n return list(titles), list(labels)",
"def variable_names(self):\n\n status, stdout, stderr... | [
"0.6771008",
"0.63261396",
"0.6262708",
"0.6234081",
"0.6216229",
"0.62123215",
"0.61811477",
"0.6179672",
"0.61066055",
"0.59839696",
"0.5974864",
"0.59194183",
"0.5914416",
"0.5903491",
"0.5896946",
"0.58476293",
"0.58380115",
"0.58063406",
"0.57915944",
"0.572818",
"0.5723... | 0.5921892 | 11 |
Updata the fit parameters from a list. | def updateParList(self, parList):
counter = 0
for modelName in self._modelList:
model = self.__modelDict[modelName]
modelParDict = model.parFitDict
for parName in modelParDict.keys():
if modelParDict[parName]["vary"]:
modelParDict[p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_with_fit_args(self, **kwargs):\n pass",
"def _load(self):\n for k,v in self.parameters.items():\n if isinstance(v,list):\n setattr(self,k,np.array(v,dtype=np.float32))\n else:\n setattr(self,k,v)",
"def set_params(model, params): # t... | [
"0.5676635",
"0.5584121",
"0.55730796",
"0.5556847",
"0.5518275",
"0.54969853",
"0.547539",
"0.54354924",
"0.54080987",
"0.53725207",
"0.53473026",
"0.53211075",
"0.530367",
"0.5300253",
"0.5249538",
"0.52292866",
"0.51781636",
"0.51571405",
"0.51552963",
"0.51544863",
"0.515... | 0.5479333 | 6 |
Generate the ModelClass object from the input model dict. | def __init__(self, input_model_dict, func_lib, x_list,
par_add_dict_all={}, QuietMode=False, **kwargs):
modelDict = OrderedDict()
modelNameList = input_model_dict.keys()
for modelName in modelNameList:
funcName = input_model_dict[modelName]["function"]
fu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dikt) -> 'ModelClass':\n return util.deserialize_model(dikt, cls)",
"def make_model():\n m = model_class(*argv[2:-1])\n modelobj[\"model\"] = m",
"def from_dict(cls, dikt) -> 'TaskModel':\n return util.deserialize_model(dikt, cls)",
"def _build_single_model(in_m... | [
"0.75785315",
"0.6717528",
"0.6634311",
"0.6622349",
"0.6489756",
"0.6456048",
"0.6420756",
"0.6363688",
"0.62587273",
"0.62566984",
"0.6229049",
"0.6228134",
"0.62109953",
"0.6157145",
"0.6144035",
"0.6141109",
"0.61284554",
"0.61173046",
"0.6091657",
"0.6078565",
"0.6076100... | 0.0 | -1 |
Calculate the complex visibility. | def Visibility(self, *xpars):
return self.combineResult(*xpars) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_visible(self):\n return self.real > 0",
"def calculate_visibility(qv,qc,qr,qi,qs,T,p):\n Rd = 287.\n COEFLC = 144.7\n COEFLP = 2.24\n COEFFC = 327.8\n COEFFP = 10.36\n EXPLC = 0.88\n EXPLP = 0.75\n EXPFC = 1.\n EXPFP = 0.7776\n\n Tv = T * (1+0.61*qv) # Virtual temper... | [
"0.6294905",
"0.6161144",
"0.60508573",
"0.5993826",
"0.58512944",
"0.56605476",
"0.56384254",
"0.5615959",
"0.5601097",
"0.5583271",
"0.5576602",
"0.5552223",
"0.5538644",
"0.55327225",
"0.55238956",
"0.5441418",
"0.5430832",
"0.5389828",
"0.5385628",
"0.538302",
"0.5343562"... | 0.52891135 | 23 |
Calculate the amplitude of the visibility. | def Amplitude(self, *xpars):
return np.absolute(self.combineResult(*xpars)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def amplitude(self):\r\n return np.sqrt(self.maxint) * self.weights",
"def amplitude(self):\n return np.sqrt(self.maxint) * self.__weights",
"def _define_amplitude(self):\n self.amplitude = LivingAnimation(\n label=\"Amplitude\",\n initial_value=0,\n value_... | [
"0.6846831",
"0.6716236",
"0.6016638",
"0.6007131",
"0.59475297",
"0.5765345",
"0.5721049",
"0.56713825",
"0.56665534",
"0.56269735",
"0.5564351",
"0.555319",
"0.55449975",
"0.55335015",
"0.5504258",
"0.5462568",
"0.54375505",
"0.5396259",
"0.53908914",
"0.53755176",
"0.53368... | 0.576707 | 5 |
Calculate the phase of the visibility. | def Phase(self, *xpars):
return np.angle(self.combineResult(*xpars)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetPhase(self):\n ...",
"def phase(self):\n return self.__phase",
"def getPhase(phase):",
"def phase(self):\n return np.arctan(np.sum(np.imag(self.values)) / np.sum(np.real(self.values)))",
"def phases(self):\r\n\r\n phase = tsa.cache_to_phase(self.cache, self.ij)\r\n\r\n ... | [
"0.69179",
"0.6892856",
"0.68536717",
"0.6824946",
"0.67778414",
"0.6647379",
"0.66447574",
"0.65135497",
"0.6320406",
"0.62649655",
"0.625816",
"0.6258037",
"0.6214263",
"0.62075037",
"0.62075037",
"0.6206714",
"0.6180539",
"0.6047368",
"0.6001718",
"0.59923965",
"0.5926054"... | 0.5766127 | 23 |
Calculate the closure phase with the given baselines. | def Closure_Phase(self, uv1, uv2, uv3):
phi1 = self.Phase(*uv1)
phi2 = self.Phase(*uv2)
phi3 = self.Phase(*uv3)
cphi = phi1 - phi2 + phi3
cphi[cphi < -pi] += 2 * pi
cphi[cphi > pi] -= 2 * pi
return cphi | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closure_phase_operator(self, redundant=False):\n N = self.nbap\n q = (N - 1) * (N - 2) // 2 if not redundant else N * (N - 1) * (N - 2) // 6\n p = self.nbuv\n base_apertures = [0] if not redundant else list(range(N))\n CPO = np.zeros((q, p))\n CPO_index = 0\n fo... | [
"0.6384488",
"0.5323988",
"0.522521",
"0.5066586",
"0.49080592",
"0.48869595",
"0.48869595",
"0.48577842",
"0.478878",
"0.4783607",
"0.47687697",
"0.47503272",
"0.47377008",
"0.47261426",
"0.47184068",
"0.46760312",
"0.46681336",
"0.46456474",
"0.46408623",
"0.45900592",
"0.4... | 0.5491304 | 1 |
The reference to cupy/numpy array on current device. | def array(self) -> ndarray:
if self._slices: # so this is a sub-parray object
# index into origin array by saved slices
ret = self._array.get_by_global_slices(self._current_device_index, self._slices[0])
for s in self._slices[1:]:
ret = ret[s]
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __array__(self):\n return self.array",
"def get_array(self) -> numpy.array:\r\n \r\n return self.pic_array",
"def __call__(self):\n return self.array",
"def numpy(self):\n return self.data",
"def __array__(self):\n return np.asarray(self.data)",
"def mat_devi... | [
"0.6339774",
"0.61898816",
"0.60879034",
"0.6083925",
"0.60048974",
"0.58929497",
"0.5887931",
"0.58803356",
"0.58781785",
"0.584485",
"0.5798073",
"0.56689554",
"0.56523114",
"0.5648078",
"0.5645597",
"0.56226003",
"0.5585329",
"0.5582773",
"0.55804837",
"0.5580131",
"0.5578... | 0.5829152 | 10 |
True if the array is on GPU. | def _on_gpu(self) -> bool:
return self._current_device_index != CPU_INDEX | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_cuda(self):\n return self._tensor.is_cuda",
"def is_cuda(self):\n return self.share.is_cuda",
"def is_cuda(self):\n return next(self.parameters()).is_cuda",
"def is_cuda(self):\n return next(self.parameters()).is_cuda",
"def is_cuda(self):\n return next(self.parame... | [
"0.8066833",
"0.80317914",
"0.7962641",
"0.7962641",
"0.7962641",
"0.7962641",
"0.76606196",
"0.7649934",
"0.7581296",
"0.7256203",
"0.7212082",
"0.71569055",
"0.7072309",
"0.69844073",
"0.6894186",
"0.6885231",
"0.6819945",
"0.679821",
"0.6741122",
"0.6666283",
"0.6656444",
... | 0.75827485 | 8 |
1 if the current device is CPU. Otherwise GPU ID. If called outside the current task context, return data owner's device_id by default | def _current_device_index(self) -> int:
device = PArray._get_current_device()
if device is None: # not called inside current task
return self._coherence.owner
elif device.architecture == cpu:
return CPU_INDEX
else:
# assume GPU here, won't check devic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deviceid(gpu):\n\n # Return if this is already a torch device\n # pylint: disable=E1101\n if isinstance(gpu, torch.device):\n return gpu\n\n # Always return -1 if gpu is None or an accelerator device is unavailable\n if gpu is None or not Models.hasaccelerator():\n... | [
"0.7568771",
"0.7159804",
"0.70684135",
"0.7065984",
"0.7047651",
"0.7042267",
"0.69943464",
"0.6928884",
"0.69227505",
"0.6922525",
"0.68241423",
"0.678068",
"0.6731357",
"0.67055494",
"0.6656736",
"0.6651197",
"0.66496414",
"0.66417074",
"0.6622966",
"0.6599968",
"0.6592631... | 0.76064694 | 0 |
An estimate of bytes used in `device_id` after data is moved there. It is neither lower bound nor upper bound. | def nbytes_at(self, device_id:int):
if self._slices:
if isinstance(self._coherence._local_states[device_id], dict): # there are subarrays no this device
if self._slices_hash in self._coherence._local_states[device_id].keys(): # this subarray is already there
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dev_size(device):\n device_path = \"/sys/block/\"\n num_sectors = open(device_path + device + \"/size\").read().rstrip(\"\\n\")\n sector_size = (\n open(device_path + device + \"/queue/hw_sector_size\")\n .read()\n .rstrip(\"\\n\")\n )\n return int(num_sectors) * int(sector_... | [
"0.65671223",
"0.6112991",
"0.6105079",
"0.60627437",
"0.5987058",
"0.59140545",
"0.5829351",
"0.5811486",
"0.5776342",
"0.5741981",
"0.57396996",
"0.5708407",
"0.5708407",
"0.5708407",
"0.5708407",
"0.56670177",
"0.56650215",
"0.56228447",
"0.56125957",
"0.5601722",
"0.55944... | 0.6388065 | 1 |
Update the copy on current device. Previous copy on other device are lost. This will replace the internal buffer and coherence object completly. | def update(self, array) -> None:
this_device = self._current_device_index
# clean up data
self._array._buffer = {n: None for n in range(num_gpu)}
self._array._buffer[CPU_INDEX] = None
# copy new data to buffer
if isinstance(array, numpy.ndarray):
if this_dev... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n self.device.update()",
"def update(self):\n self.device.update()",
"def update(self):\n self._device.update()",
"def update(self):\r\n self._state = self._dev.state",
"def update(self):\n self.device = self._api.device_query(self._hardware_address, {})... | [
"0.6639182",
"0.6639182",
"0.6589116",
"0.62424845",
"0.61874443",
"0.61656284",
"0.6156927",
"0.5890342",
"0.5890342",
"0.58355814",
"0.5799481",
"0.5768827",
"0.5740892",
"0.57050616",
"0.56907535",
"0.56684357",
"0.56382024",
"0.5632332",
"0.5627925",
"0.56110173",
"0.5602... | 0.6333345 | 3 |
Print global overview of current PArray for debugging | def print_overview(self) -> None:
state_str_map = {0: "INVALID",
1: "SHARED",
2: "MODIFIED"}
print(f"---Overview of PArray\n"
f"ID: {self.ID}, "
f"Name: {self._name}, "
f"Parent_ID: {self.parent_ID if self.ID !=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debug(self):\n \n #path\n print('Path information:')\n for k, v in self.__path.items():\n print(k, v)\n \n #sample count\n print('Sample statistic of each phase')\n for k, v in self.__phase_sample_count.items():\n print(k, v)\n ... | [
"0.6506461",
"0.64922816",
"0.6477643",
"0.636149",
"0.6245735",
"0.6226677",
"0.62087417",
"0.6165838",
"0.616191",
"0.6132819",
"0.6120514",
"0.6097762",
"0.6072334",
"0.60700065",
"0.6064867",
"0.60573196",
"0.60506463",
"0.6027437",
"0.60007197",
"0.5984009",
"0.5981173",... | 0.77615994 | 0 |
Evict all copies from buffer, and clean all related fields | def evict_all(self) -> None:
self._array = None
self._coherence = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeall(self):\n\n # If there used to be a key, there must exist an old value blob somewhere in the database. It should be deallocated after a successful commit to disk.\n for key in self.keys:\n if self.keys[key] is not None:\n punchat,punchlen = self.keys[key]\n ... | [
"0.68613684",
"0.67462224",
"0.6734561",
"0.6724728",
"0.67224747",
"0.66970587",
"0.6572537",
"0.65546036",
"0.6525338",
"0.64800787",
"0.6477587",
"0.6454403",
"0.6439972",
"0.6403386",
"0.6378573",
"0.6376939",
"0.63683766",
"0.6359996",
"0.63383526",
"0.6332468",
"0.63194... | 0.6973438 | 0 |
Evict a device's copy and update coherence states. | def evict(self, device_id: int = None, keep_one_copy: bool = True) -> None:
if device_id is None:
device_id = self._current_device_index
with self._coherence_cv[device_id]:
operations = self._coherence.evict(device_id, keep_one_copy)
self._process_operations(operatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discard(self) -> None:\n self._cached_cpu_activations.clear()",
"def on_unassign(self):",
"def deactivate(self):\n if self.parents[0].type == 'dm-multipath':\n devmap = block.getMap(major=self.major, minor=self.minor)\n if devmap:\n try:\n ... | [
"0.5906839",
"0.55631566",
"0.5532155",
"0.5498732",
"0.54559594",
"0.5447127",
"0.5381022",
"0.53707004",
"0.53222936",
"0.5274804",
"0.5268613",
"0.52685386",
"0.5236002",
"0.5207943",
"0.52032274",
"0.519083",
"0.51686573",
"0.5156111",
"0.5144335",
"0.51166004",
"0.511233... | 0.63869596 | 0 |
Tell the coherence protocol a read happened on a device. And do data movement based on the operations given by protocol. | def _coherence_read(self, device_id: int = None, slices: SlicesType = None) -> None:
if device_id is None:
device_id = self._current_device_index
# update protocol and get operation
with self._coherence._lock: # locks involve
operations = self._coherence.read(device_id,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inReadEvent(self):\r\n try:\r\n self._checkAssert()\r\n if self.handshaker:\r\n self._doHandshakeOp()\r\n elif self.closer:\r\n self._doCloseOp()\r\n elif self.reader:\r\n self._doReadOp()\r\n elif self.w... | [
"0.5821118",
"0.5671535",
"0.5632781",
"0.55741394",
"0.5570815",
"0.5503475",
"0.5421125",
"0.5362482",
"0.5355735",
"0.5354419",
"0.53358424",
"0.53311753",
"0.52687645",
"0.52552265",
"0.5245723",
"0.5225012",
"0.5190005",
"0.5173454",
"0.51724124",
"0.5166722",
"0.5164686... | 0.60276663 | 0 |
Tell the coherence protocol a write happened on a device. And do data movement based on the operations given by protocol. | def _coherence_write(self, device_id: int = None, slices: SlicesType = None) -> None:
if device_id is None:
device_id = self._current_device_index
# update protocol and get operation
with self._coherence._lock: # locks involve
operations = self._coherence.write(device_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _handle_writing(self, soc):\n self._log(\"writing %r\" % self._writing[soc])\n sent = soc.send(self._writing[soc])\n if not sent:\n self._handle_error(soc)\n # Offsets would be more efficient, but this is python so it's not worth it.\n self._writing[soc] = self._writing[soc][sent:]\n if ... | [
"0.59771055",
"0.58352953",
"0.5795601",
"0.5769751",
"0.5651605",
"0.55738467",
"0.55253106",
"0.5506683",
"0.54791766",
"0.5464289",
"0.54628277",
"0.5449849",
"0.54188335",
"0.540623",
"0.5374942",
"0.53657895",
"0.5349587",
"0.53315616",
"0.53300697",
"0.5323799",
"0.5311... | 0.62454164 | 0 |
Process the given memory operations. Data will be moved, and protocol states is kept unchanged. | def _process_operations(self, operations: List[MemoryOperation], slices: SlicesType = None) -> None:
for op in operations:
if op.inst == MemoryOperation.NOOP:
pass # do nothing
elif op.inst == MemoryOperation.LOAD:
if MemoryOperation.LOAD_SUBARRAY in op.f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TransferMemorySequence():\r\n pass",
"def run(self, in_op):\n self.move_inner_state(in_op)\n if isinstance(in_op, memops.ReorderBase):\n self.substitute_reorder(in_op)\n elif isinstance(in_op, memops.FlushBase):\n self.flush_stores(in_op)\n elif isinst... | [
"0.6162057",
"0.59280264",
"0.58506984",
"0.56673956",
"0.5547582",
"0.53738374",
"0.53355587",
"0.53013074",
"0.52991265",
"0.5276234",
"0.5227555",
"0.51870847",
"0.51634264",
"0.51478267",
"0.5125763",
"0.51199305",
"0.51100224",
"0.51066715",
"0.50779814",
"0.5077944",
"0... | 0.7123763 | 0 |
Get current device from task environment. Return None if it is not called within the current task context | def _get_current_device() -> Device | None:
if task_runtime.has_environment():
return task_runtime.get_current_devices()[0]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_device():\n return context.get_context('device_target')",
"def get_device(self):\n raise NotImplementedError()",
"def get_device(self):\n return self.parent.get_device()",
"def get_device():\n c_dev = ct.c_int(0)\n safe_call(backend.get().af_get_device(ct.pointer(c_dev)))\n ... | [
"0.80176103",
"0.72012043",
"0.71950096",
"0.71387523",
"0.7131235",
"0.7082842",
"0.70785034",
"0.6983162",
"0.6983162",
"0.6983162",
"0.6983162",
"0.6983162",
"0.69713515",
"0.68028766",
"0.67965627",
"0.6782209",
"0.67590714",
"0.6711837",
"0.66777796",
"0.6625428",
"0.657... | 0.89496875 | 0 |
Automatically move data to current device. Multiple copies on different devices will be made based on coherence protocol. | def _auto_move(self, device_id: int = None, do_write: bool = False) -> None:
# this is the view of current array, only data within this range should be moved
# currently, only use first slices, which means automove of subarray of subarray is not supported
# TODO: support auto-move subarray of su... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_devices(self, data):\n data = clean(data, self.move_parameters)\n return self.put(\"/devices/move\", data)",
"def move_data_to_device(self, data: Tuple) -> Tuple:\n tmp = []\n for dv in data:\n tmp.append(dv.to(self.device))\n \n return tuple(tmp)",
... | [
"0.64000696",
"0.58103156",
"0.5614368",
"0.55714643",
"0.5544471",
"0.5494813",
"0.5398319",
"0.53958523",
"0.5386477",
"0.53515464",
"0.5343784",
"0.5320827",
"0.53119296",
"0.52720946",
"0.52668",
"0.52289945",
"0.5112816",
"0.5110937",
"0.510419",
"0.50865155",
"0.508469"... | 0.6202042 | 1 |
Return True if the two PArrays are in the same device. | def _on_same_device(self, other: "PArray") -> bool:
this_device = self._current_device_index
return this_device in other._array | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arrays_are_same(a1, a2):\n try:\n return a1.__array_interface__['data'] == a2.__array_interface__['data'] \\\n and a1.strides == a2.strides\n except AttributeError:\n return False",
"def __eq__(self, other: JaggedArray) -> bool:\n\n return np.array_equal(self.data, other... | [
"0.71909565",
"0.6712798",
"0.64848155",
"0.645493",
"0.6450996",
"0.6444737",
"0.64358234",
"0.64259166",
"0.6402271",
"0.6372332",
"0.63694084",
"0.6294412",
"0.6291298",
"0.62789136",
"0.6271262",
"0.6222032",
"0.6214251",
"0.61150944",
"0.6109401",
"0.61036193",
"0.605932... | 0.86543465 | 0 |
Function to return the Fourier transform of the average number of excitation signal | def generate_signal_fourier(G, rot_init=settings.rot_init,
N_sample=1000, hamiltonian='xy',
tf=100*math.pi):
assert hamiltonian in ['ising', 'xy']
N_nodes = G.number_of_nodes()
H_evol = generate_Ham_from_graph(G, type_h=hamiltonian)
rotation_angl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fourierNP(img):\n\tgray = grayscale(img)\n\tf = np.fft.fft2(gray)\n\tfshift = np.fft.fftshift(f)\n\tmagnitude_spectrum = 20*np.log(np.abs(fshift)) # RETURN THIS\n return magnitude_spectrum",
"def IFourierSeries(input):\n N=len(input);\n w=2*cmath.pi/N;\n k=numpy.arange(0,N); \n output =... | [
"0.664903",
"0.66126937",
"0.65474635",
"0.65474635",
"0.6367882",
"0.6228849",
"0.6157794",
"0.61513096",
"0.61406",
"0.61312133",
"0.61271495",
"0.6111394",
"0.6110077",
"0.6088568",
"0.60724425",
"0.6071423",
"0.6057511",
"0.6047089",
"0.6041944",
"0.6024691",
"0.6003575",... | 0.0 | -1 |
Returns the entropy of a discrete distribution p | def entropy(p):
assert (p >= 0).all()
assert abs(np.sum(p)-1) < 1e-6
return -np.sum(p*np.log(p+1e-12)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entropy_py(p):\n return 2 ** np.sum(-p*np.log2(p+1e-10))",
"def entropy(P):\n P_nan = P.copy()\n P_nan[P_nan == 0] = np.nan\n return np.nansum(np.multiply(P_nan, np.log2(1 / P_nan)))",
"def entropy(p: torch.Tensor):\n nz = (p > 0).to(p.device)\n\n eps = torch.finfo(p.dtype).eps\n p_sta... | [
"0.8535428",
"0.8026321",
"0.7933022",
"0.7899416",
"0.7778248",
"0.7755773",
"0.7616017",
"0.7574335",
"0.7550206",
"0.75214255",
"0.74680275",
"0.7442331",
"0.7418228",
"0.73868614",
"0.7344822",
"0.7340159",
"0.7325228",
"0.7321643",
"0.73122334",
"0.7301384",
"0.728359",
... | 0.8559822 | 0 |
Returns the fourier transform of evolution for a list of graphs for the hamiltonian ising and xy. | def return_fourier_from_dataset(graph_list, rot_init=settings.rot_init):
fs_xy = np.zeros((2, len(graph_list), 1000))
fs_is = np.zeros((2, len(graph_list), 1000))
for i, graph in enumerate(graph_list):
fs_xy[0][i], fs_xy[1][i] = generate_signal_fourier(graph,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def numpyFourierTransform(self,graph):\n z=[complex(*graph[i]) for i in range(len(graph))]\n return np.fft.fft(z)",
"def fourier(data, temp_freq, axis, output = 'amplitude'):\n\t\t\n\t\n\t# take largest possible multiple of F1 from PSTH.\n\t# Generate freq and fft\n\t# generate amplitude\n\t# retur... | [
"0.55366683",
"0.5516783",
"0.5465739",
"0.5419355",
"0.52768075",
"0.5247535",
"0.519193",
"0.51801133",
"0.51327807",
"0.50940454",
"0.50563395",
"0.5017494",
"0.49684712",
"0.49435076",
"0.4934959",
"0.49291548",
"0.4896146",
"0.48880312",
"0.48491418",
"0.48234916",
"0.48... | 0.5995976 | 0 |
Returns the list of states after evolution for each graph following return_evolution functions. | def return_list_of_states(graphs_list,
times, pulses, evol='xy', verbose=0):
all_states = []
for G in tqdm(graphs_list, disable=verbose==0):
all_states.append(return_evolution(G, times, pulses, evol))
return all_states | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def final_states(self):\n return list(self.iter_final_states())",
"def get_states():\n # Getting all hidden state through time\n all_hidden_states = tf.scan(GRU, processed_input, \n initializer=initial_hidden, name='states')\n return all_hidden_states",
"d... | [
"0.6391523",
"0.62999266",
"0.6123978",
"0.6084034",
"0.6044997",
"0.60010105",
"0.58874",
"0.5814941",
"0.5797912",
"0.5785024",
"0.57735914",
"0.57689357",
"0.5768432",
"0.57666254",
"0.57618797",
"0.57523",
"0.57481694",
"0.57441455",
"0.57423705",
"0.57423705",
"0.5676234... | 0.69398534 | 0 |
Returns all the discrete probability distributions of a diagonal observable on a list of states each one associated with a graph. The observable can be different for each state. The distribution is taken of all possible values of all observables. | def return_energy_distribution(graphs_list, all_states, observable_func=None, return_energies=False, verbose=0):
all_e_distrib = []
all_e_values_unique = []
for i, G in enumerate(tqdm(graphs_list, disable=verbose==0)):
if observable_func == None:
observable = generate_Ham_from_graph(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, observations):\n observations = numpy.asarray(observations)\n if self.continuous:\n state_probabilities = [kde(observations) for kde in self.state_distributions]\n else:\n state_probabilities = [hist[observations] for hist in self.state_distributions]\n... | [
"0.6591823",
"0.5872692",
"0.58593",
"0.5736784",
"0.5724965",
"0.5662096",
"0.56376517",
"0.55812466",
"0.55553836",
"0.54749936",
"0.54611444",
"0.5455154",
"0.5436561",
"0.5419842",
"0.536642",
"0.5363021",
"0.53453237",
"0.53352815",
"0.5247028",
"0.5240108",
"0.5212738",... | 0.62507945 | 1 |
Extends masses array with columns of zeros for missing energies. | def extend_energies(target_energies, energies, masses):
energies = list(energies)
N = masses.shape[0]
res = np.zeros((N, len(target_energies)))
for i, energy in enumerate(target_energies):
if energy not in energies:
res[:, i] = np.zeros((N, ))
else:
res[:, i] = ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_cdm_missing_columns(self, all_merged_obs):\n #cdm_keys = self.obs_table_columns \n nan_array = np.empty( all_merged_obs['observed_variable'].shape )\n nan_array[:] = np.nan\n for k in self.obs_table_columns:\n if k not in list(all_merged_obs.colu... | [
"0.5828517",
"0.5681226",
"0.55303085",
"0.5472589",
"0.54533696",
"0.5409089",
"0.54075205",
"0.5340413",
"0.5293353",
"0.5269589",
"0.5262647",
"0.5260811",
"0.5245497",
"0.5217069",
"0.5212759",
"0.5197485",
"0.5173649",
"0.5173649",
"0.5170683",
"0.5164495",
"0.5139979",
... | 0.6560954 | 0 |
Merge the arrays of energy masses, filling with zeros the missing energies in each. N_dim is the size of the union of the energies from the two distributions. | def merge_energies(e1, m1, e2, m2):
e = sorted(list(set(e1) | set(e2)))
return extend_energies(e, e1, m1), extend_energies(e, e2, m2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend_energies(target_energies, energies, masses):\n energies = list(energies)\n N = masses.shape[0]\n res = np.zeros((N, len(target_energies)))\n for i, energy in enumerate(target_energies):\n if energy not in energies:\n res[:, i] = np.zeros((N, ))\n else:\n r... | [
"0.61147225",
"0.51791215",
"0.51780826",
"0.5170886",
"0.51204383",
"0.50917315",
"0.50118405",
"0.4986016",
"0.49192858",
"0.49115092",
"0.491036",
"0.48992932",
"0.48892462",
"0.4887851",
"0.48865023",
"0.48835614",
"0.4881345",
"0.48470116",
"0.4845102",
"0.4841364",
"0.4... | 0.49551842 | 8 |
Returns the JensenShannon distance matrix of discrete distributions. | def return_js_square_matrix(distributions, verbose=0):
js_matrix = np.zeros((len(distributions), len(distributions)))
for i in range(len(distributions)):
for j in range(i + 1):
masses1 = distributions[i]
masses2 = distributions[j]
js = entropy((masses1+masses2)/2) -\
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDistanceMatrix(self):\n v = self.getVectors()\n vLis = v.keys()\n N = len(v.keys())\n D = np.zeros([N, N], dtype=np.float32)\n print(N)\n for i in range(N):\n print(\"%d/%d\" %(i, N))\n D[i, i] = 1\n for j in range(i + 1, N):\n ... | [
"0.6366571",
"0.62066615",
"0.60713434",
"0.60403615",
"0.5970018",
"0.59257656",
"0.5893016",
"0.58267516",
"0.5821366",
"0.5815694",
"0.5802866",
"0.5776638",
"0.5758599",
"0.5732003",
"0.5713257",
"0.5684547",
"0.56317765",
"0.5623221",
"0.5565517",
"0.55054116",
"0.549900... | 0.6692387 | 0 |
Returns the JensenShannon distance matrix between discrete distributions. | def return_js_matrix(distributions1, distributions2, verbose=0):
assert distributions1.shape[1] == distributions2.shape[1], \
"Distributions must have matching dimensions. Consider using merge_energies"
js_matrix = np.zeros((len(distributions1), len(distributions2)))
for i in trange(len(distribution... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_js_square_matrix(distributions, verbose=0):\n js_matrix = np.zeros((len(distributions), len(distributions)))\n for i in range(len(distributions)):\n for j in range(i + 1):\n masses1 = distributions[i]\n masses2 = distributions[j]\n js = entropy((masses1+mass... | [
"0.6639102",
"0.63327086",
"0.62348247",
"0.6107487",
"0.6024906",
"0.59709287",
"0.5919909",
"0.5830886",
"0.58284116",
"0.5827222",
"0.5802466",
"0.57460403",
"0.57092476",
"0.5689307",
"0.5633272",
"0.5593673",
"0.55936563",
"0.5568564",
"0.5537396",
"0.5527263",
"0.551049... | 0.6015161 | 5 |
Key insensitive to how edges of the graph are returned (order of edges and order of nodes in edges). Same result for [(a, b), (c, d)] and [(d, c), (a, b)] | def edges_unique_key(graph):
edges = list(map(sorted, graph.edges))
return tuple(map(tuple, sorted(edges, key=itemgetter(0,1)))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edges_key(graph):\n return tuple(graph.edges())",
"def getEdges(self):\n # for node in graph,\n # return node -> node for j in graph[node]\n\n return [\"->\".join([str(n1), str(n2)]) for n1 in self.graph.keys() for n2 in self.graph[n1]]",
"def graph():\n\n graph = {'A': ['B',... | [
"0.8092503",
"0.68510854",
"0.6834099",
"0.6819503",
"0.6698048",
"0.6691937",
"0.6650468",
"0.65600914",
"0.65495294",
"0.6514974",
"0.6514542",
"0.64773357",
"0.6469168",
"0.646692",
"0.64300513",
"0.639204",
"0.6339081",
"0.6325254",
"0.6244339",
"0.62142223",
"0.62065727"... | 0.7559962 | 1 |
Simple key based on the edges list | def edges_key(graph):
return tuple(graph.edges()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key(self):\r\n\t\treturn ( hashE(self.edge),self.p1,self.p2);",
"def edges_unique_key(graph):\n edges = list(map(sorted, graph.edges))\n return tuple(map(tuple, sorted(edges, key=itemgetter(0,1))))",
"def hash_key(self):",
"def key(self):\n if self._key is None:\n fields =... | [
"0.74839115",
"0.70695525",
"0.62742394",
"0.61138654",
"0.6107315",
"0.5972589",
"0.59714097",
"0.593486",
"0.59181863",
"0.5910348",
"0.58266234",
"0.5789931",
"0.576313",
"0.574726",
"0.5664185",
"0.56608796",
"0.56562984",
"0.56529033",
"0.5643613",
"0.563653",
"0.5627483... | 0.77654463 | 0 |
Gets observable on graph Uses memoization to speed up the process if graph has been seen before | def get_observable(self, graph):
key = self.get_key(graph)
if key not in self.graphs:
self.graphs[key] = self.observable(graph)
return self.graphs[key] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_graph(self):\n return copy.deepcopy(self.graph)",
"def graph(self):\n ...",
"def _get_full_graph(self):",
"def gen_graph(self):",
"def buildGraph(self):\n return None",
"def graph(self):\n return self.__graph",
"def get_graph(self, engine, args):\n if args not... | [
"0.58682907",
"0.5854089",
"0.5836618",
"0.56403035",
"0.5633858",
"0.5579515",
"0.55596554",
"0.5537906",
"0.55360013",
"0.5529597",
"0.5515514",
"0.5511076",
"0.5501991",
"0.5464765",
"0.54600555",
"0.54531276",
"0.54531276",
"0.5360173",
"0.53295106",
"0.53181666",
"0.5314... | 0.7362642 | 0 |
pass in a generator that produces audio samples returns the maximum sample | def analyze(sample_gen):
max_bucket = 1000
max_sample = 0
sample_bucket_left = []
sample_bucket_right = []
sample_count = 0
for left, right in sample_gen:
max_sample = max(max_sample, left, right)
sample_bucket_left.append(left)
sample_bucket_right.append(right)
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max(self):\r\n\t\treturn max(self.sample)",
"def checkfrequency(inputgiven):\n data_size = 40000\n wav_file = wave.open(inputgiven, 'r')\n data = wav_file.readframes(data_size)\n wav_file.close()\n data = struct.unpack('{n}h'.format(n=data_size), data)\n print max(data)",
"def get_max_gen... | [
"0.69920456",
"0.63125575",
"0.61543196",
"0.6020311",
"0.59816945",
"0.5971887",
"0.5940816",
"0.59183705",
"0.58359694",
"0.58010167",
"0.5784432",
"0.5749754",
"0.56653434",
"0.56350684",
"0.5622525",
"0.5616856",
"0.5616004",
"0.5607954",
"0.5597425",
"0.5593202",
"0.5587... | 0.6102724 | 3 |
set the Cursor invisible | def hide_cursor():
props = WindowProperties()
props.setCursorHidden(True)
# somehow the window gets undecorated after hiding the cursor
# so we reset it here to the value we need
#props.setUndecorated(settings.fullscreen)
base.win.requestProperties(props) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide_cursor(self) -> None:\n self._impl.hide_cursor()",
"def cursor_hidden():\n return mouse.SDL_ShowCursor(SDL_QUERY) == SDL_DISABLE",
"def hide_cursor():\n ret = mouse.SDL_ShowCursor(SDL_DISABLE)\n if ret < 0:\n raise_sdl_err(\"hiding the mouse cursor\")",
"def cursor_set(self, y... | [
"0.80812335",
"0.7785941",
"0.77270675",
"0.7230774",
"0.7165916",
"0.71635675",
"0.69014233",
"0.67774254",
"0.67243725",
"0.6599917",
"0.6590271",
"0.658137",
"0.65602016",
"0.6552145",
"0.65371734",
"0.64842963",
"0.64664114",
"0.6464243",
"0.64412075",
"0.6363666",
"0.635... | 0.80937314 | 0 |
set the Cursor visible again | def show_cursor():
props = WindowProperties()
props.setCursorHidden(False)
path = sys.path[0]
# set the filename to the mouse cursor
x11 = path+"assets/gui/Cursor.x11"
win = path+"/"+"assets/gui/Cursor.ico"
if sys.platform.startswith("linux"):
props.setCursorFilename(x11)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_visible(self, visible):\n self.ec._win.set_mouse_visible(visible)\n self.ec._win.set_mouse_platform_visible(visible) # Pyglet workaround\n self._visible = visible",
"def ToggleCursor(self):\n self.displaycontrol ^= self.LCD_CURSORON\n self.write_lcd(self.LCD_DATA_E1, s... | [
"0.76771915",
"0.70751315",
"0.6995206",
"0.6928889",
"0.69095457",
"0.6890849",
"0.6882205",
"0.6824639",
"0.6790507",
"0.66574347",
"0.66574347",
"0.66045976",
"0.66045976",
"0.66045976",
"0.66045976",
"0.66045976",
"0.66045976",
"0.66045976",
"0.66045976",
"0.66045976",
"0... | 0.6208103 | 35 |
initializes an instance of SessionManager. | def __init__(self):
super().__init__()
self.__current_request_mock = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_session(self):\n pass",
"def init_session(self):\n pass",
"def init_login_manager():\n login_manager = LoginManager()\n login_manager.init_app(app)\n return login_manager",
"def __init__(self, session):\n ConfigurableManager.__init__(self)\n self.session = sessio... | [
"0.6904061",
"0.6904061",
"0.66481507",
"0.65806425",
"0.65141594",
"0.645277",
"0.63811195",
"0.62960505",
"0.62747216",
"0.6211209",
"0.6059803",
"0.60555804",
"0.60547674",
"0.6051973",
"0.60294783",
"0.60174465",
"0.60083896",
"0.5998538",
"0.5979656",
"0.59767985",
"0.59... | 0.0 | -1 |
gets current request object. | def get_current_request(self):
return self.__current_request_mock | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_request(self):\n return self._request",
"def __request__(self) -> requests.Request:\n return self._self_response.request",
"def get_safe_current_request(self):\n\n return self.__current_request_mock",
"def request(self):\n return self.session.request",
"def getRequest():... | [
"0.805608",
"0.7802476",
"0.7677605",
"0.76475567",
"0.74320346",
"0.73812604",
"0.73299783",
"0.7284635",
"0.7218034",
"0.70473117",
"0.69888884",
"0.69469756",
"0.6940095",
"0.69303066",
"0.688085",
"0.6856676",
"0.68296283",
"0.6789254",
"0.67889845",
"0.678115",
"0.674803... | 0.7710739 | 2 |
gets current request object in a safe manner. meaning that if the request does not exist in current context, it will return a None object instead of raising an error. | def get_safe_current_request(self):
return self.__current_request_mock | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_request():\n request = None\n frame = sys._getframe(1) # sys._getframe(0).f_back\n\n while frame:\n # check the instance of each funtion argument\n for arg in frame.f_code.co_varnames[:frame.f_code.co_argcount]:\n request = frame.f_locals[arg]\n\n if is... | [
"0.7956411",
"0.79503584",
"0.72919846",
"0.72686106",
"0.7248624",
"0.71528244",
"0.7031737",
"0.70159024",
"0.6932801",
"0.69184357",
"0.67607033",
"0.6746409",
"0.6646195",
"0.6643748",
"0.6547979",
"0.6497067",
"0.6395014",
"0.6337504",
"0.62366",
"0.62366",
"0.62366",
... | 0.7515478 | 2 |
injects a new request into current request object. | def inject_new_request(self):
self.__current_request_mock = CoreRequestMock() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_request(self, req):\n req.context = self.make_context(req)",
"def _set_request(self, request):\n self._request = request",
"def newRequest(self):\n return Request( )",
"def append_to_request(self, request_base, request_object):\n\n pass",
"def add_request(self, reque... | [
"0.69178027",
"0.68766016",
"0.6790378",
"0.6778249",
"0.653759",
"0.65059483",
"0.64909685",
"0.63973343",
"0.6350897",
"0.6327566",
"0.6317726",
"0.6312367",
"0.6303929",
"0.6248073",
"0.62330276",
"0.6227705",
"0.6210762",
"0.6203217",
"0.62026197",
"0.6074421",
"0.6033342... | 0.76589864 | 0 |
clears current request object. | def clear_current_request(self):
self.__current_request_mock = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _clear_request(self):\n self._request = None",
"def clear(self, request):\n requests.put('{}/clear'.format(self._get_url()), data=request.json())",
"def clear(self, request):\n del request.session[self.id]",
"def clearRequest():\n setRequest(marker)",
"def reset(self):\n ... | [
"0.88998795",
"0.81141376",
"0.80775124",
"0.786648",
"0.7781764",
"0.76556665",
"0.75459784",
"0.74782085",
"0.7166208",
"0.7107878",
"0.7107878",
"0.70750976",
"0.70750976",
"0.70750976",
"0.67689496",
"0.65714395",
"0.6553273",
"0.65381855",
"0.64922774",
"0.6453986",
"0.6... | 0.8228699 | 1 |
sets the given access token in current request. | def set_access_token(self, token):
self.__current_request_mock.headers['Authorization'] = token | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_access_token(self, access_token):\n self.access_token = access_token",
"def access_token(self, access_token):\n\n self._access_token = access_token",
"def set_access_token(self, value: str) -> None:\n\n self.__requester.set_authorization(value)",
"def auth_access_token_request(se... | [
"0.7911822",
"0.77660596",
"0.7647122",
"0.7603611",
"0.7121884",
"0.7116163",
"0.69187003",
"0.68211925",
"0.67627317",
"0.6746904",
"0.67017776",
"0.6563495",
"0.65510315",
"0.64993775",
"0.6483176",
"0.64291406",
"0.6401049",
"0.6347656",
"0.6347559",
"0.63349056",
"0.6166... | 0.79374963 | 0 |
sets the given refresh token in current request. | def set_refresh_token(self, token):
self.__current_request_mock.headers['Cookie'] = f'Refresh-Auth={token}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_refresh(self, token_refresh):\n\n self._token_refresh = token_refresh",
"def set_reddit_oauth_refresh_token(site_name, token, _current_parser=None):\n set_value(site_name, OAUTH_CRED_KEYS[CredKeys.refresh], token, _current_parser)",
"def refresh_token(self):\n url = 'https://www.yiky... | [
"0.819976",
"0.7503534",
"0.6996313",
"0.69947696",
"0.69867736",
"0.69400346",
"0.6887728",
"0.68788785",
"0.68174803",
"0.6813276",
"0.6781366",
"0.6763729",
"0.67563605",
"0.67479444",
"0.67211205",
"0.67074114",
"0.6697538",
"0.6684261",
"0.66680694",
"0.666029",
"0.66441... | 0.79867774 | 1 |
Generates a token of a different format depending on the medium, a 32 characters alphanumeric one if the medium is email, a 6 characters numeric one otherwise. | def generateTokenForMedium(medium: str) -> str:
if medium == "email":
return generateAlphanumericTokenOfLength(32)
else:
return generateNumericTokenOfLength(6) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_token_string(token):\n if JWT_AUTH:\n return 'JWT {}'.format(token)\n else:\n return 'Token {}'.format(token)",
"def make_token():\n return secrets.token_urlsafe(36)",
"def generateToken():\n length = random.randint(8, 32)\n rdmtoken = ''.join(random.choice(string.prin... | [
"0.6564728",
"0.63657165",
"0.6316097",
"0.59882337",
"0.59799993",
"0.59217316",
"0.58563113",
"0.5784893",
"0.5770865",
"0.57325625",
"0.5705895",
"0.56980544",
"0.5682344",
"0.5665848",
"0.5569553",
"0.55450803",
"0.5539791",
"0.550906",
"0.5489072",
"0.5478415",
"0.547741... | 0.8976365 | 0 |
Generates a token of the given length with the character set [09]. | def generateNumericTokenOfLength(length: int) -> str:
return "".join([r.choice(string.digits) for _ in range(length)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_token(length: int = 30, chars: str = UNICODE_ASCII_CHARACTER_SET) -> str:\n rand = random.SystemRandom()\n return \"\".join(rand.choice(chars) for _ in range(length))",
"def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):\n rand = random.SystemRandom()\n return ''.join(rand... | [
"0.75243676",
"0.7450021",
"0.7450021",
"0.7445682",
"0.7210027",
"0.6981508",
"0.68661",
"0.66231173",
"0.65579045",
"0.62586564",
"0.6147653",
"0.6082547",
"0.6072008",
"0.6010847",
"0.6002938",
"0.6002481",
"0.58899236",
"0.5857398",
"0.58210385",
"0.5819372",
"0.580597",
... | 0.7374094 | 4 |
Generates a token of the given length with the character set [azAZ09]. | def generateAlphanumericTokenOfLength(length: int) -> str:
return "".join(
[
r.choice(string.digits + string.ascii_lowercase + string.ascii_uppercase)
for _ in range(length)
]
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_token(length: int = 30, chars: str = UNICODE_ASCII_CHARACTER_SET) -> str:\n rand = random.SystemRandom()\n return \"\".join(rand.choice(chars) for _ in range(length))",
"def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):\n rand = random.SystemRandom()\n return ''.join(rand... | [
"0.75214833",
"0.7441212",
"0.7441212",
"0.7127542",
"0.6871274",
"0.6807342",
"0.6591418",
"0.65719575",
"0.62547743",
"0.61703056",
"0.6091066",
"0.6042798",
"0.59892493",
"0.5971289",
"0.58920443",
"0.5889459",
"0.5873506",
"0.58467793",
"0.5837306",
"0.5817971",
"0.581473... | 0.7362209 | 3 |
Setup transport prior to use Can be used for opening connections, initialisation, etc. | async def open(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepTransport():\n\t# Create a socket\n\tglobal transSock\n\tglobal connSock\n\ttransSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\ttry:\n\t\tprint \"Attempting to bind to \" + str(HOST) + \":\" + str(PORT)\n\t\ttransSock.bind((HOST,PORT))\n\texcept Exception as e:\n\t\tprint \"ERROR: %s\" % (e)\n... | [
"0.68721014",
"0.6849399",
"0.6827061",
"0.6818316",
"0.66811675",
"0.651093",
"0.64939916",
"0.64567024",
"0.6356029",
"0.63439035",
"0.6335738",
"0.63087386",
"0.62958306",
"0.62698567",
"0.62309355",
"0.6228971",
"0.6183019",
"0.61468214",
"0.61417085",
"0.60732555",
"0.60... | 0.0 | -1 |
Cleanup prior to termination Can be used for closing connections etc. | async def close(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup():",
"def cleanup(self):\r\n pass",
"def cleanup(self):\r\n pass",
"def cleanup (self):\n pass",
"def cleanup(self):\n pass",
"def cleanup(self):\n pass",
"def cleanup(self):\n pass",
"def cleanup(self):\n pass",
"def cleanup(self):\n ... | [
"0.8109308",
"0.7989566",
"0.7989566",
"0.796875",
"0.79590124",
"0.79590124",
"0.79590124",
"0.79590124",
"0.79590124",
"0.79590124",
"0.79590124",
"0.79590124",
"0.79590124",
"0.79590124",
"0.79590124",
"0.79335016",
"0.78477824",
"0.7807289",
"0.7807289",
"0.7807289",
"0.7... | 0.0 | -1 |
Publish a call to a remote procedure | async def call_rpc(self, rpc_message: RpcMessage, options: dict, bus_client: "BusClient"):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish():\n pass",
"def _call(self, ctx, method, target, async_=False, **kwargs):\n correlation_id = utils.generate_unicode_uuid()\n\n body = {\n 'rpc_ctx': ctx.to_dict(),\n 'rpc_method': method,\n 'arguments': self._serialize_message(kwargs),\n '... | [
"0.6172488",
"0.6142248",
"0.59172475",
"0.58477736",
"0.5801896",
"0.5721551",
"0.5709042",
"0.5645283",
"0.5626733",
"0.5580931",
"0.556542",
"0.5523652",
"0.55217403",
"0.5436639",
"0.5435506",
"0.5435506",
"0.53769416",
"0.53755903",
"0.5375196",
"0.53668445",
"0.53630483... | 0.0 | -1 |
Consume RPC calls for the given API | async def consume_rpcs(
self, apis: Sequence[Api], bus_client: "BusClient"
) -> Sequence[RpcMessage]:
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n self.logger.info(\"start consuming api calls\")\n while not self.shutdown:\n self.rpc.listen()",
"def call(api, url, method, payload=None, headers=None, auth=_KERBEROS_AUTH,\n proxies=None, retries=_NUM_OF_RETRIES, timeout=None, stream=None):\n if not api:\n ... | [
"0.68935806",
"0.62278247",
"0.61158144",
"0.5999046",
"0.5981028",
"0.5978859",
"0.5921289",
"0.58170295",
"0.5805861",
"0.5794442",
"0.578403",
"0.5707386",
"0.56905967",
"0.5672584",
"0.5668719",
"0.5659307",
"0.5646943",
"0.5626587",
"0.5602543",
"0.5596548",
"0.5589859",... | 0.7117492 | 0 |
Send a result back to the caller | async def send_result(
self,
rpc_message: RpcMessage,
result_message: ResultMessage,
return_path: str,
bus_client: "BusClient",
):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def success(self, result):\r\n raise NotImplementedError",
"def return_result(self, result):\n if self._result_already_returned():\n self.tab.logger.log(\"error: result is already returned\", min_level=1)\n\n self.deferred.callback(result)\n # self.deferred = None",
"def ... | [
"0.71063274",
"0.70468086",
"0.69471174",
"0.68949133",
"0.6771555",
"0.67116874",
"0.67116874",
"0.665778",
"0.6647497",
"0.65774435",
"0.65679455",
"0.6447468",
"0.6428749",
"0.642062",
"0.6418716",
"0.6416829",
"0.64128566",
"0.64128566",
"0.63927084",
"0.6374567",
"0.6372... | 0.6802248 | 4 |
Receive the result for the given message | async def receive_result(
self, rpc_message: RpcMessage, return_path: str, options: dict, bus_client: "BusClient"
) -> ResultMessage:
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receive(self, message):",
"def receive_message(self, message):",
"def receive_message(self, message):\r\n return",
"def receive(self, msg):\n pass",
"def receive(self) -> Message[ValueType]:",
"def application_message(self, bus, msg):\n msgtype = msg.structure.get_name()\n ... | [
"0.74000984",
"0.7308175",
"0.7249189",
"0.70257324",
"0.6853895",
"0.6747112",
"0.6747112",
"0.6730397",
"0.6725348",
"0.6710727",
"0.6705307",
"0.66837627",
"0.66563237",
"0.66144395",
"0.6528153",
"0.6479703",
"0.64213145",
"0.63817203",
"0.6349852",
"0.6345849",
"0.633387... | 0.7123306 | 3 |
Consume messages for the given APIs | async def consume(
self,
listen_for: List[Tuple[str, str]],
listener_name: str,
bus_client: "BusClient",
**kwargs,
) -> AsyncGenerator[List[EventMessage], None]:
raise NotImplementedError(
f"Event transport {self.__class__.__name__} does not support listen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def consume_rpcs(\n self, apis: Sequence[Api], bus_client: \"BusClient\"\n ) -> Sequence[RpcMessage]:\n raise NotImplementedError()",
"def consume_messages(process_func: Callable[[str], None]):\n consumer = get_consumer()\n\n for message in consumer:\n log.debug(f'Received a m... | [
"0.66903913",
"0.62754875",
"0.613885",
"0.5921964",
"0.58287084",
"0.5659722",
"0.55613714",
"0.5532601",
"0.5480657",
"0.5479134",
"0.54674894",
"0.54506075",
"0.5440639",
"0.5435278",
"0.54241997",
"0.5390678",
"0.53864676",
"0.5384158",
"0.53560233",
"0.53520167",
"0.5334... | 0.0 | -1 |
Acknowledge that one or more events were successfully processed | async def acknowledge(self, *event_messages, bus_client: "BusClient"):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acknowledged(self):\n ...",
"def _r_successful_connection(self):\n self.resetDelay()\n for (service_name, event_name) in self._event_callbacks.keys():\n msg = SubscribeMessage(service_name=service_name, event_name=event_name)\n serial_message = create_message_string... | [
"0.66613805",
"0.65974075",
"0.63044256",
"0.62363285",
"0.62363285",
"0.62143993",
"0.6143473",
"0.61014336",
"0.6065576",
"0.6036451",
"0.60026014",
"0.59897435",
"0.59588367",
"0.5946184",
"0.5924894",
"0.5894265",
"0.5874207",
"0.58453906",
"0.5843947",
"0.5824604",
"0.58... | 0.6509519 | 2 |
Return EventMessages for the given api/event names during the (optionally) given date range. Should return newest messages first | async def history(
self,
api_name,
event_name,
start: datetime = None,
stop: datetime = None,
start_inclusive: bool = True,
) -> AsyncGenerator[EventMessage, None]:
raise NotImplementedError(
f"Event transport {self.__class__.__name__} does not sup... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_msgs_by_time_range(self, start: Optional[datetime], end: Optional[datetime]):\n data = self.database.search_by_range(self.tname, MsgWithTag.get_time_key(),\n start, end)\n return [(item[0], self.data_to_msg(item)) for item in data]",
"def search_m... | [
"0.66253644",
"0.60407484",
"0.5977074",
"0.59059924",
"0.58054394",
"0.5721439",
"0.56342494",
"0.5625804",
"0.5603404",
"0.5553978",
"0.5551326",
"0.5543402",
"0.554105",
"0.5521111",
"0.5498942",
"0.54922676",
"0.54851454",
"0.54806143",
"0.54601246",
"0.5455781",
"0.54391... | 0.52341837 | 44 |
Utility method to sanity check the `listen_for` parameter. Call at the start of your consume() implementation. | def _sanity_check_listen_for(self, listen_for):
if not listen_for:
raise NothingToListenFor(
"EventTransport.consume() was called without providing anything "
'to listen for in the "listen_for" argument.'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listen(self, backlog: int) -> None:\n ...",
"def listen(self):\n raise NotImplementedError()",
"def listen(self) -> None:\n raise NotImplementedError",
"def listen(self, *a, **kw):\n raise NotImplementedError()",
"def test_listen_server(self):\n self.assertRaises(vk.l... | [
"0.6402229",
"0.63514966",
"0.6343499",
"0.6256435",
"0.6250072",
"0.6207335",
"0.5995244",
"0.55732787",
"0.551111",
"0.5510104",
"0.546018",
"0.5428086",
"0.53994113",
"0.5398242",
"0.5391532",
"0.53798866",
"0.5355215",
"0.5354416",
"0.5351625",
"0.53470826",
"0.53413",
... | 0.80365247 | 0 |
Store a schema for the given API | async def store(self, api_name: str, schema: Dict, ttl_seconds: int):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_schema(self, schema: str):\n return",
"def create_model(self, ApiId: str, Name: str, Schema: str, ContentType: str = None, Description: str = None) -> Dict:\n pass",
"def schema() -> None:\n pass",
"def create_schema():\n schema = Schema(idx=ID(stored=True),\n da... | [
"0.65519774",
"0.6362324",
"0.6066803",
"0.6042462",
"0.6007055",
"0.59981275",
"0.5994073",
"0.59561974",
"0.59448963",
"0.5918168",
"0.58865476",
"0.58362156",
"0.5805175",
"0.5794914",
"0.57884306",
"0.57884306",
"0.57884306",
"0.5776773",
"0.5716331",
"0.57124263",
"0.569... | 0.7529382 | 0 |
Keep alive a schema already stored via store() The defaults to simply calling store() on the assumption that this will cause the ttl to be updated. Backends may choose to customise this logic. | async def ping(self, api_name: str, schema: Dict, ttl_seconds: int):
await self.store(api_name, schema, ttl_seconds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def store(self, api_name: str, schema: Dict, ttl_seconds: int):\n raise NotImplementedError()",
"def set_ttl(self, ttl):",
"def ttl(self, ttl):\n\n self._ttl = ttl",
"def ttl(self, ttl):\n\n self._ttl = ttl",
"def update(self) -> None:\n\n \n #If time to live is 0\n... | [
"0.6533689",
"0.64557993",
"0.6260466",
"0.6260466",
"0.603891",
"0.5898992",
"0.5861441",
"0.5714942",
"0.56167144",
"0.5602855",
"0.558491",
"0.5448078",
"0.54235876",
"0.5394838",
"0.53460866",
"0.5249306",
"0.52425987",
"0.51994926",
"0.5191799",
"0.51064616",
"0.509041",... | 0.6015657 | 5 |
Load the schema for all APIs Should return a mapping of API names to schemas | async def load(self) -> Dict[str, Dict]:
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_schemas(self) -> None:\n schema_paths = self._root.rglob(\"*.json\")\n for schema_path in schema_paths:\n schema = json.loads(schema_path.read_text())\n\n if self._suffix:\n schema[\"name\"] = f'{schema[\"name\"]}{self._suffix}'\n\n fqn = get_... | [
"0.7554149",
"0.7449293",
"0.6516738",
"0.65152204",
"0.64854914",
"0.6410556",
"0.64086384",
"0.63795626",
"0.63324815",
"0.6321358",
"0.6296901",
"0.62932026",
"0.6269704",
"0.62500584",
"0.62494594",
"0.62419426",
"0.6240677",
"0.6224604",
"0.6159964",
"0.609864",
"0.60474... | 0.0 | -1 |
Get a mapping of transports to lists of APIs This is useful when multiple APIs can be served by a single transport | def get_rpc_transports(self, api_names: Sequence[str]) -> List[Tuple[RpcTransport, List[str]]]:
return self._get_transports(api_names, "rpc") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_transports(self) -> List[TransportPair]:\n with self._lock:\n return self._transport_list",
"def get_router_transports(self, details=None):\n self.log.debug(\"{}.get_router_transports\".format(self.__class__.__name__))\n\n res = []\n for transport in sorted(self.tra... | [
"0.61344844",
"0.59671205",
"0.59646237",
"0.58623034",
"0.58523995",
"0.5841847",
"0.57641447",
"0.5673997",
"0.56114864",
"0.5499092",
"0.54885435",
"0.5482955",
"0.54674995",
"0.5436544",
"0.5294198",
"0.52826595",
"0.5280292",
"0.5259294",
"0.5256797",
"0.52397674",
"0.52... | 0.52697647 | 17 |
Get a mapping of transports to lists of APIs This is useful when multiple APIs can be served by a single transport | def get_event_transports(
self, api_names: Sequence[str]
) -> List[Tuple[EventTransport, List[str]]]:
return self._get_transports(api_names, "event") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_transports(self) -> List[TransportPair]:\n with self._lock:\n return self._transport_list",
"def get_router_transports(self, details=None):\n self.log.debug(\"{}.get_router_transports\".format(self.__class__.__name__))\n\n res = []\n for transport in sorted(self.tra... | [
"0.6134532",
"0.59665954",
"0.5965889",
"0.58626014",
"0.58537227",
"0.58429444",
"0.5765304",
"0.5675413",
"0.5613267",
"0.5500009",
"0.5489003",
"0.54845417",
"0.5468007",
"0.54376686",
"0.5295521",
"0.5284128",
"0.5281446",
"0.52709466",
"0.5259671",
"0.52576065",
"0.52386... | 0.5214652 | 21 |
Get a set of all transports irrespective of type | def get_all_transports(self) -> Set[Transport]:
all_transports = chain(*[entry._asdict().values() for entry in self._registry.values()])
return set([t for t in all_transports if t is not None]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_transports(self) -> List[TransportPair]:\n with self._lock:\n return self._transport_list",
"def getClientTransports(self):\n\n return self.transports",
"def get_router_transports(self, details=None):\n self.log.debug(\"{}.get_router_transports\".format(self.__class__.__... | [
"0.73238736",
"0.685588",
"0.6616401",
"0.60161",
"0.55688196",
"0.55271745",
"0.5488733",
"0.5408329",
"0.5400791",
"0.537061",
"0.53552693",
"0.53174263",
"0.52763665",
"0.5236717",
"0.5139262",
"0.512368",
"0.51200074",
"0.5116004",
"0.5114515",
"0.5111977",
"0.5108901",
... | 0.7916006 | 0 |
r"""Function to compute the distance between sodium ion and coms | def compute_distance(na_coords,COM):
dist = math.sqrt((na_coords[0] - COM[0])**2 + (na_coords[1]-COM[1])**2 +(na_coords[2]-COM[2])**2)
return dist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_between_wheels():",
"def pore_diameter(elements, coordinates, com=None):\n if com is None:\n com = center_of_mass(elements, coordinates)\n atom_vdw = np.array([[atomic_vdw_radius[x.upper()]] for x in elements])\n dist_matrix = euclidean_distances(coordinates, com.reshape(1, -1))\n ... | [
"0.6412438",
"0.6326787",
"0.6326354",
"0.629326",
"0.61913496",
"0.6179601",
"0.6177238",
"0.60951257",
"0.60888654",
"0.60249394",
"0.60085905",
"0.59817463",
"0.5975898",
"0.59703845",
"0.596826",
"0.59603745",
"0.5957901",
"0.5937968",
"0.59256935",
"0.59102046",
"0.59020... | 0.62826216 | 4 |
This function run as a Process. Scans the DB and looks for anomalies in the amount of messages a particular computer sends (by config file). | def check_count():
config = configparser.ConfigParser()
config.read('config.ini')
while True:
try:
for user in get_count_request():
ip, count, protocol = str(user[0][0]), user[1][0], str(user[2][0])
if count >= int(config[protocol]['Count Request']) and ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monitor(self):\n procdata = self.collect_userprocs_info()\n now = int(time.time())\n #-------------------\n proclist = []\n for name in procdata:\n mem = procdata[name]['rss']\n pcode = self.DB.get_code(name)\n proclist.append((now, pcode, mem... | [
"0.6380582",
"0.613785",
"0.5822317",
"0.57135665",
"0.57102776",
"0.5674155",
"0.5622369",
"0.5611314",
"0.55936575",
"0.5568474",
"0.55407995",
"0.5511452",
"0.5495778",
"0.5495157",
"0.548739",
"0.5437029",
"0.5423879",
"0.5387169",
"0.53722477",
"0.53715646",
"0.536557",
... | 0.0 | -1 |
This function run as a Process. Deletes the IP if no minute deviation is found since the first packet sent by it | def delete_by_time():
while True:
try:
now = time.time()
for user in get_time_start():
ip, start, protocol = str(user[0][0]), user[1][0], str(user[2][0])
if now - start >= 60 and ip not in BLACK_LIST:
delete_ip(ip)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_packets(self, num):\n for i in range(num):\n del self._packets[0]",
"def deleteIpTcp(self):\n\t\tquery = ''\n\t\tconn = self.get_connection()\n\t\theaders = { 'Content-type' : 'application/json', 'Authorization' : 'A10 %s' %self.sessionid}\n\t\tconn.request('DELETE', self.get_path() ... | [
"0.57281846",
"0.55785",
"0.55547357",
"0.5404259",
"0.53753024",
"0.5368322",
"0.5351206",
"0.5324668",
"0.529334",
"0.52827144",
"0.5262819",
"0.5261861",
"0.52167547",
"0.5207755",
"0.5196121",
"0.51961124",
"0.5155561",
"0.5154647",
"0.514658",
"0.5094146",
"0.5070127",
... | 0.66586894 | 0 |
Ceiling of an Integral returns itself. | def __ceil__(self, ???): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n BuiltinFunction.__init__(self, \"ceil\",\n conversions=dict(maxima='ceiling',\n sympy='ceiling'))",
"def __call__(self, x, **kwds):\n maximum_bits = kwds.get('maximum_bits', 20000)\n tr... | [
"0.67645824",
"0.6652482",
"0.6402269",
"0.62999463",
"0.6223124",
"0.61048776",
"0.60767484",
"0.59403944",
"0.5758926",
"0.57001173",
"0.56888837",
"0.5599063",
"0.5598016",
"0.5597944",
"0.55960625",
"0.5585511",
"0.5585511",
"0.5585511",
"0.5585511",
"0.5585511",
"0.55855... | 0.6016447 | 7 |
bool(x) > bool Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed. | def __class__(self, ???): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bool(x) -> bool:\n pass",
"def __bool__(x):\n if x.value == 1:\n return True\n elif x.value == -1:\n return False\n else:\n raise ValueError('cannot determine boolean value of Unknown')",
"def explicit_bool(value: bool) -> bool:\n return value",
"... | [
"0.7338447",
"0.6900761",
"0.6462649",
"0.63252324",
"0.6313229",
"0.63063884",
"0.6131933",
"0.6089956",
"0.6066249",
"0.6064636",
"0.60601884",
"0.60582215",
"0.6055217",
"0.60361814",
"0.60250115",
"0.6006404",
"0.60059446",
"0.5959892",
"0.59477496",
"0.59403604",
"0.5939... | 0.0 | -1 |
__dir__() > list default dir() implementation | def __dir__(self, ???): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __dir__():\n return __all__",
"def __dir__(self):\n # list.__dir__ doesn't exist on 2.7, so we can't use it to get our own dir() results.\n # Instead, we'll do what the python c runtime does, and just collect the keys from\n # the plist class's __dict__ and up its superclass chain (which is just ... | [
"0.8217382",
"0.8149761",
"0.80044687",
"0.7926209",
"0.7816482",
"0.7770164",
"0.7751822",
"0.77372074",
"0.7735634",
"0.7710533",
"0.765444",
"0.7593126",
"0.75649136",
"0.7508931",
"0.7440135",
"0.7414003",
"0.7155735",
"0.68784195",
"0.68643284",
"0.6737284",
"0.6679029",... | 0.7978148 | 3 |
str(object='') > str str(bytes_or_buffer[, encoding[, errors]]) > str Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if def... | def __doc__(self, ???): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tostr(obj): # pragma: no cover\n return obj if isinstance(obj, str) else obj.decode()",
"def asString(obj):\n if type(obj) in _STR_TYPES:\n return obj\n return str(obj)",
"def _stringify(obj):\r\n if isinstance(obj, unicode):\r\n return obj.encode('utf-8')\r\n elif isinstance... | [
"0.7611406",
"0.76009786",
"0.74861443",
"0.74645734",
"0.7319926",
"0.7319926",
"0.7319926",
"0.72984457",
"0.7279684",
"0.7276719",
"0.70550954",
"0.70054615",
"0.699329",
"0.6970058",
"0.69679374",
"0.6916082",
"0.69075406",
"0.6900274",
"0.68802357",
"0.6871831",
"0.68486... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.