query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
return a list of news sources that are close to the provided (lat, long) values
def suggestSourcesAtCoordinate(self, latitude: Union[int, float], longitude: Union[int, float], radiusKm: Union[int, float], count: int = 20, **kwargs): assert isinstance(latitude, (int, float)), "The 'latitude' should be a number" assert isinstance(longitude, (int, float)), "The 'longitude' should be a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closest_stations(lat: float, lon: float, limit: int = 1) -> List[Dict]:\n dist_sorted = sorted(\n STATIONS, key=lambda s: distance((lat, lon), (s[\"lat\"], s[\"lon\"]))\n )\n return dist_sorted[:limit]", "def findStations(self, coords=[], offset=[], minThreshold=10, maxThreshold=100):\n\n ...
[ "0.67547834", "0.63278764", "0.6324769", "0.61340594", "0.6128573", "0.60959363", "0.6066078", "0.6008798", "0.5947017", "0.5842012", "0.58200216", "0.5802729", "0.5781583", "0.57792777", "0.573028", "0.5714511", "0.5701796", "0.5698442", "0.5684616", "0.5659369", "0.5651931"...
0.5848714
9
return a list of news sources that are close to the provided (lat, long) values
def suggestSourcesAtPlace(self, conceptUri: str, dataType: Union[str, List[str]] = "news", page = 1, count = 20, **kwargs): params = {"action": "getSourcesAtPlace", "conceptUri": conceptUri, "page": page, "count": count, "dataType": dataType} params.update(kwargs) return self.jsonRequest("/api/v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closest_stations(lat: float, lon: float, limit: int = 1) -> List[Dict]:\n dist_sorted = sorted(\n STATIONS, key=lambda s: distance((lat, lon), (s[\"lat\"], s[\"lon\"]))\n )\n return dist_sorted[:limit]", "def findStations(self, coords=[], offset=[], minThreshold=10, maxThreshold=100):\n\n ...
[ "0.67547834", "0.63278764", "0.6324769", "0.61340594", "0.6128573", "0.60959363", "0.6066078", "0.6008798", "0.5947017", "0.5848714", "0.5842012", "0.58200216", "0.5802729", "0.5781583", "0.57792777", "0.573028", "0.5714511", "0.5701796", "0.5698442", "0.5684616", "0.5659369"...
0.0
-1
return a list of news sources that match the prefix
def suggestAuthors(self, prefix: str, page: int = 1, count: int = 20, **kwargs): assert page > 0, "page parameter should be above 0" params = {"prefix": prefix, "page": page, "count": count} params.update(kwargs) return self.jsonRequest("/api/v1/suggestAuthorsFast", params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suggestNewsSources(self, prefix: str, dataType: Union[str, list] = [\"news\", \"pr\", \"blog\"], page: int = 1, count: int = 20, **kwargs):\n assert page > 0, \"page parameter should be above 0\"\n params = {\"prefix\": prefix, \"dataType\": dataType, \"page\": page, \"count\": count}\n pa...
[ "0.6308919", "0.62707055", "0.6084322", "0.6078376", "0.6037707", "0.6009768", "0.5960838", "0.59466416", "0.594522", "0.59372747", "0.5871036", "0.579802", "0.5768899", "0.5733959", "0.5702365", "0.56964064", "0.5685058", "0.568116", "0.5660605", "0.56461525", "0.55997753", ...
0.0
-1
return a list of event types that match the prefix
def suggestEventTypes(self, prefix: str, page: int = 1, count: int = 20, **kwargs): assert page > 0, "page parameter should be above 0" params = {"prefix": prefix, "page": page, "count": count} params.update(kwargs) return self.jsonRequest("/api/v1/eventType/suggestEventTypes", params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all(self):\r\n return list(pecan.request.storage_conn.get_event_types())", "def get_triggers_by_prefix(uuid: UUID, prefix: str | Tuple) -> Optional[List['Trigger']]:\n scenario = store.get_scenario(uuid)\n if scenario:\n return [trigger for trigger in scenario.trigger_manager.triggers...
[ "0.63858974", "0.6202084", "0.5924098", "0.5862218", "0.5741972", "0.566967", "0.562749", "0.5544773", "0.5511223", "0.5464088", "0.54471403", "0.54358304", "0.54006886", "0.53771496", "0.537508", "0.537111", "0.5363539", "0.53595304", "0.5346293", "0.5343913", "0.53282255", ...
0.64759165
0
return a list of concept classes that match the given prefix
def suggestConceptClasses(self, prefix: str, lang: str = "eng", conceptLang: str = "eng", source: Union[str, List[str]] = ["dbpedia", "custom"], page: int = 1, count: int = 20, returnInfo: ReturnInfo = ReturnInfo(), **kwargs): assert page > 0, "page parameter should be above 0" params = { "prefix": pref...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def words_start_with_prefix(self, prefix: str) -> List[str]:\n if not self.starts_with(prefix):\n return []\n if self.search(prefix):\n return [prefix]\n\n curr = self.root\n for ch in prefix:\n curr = curr.children.get(ch)\n ...
[ "0.63769776", "0.6048061", "0.60433567", "0.587656", "0.583887", "0.57681125", "0.57679045", "0.5767587", "0.5692277", "0.5622705", "0.5620777", "0.55592585", "0.5542315", "0.5525467", "0.5497741", "0.5459923", "0.5453932", "0.54335916", "0.53916717", "0.53893685", "0.5383738...
0.5906344
3
return a concept uri that is the best match for the given concept label if there are multiple matches for the given conceptLabel, they are sorted based on their frequency of occurence in news (most to least frequent)
def getConceptUri(self, conceptLabel: str, lang: str = "eng", sources: Union[str, List[str]] = ["concepts"]): matches = self.suggestConcepts(conceptLabel, lang = lang, sources = sources) if matches != None and isinstance(matches, list) and len(matches) > 0 and "uri" in matches[0]: return mat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCategoryUri(self, categoryLabel: str):\n matches = self.suggestCategories(categoryLabel)\n if matches != None and isinstance(matches, list) and len(matches) > 0 and \"uri\" in matches[0]:\n return matches[0][\"uri\"]\n return None", "def uri_sort_key(uri):\n if uri.start...
[ "0.5373891", "0.5326923", "0.5324317", "0.5230062", "0.5156094", "0.51187223", "0.49526542", "0.49000037", "0.4895589", "0.48791897", "0.48177102", "0.46961698", "0.4668031", "0.46295252", "0.46246976", "0.46214887", "0.46188977", "0.46140313", "0.4609746", "0.45985618", "0.4...
0.6000219
0
return a location uri that is the best match for the given location label
def getLocationUri(self, locationLabel: str, lang: str = "eng", sources: Union[str, List[str]] = ["place", "country"], countryUri: Union[str, None] = None, sortByDistanceTo: Union[List, Tuple, None] = None): matches = self.suggestLocations(locationLabel, sources = sources, lang = lang, countryUri = countryUri, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_family_location(family_label):\n\n search_dirs = [\"/hps/nobackup/production/xfam/rfam/RELEASES/14.3/miRNA_relabelled/batch1_chunk1_searches\",\n \"/hps/nobackup/production/xfam/rfam/RELEASES/14.3/miRNA_relabelled/batch1_chunk2_searches\",\n \"/hps/nobackup/production...
[ "0.6586528", "0.62700546", "0.60183", "0.5761023", "0.5684978", "0.56574464", "0.5643387", "0.5624193", "0.5612762", "0.5518236", "0.5503416", "0.5490034", "0.54579645", "0.5414388", "0.54064244", "0.53824854", "0.534134", "0.53146106", "0.5304863", "0.5296975", "0.5288527", ...
0.6828578
0
return a category uri that is the best match for the given label
def getCategoryUri(self, categoryLabel: str): matches = self.suggestCategories(categoryLabel) if matches != None and isinstance(matches, list) and len(matches) > 0 and "uri" in matches[0]: return matches[0]["uri"] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_category_label(label: str) -> str:\n return number_first_regex.sub(\n '_',\n space_regex.sub(\n '_',\n label.strip().lower().replace('*', '').replace('(', '').replace(\n ')', '').replace('.', '')))", "def get_label_name(label):\n\tindex = np.argmax(...
[ "0.5820102", "0.57796377", "0.57189244", "0.568857", "0.56706095", "0.5670265", "0.5614227", "0.55840105", "0.547457", "0.544891", "0.5384078", "0.5384078", "0.537984", "0.537984", "0.5355162", "0.53501034", "0.534399", "0.5342672", "0.53198165", "0.5298704", "0.5283161", "...
0.7599166
0
return the news source that best matches the source name
def getNewsSourceUri(self, sourceName: str, dataType: Union[str, List[str]] = ["news", "pr", "blog"]): matches = self.suggestNewsSources(sourceName, dataType = dataType) if matches != None and isinstance(matches, list) and len(matches) > 0 and "uri" in matches[0]: return matches[0]["uri"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_source(self, name):\n t = filter( lambda x: x.name==name, self.point_sources+self.extended_sources)\n return t[0] if len(t)==1 else None", "def get_source(source_name):\n if source_name == \"SCHOLAR_CENSUS\":\n from mec_data.source.scholar import ScholarSource\n\n return S...
[ "0.69307625", "0.66296846", "0.61865705", "0.6125315", "0.61133474", "0.6100435", "0.60152495", "0.5923847", "0.58923537", "0.5828837", "0.58286136", "0.58227843", "0.5820799", "0.58204955", "0.5797983", "0.5777223", "0.56680614", "0.56497854", "0.564131", "0.5613789", "0.552...
0.6504152
2
alternative (shorter) name for the method getNewsSourceUri()
def getSourceUri(self, sourceName: str, dataType: Union[str, List[str]] = ["news", "pr", "blog"]): return self.getNewsSourceUri(sourceName, dataType)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNewsSourceUri(self, sourceName: str, dataType: Union[str, List[str]] = [\"news\", \"pr\", \"blog\"]):\n matches = self.suggestNewsSources(sourceName, dataType = dataType)\n if matches != None and isinstance(matches, list) and len(matches) > 0 and \"uri\" in matches[0]:\n return matc...
[ "0.76972795", "0.68226814", "0.6523007", "0.6433535", "0.64236754", "0.63689995", "0.6365982", "0.63083386", "0.63083386", "0.6300353", "0.628872", "0.6269325", "0.626673", "0.6256632", "0.6249758", "0.6189944", "0.61506224", "0.61473215", "0.61441106", "0.606726", "0.6057817...
0.7801554
0
return the URI of the source group that best matches the name
def getSourceGroupUri(self, sourceGroupName: str): matches = self.suggestSourceGroups(sourceGroupName) if matches is not None and isinstance(matches, list) and len(matches) > 0 and "uri" in matches[0]: return matches[0]["uri"] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getURI(self, *args):\n return _libsbml.GroupsExtension_getURI(self, *args)", "def _source(self, namespace):\n if not namespace:\n source = self._default_source\n else:\n source = self._sources.get(namespace)\n if not source:\n raise GroupResolverSo...
[ "0.62811434", "0.6188032", "0.6106267", "0.5954231", "0.58817136", "0.58752364", "0.5858591", "0.580521", "0.57376444", "0.56671643", "0.56523913", "0.56210285", "0.55978084", "0.55902463", "0.55665797", "0.5522302", "0.55100167", "0.54542893", "0.54542893", "0.54542893", "0....
0.7802163
0
return a uri of the concept class that is the best match for the given label
def getConceptClassUri(self, classLabel: str, lang: str = "eng"): matches = self.suggestConceptClasses(classLabel, lang = lang) if matches is not None and isinstance(matches, list) and len(matches) > 0 and "uri" in matches[0]: return matches[0]["uri"] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getConceptUri(self, conceptLabel: str, lang: str = \"eng\", sources: Union[str, List[str]] = [\"concepts\"]):\n matches = self.suggestConcepts(conceptLabel, lang = lang, sources = sources)\n if matches != None and isinstance(matches, list) and len(matches) > 0 and \"uri\" in matches[0]:\n ...
[ "0.6339133", "0.60691535", "0.6041036", "0.59156215", "0.5846136", "0.575784", "0.56709063", "0.5510237", "0.54722863", "0.5397338", "0.5382017", "0.5376677", "0.53355074", "0.53352785", "0.53339684", "0.5312528", "0.5297552", "0.5296992", "0.52870166", "0.5281717", "0.527981...
0.74872255
0
return detailed information about a particular concept
def getConceptInfo(self, conceptUri: str, returnInfo: ReturnInfo = ReturnInfo(conceptInfo = ConceptInfoFlags(synonyms = True, image = True, description = True))): params = returnInfo.getParams() params.update({"uri": conceptUri }) return self.jsonRequest("/api/v1/concept/g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concept_details(\n self,\n concept_id: str,\n params: Optional[Dict] = None,\n headers: Optional[Dict] = None,\n ) -> ConceptDetails:\n method = self._get_method(\"concept_details\")\n method = method.format(**{\"id\": concept_id})\n\n return self.call_api_ge...
[ "0.7382096", "0.6283711", "0.62482786", "0.61796254", "0.5913981", "0.58909845", "0.58331335", "0.5800988", "0.5798764", "0.571371", "0.56614435", "0.5658186", "0.5639102", "0.56273085", "0.56273085", "0.5625537", "0.56052315", "0.55974036", "0.5594931", "0.55901265", "0.5580...
0.6814808
1
return author uri that is the best match for the given author name (and potentially source url) if there are multiple matches for the given author name, they are sorted based on the number of articles they have written (from most to least frequent)
def getAuthorUri(self, authorName: str): matches = self.suggestAuthors(authorName) if matches is not None and isinstance(matches, list) and len(matches) > 0 and "uri" in matches[0]: return matches[0]["uri"] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_author_name_urls(dept_name, dept_url):\n\t# Change to \"School of Humanities\" to match the name used in Enlighten\n\t# Done because the string obtained from http://www.gla.ac.uk/schools/ contains the Gaelic name as well\n\tif \"Humanities\" in dept_name:\n\t\tdept_name = \"School of Humanities\"\n\n\t# ge...
[ "0.65008885", "0.6420538", "0.6307418", "0.6182964", "0.5921297", "0.5848237", "0.57895356", "0.57528603", "0.56621397", "0.5610987", "0.556793", "0.5543805", "0.55181277", "0.55117804", "0.5501808", "0.5497998", "0.547425", "0.54675233", "0.5461011", "0.5434933", "0.5433778"...
0.6498803
1
return event type uri that is the best match for the given label
def getEventTypeUri(self, eventTypeLabel: str): matches = self.suggestEventTypes(eventTypeLabel) if matches is not None and isinstance(matches, list) and len(matches) > 0 and "uri" in matches[0]: return matches[0]["uri"] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCategoryUri(self, categoryLabel: str):\n matches = self.suggestCategories(categoryLabel)\n if matches != None and isinstance(matches, list) and len(matches) > 0 and \"uri\" in matches[0]:\n return matches[0][\"uri\"]\n return None", "def get_type_label(type_url):\n retur...
[ "0.5890905", "0.5888158", "0.5736647", "0.57230157", "0.57189935", "0.56664103", "0.5650868", "0.5550143", "0.5519739", "0.54728514", "0.5453214", "0.5382518", "0.53772074", "0.533073", "0.5309743", "0.52296954", "0.51811314", "0.5180448", "0.5166474", "0.51578933", "0.514757...
0.7921001
0
if you have article urls and you want to query them in ER you first have to obtain their uris in the ER. articleUrls a single article url or a list of article urls returns dict where key is article url and value is either None if no match found or a string with article URI.
def getArticleUris(self, articleUrls: Union[str, List[str]]): assert isinstance(articleUrls, (six.string_types, list)), "Expected a single article url or a list of urls" return self.jsonRequest("/api/v1/articleMapper", { "articleUrl": articleUrls })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_article_dictionary(url):\n articles = {\"title\": get_article_title(url), \"content\": get_article_body(url)}\n return articles", "async def get_article_links(self):\n urls = []\n for page in range(self._start, self._end+1):\n urls.append(self._searchURL + str(page))\n ...
[ "0.6657474", "0.6604622", "0.65535355", "0.65198207", "0.6463539", "0.6353567", "0.6336571", "0.61973166", "0.61275584", "0.6114767", "0.6050255", "0.60251725", "0.5979369", "0.58659524", "0.5813537", "0.5808789", "0.57911414", "0.5790488", "0.57822967", "0.5779605", "0.56730...
0.68681526
0
return the list of URIs of all known source groups
def getSourceGroups(self): ret = self.jsonRequest("/api/v1/sourceGroup/getSourceGroups", {}) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sources(self):\n srcs = GroupResolver.sources(self)\n if srcs:\n srcs.remove(self.default_sourcename)\n srcs.insert(0, self.default_sourcename)\n return srcs", "def source_list(self):\n return list(self._client.group.streams_by_name().keys())", "def source_...
[ "0.7338798", "0.6820434", "0.6810196", "0.64609927", "0.6334199", "0.62872773", "0.62260437", "0.6215513", "0.61615586", "0.6148272", "0.614812", "0.6053038", "0.6036904", "0.6008529", "0.6004802", "0.59989154", "0.5949554", "0.5941072", "0.5938796", "0.58946294", "0.5885352"...
0.70465386
1
return info about the source group
def getSourceGroup(self, sourceGroupUri: str): ret = self.jsonRequest("/api/v1/sourceGroup/getSourceGroupInfo", { "uri": sourceGroupUri }) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_group_id(self):\n return self._source_group_id", "def getSourceGroups(self):\n ret = self.jsonRequest(\"/api/v1/sourceGroup/getSourceGroups\", {})\n return ret", "def getGroup(self):\n\t\treturn self.Group", "def _source(self, namespace):\n if not namespace:\n ...
[ "0.6965876", "0.63914514", "0.63097787", "0.6098065", "0.6034737", "0.6034737", "0.6034737", "0.6034737", "0.6034737", "0.6034737", "0.5995682", "0.5991559", "0.59797585", "0.5949926", "0.594139", "0.59092706", "0.58857083", "0.5862467", "0.5850348", "0.5844907", "0.58210206"...
0.65173215
1
ensure that queries are not made too fast
def _sleepIfNecessary(self): t = time.time() if t - self._lastQueryTime < self._minDelayBetweenRequests: time.sleep(self._minDelayBetweenRequests - (t - self._lastQueryTime)) self._lastQueryTime = t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_query(self):", "def query3() :", "def query(self, query):", "def _optimise(self):\n pass", "def make_query(self):", "def query(self):", "def test_optimize(self):\n # Same id, data and user_id\n id = data = user_id = get_rand_string()\n self.conn.add(id=id, user_id=u...
[ "0.67880195", "0.6588136", "0.6182041", "0.6181996", "0.6142477", "0.6004911", "0.5807992", "0.57814604", "0.5721506", "0.5706068", "0.56834257", "0.565829", "0.56531525", "0.5645818", "0.56294364", "0.56176543", "0.5567455", "0.55609345", "0.55547845", "0.5550071", "0.553724...
0.0
-1
create instance of article mapper it will map from article urls to article uris the mappings can be remembered so it will not repeat requests for the same article urls
def __init__(self, er: EventRegistry, rememberMappings: bool = True): self._er = er self._articleUrlToUri = {} self._rememberMappings = rememberMappings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getArticleUris(self, articleUrls: Union[str, List[str]]):\n assert isinstance(articleUrls, (six.string_types, list)), \"Expected a single article url or a list of urls\"\n return self.jsonRequest(\"/api/v1/articleMapper\", { \"articleUrl\": articleUrls })", "def __init__(self, URL):\n\n ...
[ "0.61131257", "0.6091058", "0.6061315", "0.58105254", "0.57481873", "0.5724342", "0.5658919", "0.561547", "0.55640405", "0.55405253", "0.54538", "0.5376726", "0.53651744", "0.5354169", "0.5334251", "0.53232306", "0.5276144", "0.52740747", "0.52676415", "0.5246305", "0.5234518...
0.5719332
6
given the article url, return an array with 0, 1 or more article uris. Not all returned article uris are necessarily valid anymore. For news sources of lower importance we remove the duplicated articles and just keep the latest content
def getArticleUri(self, articleUrl: str): if articleUrl in self._articleUrlToUri: return self._articleUrlToUri[articleUrl] res = self._er.getArticleUris(articleUrl) if res and articleUrl in res: val = res[articleUrl] if self._rememberMappings: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_article_URLs(sourceURL):\n sourceURL = sourceURL.encode().decode()\n articleList = []\n soup = bs.BeautifulSoup(urllib.request.urlopen(sourceURL),'lxml')\n #remove any tables\n for table in soup.find_all(\"table\"):\n table.extract()\n #remove any special wiki pages\n for citati...
[ "0.682737", "0.6749216", "0.6643437", "0.6284453", "0.6279683", "0.6254851", "0.624617", "0.6225951", "0.62110454", "0.61618197", "0.61546147", "0.6124345", "0.60510105", "0.59439665", "0.5877986", "0.5868573", "0.58341867", "0.5820606", "0.5815287", "0.57822466", "0.57494754...
0.5514409
40
Given a 10x BAM entry as a pysam.AlignedSegment, extract the barcode, UMI, and sequence.
def extract_10x(alignment): barcode = alignment.get_tag('CR') umi = alignment.get_tag('UR') # The quality scores for the sequence is returned as an array.array of # unsigned chars. sequence = alignment.query_sequence return ([barcode], [umi], sequence)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_bam():\n global sample_name, header, segmentID, bam\n sys.stderr.write(time.strftime(\"%c\") + \" Busy with parsing bam file...\\n\")\n bam = pysam.AlignmentFile(NanoSV.opts_bam, 'rb')\n if not bam.has_index():\n sys.exit('The bam has no index file')\n header = bam.header\n if 'H...
[ "0.6318754", "0.5959911", "0.57797533", "0.56292635", "0.5563726", "0.5562032", "0.54856086", "0.53108937", "0.52643204", "0.5243333", "0.5230461", "0.52059263", "0.5188892", "0.51638234", "0.51475555", "0.51249605", "0.5097929", "0.5083921", "0.50224", "0.500398", "0.4997373...
0.61430377
1
Detect what technology was used to generate this BAM.
def detect_technology(self): logger.warning('Only 10x Genomics BAM files can be detected.') with pysam.AlignmentFile(self.path, 'rb') as f: # Check first read of file to see the headers. for item in f.fetch(until_eof=True): # This is a 10x BAM if a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_technology(self, what):\n return self.form.set_value(\"technology\", what)", "def supported_features(self):\n return SUPPORT_LGSMARTTV", "def is_supported(self) -> bool:\n if self.builders and self.app.builder.name not in self.builders:\n return False\n if self...
[ "0.53937185", "0.53510743", "0.5293819", "0.52716935", "0.5255712", "0.5241225", "0.5211665", "0.5197686", "0.5197202", "0.5197202", "0.518907", "0.51142985", "0.5114245", "0.51077163", "0.5107098", "0.5107098", "0.5100026", "0.509623", "0.50713795", "0.5060234", "0.50579786"...
0.6483788
0
Split the BAM into FASTQs.
def to_fastq(self, prefix='', threads=1): # Write to uncompressed FASTQ for speed fastqs = [ f'{prefix}_{i+1}.fastq.gz' if prefix else f'{i+1}.fastq.gz' for i in range(self.technology.n_files) ] logger.info(f'Splitting BAM file into FASTQs {", ".join(fastqs)}') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(self, reads_in_first_split=None):\n split_index = 0\n self.out_fns = []\n writer = open(self._out_fn(split_index), 'w')\n self.out_fns.append(self._out_fn(split_index))\n if reads_in_first_split is None:\n reads_in_first_split = self.reads_per_split\n\n ...
[ "0.6038243", "0.57537574", "0.5666764", "0.56272155", "0.56049055", "0.55941576", "0.5548215", "0.5543489", "0.5456373", "0.5375242", "0.5366417", "0.53647095", "0.5272073", "0.52577937", "0.518868", "0.5184102", "0.5157686", "0.5124461", "0.5069689", "0.5058081", "0.5036406"...
0.56357974
3
Evaluate current holding stocks at Today and update cur stock attribute
def evaluate_cur_stocks(self): today = datetime.today() close_val = PRICE_DF.iloc[PRICE_DF.index.get_loc(today, method="ffill")] close_val = close_val[self.cur_stocks.index] close_val = pd.DataFrame({"PRICE_CURRENT" : close_val.values}, index=self.cur_stocks.index) evaluated_stoc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(stock):\n fetch_data_yahoo(stock) \n if stock['Cap'] != None:\n calc_class(stock)", "async def daily(self, ctx):\r\n # TODO: Asssess whether this can be cleaned up. \r\n # As it stands, very similar to inv()\r\n author = ctx.author\r\n with DB() as db:\r\n ...
[ "0.7198389", "0.67817557", "0.6673082", "0.6595928", "0.6560851", "0.6535039", "0.6521472", "0.6423094", "0.6384765", "0.63523483", "0.6341521", "0.63283294", "0.62257564", "0.6195676", "0.60492074", "0.6039613", "0.6026212", "0.6016211", "0.59771603", "0.59657294", "0.591991...
0.7214952
0
Make historical change of price for pocket
def evaluate_history(self, price_info): historic_stocks = util.historic_stocks(self) historic_df = pd.DataFrame(columns=historic_stocks) for record in self.history: update_row = util.update_row(historic_df, record) historic_df.loc[record.date] = update_row p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_get_historical_price(base, target, date):\n return {base: {target: 10}}", "async def on_symbol_price_updated(self, price: MetatraderSymbolPrice):\n self._pricesBySymbol[price['symbol']] = price\n positions = list(filter(lambda p: p['symbol'] == price['symbol'], self._positions))\n ...
[ "0.6546065", "0.6513961", "0.6417625", "0.6332728", "0.6320226", "0.6215916", "0.6133184", "0.61270934", "0.60963976", "0.60816777", "0.6043165", "0.60069615", "0.59561163", "0.5949848", "0.59252536", "0.5910207", "0.58720535", "0.5871314", "0.5849163", "0.5824082", "0.581505...
0.57770026
22
Make Pocket cur holding stock to empty
def flush(self): self.cur_stocks = self.cur_stocks.drop(self.cur_stocks.index) # add history that flushed whole stocks
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take(self):\n print(\"You fill the kettle with water.\")\n inventory.remove('kettle')\n collect('filled kettle')", "def reset(self):\n for key in self.portfolio.keys():\n self.portfolio[key] = {'holdings': 0}\n self.buys[key] = 0\n self.portfolio['bala...
[ "0.64346164", "0.63459474", "0.61906755", "0.6181591", "0.6101768", "0.60579175", "0.6056559", "0.6015891", "0.5999291", "0.59982437", "0.59696317", "0.59237593", "0.5851878", "0.58299017", "0.5800235", "0.5799133", "0.5781456", "0.5750289", "0.57455724", "0.567645", "0.56746...
0.60396004
7
Analyzing the performance of manager's pocket.
def analyze(self, start, end): return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure(self):\n pass", "def advancedStats():", "def stats(self):", "def measure(self, recommender):", "def monitor(self):\n procdata = self.collect_userprocs_info()\n now = int(time.time())\n #-------------------\n proclist = []\n for name in procdata:\n ...
[ "0.67233044", "0.6397932", "0.6334954", "0.626483", "0.61850554", "0.61839694", "0.615876", "0.60849315", "0.6067302", "0.5993176", "0.5979811", "0.58584976", "0.5830627", "0.5822538", "0.5812257", "0.5808406", "0.57874054", "0.5766286", "0.57624614", "0.574542", "0.57443357"...
0.0
-1
Get audio frames and make an audio deque
def audio_thread(audio_que, audio_ent): vad = VADAudio( aggressiveness=2, input_rate=16000 ) audio_que.put(AudioFrame(vad.vad_collector(), vad.ssl_read())) audio_ent.set() if len(audio_que.queue) > 500: audio_que.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def audio_stream() -> typing.Iterable[bytes]:\n frames = frame_queue.get()\n while frames:\n yield frames\n frames = frame_queue.get()", "def get_audio():\n\tbuf = None\n\tnum_new_bytes = BUFFER_SIZE // REFRESH_BUFFER_FACTOR\n\twith open(INFILE) as fifo:\n\t\twhile True:\n\t\t...
[ "0.75554425", "0.6910365", "0.66622657", "0.6431581", "0.62361145", "0.62292373", "0.6207139", "0.6162148", "0.6150026", "0.61357945", "0.60847557", "0.606302", "0.5995642", "0.5961134", "0.593233", "0.59278435", "0.59212625", "0.591338", "0.5859772", "0.58524656", "0.5821281...
0.58684295
18
Returns the byte size of a file at ``file_path``.
def file_size(file_path): stat = os.stat(file_path) assert stat_fn.S_ISDIR(stat.st_mode) == False return stat.st_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_size_in_bytes(file_path):\n size = os.path.getsize(file_path)\n return size", "def file_size(file_path):\n if os.path.isfile(file_path):\n file_info = os.stat(file_path)\n return convert_bytes(file_info.st_size)", "def file_size(file_path):\n if os.path.isfile(file_path):\n...
[ "0.8997737", "0.897519", "0.897519", "0.897519", "0.8965862", "0.8730011", "0.8686579", "0.8589061", "0.855717", "0.8339082", "0.8333081", "0.8267659", "0.8118673", "0.80132294", "0.8005676", "0.8005676", "0.7886345", "0.7868195", "0.78022426", "0.77924824", "0.77924824", "...
0.818919
12
Returns a string Hex md5 digest for the file at ``file_path``.
def file_md5(file_path): log.debug("Calculating md5 for %s", file_path) start_ms = time.time() * 10**3 fp = open(file_path, 'rb') try: # returns tuple (md5_hex, md5_base64, size) md5, _, _ = boto.utils.compute_md5(fp) finally: fp.close() duration_ms = (time.time() * 10**3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def md5_hash(file_path):\n with open(file_path, 'rb') as fp:\n return md5(fp.read()).hexdigest()", "def GetFileMd5(file_path):\n return binascii.hexlify(GetFileHashes(file_path, do_md5=True)['md5'])", "def get_file_checksum(file_path):\n with open(file_path) as f:\n content = f.read()\n ...
[ "0.82983875", "0.79927385", "0.7966914", "0.7918441", "0.7798802", "0.77385974", "0.77119756", "0.77119756", "0.76662797", "0.75967014", "0.75758934", "0.75569177", "0.7496125", "0.74683166", "0.7464667", "0.7431425", "0.7404594", "0.7364096", "0.734743", "0.73444986", "0.726...
0.76608855
9
Ensure the directories for ``path`` exist.
def ensure_dir(path): try: os.makedirs(path) except (EnvironmentError) as e: if not(e.errno == errno.EEXIST and e.filename == path): raise return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_dirs_exist(path):\n os.makedirs(path, exist_ok=True)", "def assure_path_exists(self, path):\n\n dir = os.path.dirname(path)\n if not os.path.exists(dir):\n os.makedirs(dir)", "def ensure_dir_exists(path: Union[str,Path]) -> None:\n# path = str(path)\n assert not os...
[ "0.82048607", "0.8184131", "0.7938871", "0.7728657", "0.77272743", "0.7708402", "0.76807654", "0.7665548", "0.76503545", "0.76297635", "0.75548595", "0.7539441", "0.74489266", "0.74481565", "0.7425621", "0.74024767", "0.74016887", "0.7400134", "0.73874825", "0.7316488", "0.72...
0.75274724
12
Format the ``bytes`` as a human readable value.
def human_disk_bytes(bytes): patterns = [ (1024.0 ** 3, "G"), (1024.0 ** 2, "M"), (1024.0, "K") ] for scale, label in patterns: if bytes >= scale: return "{i:.1f}{label}".format(i=(bytes/scale), label=label) return "%sB" % (bytes,)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def humanize_bytes(value: bytes) -> str:\n if len(value) < INLINE_LENGTH:\n payload = value.hex()\n else:\n hex = value.hex()\n head = hex[:DISPLAY_CHARS]\n tail = hex[-1 * DISPLAY_CHARS :]\n payload = f\"{head}..{tail}\"\n\n return f\"bytes{len(value)}({payload})\"", ...
[ "0.76535106", "0.6859878", "0.6772026", "0.6762991", "0.66572475", "0.66351366", "0.6503492", "0.634785", "0.6321941", "0.6208951", "0.6163069", "0.6109563", "0.6077164", "0.60303795", "0.6028045", "0.6020948", "0.6005915", "0.6003533", "0.6002519", "0.59668106", "0.5863311",...
0.64928573
7
Creates a temporary hard link for the file at ``source_path``. The link is created when the context is entered and destroyed when it is left. You can also call the ``link`` and ``close`` functions to achieve the same result. The full path of the ``source_path`` is recreated under a temporary directory so that we can pa...
def __init__(self, source_path): self._source_path = source_path self._stable_dir = None self.stable_path = None self.ignore_next_exit = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link(self):\n\n if self.path_source is not None:\n full_source_path = os.path.join(\n os.path.expandvars(self.path_source), self.name\n )\n full_destination_path = os.path.join(\n os.path.expandvars(self.path_destination), self.name\n ...
[ "0.6136548", "0.6093798", "0.5965859", "0.585038", "0.5806252", "0.5596196", "0.55958414", "0.5442566", "0.54166704", "0.54117393", "0.53947926", "0.53625023", "0.5336499", "0.5300534", "0.52561206", "0.5227541", "0.5223866", "0.51948196", "0.51883584", "0.5175947", "0.516497...
0.4557406
73
Generates the stable link and returns it. If the link could not be generated because the source file was not found ``None`` is returned. Call ``close`` to delete the link.
def link(self): self.__enter__() return self.stable_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __enter__(self):\n if self.stable_path:\n return self.stable_path\n \n _, file_name = os.path.split(self._source_path)\n stable_dir = tempfile.mkdtemp(prefix=\"%s-\" % file_name)\n assert self._source_path.startswith(\"/\")\n stable_path = os.path.join(stabl...
[ "0.5937122", "0.58447796", "0.5743967", "0.56529963", "0.5629153", "0.5612357", "0.55422425", "0.5530858", "0.54267585", "0.53902197", "0.52353996", "0.5191223", "0.51137", "0.5081782", "0.5077057", "0.5065889", "0.50577205", "0.5030819", "0.5026374", "0.50132394", "0.5006848...
0.61671346
0
Deletes the stable link.
def close(self): self.__exit__(None, None, None) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unlink(self, link_id):", "def remove_link():", "def delete_secret_link(link_id):\n\n Secret_Link.objects.filter(link_id=link_id).delete()", "def delete_version(self):\n pass", "def deletelink(self, link_index=1, child=None):\n child = self.getnodenamed(child) # Verify pointer.\n\n ...
[ "0.7092518", "0.6725158", "0.6629403", "0.66181463", "0.65411353", "0.653509", "0.6453885", "0.6434074", "0.64093846", "0.6395287", "0.63938314", "0.6329432", "0.6159133", "0.6091675", "0.6088176", "0.6084725", "0.6080175", "0.6080175", "0.60257584", "0.60257584", "0.60257584...
0.0
-1
Enters the context and returns self if the link could be created. If the link could not be created because the source path did not exist ``None`` is returned.
def __enter__(self): if self.stable_path: return self.stable_path _, file_name = os.path.split(self._source_path) stable_dir = tempfile.mkdtemp(prefix="%s-" % file_name) assert self._source_path.startswith("/") stable_path = os.path.join(stable_dir, self._sou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link(self):\n\n if self.path_source is not None:\n full_source_path = os.path.join(\n os.path.expandvars(self.path_source), self.name\n )\n full_destination_path = os.path.join(\n os.path.expandvars(self.path_destination), self.name\n ...
[ "0.57441884", "0.5403153", "0.52979624", "0.5242806", "0.5223527", "0.5191228", "0.5150666", "0.51408464", "0.51333934", "0.51022995", "0.50961906", "0.5043649", "0.5019827", "0.5007971", "0.4994224", "0.4989699", "0.49889046", "0.49748132", "0.4961593", "0.49501863", "0.4932...
0.6574273
0
Return a list of all pypet trajectory names in a a given hdf5 file.
def getTrajectorynamesInFile(filename): assert pathlib.Path(filename).exists(), f"{filename} does not exist!" hdf = h5py.File(filename, "r") all_traj_names = list(hdf.keys()) hdf.close() return all_traj_names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def labels(self):\n with self._h5file('r') as h5file:\n return list(h5file.keys())", "def list_h5(walk_dir):\n\n file_list = []\n for root, subdirs, files in os.walk(walk_dir):\n\n for filename in files:\n file_path = os.path.join(root, filename)\n if file_pat...
[ "0.5963088", "0.59348214", "0.5826333", "0.58148545", "0.5610662", "0.56103677", "0.55904347", "0.5585358", "0.5580575", "0.5579591", "0.5578491", "0.5534216", "0.54983604", "0.5476016", "0.54249066", "0.5373145", "0.5356421", "0.53518355", "0.53175646", "0.5283302", "0.52732...
0.8125475
0
Read HDF file with simulation results and return the chosen trajectory.
def loadPypetTrajectory(filename, trajectoryName): assert pathlib.Path(filename).exists(), f"{filename} does not exist!" logging.info(f"Loading results from {filename}") # if trajectoryName is not specified, load the most recent trajectory if trajectoryName == None: trajectoryName = getTrajecto...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_simulation_results(self,\n fname_sims, \n fname_pareto = None, \n fname_cull = None):\n\n \n self.fname_sims = fname_sims\n self.__read_file(fname_sims, 'sim_results')\n \n if fname_pareto is no...
[ "0.64999044", "0.6371696", "0.6073903", "0.5837715", "0.57869893", "0.57349133", "0.5704984", "0.5631741", "0.5587649", "0.5532272", "0.55024004", "0.5448979", "0.5440913", "0.54274464", "0.5425254", "0.54140824", "0.54065776", "0.539318", "0.53873175", "0.53624594", "0.53507...
0.0
-1
Load the simulated data of a run and its parameters from a pypetTrajectory.
def getRun(runId, pypetTrajectory, pypetShortNames=True): exploredParameters = pypetTrajectory.f_get_explored_parameters() niceParKeys = [p.split(".")[-1] for p in exploredParameters.keys()] pypetTrajectory.results[runId].f_load() result = pypetTrajectory.results[runId].f_to_dict(fast_access=True, shor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadData(self, **kwargs):\n \n Simulation.loadData(self, **kwargs)\n if crp_flag:\n self.data['T'] = self.data.D*crp.kpc/crp.c_light/3600/24/365.25/1e6\n else: \n self.data['T'] = self.data.D*siu.kpc/siu.c_light/3600/24/365.25/1e6", "def load(self) -> None:\n...
[ "0.60243386", "0.5950635", "0.5801095", "0.57834077", "0.57368153", "0.56159323", "0.5614498", "0.5600852", "0.55473953", "0.5526737", "0.54745704", "0.54700917", "0.54387504", "0.5425601", "0.54211926", "0.54067695", "0.53979605", "0.5389131", "0.5389131", "0.5385771", "0.53...
0.54232967
14
Method calculates and returns terms covered by Term object
def get_covered_terms(self): base = 0 x_index = [index for index, item in enumerate(self.bin_str[::-1]) if item == '-'] for index, item in enumerate(self.bin_str[::-1]): if item == '1': base += 2 ** index yield base for i in range(len(x_index)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_terms(self):\n return self.__terms", "def _get_terms(self):\n return self.__terms", "def _get_terms(self):\n return self.__terms", "def _get_terms(self):\n return self.__terms", "def _get_terms(self):\n return self.__terms", "def _get_terms(self):\n return self.__terms", "def...
[ "0.66107965", "0.66107965", "0.66107965", "0.66107965", "0.66107965", "0.66107965", "0.66107965", "0.66107965", "0.66107965", "0.61759037", "0.6123893", "0.6059991", "0.6038169", "0.6015828", "0.6014338", "0.60119563", "0.5838138", "0.579935", "0.57963955", "0.56884027", "0.5...
0.5419943
41
Function returns true if the binary strings differ by only one bit, else false
def differ_by_one(nums): num1, num2 = nums difference = 0 for index, bit in enumerate(num1): if bit != num2[index]: difference += 1 if difference > 1: return False if difference == 1: num1.covered = num2.covered = True return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strings_differ(string1, string2):\n if len(string1) != len(string2):\n return True\n invalid_bits = 0\n for a, b in zip(string1, string2):\n invalid_bits += a != b\n return invalid_bits != 0", "def any_equal_block(b: bytes) -> bool:\n b = [b[i:i + 16] for i in range(0, len(b), 16...
[ "0.7363422", "0.7006106", "0.6955231", "0.6935423", "0.69168013", "0.68464726", "0.6827639", "0.68151927", "0.67339444", "0.6722084", "0.6646812", "0.6597543", "0.6540759", "0.64366025", "0.641615", "0.63223135", "0.62831414", "0.6280919", "0.62527806", "0.6245337", "0.623591...
0.5974088
38
Function returns a reduced Term object
def reduce_bits(nums): num1, num2 = nums result = "" for index, bit in enumerate(num1): result += bit if bit == num2[index] else '-' return Term(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, *args, **kw):\n return self.transform(Term.__call__(self, *args, **kw))", "def __call__(self, *args: TermLike) -> 'Term':\n return Term(self, args)", "def _get_term(self):\n return self.__term", "def _get_term(self):\n return self.__term", "def _get_term(self):\n r...
[ "0.6299694", "0.6096665", "0.5878431", "0.5878431", "0.5878431", "0.5878431", "0.5878431", "0.5878431", "0.5878431", "0.5878431", "0.5878431", "0.5758068", "0.56476766", "0.55836403", "0.5566976", "0.5552307", "0.55443543", "0.553262", "0.5525708", "0.55073017", "0.5463503", ...
0.0
-1
Function uses itertools.combinations to generate possible permutations of minterms and xterms
def get_pairs(terms): return itertools.combinations(terms, 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permutations(xs):\n if not xs:\n yield []\n else:\n for x, xs in selections(xs):\n for ys in permutations(xs):\n yield [x] + ys", "def get_combinations(self):\n all_steps = self.do_steps()\n self.option = [k for k, v in all_steps.items()]\n r...
[ "0.63869417", "0.62922204", "0.6280528", "0.60896415", "0.60720867", "0.6060668", "0.6060022", "0.6006552", "0.5943192", "0.59218216", "0.59115046", "0.5862979", "0.586069", "0.58377963", "0.5827487", "0.5826101", "0.5818908", "0.57880336", "0.57866234", "0.576338", "0.575172...
0.6309878
1
Function takes an input of possible pairs and returns a set of reduced pairs
def reduce_pairs(pairs): return set(map(reduce_bits, filter(differ_by_one, pairs)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pair_combos(iterable):\n pairs = set()\n for a in iterable:\n for b in iterable:\n pairs.add(a + b)\n return list(pairs)", "def all_pairs(elements):\n if len(elements) < 2:\n return []\n elif len(elements) == 2:\n return [(elements[0], elements[1])]\n else:\n...
[ "0.6682539", "0.6649223", "0.658668", "0.6501677", "0.6372383", "0.63125974", "0.62352455", "0.615719", "0.6116768", "0.6116768", "0.61058265", "0.6084855", "0.6050953", "0.60320103", "0.6000207", "0.59864324", "0.5941454", "0.59207493", "0.59112364", "0.58852816", "0.5879278...
0.8235042
0
Function formats reduced expression
def format_minimized_expression(prime_implicants): if not prime_implicants: # If no prime implicants, return 0 return '0' elif prime_implicants[0] == '-' * len(prime_implicants[0]): # If all dashes, return 1 return '1' result = '' for iteration, prime_implicant in enumerate(prime_impl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reformat(ctx):\n pass", "def expression(self):\n\n result = u\"{}({}\".format(self.function.lower(),\n self.metric_name)\n\n if self.dimensions_str:\n result += u\"{{{}}}\".format(self.dimensions_str)\n\n if self.deterministic:\n r...
[ "0.619423", "0.61758894", "0.6155742", "0.5957292", "0.5936892", "0.5857234", "0.5797273", "0.5764045", "0.5746475", "0.56976485", "0.5655259", "0.5650681", "0.5552232", "0.5550531", "0.55274117", "0.55160505", "0.5513322", "0.5504952", "0.54818195", "0.54667133", "0.54610825...
0.5509869
17
Function returns list of essential prime implicants. If any term in m_terms is covered by only one primeimplicant, that primeimplicant is considered to be essential.
def terms_covered_once(prime_implicants, m_terms): covered = [] for prime_implicant in prime_implicants: for covered_term in prime_implicant.get_covered_terms(): covered.append(covered_term) return [i for i in covered if covered.count(i) == 1 and i in m_terms]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_term_max_coverage(prime_implicants, m_terms):\n term_max_coverage = max(prime_implicants, key=lambda prime_implicant: len(\n [i for i in prime_implicant.get_covered_terms() if i in m_terms]))\n\n return term_max_coverage", "def getInterim(self):\n return [x for x in self.xeps if x.int...
[ "0.51042086", "0.50913125", "0.50038147", "0.49761307", "0.4944465", "0.49364462", "0.4881296", "0.48746046", "0.48463184", "0.48211226", "0.48175967", "0.48172054", "0.4810883", "0.48001704", "0.4791628", "0.47870997", "0.47426683", "0.46842042", "0.46507025", "0.46479034", ...
0.700567
0
Function returns the prime implicant that covers the most m_terms
def get_term_max_coverage(prime_implicants, m_terms): term_max_coverage = max(prime_implicants, key=lambda prime_implicant: len( [i for i in prime_implicant.get_covered_terms() if i in m_terms])) return term_max_coverage
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def problem41():\n for i in range(len(PANDIGITAL), 1, -1):\n cur_max = 0\n for p in itertools.permutations(PANDIGITAL[:i]):\n n = int(\"\".join(p))\n if pelib.is_prime(n) and n > cur_max:\n cur_max = n\n\n if cur_max > 0:\n return cur_max", ...
[ "0.6628919", "0.6173766", "0.6173766", "0.6153234", "0.60713315", "0.5992777", "0.59897196", "0.5982625", "0.59818715", "0.59119636", "0.58534485", "0.58469534", "0.5822166", "0.58060354", "0.57984334", "0.57881075", "0.57745135", "0.5755864", "0.5747243", "0.57214177", "0.56...
0.7448263
0
Function minimizes a sumofminterms equation, and returns a list of essential prime implicants and prime implicants
def minimize(n_bits, m_terms, x_terms): # Error checking if max(m_terms, default=0) > 2 ** n_bits or max(x_terms, default=0) > 2 ** n_bits: raise ValueError("integer overflow") # Minimizing minterms = [Term(format(i, '0{}b'.format(n_bits))) for i in m_terms] dcterms = [Term(format(i, '0{}b'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summation_of_primes():\n \n k=1\n acc=2\n for x in range(2000000):\n if x!=0 and x%2!=0 and x%4!=0 and x%6!=0 and x%8!=0 and x%10!=0:\n k=1\n for m in range(x):\n if x!=1 and m!=0 and m!=1 and x%m==0 and x!=m:\n k=2\n if k==1...
[ "0.6033164", "0.5887534", "0.5837873", "0.5818655", "0.5659827", "0.5645945", "0.5618449", "0.5573604", "0.5546379", "0.54956293", "0.5495497", "0.5453119", "0.54498684", "0.5446226", "0.5422607", "0.5383173", "0.5375919", "0.5374314", "0.5360579", "0.53528404", "0.53416526",...
0.5769164
4
Creates the job client. Can also be used for recreating the job client (e.g. in the case of communication failure). Multiple job requests can be done in parallel if needed, by creating an instance of the class for each job. Note that one class instance should only be used for one job, as each instance stores variables ...
def create_client(self) -> None: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_client(self) -> None:\n self._client = gapic.JobServiceClient(\n client_options=dict(api_endpoint=self._region + _UCAIP_ENDPOINT_SUFFIX))", "def jobserver_job():\n return _MakeJob()", "def make_instance(self, include_optional):\n # model = kloudio.models.new_job.NewJob() # noqa:...
[ "0.77097774", "0.61034995", "0.60916775", "0.6037993", "0.5971743", "0.5929555", "0.590849", "0.5902025", "0.58814514", "0.58814514", "0.5853616", "0.5816075", "0.58144796", "0.5787646", "0.5761592", "0.5736792", "0.5715204", "0.57091993", "0.56645805", "0.5615225", "0.560661...
0.5961302
5
Get training args for runner._launch_aip_training. The training args contain the inputs/outputs/exec_properties to the tfx.scripts.run_executor module.
def create_training_args(self, input_dict, output_dict, exec_properties, executor_class_path, training_inputs, job_id) -> Dict[Text, Any]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_training_args(self, input_dict: Dict[Text, List[types.Artifact]],\n output_dict: Dict[Text, List[types.Artifact]],\n exec_properties: Dict[Text, Any],\n executor_class_path: Text,\n training_inputs: D...
[ "0.70724356", "0.6887883", "0.68650603", "0.6819622", "0.6720383", "0.6570948", "0.6565429", "0.65353024", "0.6483057", "0.6375926", "0.6367454", "0.63338363", "0.6326136", "0.6322333", "0.6315006", "0.629442", "0.62928957", "0.6290497", "0.6287055", "0.62419564", "0.61994785...
0.7656704
0
Creates the job spec.
def _create_job_spec( self, job_id: Text, training_input: Dict[Text, Any], job_labels: Optional[Dict[Text, Text]] = None) -> Dict[Text, Any]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_job_spec(\n self,\n job_id: Text,\n training_input: Dict[Text, Any],\n job_labels: Optional[Dict[Text, Text]] = None) -> Dict[Text, Any]:\n\n job_spec = {\n 'display_name': job_id,\n 'job_spec': training_input,\n 'labels': job_labels,\n }\n return job_s...
[ "0.72192025", "0.71575874", "0.652794", "0.6339889", "0.6263073", "0.6225149", "0.62125117", "0.6160883", "0.61028594", "0.6097879", "0.6095217", "0.60905993", "0.60423464", "0.59173054", "0.58997864", "0.58075607", "0.5807247", "0.58008564", "0.5778806", "0.57773787", "0.575...
0.7605234
0
Launches a longrunning job.
def launch_job(self, job_id: Text, parent: Text, training_input: Dict[Text, Any], job_labels: Optional[Dict[Text, Text]] = None) -> None: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _launch_job(self, job):\n details = self.sm.get_job_details(job.jobId)\n handler = self.handlers[details[0]['method']]\n type = details[0]['type']\n resultId = details[0]['resultid']\n job.set_phase('EXECUTING')\n job.set_start_time(datetime.utcnow().isoformat())\n job.add_result(resultId,...
[ "0.7621034", "0.6952546", "0.6635061", "0.65210956", "0.643192", "0.6390821", "0.62709486", "0.62590075", "0.62201256", "0.6138722", "0.6126732", "0.60962737", "0.6070916", "0.6067779", "0.60474116", "0.6016898", "0.5952437", "0.5939165", "0.5926706", "0.59081113", "0.5884174...
0.6375229
6
Gets the the longrunning job.
def get_job(self) -> Union[Dict[Text, Text], CustomJob]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_job(self) -> CustomJob:\n return self._client.get_custom_job(name=self._job_name)", "def job(self):\n return self.batch[self.job_id]", "def get_job(self) -> Job:\n return self.jobs_list[self.sel_idx]", "def get_job(self) -> Dict[Text, Text]:\n request = self._client.projects().job...
[ "0.7959508", "0.7827083", "0.7651665", "0.7608159", "0.746725", "0.7420048", "0.73030406", "0.7280481", "0.72452736", "0.7163087", "0.7111556", "0.71088976", "0.7100397", "0.7080314", "0.70724916", "0.6938223", "0.6938223", "0.69369984", "0.69169027", "0.6887253", "0.6841543"...
0.6627546
25
Gets the state of the longrunning job.
def get_job_state( self, response: Union[Dict[Text, Text], CustomJob]) -> Union[Text, JobState]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_job_state(jobId: int) -> State: \n return mngr.getStateJob(str(jobId))", "def get_state(self):\n\t\treturn Job(SDK.PrlVm_GetState(self.handle)[0])", "def get_job_state(self, job_origin_id):", "def get_job_state(self, response) -> JobState:\n return response.state", "def status(self):...
[ "0.7776277", "0.76635754", "0.76310503", "0.75910527", "0.7253256", "0.7204234", "0.7049449", "0.6893693", "0.6854992", "0.67731065", "0.67512316", "0.67479825", "0.6723624", "0.66703707", "0.6613418", "0.6607828", "0.6564291", "0.65610725", "0.6466642", "0.6450617", "0.64280...
0.69745475
7
Gets the job name.
def get_job_name(self) -> Text: return self._job_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_name(self) -> str:\n return pulumi.get(self, \"job_name\")", "def job_name(self):\n return self._stub.List(self._message).job_name", "def job_name(self) -> str:\n return self._step_execution_context.job_name", "def job_name(self) -> pulumi.Input[str]:\n return pulumi.get(s...
[ "0.9124221", "0.8854782", "0.86039746", "0.8555109", "0.8552845", "0.82115984", "0.7826915", "0.7780019", "0.7780019", "0.7755838", "0.7453526", "0.74189264", "0.7279247", "0.7250569", "0.72497904", "0.72245", "0.7056386", "0.705631", "0.6979349", "0.6973385", "0.69360894", ...
0.8991103
1
Creates the discovery job client. Can also be used for recreating the job client (e.g. in the case of communication failure). Multiple job requests can be done in parallel if needed, by creating an instance of the class for each job. Note that one class instance should only be used for one job, as each instance stores ...
def create_client(self) -> None: self._client = discovery.build('ml', 'v1')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_client(self) -> None:\n self._client = gapic.JobServiceClient(\n client_options=dict(api_endpoint=self._region + _UCAIP_ENDPOINT_SUFFIX))", "def __init__(self,\n job_uids=None,\n cluster_id=None,\n cluster_match_string=None,\n e...
[ "0.6929064", "0.57790893", "0.55540615", "0.5551953", "0.54512167", "0.54504716", "0.5449162", "0.5445811", "0.53970695", "0.5364705", "0.5301948", "0.5293237", "0.5282406", "0.52800995", "0.52337587", "0.5223323", "0.5223323", "0.5222134", "0.5202863", "0.51972383", "0.51919...
0.6168927
1
Get training args for runner._launch_aip_training. The training args contain the inputs/outputs/exec_properties to the tfx.scripts.run_executor module.
def create_training_args(self, input_dict: Dict[Text, List[types.Artifact]], output_dict: Dict[Text, List[types.Artifact]], exec_properties: Dict[Text, Any], executor_class_path: Text, training_inputs: Dict[Text,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_training_args(self, input_dict, output_dict, exec_properties,\n executor_class_path, training_inputs,\n job_id) -> Dict[Text, Any]:\n pass", "def get_train_args():\n d_train = cfg.get_train_args_schema().fields\n \n if num_local_gpus ...
[ "0.7657387", "0.6888748", "0.68656194", "0.682167", "0.67204", "0.6571265", "0.6566474", "0.6535822", "0.6482168", "0.63752997", "0.6367284", "0.6333624", "0.6325504", "0.6321786", "0.63143045", "0.62942094", "0.62941766", "0.6291347", "0.6287213", "0.6240908", "0.61983275", ...
0.70728606
1
Creates the job spec.
def _create_job_spec( self, job_id: Text, training_input: Dict[Text, Any], job_labels: Optional[Dict[Text, Text]] = None) -> Dict[Text, Any]: job_spec = { 'jobId': job_id, 'trainingInput': training_input, 'labels': job_labels, } return job_spec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_job_spec(\n self,\n job_id: Text,\n training_input: Dict[Text, Any],\n job_labels: Optional[Dict[Text, Text]] = None) -> Dict[Text, Any]:\n pass", "def _create_job_spec(\n self,\n job_id: Text,\n training_input: Dict[Text, Any],\n job_labels: Optional[Dict[T...
[ "0.7605234", "0.72192025", "0.652794", "0.6339889", "0.6263073", "0.6225149", "0.62125117", "0.6160883", "0.61028594", "0.6097879", "0.6095217", "0.60905993", "0.60423464", "0.59173054", "0.58997864", "0.58075607", "0.5807247", "0.58008564", "0.5778806", "0.57773787", "0.5755...
0.71575874
2
Launches a longrunning job.
def launch_job(self, job_id: Text, project: Text, training_input: Dict[Text, Any], job_labels: Optional[Dict[Text, Text]] = None) -> None: parent = 'projects/{}'.format(project) job_spec = self._create_job_spec(job_id, training_input, job_labe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _launch_job(self, job):\n details = self.sm.get_job_details(job.jobId)\n handler = self.handlers[details[0]['method']]\n type = details[0]['type']\n resultId = details[0]['resultid']\n job.set_phase('EXECUTING')\n job.set_start_time(datetime.utcnow().isoformat())\n job.add_result(resultId,...
[ "0.76209676", "0.69519645", "0.6634889", "0.652025", "0.643076", "0.63896775", "0.6375683", "0.6270224", "0.62586224", "0.6220635", "0.6138094", "0.61267763", "0.60981447", "0.6071404", "0.60678756", "0.6048099", "0.6015662", "0.5951581", "0.59388965", "0.59266406", "0.590749...
0.5742829
34
Gets the longrunning job.
def get_job(self) -> Dict[Text, Text]: request = self._client.projects().jobs().get(name=self._job_name) return request.execute()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_job(self) -> CustomJob:\n return self._client.get_custom_job(name=self._job_name)", "def job(self):\n return self.batch[self.job_id]", "def get_job(self) -> Job:\n return self.jobs_list[self.sel_idx]", "def current_job(self):\n assert(ExecutorThread.executor_object is not None...
[ "0.78749716", "0.755368", "0.7488666", "0.7287057", "0.7284264", "0.7177822", "0.71693903", "0.7139543", "0.7112392", "0.698487", "0.6967169", "0.6921034", "0.6912143", "0.6863278", "0.6839613", "0.68319654", "0.6814457", "0.677886", "0.6773958", "0.67043626", "0.6698025", ...
0.7425105
3
Gets the state of the longrunning job.
def get_job_state(self, response) -> Text: return response['state']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_job_state(jobId: int) -> State: \n return mngr.getStateJob(str(jobId))", "def get_state(self):\n\t\treturn Job(SDK.PrlVm_GetState(self.handle)[0])", "def get_job_state(self, job_origin_id):", "def get_job_state(self, response) -> JobState:\n return response.state", "def status(self):...
[ "0.7776277", "0.76635754", "0.76310503", "0.75910527", "0.7253256", "0.7204234", "0.7049449", "0.69745475", "0.6854992", "0.67731065", "0.67512316", "0.67479825", "0.6723624", "0.66703707", "0.6613418", "0.6607828", "0.6564291", "0.65610725", "0.6466642", "0.6450617", "0.6428...
0.6893693
8
Creates the Gapic job client. Can also be used for recreating the job client (e.g. in the case of communication failure). Multiple job requests can be done in parallel if needed, by creating an instance of the class for each job. Note that one class instance should only be used for one job, as each instance stores vari...
def create_client(self) -> None: self._client = gapic.JobServiceClient( client_options=dict(api_endpoint=self._region + _UCAIP_ENDPOINT_SUFFIX))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __new__(cls, *_args, **_kwargs):\n if cls._instance is None:\n cls._instance = super(TestJob, cls).__new__(cls)\n return cls._instance", "def make_instance(self, include_optional):\n # model = kloudio.models.new_job.NewJob() # noqa: E501\n if include_optional :\n ...
[ "0.61560833", "0.6033133", "0.59234405", "0.57237214", "0.5716353", "0.5714552", "0.57126325", "0.5688973", "0.56439745", "0.5621558", "0.56208074", "0.56127506", "0.5611762", "0.55921733", "0.5577413", "0.5556657", "0.5548118", "0.5516411", "0.5515737", "0.5490988", "0.54838...
0.80078906
0
Get training args for runner._launch_aip_training. The training args contain the inputs/outputs/exec_properties to the tfx.scripts.run_executor module.
def create_training_args(self, input_dict: Dict[Text, List[types.Artifact]], output_dict: Dict[Text, List[types.Artifact]], exec_properties: Dict[Text, Any], executor_class_path: Text, training_inputs: Dict[Text,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_training_args(self, input_dict, output_dict, exec_properties,\n executor_class_path, training_inputs,\n job_id) -> Dict[Text, Any]:\n pass", "def create_training_args(self, input_dict: Dict[Text, List[types.Artifact]],\n ...
[ "0.7656112", "0.7071737", "0.68881834", "0.6817965", "0.6719776", "0.65706426", "0.6564103", "0.65336037", "0.6483007", "0.6375374", "0.6366846", "0.6333173", "0.6325439", "0.6321799", "0.63139856", "0.62937886", "0.62911975", "0.62895596", "0.6287303", "0.62421274", "0.61994...
0.6864444
3
Creates the job spec.
def _create_job_spec( self, job_id: Text, training_input: Dict[Text, Any], job_labels: Optional[Dict[Text, Text]] = None) -> Dict[Text, Any]: job_spec = { 'display_name': job_id, 'job_spec': training_input, 'labels': job_labels, } return job_spec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_job_spec(\n self,\n job_id: Text,\n training_input: Dict[Text, Any],\n job_labels: Optional[Dict[Text, Text]] = None) -> Dict[Text, Any]:\n pass", "def _create_job_spec(\n self,\n job_id: Text,\n training_input: Dict[Text, Any],\n job_labels: Optional[Dict[T...
[ "0.7605234", "0.71575874", "0.652794", "0.6339889", "0.6263073", "0.6225149", "0.62125117", "0.6160883", "0.61028594", "0.6097879", "0.6095217", "0.60905993", "0.60423464", "0.59173054", "0.58997864", "0.58075607", "0.5807247", "0.58008564", "0.5778806", "0.57773787", "0.5755...
0.72192025
1
Launches a longrunning job.
def launch_job(self, job_id: Text, project: Text, training_input: Dict[Text, Any], job_labels: Optional[Dict[Text, Text]] = None) -> None: parent = 'projects/{project}/locations/{location}'.format( project=project, location=self._region) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _launch_job(self, job):\n details = self.sm.get_job_details(job.jobId)\n handler = self.handlers[details[0]['method']]\n type = details[0]['type']\n resultId = details[0]['resultid']\n job.set_phase('EXECUTING')\n job.set_start_time(datetime.utcnow().isoformat())\n job.add_result(resultId,...
[ "0.7621034", "0.6952546", "0.6635061", "0.65210956", "0.643192", "0.6390821", "0.6375229", "0.62709486", "0.62590075", "0.62201256", "0.6138722", "0.6126732", "0.60962737", "0.6070916", "0.6067779", "0.60474116", "0.6016898", "0.5952437", "0.5939165", "0.5926706", "0.59081113...
0.5639164
43
Gets the longrunning job.
def get_job(self) -> CustomJob: return self._client.get_custom_job(name=self._job_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job(self):\n return self.batch[self.job_id]", "def get_job(self) -> Job:\n return self.jobs_list[self.sel_idx]", "def get_job(self) -> Dict[Text, Text]:\n request = self._client.projects().jobs().get(name=self._job_name)\n return request.execute()", "def current_job(self):\n as...
[ "0.755368", "0.7488666", "0.7425105", "0.7287057", "0.7284264", "0.7177822", "0.71693903", "0.7139543", "0.7112392", "0.698487", "0.6967169", "0.6921034", "0.6912143", "0.6863278", "0.6839613", "0.68319654", "0.6814457", "0.677886", "0.6773958", "0.67043626", "0.6698025", "...
0.78749716
0
Gets the state of the longrunning job.
def get_job_state(self, response) -> JobState: return response.state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_job_state(jobId: int) -> State: \n return mngr.getStateJob(str(jobId))", "def get_state(self):\n\t\treturn Job(SDK.PrlVm_GetState(self.handle)[0])", "def get_job_state(self, job_origin_id):", "def status(self):\n return self.job_proto.status", "def get_status(self):\n\t\treturn c...
[ "0.7774955", "0.7662598", "0.76315635", "0.7255315", "0.72048146", "0.7050449", "0.69742876", "0.6893676", "0.68554026", "0.67728364", "0.67517", "0.6748638", "0.672395", "0.66709757", "0.661294", "0.6608844", "0.65649486", "0.6563904", "0.6467926", "0.6450994", "0.6427336", ...
0.75909746
3
Gets the job client.
def get_job_client( enable_ucaip: Optional[bool] = False, ucaip_region: Optional[Text] = None ) -> Union[CAIPJobClient, UCAIPJobClient]: if enable_ucaip: return UCAIPJobClient(ucaip_region) return CAIPJobClient()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_client(self):\n return self.client", "def client(self):\n return self._thread._client", "def client(self):\n\n if self._client is None:\n self._client = self._get_client()\n return self._client", "def get_job(self) -> CustomJob:\n return self._client.get_cust...
[ "0.7423273", "0.72262716", "0.71783745", "0.70032036", "0.69956785", "0.6968737", "0.69335467", "0.6916196", "0.66505975", "0.654899", "0.6530459", "0.65132034", "0.647153", "0.647153", "0.64516896", "0.64152753", "0.6394034", "0.6392622", "0.6389914", "0.63815117", "0.637198...
0.6007895
37
Construct a toplevel widget with the parent MASTER.
def __init__(self, master=None, cnf={}, **kw): if kw: cnf = _cnfmerge((cnf, kw)) extra = () for wmkey in ['screen', 'class_', 'class', 'visual', 'colormap']: if wmkey in cnf: val = cnf[wmkey] # TBD: a hack needed because s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, master, _type=REGULAR, **kw):\r\n Frame.__init__(self, master, **kw)\r\n self.main_frame = Frame(self, bd=1)\r\n self.main_frame.pack()", "def __init__(self, master=None):\n\n # Use super() to inherit Frame method from superclass tk\n super().__init__(master)...
[ "0.69735175", "0.67381746", "0.669472", "0.668831", "0.6686077", "0.6609715", "0.6572637", "0.6540365", "0.6484257", "0.64818954", "0.6438975", "0.64249706", "0.6423365", "0.64200574", "0.6408428", "0.63591474", "0.6356483", "0.63561195", "0.63275886", "0.62708426", "0.626065...
0.6029286
36
User re.search or re.match to capture the from, to, subject
def get_email_details(header: str) -> dict: try: m = re.match( r""" ([\w\W]* # remove lines ( ^Date: \s*(?P<date>[\w\W]{25}) # obtain date ("date") |^From: \s*(?P<from>[\w\W]*?$) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recipient(self):\n\t\trecipient = re.search(r\"([Tt]\\s*o )(.*)(from.*)\",self.raw_text()[:250])\n\t\t\n\t\tif recipient: \t\n\t\t\trecipient = recipient.group(2) \t\n\t\t\trecipient = re.sub(r\"(\\w+\\s*\\w+),.*\",r\"\\1\",recipient) #attempting to clear out titles and such\n\t\t\t# recipient = re.sub(r\"([sS...
[ "0.5718387", "0.5634224", "0.56214267", "0.54608035", "0.54419184", "0.5416016", "0.5409387", "0.5352327", "0.5340618", "0.53319365", "0.5329645", "0.5308167", "0.52676654", "0.52523005", "0.5220662", "0.52080166", "0.5198048", "0.51962763", "0.51787484", "0.51620984", "0.515...
0.5106384
28
A pserve script aware of static resources.
def pserve(): import pyramid.scripts.pserve import pyramid_fanstatic import os dirname = os.path.dirname(__file__) dirname = os.path.join(dirname, 'resources') pyramid.scripts.pserve.add_file_callback( pyramid_fanstatic.file_callback(dirname)) pyramid.scripts.pserve.main()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_static (filename):\n return static_file(filename, root=\"./static\")", "def server_static(filename):\n return static_file(filename, root='static/stats')", "def statics(file, type='img'):\n return bottle.static_file(file, root=HOME+STATIC_PATH+'/'+type)", "def static(filename):\n return...
[ "0.7150718", "0.69992626", "0.67572206", "0.6541767", "0.6521592", "0.6472664", "0.64559674", "0.64321667", "0.6429534", "0.63892156", "0.6383383", "0.63797045", "0.6370705", "0.636868", "0.6363368", "0.63551867", "0.6335698", "0.630819", "0.6294129", "0.6259669", "0.6254209"...
0.76249796
0
approved condo payment creates an egreso
def test_approved__condo_payment_creates_egreso(self): pago = Pagos_Condominio.objects.get(id = 1) try: self.assertIsNotNone(pago.egreso) except: print 'WARNING: _loaded_values in model is creating problem' #self.assertEqual(hasattr(pago, 'egreso'), True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment(self, **post):\n cr, uid, context = request.cr, request.uid, request.context\n payment_obj = request.registry.get('payment.acquirer')\n sale_order_obj = request.registry.get('sale.order')\n\n order = request.website.sale_get_order(context=context)\n order.write({'user...
[ "0.68200374", "0.66911495", "0.6539901", "0.64811856", "0.6442946", "0.6428527", "0.6295282", "0.62489337", "0.61958116", "0.6165144", "0.6128512", "0.6098366", "0.60955703", "0.60880065", "0.6079592", "0.6073143", "0.6071113", "0.60629845", "0.60420525", "0.6017494", "0.5990...
0.68466234
0
approved condo payment creates an egreso
def test_egreso_updates_account_balance(self): banco = Bancos.objects.get(id=1) previous_balance = banco.balance condominio = Condominio.objects.get(rif='J6750435') factura_condominio = Factura_Condominio.objects.get(id=1) pais = Paises.objects.get(pk="Venezuela") tipo_egreso, created =Tipos_Egresos.object...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_approved__condo_payment_creates_egreso(self):\n\t\tpago = Pagos_Condominio.objects.get(id = 1)\n\t\ttry:\n\t\t\tself.assertIsNotNone(pago.egreso)\n\t\texcept:\n\t\t\tprint 'WARNING: _loaded_values in model is creating problem'\n\t\t#self.assertEqual(hasattr(pago, 'egreso'), True)", "def payment(self, **...
[ "0.68466234", "0.68200374", "0.66911495", "0.6539901", "0.64811856", "0.6442946", "0.6428527", "0.6295282", "0.62489337", "0.61958116", "0.6165144", "0.6128512", "0.6098366", "0.60955703", "0.60880065", "0.6079592", "0.6073143", "0.6071113", "0.60629845", "0.60420525", "0.601...
0.0
-1
extra_col being saved updates account balance
def test_extra_col_updates_account_balance(self): banco = Bancos.objects.get(id=1) previous_balance = banco.balance condominio = Condominio.objects.get(rif='J6750435') factura_condominio = Factura_Condominio.objects.get(id=1) data ={ 'id':1, 'factura': factura_condominio, 'titulo': 'sample_extra_col'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_db_account_balances(self, quote:str, **kwargs):\n\n\t\t# real_balance \t\t\t\t= kwargs.get('real_balance', None)\n\t\t# real_locked \t\t\t\t= kwargs.get('real_locked', None)\n\t\t# internal_balance \t\t\t= kwargs.get('internal_balance', None)\n\t\t# internal_locked \t\t\t= kwargs.get('internal_locked', ...
[ "0.64701575", "0.644509", "0.6379475", "0.6347287", "0.6296751", "0.61106837", "0.61038214", "0.6090905", "0.6013311", "0.5932772", "0.5912174", "0.5902762", "0.5897663", "0.5892612", "0.5846604", "0.5769641", "0.5735082", "0.57056206", "0.56956476", "0.56887454", "0.5668993"...
0.7536452
0
Creates the Real NVP or NICE bijector.
def __init__(self, num_masked=None, fraction_masked=None, shift_and_log_scale_fn=None, bijector_fn=None, is_constant_jacobian=False, validate_args=False, name=None): name = name or 'real_nvp' with tf.name_sc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self):\n\t\treturn handle_to_object(call_sdk_function('PrlVirtNet_Create'))", "def create_entity(self):\n \n if self.ORION_CB.get_entity(self.params['name']) is None:\n \n print('[INFO]: Create new PID entity')\n \n entity_dict = {\"id\":self.p...
[ "0.5961635", "0.57741874", "0.5597742", "0.52777296", "0.5205733", "0.51504385", "0.5143571", "0.5095149", "0.50811416", "0.50780755", "0.5067421", "0.50485516", "0.5039967", "0.49959785", "0.49959785", "0.49661916", "0.4958066", "0.4939919", "0.493104", "0.49255878", "0.4914...
0.0
-1
Construct a new RationalQuadraticSpline bijector. For each argument, the innermost axis indexes bins/knots and batch axes index axes of `x`/`y` spaces. A `RationalQuadraticSpline` with a separate transform for each of three dimensions might have `bin_widths` shaped `[3, 32]`. To use the same spline for each of `x`'s th...
def __init__(self, bin_widths, bin_heights, knot_slopes, range_min=-1., validate_args=False, name=None): with tf.name_scope(name or 'RationalQuadraticSpline') as name: dtype = dtype_util.common_dtype( [bin_widt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpolateSpline(x, y) :\n n = len(x)\n\n dim = 4 * (n - 1)\n b = np.zeros((dim, 1))\n A = np.zeros((dim, dim))\n\n for i in range(n-1):\n x1 = x[i]\n x2 = x[i+1]\n y1 = y[i]\n y2 = y[i+1]\n b[i*4:(i+1)*4, 0] = [y1, y2, 0, 0]\n\n A[i*4, i*4:(i+1)*4] = [...
[ "0.5183332", "0.51626414", "0.5119118", "0.5079179", "0.4961845", "0.49498278", "0.49099728", "0.49079925", "0.48892424", "0.48506638", "0.48246297", "0.478306", "0.47814262", "0.4725182", "0.4706628", "0.46775335", "0.46716303", "0.46659052", "0.46585312", "0.46565458", "0.4...
0.6718378
0
Captures shared computations across forward/inverse/logdet. Only one of `x` or `y` should be specified.
def _compute_shared(self, x=None, y=None): with tf.name_scope("comput_shared") as name: assert (x is None) != (y is None) is_x = x is not None with tf.name_scope("piece0"): range_min = tf.convert_to_tensor(self.range_min, name='range_min') kx = _knot_positions(self.bin_widths, ran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x, y):\n\n masked = self.mask * x\n\n s = self.s(masked, y)\n t = self.t(masked, y)\n z = masked + (1 - self.mask) * (x * s.exp() + t)\n\n log_det = (s * (1 - self.mask)).sum(1)\n\n return z, log_det", "def test_log():\n x, y = fwd.Variable(), fwd.Va...
[ "0.6799488", "0.5780545", "0.561331", "0.54602194", "0.5458519", "0.5442325", "0.5433614", "0.5368498", "0.5366357", "0.53153783", "0.53071904", "0.5299364", "0.52870744", "0.5253826", "0.5222706", "0.5199964", "0.5198029", "0.5174347", "0.5129113", "0.5123612", "0.51117826",...
0.0
-1
Compute the forward transformation (Appendix A.1).
def _forward(self, x): d = self._compute_shared(x=x) relx = (x - d.x_k) / d.w_k spline_val = ( d.y_k + ((d.h_k * (d.s_k * relx**2 + d.d_k * relx * (1 - relx))) / (d.s_k + (d.d_kp1 + d.d_k - 2 * d.s_k) * relx * (1 - relx)))) y_val = spline_val #tf.where(d.out_of_bounds, x, spline...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_transform(self):\n\n if self._pipeline:\n #return functools.reduce(lambda x, y: x | y, [step[1] for step in self._pipeline[: -1]])\n return functools.reduce(lambda x, y: x | y, [step.transform for step in self._pipeline[:-1]])\n else:\n return None", "de...
[ "0.7412555", "0.6997475", "0.6997431", "0.6997431", "0.68757826", "0.6822799", "0.6821863", "0.67669487", "0.67491704", "0.6735819", "0.67256963", "0.67136383", "0.67097676", "0.6668364", "0.6662344", "0.6639448", "0.6637169", "0.6623411", "0.661096", "0.660531", "0.66014105"...
0.0
-1
Compute the inverse transformation (Appendix A.3).
def _inverse(self, y): d = self._compute_shared(y=y) rely = y - d.y_k # tf.where(d.out_of_bounds, tf.zeros_like(y), y - d.y_k) term2 = rely * (d.d_kp1 + d.d_k - 2 * d.s_k) # These terms are the a, b, c terms of the quadratic formula. a = d.h_k * (d.s_k - d.d_k) + term2 b = d.h_k * d.d_k - term2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse_transform(self, X):\n ...", "def inverse_transform(self, X):\n ...", "def inverse_transform(self, X):\n ...", "def inverse_transform(self, X):\n ...", "def inverse_transform(self, X):\n ...", "def inverse_transform(self, X, copy=...):\n ...", "def i...
[ "0.7994033", "0.7994033", "0.7994033", "0.7994033", "0.7994033", "0.7689036", "0.76750916", "0.76586753", "0.7580127", "0.75664145", "0.7531505", "0.74678403", "0.7457205", "0.7444826", "0.7433826", "0.74283147", "0.7378608", "0.73695505", "0.7344377", "0.733746", "0.7327305"...
0.6896039
77
Compute the forward derivative (Appendix A.2).
def _forward_log_det_jacobian(self, x): d = self._compute_shared(x=x) relx = (x - d.x_k) / d.w_k relx = relx # tf.where(d.out_of_bounds, 0.5*tf.ones_like(x), relx) grad = ( 2 * tf.math.log(d.s_k) + tf.math.log(d.d_kp1 * relx**2 + 2 * d.s_k * relx * (1 - relx) + # newln ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derivative(func: Callable, x: float, delta: float) -> float:\n return (func(x + delta) - func(x - delta)) / (2.0 * delta)", "def derivative ( self ):\n return self.__derivative", "def deriv(func: Callable[[ndarrray], ndarray],\n input_: ndarray,\n delta: float = 0.00...
[ "0.7290176", "0.7042805", "0.69695157", "0.6969174", "0.68731177", "0.6854815", "0.6830507", "0.6792242", "0.67888516", "0.67416143", "0.6734721", "0.6734721", "0.6696811", "0.6691667", "0.6688757", "0.666151", "0.6658981", "0.6657034", "0.6640104", "0.6640104", "0.66360956",...
0.0
-1
Flattens and normalizes the plastic strain time derivative tensor. Normalize plastic strain time derivative by dividing by the strain time derivative magnitude
def calc_output(self, plastic_strain_dot, strain_dot): # Calculate Frobenius norm of elastic strain time derivative tensor strain_dot_mag = np.sqrt(np.mean(np.mean(np.square(strain_dot), axis=2), axis=1)) # To avoid singularities, if strain rate magnitude is zero, set it equal to one s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_transition(self):\n self._t /= self._t.sum(1)[:, np.newaxis]", "def _partial_flatten_and_normalize(x):\n x = np.reshape(x, (x.shape[0], -1))\n return (x - np.mean(x)) / np.std(x)", "def unnormalize(tensor, mean, std):\n for t, m, s in zip(tensor, mean, std):\n t.mul_(s).add...
[ "0.62458545", "0.5984606", "0.59279716", "0.5894949", "0.58369017", "0.57565486", "0.5707113", "0.5672379", "0.5637169", "0.56276435", "0.5559953", "0.55526054", "0.5547735", "0.55388963", "0.55312216", "0.5528915", "0.5524366", "0.551839", "0.5514702", "0.54963565", "0.54954...
0.630154
0
Perform beta forecast for a set of scenarios on a regression.
def forecast(run_metadata, specification, output_root, mark_best, production_tag, preprocess_only, verbose, with_debugger, **input_versions): cli_tools.configure_logging_to_terminal(verbose) do_forecast( run_metadata=run_metadata, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linear_regression_forecasting(x_train,y_train,x_valid,y_valid,x_test,y_test):\n y_train = y_train.reshape(TRAINING_BATCH_SIZE,N_PREDICTIONS*N_OUTPUT_FEATURES)\n y_valid = y_valid.reshape(VALIDATION_BATCH_SIZE,N_PREDICTIONS*N_OUTPUT_FEATURES)\n ...
[ "0.6112371", "0.59843546", "0.5966853", "0.59554493", "0.5932704", "0.5894218", "0.5783442", "0.564491", "0.56345904", "0.56212074", "0.56020945", "0.558852", "0.5585161", "0.55805236", "0.55623627", "0.5552391", "0.5545439", "0.55443627", "0.5535678", "0.55313015", "0.551574...
0.53226084
38
Gets the area cords for the dancefloor
def get_dancefloor_area(self): cords = [] x1 = self.coordinates[0] y1 = self.coordinates[1] x2 = self.coordinates[0] + self.width y2 = self.coordinates[1] + self.height if self.width <= 0: x1, x2 = x2, x1 if self.height <= 0: y1, y2 = y2, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_referenced_floor_area() -> np.ndarray:\n\n return envelope.get_referenced_floor_area()", "def area(self):\n return _cantera.wall_area(self.__wall_id)", "def get_area(self):\n ### Original\n from pyresample.spherical_geometry import get_polygon_area\n\n return get_polygon_...
[ "0.66182476", "0.65240717", "0.63324845", "0.6230986", "0.6223651", "0.6190598", "0.6087059", "0.60808396", "0.6071041", "0.60708934", "0.60700375", "0.6048479", "0.60449976", "0.5992652", "0.59492236", "0.59431803", "0.5929464", "0.5906095", "0.58992434", "0.5882558", "0.586...
0.8184448
0
This function sends a SUCCESS/FAILED response to the CloudFormation stack that invoked the Lambda function.
def send_cf_response(event, context, success=True, reason='Unknown'): data = { 'Status': 'SUCCESS' if success else 'FAILED', 'PhysicalResourceId': context.log_stream_name, 'StackId': event['StackId'], 'RequestId': event['RequestId'], 'LogicalResourceId': event['LogicalResourc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lambda_handler(event, context):\n\n return {\n \"statusCode\": 200,\n \"body\": json.dumps({\n 'message': 'API deployed',\n })\n }", "def lambda_handler(event, context):\n return {\n 'statusCode': 200,\n 'body': say_hello()\n }", "def lambda_respons...
[ "0.7016714", "0.6934398", "0.65957916", "0.6580948", "0.65773124", "0.6350327", "0.62960196", "0.6292117", "0.62879604", "0.626153", "0.62377375", "0.6202347", "0.6150959", "0.61024934", "0.60883546", "0.59804237", "0.5948244", "0.5916419", "0.5903106", "0.58938974", "0.58765...
0.7171703
0
Save the model to a json file.
def save_model(self, model_path): MODEL_FILE = 'simple_model.dat' model = { 'm': self.m.tolist(), 'b': self.b, 'FEAST_CORE_URL': FEAST_CORE_URL, 'FEAST_SERVING_URL': FEAST_SERVING_URL, 'ENTITY_ID': ENTITY_ID, } logging.info('Saving model to %s', model_path) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model(model):\n json_string = model.to_json()\n with open(MODEL_SAVE_JSON, 'w') as fp:\n fp.write(json_string)", "def save_model(model, model_file):\n json_string = model.to_json()\n with open(model_file, 'w') as f:\n json.dump(json_string, f)", "def save_model(self, model_fi...
[ "0.8499312", "0.8433259", "0.8345494", "0.797389", "0.7874161", "0.787403", "0.7827332", "0.77711433", "0.7760659", "0.76583546", "0.75438595", "0.7513002", "0.7510078", "0.75076234", "0.7502369", "0.74815285", "0.74815285", "0.74815285", "0.746824", "0.7452417", "0.74390745"...
0.77844816
7
testuser1 has a 'testing' subnamespace, testuser2 tries to see its permissions but fails.
def testRandomUserCannotGETRandomUserSubNamespace(self): headers = { 'accept': 'application/json', } self.addBasicAuthHeader(headers, 'testuser2', 'secret') path = defaults.sep.join([defaults.namespaceCategoryName, 'testuser1', 'testing']) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_namespace_access(self, namespace, user):\n if not namespace.owners.filter(id=user.id).count():\n raise exceptions.PermissionDenied(\n 'The namespace listed on your filename must match one of '\n 'the namespaces you have access to.'\n )", "def ...
[ "0.6429766", "0.6371066", "0.6243876", "0.6156751", "0.6154213", "0.61048347", "0.6101933", "0.60836434", "0.60561347", "0.6050891", "0.6036248", "0.60299695", "0.6001029", "0.5991596", "0.59487164", "0.5943904", "0.5931206", "0.5913553", "0.5899936", "0.58955866", "0.5859986...
0.66301256
0
Convert all dicts to HashableDicts in nested structure.
def parse(cls, el): if isinstance(el, list): for i, x in enumerate(el): el[i] = HashableDict.parse(x) elif isinstance(el, dict): d = HashableDict() for k, v in el.iteritems(): d[k] = HashableDict.parse(v) return d re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(self):\n flat = {}\n for d in self.dicts:\n flat.update(d)\n return flat", "def _deep_asdict(self):\n return {\n \"collections\": {k: p._deep_asdict() for (k, p) in self.collections.items()},\n }", "def get_hashable_entries(nested:dict):\n ...
[ "0.65635574", "0.64972985", "0.63339704", "0.633059", "0.62674254", "0.6173345", "0.6043641", "0.6025789", "0.60111827", "0.59066117", "0.58889693", "0.5853961", "0.5845323", "0.58159864", "0.57850933", "0.57364714", "0.57173663", "0.56847185", "0.5674789", "0.5667077", "0.56...
0.0
-1
Checks if two intervals are overlapping. Function requires intervals to be proper (end >= start). Works with any types of comparable by mathematical operators objects.
def ranges_overlap(start1, end1, start2, end2): return start1 <= end2 and end1 >= start2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dates_intervals_are_overlapped(start_1, end_1, start_2, end_2):\n return end_1 >= start_2 and end_2 >= start_1", "def overlap(start1, end1, start2, end2):\n return not (end1 < start2 or end2 < start1)", "def overlap(t1start, t1end, t2start, t2end):\n\n return (t1start <= t2start <= t1end) or (t2st...
[ "0.8221766", "0.8196568", "0.80125463", "0.7714692", "0.76665205", "0.7543957", "0.75031185", "0.74704397", "0.7351677", "0.73447514", "0.72555596", "0.72339934", "0.72237253", "0.71955794", "0.7165406", "0.71499693", "0.70835686", "0.7058538", "0.70213556", "0.69799066", "0....
0.82069135
1
Returns (list of) sum of intervals. Intervals could be tuple of any orderable values (ex. integers, dates). If sets are overlapping, they are "merged" together and resulting interval is (min(start1, start2), max(end1, end2)). >>> sum_of_intervals([(1, 5), (4, 10), (7, 13), (15, 20), (21, 30)]) [(1, 13), (15, 20), (21, ...
def sum_of_intervals(intervals): intervals_set = set() for v_start, v_end in intervals: intervals_set.add((v_start, True)) intervals_set.add((v_end, False)) intervals = list(intervals_set) intervals.sort(key=lambda a: a[0]) current_start = None started = 0 result = [] fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intervals(start, end, delta, intervals_right_closed=False):\r\n result = []\r\n interval_start, interval_end = None, None\r\n while True:\r\n interval_start = start if interval_end is None else interval_end\r\n interval_end = min(end, interval_start + delta)\r\n result.append(thal...
[ "0.59077203", "0.563408", "0.5407047", "0.5392709", "0.52991736", "0.52946335", "0.52101135", "0.5203491", "0.5171669", "0.51691556", "0.5138005", "0.5121623", "0.51164556", "0.506967", "0.506666", "0.5054887", "0.5036717", "0.50176084", "0.5004771", "0.49338767", "0.49328962...
0.7316026
0
Normalize decimal without scientific notation (remove exponent and trailing zeros).
def normalize_decimal(d): return d.quantize(Decimal(1)) if d == d.to_integral() else d.normalize()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_exponent(val):\n context = decimal.Context(prec=self.max_digits)\n return val.quantize(decimal.Decimal(1), context=context) if val == val.to_integral() else val.normalize(context)", "def normalize(amount, min=2, max=4):\n if not amount:\n return amount\n\n # To Decim...
[ "0.71156347", "0.6817118", "0.6672521", "0.6446351", "0.62960124", "0.61859643", "0.6139326", "0.5954451", "0.5883746", "0.5880353", "0.58401924", "0.5834147", "0.57599866", "0.5726349", "0.57119143", "0.5709601", "0.5705417", "0.5702603", "0.5699816", "0.56875485", "0.568076...
0.7325013
0
Use IPMITOOL to blink a chassis LED
def blink_light(hostname, on=True): if on: opt = "force" else: opt = "0" LOGGER.info("Blinking chassis LED for %s", hostname) command = "ipmitool -U {} -P {} -H {} chassis identify {}".format( USER, PASS, hostname, opt) subprocess.check_call(command, shell=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def blink(my_board, pin):\n\n # set the pin mode\n await my_board.set_pin_mode_digital_output(pin)\n\n # toggle the pin 4 times and exit\n for x in range(4):\n print('ON')\n await my_board.digital_write(pin, 1)\n await asyncio.sleep(1)\n print('OFF')\n await my_...
[ "0.73258066", "0.69174576", "0.6745456", "0.6721252", "0.66942364", "0.66491276", "0.6608069", "0.65577483", "0.64461106", "0.63938886", "0.63897306", "0.6379322", "0.637831", "0.63509107", "0.63327783", "0.626326", "0.62223494", "0.61845493", "0.6181832", "0.6151551", "0.612...
0.7913171
0
Get the MAC for eth0 using IPMI
def get_eth0_mac_address(hostname): command = "ipmitool -H {} -U ADMIN -P ADMIN raw 0x30 0x21".format(hostname) try: result = subprocess.check_output(command, shell=True) except subprocess.CalledProcessError as exc: LOGGER.exception("Failed to get eth0 mac for %s", hostname) # Remove ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mac_address():\n eth0_interface = 'eth0'\n addresses = netifaces.ifaddresses(eth0_interface)[netifaces.AF_LINK][0]\n mac_address = addresses['addr']\n return mac_address", "def getMac(self):\n # Import netifaces here to prevent error importing this module in setup.py\n import ne...
[ "0.78554046", "0.78055936", "0.7448746", "0.7251684", "0.72502637", "0.72043616", "0.7181221", "0.71635437", "0.70859075", "0.69643205", "0.69631994", "0.6941659", "0.69308925", "0.6928495", "0.68998766", "0.6882689", "0.6879579", "0.68495977", "0.68219835", "0.67996645", "0....
0.8025036
0
Get the BMC Mac from RedFish
def get_mac_address(hostname): url = "https://{}/redfish/v1/Managers/1/EthernetInterfaces/1/".format(hostname) eth_dict = requests.get(url, auth=(USER,PASS),verify=False).json() mac_address = eth_dict['MACAddress'] LOGGER.info("IPMI BMC %s reports MAC address as %s", hostnameh, mac_address) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_mac(self):\n return self.__mac", "def get_sonic_mac(host, asicnum, port):\n if host.facts[\"num_asic\"] == 1:\n cmd = \"sudo ip link show {}\".format(port)\n else:\n ns = \"asic\" + str(asicnum)\n cmd = \"sudo ip netns exec {} ip link show {}\".format(ns, port)\n output ...
[ "0.6588843", "0.6586241", "0.6426141", "0.63516474", "0.62712574", "0.61390996", "0.61328363", "0.6111466", "0.6111466", "0.6086921", "0.6073458", "0.6061298", "0.6035936", "0.6028136", "0.60262287", "0.59856164", "0.59211636", "0.59168446", "0.59006864", "0.58995175", "0.589...
0.5884323
21
Prompt and convert cab and ru to a hostname
def location_to_index(): while True: cabinet = int(raw_input("Cabinet: ")) ru = int(raw_input("Rack U: ")) index = ((cabinet - 1) * 32) + ru correct = raw_input("Does index {} sound right (y/n)? ".format(index)) if 'y' in correct: break LOGGER.info("Mapp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_host_name():\r\n\tglobal HOST_NAME\r\n\r\n\twhile True:\r\n\t\tname_of_host = input(\"What is your name (As it appears in zoom without the '(Host, me)' part)? \")\r\n\t\tHOST_NAME = name_of_host + \" (Host, me)\"\r\n\t\tcorrect = input(f\"Host name set as {HOST_NAME}, is this correct? [Y/N]: \")\r\n\t\tif ...
[ "0.61417115", "0.59693193", "0.58512926", "0.5775678", "0.5465449", "0.54297626", "0.5409156", "0.53970236", "0.5384489", "0.5359659", "0.52832544", "0.52559316", "0.5251943", "0.52433914", "0.5231732", "0.5215157", "0.51479506", "0.5126778", "0.51189417", "0.5097943", "0.505...
0.0
-1
Convert to an emulab style mac
def emulab_mac(mac): return "".join(mac.lower().split(':'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def macFor(cls, board):\n return cls.MAC_PREFIX + '{:02X}'.format(int(board))", "def mac_ntoa(mac):\n return '%.2x:%.2x:%.2x:%.2x:%.2x:%.2x' % tuple(map(ord, list(mac)))", "def good_mac(mac):\r\n return mac.upper().replace('-', ':')", "def get_mac_string():\n mac_int = getnode()\n mac_str =...
[ "0.6040826", "0.59956956", "0.5854787", "0.5779863", "0.5675275", "0.56129545", "0.5586242", "0.552146", "0.54683423", "0.5457044", "0.54549307", "0.54475677", "0.5410852", "0.5382184", "0.5353483", "0.5331743", "0.5249846", "0.52239674", "0.5209968", "0.51962715", "0.5182766...
0.69217736
0
Stitch together the steps
def provision_bmc(hostname): LOGGER.info("Provisioning %s", hostname) mac = get_mac_address(hostname) blink_light(hostname) index = location_to_index() generate_sql(index, mac) blink_light(hostname, on=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_step(self) -> None:", "def _step(self) -> None:", "def step_forward(self):", "def step(self):\n #1. Time progresses\n self.time_operator.step()\n \n #2. Form and dissolve relationships\"\n self.relationship_operator.step()\n\n #3. HIV transmission\n sel...
[ "0.7023969", "0.68842584", "0.6786682", "0.6676937", "0.66504234", "0.66142386", "0.6586369", "0.6399443", "0.63699806", "0.6316583", "0.6300726", "0.6257871", "0.62492967", "0.6244361", "0.6241148", "0.6221081", "0.62170863", "0.6203809", "0.61842567", "0.609894", "0.6063322...
0.0
-1
See if an IP is up
def check_alive(hostname): LOGGER.info("Seeing if %s is alive", hostname) try: subprocess.check_call("ping -o -c1 -W1 {}".format(hostname), shell=True) except subprocess.CalledProcessError as exc: LOGGER.info("Host %s appears down", hostname) return False else: return T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkIP(self, ip = None):\n\t\treturn os.system(\"ping -c 1 -w2 \" + ip + \" > /dev/null 2>&1\") == 0", "def is_alive(self):\n ret = subprocess.call(\n shlex.split(\"ping -c 1 -W 2 %s\" % self.ip_address),\n stdout=open('/dev/null', 'w'),\n stderr=subprocess.STDOUT,\n ...
[ "0.73951226", "0.7028806", "0.6933253", "0.6876365", "0.67340374", "0.67282856", "0.67181677", "0.66473746", "0.6614493", "0.66109097", "0.6580546", "0.658013", "0.65744126", "0.6572488", "0.65436584", "0.65303814", "0.651624", "0.6508601", "0.64948905", "0.6459352", "0.64276...
0.58888644
70
Verify that the right node blinks
def check_address(): for i in range(1, 97): hostname = "sm{}-ipmi".format(i) if not check_alive(hostname): LOGGER.error("%s is dead", hostname) else: blink_light(hostname) raw_input("Is host {} on? ".format(hostname)) blink_light(hostname, on...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_balance(self):\n\t\tif math.abs(self.get_height(treenode=self.left) - self.get_height(treenode=self.right)) > 1:\n\t\t\tself.rebalance()", "def test_update_node_state_smartfail(self):\n pass", "def test_breeding_failed_carn(self):\n nt.assert_equal(self.carn.breeding(1), None)", "asyn...
[ "0.6044601", "0.5912378", "0.58205146", "0.5657362", "0.5654809", "0.56453246", "0.5585713", "0.5581643", "0.5547597", "0.5540926", "0.55249363", "0.55155265", "0.5514777", "0.54998475", "0.5494642", "0.549018", "0.5473279", "0.5464496", "0.5460745", "0.5455696", "0.5443095",...
0.0
-1
Gather the MAC addresses of eth0 from all SM hosts
def get_eth0_macs(): mac_dict = { 'mac_to_host': {}, 'host_to_mac': {} } # Host Range for i in range(1, 95): if i == 47: # 47 is broken continue hostname = "sm{}-ipmi".format(i) realname = "sm{}".format(i) mac = get_eth0_mac_ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mac_address_table(self):\n\n mac_address_table = []\n command = '/interface bridge host print terse'\n\n output = self._send_command(command)\n\n for host in parse_terse_output(output):\n mac_address_table.append({\n 'mac': cast_mac(host.get('mac-addres...
[ "0.7146105", "0.67204034", "0.6417322", "0.6113413", "0.60379297", "0.6028078", "0.6010826", "0.5976122", "0.5964501", "0.5955474", "0.5925722", "0.5905432", "0.5898975", "0.58903706", "0.58572847", "0.5804898", "0.5784774", "0.5769922", "0.57560873", "0.575395", "0.57504755"...
0.70925903
1