query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Whether the process is running as the main process | def is_main_process(args: dict):
return not is_distributed(args) or args.local_rank == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_main_process() -> bool:\n return multiprocessing.current_process().name == 'MainProcess' and os.environ['main_process_pid'] == str(os.getpid())",
"def _isSubProcessRunning(self): \n # Check if child process has terminated. Set and return returncode attribute.\n if self.__process.poll()... | [
"0.8799151",
"0.7497712",
"0.7343165",
"0.7201382",
"0.7150669",
"0.7103503",
"0.7073254",
"0.7026223",
"0.70111364",
"0.6951164",
"0.6927277",
"0.6923171",
"0.68789256",
"0.68608314",
"0.68460107",
"0.68151265",
"0.6789779",
"0.67896146",
"0.67687416",
"0.6764666",
"0.674240... | 0.7922667 | 1 |
Set parameters in the parameter tree. This method simply wraps underlying ParameterTree method so that an exceptions can be reraised with an appropriate FileInterfaceError. | def set(self, path, data):
try:
self.param_tree.set(path, data)
except ParameterTreeError as e:
raise FileInterfaceError(e) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setParameterNode(self, parameterNode):\r\n # framework\r\n profbox()\r\n self.parameterNode = parameterNode",
"def setParameterNode(self, parameterNode):\n #framework\n profbox()\n self.parameterNode = parameterNode",
"def setParams(self, paramSet):\r\n pass",
"def set_params(self):\... | [
"0.6985717",
"0.67060566",
"0.6683662",
"0.66480035",
"0.6634291",
"0.66082174",
"0.65245366",
"0.6508125",
"0.64559436",
"0.6373968",
"0.6365402",
"0.63510525",
"0.63371843",
"0.62663895",
"0.6263053",
"0.6206298",
"0.6145241",
"0.6132779",
"0.609262",
"0.6084063",
"0.608083... | 0.7035647 | 0 |
Retrieve all of the txt configuration files in the absolute directory path Clears the internal lists first to prevent circular appending at every "GET" | def get_config_files(self):
self.clear_lists()
print self.abs_directory
for file in os.listdir(self.abs_directory):
print file
if file.endswith('.json') and "qemii" in file:
self.txt_files.append(file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_path(self, conf):\n\t\tpass",
"def get_cfg_files(self):\n\t\tcfg_files = []\n\t\tfor config_object, config_value in self.maincfg_values:\n\t\t\t\n\t\t\t## Add cfg_file objects to cfg file list\n\t\t\tif config_object == \"cfg_file\" and os.path.isfile(config_value):\n\t\t\t\t\tcfg_files.append(config... | [
"0.67695117",
"0.6177163",
"0.617072",
"0.59774256",
"0.59301084",
"0.5873713",
"0.58602625",
"0.58550894",
"0.58476",
"0.58326143",
"0.57421196",
"0.5723155",
"0.57174045",
"0.5698926",
"0.56854516",
"0.56496686",
"0.5622283",
"0.56196785",
"0.5619165",
"0.55947644",
"0.5593... | 0.7291427 | 0 |
gets the frame processor config files from the list of text files found | def get_fp_config_files(self):
self.get_config_files()
for file in self.txt_files:
if "fp" in file:
self.fp_config_files.append(file)
return self.fp_config_files | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fr_config_files(self):\n self.get_config_files()\n for file in self.txt_files:\n if \"fr\" in file:\n self.fr_config_files.append(file)\n return self.fr_config_files",
"def get_config_files(self):\n self.clear_lists()\n print self.abs_directory... | [
"0.6520556",
"0.63628197",
"0.63615507",
"0.6221763",
"0.5962912",
"0.5892015",
"0.5830065",
"0.5739405",
"0.57229286",
"0.56986266",
"0.5679086",
"0.5662258",
"0.5656805",
"0.5652418",
"0.5599099",
"0.5556959",
"0.5527652",
"0.5507178",
"0.5476617",
"0.5443827",
"0.5414869",... | 0.68645674 | 0 |
clears the text file, fr and fp config file lists | def clear_lists(self):
self.fp_config_files = []
self.txt_files = []
self.fr_config_files = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear():",
"def clean_files(self):\n self.filenames.clear()",
"def clear_specific(self):\n self.specific_file = None\n self.specific_parser = None\n\n self.specific_box.delete(0, END)",
"def _clear_variables( self ):\r\n self.navigation = None\r\n self.resPath = ... | [
"0.6580808",
"0.656783",
"0.6490422",
"0.64671326",
"0.6438465",
"0.64325815",
"0.6405157",
"0.63748187",
"0.6326406",
"0.63253486",
"0.6313617",
"0.6293512",
"0.6253082",
"0.6251729",
"0.62491286",
"0.6137878",
"0.61237454",
"0.6122098",
"0.6118917",
"0.6106766",
"0.61034346... | 0.8425523 | 0 |
Find the overlap areas between each cartesian bin and each polar bin. | def get_overlap_values(self, cbins, rbins, thbins):
dr = (cbins - 0.5) / rbins
dth = (pi / 2) / thbins
thbins_reduced = int(ceil(thbins / 2))
def overlap_value(x, y, r, th):
"""
Find the overlap area between a cartesian and a polar bin.
"""
thmin = max(th - dth/2, atan2(y - 0.5, x + 0.5))
thma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def face_area(lon_b, lat_b, r_sphere = 6.375e6):\n \n # Convert inputs to radians\n lon_b_rad = lon_b * np.pi / 180.0\n lat_b_rad = lat_b * np.pi / 180.0\n \n r_sq = r_sphere * r_sphere\n n_cs = lon_b.shape[1] - 1\n \n # Allocate output array\n cs_area = np.zeros((n_cs,n_cs))\n \n ... | [
"0.6044802",
"0.5895329",
"0.58889174",
"0.58684486",
"0.5833127",
"0.58256036",
"0.5822762",
"0.58167046",
"0.5789582",
"0.5789443",
"0.57723266",
"0.5764114",
"0.5745368",
"0.57442003",
"0.57348084",
"0.57329583",
"0.56990653",
"0.56981635",
"0.5677911",
"0.5641722",
"0.564... | 0.72021544 | 0 |
Simply a setter for the switch_state variable | def switch_to_state(self, state):
self.switch_state = state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_state(self, state: int):",
"def set_state(self,s):\n self.state = s",
"def set_state(self, value):\n self.state = value",
"def set_state( self ):",
"def __change_state(self, state):\n self.state = state",
"def _set_state(self, state):\n #print(\"** set state from %d to... | [
"0.7938014",
"0.77415305",
"0.77284354",
"0.7591089",
"0.7483043",
"0.74070084",
"0.74032426",
"0.73946637",
"0.7236219",
"0.722214",
"0.72149825",
"0.7191996",
"0.71756476",
"0.7167509",
"0.7059652",
"0.7028504",
"0.70257914",
"0.69464743",
"0.6940021",
"0.69133204",
"0.6864... | 0.7992266 | 0 |
uses the USA Today API in order to extract the list of the subAPIs for music reviews | def obtain_USAToday_APIs(api="http://api.usatoday.com/open/reviews/music?count=1000&api_key=mhph6f4afgvetbqtex4rs22a"):
import requests
r = requests.get(api)
jsonfile = r.json()
key = jsonfile.keys()
data = jsonfile[key[0]]
keys = jsonfile[key[0]].keys()
api_dict = {}
nData =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, request, format=None):\n albums = MusicAlbum.objects.all()\n # trending = \n # popular = albums[6:]\n recommendations = serializers.ReadMusicAlbumSerializer(\n albums[:2], many=True, context={'request': request}\n )\n trending = serializers.ReadMus... | [
"0.5990308",
"0.5970837",
"0.576632",
"0.5740902",
"0.5699372",
"0.5680496",
"0.5655822",
"0.55319315",
"0.5443329",
"0.54422873",
"0.5438654",
"0.5432013",
"0.5431028",
"0.5429935",
"0.54219544",
"0.5420579",
"0.54025465",
"0.5399872",
"0.5391939",
"0.5383238",
"0.5366309",
... | 0.66950834 | 0 |
convert any item to a numpy ndarray | def to_ndarray(item):
return type(item), sp.array(item, sp.float64, ndmin=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_ndarray(data):\n return np.atleast_1d(getattr(data, 'values', data))",
"def convert_to_ndarray(entity):\n if isinstance(entity, np.ndarray) and entity.dtype.kind in set('biufc'):\n # entity is numerical ndarray already\n return entity\n if isinstance(entity, np.ndarray) and isinsta... | [
"0.7383202",
"0.712074",
"0.70498645",
"0.70083153",
"0.69416726",
"0.69294995",
"0.6854728",
"0.6834907",
"0.6817344",
"0.6804671",
"0.6770331",
"0.66576916",
"0.6650874",
"0.6647591",
"0.6646724",
"0.6613207",
"0.6582173",
"0.6582173",
"0.65404516",
"0.6507793",
"0.64623237... | 0.7740508 | 0 |
Compute the ROUGEN score of a peer with respect to one or more models, for a given value of `n`. | def rouge_n(peer, models, n, alpha=1):
matches = 0
recall_total = 0
peer_counter = _ngram_counts(peer, n)
for model in models:
model_counter = _ngram_counts(model, n)
matches += _counter_overlap(peer_counter, model_counter)
recall_total += _ngram_count(model, n)
precision_tot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_score(self, n_episodes=5):\n\n # Score is computed via aggregate over multiple episodes\n score = 0\n\n for _ in range(n_episodes):\n score += play_episode(self.model, self.env)\n\n return score / n_episodes",
"def compute_rouge_n(output, reference, n=1, mode='f... | [
"0.6221026",
"0.61857086",
"0.59200484",
"0.5913296",
"0.58413684",
"0.58119303",
"0.5691505",
"0.56906444",
"0.5665036",
"0.5646627",
"0.5615947",
"0.5566597",
"0.55650103",
"0.55646986",
"0.55566496",
"0.5514124",
"0.5488513",
"0.5460889",
"0.545565",
"0.54523516",
"0.54460... | 0.7420437 | 0 |
Compute the ROUGE1 (unigram) score of a peer with respect to one or more models. | def rouge_1(peer, models, alpha=1):
return rouge_n(peer, models, 1, alpha) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rouge_l(peer, models, alpha=1):\n matches = 0\n recall_total = 0\n for model in models:\n matches += lcs(model, peer)\n recall_total += len(model)\n precision_total = len(models) * len(peer)\n return _safe_f1(matches, recall_total, precision_total, alpha)",
"def rouge_2(peer, mod... | [
"0.6404512",
"0.6164474",
"0.61226386",
"0.57171863",
"0.56591094",
"0.56569135",
"0.5644448",
"0.5607102",
"0.5510303",
"0.5491259",
"0.5481637",
"0.547529",
"0.54537225",
"0.5388831",
"0.52865225",
"0.52846694",
"0.52558506",
"0.52415675",
"0.52409685",
"0.5237391",
"0.5225... | 0.69222933 | 0 |
Compute the ROUGE2 (bigram) score of a peer with respect to one or more models. | def rouge_2(peer, models, alpha=1):
return rouge_n(peer, models, 2, alpha) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rouge_n(peer, models, n, alpha=1):\n matches = 0\n recall_total = 0\n peer_counter = _ngram_counts(peer, n)\n for model in models:\n model_counter = _ngram_counts(model, n)\n matches += _counter_overlap(peer_counter, model_counter)\n recall_total += _ngram_count(model, n)\n ... | [
"0.63647765",
"0.6264367",
"0.6048327",
"0.56891185",
"0.559623",
"0.5595172",
"0.55653435",
"0.5532778",
"0.5503071",
"0.5493627",
"0.54738057",
"0.54648376",
"0.5429727",
"0.54142624",
"0.5363083",
"0.53563017",
"0.53514856",
"0.53496987",
"0.5347989",
"0.53299314",
"0.5326... | 0.68937504 | 0 |
Compute the ROUGE3 (trigram) score of a peer with respect to one or more models. | def rouge_3(peer, models, alpha=1):
return rouge_n(peer, models, 3, alpha) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rouge_l(peer, models, alpha=1):\n matches = 0\n recall_total = 0\n for model in models:\n matches += lcs(model, peer)\n recall_total += len(model)\n precision_total = len(models) * len(peer)\n return _safe_f1(matches, recall_total, precision_total, alpha)",
"def rouge_n(peer, mod... | [
"0.6201271",
"0.59838575",
"0.56443214",
"0.563465",
"0.5621777",
"0.56136626",
"0.5591619",
"0.551658",
"0.5460007",
"0.5452518",
"0.54252064",
"0.5394155",
"0.53527737",
"0.5327824",
"0.531235",
"0.5268596",
"0.5262611",
"0.5215765",
"0.5202057",
"0.518789",
"0.518238",
"... | 0.6721017 | 0 |
Compute the ROUGEL score of a peer with respect to one or more models. | def rouge_l(peer, models, alpha=1):
matches = 0
recall_total = 0
for model in models:
matches += lcs(model, peer)
recall_total += len(model)
precision_total = len(models) * len(peer)
return _safe_f1(matches, recall_total, precision_total, alpha) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score(self, params):\n\n if self.use_sqrt:\n return self.score_sqrt(params)\n else:\n return self.score_full(params)",
"def score(self, model, probe):\n return scipy.spatial.distance.euclidean(model, probe)",
"def rouge_1(peer, models, alpha=1):\n return rouge_n(pe... | [
"0.64376223",
"0.61849993",
"0.6173057",
"0.6096087",
"0.6008323",
"0.5948405",
"0.59441435",
"0.5903325",
"0.5891097",
"0.5812651",
"0.5770408",
"0.5759025",
"0.573958",
"0.5702037",
"0.5636004",
"0.5603585",
"0.55869937",
"0.5549397",
"0.5543058",
"0.5512206",
"0.5507263",
... | 0.6972612 | 0 |
Given a list of graphs in networkx format, write each of them in its own little gml file in a folder named name in the data_root folder. Create the folder, if necessary. This function is very hacky, parsing node labels on the go for datasets obtained from the Dortmund collection at | def write_graph_list(name, graph_list, data_root):
data_path = os.path.join(data_root, name)
if not os.path.exists(data_path):
os.makedirs(data_path)
# compute right number of trailing zeros for file names
format_positions = ceil(log10(len(graph_list)))
for i, g in enumerate(graph_list):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_layout(root_dir, subsets):\n _create_folder(os.path.join(root_dir, \"images\"))\n _create_folder(os.path.join(root_dir, \"labels\"))\n\n for subset in subsets:\n _create_folder(os.path.join(root_dir, \"images\", subset))\n _create_folder(os.path.join(root_dir, \"labels\", subset)... | [
"0.6296529",
"0.6196926",
"0.6115122",
"0.60457796",
"0.60432667",
"0.6025473",
"0.6017168",
"0.6001553",
"0.5972465",
"0.5906791",
"0.5901544",
"0.585161",
"0.58406854",
"0.5752646",
"0.5749147",
"0.57461995",
"0.5728297",
"0.5697866",
"0.5691245",
"0.56871533",
"0.5682423",... | 0.77036434 | 0 |
fetches tweets and wraps them in Tweet objects | def get_tweets(self):
now = datetime.datetime.now()
tweet_json = self.api.get_tweets(self.last, now)
self.last = now
return [Tweet(x) for x in tweet_json] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tweets():\n clean_tweetdb.delay()\n db_tweets = Tweet.objects.all()\n max_id = min([tweet.tweet_id for tweet in db_tweets])\n tweets = api.search(\n q='#python',\n max_id=max_id,\n count=100\n )\n tweets_id = [tweet.id for tweet in tweets]\n tweets_date = [tweet.cr... | [
"0.76285994",
"0.7314002",
"0.72527397",
"0.7232973",
"0.7203812",
"0.72006255",
"0.71095735",
"0.7069534",
"0.70468444",
"0.70431787",
"0.70248395",
"0.70181644",
"0.70125926",
"0.70005286",
"0.69737434",
"0.69352496",
"0.6934322",
"0.68964857",
"0.688853",
"0.68642783",
"0.... | 0.73902327 | 1 |
updates max_importance value if importance is higher then max_importance | def update_importance(self, importance):
if importance > self.max_importance:
self.max_importance = importance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_importance(self, importance):\r\n self.importance = importance\r\n for tweet in self.tweets:\r\n tweet.update_importance(importance)",
"def change_max(self, level, value):\n if value < 0:\n raise AttributeError('max value should be greater than zero')\n i... | [
"0.6120561",
"0.5990391",
"0.56675154",
"0.56649125",
"0.5598316",
"0.5463613",
"0.5463613",
"0.5452502",
"0.541491",
"0.5413382",
"0.5384408",
"0.5384408",
"0.53646934",
"0.53610283",
"0.53610283",
"0.53610283",
"0.5323976",
"0.53171647",
"0.5316251",
"0.5280184",
"0.5269162... | 0.86922395 | 0 |
fetches tweets from start date till end date | def get_tweets(self, start_date, end_date):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tweets(self, start_date, end_date):\r\n # get tweets from api\r\n config = crawler.APIConfig()\r\n config.set_api_key(\"8e1618e9-419f-4239-a2ee-c0680740a500\")\r\n config.set_end_time(end_date)\r\n config.set_filter(self.region)\r\n config.set_start_time(start_date... | [
"0.7896825",
"0.76824534",
"0.7510762",
"0.7041128",
"0.6890227",
"0.6792959",
"0.6664002",
"0.66307527",
"0.65022916",
"0.6492793",
"0.64922196",
"0.6477469",
"0.6452656",
"0.6447653",
"0.6434829",
"0.6408373",
"0.6390277",
"0.63862234",
"0.6347076",
"0.6342707",
"0.6322864"... | 0.8704661 | 0 |
fetches tweets from start date till end date | def get_tweets(self, start_date, end_date):
# get tweets from api
config = crawler.APIConfig()
config.set_api_key("8e1618e9-419f-4239-a2ee-c0680740a500")
config.set_end_time(end_date)
config.set_filter(self.region)
config.set_start_time(start_date)
return c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tweets(self, start_date, end_date):\r\n pass",
"def getTweets(self, query, start, end):\n gettweets = Twitter.GetTweets(self.rootpath, self.folderpath,\n start, end, query)\n gettweets.start_getTweets()",
"def get_tweets_in_date_range(start, end... | [
"0.8704661",
"0.76824534",
"0.7510762",
"0.7041128",
"0.6890227",
"0.6792959",
"0.6664002",
"0.66307527",
"0.65022916",
"0.6492793",
"0.64922196",
"0.6477469",
"0.6452656",
"0.6447653",
"0.6434829",
"0.6408373",
"0.6390277",
"0.63862234",
"0.6347076",
"0.6342707",
"0.6322864"... | 0.7896825 | 1 |
Return a final mad lib with parts of speech replaced by user input. | def make_madlib(get_input):
# call the get_input function and make a variable from its output list
replaced_list = get_input(read_text)
index = 0
# we want both the index and the word that we want to replace in text_split
for (i, word) in enumerate(text_split):
# find the parts of speech, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mad_libs():\n\n # The parts of speech we are intrested in removing and replacing\n to_replace = [\"JJ\", \"JJR\", \"JJS\", \"NN\", \"NNS\", \"RB\", \"RBR\", \"RBS\"]\n done = False\n while not done:\n print(\"You're in the madlibs menu\")\n print(\"Here are your options:\")\n p... | [
"0.63713914",
"0.6036372",
"0.57943606",
"0.5604704",
"0.55267847",
"0.549841",
"0.54870534",
"0.5482093",
"0.5372294",
"0.5347282",
"0.5323033",
"0.53198546",
"0.52982825",
"0.5293129",
"0.52888864",
"0.52587306",
"0.5246758",
"0.5227932",
"0.52277255",
"0.5220096",
"0.52196... | 0.7572062 | 0 |
Generates a unary relation from our graph by first sampling a value from dist (must return a number between 1 and N, where N is the number of nodes in the graph), and then sampling that many nodes from the graph with replacement | def generateUnaryRel(graph, dist=None):
if dist is None:
dist = lambda: random.randint(1, len(graph.nodes()))
count = dist()
return random.sample(graph.nodes(), count) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_regular_graph(variable_names, dist_func, num_neigh=10, **kwargs):\n shuffle(variable_names)\n num_vars = len(variable_names)\n num_neigh = min(num_neigh, num_vars-1)\n graphs = nx.random_graphs.random_regular_graph(num_neigh, num_vars)\n edges = np.array(graphs.edges())\n edges.sort(... | [
"0.6225221",
"0.6075832",
"0.57536215",
"0.5595702",
"0.55751705",
"0.5566251",
"0.5530265",
"0.54891706",
"0.5453418",
"0.5447563",
"0.5430584",
"0.5427841",
"0.54138327",
"0.5403605",
"0.54019284",
"0.53796065",
"0.5331073",
"0.5319422",
"0.53087515",
"0.5298584",
"0.529813... | 0.8003123 | 0 |
Plots the theoretical probability distribution for the random walk. | def plot_distribution(self,show=True):
k_vals,prob_vals = self.tuple_of_probabilities
plt.figure("Probability distribution of Random Walk, theoretical")
plt.scatter(k_vals,prob_vals,s=4)
plt.xlim((-self.n-1,self.n+1))
plt.xlabel("x\u2099 - Position after n jumps")
plt.ylabel("Probability")
plt.supti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def geneticAlgorithmPlot(population, popSize, fittestSize, mutationRate, generations):\n pop = GA.initialPopulation(popSize, population)\n progress = []\n progress.append(1 / GA.rankRoutes(pop)[0][1])\n \n for i in range(0, generations):\n pop = GA.nextGeneration(pop, fittestSize, mutationRat... | [
"0.6606563",
"0.6557504",
"0.6498785",
"0.641404",
"0.640985",
"0.6358938",
"0.62723446",
"0.6208371",
"0.6195964",
"0.61664635",
"0.6133573",
"0.60698766",
"0.6052493",
"0.6051445",
"0.60448354",
"0.6023211",
"0.5997611",
"0.59773487",
"0.59731567",
"0.5966449",
"0.59633803"... | 0.83731085 | 0 |
Runs a Monte Carlo simulation of the random walk for a specified number of trials. It then plots the results as a frequency distribution. Mean and variance values of the Monte Carlo simulation can be retrieved by calling mc.mean and mc.variance, respectively. Method parameters | def run_monte_carlo(self,number_of_trials=2000,plot=True,histogram=False,show=True,overlay=False):
trial_data = []
for _ in range(number_of_trials):
steps = self._random_walk_simulation()
trial_data.append( sum(steps) + self.x_initial )
x_n, counts = np.unique(trial_data, return_counts=True)
self.mc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simulate(self, number_of_simulations):\n self.number_of_simulations = number_of_simulations\n\n for iteration_num in range(0, number_of_simulations, 1):\n self.add_grain(0)\n self.check_pile(iteration_num)\n self.mass_when_iteration.append(self.mass_count - self.m... | [
"0.6701685",
"0.6585736",
"0.6476485",
"0.6432378",
"0.6383453",
"0.631216",
"0.625372",
"0.62430805",
"0.6218561",
"0.62165946",
"0.62092024",
"0.6172401",
"0.61608857",
"0.6157016",
"0.6096449",
"0.6096449",
"0.609388",
"0.60926163",
"0.60920125",
"0.60714257",
"0.60618424"... | 0.7543116 | 0 |
This method produces an animated simulation of a 1D random walk. | def random_walk_draw(self,num_plots,animated=False,show=True):
t_x_arrays = []
t_max = self.n
for _ in range(num_plots):
current_x = self.x_initial
x_array = [current_x]
t_array = range(t_max + 1)
steps = self._random_walk_simulation()
for s in steps:
current_x += s
x_array.append(curren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_walk(turtle, distance, steps):\n turtle.color(randcolor(), randcolor())\n for step in range(0,steps):\n random_move(turtle, distance)\n gohome(turtle)",
"def animate(agent, steps, initialize=None):\n grid, r, c = random_world()\n image = plt.imshow(grid, cmap=cmap, norm=norm)\n if initi... | [
"0.6422432",
"0.6396238",
"0.636496",
"0.63317525",
"0.62908727",
"0.6250839",
"0.6221125",
"0.6113204",
"0.61060905",
"0.60530597",
"0.6004688",
"0.59976655",
"0.5970178",
"0.5949534",
"0.5910587",
"0.5881018",
"0.58617455",
"0.58095884",
"0.5787556",
"0.5768405",
"0.5759622... | 0.7161393 | 0 |
Returns the theoretical average distance from x_initial. | def _calculate_mean_distance_theoretical(self):
x_mean_distance = 0
x_vals,prob_vals = self.tuple_of_probabilities
for i in range(len(x_vals)):
x_val, prob = x_vals[i], prob_vals[i]
x_distance = abs(x_val - self.x_initial)
x_weighted = x_distance * prob
x_mean_distance += x_weighted
return x_mean_di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avgX(self):\n return np.mean(self.getx())",
"def _avg_sample(self):\n samples = [0] * self.num_samples\n for i in range(self.num_samples):\n samples[i] = self.sensor.measure_distance()\n time.sleep(self.sample_delay)\n if self.drop_extremes:\n samp... | [
"0.65964574",
"0.6528893",
"0.65209246",
"0.63227236",
"0.6232084",
"0.62193644",
"0.61996084",
"0.61704206",
"0.6161522",
"0.61305714",
"0.61239797",
"0.6103318",
"0.6088901",
"0.5991759",
"0.59127855",
"0.59127855",
"0.59127855",
"0.59074956",
"0.58808935",
"0.58742917",
"0... | 0.80323946 | 0 |
Calculates the probability that x_n = k delta_x. This method uses the values of n and p in its calculations. | def _calculate_probability(self,k):
if abs(k * self.delta_x) > (3 * np.sqrt(self.variance)):
return 0.0
binom_coeff = special.binom(self.n,(self.n + k)/2)
b_value = binom_coeff * ((self.p) ** ((self.n + k)/2)) * ((1-self.p) ** ((self.n - k)/2))
return b_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probability(n, k, p):\n prob = 0\n power = expotentation_by_squaring((1-p), n)\n count_mult = math.log(n, 2)\n p_fraction = p/(1-p)\n count_mult += 1\n for i in range(0, k+1):\n element = newton(n, i)*power\n prob += element\n power *= p_fraction\n count_mult += 2\... | [
"0.7945974",
"0.7007212",
"0.6929289",
"0.6782928",
"0.67037106",
"0.65899515",
"0.6540211",
"0.6514137",
"0.6489262",
"0.63936114",
"0.636305",
"0.6362294",
"0.62638086",
"0.6237782",
"0.6176205",
"0.61600775",
"0.613456",
"0.613456",
"0.6123985",
"0.6123276",
"0.61229426",
... | 0.7519626 | 1 |
Gets a tuple of the form (kvalues,probabilities) in the range [n,n]. | def _get_tuple_of_probabilities(self):
k_array = np.arange(-self.n,self.n+1,2)
probability_array = []
for k in k_array:
probability_array.append(self._calculate_probability(k))
return (k_array,probability_array) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probability(n, k, p):\n prob = 0\n power = expotentation_by_squaring((1-p), n)\n count_mult = math.log(n, 2)\n p_fraction = p/(1-p)\n count_mult += 1\n for i in range(0, k+1):\n element = newton(n, i)*power\n prob += element\n power *= p_fraction\n count_mult += 2\... | [
"0.6795796",
"0.6431642",
"0.6371308",
"0.63636243",
"0.62259746",
"0.6038752",
"0.59965384",
"0.5926337",
"0.59128183",
"0.5910087",
"0.5896185",
"0.58841133",
"0.584079",
"0.58231497",
"0.5818503",
"0.58054143",
"0.5799345",
"0.5798068",
"0.5791992",
"0.5765857",
"0.5764065... | 0.80612916 | 0 |
tries to decode unicode to deal with python unicode strangeness | def unicode_decode(text):
try:
return text.encode('utf-8').decode()
except UnicodeDecodeError:
return text.encode('utf-8') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unicode_decode(text):\n\n try:\n return text.encode('utf-8').decode()\n except UnicodeDecodeError:\n return text.encode('utf-8')",
"def escapeDecode(s: unicode) -> unicode:\n ...",
"def TryDecode(text):\n try:\n return unicode(text, \"utf8\")\n except (TypeError, UnicodeDeco... | [
"0.7843637",
"0.7709333",
"0.768689",
"0.74438226",
"0.73078275",
"0.7273341",
"0.72526544",
"0.71388495",
"0.70961183",
"0.708849",
"0.7074156",
"0.7049334",
"0.7018959",
"0.6978158",
"0.6967038",
"0.69328606",
"0.6872787",
"0.68676764",
"0.6857858",
"0.6856613",
"0.6843041"... | 0.79577845 | 0 |
Reads lines in file_id and fetches relevant facebook comments, using the facebook graph api, saving the result to result_file | def scrapeFacebookComments(file_id, result_file, access_token):
with open(file_id, 'r', encoding='utf8') as f, \
open(result_file, 'w', encoding='utf8', newline='') as o:
input_file = csv.DictReader(f)
output_file = csv.DictWriter(o,
fieldnames=[
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_comments(video_id, CLIENT_SECRETS_FILE):",
"def process_reddit_comment_file(f,\n output_folder):\n ## Output File\n if output_folder is not None:\n fname = os.path.basename(f).replace(\"comments.json\",\"processed.comments.json\")\n if not fname.endswith... | [
"0.6400023",
"0.62088317",
"0.6198404",
"0.5723124",
"0.54117316",
"0.5385133",
"0.53159404",
"0.524866",
"0.51766294",
"0.5171449",
"0.5160384",
"0.5138199",
"0.51008713",
"0.50976366",
"0.50750273",
"0.5037629",
"0.50367475",
"0.502809",
"0.5021747",
"0.50176424",
"0.501086... | 0.7850107 | 0 |
Generate an instance of the HPE OneView client. Generates an instance of the HPE OneView client using the hpOneView lib. | def get_hponeview_client():
manager_url = prepare_manager_url(CONF.oneview.manager_url)
config = {
"ip": manager_url,
"credentials": {
"userName": CONF.oneview.username,
"password": CONF.oneview.password
}
}
return hponeview_client.OneViewClient(config) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_heat_client(self):\n\n print \"\\t* Generating heat client\"\n # request a new auth token from keystone\n keystone = ksclient.Client(auth_url=self.auth_url,\n username=self.username,\n password=self.password,\n ... | [
"0.62012696",
"0.59542215",
"0.5604468",
"0.53502053",
"0.5333491",
"0.52706295",
"0.5257632",
"0.5231252",
"0.5147483",
"0.5104047",
"0.50083214",
"0.5004166",
"0.49704948",
"0.49391007",
"0.49293235",
"0.49172926",
"0.49049976",
"0.48713294",
"0.48525918",
"0.48477373",
"0.... | 0.78882736 | 0 |
Get the needed information to access ilo. Get the host_ip and a token of an iLO remote console instance which can be used to perform operations on that controller. | def _get_ilo_access(remote_console):
url = remote_console.get('remoteConsoleUrl')
url_parse = parse.urlparse(url)
host_ip = parse.parse_qs(url_parse.netloc).get('addr')[0]
token = parse.parse_qs(url_parse.netloc).get('sessionkey')[0]
return host_ip, token | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_details(module):\n\n login_list = [module.params['login'], os.getenv('DCI_LOGIN')]\n login = next((item for item in login_list if item is not None), None)\n\n password_list = [module.params['password'], os.getenv('DCI_PASSWORD')]\n password = next((item for item in password_list if item is not ... | [
"0.57575613",
"0.57030374",
"0.5658261",
"0.561578",
"0.55102676",
"0.5456767",
"0.54272753",
"0.54270345",
"0.53561795",
"0.53542095",
"0.5327382",
"0.5325279",
"0.5313275",
"0.5305687",
"0.528909",
"0.52887946",
"0.52811927",
"0.52711695",
"0.52711695",
"0.526446",
"0.52539... | 0.808896 | 0 |
Verify if fields and namespaces of a node are valid. Verifies if the 'driver_info' field and the 'properties/capabilities' namespace exist and are not empty. | def verify_node_info(node):
capabilities_dict = utils.capabilities_to_dict(
node.properties.get('capabilities', '')
)
driver_info = node.driver_info
_verify_node_info('properties/capabilities', capabilities_dict,
REQUIRED_ON_PROPERTIES)
_verify_node_info('driver_info'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _verify_node_info(node_namespace, node_info_dict, info_required):\n missing_keys = set(info_required) - set(node_info_dict)\n\n if missing_keys:\n raise exception.MissingParameterValue(\n _(\"Missing the keys for the following OneView data in node's \"\n \"%(namespace)s: %(... | [
"0.62888443",
"0.5970122",
"0.5792318",
"0.5749915",
"0.57480246",
"0.5558528",
"0.555058",
"0.54527915",
"0.54470193",
"0.54410964",
"0.54384977",
"0.5430039",
"0.54069996",
"0.53724563",
"0.53724563",
"0.5347799",
"0.53438234",
"0.53368545",
"0.53343976",
"0.5322387",
"0.53... | 0.7963399 | 0 |
Get OneView information from the node. | def get_oneview_info(node):
try:
capabilities_dict = utils.capabilities_to_dict(
node.properties.get('capabilities', '')
)
except exception.InvalidParameterValue as e:
raise exception.OneViewInvalidNodeParameter(node_uuid=node.uuid,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_show(self, node):\n if node.instance_uuid:\n n = self.ironic_client.node.get_by_instance_uuid(\n node.instance_uuid)\n else:\n n = self.ironic_client.node.get(node.uuid)\n return n",
"def get_node_details(self, node):\n node_details = self... | [
"0.65129185",
"0.60302633",
"0.60019517",
"0.59819186",
"0.5964509",
"0.5886509",
"0.57704425",
"0.5651187",
"0.5634503",
"0.5597397",
"0.5592938",
"0.55923563",
"0.5571141",
"0.55683917",
"0.55459785",
"0.55267394",
"0.55267394",
"0.54931307",
"0.54928416",
"0.5488017",
"0.5... | 0.797151 | 0 |
Validate if the node configuration is consistent with OneView. This method calls hpOneView functions to validate if the node configuration is consistent with the OneView resources it represents, including serverHardwareUri, serverHardwareTypeUri, serverGroupUri serverProfileTemplateUri, enclosureGroupUri and node ports... | def validate_oneview_resources_compatibility(task):
ports = task.ports
oneview_client = get_hponeview_client()
oneview_info = get_oneview_info(task.node)
_validate_node_server_profile_template(oneview_client, oneview_info)
_validate_node_server_hardware_type(oneview_client, oneview_info)
_valid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_node_server_hardware_type(oneview_client, oneview_info):\n node_server_hardware_type_uri = oneview_info['server_hardware_type_uri']\n server_hardware = oneview_client.server_hardware.get(\n oneview_info['server_hardware_uri'])\n server_hardware_sht_uri = server_hardware.get('serverHar... | [
"0.64884377",
"0.626606",
"0.6191199",
"0.61666006",
"0.56702393",
"0.5576689",
"0.5527156",
"0.5473364",
"0.53926665",
"0.53686446",
"0.5361794",
"0.53390706",
"0.53390706",
"0.5296695",
"0.5285889",
"0.521166",
"0.52000636",
"0.5153872",
"0.5126247",
"0.5111564",
"0.5093537... | 0.70742106 | 0 |
Verify if info_required is present in node_namespace. | def _verify_node_info(node_namespace, node_info_dict, info_required):
missing_keys = set(info_required) - set(node_info_dict)
if missing_keys:
raise exception.MissingParameterValue(
_("Missing the keys for the following OneView data in node's "
"%(namespace)s: %(missing_keys)s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_namespace_attrs(self, node):\n for cls in node.classes:\n for var in cls.variables:\n self.check_var_attrs(cls, var)\n for func in cls.functions:\n self.check_fcn_attrs(func)\n\n for func in node.functions:\n self.check_fcn_att... | [
"0.58488464",
"0.58250725",
"0.5789654",
"0.5767724",
"0.576109",
"0.5756803",
"0.57413286",
"0.56746936",
"0.55888873",
"0.55871767",
"0.55615854",
"0.55192447",
"0.54995584",
"0.5496556",
"0.54898274",
"0.5455332",
"0.54527485",
"0.54376256",
"0.5391571",
"0.5388521",
"0.53... | 0.7387368 | 0 |
Checks if the node's Server Hardware has a Server Profile associated. Decorator to execute before the function execution to check if the Server Profile is applied to the Server Hardware. | def node_has_server_profile(func):
def inner(self, *args, **kwargs):
task = args[0]
has_server_profile(task)
return func(self, *args, **kwargs)
return inner | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_server_profile(task):\n oneview_client = get_hponeview_client()\n try:\n profile = task.node.driver_info.get('applied_server_profile_uri')\n oneview_client.server_profiles.get(profile)\n except client_exception.HPOneViewException as exc:\n LOG.error(\n \"Failed to g... | [
"0.64625174",
"0.6329892",
"0.6047561",
"0.59693646",
"0.5888459",
"0.5794492",
"0.57879764",
"0.5742285",
"0.57172704",
"0.55384105",
"0.5498647",
"0.54914945",
"0.5441861",
"0.5415404",
"0.5377407",
"0.5358442",
"0.53436404",
"0.5326051",
"0.5309744",
"0.530064",
"0.5288293... | 0.6996314 | 0 |
Checks if the node's Server Hardware has a Server Profile associated. Function to check if the Server Profile is applied to the Server Hardware. | def has_server_profile(task):
oneview_client = get_hponeview_client()
try:
profile = task.node.driver_info.get('applied_server_profile_uri')
oneview_client.server_profiles.get(profile)
except client_exception.HPOneViewException as exc:
LOG.error(
"Failed to get server pro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_simple_server_profile_by_server_hardware(profile_name, server_name, return_true_if_exists=False):\n logger.info(\"--> creating a server profile with name '%s' ...\" % profile_name)\n # checking if the profile is already existing\n FusionUIBase.navigate_to_section(SectionType.SERVER_PROFILES, ti... | [
"0.6275056",
"0.61501735",
"0.61437684",
"0.6112742",
"0.6090006",
"0.60501087",
"0.60271287",
"0.599908",
"0.59340584",
"0.5925858",
"0.5887888",
"0.58697414",
"0.58384514",
"0.582165",
"0.57998717",
"0.5766464",
"0.5734024",
"0.57302743",
"0.5717543",
"0.5691349",
"0.564297... | 0.7312112 | 0 |
Validate if the Server Profile Template is consistent. | def _validate_node_server_profile_template(oneview_client, oneview_info):
server_profile_template = oneview_client.server_profile_templates.get(
oneview_info['server_profile_template_uri'])
server_hardware = oneview_client.server_hardware.get(
oneview_info['server_hardware_uri'])
_validate_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_server_profile_template_manage_boot(server_profile_template):\n manage_boot = server_profile_template.get('boot', {}).get('manageBoot')\n\n if not manage_boot:\n message = _(\"Server Profile Template: %s, does not allow to manage \"\n \"boot order.\") % server_profile_... | [
"0.7069994",
"0.68792826",
"0.66662836",
"0.6568979",
"0.623397",
"0.6207681",
"0.6184548",
"0.6091524",
"0.6008042",
"0.5996494",
"0.59735686",
"0.5967848",
"0.5924284",
"0.5894213",
"0.58178085",
"0.5812006",
"0.57749254",
"0.5769697",
"0.5671442",
"0.56670874",
"0.5555338"... | 0.7610132 | 0 |
Validate if the Server Hardware Types are the same. Validate if the Server Profile Template and the Server Hardware have the same Server Hardware Type | def _validate_server_profile_template_server_hardware_type(
server_profile_template, server_hardware):
spt_server_hardware_type_uri = (
server_profile_template.get('serverHardwareTypeUri')
)
sh_server_hardware_type_uri = server_hardware.get('serverHardwareTypeUri')
if spt_server_hardwar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_node_server_hardware_type(oneview_client, oneview_info):\n node_server_hardware_type_uri = oneview_info['server_hardware_type_uri']\n server_hardware = oneview_client.server_hardware.get(\n oneview_info['server_hardware_uri'])\n server_hardware_sht_uri = server_hardware.get('serverHar... | [
"0.72816855",
"0.7089422",
"0.6603946",
"0.5662966",
"0.5636588",
"0.5465046",
"0.5454747",
"0.5449822",
"0.5423557",
"0.53436553",
"0.5322769",
"0.530526",
"0.5304127",
"0.52597606",
"0.52190274",
"0.5214245",
"0.51793396",
"0.5171909",
"0.51624525",
"0.51224446",
"0.5110577... | 0.797853 | 0 |
Validate if the Server Profile Template allows to manage the boot order. | def _validate_server_profile_template_manage_boot(server_profile_template):
manage_boot = server_profile_template.get('boot', {}).get('manageBoot')
if not manage_boot:
message = _("Server Profile Template: %s, does not allow to manage "
"boot order.") % server_profile_template.get('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_node_server_profile_template(oneview_client, oneview_info):\n server_profile_template = oneview_client.server_profile_templates.get(\n oneview_info['server_profile_template_uri'])\n server_hardware = oneview_client.server_hardware.get(\n oneview_info['server_hardware_uri'])\n\n ... | [
"0.67219007",
"0.6499709",
"0.6323258",
"0.6316359",
"0.6255033",
"0.6118853",
"0.6111678",
"0.6087322",
"0.6000576",
"0.58550376",
"0.5843932",
"0.57918465",
"0.5738527",
"0.57050484",
"0.56965",
"0.5672641",
"0.56639814",
"0.56551486",
"0.564075",
"0.5627896",
"0.56241286",... | 0.8403261 | 0 |
Validate if the node's Server Hardware Type matches Server Hardware's. | def _validate_node_server_hardware_type(oneview_client, oneview_info):
node_server_hardware_type_uri = oneview_info['server_hardware_type_uri']
server_hardware = oneview_client.server_hardware.get(
oneview_info['server_hardware_uri'])
server_hardware_sht_uri = server_hardware.get('serverHardwareType... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_server_profile_template_server_hardware_type(\n server_profile_template, server_hardware):\n spt_server_hardware_type_uri = (\n server_profile_template.get('serverHardwareTypeUri')\n )\n sh_server_hardware_type_uri = server_hardware.get('serverHardwareTypeUri')\n\n if spt_se... | [
"0.67908597",
"0.62367",
"0.5962622",
"0.5756479",
"0.56312937",
"0.55868",
"0.5542178",
"0.5457781",
"0.5441118",
"0.542971",
"0.54071677",
"0.53862107",
"0.5355715",
"0.5339024",
"0.53239506",
"0.528533",
"0.5275171",
"0.5271481",
"0.52409774",
"0.52346915",
"0.51931256",
... | 0.8271434 | 0 |
Validate if the node's Enclosure Group matches the Server Hardware's. | def _validate_node_enclosure_group(oneview_client, oneview_info):
server_hardware = oneview_client.server_hardware.get(
oneview_info['server_hardware_uri'])
sh_enclosure_group_uri = server_hardware.get('serverGroupUri')
node_enclosure_group_uri = oneview_info['enclosure_group_uri']
if node_encl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_node_server_hardware_type(oneview_client, oneview_info):\n node_server_hardware_type_uri = oneview_info['server_hardware_type_uri']\n server_hardware = oneview_client.server_hardware.get(\n oneview_info['server_hardware_uri'])\n server_hardware_sht_uri = server_hardware.get('serverHar... | [
"0.6324016",
"0.6095127",
"0.5762267",
"0.5492249",
"0.5368418",
"0.5298437",
"0.52928054",
"0.524873",
"0.5237448",
"0.51903677",
"0.5187325",
"0.5177885",
"0.5053734",
"0.50441307",
"0.50437135",
"0.50406593",
"0.50092286",
"0.50085694",
"0.5004797",
"0.5001447",
"0.500056"... | 0.68265074 | 0 |
Validate if a port matches the node's Server Hardware's MAC. | def _validate_node_port_mac_server_hardware(oneview_client,
oneview_info, ports):
server_hardware = oneview_client.server_hardware.get(
oneview_info['server_hardware_uri'])
if not ports:
return
# NOTE(nicodemos) If hponeview client's unable to ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mac_test(mac):\n\n\t\tif re.search(r'([0-9A-F]{2}[:]){5}([0-9A-F]){2}', mac.upper()) is not None:\n\t\t\treturn True\n\t\telse:\n\t\t\treturn False",
"def isMACCommand(self):\n return self.payload.fport == 0",
"def validate_port(port_id, serial_id):\n check_port = False\n api_uri = f\"/v1/dev... | [
"0.7097071",
"0.674294",
"0.67142147",
"0.66719925",
"0.6523463",
"0.652277",
"0.6445301",
"0.64277035",
"0.618244",
"0.61718965",
"0.61240774",
"0.6104669",
"0.6086369",
"0.6079721",
"0.6074816",
"0.6058944",
"0.60415375",
"0.6036376",
"0.59993446",
"0.5959773",
"0.59428114"... | 0.7183407 | 0 |
Validate if the node's Server Profile Template's MAC type is physical. | def _validate_server_profile_template_mac_type(oneview_client, oneview_info):
server_profile_template = oneview_client.server_profile_templates.get(
oneview_info['server_profile_template_uri']
)
if server_profile_template.get('macType') != 'Physical':
message = _("The server profile template... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_server_profile_template_server_hardware_type(\n server_profile_template, server_hardware):\n spt_server_hardware_type_uri = (\n server_profile_template.get('serverHardwareTypeUri')\n )\n sh_server_hardware_type_uri = server_hardware.get('serverHardwareTypeUri')\n\n if spt_se... | [
"0.6238729",
"0.5995228",
"0.5811483",
"0.57653874",
"0.56162757",
"0.5592679",
"0.5545467",
"0.5504423",
"0.5461139",
"0.53143936",
"0.53029996",
"0.5298736",
"0.5189293",
"0.5159756",
"0.515517",
"0.5120909",
"0.50535005",
"0.5044812",
"0.50217086",
"0.5011732",
"0.50085557... | 0.83715606 | 0 |
Add event on obj which will trigger error on this Deferred | def add_error_event(self, obj, event, *args):
hid = obj.connect(event, self._err_emited, *args)
self.handlers_id.append(hid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _err_emited(self, *args):\n\t\tdebug(\"OnEventDeferred : err event catched\")\n\t\tself.errback(*args)\n\t\tself._clean()",
"def errback(self, f):\r\n assert self.__obj is None, 'Only one object can be registered.'\r\n assert isinstance(f, Failure), \"Failure has to be of type 'Failure'.\"\r\n ... | [
"0.67899597",
"0.6495937",
"0.619477",
"0.61869735",
"0.61564225",
"0.615239",
"0.59784204",
"0.59604985",
"0.58662796",
"0.5854047",
"0.5818122",
"0.5777247",
"0.5679716",
"0.5663086",
"0.5646356",
"0.56234443",
"0.5596893",
"0.5590271",
"0.5570113",
"0.5570113",
"0.5570113"... | 0.7338435 | 0 |
Returns a frozenset of variables used in given terms. Note that this returns all used variables, not just free ones. | def used_variables(*terms):
t = terms[0] if len(terms) == 1 else terms
if type(t) is Var:
return frozenset((t,))
elif type(t) in (tuple, Const, Apply, Eq, Ite, Not, And, Or,
Implies, Iff):
return union(*(used_variables(x) for x in t))
elif type(t) in (ForAll, Exi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def free_variables(*terms, **kwargs):\n by_name = kwargs.get('by_name', False)\n _free_variables = partial(free_variables, by_name=by_name)\n\n t = terms[0] if len(terms) == 1 else terms\n\n if type(t) is Var:\n return frozenset((t.name if by_name else t,))\n\n elif type(t) in (tuple, Const, ... | [
"0.7428986",
"0.6987549",
"0.69048446",
"0.6717069",
"0.6559568",
"0.63589525",
"0.62739486",
"0.6270176",
"0.61921215",
"0.6188963",
"0.61090964",
"0.5963275",
"0.5938047",
"0.5924042",
"0.589158",
"0.5881121",
"0.5876238",
"0.5858637",
"0.56572014",
"0.5639939",
"0.56199235... | 0.7920552 | 0 |
Returns a frozenset of variables free in given terms. | def free_variables(*terms, **kwargs):
by_name = kwargs.get('by_name', False)
_free_variables = partial(free_variables, by_name=by_name)
t = terms[0] if len(terms) == 1 else terms
if type(t) is Var:
return frozenset((t.name if by_name else t,))
elif type(t) in (tuple, Const, Apply, Eq, Ite... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def used_variables(*terms):\n\n t = terms[0] if len(terms) == 1 else terms\n\n if type(t) is Var:\n return frozenset((t,))\n\n elif type(t) in (tuple, Const, Apply, Eq, Ite, Not, And, Or,\n Implies, Iff):\n return union(*(used_variables(x) for x in t))\n\n elif type(t)... | [
"0.7301436",
"0.6923216",
"0.66222817",
"0.6540475",
"0.6467375",
"0.63554454",
"0.6250781",
"0.61498994",
"0.5961769",
"0.58668995",
"0.5840457",
"0.5688273",
"0.5672531",
"0.5552212",
"0.5511896",
"0.55101573",
"0.54558146",
"0.5436367",
"0.5431674",
"0.54288334",
"0.541791... | 0.7726464 | 0 |
Returns a frozenset of variables bound in given terms. | def bound_variables(*terms):
t = terms[0] if len(terms) == 1 else terms
if type(t) is Var:
return frozenset()
elif type(t) in (tuple, Const, Apply, Eq, Ite, Not, And, Or,
Implies, Iff):
return union(*(bound_variables(x) for x in t))
elif type(t) in (ForAll, Exist... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def used_variables(*terms):\n\n t = terms[0] if len(terms) == 1 else terms\n\n if type(t) is Var:\n return frozenset((t,))\n\n elif type(t) in (tuple, Const, Apply, Eq, Ite, Not, And, Or,\n Implies, Iff):\n return union(*(used_variables(x) for x in t))\n\n elif type(t)... | [
"0.72198117",
"0.70041084",
"0.6517899",
"0.59218013",
"0.5741847",
"0.57111204",
"0.5670193",
"0.5647711",
"0.5632197",
"0.5581976",
"0.55689853",
"0.55376583",
"0.54729617",
"0.5426977",
"0.5418284",
"0.5415937",
"0.5402921",
"0.53907967",
"0.5385815",
"0.53603476",
"0.5360... | 0.8032309 | 0 |
Returns a frozenset of constants used in given terms. | def used_constants(*terms):
t = terms[0] if len(terms) == 1 else terms
if type(t) is Const:
return frozenset((t,))
elif type(t) in (tuple, Var, Apply, Eq, Ite, Not, And, Or,
Implies, Iff, ForAll, Exists, Lambda, NamedBinder):
return union(*(used_constants(x) for x in ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_constants():\n return filter(\n lambda key: key.upper() == key and type(globals()[key]) in _ALLOWED,\n\n filter( # filter _PRIVATE variables\n lambda x: not x.startswith(\"_\"),\n globals()\n )\n )",
"def used_variables(*t... | [
"0.63245064",
"0.5992687",
"0.59890866",
"0.59641623",
"0.5806408",
"0.56888586",
"0.56451476",
"0.55847293",
"0.5571786",
"0.55393314",
"0.55284834",
"0.5504401",
"0.54954517",
"0.54566354",
"0.54400617",
"0.5428424",
"0.54196256",
"0.5411198",
"0.53967535",
"0.53961635",
"0... | 0.80427533 | 0 |
Return the term obtained from t by simultaneous substitution given by subs subs is either a dictionary or a mapping given by an iterable of (key, value) pairs Both keys and values in subs can be either Var or Const. All keys in subs will be substituted by their values in subs. For variables, only free occurances will b... | def substitute(t, subs):
if not isinstance(subs, dict):
subs = dict(subs)
if type(t) in (Var, Const):
if t in subs:
return subs[t]
else:
return t
elif type(t) in (Apply, Eq, Ite, Not, And, Or, Implies, Iff):
return type(t)(*(substitute(x, subs) for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def substitute_apply(t, subs, by_name=False):\n\n if not isinstance(subs, dict):\n subs = dict(subs)\n\n _substitute_apply = partial(substitute_apply, subs=subs, by_name=by_name)\n\n if type(t) in (Var, Const):\n return t\n\n if type(t) is Apply and t.func in subs:\n terms = tuple(... | [
"0.6979903",
"0.6809032",
"0.68054605",
"0.67548573",
"0.6693763",
"0.6661133",
"0.65522754",
"0.65254176",
"0.6471985",
"0.62673676",
"0.6261165",
"0.6179068",
"0.6160233",
"0.61346424",
"0.6046451",
"0.5994784",
"0.5992433",
"0.5826811",
"0.58200824",
"0.5808683",
"0.574078... | 0.80016816 | 0 |
Return the term obtained from t by simultaneous substitution given by subs subs is either a dictionary or a mapping given by an iterable of (key, value) pairs Both keys and values in subs can be either Var or Const, but must be 2nd order. For any key, value in subs, Apply(key, terms) is substituted by value(terms'), so... | def substitute_apply(t, subs, by_name=False):
if not isinstance(subs, dict):
subs = dict(subs)
_substitute_apply = partial(substitute_apply, subs=subs, by_name=by_name)
if type(t) in (Var, Const):
return t
if type(t) is Apply and t.func in subs:
terms = tuple(_substitute_appl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def substitute(t, subs):\n\n if not isinstance(subs, dict):\n subs = dict(subs)\n\n if type(t) in (Var, Const):\n if t in subs:\n return subs[t]\n else:\n return t\n\n elif type(t) in (Apply, Eq, Ite, Not, And, Or, Implies, Iff):\n return type(t)(*(substit... | [
"0.72416764",
"0.65752196",
"0.6252526",
"0.6022401",
"0.5977601",
"0.5844865",
"0.57589626",
"0.57118535",
"0.55280894",
"0.55234385",
"0.55226636",
"0.5458737",
"0.54270804",
"0.533437",
"0.5322457",
"0.53204954",
"0.52589554",
"0.51950306",
"0.5139489",
"0.50581187",
"0.50... | 0.77619237 | 0 |
Returns True if t is Eq(x,x) for some x | def is_tautology_equality(t):
return type(t) is Eq and t.t1 == t.t2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equals(x, y):\n return x == y",
"def exact(cls, lhs, rhs):\n return lhs == rhs",
"def __eq__(self, *args):\n return _ida_hexrays.cexpr_t___eq__(self, *args)",
"def eq(self, y):\n return 1 - self.ne(y)",
"def __eq__(self, other: t.Any) -> bool:\n return self._op_bool('__eq__',... | [
"0.6527325",
"0.6335552",
"0.62206423",
"0.61665654",
"0.6158353",
"0.6072844",
"0.606981",
"0.6037759",
"0.6037759",
"0.6037759",
"0.6037759",
"0.6037759",
"0.6037759",
"0.6037759",
"0.6037759",
"0.6037759",
"0.6037759",
"0.6037759",
"0.6037759",
"0.6037759",
"0.6037759",
... | 0.69490355 | 0 |
Returns True if t is syntactially equal to u modulo alpha conversion | def equal_mod_alpha(t,u):
def rec(t,u,m1,m2,n):
if type(t) is Var and type(u) is Var:
return m1.get(t,t) == m2.get(u,u)
if type(t) in (ForAll, Exists, Lambda, NamedBinder) and type(t) is type(u):
if len(t.variables) == len(u.variables):
for v1,v2 in zip(t.vari... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def u_exact(t):\n return a * t + b",
"def isalpha(self) -> bool:\n pass",
"def oracle(ct: int) -> bool:\n return rsa.dec(ct) & 1 == 0",
"def isAcute(trpl):\n vd = vectorFormat(trpl)\n if angle_between(*vd) < np.pi/2:\n return True\n else:\n return False",
"def check_pali... | [
"0.58734155",
"0.5778579",
"0.5749819",
"0.5632407",
"0.55852145",
"0.55829185",
"0.5546565",
"0.5520525",
"0.55134135",
"0.5501811",
"0.5460695",
"0.5449854",
"0.54210347",
"0.5412214",
"0.538456",
"0.5383626",
"0.53737104",
"0.5345897",
"0.5311306",
"0.5297979",
"0.5283892"... | 0.67610735 | 0 |
Return the body part of HTML files. | def get_body(html_file_content):
return findall("<body>(.*?)</body>", html_file_content, DOTALL)[0].decode("utf-8") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_body(html_page):\n soup = BeautifulSoup(open(html_page), 'html.parser')\n body = soup.find('body')\n return body",
"def get_body_content(self):\n\n try:\n html_tree = parse_html_string(self.content)\n except:\n return ''\n\n html_root = html_tree.getroo... | [
"0.77461666",
"0.7460988",
"0.7410468",
"0.7252582",
"0.72338134",
"0.69558644",
"0.6863169",
"0.66610724",
"0.66539806",
"0.665275",
"0.6494882",
"0.64808214",
"0.6437959",
"0.6399701",
"0.63638884",
"0.63097113",
"0.6272104",
"0.6268735",
"0.62536013",
"0.62374175",
"0.6231... | 0.7931815 | 0 |
Correct the diagram links into the main content body. | def correct_img_links(body_main_content, schema_name, list_name_image):
for name_image in list_name_image:
body_main_content = body_main_content.replace(
"src=\"" + name_image + "\"",
"src=\"{% static \"schema_viewer/oxygen/" + schema_name + "/" + name_image + "\" %}\""
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix_links():\n pass",
"def append_links(self, lines, lang):\n lines.append(\"verbatim \")\n lines.append(\"section Links\")\n lines.append(\"external http://polcasaglia.blogspot.com Blog\")\n lines.append(\"external http://www.uisp-fe.it/calcio.php UISP\" )\n lines... | [
"0.63308895",
"0.5643925",
"0.55043316",
"0.5476968",
"0.5352855",
"0.5346029",
"0.53028953",
"0.5257914",
"0.5252659",
"0.52249026",
"0.52183926",
"0.519567",
"0.5179021",
"0.5144104",
"0.51285285",
"0.5118393",
"0.50887305",
"0.50714946",
"0.5056446",
"0.50404006",
"0.50282... | 0.5835807 | 1 |
Create the final HTML oxygen files, with the common header, a specific left menu and the main body. | def create_html_file(body_left_menu, body_main_content):
# Get the header fie and get it contents
path_header = path.join(
SITE_ROOT,
'schema_viewer',
'templates',
'schema_viewer',
'oxygen',
'header_oxygen_template.html'
)
file_header = open(path_header, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def common_header_part1(outfile: TextIO, title: str, indexpath: str = \"\") -> None:\n outfile.write(\"<!DOCTYPE HTML>\\n\")\n outfile.write(\"<html lang=\\\"en\\\">\\n\")\n outfile.write(\" <head>\\n\")\n outfile.write(\" <!-- Google tag (gtag.js) -->\\n\")\n outfile.write(\" <script async src=\... | [
"0.61840135",
"0.615706",
"0.6106681",
"0.59005207",
"0.58948696",
"0.5833731",
"0.57632947",
"0.57230896",
"0.57106525",
"0.57040775",
"0.56784046",
"0.5634475",
"0.56243837",
"0.5544781",
"0.5540921",
"0.5534541",
"0.55281717",
"0.55029094",
"0.5502361",
"0.5495124",
"0.549... | 0.7858279 | 0 |
Delete the floating global control on the main content. | def del_global_control(body_main_content):
return sub("<div id=\"global_controls\" (.*?) </div>", "", body_main_content, flags=DOTALL) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DelDiv(self):\n if self.created:\n self.CloseImage()\n command = \"\"\"$('#{}').remove();\"\"\".format(self.wid)\n get_ipython().run_cell_magic('javascript', '', command)\n self.created = False\n self.wid = uuid.uuid4().hex",
"def OnCloseFloatingP... | [
"0.6569426",
"0.6322288",
"0.6220098",
"0.61642945",
"0.6048335",
"0.6038787",
"0.599455",
"0.598732",
"0.5944671",
"0.5929435",
"0.5899441",
"0.5881212",
"0.5822167",
"0.5811097",
"0.5805517",
"0.5760576",
"0.5734409",
"0.57206446",
"0.5712142",
"0.5706464",
"0.5681028",
"... | 0.6487117 | 1 |
filters data that have at least $at_least $x unique values per $per | def filter_x_per_y(df, at_least, x, per):
return df.groupby(per, as_index=False, sort=False).filter(
lambda g: g[x].nunique() >= at_least
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_toofew_toolong(df, min_each_group, max_length):\n df = df[~(df.question.apply(lambda x : len(x)) > max_length)]\n\n counts = df[\"index\"].value_counts()\n idxs = np.array(counts.index)\n \n # index numbers of groups with count >= mineachgroup\n list_idx = [i for i, c in zip(idxs, coun... | [
"0.55409527",
"0.55308944",
"0.55091226",
"0.5428687",
"0.5395138",
"0.53877074",
"0.5354342",
"0.5341396",
"0.52779645",
"0.5227017",
"0.51802427",
"0.51764864",
"0.51556313",
"0.5132215",
"0.51163405",
"0.51158553",
"0.5110208",
"0.510321",
"0.50508755",
"0.5044529",
"0.503... | 0.798085 | 0 |
Receives a DBSReader object and finds out whether it's pointing to Global DBS (no matter whether it's production or the preproduction instance). | def isGlobalDBS(dbs):
try:
url = urlparse(dbs.dbsURL)
if url.hostname.startswith('cmsweb'):
if url.path.startswith('/dbs/prod/global') or url.path.startswith('/dbs/int/global'):
return True
except Exception as ex:
logging.error("Failed to find out whether DBS ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_gisdbase():\n global current_gisdbase\n return current_gisdbase",
"async def casino_is_global(self):\n return await self.db.Settings.Global()",
"def is_on_dbsnp(row):\n is_on_dbsnp = 1\n\n if row[\"dbsnp\"] == \"-\":\n is_on_dbsnp = 0\n\n return is_on_dbsnp",
"def... | [
"0.52581006",
"0.5185863",
"0.51744187",
"0.51528794",
"0.5043897",
"0.50279176",
"0.5004774",
"0.500209",
"0.49769497",
"0.49480417",
"0.49011204",
"0.48366022",
"0.48357213",
"0.48242038",
"0.4815816",
"0.48043567",
"0.47987908",
"0.47840345",
"0.47834823",
"0.47745487",
"0... | 0.7254706 | 0 |
Get data location from dbs | def locationsFromDBS(self, dbs, dataItems):
result = defaultdict(set)
for dataItem in dataItems:
try:
if isDataset(dataItem):
phedexNodeNames = dbs.listDatasetLocation(dataItem)
else:
phedexNodeNames = dbs.listFileBlockL... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_loc(self):\n\t\treturn self.__dbfile",
"def __get_location(self) -> str:\n\t\treturn os.getenv('SQLITE_DRIVER_LOCATION', 'db.sqlite')",
"def get_datasource_of():\n global datasource_of\n\n if not datasource_of:\n datasource_of = stixhelpers.datasource_of()\n \n return datasource_of"... | [
"0.6616532",
"0.6296066",
"0.6252961",
"0.62318724",
"0.6225313",
"0.61788684",
"0.61649096",
"0.61381984",
"0.60394216",
"0.60271424",
"0.59884375",
"0.5912525",
"0.5897254",
"0.5876116",
"0.5872178",
"0.58330953",
"0.582461",
"0.58245146",
"0.5800512",
"0.57918423",
"0.5775... | 0.6312537 | 1 |
Sort items by dbs instances return dict with DBSReader as key & data items as values | def organiseByDbs(self, dataItems):
itemsByDbs = defaultdict(list)
for item in dataItems:
if ACDCBlock.checkBlockName(item['name']):
# if it is acdc block don't update location. location should be
# inserted when block is queued and not supposed to change
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sortdb():\n return sorted(donor_db.items(), key=sumdbkey, reverse=True)",
"def read_db():\n f_result = []\n result = execute_query('select sitename, id from {} order by sitename;'.format(TABLES[0]))\n sites = [(x['sitename'], x['id']) for x in result]\n for sitename, site_id in sites:\n ... | [
"0.6100124",
"0.5767866",
"0.5482177",
"0.5375432",
"0.52297914",
"0.517466",
"0.51589227",
"0.51308376",
"0.5080761",
"0.50783294",
"0.5067629",
"0.5035221",
"0.50315094",
"0.5030121",
"0.50266075",
"0.5023428",
"0.5004768",
"0.50018305",
"0.4949546",
"0.49456415",
"0.494003... | 0.62622225 | 0 |
Hjorth's Complexity and Parameters Hjorth Parameters are indicators of statistical properties initially introduced by Hjorth (1970) to describe the general characteristics of an EEG trace in a few quantitative terms, but which can applied to any time series. The parameters are activity, mobility, and complexity. NeuroK... | def complexity_hjorth(signal):
# Sanity checks
if isinstance(signal, (np.ndarray, pd.DataFrame)) and signal.ndim > 1:
raise ValueError(
"Multidimensional inputs (e.g., matrices or multichannel data) are not supported yet."
)
# Calculate derivatives
dx = np.diff(signal)
d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doParametersOfInterest(self):\n \n self.modelBuilder.doVar('expr::cosW(\"0.87681811112\",)')\n self.modelBuilder.doVar('expr::sinW(\"0.48082221247\",)')\n self.modelBuilder.doVar('expr::mZ(\"91.2\",)')\n self.modelBuilder.doVar('expr::Lambda1(\"100.0\",)')\n self.modelBui... | [
"0.6022703",
"0.57704234",
"0.5730367",
"0.56339955",
"0.5561419",
"0.5557344",
"0.5556481",
"0.5482355",
"0.548171",
"0.548036",
"0.54543763",
"0.5435389",
"0.5425596",
"0.5410607",
"0.5403748",
"0.5390412",
"0.537292",
"0.5371755",
"0.5351225",
"0.53323776",
"0.531349",
"... | 0.71381897 | 0 |
Update the images that are displayed from the video stream. | def update(self):
# Update the vision frames in the system
self._system.update()
# Create blank PIL images to hold the video streams
layered = PIL.Image.new('RGBA', (400, 400))
stacked = PIL.Image.new('RGBA', (200, 800))
control = PIL.Image.new('RGBA', (600, 800... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n print('VIDEO: Video Stream started')\n while True:\n if self.stopped:\n return\n (self.grabbed, self.frame) = self.stream.read()",
"def viewUpdate(self):\n # Update Capture\n imgtk = self.model.capture\n self.updateImage(... | [
"0.67444074",
"0.6730207",
"0.6720518",
"0.67168564",
"0.6591318",
"0.657772",
"0.6577194",
"0.64696455",
"0.6445771",
"0.64267576",
"0.64083344",
"0.6405238",
"0.6402562",
"0.6371376",
"0.6345765",
"0.63317454",
"0.62935567",
"0.62902534",
"0.6285674",
"0.6278713",
"0.626501... | 0.7045872 | 0 |
Update the vision choices when a new device is selected. | def updateDevice(self, *args):
# Update the list of vision choices and the default vision choice
self._appChoice["vision"] = [choice[0] for choice in self._system[self._appString["device"].get()]]
self._appString["vision"].set(self._appChoice["vision"][0])
# Delete the old choice... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateVision(self, *args):\r\n\r\n # Update the list of frame choices and the default frame choice\r\n self._appChoice[\"frame\"] = [choice[0] for choice in self._system[self._appString[\"device\"].get()][self._appString[\"vision\"].get()]]\r\n self._appString[\"frame\"].set(self._appChoic... | [
"0.68089235",
"0.59843624",
"0.5973282",
"0.5937724",
"0.5828414",
"0.58241105",
"0.5739061",
"0.56566024",
"0.56519794",
"0.5624004",
"0.5604147",
"0.5591249",
"0.55712897",
"0.5546274",
"0.5538931",
"0.54759663",
"0.54590356",
"0.54416597",
"0.54367846",
"0.54256344",
"0.54... | 0.82246095 | 0 |
Update the frame choices whena new vision is selected. | def updateVision(self, *args):
# Update the list of frame choices and the default frame choice
self._appChoice["frame"] = [choice[0] for choice in self._system[self._appString["device"].get()][self._appString["vision"].get()]]
self._appString["frame"].set(self._appChoice["frame"][0])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slider_frames_changed(self):\n\n # Again, please note the difference between indexing and GUI displays.\n index = self.slider_frames.value() - 1\n\n # Differentiate between frame ordering (by quality or chronologically).\n if self.frame_ordering == \"quality\":\n self.fra... | [
"0.67221683",
"0.647668",
"0.6142463",
"0.60368323",
"0.6010365",
"0.59839",
"0.594206",
"0.5939723",
"0.5774318",
"0.57701164",
"0.5685508",
"0.56649303",
"0.5623016",
"0.5616354",
"0.5597576",
"0.55696803",
"0.5566506",
"0.5529806",
"0.5504718",
"0.54967684",
"0.5455349",
... | 0.777694 | 0 |
Creates a color palette compatible with Bokeh from a matplotlib cmap name. | def get_bokeh_palette(cmap):
from bokeh.colors import RGB
from matplotlib import cm
# Solution adapted from
# https://stackoverflow.com/questions/31883097/elegant-way-to-match-a-string-to-a-random-color-matplotlib
m_RGB = (255 * plt.get_cmap(cmap)(range(256))).astype("int")
return [RGB(*tuple(r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def palette_from_mpl_name(name):\n if name in CMAPS:\n return CMAPS[name]\n\n rgba = plt.get_cmap(name)(np.linspace(0, 1, 256))\n palette = [to_hex(color) for color in rgba]\n return palette",
"def get_palette(palette_name):\n\n if hasattr(plt.cm, palette_name):\n cmap = getattr(plt.... | [
"0.8101128",
"0.6942909",
"0.6776598",
"0.6741528",
"0.6741528",
"0.66666794",
"0.66659963",
"0.66659963",
"0.66659963",
"0.6503461",
"0.6470813",
"0.6413775",
"0.63696545",
"0.6352337",
"0.631037",
"0.61285675",
"0.61251086",
"0.6121512",
"0.6044165",
"0.60116994",
"0.601053... | 0.6990008 | 1 |
instead of return a cursor object, find_one() returns one document. so when you look up document by it's _id (_id field is always unique), use find_one() method. | def find_one():
fmter.tpl._straightline("one document", 100)
result = users.find_one({})
print(type(result))
ppt(result)
fmter.tpl._straightline("none result", 100)
result = users.find_one({"_id": 100})
print(type(result))
ppt(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_one(self, collection, query):\n obj = getattr(self.db, collection)\n result = obj.find_one(query)\n return result",
"def first(self, **kwargs):\n return self.find(**kwargs).first()",
"def one(self):\n try:\n return self[0]\n except IndexError:\n raise self.d... | [
"0.7754107",
"0.7186727",
"0.7182808",
"0.715503",
"0.69664955",
"0.6931495",
"0.69100857",
"0.6904317",
"0.6898412",
"0.6841113",
"0.68210936",
"0.6808862",
"0.679702",
"0.6777635",
"0.67716956",
"0.6718852",
"0.6685826",
"0.66839063",
"0.66428053",
"0.6642651",
"0.66407835"... | 0.7955518 | 0 |
Fills out the model by invoking C{svnlook} | def _populateModel(self):
self.repoPath = self.argv[1]
self.rev = self.argv[2]
self.model.rev = self.rev
self.model.repo = os.path.split(self.repoPath)[-1]
self.prefix = (self.addRepoPrefix() and ('/' + self.model.repo)) or ''
# First, get the user and log message
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_model(self):\n pass # TODO: Implement this.",
"def build_model():",
"def update_model(self):\n pass",
"def updateModel(self):\n pass",
"def loadAdjustedModel(self):\r\n # Load model in GUI\r\n addModel(self.trcFilePath.replace('.trc','.osim'))",
"def makeMod... | [
"0.5480063",
"0.54420656",
"0.5437654",
"0.53411984",
"0.5257772",
"0.5196333",
"0.51816934",
"0.50881743",
"0.5072814",
"0.50495183",
"0.50386804",
"0.5009755",
"0.499261",
"0.49754384",
"0.49611595",
"0.49506703",
"0.49395007",
"0.4916408",
"0.4916408",
"0.49122566",
"0.491... | 0.69316125 | 0 |
Gera o codigo rml do cabecalho | def cabecalho(dic_cabecalho,dat_ordem,imagem):
tmp=''
tmp+='\t\t\t\t<image x="4.1cm" y="26.9cm" width="74" height="60" file="' + imagem + '"/>\n'
tmp+='\t\t\t\t<lines>3.3cm 26.3cm 19.5cm 26.3cm</lines>\n'
tmp+='\t\t\t\t<setFont name="Helvetica-Bold" size="15"/>\n'
tmp+='\t\t\t\t<drawString x="6.7cm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(self):",
"def mezclar_bolsa(self):",
"def load_ccs9():\n ccs9 = pd.read_csv(pkg_resources.resource_filename(__name__,'$dxref 2015.csv'))\n ccs9 = ccs9.reset_index()\n for col in ccs9.columns:\n ccs9.loc[:,col]=ccs9[col].str.strip('\\'')\n ccs9.columns=ccs9.iloc[0,:]\n ccs9 = ccs9... | [
"0.55839115",
"0.55125",
"0.53216106",
"0.5215636",
"0.5121315",
"0.5116958",
"0.51138484",
"0.5088174",
"0.49747437",
"0.4962377",
"0.49491808",
"0.49370742",
"0.4935785",
"0.4934977",
"0.49025398",
"0.4889983",
"0.48558292",
"0.4849866",
"0.48489085",
"0.48460174",
"0.48455... | 0.55939573 | 0 |
Retreive a file from the file storage. | def storage_get_file(self, group='', key=''):
try:
obj = None
content = None
if key != '':
if self.config['type'] == 's3':
obj = self.s3.Object(bucket_name=self.bucket, key='corr-{0}s/{1}'.format(group,key))
res = obj.ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, filename, **kw):\n\n file_path = os.path.join(self.storage_path, filename)\n try:\n file_obj = open(file_path, \"r\")\n except IOError:\n return\n else:\n return file_obj.read()",
"def get_file(URI):\n return file_fabric.get_class(URI)... | [
"0.78756535",
"0.7461347",
"0.7436858",
"0.7395782",
"0.7368263",
"0.7213877",
"0.72103053",
"0.713844",
"0.7136062",
"0.7094323",
"0.7046528",
"0.70224756",
"0.6999044",
"0.6987379",
"0.6954168",
"0.6929677",
"0.6907303",
"0.6901869",
"0.68689317",
"0.6859872",
"0.6847875",
... | 0.74737984 | 1 |
Agent function that prepares a dictionary for storage in a compressed files. | def agent_prepare(self, zf, group, object_dict):
object_buffer = StringIO()
object_buffer.write(json.dumps(object_dict, sort_keys=True, indent=4, separators=(',', ': ')))
object_buffer.seek(0)
data = zipfile.ZipInfo("{0}.json".format(group))
data.date_time = time.localtime(time.t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _files_from_json(self, file_json):\n self.compressed_file_json = zlib.compress(json.dumps(file_json).encode('utf-8'))\n self.compression_algorithm = 'gzip'\n self.compressed_content_hash = hashlib.sha256(self.compressed_file_json).hexdigest()",
"def file_to_dictionary():\n\n return;",... | [
"0.6145931",
"0.6029067",
"0.5845155",
"0.5629594",
"0.56274456",
"0.5606034",
"0.55619204",
"0.55617094",
"0.55312747",
"0.5409232",
"0.5396165",
"0.5389857",
"0.5363818",
"0.5336105",
"0.5334452",
"0.5315649",
"0.53133637",
"0.53003275",
"0.52949893",
"0.527997",
"0.5277781... | 0.62700593 | 0 |
Delete a project files. | def delete_project_files(self, project, logStat):
from corrdb.common.models import FileModel
from corrdb.common.models import EnvironmentModel
for _file in project.resources:
file_ = FileModel.objects.with_id(_file)
if file_:
result = self.storage_delete_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_project(proj_id):\n project_obj = Project.objects.get(id=proj_id)\n print('Deleting project the fastq files within the project: ', project_obj.description)\n\n description = project_obj.description.replace(' ', '') # remove any space in the project name\n project_dir = 'documents/%s/%s' % (... | [
"0.7671678",
"0.70789576",
"0.69476116",
"0.67798454",
"0.66957814",
"0.6679533",
"0.6669261",
"0.663331",
"0.6531018",
"0.6503622",
"0.6503622",
"0.64738876",
"0.6457917",
"0.64377785",
"0.6412456",
"0.6380504",
"0.6365763",
"0.63568527",
"0.635452",
"0.6349144",
"0.634238",... | 0.74385405 | 1 |
Delete a record files. | def delete_record_files(self, record, logStat):
from corrdb.common.models import FileModel
final_result = True
for _file_id in record.resources:
_file = FileModel.objects.with_id(_file_id)
result = self.delete_record_file(_file, logStat)
if not result:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_records(self, records_to_delete):\n for record in records_to_delete:\n self.records.remove(record)\n self._store_writer.remove_img_file(record)\n\n self._process_change()",
"def delete_record(records):\n delete_record()",
"def delete(self, filename):\n p... | [
"0.75914454",
"0.7471837",
"0.73076427",
"0.7286397",
"0.6935407",
"0.68690795",
"0.67846966",
"0.6765541",
"0.6712611",
"0.6703749",
"0.66534185",
"0.6648763",
"0.6578517",
"0.656606",
"0.6554084",
"0.65478927",
"0.6511074",
"0.64954126",
"0.6470087",
"0.6469611",
"0.6414448... | 0.77628917 | 0 |
Delete a record file and log the stats. | def delete_record_file(self, record_file, logStat):
result = self.storage_delete_file(record_file.group, record_file.storage)
if result:
logStat(deleted=True, file_obj=record_file)
record_file.delete()
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_file(fileName):\n os.remove(fileName)\n print (\"Deleteing file: \" + str(fileName))\n write_log()\n read_log()",
"def delete(self, filename):\n pass",
"def delete_log():\n log_path = Path.cwd() / \"premise.log\"\n if log_path.exists():\n log_path.unli... | [
"0.6743752",
"0.6579642",
"0.65737575",
"0.6460211",
"0.64425284",
"0.6401115",
"0.6390069",
"0.63400424",
"0.63385975",
"0.6327259",
"0.6298369",
"0.6264551",
"0.6233331",
"0.6219438",
"0.620855",
"0.6170005",
"0.61598647",
"0.61536807",
"0.61153316",
"0.6106858",
"0.6105311... | 0.81148934 | 0 |
Retrieve a externaly hosted file. | def web_get_file(self, url):
try:
print(url)
response = requests.get(url, verify=False)
file_buffer = BytesIO(response.content)
file_buffer.seek(0)
return file_buffer
except:
print(traceback.print_exc())
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file(self, sys_id):\n url = \"{}/file\".format(self._target(sys_id))\n r = self._client.session.get(url, stream=True)\n return r",
"def get_file(URI):\n return file_fabric.get_class(URI).get_content(URI)",
"def _fs_get_file(url, working_dir):\n if not os.path.isabs(url) a... | [
"0.7363333",
"0.71599615",
"0.7076054",
"0.70494545",
"0.70425373",
"0.6997317",
"0.69079727",
"0.68707514",
"0.68504196",
"0.67665625",
"0.6739661",
"0.6723161",
"0.6715714",
"0.6701585",
"0.6683252",
"0.6590083",
"0.6564484",
"0.65569955",
"0.65451306",
"0.65384126",
"0.648... | 0.7258937 | 1 |
Bundle a project's environment. | def prepare_env(self, project=None, env=None):
if project == None or env == None:
return [None, '']
else:
memory_file = BytesIO()
with zipfile.ZipFile(memory_file, 'w') as zf:
if env.bundle != None and env.bundle.storage != '':
try:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env(config, args):\n print config.template(\"scripts/env.sh\", project=args.project)",
"def venv(session):\n # Install dependencies.\n session.install(\"--upgrade\", \"pip\", \"setuptools\")\n session.install(\"-r\", \"requirements-dev.txt\")\n session.install(\"-e\", \".\")\n\n # Customize... | [
"0.6130687",
"0.598805",
"0.5796788",
"0.57524836",
"0.5727751",
"0.572663",
"0.57033294",
"0.564921",
"0.5631391",
"0.56252474",
"0.560973",
"0.55973923",
"0.5581485",
"0.55788237",
"0.55742204",
"0.556539",
"0.55550957",
"0.5539426",
"0.5535784",
"0.55265415",
"0.5499274",
... | 0.60943496 | 1 |
Obtain ORI, AGENCY, CGOVTYPE, FIPS_STATE, FIPS_PLACE from final main(9001) file | def get_final_main_cgovtype_ori_agency(file_path):
final_main_df = pd.read_csv(file_path)
final_main_fips_ori_agency = final_main_df[['ORI', 'AGENCY', 'CGOVTYPE', 'FIPS_STATE', 'FIPS_PLACE']]
"""
1. Obtain only unique records from the final main file - key: fips place + fips state
"""
final_mai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ogip_dictionary_arf():\n \"\"\"\n this function returns the required and optional keywords and columns\n as defined by OGIP 92-002 and 92-002a\n \"\"\"\n global status\n global REPORT\n\n \"\"\"\n FOR the ARF file:\n \"\"\"\n \"\"\"\n Define REQUIRED Keywords for SPECRESP EXTE... | [
"0.60176206",
"0.56555265",
"0.5474328",
"0.5407819",
"0.5401295",
"0.5373873",
"0.5334079",
"0.5289622",
"0.52885354",
"0.5262731",
"0.5220959",
"0.5170142",
"0.51691955",
"0.5163392",
"0.5162932",
"0.5147522",
"0.5127302",
"0.5127064",
"0.51110655",
"0.5105965",
"0.5087524"... | 0.5832184 | 1 |
Merge CGOVTYPE, ORI, AGENCY from final main file into census files based on state and place fips. | def get_glevel_ori_agency(county_cens_file, crime_df, filename, cens_year, city_cens_file=False):
"""
1. Append cities census file to counties census file
"""
national_census_df = pd.read_csv(county_cens_file)
"""
Checking for city census file coz we need to first append city census file t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_final_main_cgovtype_ori_agency(file_path):\n final_main_df = pd.read_csv(file_path)\n final_main_fips_ori_agency = final_main_df[['ORI', 'AGENCY', 'CGOVTYPE', 'FIPS_STATE', 'FIPS_PLACE']]\n\n \"\"\"\n 1. Obtain only unique records from the final main file - key: fips place + fips state\n \"\... | [
"0.63951296",
"0.5647709",
"0.5632972",
"0.5529909",
"0.5512112",
"0.5358087",
"0.53524876",
"0.534505",
"0.53141177",
"0.53104985",
"0.5308745",
"0.52762294",
"0.5263449",
"0.5253142",
"0.52261686",
"0.522328",
"0.51910317",
"0.51679087",
"0.5163909",
"0.5161484",
"0.5154538... | 0.629315 | 1 |
Return a dictionary of a location's properties. | def to_dict(self):
return {
'location_id': self.location_id,
'location_name': self.location_name
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_properties():",
"def get_locations():\n return STATUS['locations']",
"def _get_location_details(self, location):\n resp = requests.get(\n self.base_url,\n params = {\n 'address': ''.join(location.split(' ')),\n 'key': GOOGLE_API_KEY,\n ... | [
"0.66905564",
"0.6581534",
"0.65401554",
"0.65313935",
"0.65221065",
"0.650296",
"0.6466247",
"0.6466247",
"0.6427804",
"0.6427804",
"0.6396865",
"0.6388714",
"0.637269",
"0.63603663",
"0.6325594",
"0.631466",
"0.62228143",
"0.62096256",
"0.6171209",
"0.6171209",
"0.6163851",... | 0.7027157 | 0 |
Method used to sort the objects from low > highest of the currenthealth | def sort_currenthealth(cls):
CloudCtx.objCloudCtx.sort(key=lambda x: x.currenthealth)
for elem in CloudCtx.objCloudCtx:
print(elem.display_cloud_ctx()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sort(self):\n self.population.sort()\n self.population.reverse()",
"def order_by_fitness(self):\n self.fauna_list['Herbivore'].sort(key=operator.\n attrgetter('animal_fitness'))\n self.fauna_list['Carnivore'].sort(key=operator.\n ... | [
"0.6516192",
"0.62642473",
"0.61162984",
"0.60903406",
"0.60502887",
"0.6042862",
"0.6019754",
"0.60002744",
"0.60002744",
"0.59838814",
"0.591684",
"0.59040284",
"0.5897962",
"0.5884195",
"0.5877887",
"0.58615667",
"0.5833206",
"0.5787725",
"0.57582235",
"0.57577944",
"0.575... | 0.6984742 | 0 |
Sequence init with other seq should preserve name and info. | def test_init_other_seq(self):
r = self.RNA("UCAGG", name="x", info={"z": 3})
s = Sequence(r)
self.assertEqual(s._seq, "UCAGG")
self.assertEqual(s.name, "x")
self.assertEqual(s.info.z, 3) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, name, seq):",
"def __init__(self, name, sequence, description=None, seq_type=None):\n self.name = name\n self.description = description\n self.seq_type = seq_type\n self._sequence = sequence",
"def __init__(self, seq_name, seed=0, hashable=False):\n self.__... | [
"0.73695916",
"0.64641666",
"0.6406861",
"0.63860846",
"0.6326368",
"0.6289234",
"0.62387466",
"0.62214434",
"0.61863655",
"0.6182251",
"0.6173626",
"0.608901",
"0.6055515",
"0.6053556",
"0.60087323",
"0.59916127",
"0.5978379",
"0.5969416",
"0.59500825",
"0.59398437",
"0.5890... | 0.7811066 | 0 |
Sequence to_fasta() should return Fastaformat string | def test_to_fasta(self):
even = "TCAGAT"
odd = even + "AAA"
even_dna = self.SEQ(even, name="even")
odd_dna = self.SEQ(odd, name="odd")
self.assertEqual(even_dna.to_fasta(), ">even\nTCAGAT\n")
# set line wrap to small number so we can test that it works
self.assert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_to_fasta(self):\n even = \"TCAGAT\"\n odd = even + \"AAA\"\n even_dna = self.SequenceClass(even, name=\"even\")\n odd_dna = self.SequenceClass(odd, name=\"odd\")\n self.assertEqual(even_dna.to_fasta(), \">even\\nTCAGAT\\n\")\n # set line wrap to small number so we... | [
"0.74931866",
"0.7302847",
"0.70808065",
"0.6741352",
"0.67153966",
"0.67040503",
"0.6695643",
"0.66434294",
"0.66212684",
"0.6602914",
"0.6531266",
"0.65176135",
"0.65008026",
"0.6492443",
"0.648414",
"0.64614666",
"0.638201",
"0.6333177",
"0.6327045",
"0.62993723",
"0.62658... | 0.74317557 | 1 |
correctly annotates a Sequence from a gff file | def test_annotate_from_gff(self):
from cogent3.parse.fasta import FastaParser
fasta_path = os.path.join("data/c_elegans_WS199_dna_shortened.fasta")
gff3_path = os.path.join("data/c_elegans_WS199_shortened_gff.gff3")
name, seq = next(FastaParser(fasta_path))
sequence = Sequence(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gff2FA(annotation, sequence, windows, output):\n df_gff = pd.read_csv(annotation, index_col=False, sep='\\t', header=None, comment=\"#\")\n df_gff.columns = ['seqname', 'source', 'feature', 'start', 'end', 'score', 'strand', 'frame', 'attribute']\n fasta_seq = SeqIO.parse(sequence, 'fasta')\n buffe... | [
"0.68458533",
"0.6741979",
"0.64248884",
"0.6258323",
"0.62455755",
"0.61349237",
"0.6114975",
"0.6035717",
"0.6020976",
"0.5951338",
"0.5917856",
"0.5893167",
"0.5850203",
"0.58161116",
"0.58051586",
"0.5799951",
"0.5758082",
"0.57514256",
"0.57467973",
"0.57466453",
"0.5679... | 0.6810655 | 1 |
Sequence strip_degenerate should remove any degenerate bases | def test_strip_degenerate(self):
self.assertEqual(self.RNA("UCAG-").strip_degenerate(), "UCAG-")
self.assertEqual(self.RNA("NRYSW").strip_degenerate(), "")
self.assertEqual(self.RNA("USNG").strip_degenerate(), "UG") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleaning_ambiguous_bases(seq):\n # compile the regex with all ambiguous bases\n pat = re.compile(r'[NRYWXSKM]')\n # look for the ambiguous bases and replace by\n # nothing\n return re.sub(pat, '', seq)",
"def degenerate2(s):\n from lasagna.utils import base_repr\n\n n = s.count('N')\... | [
"0.670461",
"0.6552507",
"0.5997409",
"0.5994004",
"0.59098065",
"0.58974713",
"0.5855396",
"0.58462846",
"0.5815244",
"0.5701709",
"0.56765515",
"0.5675322",
"0.5673388",
"0.5557388",
"0.55281866",
"0.55277646",
"0.55103743",
"0.5502395",
"0.548646",
"0.5485527",
"0.53843564... | 0.7007799 | 0 |
Sequence strip_bad should remove any nonbase, nongap chars | def test_strip_bad(self):
# have to turn off check to get bad data in; no longer preserves case
self.assertEqual(
self.RNA("UCxxxAGwsnyrHBNzzzD-D", check=False).strip_bad(),
"UCAGWSNYRHBND-D",
)
self.assertEqual(self.RNA("@#^*($@!#&()!@QZX", check=False).strip_bad... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_other_charcter():\n pass",
"def test_strip_bad(self):\n # have to turn off check to get bad data in; no longer preserves case\n r = self.RNA(\"UCAGRYU\")\n r._data[0] = 31\n r._data[2] = 55\n self.assertEqual(r.strip_bad(), \"CGRYU\")",
"def _strip_invalid_xml(s)... | [
"0.715122",
"0.70498705",
"0.69027036",
"0.69027036",
"0.68354553",
"0.67104006",
"0.66530055",
"0.65649366",
"0.65649366",
"0.65639234",
"0.65602666",
"0.653047",
"0.65097004",
"0.6500392",
"0.64983284",
"0.6485774",
"0.64769524",
"0.6473822",
"0.6450652",
"0.6406869",
"0.64... | 0.7429765 | 0 |
Sequence strip_bad_and_gaps should remove gaps and bad chars | def test_strip_bad_and_gaps(self):
# have to turn off check to get bad data in; no longer preserves case
self.assertEqual(
self.RNA("UxxCAGwsnyrHBNz#!D-D", check=False).strip_bad_and_gaps(),
"UCAGWSNYRHBNDD",
)
self.assertEqual(
self.RNA("@#^*($@!#&()!... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_strip_bad_and_gaps(self):\n # have to turn off check to get bad data in; no longer preserves case\n r = self.RNA(\"ACG--GRN?\")\n self.assertEqual(r.strip_bad_and_gaps(), \"ACGGRN\")\n r._data[0] = 99\n self.assertEqual(r.strip_bad_and_gaps(), \"CGGRN\")",
"def ungappe... | [
"0.7566995",
"0.6872599",
"0.686638",
"0.6582646",
"0.6464975",
"0.6438769",
"0.63625026",
"0.6273571",
"0.6273571",
"0.6253653",
"0.6191777",
"0.6101316",
"0.60952926",
"0.6083035",
"0.602748",
"0.60102254",
"0.59808695",
"0.5978832",
"0.5978832",
"0.59764034",
"0.59651965",... | 0.76906425 | 0 |
Sequence shuffle should return new random sequence w/ same monomers | def test_shuffle(self):
r = self.RNA("UUUUCCCCAAAAGGGG")
s = r.shuffle()
self.assertNotEqual(r, s)
self.assertEqualItems(r, s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_shuffle(self):\n random.shuffle(self.seq)\n self.seq.sort()\n self.assertEqual(self.seq, range(10))",
"def shuffle(self):\n for i in xrange(self.n - 1):\n pos = random.randint(i, self.n - 1)\n self.to[i], self.to[pos] = self.to[pos], self.to[i]\n ... | [
"0.74236465",
"0.70922947",
"0.70799804",
"0.7030679",
"0.6991424",
"0.6946981",
"0.68759125",
"0.68759125",
"0.681591",
"0.6815623",
"0.6789187",
"0.67795455",
"0.67775214",
"0.6772275",
"0.67656815",
"0.67480785",
"0.6738267",
"0.6738267",
"0.6738267",
"0.6738267",
"0.67382... | 0.7527803 | 0 |
Sequence is_gap should return True if char is a valid gap char | def test_is_gap(self):
r = self.RNA("ACGUCAGUACGUCAGNRCGAUcaguaguacYRNRYRN")
for char in "qwertyuiopasdfghjklzxcvbnmQWERTYUIOASDFGHJKLZXCVBNM":
assert not r.is_gap(char)
assert r.is_gap("-")
# only works on a single literal that's a gap, not on a sequence.
# possibly,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_gaps(s, gapcode=45):\r\n return nonzero(fromstring(s, dtype=uint8) == gapcode)",
"def find_gaps(s, gapcode=45):\n return nonzero(fromstring(s,dtype=uint8) == gapcode)",
"def checkForNOrGap(character):\n if character == \"-\" or character == \"N\":\n return False\n else:\n ret... | [
"0.72288585",
"0.7180023",
"0.7167158",
"0.7167158",
"0.68990767",
"0.68299943",
"0.65973693",
"0.6557601",
"0.64990675",
"0.64894366",
"0.63977575",
"0.6362843",
"0.6229104",
"0.61301273",
"0.60077465",
"0.5992771",
"0.5968189",
"0.59411037",
"0.593851",
"0.5772497",
"0.5726... | 0.8379988 | 0 |
Sequence is_degenerate should return True if degen symbol in seq | def test_is_degenerate(self):
assert not self.RNA("").is_degenerate()
assert not self.RNA("UACGCUACAUGuacgucaguGCUAGCUA---ACGUCAG").is_degenerate()
assert self.RNA("N").is_degenerate()
assert self.RNA("R").is_degenerate()
assert self.RNA("y").is_degenerate()
assert self.R... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_consistent_gap_degen_handling(self):\n # the degen character '?' can be a gap, so when we strip either gaps or\n # degen characters it should be gone too\n raw_seq = \"---??-??TC-GGCG-GCA-G-GC-?-C-TAN-GCGC-CCTC-AGGA?-???-??--\"\n raw_ungapped = re.sub(\"[-?]\", \"\", raw_seq)\n... | [
"0.6201668",
"0.6091381",
"0.6069485",
"0.59473264",
"0.59035546",
"0.5826139",
"0.57964295",
"0.5788602",
"0.57822496",
"0.57488996",
"0.5700209",
"0.56820357",
"0.5671976",
"0.56627655",
"0.5661535",
"0.56607664",
"0.56530017",
"0.563402",
"0.5610719",
"0.5593537",
"0.55397... | 0.7355169 | 0 |
Sequence is_strict should return True if all symbols in Monomers | def test_is_strict(self):
assert self.RNA("").is_strict()
assert self.PROT("A").is_strict()
assert self.RNA("UAGCACUgcaugcauGCAUGACuacguACAUG").is_strict()
assert not self.RNA("CAGUCGAUCA-cgaucagUCGAUGAC").is_strict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_atomic(self):\n \n symbols=set()\n for e in self.symbols:\n if not e=='':\n symbols.add(e)\n\n for s in symbols: #unicity first\n count=0\n for e in symbols:\n if s==e:\n count+=1\n if c... | [
"0.59880435",
"0.5868502",
"0.57117075",
"0.5693459",
"0.56859756",
"0.5625319",
"0.55478084",
"0.5500837",
"0.5423727",
"0.5399986",
"0.5368656",
"0.53295964",
"0.53133947",
"0.52879006",
"0.5250921",
"0.5220573",
"0.5218399",
"0.5208652",
"0.5200181",
"0.5194953",
"0.517377... | 0.7072339 | 0 |
Sequence first_gap should return index of first gap symbol, or None | def test_first_gap(self):
self.assertEqual(self.RNA("").first_gap(), None)
self.assertEqual(self.RNA("a").first_gap(), None)
self.assertEqual(self.RNA("uhacucHuhacUUhacan").first_gap(), None)
self.assertEqual(self.RNA("-abc").first_gap(), 0)
self.assertEqual(self.RNA("b-ac").firs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first(seq):\n return next(iter(seq))",
"def _substitute_opening_gap_char(seq):\n newseq=list(seq)\n iterator=rex.finditer(seq)\n for match in iterator:\n try:\n newseq[match.span()[1]-1]=\"|\"\n except:\n continue\n return \"\".join(newseq)",
"def test_is_... | [
"0.62938017",
"0.5901865",
"0.58401036",
"0.5820655",
"0.58202505",
"0.58202505",
"0.5801659",
"0.5738459",
"0.57372636",
"0.5688006",
"0.5682002",
"0.5681534",
"0.56456417",
"0.5599555",
"0.5591629",
"0.5551406",
"0.552724",
"0.5501178",
"0.5490658",
"0.545651",
"0.54537",
... | 0.75103754 | 0 |
Sequence first_degenerate should return index of first degen symbol | def test_first_degenerate(self):
self.assertEqual(self.RNA("").first_degenerate(), None)
self.assertEqual(self.RNA("a").first_degenerate(), None)
self.assertEqual(self.RNA("UCGACA--CU-gacucaguacgua").first_degenerate(), None)
self.assertEqual(self.RNA("nCAGU").first_degenerate(), 0)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def firstNotRepeatingCharacter(s):\n\n # even positions = number of characters\n # odd positions = last occurrence of that character\n scounter = [0] * 52\n\n for i in range(len(s)):\n char_pos = (ord(s[i]) - 97) * 2\n scounter[char_pos] += 1\n scounter[char_pos + 1] = i\n\n las... | [
"0.629569",
"0.61979645",
"0.61258584",
"0.5994529",
"0.59364647",
"0.59274447",
"0.5868857",
"0.5833778",
"0.57321924",
"0.56907326",
"0.567017",
"0.5665031",
"0.5656412",
"0.56558704",
"0.56542057",
"0.5627427",
"0.5622604",
"0.56069934",
"0.5604781",
"0.5595544",
"0.558563... | 0.67240775 | 0 |
Sequence first_non_strict should return index of first nonstrict symbol | def test_first_non_strict(self):
self.assertEqual(self.RNA("").first_non_strict(), None)
self.assertEqual(self.RNA("A").first_non_strict(), None)
self.assertEqual(self.RNA("ACGUACGUcgaucagu").first_non_strict(), None)
self.assertEqual(self.RNA("N").first_non_strict(), 0)
self.ass... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first(word):\n\treturn word[0]",
"def _find_index(string):\n if string[0] == 'X':\n return 0\n elif string == 'D':\n return 1\n else:\n return np.where(sym == string)[0][0]",
"def first(seq):\n return next(iter(seq))",
"def test_strings_first_symbol():\n\n first_resul... | [
"0.6179377",
"0.61144847",
"0.60682476",
"0.6048123",
"0.60406363",
"0.5949297",
"0.5831545",
"0.58217716",
"0.5802844",
"0.57483494",
"0.57339954",
"0.57324356",
"0.5702078",
"0.56688476",
"0.5591062",
"0.5555485",
"0.55398554",
"0.5539652",
"0.55382264",
"0.5532169",
"0.552... | 0.7133279 | 0 |
Sequence disambiguate should remove degenerate bases | def test_disambiguate(self):
self.assertEqual(self.RNA("").disambiguate(), "")
self.assertEqual(
self.RNA("AGCUGAUGUA--CAGU").disambiguate(), "AGCUGAUGUA--CAGU"
)
self.assertEqual(
self.RNA("AUn-yrs-wkmCGwmrNMWRKY").disambiguate("strip"), "AU--CG"
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleaning_ambiguous_bases(seq):\n # compile the regex with all ambiguous bases\n pat = re.compile(r'[NRYWXSKM]')\n # look for the ambiguous bases and replace by\n # nothing\n return re.sub(pat, '', seq)",
"def back_translate(self):\n base = Bio.Alphabet._get_base_alphabet(self.alphabet)\... | [
"0.7825706",
"0.632825",
"0.62402546",
"0.5868822",
"0.58633727",
"0.5861185",
"0.58539385",
"0.5849037",
"0.57864356",
"0.5770885",
"0.569351",
"0.5685995",
"0.55985564",
"0.5540336",
"0.55358434",
"0.5530427",
"0.5522565",
"0.5515272",
"0.55127937",
"0.5512095",
"0.55023056... | 0.67777115 | 1 |
Sequence gap_indices should return correct gap positions | def test_gap_indices(self):
self.assertEqual(self.RNA("").gap_indices(), [])
self.assertEqual(self.RNA("ACUGUCAGUACGHSDKCUCDNNS").gap_indices(), [])
self.assertEqual(self.RNA("GUACGUACAKDC-SDHDSK").gap_indices(), [12])
self.assertEqual(self.RNA("-DSHUHDS").gap_indices(), [0])
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_gap_indices(self):\n r = self.RNA(\"-?A-?NRY-\")\n v = r.gap_indices()\n self.assertEqual(v, array([0, 1, 3, 4, 8]))\n r = self.RNA(\"AC\")\n v = r.gap_indices()\n self.assertEqual(v, array([])) # note: always returns array\n r = self.RNA(\"-?\")\n ... | [
"0.6974337",
"0.6601554",
"0.64816505",
"0.63461",
"0.6027567",
"0.5972312",
"0.5915429",
"0.586718",
"0.58583003",
"0.58261764",
"0.5799375",
"0.5784183",
"0.57565933",
"0.57559055",
"0.57435954",
"0.57185775",
"0.5682374",
"0.56467414",
"0.56163996",
"0.5611873",
"0.561138"... | 0.74248666 | 0 |
Sequence gap_vector should return correct gap positions | def test_gap_vector(self):
def g(x):
return self.RNA(x).gap_vector()
self.assertEqual(g(""), [])
self.assertEqual(g("ACUGUCAGUACGHCSDKCCUCCDNCNS"), [False] * 27)
self.assertEqual(
g("GUACGUAACAKADC-SDAHADSAK"),
list(map(bool, list(map(int, "000000000... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaps(self):\n return self.gaps_L + self.gaps_R",
"def get_gaps( rows ):\n\n n = len(rows) - 1\n gaps = [ rows[i+1][0]-rows[i][1] for i in range(n) ]\n return gaps",
"def pos_gaps(df, gaps):\n nb_rows, nb_cols = df.shape\n\n value_counts = df.apply(pd.Series.value_counts, axis=0)#.max(axis... | [
"0.69004416",
"0.6682347",
"0.6234445",
"0.61394644",
"0.6135273",
"0.6029227",
"0.5996346",
"0.596874",
"0.59524286",
"0.58817637",
"0.5849354",
"0.58274347",
"0.5820121",
"0.5768506",
"0.57642204",
"0.5745565",
"0.5728751",
"0.5723446",
"0.5646391",
"0.56260604",
"0.5612469... | 0.71960086 | 0 |
Sequence gap_maps should return dicts mapping gapped/ungapped pos | def test_gap_maps(self):
empty = ""
no_gaps = "aaa"
all_gaps = "---"
start_gaps = "--abc"
end_gaps = "ab---"
mid_gaps = "--a--b-cd---"
def gm(x):
return self.RNA(x).gap_maps()
self.assertEqual(gm(empty), ({}, {}))
self.assertEqual(gm(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_labeled_sequence_gaps(source_seq, test_seq):\n slot_vals = {} \n tmp_gap = []\n prev_word_pos = 0 # the temp value used as a key for the gaps\n pos_in_seq = 0 # position of source_seq of test_seq's current match\n for i, el in enumerate(test_seq):\n if (len(source_seq)-pos_in_s... | [
"0.69372344",
"0.6512925",
"0.6227912",
"0.61309123",
"0.6124416",
"0.5984851",
"0.5867605",
"0.58508515",
"0.58421373",
"0.5823585",
"0.5815825",
"0.5779069",
"0.5761891",
"0.57431996",
"0.5677936",
"0.56523556",
"0.565037",
"0.5649766",
"0.5629222",
"0.5621352",
"0.56200445... | 0.7045853 | 0 |
Sequence count_degenerate should return correct degen base count | def test_count_degenerate(self):
self.assertEqual(self.RNA("").count_degenerate(), 0)
self.assertEqual(self.RNA("GACUGCAUGCAUCGUACGUCAGUACCGA").count_degenerate(), 0)
self.assertEqual(self.RNA("N").count_degenerate(), 1)
self.assertEqual(self.PROT("N").count_degenerate(), 0)
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(seq):\n\treturn sum(1 for x in seq)",
"def count():",
"def n_neg(seq):\n\n # Convert to all upper case\n seq = seq.upper()\n\n # Check the valiality of sequence\n for aa in seq:\n if aa not in bioinfo_dicts.aa.keys():\n raise RuntimeError(aa + ' is not a valid amino acid... | [
"0.6848711",
"0.6295464",
"0.6287779",
"0.6244194",
"0.61932415",
"0.6169714",
"0.61309725",
"0.60558563",
"0.6046519",
"0.60183054",
"0.5953899",
"0.5946832",
"0.59274083",
"0.59274083",
"0.59274083",
"0.59274083",
"0.59089196",
"0.58695394",
"0.58592194",
"0.5851811",
"0.58... | 0.7551653 | 0 |
Sequence can_mispair should return True on any possible mispair | def test_can_mispair(self):
assert not self.RNA("").can_mispair("")
assert self.RNA("N").can_mispair("N")
assert self.RNA("R").can_mispair("Y")
assert self.RNA("N").can_mispair("r")
assert self.RNA("CGUACGCAN").can_mispair("NUHCHUACH")
assert self.RNA("U").can_mispair("C"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_mi():\n pass",
"def ok_mm_primer(primer_seq, all_primer_seqs, primer_mm):\r\n for curr_pat in all_primer_seqs:\r\n if count_mismatches(primer_seq, curr_pat, primer_mm) <= primer_mm:\r\n return True\r\n return False",
"def check_sat(m):\n conflict = False\n matrix = np.a... | [
"0.5894247",
"0.55321866",
"0.5423738",
"0.532274",
"0.52513564",
"0.5211209",
"0.5125752",
"0.50944513",
"0.5094062",
"0.50700766",
"0.50617254",
"0.5061186",
"0.5042807",
"0.5036132",
"0.5035601",
"0.50216484",
"0.50123334",
"0.50002867",
"0.49906853",
"0.4979314",
"0.49767... | 0.7014911 | 0 |
Sequence must_pair should return True when no possible mispairs | def test_must_pair(self):
assert self.RNA("").must_pair("")
assert not self.RNA("N").must_pair("N")
assert not self.RNA("R").must_pair("Y")
assert not self.RNA("A").must_pair("A")
assert not self.RNA("CGUACGCAN").must_pair("NUGCGUACG")
assert not self.RNA("U").must_pair("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def requires_pairing(cls) -> bool:\n return False",
"def test_can_pair(self):\n assert self.RNA(\"\").can_pair(\"\")\n assert not self.RNA(\"UCAG\").can_pair(\"UCAG\")\n assert self.RNA(\"UCAG\").can_pair(\"CUGA\")\n assert not self.RNA(\"UCAG\").can_pair(\"cuga\")\n assert ... | [
"0.7317017",
"0.6751099",
"0.66120136",
"0.64646906",
"0.6463766",
"0.6461888",
"0.63059074",
"0.63053954",
"0.6272074",
"0.6253735",
"0.6220704",
"0.61994374",
"0.6165336",
"0.60740834",
"0.6050706",
"0.60397875",
"0.59866846",
"0.5950847",
"0.5943008",
"0.59143764",
"0.5884... | 0.6926781 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.