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
Test case for authorize_pending_payment
def test_authorize_pending_payment(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deny_pending_payment(self):\n pass", "def test_cancel_pending_payment(self):\n pass", "def awaiting_payment(self):", "def test_create_pending_payment(self):\n order = self.order\n data = {\n 'method' : 'paypal-rest-single',\n 'order_id' : order.pk,\n...
[ "0.81705415", "0.7718226", "0.7217066", "0.7139483", "0.68968856", "0.6597906", "0.6480025", "0.6429397", "0.6316805", "0.61451566", "0.61109495", "0.60853845", "0.60402066", "0.6037417", "0.60363173", "0.6017596", "0.60175025", "0.6005774", "0.5995334", "0.5995219", "0.59885...
0.93050486
0
Test case for cancel_pending_payment
def test_cancel_pending_payment(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deny_pending_payment(self):\n pass", "def test_authorize_pending_payment(self):\n pass", "def test_request_cancel_already_pending_cancel(self):\n self.braintree_customer.subscription_id = \"1234\"\n self.braintree_customer.pending_cancel = True\n self.braintree_custo...
[ "0.7769274", "0.76694417", "0.7395697", "0.7190866", "0.71857595", "0.7133329", "0.7114214", "0.7076206", "0.70306045", "0.7018952", "0.6977227", "0.69654834", "0.69128585", "0.6894958", "0.6793777", "0.67265534", "0.67158717", "0.6665605", "0.65893525", "0.6562316", "0.65401...
0.9436064
0
Test case for deny_pending_payment
def test_deny_pending_payment(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authorize_pending_payment(self):\n pass", "def test_cancel_pending_payment(self):\n pass", "def test_process_postpay_not_accepted(self):\r\n student1 = UserFactory()\r\n student1.save()\r\n\r\n order1 = Order.get_cart_for_user(student1)\r\n params = {\r\n ...
[ "0.8342903", "0.82414275", "0.73249424", "0.73036164", "0.7185017", "0.714316", "0.69241816", "0.66919315", "0.66871744", "0.6520823", "0.6518757", "0.65028626", "0.6480051", "0.6465115", "0.6448647", "0.640321", "0.6376857", "0.6356016", "0.63355106", "0.63011634", "0.627783...
0.93512565
0
Autocomplete the tensors linked to `self.root` with suitable initial value.
def autocomplete(self, n_bond_dict, max_entangled=False): for t in self.root.visitor(leaf=False): if t.array is None: axis = t.axis if max_entangled and not any(t.children(leaf=False)): if len(list(t.children(leaf=True))) != 2 or axis is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.root = None\n self.k = None", "def __init__(self):\n self.root = None\n self.k = None", "def defaultize(self):\n if self.root is None:\n genome.initialize(self)\n self.root.defaultize()", "def reset_tree(self):\n self.root...
[ "0.57327425", "0.57327425", "0.5723352", "0.56162256", "0.5539573", "0.5387556", "0.5384663", "0.52856284", "0.5270767", "0.5199456", "0.5186978", "0.5180261", "0.5167288", "0.5167288", "0.5138794", "0.5138794", "0.51006377", "0.50823957", "0.5077841", "0.5076818", "0.5075629...
0.58406657
0
Return the expection value with the state of the network which `self.root` in. Sum over `self.h_list`.
def expection(self, normalized=False, op=None): ans = 0.0 for _ in self.term_visitor(op=op): ans += self.root.expection() if normalized: ans /= self.root.global_square() return ans
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __error(self,node_set):\n error=0\n for n in node_set:\n if(n.seq_num!=0):\n error+=LA.norm(n.node_vol-node_set[n.neighbor.parent].node_vol-n.impedance*n.branch_cur)\n #print n.node_vol, '\\n', node_set[n.neighbor.parent].node_vol\n \n ...
[ "0.5438204", "0.53954154", "0.53570884", "0.5268109", "0.5242569", "0.52030486", "0.5143973", "0.5141706", "0.5140548", "0.5140056", "0.5139341", "0.5118344", "0.51050544", "0.51041", "0.5067736", "0.5060087", "0.5055472", "0.5040935", "0.5011476", "0.5004999", "0.500003", ...
0.54961354
0
Fetch the version information for each of the packages. Also remove EPVs with CVEs and ones not present in Graph
def get_version_information(input_list, ecosystem): str_query = "data=[]; " for package in input_list: str_query += "pkg = g.V().has('ecosystem', '{eco}').has('name', '{pkg}'); " \ "lnv = []; pkg.clone().values('latest_non_cve_version', " \ "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_versions(self, package):\n raise NotImplementedError(self, \"_get_versions\")", "def get_all_package_versions(self):\n with self._conn.begin():\n return {\n (rec.package, rec.version)\n for rec in self._conn.execute(self._versions.select())\n ...
[ "0.6543965", "0.65158117", "0.63081753", "0.6207479", "0.6197468", "0.6129687", "0.60986906", "0.6093709", "0.6070503", "0.60493296", "0.59996223", "0.59729433", "0.59522855", "0.59308636", "0.59266967", "0.5887097", "0.5853889", "0.5845434", "0.58397335", "0.5826583", "0.580...
0.69945884
0
Get only topmost alternate package to recommend based on similarity score.
def get_topmost_alternate(insights_result, input_stack): temp_dict = {} for pkg_name, contents in insights_result.get('alternate_packages', {}).items(): pkg = {} for ind in contents: pkg[ind['package_name']] = ind['similarity_score'] temp_dict[pkg_name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_match(self, list):\n raise NotImplementedError", "def top_5_similar_2(list_string, my_nlp=nlp1, model_type=my_model, doc_topic=my_doc_topic):\n vec = my_nlp.transform(list_string)\n vtrans = model_type.transform(vec)\n array_5 = pairwise_distances(vtrans, doc_topic, metric='cosine')....
[ "0.5661543", "0.56517416", "0.5632585", "0.5607197", "0.5593827", "0.5533133", "0.5505497", "0.5497555", "0.54538906", "0.54258627", "0.54207337", "0.5405309", "0.53485316", "0.53227997", "0.532241", "0.5290015", "0.5285469", "0.5284596", "0.52806467", "0.52779144", "0.526047...
0.6680439
0
Add versions to filtered list.
def add_version_to_filtered_list(epv, key, val, semversion_tuple, input_stack_tuple, pkg_dict, new_dict, filtered_comp_list): name = epv.get('package', {}).get('name', [''])[0] version = epv.get('version', {}).get('version', [''])[0] try: if semve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_versions(self):\n return []", "def filter_queryset(self, qs):\n qs = super(ReleaseViewSet, self).filter_queryset(qs)\n if getattr(self, 'order_queryset', False):\n return sorted(qs, key=models.Release.version_sort_key)\n return qs", "def filter_versions(epv_lis...
[ "0.62652504", "0.57633746", "0.57496274", "0.57408017", "0.56999254", "0.56245357", "0.5613813", "0.56130326", "0.5548632", "0.55051064", "0.5501385", "0.54833376", "0.5472852", "0.54387677", "0.5410473", "0.54037774", "0.5308708", "0.529208", "0.5256953", "0.5254935", "0.523...
0.6088062
1
Filter the EPVs according to following rules. First filter fetches only EPVs that 1. has No CVEs 2. are Present in Graph Apply additional filter based on following. That is sorted based on 3. Latest Version 4. Dependents Count in Github Manifest Data 5. Github Release Date
def filter_versions(epv_list, input_stack, external_request_id=None, rec_type=None): logger.info("Filtering {} for external_request_id {}".format(rec_type, external_request_id)) pkg_dict = defaultdict(dict) new_dict = defaultdict(dict) filtered_comp_list = [] for epv in epv_lis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_cves_for_epv(context, cves, p, v, e):\n response = context.response.json()\n depencencies = check_and_get_attribute(response, \"dependencies\")\n\n for dependency in depencencies:\n cve_count = check_and_get_attribute(dependency, \"cve_count\")\n ecosystem = check_and_get_attribute...
[ "0.55689657", "0.52753115", "0.51569027", "0.51495475", "0.50999576", "0.50104886", "0.50065416", "0.5004988", "0.49848557", "0.49695632", "0.49218133", "0.48959437", "0.4889735", "0.4889097", "0.48798457", "0.4845196", "0.4767309", "0.47618723", "0.47383654", "0.47263968", "...
0.5723364
0
Get topics from pgm and associate with filtered versions from Graph.
def get_topics_for_alt(alt_list, pgm_dict): for epv in alt_list: name = epv.get('package', {}).get('name', [''])[0] if name: for pgm_pkg_key, pgm_list in pgm_dict.items(): for pgm_epv in pgm_list: if name == pgm_epv.get('package...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_topics_for_comp(comp_list, pgm_list):\n for epv in comp_list:\n name = epv.get('package', {}).get('name', [''])[0]\n if name:\n for pgm_epv in pgm_list:\n if name == pgm_epv.get('package_name', ''):\n epv['package']['pgm_...
[ "0.624174", "0.5761184", "0.5715594", "0.5509116", "0.54433787", "0.5407973", "0.5358356", "0.53516734", "0.53462213", "0.53185207", "0.5304576", "0.52789676", "0.5265392", "0.51971334", "0.5190482", "0.5178945", "0.5134864", "0.5134683", "0.5133571", "0.5117395", "0.51031554...
0.6738061
0
Get topics from pgm and associate with filtered versions from Graph.
def get_topics_for_comp(comp_list, pgm_list): for epv in comp_list: name = epv.get('package', {}).get('name', [''])[0] if name: for pgm_epv in pgm_list: if name == pgm_epv.get('package_name', ''): epv['package']['pgm_topics'] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_topics_for_alt(alt_list, pgm_dict):\n for epv in alt_list:\n name = epv.get('package', {}).get('name', [''])[0]\n if name:\n for pgm_pkg_key, pgm_list in pgm_dict.items():\n for pgm_epv in pgm_list:\n if name == pgm_epv.g...
[ "0.6736346", "0.5758977", "0.5712824", "0.55073386", "0.5441972", "0.5405679", "0.5356367", "0.5349985", "0.53440523", "0.5317159", "0.5303023", "0.527689", "0.5264766", "0.51951194", "0.5189798", "0.51763505", "0.51340675", "0.5133218", "0.51313066", "0.511647", "0.510166", ...
0.6241026
1
Get License Analysis and filter out License Conflict EPVs.
def apply_license_filter(user_stack_components, epv_list_alt, epv_list_com): license_score_list_alt = license_score_list_com = [] conflict_packages_alt = conflict_packages_com = [] list_pkg_names_alt = list_pkg_names_com = [] for epv in epv_list_alt: license_scoring_input = {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_license_analysis(\n resolved, ecosystem, filtered_alternate_packages,\n filtered_alt_packages_graph, filtered_companion_packages,\n filtered_comp_packages_graph, external_request_id):\n list_user_stack_comp = extract_user_stack_package_licenses(resolved, ecosyste...
[ "0.57380617", "0.5651631", "0.5636101", "0.5427706", "0.5421714", "0.5414008", "0.54022676", "0.53644395", "0.53555596", "0.5353291", "0.5330937", "0.52408224", "0.5127965", "0.5122203", "0.50981957", "0.5067312", "0.5042597", "0.50423706", "0.50342274", "0.5030037", "0.50062...
0.62751555
0
Return a list of companion components with valid cooccurrence probability.
def set_valid_cooccurrence_probability(package_list=[]): new_package_list = [] for package in package_list: if str(package['cooccurrence_probability']) == 'nan': logger.error("Found an invalid cooccurrence probability for %s" % package['name']) package['cooccurrence_probability']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_components_probabilities(self):\n compsProbs={}\n for d in self.diagnoses:\n p = d.get_prob()\n for comp in d.get_diag():\n compsProbs[comp] = compsProbs.get(comp,0) + p\n return sorted(compsProbs.items(), key=lambda x: x[1], reverse=True)", "def ...
[ "0.65161115", "0.5962246", "0.5887236", "0.58519393", "0.5831798", "0.568156", "0.567161", "0.56327885", "0.55874306", "0.5566834", "0.55591905", "0.5446711", "0.5428646", "0.542515", "0.5421322", "0.54199296", "0.5418528", "0.54184157", "0.5407738", "0.53900576", "0.53878695...
0.6209135
1
Get the insights url based on the ecosystem.
def get_insights_url(payload): if payload and 'ecosystem' in payload[0]: quickstarts = False if payload[0]['ecosystem'] in RecommendationTask.chester_ecosystems: INSIGHTS_SERVICE_HOST = os.getenv("NPM_SERVICE_HOST") elif payload[0]['ecosystem'] in Recommendati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __discovery_url(self):\n port = self.sensor.options.agent_port\n if port == 0:\n port = AGENT_DEFAULT_PORT\n\n return \"http://%s:%s/%s\" % (self.host, port, AGENT_DISCOVERY_PATH)", "def get_overpass_uri() -> str:\n Config.__get()\n assert Config.__config is not ...
[ "0.5953002", "0.5875074", "0.5805298", "0.5760436", "0.56931", "0.56714034", "0.56634486", "0.56627494", "0.5660305", "0.5659327", "0.56569594", "0.56523246", "0.5639153", "0.55690545", "0.5568302", "0.55519384", "0.5529384", "0.55052453", "0.54771394", "0.5474575", "0.546868...
0.7250144
0
Find a character that this owns. If no parameters are given, it will try to get only one character. If the user has more than one character, an exception will be thrown You should only give one of the optional parameters.
def get_character(self, name=None, id=None): if name is None and id is None: if len(self.characters) > 1: raise TooManyCharactersError("There are too many characters to choose from") if len(self.characters) is 0: return None return self.charac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_specific_character(self):\n characters = self._get_all_characters(self._main_page)\n for character in characters.keys():\n if self._find_name.lower() in character.lower():\n return {character: characters[character]}\n else:\n raise CharacterNotFoun...
[ "0.6970571", "0.62470883", "0.622336", "0.6158424", "0.60272366", "0.5991086", "0.5991086", "0.5991086", "0.5984212", "0.5951051", "0.58442706", "0.56607884", "0.56492585", "0.56492585", "0.56359833", "0.55742425", "0.5476996", "0.5454454", "0.54166716", "0.5363763", "0.53439...
0.71451056
0
parse fit activity record to geographic and misc data
def _parse_activity_record(self, record): timestamp = record.pop('timestamp', None) coordinate = Coordinate({'latitude': record.pop('positionLong', None), 'longitude': record.pop('positionLat', None), 'altitude': record.pop('enhancedAltit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_records(self):\n for record in sp.parse(gzip.open(\n \"./human_uniprot_04_07_20.gz\", 'rt')):\n # print(record.taxonomy_id)\n # if record.organism != \"Homo sapiens\":\n # continue\n # print(record.features[0])\n # for comme...
[ "0.59880304", "0.57370543", "0.5634082", "0.5615271", "0.54047924", "0.534302", "0.52854854", "0.5262372", "0.52179396", "0.5212996", "0.51923996", "0.51440746", "0.5140372", "0.5114112", "0.5111809", "0.5107928", "0.50860095", "0.50744706", "0.50719446", "0.5052834", "0.5043...
0.66960806
0
Discovers BTLE devices that describe themselves as a SensorTag.
def SensorTagDeviceScan(bt_adapter, scan_ttl): service = DiscoveryService(bt_adapter) devices = service.discover(scan_ttl) for key in devices.keys(): if 'SensorTag' not in devices[key]: del devices[key] return devices
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_device_tags_by_id(self):\n pass", "def test_get_device_tags_by_id1(self):\n pass", "def identify_smart_sensors(serial_conns):\n def recv_subscription_response(conn, uid_queue, stop_event):\n \"\"\"\n Place received subscription response UIDs from CONN into UID_QUEUE,...
[ "0.6235508", "0.61249113", "0.60448694", "0.60073525", "0.5875684", "0.5734707", "0.57090735", "0.56834054", "0.5666481", "0.5632527", "0.55328953", "0.54945636", "0.5450923", "0.53866327", "0.53375965", "0.53337836", "0.5328025", "0.53078216", "0.53027505", "0.5254843", "0.5...
0.7380351
0
Return tuples of all networks for a given country. The country must be provided as a ISO31661 alpha2 country code. The returned for is (mcc, mnc, network_name).
def country_networks(country: str) -> typing.List[typing.Tuple[int, int, str]]: try: return [(m[0], m[1], operators[m[0]][m[1]][1]) for m in countries[country]] except Exception as ex: raise InvalidCountry("Invalid country {}".format(country)) from ex
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrapeCountries(conn):\n query = \"SELECT * FROM country\"\n c = conn.cursor()\n c.execute(query)\n results = []\n for row in c:\n result={}\n country_fields = {}\n\n result['pk'] = country_codes[row[0]]\n result['model'] = \"infohub.country\"\n result['fields'...
[ "0.5545293", "0.5517422", "0.55047107", "0.5444973", "0.54217064", "0.5387653", "0.53256685", "0.52965677", "0.5291538", "0.52650654", "0.5264366", "0.52108544", "0.5197521", "0.5184642", "0.51505244", "0.51354706", "0.5124626", "0.5117832", "0.5112238", "0.5101235", "0.50952...
0.7822536
0
Decorate a function to print its runtime
def runtime_print(f): def decorated_fun(*args, **kwargs): t0 = datetime.now() ret = f(*args, **kwargs) t1 = datetime.now() print(f'Runtime: {t1 - t0}') return ret return decorated_fun
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_time(f):\n @wraps(f)\n def wrapper(*args, **kwargs):\n # Current timestep\n t1 = time.time()\n f_out = f(*args, **kwargs)\n t2 = time.time()\n text = f\"{f.__name__} output (exec time: {(t2 - t1) * 1000 :.6f} ms)\"\n print(text)\n return f_out\n r...
[ "0.76284724", "0.7458502", "0.73377395", "0.7332962", "0.72374874", "0.719477", "0.70849335", "0.70599043", "0.7017274", "0.69933575", "0.69602835", "0.69571716", "0.6944237", "0.6931771", "0.6910322", "0.69093317", "0.6889765", "0.68755955", "0.6852927", "0.68188", "0.677574...
0.86992747
0
Sampling room length, width, and height.
def sample_room(config): room = np.zeros((3,)) room[0] = get_sample(config['length'], n_sample=1)[0] room[1] = get_sample(config['width'], n_sample=1)[0] room[2] = get_sample(config['height'], n_sample=1)[0] return room
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(self, length):\n pass", "def sample(self, size=1):\n pass", "def get_sample(self, n, side_len):\n self.side_len = side_len\n side_len_scaled = self.side_len * self.resolution_scaler\n\n print(self.side_len, side_len_scaled, self.resolution_scaler)\n tiles = ...
[ "0.6291044", "0.5974007", "0.5959597", "0.59489334", "0.5886053", "0.58338994", "0.5815867", "0.5800344", "0.57450944", "0.5694468", "0.56857747", "0.5657124", "0.5654733", "0.5654733", "0.5654733", "0.5654733", "0.5627829", "0.5610665", "0.5590204", "0.5566714", "0.55634296"...
0.7681961
0
Sample the positions of the sound sources.
def sample_source_position(config, room_size, array_center): # sample the number of speakers n_spk = get_sample(config['num_spk']) n_spk = n_spk[0] if config['position_scheme'] == "random_coordinate": source_position = sample_source_position_by_random_coordinate(config, n_spk, room_size, array_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(self, verbose=False):\n\t\tfor i in range(self.nsamp): self.subsample(verbose)\n\t\treturn self.amps, self.pos, self.irads", "def samplePositions(self):\n samples = []\n for i in range(self.sampleIter):\n x = random.randint(-self.sampleRange, self.sampleRange)\n y =...
[ "0.6578892", "0.6376212", "0.60471386", "0.5884458", "0.5880108", "0.587275", "0.56886494", "0.567973", "0.56540215", "0.56339526", "0.5618356", "0.55937064", "0.5517207", "0.5486643", "0.5485877", "0.5485388", "0.5474353", "0.54645115", "0.54592013", "0.54577607", "0.5449659...
0.6847986
0
Sample positions of sound sources by uniformly sampling their 3D coordinates in the room.
def sample_source_position_by_random_coordinate(config, n_spk, room_size, array_center, forbidden_rect=None): source_position = np.zeros((3, n_spk)) d_from_wall = config['min_dist_from_wall'] if "min_dist_from_wall" in config.keys() else [0.0, 0.0] # minimum distance from wall d_from_array = config['min_di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_source_position(config, room_size, array_center):\n # sample the number of speakers\n n_spk = get_sample(config['num_spk'])\n n_spk = n_spk[0]\n\n if config['position_scheme'] == \"random_coordinate\":\n source_position = sample_source_position_by_random_coordinate(config, n_spk, room...
[ "0.67525697", "0.6351828", "0.62483054", "0.6094069", "0.60869646", "0.6050129", "0.6013234", "0.59497035", "0.59006274", "0.5820183", "0.5761283", "0.56493074", "0.5646169", "0.5637693", "0.5634082", "0.5617797", "0.5610548", "0.56050086", "0.56039065", "0.56009334", "0.5593...
0.7046122
0
Given the values of the most abundant species at pH 7 and a list of pKa values, generates the data of all other pseudoisomers
def GenerateAllPseudoisomers(self, dG0, nH, charge, nMg, pKas): pKa_higher = [x for x in pKas if 7 < x] pKa_lower = [x for x in pKas if 7 > x] pseudoisomer_list = [{'dG0': round(dG0, 1), 'nH': nH, 'charge': charge, 'nMg': nMg}] ddG0 = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shaffer(p_values):\n\n def S(k):\n \"\"\"\n Computes the set of possible numbers of true hoypotheses.\n\n Parameters:\n -----------\n k: int\n number of algorithms being compared.\n\n Returns\n ----------\n TrueSet : array-like\n ...
[ "0.5946299", "0.5646367", "0.5625786", "0.5575138", "0.5561217", "0.55421597", "0.5532962", "0.5505822", "0.5474765", "0.5456286", "0.54247016", "0.54097885", "0.5405766", "0.5387464", "0.53611946", "0.5337932", "0.53373283", "0.5335868", "0.5326979", "0.53095835", "0.5293737...
0.6028935
0
Decorator for packed places.
def packed_place(cls): cls._packed_place_ = True return cls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_holder(*args):\n return args", "def is_packed(self):\n return self.__class__._packed_place_", "def extra_coords(self) -> ExtraCoordsABC:", "def place(self):\n\n return super().place(self._order_params)", "def helper_place_type(cls):\n cls._helper_ = True\n return cls", "d...
[ "0.63571644", "0.5677685", "0.5330051", "0.5229249", "0.5068734", "0.49555203", "0.49196962", "0.49126306", "0.48645574", "0.4858084", "0.47811386", "0.47681856", "0.47652695", "0.47392976", "0.47392976", "0.473223", "0.46335927", "0.46253112", "0.46078494", "0.45732382", "0....
0.68913746
0
C{True} if place is packed, C{False} otherwise
def is_packed(self): return self.__class__._packed_place_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_packed_layout(layout):\n if layout == \"NCHW\":\n return False\n if \"n\" in layout and \"c\" in layout:\n return True\n return False", "def packed_place(cls):\n cls._packed_place_ = True\n return cls", "def is_struct(self):\n return False", "def assert_placement(ci...
[ "0.7166416", "0.5932903", "0.5763247", "0.5710104", "0.5530314", "0.5504995", "0.5454246", "0.5413304", "0.5330749", "0.53268087", "0.5297606", "0.52963185", "0.52963185", "0.52898914", "0.5285461", "0.5270056", "0.5269989", "0.5260964", "0.5206346", "0.51905066", "0.5187782"...
0.8396906
0
C{True} if place is a helper, C{False} otherwise
def is_helper(self): return self.__class__._helper_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def helper_place_type(cls):\n cls._helper_ = True\n return cls", "def test_if_exist(self):\r\n self.assertEqual(Place, type(Place()))", "def check_helpers(self):\n paths = self.get_helper_out_paths()\n\n for p in paths:\n full_path = p + \".data-00000-of-00001\"\n ...
[ "0.6428334", "0.6064022", "0.5664283", "0.5609472", "0.55959576", "0.55394316", "0.54940236", "0.54902923", "0.5377365", "0.5350513", "0.53264475", "0.5315285", "0.5296897", "0.52920425", "0.52858055", "0.52681464", "0.52617115", "0.5256093", "0.52425367", "0.5225598", "0.521...
0.70334816
0
Return a list of data's column names which are started with "antisocial_".
def selectnamesA(data): col = [] for name in list(data): if name.startswith('antisocial_'): col.append(name) else: col = col return col
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selectnamesD(data):\n col = []\n for name in list(data):\n if name.startswith('hyperactive_'):\n col.append(name)\n else:\n col = col\n \n return col", "def selectnamesB(data):\n col = []\n for name in list(data):\n if name.startswith('anxiety_'):\...
[ "0.67057896", "0.6596896", "0.65445834", "0.6541286", "0.6535775", "0.6447968", "0.63812613", "0.6355492", "0.6292702", "0.62767863", "0.62696075", "0.61847275", "0.6146204", "0.61457735", "0.6118318", "0.6109781", "0.61031455", "0.6043961", "0.6042299", "0.60353166", "0.6034...
0.78132504
0
Return a list of data's column names which are started with "anxiety_".
def selectnamesB(data): col = [] for name in list(data): if name.startswith('anxiety_'): col.append(name) else: col = col return col
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selectnamesA(data):\n col = []\n for name in list(data):\n if name.startswith('antisocial_'):\n col.append(name)\n else:\n col = col\n \n return col", "def selectnamesD(data):\n col = []\n for name in list(data):\n if name.startswith('hyperactive_'...
[ "0.6901438", "0.6789566", "0.6637145", "0.66115993", "0.6428764", "0.63146144", "0.6145212", "0.61358887", "0.6090926", "0.6042427", "0.6009953", "0.5917986", "0.58701956", "0.58558387", "0.5847718", "0.5812759", "0.58074504", "0.57885015", "0.5745914", "0.57153773", "0.57145...
0.8105847
0
Return a list of data's column names which are started with "headstrong_".
def selectnamesC(data): col = [] for name in list(data): if name.startswith('headstrong_'): col.append(name) else: col = col return col
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset_headers(dataset):\n return list(dataset.columns.values)", "def _get_headers(self, data):\n if not self._headers:\n self._headers = list(map(lambda col: col.lower(), data.columns))\n return self._headers", "def column_names(self):\n return self.data.columns.values"...
[ "0.69749767", "0.6848288", "0.6799351", "0.6685291", "0.65973246", "0.65394247", "0.6492351", "0.6490348", "0.6426372", "0.64217645", "0.6405321", "0.63893276", "0.6384573", "0.63803643", "0.63647515", "0.6344466", "0.6336821", "0.6300765", "0.6276494", "0.6273715", "0.625951...
0.7652278
0
Return a list of data's column names which are started with "hyperactive_".
def selectnamesD(data): col = [] for name in list(data): if name.startswith('hyperactive_'): col.append(name) else: col = col return col
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selectnamesC(data):\n col = []\n for name in list(data):\n if name.startswith('headstrong_'):\n col.append(name)\n else:\n col = col\n \n return col", "def column_names(self):\n return self.data.columns.values", "def getDataCols(data: List[Dict]) -> Li...
[ "0.70170325", "0.69913113", "0.6841379", "0.6626", "0.65905523", "0.6576411", "0.654978", "0.6534173", "0.65270835", "0.6484165", "0.64703137", "0.6467796", "0.6462947", "0.64606994", "0.6452867", "0.64504164", "0.6398739", "0.6395657", "0.63771284", "0.637636", "0.63313013",...
0.789232
0
Return a list of data's column names which are started with "peer_".
def selectnamesE(data): col = [] for name in list(data): if name.startswith('peer_'): col.append(name) else: col = col return col
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDataCols(data: List[Dict]) -> List[str]:\n notAudit = list(\n filter(\n partial(is_not, None),\n list(\n map(\n lambda x: x.get(\"col_name\")\n if x.get(\"is_audit_col\") == \"N\"\n else None,\n ...
[ "0.62229306", "0.6116045", "0.6085167", "0.59296584", "0.5884195", "0.5821778", "0.5821116", "0.58168924", "0.5797596", "0.5787838", "0.57865334", "0.57372826", "0.5728357", "0.5727421", "0.57051444", "0.5674043", "0.564491", "0.5616172", "0.56067675", "0.55911744", "0.558012...
0.799564
0
Gets the list of animals from the given file.
def get_animals_list(filename): f = open(filename, 'r') text = f.read() f.close() animals = text.split('\n') animals = [animal for animal in animals if animal != '' and len(animal) > 1] return sorted(animals)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_animals(self):\n for animal in self.animals:\n print(animal)", "def get_fortunes(data_file):\n fortunes = []\n for line in open(data_file):\n fortunes.append(line)\n return fortunes", "def all_species():\n with open(\"animal_list.json\", \"r\") as file:\n data = json.l...
[ "0.6528121", "0.64792347", "0.6395931", "0.63652486", "0.6021897", "0.6009719", "0.599702", "0.5977753", "0.5940923", "0.5924525", "0.5905968", "0.590205", "0.58956164", "0.5894552", "0.5877434", "0.5876524", "0.587468", "0.587029", "0.5848932", "0.5847276", "0.5846705", "0...
0.71120083
0
Finds the bit in the sync file and returns the time points that there is a transition (given by the direction parameter).
def _find_bit_in_sync(sync_file, bit, direction): sync_data = np.fromfile(sync_file, np.uint16).astype(np.int32) sync_data_zeroed = sync_data - sync_data.min() bit_on = sync_data_zeroed & bits[bit] bit_start = np.argwhere(np.diff(bit_on) > 0).squeeze() bit_end = np.argwhere(np.diff(bit_on) < 0).sque...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _discover_move(self, origin, direction):\n x, y = origin\n color = self[x][y]\n flips = []\n\n for x, y in OthelloBoard._increment_move(origin, direction, self.n):\n if self[x][y] == 0:\n if flips:\n # print(\"Found\", x,y)\n ...
[ "0.55635005", "0.53977734", "0.53707165", "0.5311501", "0.5267841", "0.5224308", "0.5210224", "0.5136517", "0.5128506", "0.51150435", "0.5103131", "0.507816", "0.50287354", "0.5006899", "0.49965474", "0.49526975", "0.49326602", "0.49323615", "0.49297693", "0.4887006", "0.4880...
0.72986764
0
Returns a pandas dataframe with two columns. The first ('ComputerTime') is the Timestamps of the video frames (in the Video.avi file) as recorded using the computer clock. The second ('AmpTimePoints') is the time point of the amplifier corresponding to the beginning of this video frame.
def get_computer_time_to_amp_time_points_dataframe(data_folder, clean=False, cam_ttl_pulse_period=158): sync_file = path.join(data_folder, 'Sync.bin') camera_pulses = _generate_camera_pulses(sync_file, clean, cam_ttl_pulse_period) video_csv_file = path.join(data_folder, 'Video.csv') video_df = csv_func...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frame(self):\n microseconds = np.array(self.results['times']) * 1e6\n return pd.DataFrame(self.results, index=microseconds)", "def get_amp_time_point_from_computer_time(correspondance_dataframe, datetime):\n sampling_period_in_milliseconds = 20\n items = correspondance_dataframe['Computer...
[ "0.65935576", "0.58919424", "0.5637284", "0.5464183", "0.54253924", "0.5375368", "0.53399324", "0.5304138", "0.5285717", "0.5258087", "0.52442604", "0.5221155", "0.5197789", "0.5186402", "0.51722986", "0.51547575", "0.5141815", "0.51291794", "0.51245993", "0.5082412", "0.5070...
0.67042834
0
Get the amplifier time point corresponding to the frame of the video.
def frame_to_time_point(time_point_of_first_video_frame, camera_frames_in_video, points_per_pulse, frame): return int(time_point_of_first_video_frame + (camera_frames_in_video[frame] * points_per_pulse))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_frame_time(self, f):\n return f * self.get_frame_duration()", "def get_frame_time(self):\n return self.get_timings().frame_time", "def get_amp_time_point_from_computer_time(correspondance_dataframe, datetime):\n sampling_period_in_milliseconds = 20\n items = correspondance_dataframe['Co...
[ "0.6288291", "0.62046325", "0.6157795", "0.6125282", "0.6036017", "0.601553", "0.5934804", "0.5921699", "0.58475906", "0.56684566", "0.5645835", "0.5637956", "0.5630091", "0.5619763", "0.5612464", "0.55950785", "0.55929315", "0.5583393", "0.55480486", "0.554382", "0.5541548",...
0.69987726
0
Returns the video frame number corresponding to the amplifier time point. If the time point is before (after) the video then the zeroth (last) frame will be returned. Also if the time point corresponds to a dropped camera frame then the nearest past video frame will be returned
def time_point_to_frame(time_point_of_first_video_frame, camera_frames_in_video, points_per_pulse, time_point): true_frame = int((time_point - time_point_of_first_video_frame) / points_per_pulse) if true_frame < 0: video_frame = 0 elif true_frame > len(camera_frames_in_video): video_frame =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frame_to_time_point(time_point_of_first_video_frame, camera_frames_in_video, points_per_pulse, frame):\n return int(time_point_of_first_video_frame + (camera_frames_in_video[frame] * points_per_pulse))", "def get_frameidx(self, fps):\n return int(self.hours * MIN_PER_H * S_PER_MIN * fps \\\n ...
[ "0.7207683", "0.6354549", "0.62271404", "0.6206537", "0.6111925", "0.60873544", "0.59454983", "0.59423137", "0.5927092", "0.5902686", "0.57881236", "0.57740575", "0.5753905", "0.573533", "0.57214993", "0.5695044", "0.56923103", "0.5661834", "0.5570037", "0.5564497", "0.555232...
0.71657836
1
Handles quality increments and ensures quality >0 and <50 , invariant
def increment_quality(self, increment_unit): if self.quality > self.min_quality and self.quality < self.max_quality: self.quality = self.quality + increment_unit return self.quality
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enforce_quality_limits(self):\n if self.orig_quality <= 50:\n if self.quality >= 50:\n self.quality = 50", "def set_quality(self):\n p = self.suitability + 1.15 * self.fono\n self.quality = np.exp(p) / (1 + np.exp(p))", "def quality(self):\n return self.pla...
[ "0.77974176", "0.73606473", "0.7266813", "0.7036684", "0.69486827", "0.6742093", "0.65865946", "0.65769345", "0.6498352", "0.6467981", "0.6464578", "0.6444412", "0.6409319", "0.6295895", "0.62946236", "0.6285363", "0.6277648", "0.61617494", "0.6132603", "0.6129394", "0.603727...
0.7392929
1
We can get a reasonable guess for the output bias by just assuming the crystal's energy is a linear sum over it's element types
def calculate_output_bias(train): # This just converts to a count of each element by crystal site_counts = ( train.inputs.progress_apply(lambda x: pd.Series(Counter(x["site"]))) .reindex(columns=np.arange(max_atomic_num)) .fillna(0) ) # Linear regression assumes a sum, while we a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bias(self):", "def _energy_bias(self,vBz):\n return np.clip(0.1*np.log10(vBz)+0.6,0,1)", "def betaW(self):\n if self.maCruise > 1:\n return 0\n else:\n return sqrt(1 - self.maCruise**2)", "def calcEout(model_type): \n b, v = calcStatistics(model_type)\...
[ "0.6517002", "0.6189034", "0.5984206", "0.58687437", "0.57943195", "0.57759243", "0.56865144", "0.56757593", "0.56599385", "0.56509316", "0.5646032", "0.5638265", "0.5630325", "0.5612398", "0.5596738", "0.55893207", "0.5573205", "0.55585057", "0.5553049", "0.5531465", "0.5531...
0.6285882
1
list all notes in this notebook
def ls(self, count = 200): return self._manager.ls_notes(self['id'], count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getnotes():", "def notes(self):\n return reapy.NoteList(self)", "def listNotes() -> list:\n list_of_notes = []\n for note in Note.objects.all():\n list_of_notes.append({\n 'uuid': note.uuid, 'title': note.title,\n 'author': note.author, 'body': note.body, 'created_...
[ "0.7503266", "0.73883605", "0.7283083", "0.7261222", "0.7136306", "0.710459", "0.70128185", "0.6972455", "0.6969843", "0.69654083", "0.693706", "0.6919246", "0.69087744", "0.69087744", "0.6890651", "0.684446", "0.68345386", "0.6810401", "0.67650634", "0.676217", "0.65773153",...
0.7570299
0
Train Runs `num_episodes` episodes to train the Q table.
def train(self, num_episodes = 10000, verbose = True): start_time = datetime.now().replace(microsecond=0) for e in range(num_episodes): S_old = self.env.reset() steps = 0 # there is an interal limit of 100 steps while steps < 1000: steps +=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, num_tickers=4, episodes_per_ticker=5, **kwargs):\n num_tickers = min(num_tickers, len(self.filtered_tickers))\n for i in range(num_tickers):\n ticker = self.filtered_tickers[i % num_tickers]\n env = self.ENV_CONSTRUCTOR(ticker=ticker, **kwargs)\n for j...
[ "0.761182", "0.7291354", "0.7254259", "0.7233456", "0.7086902", "0.70309263", "0.69997805", "0.69312054", "0.6847256", "0.6772324", "0.6739903", "0.6718038", "0.66944325", "0.6593634", "0.65104365", "0.64791363", "0.6422203", "0.6363365", "0.6360794", "0.6355351", "0.63426006...
0.7731692
0
Save Qtable (parameters will not be saved)
def save(self,path="qtable.npy"): np.save(path, self.Q)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(file, table):\n pq.write_table(pa.Table.from_pandas(table), file)", "def save(self, values):", "def save():", "def saveParam(self):\n qApp.emit(QtCore.SIGNAL(\"saveMe\"), self._param)", "def saveParam(self):\n qApp.emit(QtCore.SIGNAL(\"saveMe\"), self._param)", "def write_parame...
[ "0.6557314", "0.6538945", "0.6460572", "0.64240944", "0.64240944", "0.6402268", "0.632243", "0.6247804", "0.622754", "0.62246984", "0.62125134", "0.619415", "0.61918694", "0.6187383", "0.6171158", "0.61676836", "0.615162", "0.6144794", "0.61054707", "0.6092383", "0.6092383", ...
0.7091648
0
Load Q table (no parameters)
def load(self, path="qtable.npy"): self.Q = np.load(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadModel(self, model_file):\n with open(model_file) as f:\n self.q_table = json.load(f)", "def q(self):\n self.qTable()", "def with_qtable_imported_from(self, qtable_file_path):\n self.qtable_file_path = qtable_file_path\n return self", "def __init__(self, **kwargs...
[ "0.64264965", "0.639735", "0.63111997", "0.61453503", "0.61453503", "0.61453503", "0.61453503", "0.61453503", "0.61453503", "0.61453503", "0.61453503", "0.61453503", "0.61453503", "0.61453503", "0.6077961", "0.59836173", "0.5966984", "0.5899091", "0.58947647", "0.579236", "0....
0.72678417
0
Run PSIBlast on specified input.
def _blast(query, output_pssm, output, blastdb): psiblast_command = "psiblast -db {:} -query {:} -out_ascii_pssm {:} " + \ "-save_pssm_after_last_round -out {:}" log_out = "{}.out".format(output) log_err = "{}.err".format(output) with open(log_out, 'a') as f_out: with open(log_err, 'a') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_blast(inputfile, input_type, outputfile, database, args=None, verbose=True):\n\n assert (input_type in ['protein', 'dna']), \"Input type must be either 'protein' or 'dna'\"\n\n cmd = ['diamond']\n\n if input_type == 'protein':\n cmd += ['blastp']\n elif input_type == 'dna':\n cmd ...
[ "0.70275027", "0.62656426", "0.6253778", "0.6222382", "0.6119403", "0.5984659", "0.58371437", "0.57142895", "0.5681634", "0.55803686", "0.54573035", "0.5444228", "0.54296017", "0.54211515", "0.5413929", "0.5379698", "0.5347457", "0.5289069", "0.528414", "0.52539766", "0.52083...
0.6397681
1
Convert PSIBlast output to CLUSTAL format.
def _to_clustal(psiblast_in, clustal_out): log_out = "{}.out".format(clustal_out) log_err = "{}.err".format(clustal_out) mview_command = "mview -in blast -out clustal {:} | tail -n+4 > {:}" with open(log_out, 'a') as f_out: with open(log_err, 'a') as f_err: command = mview_command.fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _al2co(clustal_in, al2co_out):\n log_out = \"{}.out\".format(al2co_out)\n log_err = \"{}.err\".format(al2co_out)\n al2co_command = \"al2co -i {:} -g 0.9 | head -n -12 > {:}\"\n with open(log_out, 'a') as f_out:\n with open(log_err, 'a') as f_err:\n command = al2co_command.format(c...
[ "0.5347321", "0.52854484", "0.5042904", "0.49632794", "0.4865282", "0.4727162", "0.47163013", "0.47053492", "0.46560776", "0.46421504", "0.45914274", "0.45884034", "0.4578219", "0.45664334", "0.4565815", "0.4565198", "0.4557839", "0.45315677", "0.452516", "0.45210153", "0.451...
0.65323865
0
Use al2co on CLUSTAL format.
def _al2co(clustal_in, al2co_out): log_out = "{}.out".format(al2co_out) log_err = "{}.err".format(al2co_out) al2co_command = "al2co -i {:} -g 0.9 | head -n -12 > {:}" with open(log_out, 'a') as f_out: with open(log_err, 'a') as f_err: command = al2co_command.format(clustal_in, al2co_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ConUACalc(self):\n if hasattr(self,\"con\"): return self.con\n st = self.uacalc_format(\"A\"+str(self.index))\n writefile('tmpalgCon.ua',st)\n os.system('java -classpath '+clspth+'uacalc/classes/ org.uacalc.example.ConUACalc tmpalgCon.ua >tmpoutCon.txt')\n st = readfile('tmpo...
[ "0.5458678", "0.5117386", "0.5080209", "0.50449705", "0.50278884", "0.49548152", "0.49257407", "0.48588154", "0.48197156", "0.48102337", "0.4806121", "0.4792376", "0.47755265", "0.47459295", "0.47364768", "0.47286403", "0.47164693", "0.47036618", "0.47005302", "0.4683181", "0...
0.7679692
0
Use the method of moments to approximate a distribution with a gamma of the same mean and variance
def approximate_gamma_mom(mean, variance): assert mean > 0 assert variance > 0 alpha = mean**2 / variance beta = mean / variance return alpha, beta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_approximate_gamma(self, k):\n mean_column = prior.PriorParams.field_index(\"mean\")\n var_column = prior.PriorParams.field_index(\"var\")\n x = self.priors[self.n][k][mean_column]\n xvar = self.priors[self.n][k][var_column]\n # match mean/variance\n alpha_0, beta_...
[ "0.6605525", "0.6560424", "0.6516903", "0.6388569", "0.6346039", "0.6321473", "0.6301819", "0.62925744", "0.6268105", "0.621033", "0.6197907", "0.6184741", "0.6184442", "0.6156318", "0.6155723", "0.6138721", "0.6103537", "0.6084621", "0.60704577", "0.6060387", "0.6034926", ...
0.8156598
0
Test that matching gamma to Taylorseriesapproximated sufficient statistics will result in lower KL divergence than matching to mean/variance
def test_approximate_gamma(self, k): mean_column = prior.PriorParams.field_index("mean") var_column = prior.PriorParams.field_index("var") x = self.priors[self.n][k][mean_column] xvar = self.priors[self.n][k][var_column] # match mean/variance alpha_0, beta_0 = approximate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve_gamma(t, old, total):\n\n old, total = np.mean(old), np.mean(total)\n gamma = -1 / t * np.log(old / total)\n\n return gamma", "def gamma(self):\r\n raise NotImplementedError('not implemented yet, will use spouge approximation')", "def test_gamma_basis_hon(self):\n def row_gener...
[ "0.62503284", "0.6153751", "0.6115039", "0.60666776", "0.5999449", "0.5967799", "0.5935997", "0.5929466", "0.5925981", "0.59205425", "0.59101415", "0.5907824", "0.5896239", "0.58749276", "0.58717704", "0.5871331", "0.58651376", "0.58519584", "0.5839726", "0.5838855", "0.58378...
0.73119956
0
Compute parameter size in MB
def param_size(model): n_params = sum( np.prod(v.size()) for k, v in model.named_parameters() if not k.startswith('aux_head')) return n_params / 1024. / 1024.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size_in_gb(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"size_in_gb\")", "def size_in_gb(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"size_in_gb\")", "def size_in_gb(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"size_in_gb\")", "def calc_size(self):\r\n...
[ "0.7263162", "0.7263162", "0.7263162", "0.7241035", "0.71693695", "0.71566486", "0.7121322", "0.70817107", "0.70729536", "0.70373976", "0.702683", "0.69586474", "0.69586474", "0.69404674", "0.69404674", "0.69086444", "0.6904315", "0.68968344", "0.68968344", "0.6895138", "0.68...
0.75137967
0
Does the font have a DSIG table?
def com_google_fonts_check_dsig(ttFont): if "DSIG" not in ttFont: yield PASS, "ok" else: yield WARN,\ Message("found-DSIG", "This font has a digital signature (DSIG table) which" " is only required - even if only a placeholder" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def com_google_fonts_check_052(ttFont):\n REQUIRED_TABLES = {\n \"cmap\", \"head\", \"hhea\", \"hmtx\", \"maxp\", \"name\", \"OS/2\", \"post\"}\n OPTIONAL_TABLES = {\n \"cvt \", \"fpgm\", \"loca\", \"prep\", \"VORG\", \"EBDT\", \"EBLC\", \"EBSC\", \"BASE\",\n \"GPOS\", \"GSUB\", \"JSTF\", \"DSIG\"...
[ "0.59934574", "0.59934574", "0.5824857", "0.5736564", "0.5736564", "0.5735894", "0.569441", "0.5688455", "0.5677906", "0.5677906", "0.56572485", "0.56278217", "0.56196815", "0.55831844", "0.5579034", "0.5579034", "0.5538577", "0.5521863", "0.5506661", "0.5506661", "0.54903156...
0.68253064
0
return all contacts that contain the search value in their name.
def search(self, name): matching_contacts = [] for contact in self: if name in contact.name: matching_contacts.append(contact) return matching_contacts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_by_name(self, name):\r\n return self.__filter(self.get_all_persons(), lambda x: name.lower().strip() in x.name.lower().strip())", "def search_contact_list(self):\n\n search_db = Database()\n result = search_db.contact_search(self.name)\n if not result:\n print Fo...
[ "0.7542229", "0.7402875", "0.68143237", "0.67611414", "0.6580044", "0.6447597", "0.6325198", "0.6282001", "0.62611824", "0.62127775", "0.609645", "0.60654765", "0.6041744", "0.6038867", "0.60315645", "0.60297406", "0.6017091", "0.59663445", "0.5965268", "0.5928945", "0.591991...
0.8526341
0
Testing layer sparsity calculation.
def test_calc_layer_sparsity(): test_ndarray = np.array([[0, 2, 0], [1, 0, 1]]) assert lu.calc_layer_sparsity(test_ndarray) == 3 / 6, 'correct sparsity value' test_ndarray = np.array([[0, 0, 0], [1, 0, 1]]) assert abs(lu.calc_layer_sparsity(test_ndarray) - 4 / 6) < 10**-8, 'correct sparsity value' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sparsity(config):\n total_zeros = 0\n total_nonzeros = 0\n\n print ('<===sparsity type is {}'.format(config.sparsity_type))\n print ('<===layers to be pruned are {}'.format(config._prune_ratios))\n if config.masked_progressive and (config.sparsity_type == 'filter' or config.sparsity_ty...
[ "0.8032029", "0.69233114", "0.68469155", "0.68389285", "0.6689874", "0.6579999", "0.6113282", "0.60921884", "0.6085082", "0.60687727", "0.6049707", "0.5923072", "0.59068125", "0.5871338", "0.5838452", "0.58295774", "0.5817212", "0.5816951", "0.57818764", "0.5723493", "0.57192...
0.82080257
0
Unmutes a muted user
async def unmute(self, ctx, user: Redeemed): if member == None or member == ctx.message.author: await ctx.send("You cannot unmute yourself!") return await user.remove_roles(discord.utils.get(ctx.guild.roles, name="Muted")) await ctx.send(f"{user.mention} has been unmut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_unmute():\n muted = set(t.mutes.users.ids(screen_name=TWITTER_HANDLE)[\"ids\"])\n\n # put user IDs of people you want to remain muted here\n users_keep_muted = set([])\n \n # mute all \n for user_id in muted:\n if user_id not in users_keep_muted:\n t.mute...
[ "0.8053246", "0.77135104", "0.7570595", "0.7322523", "0.72926575", "0.7282651", "0.705911", "0.6830115", "0.6763812", "0.6667925", "0.66289747", "0.65658414", "0.6529562", "0.6510275", "0.6494702", "0.6475305", "0.6463142", "0.6378609", "0.637185", "0.6329488", "0.6257704", ...
0.8195687
0
Train naive Bayes parameters from data.
def naive_bayes_train(train_data, train_labels, params): labels = np.unique(train_labels) d, n = train_data.shape num_classes = labels.size # Set LaPlace smoothing parameter. # As alpha increases, the probabilities tend towards the uniform distribution. # If there is little need for smoothin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_naive_Bayes_classificator(self):\n positive_tweet_tokens = twitter_samples.tokenized(\n 'positive_tweets.json')\n negative_tweet_tokens = twitter_samples.tokenized(\n 'negative_tweets.json')\n\n positive_cleaned_tokens_list = []\n negative_cleaned_tokens_...
[ "0.7367895", "0.7309136", "0.72999424", "0.71508944", "0.7137337", "0.7088768", "0.7062019", "0.6958703", "0.69489264", "0.6920708", "0.6863779", "0.6849118", "0.680495", "0.67637575", "0.6684735", "0.66523296", "0.66499275", "0.6622607", "0.6610919", "0.65941507", "0.6573226...
0.8192772
0
`tokens` = a POStagged sentence [(w1, t1), ...] `index` = the index of the token we want to extract features for `history` = the previous predicted IOB tags
def ner_features(tokens, index, history): # Pad the sequence with placeholders tokens = [('__START2__', '__START2__'), ('__START1__', '__START1__')] + list(tokens) + [('__END1__', '__END1__'), ('__END2__', '__END2__')] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def features(self, tokens, index, history):\r\n # for more details see: http://nlpforhackers.io/named-entity-extraction/\r\n \r\n # init the stemmer\r\n stemmer = SnowballStemmer('english')\r\n\r\n # Pad the sequence with placeholders\r\n tokens = [('[START2]', '[START2]')...
[ "0.7564211", "0.71175826", "0.7015154", "0.7014558", "0.6411697", "0.6302265", "0.6270808", "0.6217701", "0.61726224", "0.61617595", "0.6145696", "0.6072391", "0.5986974", "0.5948331", "0.59082043", "0.5907524", "0.58773524", "0.586173", "0.5830784", "0.58045053", "0.5779231"...
0.7541114
1
Make a token request. Should be modeled after `testsuite.oauth.authorization_code._token_request`.
def token_request(post_data, auth_config, conformance): auth = None if auth_config.get('confidential_client'): auth = requests.auth.HTTPBasicAuth(auth_config['client_id'], auth_config['client_secret']) uris = fhir.get_oauth_uris(conformance) response ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_request(post_data, auth_config, conformance, request_method='POST'):\n auth = None\n allow_redirects = False\n timeout = 5\n\n if auth_config.get('confidential_client'):\n auth = requests.auth.HTTPBasicAuth(auth_config['client_id'],\n auth_conf...
[ "0.74559575", "0.7389697", "0.73772997", "0.73548037", "0.7089377", "0.7034272", "0.69745517", "0.6920904", "0.6885441", "0.68721217", "0.68118185", "0.68046504", "0.6778314", "0.6729754", "0.66917837", "0.6671977", "0.6663617", "0.6662737", "0.659065", "0.65811455", "0.65730...
0.75235987
0
Test for login of registereduser login
def test_registered_user_login(self): # register a user register_user(self, 'some', 'name', 'another@gmail.com', 'aaaAAA111') # test logging in registered user with self.client: response = login_user(self, 'another@gmail.com', 'aaaAAA111') data = json.loads(respo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_login_user(self):\n\n self.register_user()\n\n self.assertEqual(self.login_user().status_code, 200)\n self.assertTrue(self.login_user().json[\"data\"][0][\"token\"])", "def test_registered_user_login(self):\n with self.client:\n # user registration\n use...
[ "0.7991888", "0.79394674", "0.78339005", "0.7801448", "0.7763463", "0.7732795", "0.7687294", "0.7667477", "0.7624085", "0.76170576", "0.7609002", "0.7554806", "0.75308704", "0.75304526", "0.75167984", "0.7508486", "0.7488416", "0.7488416", "0.7488416", "0.7488416", "0.7432077...
0.8032594
0
Ensure that PipelineSimple accepts a passthrough Estimator.
def test_pipeline_simple_passthrough(): passthrough = make_pipeline(None) pipeline = PipelineSimple(passthrough, Distance()) assert isinstance(pipeline, PipelineSimple) pipeline_with_passthrough = make_pipeline("passthrough") pipeline = PipelineSimple(pipeline_with_passthrough, Distance()) asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, pipeline=PIPELINE, name=\"fake_estimator\"):\n super().__init__(pipeline=pipeline, name=name)", "def test_is_pipeline(model):\n assert type(model) == Pipeline", "def _validate_estimator(self, default=DecisionTreeClassifier()):\n if not isinstance(self.n_estimators, (numbers....
[ "0.63813967", "0.58040303", "0.57488316", "0.5719609", "0.5712581", "0.5660184", "0.5519216", "0.544738", "0.5426395", "0.53335524", "0.5244499", "0.52399343", "0.521549", "0.5213006", "0.51974636", "0.51974636", "0.518712", "0.5172897", "0.5172791", "0.5159455", "0.5157017",...
0.663651
0
Save `request.apple_login_session` and set the cookie
def persist_apple_session(request, response): patch_vary_headers(response, ('Cookie',)) request.apple_login_session.save() response.set_cookie( APPLE_SESSION_COOKIE_NAME, request.apple_login_session.session_key, max_age=None, expires=None, domain=settings.SESSION_COOK...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_apple_session(request):\n session_key = request.COOKIES.get(APPLE_SESSION_COOKIE_NAME)\n request.apple_login_session = SessionStore(session_key)", "def _set_session_cookies(self):\n cookies = dict(platform=\"9\")\n requests.utils.add_dict_to_cookiejar(self._session.cookies, cookies)\n...
[ "0.8380049", "0.6584628", "0.6583051", "0.6459382", "0.6424264", "0.6421192", "0.6399315", "0.6351785", "0.631867", "0.6238499", "0.616325", "0.6138049", "0.6138049", "0.6114666", "0.60982144", "0.6061997", "0.60246456", "0.6010589", "0.5986287", "0.59073067", "0.59055316", ...
0.8371735
1
Sets the module's current context
def context_set(context): global __context if context == DefaultContext: context = context.copy() __context = context
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_context(self, context: Context):\n self.context = context", "def set_context(self, context: Context):\n self.context = context", "def set_context(self, context):\n self._impl.set_context(context)", "def set_ctx(ctx) -> None:\n global _ctx\n _ctx = ctx", "def setCurrent(ctx):\n T...
[ "0.75897396", "0.75897396", "0.7454029", "0.73136735", "0.7275335", "0.72273225", "0.71441203", "0.70889443", "0.70716023", "0.67674625", "0.6766054", "0.66735625", "0.6655374", "0.6392223", "0.6389144", "0.6353126", "0.63520414", "0.6345522", "0.63386655", "0.6321278", "0.62...
0.77538234
0
combine the google host and my own host file segments
def combine_host(): lines = [] for path in [google_hosts, my_hosts]: with open(path, 'r') as f: lines += f.readlines() with open(output_hosts, 'w') as f: f.writelines(line for line in lines)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getHost():", "def getHost():", "def inject_hosts_files(self):\n self.log.info(\"Injecting host files\")\n hosts = dict()\n for i in self.all_nodes:\n hosts[i.name] = i.get_public_addr()\n #add the host names to etc/hosts\n orchestrator.inject_hostnames(hosts, d...
[ "0.6377141", "0.6377141", "0.60996747", "0.56725776", "0.5482434", "0.54674184", "0.544646", "0.53899944", "0.53738177", "0.5321742", "0.531273", "0.53108615", "0.5262711", "0.5242962", "0.5222827", "0.51861906", "0.51795393", "0.5165667", "0.51486313", "0.51284206", "0.51251...
0.67901844
0
Test that a single coef model which has a known value gets there. This is a good round trip test that fitting works.
def test_single_coef_is_about_right(): # going to make a coef be the mean of y df = pd.DataFrame(dict(y=[10, 11, 11, 11, 12] * 10)) expected_coef = onp.log(df.y).mean() class Model(Poisson): dv = "y" features = dict(mu=dict(transformer=1, prior=dist.Normal(0, 5)),) model = Model()....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_single_linear_regression_coefficients(single_linear_regression_model):\n print(single_linear_regression_model)\n expected_coefficients = [(0, 151.27), (1, 303.90)]\n no_of_betas = len(single_linear_regression_model.B)\n for n in range(no_of_betas):\n assert single_linear_regression_mode...
[ "0.7066258", "0.66579646", "0.6640091", "0.6585084", "0.62213373", "0.6178894", "0.61647165", "0.6131486", "0.61213744", "0.610294", "0.60835654", "0.6072188", "0.60574126", "0.60374105", "0.60035616", "0.59609044", "0.59551424", "0.5941344", "0.59323466", "0.5921635", "0.587...
0.68565816
1
Test that predict ci makes sense when init from samples.
def test_predict_ci(): df = pd.DataFrame(dict(x=[1.0, 2.0, 3.0, 4.0])) class Model(Poisson): dv = "y" features = dict(x=dict(transformer=lambda x: x.x, prior=dist.Normal(0, 1))) # ci = yhat when no variation in samples config = {"samples": {"x": onp.ones((2, 10))}} model = Model.fr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_test_model(self):\n\n dataset = ClassificationTestDataset()\n model = ClassificationTestModel(dataset)\n preds = list(model.predict(dataset.examples))\n self.assertEqual(np.argmax(preds[0]['preds']), 2)\n self.assertEqual(np.argmax(preds[1]['preds']), 1)\n self.assertEqual(np.argmax(pred...
[ "0.69585276", "0.6733314", "0.6552993", "0.64890563", "0.63998693", "0.63852644", "0.6354954", "0.633773", "0.62965834", "0.6293923", "0.62681127", "0.6227522", "0.62019694", "0.6188406", "0.6152024", "0.6127309", "0.60814697", "0.6065687", "0.6055566", "0.6049947", "0.603985...
0.75954604
0
Only asset issuer can create a buyback account on that asset
def create_buyback_account(name, asset, buyback_markets): if inst.wallet.locked(): inst.wallet.unlock(TEST_WALLET_PWD) try: ## private key of faucet, which is the referrer inst.wallet.addPrivateKey(private) except Exception as e: pass account = cybex.Account(inst.con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_client_bank_account_create(self):\n pass", "def test_withdraw_interactive_no_asset(client):\n Asset.objects.create(\n code=\"USD\",\n issuer=Keypair.random().public_key,\n sep24_enabled=True,\n withdrawal_enabled=True,\n distribution_seed=Keypair.random().sec...
[ "0.65437835", "0.64588386", "0.6173151", "0.616411", "0.6160695", "0.5980458", "0.5967613", "0.59113014", "0.5902701", "0.5788299", "0.5718812", "0.56919897", "0.56800485", "0.5659643", "0.5634053", "0.5603704", "0.56020176", "0.5587785", "0.55756605", "0.5556012", "0.5555204...
0.72875166
0
Listens for a connection on the socket. Requires that the socket has been created as a server socket action the action to perform when we succeed with receving a connection. The purpose is that it simplifies threading this sort of connection. Defaults to none what this means is that if action is none, then it returns t...
def accept(self, action = None): if not self.is_server: raise socket.error("""Is not a server, yet was requested to accept a connection""") conn, address = self.socket.accept() if action == None: return conn, address else: return action(conn, address)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listen(self):\r\n self.theSocket.listen(0)\r\n print('Socket now listening')\r\n \r\n #wait to accept a connection - blocking call\r\n self.conn, self.addr = self.theSocket.accept()\r\n\r\n print('Connected with ' + self.addr[0] + ':' + str(self.addr[1]))\r\n return se...
[ "0.5802178", "0.57796913", "0.57591057", "0.57533956", "0.5553255", "0.5524077", "0.5501844", "0.5501828", "0.54559964", "0.5430505", "0.5368974", "0.53231925", "0.5298487", "0.52961886", "0.5280743", "0.5224718", "0.5209123", "0.52029395", "0.5176586", "0.51704335", "0.51640...
0.73033816
0
Sends data to the connection object specified. This assumes that the data being sent is a string. data = the data to send conn the connection to which to send the data. Defaults to none. If the socket is a server socket, then the conn must be specified. Otherwise, if it is a client socket, then you do not need to speci...
def SendData(self, data, conn = None, is_string = True): if self.is_server == False: if self.socket_connected: conn = self.socket else: raise Exception("Socket not connected to anything") else: if conn == None: raise AttributeError("conn was not specified") # THis works regardless of bnrary ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self,data):\n\t\ttry:\n\t\t\tif len(self.protocol) > 1:\n\t\t\t\tfor protocol in reversed(self.protocol[1:]):\n\t\t\t\t\tdata = protocol.encode(data)\n\t\t\tself.protocol[0].sendTcpSocket(data, self.socket)\n\t\texcept protocols.ProtocolIsNotRespectedError as e:\n\t\t\traise CouldNotSendRequestError(\"\",...
[ "0.7408721", "0.71802217", "0.7009695", "0.6950158", "0.69285613", "0.69199157", "0.69185364", "0.68751067", "0.6843507", "0.68276286", "0.67259634", "0.67259634", "0.66607696", "0.66567206", "0.6641494", "0.66390383", "0.6626491", "0.65316415", "0.65107626", "0.65037495", "0...
0.81418407
0
Receives the data from the socket. If this is a server, then the connection object needs to be specified, otherwise not. conn Connection object is_string is a string being returned expected? IF yes (default), then we decode it usnig utf8, otherwise we just return the binary format
def ReceiveData(self, conn = None, is_string = True): if self.is_server == False: if self.socket_connected: conn = self.socket else: raise IOError("Socket not connected to anything") else: if conn == None: raise AttributeError("connection was not specified for server \ socket") # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive(self):\n\t\ttry:\n\t\t\tdata = self.protocol[0].readTcpSocket(self.socket)\n\t\t\tif len(self.protocol) > 1:\n\t\t\t\tfor protocol in self.protocol[1:]:\n\t\t\t\t\tdata = protocol.decode(data)\n\t\t\t\n\t\t\treturn data\n\t\texcept protocols.ProtocolIsNotRespectedError as e:\n\t\t\traise ClientIsNotFin...
[ "0.6695462", "0.6610027", "0.6602054", "0.6484952", "0.64821315", "0.6459727", "0.6337745", "0.62717086", "0.62467384", "0.6211548", "0.6156342", "0.6123808", "0.6119324", "0.6111965", "0.61112666", "0.6106142", "0.6104824", "0.610239", "0.60815156", "0.60350895", "0.6029807"...
0.8083795
0
Spawn a completely detached subprocess (i.e., a daemon).
def spawn(cmd, cwd=None): # FROM: http://stackoverflow.com/questions/972362/spawning-process-from-python # fork the first time (to make a non-session-leader child process) try: pid = os.fork() except OSError as e: raise RuntimeError("1st fork failed: %s [%d]" % (e.strerror, e.errno)) if pid != 0: # parent (c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subprocess_nowait(cmd, shell=False, cwd=None, env=None):\n # type: (str, bool, str, dict) -> subprocess.Process\n return subprocess.Popen(cmd, shell=shell, cwd=cwd, env=env)", "def start_detached(executable, *args):\n\n # create pipe\n reader, writer = multiprocessing.Pipe(False)\n\n # do not ...
[ "0.65081984", "0.64860094", "0.64005446", "0.6307431", "0.62583023", "0.6249705", "0.6218802", "0.6123705", "0.59959793", "0.5934835", "0.5878198", "0.5861662", "0.5843064", "0.58336747", "0.5810439", "0.5771761", "0.5712478", "0.57103586", "0.5698256", "0.5694017", "0.568182...
0.7340411
0
Sets up the signals, registering the shutdown function. You only need to call this function once.
def setup(self): if self.hasSignalModule and not self.signalsRegistered: # Jython does not support all signals, so we only use # the available ones signals = ['SIGINT', 'SIGHUP', 'SIGABRT', 'SIGQUIT', 'SIGTERM'] import signal for sig in signals: try: signal.signal(getattr(signal, sig), self._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_signals(self):\n if os.name == 'nt':\n return\n\n def shutdown_handler(signo):\n log.info('Shutting down on signal %d' % signo)\n self.shutdown_event.set()\n\n loop = asyncio.get_event_loop()\n for sig in [signal.SIGTERM, signal.SIGINT]:\n ...
[ "0.8295706", "0.7300164", "0.7189461", "0.7099282", "0.7061593", "0.7060268", "0.697218", "0.69481", "0.6871097", "0.6867708", "0.6818201", "0.6685268", "0.66491747", "0.6644087", "0.6587293", "0.65477955", "0.64574736", "0.6453766", "0.64116114", "0.64092827", "0.6373524", ...
0.7989966
1
Safely executes the callbacks registered in self.onShutdown.
def _shutdown(self, *args): for callback in self.onShutdown: try: callback() except: pass sys.exit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_shutdown(self) -> None:\n pass", "def shutdown_callback():\n pass", "def _shutdown(self):", "def shutdown() -> None: # TODO Better place for this code\n # TODO Safe landing\n pass", "def __shutdown(self):\n\n pass", "def shutdown(self) -> None:", "def shutdown(sel...
[ "0.7584504", "0.74116313", "0.73457164", "0.7340843", "0.722383", "0.7183227", "0.7183227", "0.7132943", "0.7111738", "0.7111738", "0.7111738", "0.7109204", "0.70507973", "0.69756496", "0.6952843", "0.686682", "0.6792409", "0.6786117", "0.675424", "0.67334414", "0.67334414", ...
0.7943544
0
Returns a map of pid to cmdline
def List(cls): res = {} for p in glob.glob("/proc/*/cmdline"): process = p.split("/")[2] if cls.RE_PID.match(process): res[int(process)] = cat(p).replace("\x00", " ") return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_cmdline(pid_info):\n\tif pid_info[\"cmdline\"]:\n\t\treturn reduce(lambda a, b: a + \" %s\" % b, pid_info[\"cmdline\"]).strip()\n\n\treturn pid_info[\"stat\"][\"comm\"]", "def kernel_cmdline():\n cmdline_path = Path('/proc/cmdline')\n cmdline_matches = re.compile(r\"([\\w\\-\\.]+)(\\=(\\\"[\\w\...
[ "0.7138014", "0.70559645", "0.67759454", "0.6739408", "0.67099035", "0.6702948", "0.66869664", "0.6607563", "0.6333675", "0.6305416", "0.61211395", "0.6057632", "0.58799875", "0.58270264", "0.58204144", "0.57767946", "0.57622665", "0.5732487", "0.5718589", "0.569906", "0.5687...
0.723253
0
Returns a list of all processes that contain the expression in their command line.
def GetWith(cls, expression, compare=(lambda a, b: fnmatch.fnmatch(a, b))): res = [] expression = "*" + expression + "*" for pid, cmdline in cls.List().items(): if compare(cmdline, expression): res.append(pid) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_matches_commandline(self, match_pattern):\n\n matches = []\n for _process in self.processes:\n if re.search(match_pattern, _process[\"cmd\"]):\n matches.append(_process[\"pid\"])\n return matches", "def get_matches_commandline_with_children(self, match_patte...
[ "0.724429", "0.6745634", "0.6521001", "0.65186083", "0.64543986", "0.63966167", "0.6381507", "0.6347461", "0.6333883", "0.624487", "0.6206657", "0.61817014", "0.611455", "0.60992646", "0.6089617", "0.6049026", "0.60024923", "0.5914601", "0.5906781", "0.5885109", "0.5863753", ...
0.67701876
1
Returns the memory usage (between 0.0 and 1.0) on this system, which is total memory free memory cached memory.
def MemoryUsage(cls): meminfo = cls.MemoryInfo() return (meminfo["MemTotal"] - meminfo["MemFree"] - meminfo["Cached"]) / float(meminfo["MemTotal"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mem_usage():\n return process.memory_info().rss / 1024.**2", "def get_current_mem_usage():\n process = psutil.Process()\n return process.memory_info().rss / float(2**20)", "def get_total_mem(self):\n return self.total_mem", "def memory_usage():\n\n # Handle optional psutil support\...
[ "0.8351866", "0.80991274", "0.80778897", "0.80132693", "0.7924828", "0.7865128", "0.7654336", "0.7642362", "0.763168", "0.7580143", "0.7578932", "0.7561593", "0.75514424", "0.7491898", "0.7461666", "0.743066", "0.7418507", "0.74144953", "0.7410928", "0.7373577", "0.73711276",...
0.8610762
0
Returns a dictionary 'device' > 'percentage' representing the usage of each device. A percentage of 1.0 means completely used, 0.0 means unused.
def DiskUsage(cls): # >> df -iP # Sys. de fich. Inodes IUtil. ILib. IUti% Monte sur # /dev/sda1 915712 241790 673922 27% / # none 210977 788 210189 1% /dev # none 215028 19 215009 1% /dev/shm # none 215028 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_metric(self):\n device_dict = {}\n # Delete first and last line of output of adb.\n output = self._shell.run(self.COMMAND).stdout\n\n # Example Line, Device Serial Num TAB Phone Status\n # 00bd977c7f504caf\toffline\n if output:\n for line in output.sp...
[ "0.7035691", "0.6535997", "0.64914197", "0.6477389", "0.6307393", "0.6220605", "0.62193364", "0.61979455", "0.6187674", "0.60996705", "0.6073188", "0.6046488", "0.60337204", "0.60219747", "0.6017763", "0.60095817", "0.60071844", "0.60071504", "0.5995868", "0.59924835", "0.596...
0.66442657
1
This function allows to run a command and retrieve its output as given by the shell. It is quite error prone, as it will include your prompt styling and will only poll the output at `resolution` seconds interval.
def Run( self, session, name, command, timeout=10, resolution=0.5): self.EnsureWindow(session, name) delimiter = "CMD_" + timenum() delimier_cmd = "echo " + delimiter output = None found = False self.Write(session, name, command + ";" + delimier_cmd) for i in range(int(timeout / resolution...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_command(command):\n process = subprocess.Popen(command, stdout=subprocess.PIPE)\n while True:\n output = process.stdout.readline()\n if output == '' and process.poll() is not None:\n break\n if output:\n print output.strip()\n\n rc = process.poll()\n r...
[ "0.5911372", "0.57924676", "0.5751892", "0.5747421", "0.5726285", "0.56923586", "0.5636839", "0.56134343", "0.5585743", "0.55203485", "0.55117524", "0.5507503", "0.5483744", "0.54810786", "0.5479471", "0.54742265", "0.5449044", "0.5430807", "0.5422019", "0.538684", "0.5377343...
0.7113203
0
Creats a new monitor with the given services.
def __init__(self, *services): self.services = [] self.isRunning = False self.freq = self.FREQUENCY self.logger = Logger(prefix="monitoring ") self.iteration = 0 self.iterationLastDuration = 0 self.runners = {} self.react...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _start_service_monitor(cls):\n cls.service_monitor = Monitor()\n await cls.service_monitor.start()", "def test_monitor_creation(processor, measure, dialog_sleep):\n def run(measure):\n t = Thread(target=processor._start_monitors, args=(measure,))\n t.start()\n whil...
[ "0.6231818", "0.5978018", "0.5455513", "0.537251", "0.5356045", "0.5354765", "0.5333208", "0.53259355", "0.52815604", "0.5248883", "0.5216355", "0.5188205", "0.516593", "0.51612884", "0.51561", "0.5150128", "0.5118755", "0.5073659", "0.5059035", "0.5032901", "0.5004443", "0...
0.5995564
1
Adds a service to this monitor.
def addService(self, service): self.services.append(service) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_service(self, service):\n self.app.add_service(service)", "def add(self, service: AbstractService):\n self.services.append(service)", "def add_service(self, service):\n # type: (LoadBalancerService) -> List[BoundAction]\n return self._client.add_service(self, service=service...
[ "0.80821586", "0.7987084", "0.685212", "0.68057656", "0.6668222", "0.66574085", "0.65656537", "0.6504233", "0.64844793", "0.64105064", "0.62977153", "0.6267034", "0.6264967", "0.62021554", "0.61958724", "0.6160605", "0.6159013", "0.6119961", "0.6046924", "0.60298496", "0.5988...
0.8156033
0
Callback bound to 'Runner.onRunEnded', trigerred once a rule was executed. If the rule failed, actions will be executed.
def onRuleEnded(self, runner): rule = runner.runable service = runner.context iteration = runner.iteration if isinstance(runner.result, Success): if rule.success: for action in rule.success: action_object = service.getAction(action) action_runner = self.getRunnerForAction(rule, action_ob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, monitor, service, rule, runner):\n\t\tif not self.errorValues:\n\t\t\tself.errorStartTime = now()\n\t\telapsed_time = now() - self.errorStartTime\n\t\tself.errorValues.append(runner.result)\n\t\tif len(self.errorValues) >= self.errors and elapsed_time >= self.during:\n\t\t\tself.errorValues = []\n\t\...
[ "0.57482636", "0.5732967", "0.5703071", "0.56963694", "0.56578094", "0.54600453", "0.53609776", "0.53503144", "0.53288025", "0.53150815", "0.5278396", "0.52287364", "0.5220795", "0.5219662", "0.52042973", "0.5180013", "0.5178494", "0.5150679", "0.51421547", "0.5127896", "0.51...
0.8147479
0
Creates a runner for the given runable, making sure that it won't be started twice, raising `RunnerStillRunning` or `RunnerThreadPoolFull` in case of problems.
def _createRunner(self, runable, context, iteration, callback, runableId=None): # FIXME: we should prefix the ID with the Rule name, if any if runableId is None: runable_id = str(runable) else: runable_id = runableId if runable_id in self.runners: runner = self.runners[runable_id] raise RunnerStillR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_runner(config):\n if not isinstance(config, dict) or 'runner_type' not in config:\n raise ValueError('`runner_type` is missing from configuration!')\n\n runner_type = config['runner_type']\n if runner_type not in _RUNNERS:\n raise ValueError(f'Invalid runner type: `{runner_type}`!\...
[ "0.6116232", "0.5671745", "0.55419755", "0.5322775", "0.5294464", "0.5277626", "0.52052486", "0.51895684", "0.5137776", "0.512386", "0.51224935", "0.5079341", "0.50167185", "0.50001633", "0.49851686", "0.49478084", "0.48973316", "0.48973316", "0.4871663", "0.47800362", "0.476...
0.81946373
0
Change current directory to the BAM folder.
def chdir(self) -> None: os.chdir(self.analysis.get_bam_dir())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_dir(path): \r\n os.chdir(path)", "def change_directory(path):\n os.chdir(path)", "def change_to_current_path(to_change_path):\n os.chdir(to_change_path)", "def changeDirectory(self, directory):\n self._cwd = directory", "def changeDirectory( self, directory ):\n if directory...
[ "0.6842324", "0.68245375", "0.6540224", "0.6418225", "0.64076173", "0.6394437", "0.6312923", "0.62694526", "0.61634445", "0.6128334", "0.60120696", "0.5997329", "0.5928512", "0.5898889", "0.5894457", "0.5852728", "0.58420885", "0.58262247", "0.58216995", "0.5811096", "0.57907...
0.79141164
0
Run Novoalign aligner. The output statistics are collected into two CSVs. At to date, Novoalign can be used to run whole exome and gene panel data alignment.
def novoalign(self) -> None: self.analysis.logger.info("Running alignment with NovoAlign") self.chdir() config = self.analysis.config executor = Executor(self.analysis) barcoded = BarcodedFilename.from_sample(self.analysis.sample) with tempfile.TemporaryDirectory(dir=conf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def align(filename, prog, outfile):\n ra = RunAlign()\n ra.run_align(filename, prog, outfile)", "def miraligner(args):\n hairpin, mirna = _download_mirbase(args)\n precursors = _read_precursor(args.hairpin, args.sps)\n matures = _read_mature(args.mirna, args.sps)\n gtf = _read_gtf(args....
[ "0.59536856", "0.589596", "0.58075494", "0.57275957", "0.57055616", "0.5630772", "0.5579988", "0.55275583", "0.5510898", "0.54892343", "0.5487643", "0.54507923", "0.54309165", "0.5415767", "0.5401512", "0.536341", "0.53431696", "0.5342528", "0.53253406", "0.5321803", "0.53120...
0.7759726
0
Run the BWA aligner.
def bwa(self) -> None: self.analysis.logger.info("Running alignment with BWA") self.chdir() config = self.analysis.config executor = Executor(self.analysis) executor( f"{config.bwa} mem -t 6 -L 5,10 -v 1 {{genome_ref}} " f"{{input_filename}}> {{output_file...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(config=None):\n AlignmentWorkflow().run(config)", "def run(self):\n contig_file = self.data.contigfiles[0]\n reads = self.data.readfiles\n\n ## Index contigs using IS algorithm\n prefix = os.path.join(self.outpath, 'bt2')\n cmd_args = [self.build_bin, '-f', contig_fi...
[ "0.68714815", "0.6850207", "0.67499906", "0.64364415", "0.63678634", "0.6341019", "0.6308213", "0.62959635", "0.6248676", "0.6077852", "0.5976404", "0.5954463", "0.59360886", "0.5904422", "0.58446455", "0.5843686", "0.58432174", "0.57990974", "0.5704627", "0.56826895", "0.567...
0.8238711
0
Run STAR to perform alignment of RNAseq data. STAR uses a multistep procedure to perform the alignment. Indeed, this function is more complex than the other aligner functions.
def star(self) -> None: self.analysis.logger.info("Running alignment with STAR") config = self.analysis.config executor = Executor(self.analysis) bam_directory = self.analysis.get_bam_dir() def create_dirs(*args: str, **kwargs: str) -> None: output_path = os.path.jo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(args):\n # args = args_init(vars(get_args()), align=True)\n\n log.info('running RNAseq pipeline')\n\n ## default arguments, for RNAseq2 only\n args['align_to_rRNA'] = True\n\n ## multireads should not be discarded\n ## https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4728800/\n ## Genome B...
[ "0.6631471", "0.6505842", "0.63943124", "0.6373514", "0.6364657", "0.63586855", "0.6308384", "0.6274574", "0.62547904", "0.62098163", "0.61298877", "0.6114103", "0.60965884", "0.60760087", "0.6052162", "0.603462", "0.601626", "0.6009297", "0.60070413", "0.599775", "0.59743017...
0.7389102
0
Sort BAM files using Picard. Picard SortSam and Picard ReorderSam are used. A temporary directory is used during the process, and it is cleaned up at the end.
def sort_bam(self) -> None: self.analysis.logger.info("Sorting BAM(s)") self.chdir() config = self.analysis.config os.makedirs(self.sort_tempdir, exist_ok=True) executor = Executor(self.analysis) executor( f"{config.java} {config.picard_jvm_args} -jar {confi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_bam(self, bam_in, bam_sorted_out):\n self.cmd(\"{picard_cmd}/SortSam.jar\\\n INPUT='{bam_in}'\\\n OUTPUT='{bam_sorted_out}'\\\n SORT_ORDER=coordinate CREATE_MD5_FILE=false\\\n CREATE_INDEX=false MAX_RECORDS_IN_RAM=5000000\\\n ...
[ "0.7317769", "0.65501356", "0.6349503", "0.600744", "0.598181", "0.5862215", "0.58174586", "0.57711077", "0.569185", "0.56206137", "0.5619016", "0.55896354", "0.55008554", "0.54742914", "0.53913575", "0.5291367", "0.52688575", "0.52431387", "0.52332854", "0.52258295", "0.5215...
0.76202744
0
Split data into different phases based on time intervals. The start and end times of the phases are prodivded via the ``time_intervals`` parameter and can either be a
def split_data( data: pd.DataFrame, time_intervals: Union[pd.DataFrame, pd.Series, Dict[str, Sequence[str]]], include_start: Optional[bool] = False, ) -> Dict[str, pd.DataFrame]: _assert_is_dtype(time_intervals, (pd.DataFrame, pd.Series, dict)) if isinstance(time_intervals, pd.DataFrame): i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _intervals(parts, duration) -> list:\n part_duration = duration / parts\n return [(floor(i * part_duration), floor((i + 1) * part_duration)) for i in range(parts)]", "def time_slice(time_intervals, n=10):\n time_format = 'HH:mm:ss'\n total_time = timedelta(0)\n for (start_t...
[ "0.5885945", "0.57779735", "0.5727429", "0.572657", "0.5536598", "0.54832613", "0.538261", "0.5320827", "0.53111655", "0.53028107", "0.52807975", "0.51883584", "0.51390094", "0.511727", "0.51077217", "0.5067505", "0.5042173", "0.5028445", "0.50167", "0.5016492", "0.4979177", ...
0.59032506
0
Exclude subjects from dataframes.
def exclude_subjects( excluded_subjects: Union[Sequence[str], Sequence[int]], index_name: Optional[str] = "subject", **kwargs ) -> Union[pd.DataFrame, Dict[str, pd.DataFrame]]: cleaned_data: Dict[str, pd.DataFrame] = {} for key, data in kwargs.items(): _assert_is_dtype(data, pd.DataFrame) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_missing_subjects(subjects,task,atlas):\n\tsubjects = list(subjects)\n\tfor subject in subjects:\n\t\tfiles = glob.glob('/home/despoB/mb3152/dynamic_mod/%s_matrices/%s_%s_*%s*_matrix.npy'%(atlas,subject,atlas,task))\n\t\tif len(files) < 2:\n\t\t\tsubjects.remove(subject)\n\treturn subjects", "async def...
[ "0.62790495", "0.58519125", "0.5779056", "0.5540687", "0.5495042", "0.5485879", "0.5485477", "0.53683954", "0.5362112", "0.52891755", "0.52814394", "0.52536", "0.52487105", "0.5219216", "0.51930887", "0.519197", "0.51879984", "0.5175325", "0.5165898", "0.5106164", "0.50711274...
0.6350209
0
Normalize time series data per subject to the phase specified by ``normalize_to``. The result is the relative change (of, for example, heart rate) compared to the mean value in ``phase``.
def normalize_to_phase(subject_data_dict: SubjectDataDict, phase: Union[str, pd.DataFrame]) -> SubjectDataDict: _assert_is_dtype(phase, (str, pd.DataFrame)) dict_subjects_norm = {} for subject_id, data in subject_data_dict.items(): bl_mean = data[phase].mean() if isinstance(phase, str) else phase.me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_emission(self):\n self._e /= self._e.sum(0)", "def _renorm(self, to='peak'):\n if to.lower() == 'peak':\n self.data /= self.data.max()\n elif to.lower() == 'total':\n ttl = self.data.sum()\n self.data /= ttl\n return self", "def normali...
[ "0.55861294", "0.55803686", "0.5562258", "0.55561143", "0.5529962", "0.5520992", "0.54562175", "0.5429541", "0.538229", "0.53683954", "0.53380233", "0.525988", "0.5259841", "0.5237051", "0.5225347", "0.5174676", "0.51621884", "0.51490784", "0.5145356", "0.51451355", "0.513570...
0.66805947
0
Resample all data in the dictionary to 1 Hz data. This function recursively looks for all dataframes in the dictionary and resamples data to 1 Hz using
def resample_dict_sec( data_dict: Dict[str, Any], ) -> Dict[str, Any]: result_dict = {} for key, value in data_dict.items(): if isinstance(value, (pd.DataFrame, pd.Series)): result_dict[key] = resample_sec(value) elif isinstance(value, dict): result_dict[key] = resamp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resample(self, dataframes, freq='5s'):\n\n for df in dataframes:\n yield df.resample(freq, fill_method='bfill')", "def resample(data, resample_rate=16000):\n for sample in data:\n assert \"sample_rate\" in sample\n assert \"wav\" in sample\n sample_rate = sample[\"sa...
[ "0.67451787", "0.6404874", "0.6007783", "0.57603705", "0.56952775", "0.56782204", "0.56607044", "0.5642602", "0.56016624", "0.5583797", "0.55751604", "0.55430216", "0.54909056", "0.5460196", "0.5451945", "0.53688246", "0.53585273", "0.53539455", "0.5352452", "0.528387", "0.52...
0.6414204
1
Rearrange ``SubjectDataDict`` to ``StudyDataDict``.
def rearrange_subject_data_dict( subject_data_dict: SubjectDataDict, ) -> StudyDataDict: dict_flipped = {} phases = [np.array(dict_phase.keys()) for dict_phase in subject_data_dict.values()] if not all(phases[0] == p for p in phases): raise ValueError( "Error rearranging the dictiona...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_to_phase(subject_data_dict: SubjectDataDict, phase: Union[str, pd.DataFrame]) -> SubjectDataDict:\n _assert_is_dtype(phase, (str, pd.DataFrame))\n dict_subjects_norm = {}\n for subject_id, data in subject_data_dict.items():\n bl_mean = data[phase].mean() if isinstance(phase, str) else...
[ "0.5630852", "0.5586428", "0.5411687", "0.5391781", "0.52407944", "0.5204471", "0.51992005", "0.51751816", "0.5043062", "0.50272477", "0.49770683", "0.49545488", "0.49416718", "0.49311018", "0.4924573", "0.48780003", "0.48712677", "0.4832812", "0.47907513", "0.47803688", "0.4...
0.8210645
0
Split dataframes in a nested dictionary into subphases. By further splitting a dataframe into subphases a new dictionary level is created. The new dictionary level then contains the subphases with their data.
def split_dict_into_subphases( data_dict: Dict[str, Any], subphases: Dict[str, int], ) -> Union[Dict[str, Dict[str, Any]]]: result_dict = {} for key, value in data_dict.items(): _assert_is_dtype(value, (dict, pd.DataFrame)) if isinstance(value, dict): # nested dictionary ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_clean_up(dict_of_dfs, outdir):\n # rvs_to_be_shared = id_mapping['SUBJECT_NUMBER'].tolist()\n for key, df in dict_of_dfs.items():\n for ind, subjnum in df['participant_id'].items():\n if subjnum in rvs_to_be_shared:\n onid = openneuro_id_lookup(subjnum)\n ...
[ "0.55582225", "0.5474581", "0.54479736", "0.5430998", "0.5342163", "0.51849264", "0.5164841", "0.50900674", "0.5063155", "0.49475574", "0.49430624", "0.49093482", "0.48975477", "0.48972487", "0.48958534", "0.4890863", "0.4870722", "0.4865262", "0.48596045", "0.48565897", "0.4...
0.74328685
0
Compute subphase durations from dataframe.
def get_subphase_durations( data: pd.DataFrame, subphases: Dict[str, Union[int, Tuple[int, int]]] ) -> Sequence[Tuple[int, int]]: subphase_durations = np.array(list(subphases.values())) if subphase_durations.ndim == 1: # 1d array => subphase values are integer => they are consecutive and each entry ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(df):", "def get_duration(data):\n try:\n start_time = data.Time.min()\n end_time = data.Time.max()\n duration = end_time-start_time\n print(duration)\n return duration\n except AttributeError:\n logging.error(\"The dataframe needs to have a ...
[ "0.6359399", "0.5513919", "0.55088645", "0.5453176", "0.5433182", "0.54035217", "0.5381439", "0.53610665", "0.53600776", "0.5347001", "0.5300298", "0.527669", "0.5253655", "0.52508795", "0.52302164", "0.5203829", "0.51903045", "0.51666254", "0.5158617", "0.515164", "0.5138120...
0.7378062
0
Add subject conditions to dataframe. This function expects a dataframe with data from multiple subjects and information on which subject belongs to which condition.
def add_subject_conditions( data: pd.DataFrame, condition_list: Union[SubjectConditionDict, SubjectConditionDataFrame] ) -> pd.DataFrame: if is_subject_condition_dataframe(condition_list, raise_exception=False): condition_list = condition_list.groupby("condition").groups is_subject_condition_dict(co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_subject(csv_data, subj, timepoint, orged, orgedwhen, orgedby, conved,\n convedwhen, convedby, notes):\n row = pd.DataFrame([dict(Subject=subj, Timepoint=timepoint,\n Organized=orged, Date_Organized=orgedwhen,\n Organized_by=orgedby, ...
[ "0.6055512", "0.5989544", "0.5682403", "0.52098304", "0.51304835", "0.50524604", "0.50286967", "0.4987363", "0.48902005", "0.48844796", "0.48715445", "0.4832613", "0.48076314", "0.47968623", "0.47670686", "0.475864", "0.4755521", "0.4753828", "0.47507262", "0.4747092", "0.468...
0.8123533
0
Split dictionary with data based on conditions subjects were assigned to. This function adds a new outer dictionary level with the different conditions as keys and dictionaries belonging to the conditions as values. For that, it expects a dictionary with data from multiple subjects and information on which subject belo...
def split_subject_conditions( data_dict: Dict[str, Any], condition_list: Union[SubjectConditionDict, SubjectConditionDataFrame] ) -> Dict[str, Dict[str, Any]]: if is_subject_condition_dataframe(condition_list, raise_exception=False): condition_list = condition_list.groupby("condition").groups is_sub...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_subject_conditions(\n data: pd.DataFrame, condition_list: Union[SubjectConditionDict, SubjectConditionDataFrame]\n) -> pd.DataFrame:\n if is_subject_condition_dataframe(condition_list, raise_exception=False):\n condition_list = condition_list.groupby(\"condition\").groups\n is_subject_condi...
[ "0.62274104", "0.5728521", "0.565983", "0.5328839", "0.52684236", "0.52551615", "0.523671", "0.5201086", "0.51276004", "0.5025225", "0.5020071", "0.49670416", "0.4936463", "0.49328497", "0.4894246", "0.487451", "0.485842", "0.47858498", "0.47453144", "0.47383294", "0.47379956...
0.7597523
0
Compute mean values of timeseries data from a nested dictionary. This function computes the mean value of timeseries data in a nested dictionary per subject and combines it into a joint dataframe. The dictionary will be traversed recursively and can thus have arbitrary depth. The most inner level must contain dataframe...
def mean_per_subject_dict(data: Dict[str, Any], dict_levels: Sequence[str], param_name: str) -> pd.DataFrame: result_data = {} one_col_df = False for key, value in data.items(): _assert_is_dtype(value, (dict, pd.DataFrame)) if isinstance(value, dict): if len(dict_levels) <= 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summaries(e_dict, m_dict):\n for key, value in m_dict.items():\n e_dict[key].append(np.mean(value))\n return e_dict", "def mean(data, *args, **kwargs):\n result = OrderedDict()\n for observation_label, variant_values in data.items():\n result[observation_label] = OrderedDict()\n ...
[ "0.5395817", "0.5221981", "0.5202681", "0.5069268", "0.49729764", "0.49403316", "0.4933469", "0.49204287", "0.48544163", "0.48020253", "0.47750285", "0.47672513", "0.47263125", "0.471719", "0.4616093", "0.45999834", "0.4574128", "0.45722482", "0.45510054", "0.45377666", "0.45...
0.7767595
0
List containerd containers in the evidence.
def list_containers(self, evidence, _, detailed_output=False): config.LoadConfig() containers = None image_path = evidence.mount_path outputfile = tempfile.mkstemp()[1] list_cmd = [ 'sudo', CE_BINARY, '--support-container-data', CE_SUPPORT_FILE, '--output', 'json', '--output-file', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def containers_list(self) -> Sequence[str]:\n return pulumi.get(self, \"containers_list\")", "def containers_list(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:\n return pulumi.get(self, \"containers_list\")", "def container_list(ctx, token, all):\n try:\n out = ctx.obj.container_l...
[ "0.7567737", "0.7418695", "0.7208736", "0.7081523", "0.70775867", "0.70462155", "0.7039902", "0.70334166", "0.6910645", "0.67857593", "0.66140467", "0.65889025", "0.6583619", "0.6574067", "0.65617037", "0.65437424", "0.6533605", "0.64996105", "0.646002", "0.64599824", "0.6443...
0.7606816
0
Split the ticker into [{provider_code}, {external_fetch_ticker}].
def SplitTicker(self): try: s1, s2 = self.Text.split(TickerFull.DelimiterSplit, 1) return TickerProviderCode(s1), TickerFetch(s2) except: # pragma: nocover # Probably should not get here. raise InvalidTickerError('{0} is not a valid full ticker; cannot be...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_ticker_full(ticker_provider, ticker_fetch):\n ticker_str = '{0}{1}{2}'.format(str(ticker_provider), TickerFull.DelimiterSplit, str(ticker_fetch))\n return TickerFull(ticker_str)", "def splitTrackingNums(_pack):\n multi = [ i.strip() for i in _pack[1].split(';') ]\n splits_ = [ [_pa...
[ "0.60701865", "0.55334824", "0.5520768", "0.55081236", "0.54777086", "0.5443896", "0.5402258", "0.53239465", "0.5323179", "0.5320861", "0.5285653", "0.5166973", "0.5140324", "0.51261055", "0.50867707", "0.50737786", "0.5048258", "0.50281125", "0.50181675", "0.5016223", "0.500...
0.71501243
0
Current rules. (1) Cannot qualify as a "full ticker" (not TickerFull.DelimiterSplit ("@") (2) Contains at least one DelimiterData character.
def IsValid(self): return (TickerFull.DelimiterSplit not in self.Text) and (TickerDataType.DelimiterData in self.Text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsValid(self):\n return not TickerFull.DelimiterSplit in self.Text", "def SplitTicker(self):\n try:\n s1, s2 = self.Text.split(TickerFull.DelimiterSplit, 1)\n return TickerProviderCode(s1), TickerFetch(s2)\n except: # pragma: nocover\n # Probably should ...
[ "0.72174716", "0.6289906", "0.6108421", "0.5931112", "0.5899332", "0.58988327", "0.58842844", "0.5764209", "0.5760756", "0.5725195", "0.5691706", "0.545364", "0.5429165", "0.5410597", "0.54058605", "0.5336319", "0.5330695", "0.5298495", "0.5258216", "0.5256183", "0.5255183", ...
0.71043557
1
Convert a raw string object into a ticker class object. Should be called against strings supplied from the public interface functions; internal code sticks to the correct objects. The testing hierarchy is asfollows. (1) If it qualifies as a full ticker, return TickerFull (2) Try to see if it is a datatype ticker. (3) I...
def map_string_to_ticker(ticker): # Force to a string. ticker = str(ticker) if len(ticker) == 0: raise InvalidTickerError('Tickers cannot be empty strings') try: return TickerFull(ticker) except InvalidTickerError: try: return TickerDataType(ticker) except...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_to_ticker(self, raw_ticker: HitbtcRawTickerModel) -> HitbtcTickerModel:\n\n symbol = raw_ticker[\"symbol\"]\n low = Decimal(raw_ticker[\"low\"])\n high = Decimal(raw_ticker[\"high\"])\n volume = Decimal(raw_ticker[\"volume\"])\n volume_quote = Decimal(raw_ticker[\"volumeQ...
[ "0.5828706", "0.5503655", "0.53274155", "0.530303", "0.5287685", "0.5246245", "0.5240407", "0.5218475", "0.52168626", "0.519134", "0.5127857", "0.509924", "0.50954086", "0.49722198", "0.49697196", "0.491803", "0.49102783", "0.48899898", "0.487651", "0.48478815", "0.48348337",...
0.73018396
0
Create a TickerFull object from provider and fetch ticker.
def create_ticker_full(ticker_provider, ticker_fetch): ticker_str = '{0}{1}{2}'.format(str(ticker_provider), TickerFull.DelimiterSplit, str(ticker_fetch)) return TickerFull(ticker_str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTicker(self):\n\t\tif self.poll_reqq is None or self.poll_rspq is None:\n\t\t\treturn\n\n\t\treq = {\"cmd\" : \"get ticker\"}\n\t\tself.poll_reqq.put(req)\n\t\tticker = self.poll_rspq.get(timeout=self.q_get_tov)\n\n\t\t#debug\n\t\t# self.logger.debug(\"ticker=%s\" % str(ticker))\n\n\t\treturn ticker", "de...
[ "0.6334015", "0.6110266", "0.5972628", "0.5940193", "0.5928329", "0.5725993", "0.5714212", "0.56328416", "0.56137896", "0.56051505", "0.560471", "0.5585715", "0.5583772", "0.55598813", "0.54572064", "0.54513955", "0.5421436", "0.54154223", "0.5407971", "0.53938043", "0.535978...
0.76617813
0
r"""Loads checkpoint. ``UnicodeDecodeError`` can be well handled, which means python2saved files can be read from python3.
def load_checkpoint(fpath): if fpath is None: raise ValueError('File path is None') if not osp.exists(fpath): raise FileNotFoundError('File is not found at "{}"'.format(fpath)) map_location = None if torch.cuda.is_available() else 'cpu' try: checkpoint = torch.load(fpath, map_loc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_checkpoint(self, session, model_dir):\n assert self.params.cp_load == True, (\"cp_load must be set to true to load a checkpoint\")\n self.loader.restore(session, model_dir)", "def load_checkpoint(self):\n checkpoin_path = self.get_checkpoint_path()\n _logger.info('Load checkpoint ign...
[ "0.6807381", "0.65758497", "0.6548997", "0.65318584", "0.6531739", "0.651706", "0.6499114", "0.64484894", "0.63787794", "0.63693464", "0.6312106", "0.6312106", "0.62639415", "0.6260744", "0.6255464", "0.6248616", "0.6239228", "0.6230579", "0.6200315", "0.61973906", "0.619435"...
0.7136253
0
Retrieves data from the given exchange, and returns it as an array of CurrencyPairStates.
def get_data_from_exchange(self, now): currency_options = dict( currency_pair='USD', bid={12.00 : {'guy_1' : 100.00}}, ask={14.00 : {'guy_2' : 200.00}}, time=datetime.datetime.now() ) currency_pair_state = CurrencyPairState(**curren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _query_exchange_pairs(self) -> ExchangePairsResponse:\n was_successful = True\n pairs = []\n response = self._api_query('configs_list_pair_exchange')\n if response.status_code != HTTPStatus.OK:\n was_successful = False\n log.error(f'{self.name} exchange pairs l...
[ "0.57927185", "0.57078826", "0.5652057", "0.56068945", "0.55283237", "0.5521864", "0.54988307", "0.54836756", "0.54834116", "0.5480358", "0.5451237", "0.5441036", "0.5417298", "0.53951776", "0.537572", "0.53708166", "0.53697157", "0.5345947", "0.53304607", "0.53031355", "0.52...
0.79181063
0