query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Given a single trade, executes it.
def execute_trade(self, trade): print trade
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_trade_send(self, trade: \"steam.TradeOffer\") -> None:", "def perform_trade(self):\n try:\n prediction, latest_value = self.predictor()\n except (MissingSamplesError,MarketClosedError) as e:\n print(f\"{type(e).__name__}: {e}\\nCancelled this trade.\")\n ...
[ "0.66631126", "0.6558388", "0.6470331", "0.6466781", "0.642113", "0.6392287", "0.6368913", "0.63584834", "0.6351473", "0.6315026", "0.62665486", "0.62665486", "0.62665486", "0.62665486", "0.62241447", "0.6129187", "0.6118846", "0.6116587", "0.6085619", "0.6022735", "0.6001218...
0.82063407
0
Executes the given command. Makes the right thing happen when the appcommand raises app.UsageError. Temporarily makes the appcommandspecific commandline flags appear to be global flags.
def _RunCommand(self, the_state, cmd, argv): flag_values = self._flag_values_by_cmd[argv[0]] FLAGS.AppendFlagValues(flag_values) # Prepare flags parsing, to redirect help, to show help for command orig_app_usage = app.usage def ReplacementAppUsage(shorthelp=0, writeto_stdout=1, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_command(cmd, **kwargs):\n cmd_list = [\n c for c in dir(commands) if not c.startswith('_') and c != 'os' # noqa\n ]\n\n if cmd not in cmd_list:\n raise ConfigurationError('command {} does not exists'.format(cmd))\n cmd_module = importlib.import_module('flaskutils.commands.' +...
[ "0.6261531", "0.625787", "0.61845744", "0.61081815", "0.6106056", "0.6059967", "0.60541695", "0.60345006", "0.593255", "0.5921884", "0.5911765", "0.58967817", "0.5891565", "0.5872479", "0.586665", "0.58581984", "0.58282465", "0.5795188", "0.5791574", "0.57791704", "0.5770114"...
0.73559964
0
Returns the full list of command names, aliases included.
def CmdList(self): return sorted(self._cmd_alias_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_command_names(self):\n return list(self.commands.keys())", "def commands(self, *ignored):\n return [command.rsplit(\"_\").pop() for command in dir(self) if command.startswith(\"command_\")]", "def getCommandList(self):\n return self.commands.keys()", "def _get_commands(self) -> l...
[ "0.80545396", "0.74197423", "0.7414297", "0.7245152", "0.72000843", "0.7194557", "0.7136101", "0.71355385", "0.7135109", "0.71267855", "0.711855", "0.7105755", "0.7094501", "0.7073247", "0.70351166", "0.7016222", "0.7006693", "0.69627017", "0.6953774", "0.69295156", "0.692418...
0.77171296
1
Turn a matplotlib Figure into Flask response
def fig_response(fig): img_bytes = io.BytesIO() fig.savefig(img_bytes) img_bytes.seek(0) return send_file(img_bytes, mimetype='image/png')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def figToResponse(self,fig):\n output = io.BytesIO()\n FigureCanvas(fig).print_png(output)\n return Response(output.getvalue(), mimetype='image/png')", "def simple(request):\n\n fig = Figure()\n ax = fig.add_subplot(111)\n x = []\n y = []\n now = datetime.datetime.now()\n d...
[ "0.7297697", "0.63114434", "0.6283384", "0.6185025", "0.6127524", "0.6031304", "0.6031244", "0.59641093", "0.5868468", "0.5837417", "0.57341766", "0.56730306", "0.5664421", "0.5648573", "0.5635697", "0.5631488", "0.5621028", "0.55682003", "0.5564759", "0.5561235", "0.55429775...
0.7180595
1
r""" The event is used to collect the user configuration and register a global message indexer accordingly to user configuration. The global indexer will be used inside the directive to parse the actual files.
def on_config_inited(app, *args): paths = app.config["rosmsg_path_root"] if isinstance(paths, str): paths = [paths] MessageIndexer.register_global(paths)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _config_filehandler(self, **kwargs):\n tool = FileHandlerFactory(self.filehandler_type, **kwargs)\n self._tools.append(tool.to_msg())", "def on_message(self, message):\n global currentFolder, userspace, pathslist\n\n userip = self.request.remote_ip\n\n tokens = re.split(\",...
[ "0.518629", "0.51521593", "0.5094051", "0.5087144", "0.5008113", "0.49371064", "0.49005273", "0.48734078", "0.48577332", "0.4843608", "0.4816458", "0.48120895", "0.4797734", "0.47870097", "0.47867623", "0.47622457", "0.47384548", "0.4728446", "0.4726752", "0.4714065", "0.4706...
0.6627756
0
Perform the keypoint extraction for max_octave cycles or until all octaves have been processed.
def process(self, max_octave=None): finished = False if self.cur_mask is None: self._init_mask() if self.data is None: self._initial_blur() if self.sigmas is None: self._calc_sigma() while not finished: self._one_octave(shrink=True,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def divide_octaves(self):\n octaves = []\n n_bins = 5\n cur_bin = 0\n cur_octave = 0\n while True:\n octaves.append(0)\n for i in range(n_bins):\n if cur_bin >= len(self.rel_mags):\n self.octaves = octaves\n ...
[ "0.4773192", "0.4719816", "0.465413", "0.46365803", "0.4608323", "0.45363066", "0.45028454", "0.44940338", "0.4472509", "0.44628078", "0.4446128", "0.4423777", "0.44099286", "0.43956828", "0.4381683", "0.43758598", "0.4368517", "0.436381", "0.43585578", "0.43404868", "0.43394...
0.6683271
0
Return the nearest peak from a position
def nearest_peak(self, p, refine=True, Imin=None): if Imin: valid = (self.keypoints.I >= Imin) kp = self.keypoints[valid] else: kp = self.keypoints dy = kp.y - p[0] dx = kp.x - p[1] r2 = dx * dx + dy * dy best_pos = r2.argmin() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _closest_peak(peak_points, prev_step, dot_limit):\n peak_dots = dot(peak_points, prev_step)\n closest_peak = abs(peak_dots).argmax()\n dot_closest_peak = peak_dots[closest_peak]\n if abs(dot_closest_peak) < dot_limit:\n raise StopIteration(\"angle between peaks too large\")\n if dot_close...
[ "0.737814", "0.6963202", "0.6815278", "0.66613877", "0.6552527", "0.6545717", "0.65368104", "0.65204275", "0.640678", "0.6357571", "0.6337557", "0.6329592", "0.6281388", "0.6278998", "0.6278998", "0.6276764", "0.62595195", "0.62589455", "0.62444055", "0.624385", "0.62224287",...
0.6964242
1
Return the list of peaks within an area
def peaks_from_area(self, mask, keep=None, refine=True, Imin=None, **kwargs): y = numpy.round(self.keypoints.y).astype(int) x = numpy.round(self.keypoints.x).astype(int) is_inside = (mask[y, x]).astype(bool) if is_inside.sum() == 0: logger.error("No keypoint that region") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peaks_vs_area(pmap):\n fdata = pmap.get_field_data()\n return numpy.c_[fdata['peak'], fdata['area']].T", "def get_peaks(chromosome, start, end, peaks):\n candidates = peaks[chromosome]\n indexes = [int(x[0]) for x in candidates]\n index_start = bisect(indexes, start)\n index_end = bisect(in...
[ "0.74473315", "0.6718453", "0.6631938", "0.6494976", "0.647758", "0.6463088", "0.6352382", "0.63499427", "0.63015425", "0.6265822", "0.6236883", "0.6221178", "0.6149676", "0.6141899", "0.61218566", "0.61080647", "0.6093049", "0.6092761", "0.60826004", "0.60676646", "0.606548"...
0.718679
1
Returns TRUE if called upstream by validate_user_signout method. This is used to change the mock return of the SLSx userinfo endpoint when called by the OAuth2ConfigSLSx.validate_user_signout() method.
def is_called_by_validate_user_signout(): curframe = inspect.currentframe() calframe = inspect.getouterframes(curframe, 2) for i in calframe: if str(i.function) == "validate_user_signout": return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sso_user_verified(test_sso_user) -> dict:\n verify_response = SSO_API_CLIENT.patch(\n url=f\"testapi/user-by-email/{test_sso_user['email']}/\",\n data={\"is_verified\": True},\n authenticator=BASIC_AUTHENTICATOR,\n )\n assert verify_response.status_code == HTTP_204_NO_CONTENT...
[ "0.59500915", "0.57337445", "0.56603587", "0.56569415", "0.5620733", "0.55935013", "0.5526833", "0.54947597", "0.54390216", "0.5436274", "0.543509", "0.54321927", "0.54248536", "0.54228985", "0.5406359", "0.5400294", "0.5304849", "0.529756", "0.52738094", "0.52442855", "0.523...
0.6744582
0
Compute an estimate for the rank of the most recent common ancestor (MRCA) that, on average, avoids systematic over or underestimation.
def estimate_rank_of_mrca_unbiased( coincident_ranks_from_first_disparity_through_first_commonality: typing.Iterator[ int ], p_differentia_collision: float, prior: object, ) -> typing.Optional[float]: base = p_differentia_collision weights, expected_ranks, sum_weight = [], [], 0.0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowest_common_ancestor(node):\n pass", "def __call__(\n self: \"CalcMrcaUncertaintyAbsExact\",\n policy: PolicyCouplerBase,\n first_num_strata_deposited: int,\n second_num_strata_deposited: int,\n actual_rank_of_mrca: int,\n ) -> int:\n # rectify negative-index...
[ "0.57603675", "0.57402635", "0.5723751", "0.5695038", "0.5622952", "0.55952525", "0.55021775", "0.5487209", "0.5472773", "0.5466164", "0.5460477", "0.5416344", "0.5400518", "0.53934896", "0.5355848", "0.53380156", "0.5327873", "0.5325883", "0.53139824", "0.5287846", "0.527659...
0.60859555
0
Regular max won't compare dates with NoneType and raises exception for no args
def safe_max(*args, **kwargs): non_nones = [v for v in args if v is not None] if len(non_nones) == 0: return None elif len(non_nones) == 1: return non_nones[0] else: return max(*non_nones, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _null_max(a, b):\n if a is None:\n return b\n if b is None:\n return a\n return max(a, b)", "def max_or_none(val1, val2):\n return max(val1, val2, key=lambda x: -sys.maxint if x is None else x)", "def max(*x, na_rm: bool = False) -> Any:\n fun = numpy.nanmax if na_rm else numpy.max\n x = ...
[ "0.6800514", "0.66728216", "0.65872735", "0.6572686", "0.63780963", "0.6196753", "0.6169675", "0.6140182", "0.6119614", "0.6090574", "0.6069216", "0.60612416", "0.60210025", "0.59794307", "0.59484816", "0.5936233", "0.59337825", "0.5922495", "0.5903118", "0.5886082", "0.58629...
0.7084769
0
Normalizes text before keyword matching. Converts to lowercase, performs KD unicode normalization and replaces multiple whitespace characters with single spaces.
def normalize(text): return unicodedata.normalize("NFKD", re.sub(r"\s+", " ", text.lower()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(text):\n return text.lower().translate(TRANSLATION_TABLE)", "def normalize(text):\n # Remove endings of song titles with extra info, e.g., (radio edit)\n text, foo, bar = text.partition(' - ')\n text, foo, bar = text.partition(' (')\n # Set to lower case and strip extra spaces on the...
[ "0.719955", "0.71913165", "0.7090791", "0.7058115", "0.6974177", "0.69290274", "0.6879001", "0.6825262", "0.6785198", "0.67569494", "0.67540497", "0.6736676", "0.6724436", "0.6724436", "0.6722344", "0.6712091", "0.6694824", "0.66625726", "0.66625726", "0.66625726", "0.6662572...
0.75461876
0
Checks the given text for a keyword match
def match_keywords(text, keywords): for keyword in keywords: if re.search(r"\b" + keyword + r"\b", text, flags=re.IGNORECASE): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_keyword_present(self,text):\n if self.keywords_re.search(text) and not self.blocked_keywords_re.search(text):\n print self.blocked_keywords_re.search(text)\n return True\n return False", "def word_finder(word, text):\r\n word = word.lower()\r\n text = str(...
[ "0.7755764", "0.74115896", "0.70937157", "0.7046507", "0.68935156", "0.6837468", "0.674666", "0.6717007", "0.66964054", "0.66718024", "0.66510713", "0.66148365", "0.6552441", "0.65460795", "0.65428233", "0.65214926", "0.6499533", "0.64979", "0.6485338", "0.6449193", "0.637649...
0.75193787
1
Converts a date to a millisecond accuracy timestamp. Equivalent to Date.UTC(d.year, d.month1, d.day) in Javascript
def date_to_milliseconds(d): return calendar.timegm(datetime.combine(d, time(0, 0, 0)).replace(tzinfo=pytz.UTC).utctimetuple()) * 1000
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unix_time_millisecond(date):\r\n return unix_time(date, float=True) * 1e3", "def utc_millisecond_timestamp():\n return __date_to_millisecond_ts(utc())", "def utc_timestamp(d):\n if isinstance(d, pd.tslib.Timestamp):\n # Pandas datetime timestamp whatever thing\n if d.tz != pytz.utc:\...
[ "0.728515", "0.7048117", "0.6665483", "0.65586203", "0.6473058", "0.64467794", "0.63545495", "0.63019687", "0.62854236", "0.62761515", "0.6258863", "0.6236034", "0.61951363", "0.61670613", "0.61646944", "0.61426383", "0.60565823", "0.6056321", "0.6024606", "0.59626627", "0.59...
0.740372
0
Converts a datetime to a microsecond accuracy timestamp
def datetime_to_microseconds(dt): seconds = calendar.timegm(dt.utctimetuple()) return seconds * 1000000 + dt.microsecond
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utc_millisecond_timestamp():\n return __date_to_millisecond_ts(utc())", "def _from_microseconds(value):\n return _UTC_EPOCH + datetime.timedelta(microseconds=value)", "def datetime_to_epoch_microseconds(obj: \"datetime\") -> float:\n td = datetime_to_epoch_timedelta(obj)\n return (td.days * 864...
[ "0.72529066", "0.70968264", "0.7032166", "0.7006187", "0.6993755", "0.699352", "0.6958667", "0.6932001", "0.67451006", "0.6707826", "0.66934925", "0.6637661", "0.65551037", "0.65199524", "0.6482659", "0.64510804", "0.64466745", "0.6440227", "0.64201826", "0.63682145", "0.6329...
0.78731877
0
Converts a microsecond accuracy timestamp to a datetime
def microseconds_to_datetime(ms): return datetime.utcfromtimestamp(ms / 1000000.0).replace(tzinfo=pytz.utc)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp_to_datetime(value):\n if not isinstance(value, (int, long, float)):\n raise ValueError(\n 'Expecting a number, got %s instead' % type(value).__name__)\n return EPOCH + datetime.timedelta(microseconds=value)", "def _time_to_datetime(value):\r\n assert isinstance(value, datetime.time)\...
[ "0.72197497", "0.72195035", "0.72044027", "0.7151784", "0.69175553", "0.6827507", "0.67991424", "0.67348254", "0.67316675", "0.6656708", "0.662968", "0.66295", "0.662285", "0.6554271", "0.6492199", "0.6461113", "0.6452887", "0.6444923", "0.6387432", "0.6385543", "0.63840055",...
0.7604913
0
Converts a UUID hex string to an int within the range of a Django IntegerField, and also >=0, as the URL regexes don't account for negative numbers.
def uuid_to_int(uuid): return UUID(hex=uuid).int % (2147483647 + 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hex2int(r: str) -> int:", "def check_int_uuid(uuid):\n try:\n converted = UUID(int=uuid, version=4)\n except ValueError:\n return False\n\n return converted.int == uuid", "def __hex2int(_hex_str):\n return int(\"0x\"+_hex_str, 16)", "def hex_to_int(hex_string):\r\n return...
[ "0.64417714", "0.64231217", "0.62070096", "0.58088577", "0.5784129", "0.57240516", "0.5679936", "0.56471455", "0.5635554", "0.5630116", "0.5625564", "0.5601663", "0.558437", "0.5583941", "0.55534047", "0.5506495", "0.54904664", "0.548656", "0.548602", "0.54572433", "0.5445689...
0.68420196
0
Gets the language name for the given ISO6393 code.
def get_language_name(iso_code): if iso_code not in LANGUAGES_BY_CODE: try: lang = iso639.languages.get(part3=iso_code) except KeyError: lang = None if lang: # we only show up to the first semi or paren lang = re.split(r";|\(", lang.name)[0].s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def language_name(value):\n return pycountry.languages.get(alpha_2=value)", "def get_locale_name(code):\n language_map = dict(django.conf.global_settings.LANGUAGES)\n\n # check for exact match\n if code in language_map:\n return language_map[code]\n\n # try for the language, fall back to ju...
[ "0.7385633", "0.7274735", "0.7177817", "0.69214004", "0.6743556", "0.6650705", "0.6432257", "0.6353041", "0.6301158", "0.6153916", "0.6110643", "0.60967785", "0.6089928", "0.60717005", "0.6054486", "0.60135984", "0.5970771", "0.59593534", "0.58977", "0.5894957", "0.5845086", ...
0.8210028
0
Gets whether the given code is a valid ISO6393 code.
def is_valid_language_code(code): try: iso639.languages.get(part3=code) return True except KeyError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_valid_code(self, code):\r\n return code in COUNTRY_CODES", "def is_valid(postal_code):\n return bool(re.match(UK_POST_CODE_REGEX, postal_code, re.VERBOSE)) if postal_code else False", "def is_valid_postal_code(postal_code):\n is_code_valid = False\n postcode_regex = re.compile(r'^\\d{2}...
[ "0.6936153", "0.63197273", "0.60053056", "0.59849423", "0.5789979", "0.5755435", "0.56287956", "0.5488081", "0.5430039", "0.540185", "0.53728503", "0.53156346", "0.5292165", "0.52611434", "0.52237856", "0.52043635", "0.5176588", "0.51724887", "0.51656127", "0.5162612", "0.515...
0.7740952
0
A list of monsters inside dungeon.
def MONSTERS(): list_of_monster = [ ("Elfy the Elf", "A small elvin creature with a bow and arrows around its back.", 2, 1, 1), ("Bazilisk", "A long snake with piercing eyes", 3, 2, 1), ("Shrak the Ogre", "A large green ogre with a penchant for eating people", 4, 2, 2), ("Wanda the Witch", "A tall scary look...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_mobs(self):\n mobs = []\n z = 0\n while z < 10: # 10 mobs per level for now\n c = 0\n while c == 0:\n x = random.randint(0, self.map.width - 1)\n y = random.randint(0, self.map.height - 1)\n if self.map.map[x][y]....
[ "0.69287133", "0.63263077", "0.5886569", "0.5824322", "0.57758963", "0.5768761", "0.5732632", "0.57172227", "0.57103765", "0.5675186", "0.5659909", "0.5647063", "0.56430095", "0.5635332", "0.56214225", "0.5607423", "0.56003904", "0.5582513", "0.55810535", "0.55605525", "0.555...
0.6744559
1
[set the book Author]
def addSetAuthor(self,val): self.bookAuthor = val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setAuthor(self,value):\n self.PDFreactorConfiguration.in1[\"author\"] = value", "def set_author(self, author):\n self.author = author\n self.opf.author = author", "def set_author (self, author):\n self.author = author", "def author(self, author):\n self._author = author...
[ "0.82572687", "0.8028083", "0.7942858", "0.7935961", "0.7780075", "0.76821053", "0.7632148", "0.7632148", "0.75764555", "0.736058", "0.73203236", "0.7059934", "0.69923925", "0.69791156", "0.6916502", "0.6879281", "0.6812324", "0.6710715", "0.6664415", "0.66638213", "0.6582486...
0.861797
0
[gets the ISBN of the book object]
def getISBN(self): return self.bookISBN
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_isbn(self):\n return self.isbn", "def get_book_by_isbn(isbn):\n return Book.get_book(isbn)", "def ISBN(self, default=None):\n return self.data.get('isbn', default)", "def testgetISBN(self):\r\n ebook1 = ElectronicResources()\r\n #ebook1.setListDevices([device1, devi...
[ "0.83998966", "0.7834889", "0.77634466", "0.7269846", "0.71079844", "0.70292556", "0.6772832", "0.6710107", "0.65745664", "0.6405835", "0.63930047", "0.6375792", "0.6361034", "0.62676245", "0.62550044", "0.6215608", "0.6143562", "0.6137508", "0.61294484", "0.61000735", "0.605...
0.87114733
0
gets the number of purchased books
def getNumPurchased(self): return self.numberPurchased
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n return Library.functions.count(self._book)", "def count_buy(self):\n return Library.functions.count_buy(self._book)", "def book_count(self):\n\n try:\n cur = self._db.cursor()\n cur.execute('SELECT COUNT(*) FROM books')\n ...
[ "0.7311004", "0.7072531", "0.6842811", "0.68022865", "0.67554307", "0.6687002", "0.65078276", "0.62787765", "0.62066764", "0.6166822", "0.6118746", "0.611226", "0.6108931", "0.6097724", "0.6069314", "0.6069314", "0.6069314", "0.6069314", "0.6050876", "0.60248315", "0.6020721"...
0.7442632
0
Chopping of a file
def chop(options): root_file = None if not options.freplace: if not options.parallel: if len(options.args) != 2: raise TelemacException(\ '\nThe code "chop" (without --replace) ' 'here requires 2 file names\n') slf_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file():\r\n return deque()", "def reload_tailed_file(self):\n try:\n self.file_ = open(self.tailed_file, \"r\")\n self.size = os.path.getsize(self.tailed_file)\n\n # Go to the head of file\n self.file_.seek(0, 1)\n\n return True\n except...
[ "0.5504538", "0.54339844", "0.54205906", "0.5375172", "0.53406924", "0.5252787", "0.52156204", "0.5200041", "0.51672477", "0.5140827", "0.51195353", "0.51011556", "0.51010895", "0.5096222", "0.5081342", "0.5064958", "0.505003", "0.50118196", "0.50048953", "0.4994026", "0.4989...
0.5906039
0
Returns list of variables without scopes that start with exclude_scopes .
def get_variables(finetune_ckpt_path, exclude_scopes=None): if exclude_scopes is not None: exclusions = [scope.strip() for scope in exclude_scopes] variables_to_restore = [ var for var in slim.get_model_variables() if not np.any([var.op.name.startswith(ex) for ex in exclusions])] else: v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_variables_to_restore():\n# checkpoint_exclude_scopes=[\"distance-module\", \"InceptionV4/Logits\"]\n checkpoint_exclude_scopes=[\"DeInceptionV4\"]\n exclusions = [scope.strip() for scope in checkpoint_exclude_scopes]\n\n variables_to_restore = []\n for var in slim.get_model_variables():\n ...
[ "0.720917", "0.69072914", "0.66063374", "0.6404244", "0.6290807", "0.6250691", "0.6105175", "0.6102679", "0.6044578", "0.6044243", "0.5991366", "0.59767663", "0.59064114", "0.5837804", "0.57819754", "0.5755795", "0.5755795", "0.5748342", "0.57453793", "0.5731443", "0.571667",...
0.72680116
0
Initializes solver using solver param
def init_solver(param): return param.solver(learning_rate=param.learning_rate, beta1=param.beta1, beta2=param.beta2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_solver(self):\n self.solver = Solver.select_solver(self.method, self.solver_args)\n if self.method.lower()==\"elastic-net\":\n self.solver.elements=self.basis.elements", "def setup_solver(self):\n option = Options()\n if logger.getEffectiveLevel() == logging.DEBUG:...
[ "0.6933553", "0.6792376", "0.667814", "0.6658098", "0.6546298", "0.6470432", "0.64449465", "0.6363484", "0.62997067", "0.627163", "0.62099284", "0.61571366", "0.6132777", "0.60913944", "0.60901535", "0.6075938", "0.6069767", "0.6035047", "0.6031944", "0.60215604", "0.60092294...
0.84947443
0
pr is logits. computes multiclass accuracy
def multiclass_accuracy(pr, gt): correct_prediction = tf.equal(tf.round(tf.nn.sigmoid(pr)), tf.round(gt)) accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32)) return accuracy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accuracy(self, logits, labels):\n\n ########################\n # PUT YOUR CODE HERE #\n #######################\n predictions = tf.argmax(input=logits, axis=1, name='label_predictions')\n class_labels = tf.argmax(input=labels, axis=1)\n\n accuracy = tf.to_float(tf.equ...
[ "0.7285938", "0.7140583", "0.7133395", "0.7092764", "0.7063149", "0.6938243", "0.6828483", "0.68140155", "0.6770336", "0.6767815", "0.6763319", "0.6758636", "0.67489094", "0.67462796", "0.6731694", "0.6729644", "0.6728175", "0.67274964", "0.67273647", "0.671521", "0.6714998",...
0.7753985
0
FC with norm, activation, dropout support
def fc(input, output, reuse=False, norm=None, activation=tf.nn.relu, dropout=0.7, is_training=True, name='fc'): with tf.variable_scope(name, reuse=reuse): x = slim.fully_connected(input, output, activation_fn=activation, normalizer_fn=norm, reuse=reuse) x = tf.nn.dropout(x, dropout) return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fc(self, inputs, out_dim, name=\"fc_layer\"):\n initializer = tf.contrib.layers.xavier_initializer()\n w = tf.Variable(initializer(shape=[in_dim, out_dim]), name='weights')\n b = tf.Variable(tf.zeros(shape=[out_dim]), name='bias')\n out = tf.matmul(inputs, w) + b\n return out...
[ "0.69007343", "0.65705687", "0.6463823", "0.63683665", "0.6295745", "0.6284069", "0.62624097", "0.6245137", "0.6245087", "0.6236857", "0.6160769", "0.6151713", "0.61289096", "0.6125847", "0.6121168", "0.6110384", "0.6090827", "0.6084116", "0.6079222", "0.604836", "0.6045172",...
0.7011253
0
Reflect pads input by adding pad_size to h x w dimensions
def pad(input, pad_size): if not pad_size: return input return tf.pad(input, [[0,0],[pad_size, pad_size],[pad_size, pad_size],[0,0]], 'REFLECT')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_pad(input, size):\n M1 = tf.concat([input[:, :, -size[1]:, :], input, input[:, :, 0:size[1], :]], 2)\n M1 = tf.concat([M1[:, -size[0]:, :, :], M1, M1[:, 0:size[0], :, :]], 1)\n return M1", "def pad2d_hw_shape(\n h_w: Union[int, Tuple[int, int]],\n pad_size: Union[int, Tuple[int, int], Tup...
[ "0.7233095", "0.697727", "0.681642", "0.68118125", "0.6807323", "0.6792372", "0.67235726", "0.6717754", "0.66783816", "0.66661566", "0.6654894", "0.66179925", "0.6610793", "0.65578634", "0.6521711", "0.6488787", "0.6449627", "0.644732", "0.64341927", "0.6410827", "0.63995403"...
0.7037951
1
Stores the dataframe. Either in a local path, or on cloud storage.
def store_result(dataframe, filepath): if not filepath.startswith('gs://'): logging.info("Storing result locally in: {}".format(filepath)) dataframe.to_csv(filepath, index=True) else: logging.info("Storing result in cloud storage in path: {}".format(filepath)) # Content to write ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_df(data_frame, file_path):\r\n data_frame.to_csv(file_path)\r\n return None", "def store_to_file(self, file_type, path):\n if not isinstance(self.dataframe, pd.DataFrame):\n raise ValueError('dataframe argument is not a Pandas.DataFrame')\n elif file_type.lower() not in ['...
[ "0.7199112", "0.7063253", "0.6830922", "0.678445", "0.67565364", "0.67138433", "0.668296", "0.66033417", "0.6578787", "0.6512117", "0.65071225", "0.6500428", "0.6457406", "0.64400685", "0.63938373", "0.638503", "0.6378449", "0.6362153", "0.6334309", "0.6320918", "0.6281366", ...
0.7269431
0
If a payload or a file is provided, use it. Otherwise, propose the user an editor with a default query.
def get_query_from_payload_xor_data_otherwise_editor(_payload, file, default_query, file_prefix): if _payload is not None and file is not None: utils.error("--data and --file are mutually exclusive.") if _payload is not None: if isinstance(_payload, dict): data = json.dumps(_payloa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_external_editor(filename=None, sql=None):\n\n message = None\n filename = filename.strip().split(' ', 1)[0] if filename else None\n\n sql = sql or ''\n MARKER = '# Type your query above this line.\\n'\n\n # Populate the editor buffer with the partial sql (if available) and a\n # placehol...
[ "0.5870558", "0.515388", "0.512633", "0.5038213", "0.50066376", "0.49565703", "0.48775005", "0.48113602", "0.47934082", "0.47250897", "0.47207648", "0.47116482", "0.4688943", "0.46729988", "0.46712863", "0.46708572", "0.46192116", "0.46079788", "0.45906565", "0.4583833", "0.4...
0.6945503
0
Return the timezone map, generating it if needed.
def get_tz_map(version=LATEST_VER): _gen_map() return _TZ_MAP
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tz_rmap(version=LATEST_VER):\n _gen_map()\n return _TZ_RMAP", "def _map_timezones():\n tz_map = {}\n todo = HAYSTACK_TIMEZONES_SET.copy()\n for full_tz in pytz.all_timezones:\n # Finished case:\n if not bool(todo): # pragma: no cover\n # This is nearly impossible f...
[ "0.74370706", "0.6570189", "0.65298337", "0.6491904", "0.6434843", "0.6367455", "0.6088126", "0.6056394", "0.6036855", "0.60350317", "0.5913512", "0.5857469", "0.5765073", "0.5715903", "0.57140595", "0.5703094", "0.56877476", "0.56223917", "0.55516887", "0.5518664", "0.549725...
0.80604345
0
Return the reverse timezone map, generating it if needed.
def get_tz_rmap(version=LATEST_VER): _gen_map() return _TZ_RMAP
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tz_map(version=LATEST_VER):\n _gen_map()\n return _TZ_MAP", "def Timezones():\n return sorted(list(PytzCache._zmap.values()))", "def _map_timezones():\n tz_map = {}\n todo = HAYSTACK_TIMEZONES_SET.copy()\n for full_tz in pytz.all_timezones:\n # Finished case:\n if not bo...
[ "0.7278727", "0.6226269", "0.6062051", "0.58193207", "0.5761579", "0.5724349", "0.55882674", "0.54132795", "0.5372138", "0.5352945", "0.5299746", "0.5234578", "0.5211663", "0.51854223", "0.5151114", "0.514626", "0.5117133", "0.50950706", "0.5084222", "0.50495654", "0.5046373"...
0.78640175
0
Returns state action probability distribution dict. Returns
def get_state_action_probability_dict_dict(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_action_probability_dict(self, state):\n pass", "def get_probs(self, states, actions):\n # YOUR CODE HERE\n \n probs = np.ones(len(states))/2\n return probs", "def get_action_probs(self, state):\n state = state.astype(np.float32)\n return self.session.run...
[ "0.8994351", "0.75745773", "0.75480866", "0.7297051", "0.7238821", "0.7178417", "0.7147515", "0.70597255", "0.7045411", "0.7019414", "0.69511634", "0.6940256", "0.6915927", "0.6913083", "0.68839854", "0.68494976", "0.6840427", "0.6817927", "0.6790305", "0.67675054", "0.668421...
0.88919246
1
Returns action probability distribution from the state.
def get_action_probability_dict(self, state): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_action_probs(self, state):\n state = state.astype(np.float32)\n return self.session.run(self.action_probs,\n feed_dict={self.s_placeholder: state})", "def get_action(self, state):\n action_probs = self.forward(state)\n action = torch.distribution...
[ "0.8005834", "0.79708177", "0.7950502", "0.78927654", "0.7843559", "0.776451", "0.7752941", "0.76965046", "0.7608146", "0.7578268", "0.7534149", "0.75231683", "0.75188714", "0.75041866", "0.7463561", "0.73656386", "0.73595685", "0.7343611", "0.73334104", "0.7303352", "0.73011...
0.8409741
0
Returns cell value or an empty string.
def cell_value(cell): value = getattr(cell, 'value', '') if value is None or str(value).startswith('='): # we don't calculate expressions return '' else: return str(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCellValue(self, row = None, column = None, *, cell = None, strip = False):\n\n\t\t\t\tif (cell is None):\n\t\t\t\t\tcell = self.getCell(row = row, column = column)\n\n\t\t\t\tif ((not strip) or (cell.value is None) or (not isinstance(cell.value, str))):\n\t\t\t\t\treturn cell.value\n\n\t\t\t\tvalue = cell.v...
[ "0.7481379", "0.7167552", "0.70062363", "0.6958826", "0.68966067", "0.6839461", "0.6776999", "0.6611954", "0.660957", "0.6476377", "0.6438021", "0.64055234", "0.63834494", "0.63834494", "0.6358165", "0.63168186", "0.61936337", "0.6180817", "0.61807334", "0.6169637", "0.616963...
0.80235636
0
Compile every codecool member to one collection
def _compile_codecoolers(cls): cls.codecoolers = Student.get_students() + Mentor.get_mentors() + Admin.get_admins()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile(self, collection):\n \n return 0", "def _compile_list(self):\n if self.case_insensitive:\n return [(re.compile(pattern, re.I), replacement) for\n pattern, replacement in self.uncompiled]\n else:\n return [(re.compile(pattern), repla...
[ "0.648147", "0.59205645", "0.58802456", "0.58248144", "0.5643787", "0.55897653", "0.5561151", "0.5536955", "0.5505781", "0.5392964", "0.5387718", "0.5374681", "0.5374658", "0.53730327", "0.5313672", "0.53111166", "0.5304053", "0.52908367", "0.52852863", "0.5238188", "0.523711...
0.67701995
0
Test creating a new product category
def test_create_product_successful(self): ProductCategory.objects.create(name="test name", description="new name") test_key = ProductCategory.objects.values()[0] # print(test_key) payload = { 'name': 'Test Tag', 'product_category_id': test_key.get('id'), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_category(self):\n pass", "def test_create_category(self):\n res = self.client().post('/categories/', data=self.category)\n self.assertEqual(res.status_code, 201)\n self.assertIn('Stews', str(res.data))", "def test_add_category_to_product(self):\n login = self....
[ "0.8666074", "0.8083804", "0.80333173", "0.8018478", "0.80060804", "0.79673266", "0.7897619", "0.7886233", "0.7873304", "0.7858809", "0.76521426", "0.75928867", "0.75764745", "0.74452746", "0.7441107", "0.73869574", "0.7349622", "0.73455846", "0.73388535", "0.72651356", "0.72...
0.8309495
1
Instantiate a logger for this command
def __init__(self, *args, **kwargs): super(BaseCommandWithLogger, self).__init__(*args, **kwargs) logger_name = '/'.join([self.app_name, self.name]) self.logger = logging.getLogger(logger_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.logger = logger()", "def build_logger(self):\n pass", "def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.log = logging.getLogger(logger_name(__name__))", "def _instanciate_logger(self):\n\t\tself._logger = logging.getLogger(...
[ "0.72129446", "0.7059219", "0.7025207", "0.6991321", "0.69672096", "0.6945733", "0.68668175", "0.685063", "0.67268413", "0.67195994", "0.6715779", "0.67065454", "0.6695128", "0.6687072", "0.66459155", "0.66342306", "0.66322047", "0.6628688", "0.6617226", "0.6614343", "0.66118...
0.7487473
0
Return this command's name. The name of a Django management command is nothing more than the name of the file where it sits, with the extension stripped out.
def name(self): module_filepath = inspect.getfile(type(self)) module_filename = os.path.basename(module_filepath) command_name, _ = os.path.splitext(module_filename) return command_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_name(self):\n return None", "def __getFullCommandName(self, command, type):\n return 'cmd_%s_%s' % (type, command)", "def get_command_name(args):\n\n # First argument would always be atlas or manage.py, i.e the calling interface\n if len(args) < 2:\n CommandError.print_to...
[ "0.7221757", "0.68458074", "0.6797556", "0.6686816", "0.6499827", "0.6428203", "0.64199543", "0.6405688", "0.639326", "0.6377145", "0.62805665", "0.6224193", "0.6212611", "0.62076145", "0.62063813", "0.6203215", "0.6191002", "0.6135667", "0.6128957", "0.6126173", "0.609243", ...
0.7605796
0
Clean authorities if their amount of connected item is below the threshold
def thresholder(self, threshold = False, compute = False, computeMin= False): if threshold: self.threshold = threshold try: if compute: self.countAuthorities(purge=True) x = [self.authorities[i] for i in self.authorities if self.authorities[i] != 1] xx = sorted(x) l = float(len(xx)) if c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def process_prune(\n channel, amount, user_id: int, ctx=None, inter=None, allowed_mentions=None\n):\n user = await User.get(user_id)\n if amount not in range(PRUNE_MIN, PRUNE_MAX):\n return await send_message(\n PRUNE_MIN,\n PRUNE_MAX,\n key=\"not_in_range\",\...
[ "0.56368345", "0.5378013", "0.53335387", "0.5282283", "0.52782786", "0.51789063", "0.51749015", "0.5120327", "0.510957", "0.5097219", "0.507842", "0.50510216", "0.50247717", "0.50164735", "0.49702242", "0.49412838", "0.49349833", "0.49303597", "0.4930107", "0.4915352", "0.491...
0.6142882
0
Extract $ACCT_NO, $CURRENCY and $FOREIGN_COUNTRY from description to a new column
def extract_description_features(df, desc_col_name, remove_var=False): df['isAcctNo'] = df[desc_col_name].str.contains('$ACCT_NO', regex=False).astype('int') df['isForeignCurr'] = df[desc_col_name].str.contains('$CURRENCY', regex=False).astype('int') # df['isForeignCountry'] = df[desc_col_name].str.contains...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _format_beneficiary_customer_59F(self, val):\n account = val.get('ACCOUNT')\n name = val.get('NAME')\n address = val.get('ADDRESS')\n country_code = val.get('COUNTRY_CODE')\n town = val.get('TOWN')\n name_list, address_list, country_and_town_list = [], [], []\n\n ...
[ "0.54826945", "0.54259354", "0.52753925", "0.51045966", "0.5098985", "0.50600314", "0.50017625", "0.49563834", "0.4946617", "0.4933699", "0.48514158", "0.48360968", "0.48163536", "0.48143622", "0.48055294", "0.4793342", "0.47678524", "0.47598422", "0.4758132", "0.47534722", "...
0.65888876
0
Mask account number with $ACCT_NO
def mask_acct_no(column): return column.str.replace(r'\d*\*{3,}\d*|\d+(\-\d+){2,}', ' $ACCT_NO ')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def safe_number(self):\n mask = '*' * (len(self.account_number) - 4)\n return '{0}{1}'.format(mask, self.account_number[-4:])", "def format_aws_account_id(value):\n return str(value).zfill(12)", "def safe_number(self):\n mask = '*' * (len(self.card_number) - 4)\n return '...
[ "0.68052506", "0.60379833", "0.59726363", "0.57280743", "0.5665146", "0.5501213", "0.545594", "0.5329968", "0.532395", "0.53023976", "0.52988034", "0.52743536", "0.5210675", "0.5205445", "0.5189349", "0.5185346", "0.51673627", "0.51256794", "0.511375", "0.50488406", "0.504066...
0.779833
0
Mask foreign currency text with $CURRENCY Must do before removing numbers from the text
def mask_foreign_currency(column): curr = misc_utils.load_currencies() # Drop New Zealand currencies curr = curr.drop(curr[curr['id'] == 'nzd'].index) # Drop ancient currencies curr = curr.drop(curr[curr.value.str.contains(r'\(\d', regex=True)].index) # Remove texts in brackets: belgian franc (c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_currency_symbols(text, replace_with=\"_CUR_\"):\n return RE_CURRENCY_SYMBOL.sub(replace_with, text)", "def replace_money_token(text):\n\n return re.sub(r\"(\\$|€)\\d*((\\.|,)*\\d*)*\", \"<money/>\", text, re.M | re.I)", "def text_transform(val):\n if CURRENCY == \"USD\":\n return \"...
[ "0.7192317", "0.7133706", "0.70557743", "0.69585484", "0.6847322", "0.6643723", "0.65412945", "0.6361416", "0.6186817", "0.6186817", "0.6186817", "0.6107079", "0.60907996", "0.5830142", "0.57810676", "0.5770057", "0.57397074", "0.5730545", "0.5728919", "0.57192415", "0.567510...
0.71880287
1
Mask foreign country name with $FOREIGN_COUNTRY
def mask_foreign_country(column): codes = misc_utils.load_country_code() # Remove New Zealand from foreign country list codes = codes.drop(codes[codes['Alpha-2'] == 'nz'].index) # Remove texts in brackets: belgian franc (convertible) -> belgian franc codes['Country'] = codes['Country'].replace({r'\(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_country(raw_country):\n #\n if raw_country[0:2]==\"l'\":\n raw_country = raw_country[2:]\n country = ''.join((c for c in unicodedata.normalize('NFD', raw_country) if unicodedata.category(c) != 'Mn'))\n country = re.sub(r\"(\\s|')\", \"-\", country) # replace space and quotes with dash\...
[ "0.6272275", "0.60832465", "0.60702956", "0.5947256", "0.57604736", "0.56804645", "0.5616587", "0.56001914", "0.55945987", "0.55775535", "0.5433567", "0.543088", "0.5425026", "0.54066634", "0.5370467", "0.53429735", "0.5331653", "0.53220636", "0.53181976", "0.52997565", "0.52...
0.8104869
0
Get and update cluster name from cookiecutter.json.
def get_cluster_name(): cookiecutter_path = Path("cookiecutter.json") cookiecutter_dict = json.loads(cookiecutter_path.read_text()) cluster_name = "" try: cluster_name = cookiecutter_dict["cluster_name"] except KeyError: while not cluster_name: cluster_name = input("Pleas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")", "def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")", "def cluster_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"cluster_name\")", "def cluster_name(self) -> pulumi.Input[s...
[ "0.6458336", "0.6458336", "0.6439198", "0.6439198", "0.6339771", "0.6323489", "0.6309117", "0.62971157", "0.62971157", "0.62971157", "0.62971157", "0.62971157", "0.6198518", "0.5919496", "0.58436006", "0.5747788", "0.57337683", "0.5638161", "0.5595323", "0.55599266", "0.55261...
0.8430586
0
Find free transfer ip pairs (ipv4 & ipv6)
def find_transfer_ip(allocated): for ip_addr in ip_network(TRANSFER_NET_IP4).hosts(): if ip_addr in allocated: continue # create matching ipv6 address ip6_addr = ip_address("fec0::a:cf:%X:%X" % (ip_addr.packed[2], ip_addr.packe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ip_get_free(net=\"a\"):\n tnet = net.upper()\n\n # start Requests session\n sc = requests.Session()\n\n # import cookies from Firefox\n sc.cookies.update(get_cookies('imhsc.imhadmin.net'))\n\n # send request\n vpx = sc.get('https://imhsc.imhadmin.net/index.php',\n params={'...
[ "0.5923028", "0.5914336", "0.575231", "0.5696911", "0.5621063", "0.5588598", "0.55872273", "0.5579918", "0.5571027", "0.5559162", "0.5505478", "0.549354", "0.5455738", "0.5451806", "0.54158354", "0.5402061", "0.5391193", "0.5389562", "0.5389505", "0.53771615", "0.537526", "...
0.7610932
0
Find free ipv4 subnet with the given prefix length in the freifunk range (10.0.0.0/8)
def find_subnet(allocated, prefix_len): def is_colliding(network, allocations): """ Check if given network is colliding with an already allocated networks """ for allocation in allocations: if network.overlaps(allocation): return True retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_netmask(prefix):\n try:\n prefix_str = unicode(prefix)\n except NameError as ex:\n prefix_str = str(prefix)\n return IPv4Network(\"1.0.0.0/\"+prefix_str).netmask", "def get_nets_and_highest_prefix(ip, net_group, db):\n highest_prefix_length = 0\n networks = []\n ip = nacaddr....
[ "0.7031105", "0.628563", "0.6167392", "0.6117675", "0.6071933", "0.6042414", "0.60167956", "0.5985993", "0.59358686", "0.5917043", "0.5829789", "0.5783567", "0.5774751", "0.576267", "0.57365376", "0.5706467", "0.56903154", "0.56880146", "0.56600106", "0.5620678", "0.5558388",...
0.7617754
0
Check if given network is colliding with an already allocated networks
def is_colliding(network, allocations): for allocation in allocations: if network.overlaps(allocation): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isNetConflict(ip_addr1, mask1, ip_addr2, mask2):\n subnet1 = calcSubnet(ip_addr1, mask1)\n if not subnet1:\n return False\n\n subnet2 = calcSubnet(ip_addr2, mask2)\n if not subnet2:\n return False\n\n if subnet1 == subnet2:\n return False", "def check_collisions(self):", ...
[ "0.6629457", "0.61691636", "0.6160328", "0.6026882", "0.60075307", "0.5983914", "0.5946831", "0.5918339", "0.5913826", "0.59066904", "0.5905258", "0.58775365", "0.5859837", "0.582674", "0.5781767", "0.5756972", "0.5745077", "0.57395834", "0.57383215", "0.573295", "0.57036567"...
0.80092055
0
Return first num items of the iterable as a list
def take(num, iterable): return list(islice(iterable, num))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take(n, iterable):\n return list(itertools.islice(iterable, n))", "def take(n, iterable):\n return list(itertools.islice(iterable, n))", "def take(iterable, n):\n return list(itertools.islice(iterable, n))", "def take(n, iterable):\n return list(islice(iterable, n))", "def take(n, iterable)...
[ "0.7339252", "0.7339252", "0.7338282", "0.7293102", "0.7293102", "0.6639961", "0.6595714", "0.6587594", "0.6577808", "0.6388577", "0.6355226", "0.6335601", "0.6331037", "0.632935", "0.63089955", "0.6301983", "0.6247116", "0.6217543", "0.6199824", "0.6197754", "0.6195925", "...
0.8021185
0
Execute locatorSurface() from UI
def locatorSurfaceFromUI(): # Window window = 'locatorSurfaceUI' if not cmds.window(window, q=True, ex=1): raise UIError('LocatorSurface UI does not exist!!') # Get UI data surface = cmds.textFieldGrp('locatorSurfaceTFB', q=True, text=True) # Check surface if not glTools.utils.surface.isSurf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solveTetris(self,**kwargs):\n #self.showCamera()\n self.locator.recognise_grid()", "def test_grasp_3D_location(self):\n self.taskRunner.callOnThread(self.grasp_3D_location)", "def main(context, event):\n for area in bpy.context.screen.areas:\n if area.type == 'VIEW_3D':\n ...
[ "0.5619464", "0.5541903", "0.54635596", "0.5405642", "0.52623695", "0.52481216", "0.5243945", "0.52120155", "0.5176234", "0.51756865", "0.51755226", "0.5173685", "0.5172642", "0.5162817", "0.5162754", "0.5114833", "0.51042783", "0.51011926", "0.50989926", "0.50908095", "0.508...
0.73527545
0
Execute snapToSurface() from UI
def snapToSurfaceFromUI(close=False): # Window window = 'snapToSurfaceUI' if not cmds.window(window, q=True, ex=1): raise UIError('SnapToSurface UI does not exist!!') # Get UI data surface = cmds.textFieldGrp('snapToSurfaceTFB', q=True, text=True) # Check surface if not glTools.utils.surface...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snap():\n pass", "async def snap(self, out=None):\r\n # NOTE ring buffer requires minimally of 2 frames\r\n await self.configure_acquisition(1)\r\n\r\n self.start_acquisition()\r\n out = await self.get_image(out=out)\r\n self.stop_acquisition()\r\n\r\n await self....
[ "0.6497052", "0.5861761", "0.58308285", "0.56913775", "0.5576688", "0.5557962", "0.54852504", "0.5464333", "0.5453036", "0.5428654", "0.54189557", "0.5402482", "0.5385184", "0.5369522", "0.53495884", "0.5337303", "0.5318646", "0.5313067", "0.5297209", "0.5281439", "0.52376646...
0.7296196
0
Execute attachToSurface() from UI
def attachToSurfaceFromUI(close=True): # Window window = 'attachToSurfaceUI' if not cmds.window(window, q=True, ex=1): raise UIError('AttachToSurface UI does not exist!!') # Get UI data surf = cmds.textFieldGrp('attachToSurfaceTFB', q=True, text=True) # Check surface if not glTools.utils.sur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _draw(self):\r\n \r\n if self.active:\r\n self.surface = self.activeSurface # Set active surface to be displayed.\r\n else:\r\n self.surface = self.passiveSurface # Set passive surface to be displayed.\r", "def draw(self, draw_surface):\n super().draw(draw_su...
[ "0.60345495", "0.5915981", "0.57465816", "0.57247853", "0.5721777", "0.56778574", "0.5604188", "0.5579229", "0.55452865", "0.55330396", "0.5483717", "0.5483717", "0.5475361", "0.546382", "0.5441313", "0.5428758", "0.53970516", "0.5391289", "0.53756166", "0.53642476", "0.52953...
0.74520713
0
provide info on legislator.
def __repr__(self): return f"Legislator: {self.full_name} party: {self.party}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_info(self, lander):\n print (\"Lander Status: Altitude %d, Velocity %d, Fuel %d\" % \n (lander.get_altitude(), lander.get_velocity(), lander.get_fuel()))", "def getInfo():", "def info(self):", "def info(self):", "def get(self, id_code):\r\n return self.fetch('getLegislator...
[ "0.58087593", "0.56525826", "0.5610032", "0.5610032", "0.55559844", "0.5533336", "0.55037564", "0.545871", "0.545871", "0.54140604", "0.5339678", "0.52730197", "0.5272102", "0.5259009", "0.5248812", "0.5243252", "0.5185192", "0.5175981", "0.5164203", "0.5112168", "0.50489897"...
0.588282
0
Create a new NetworkDegradeFaultSpec.
def __init__(self, start_ms, duration_ms, node_specs): super(DegradedNetworkFaultSpec, self).__init__(start_ms, duration_ms) self.message["class"] = "org.apache.kafka.trogdor.fault.DegradedNetworkFaultSpec" self.message["nodeSpecs"] = node_specs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, start_ms, duration_ms, partitions):\n super(NetworkPartitionFaultSpec, self).__init__(start_ms, duration_ms)\n self.message[\"class\"] = \"org.apache.kafka.trogdor.fault.NetworkPartitionFaultSpec\"\n self.message[\"partitions\"] = [TaskSpec.to_node_names(p) for p in partitio...
[ "0.6488354", "0.48511526", "0.471223", "0.46935087", "0.46434933", "0.4605534", "0.45941415", "0.45939744", "0.45196947", "0.45179686", "0.44763002", "0.44507137", "0.44153222", "0.44015405", "0.43812194", "0.43682972", "0.43577945", "0.43492493", "0.4324128", "0.43147445", "...
0.72217816
0
Set the value for voltage 1, 2, 3 if provided. If none provided, obtains the value for voltage. Voltage is a tuple containing a voltage value for each phase.
def voltage(self, voltage=None): if voltage is not None: # set output voltage on all phases # self.ts.log_debug('voltage: %s, type: %s' % (voltage, type(voltage))) if type(voltage) is not list and type(voltage) is not tuple: self.cmd(':AC:SETB:VOLT PERC,%0.1f,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_voltage(self, v):\n self.environment.set_voltage(self.neuron_id, v)", "def set_voltage(self, value):\n self.write(\":VOLT {}V\".format(value))", "def set_voltage(self, c, voltage):\n if abs(voltage['V']) < (.00001):\n voltage = 0 * units.V\n \n dev = se...
[ "0.67233396", "0.67154664", "0.6680747", "0.6588077", "0.6544054", "0.65423506", "0.64561886", "0.64252436", "0.6370115", "0.6344377", "0.6281378", "0.61517817", "0.6132901", "0.60910285", "0.6052103", "0.592927", "0.5802812", "0.57095796", "0.56035215", "0.5591283", "0.55880...
0.77333033
0
Returns a PackageDir object for pkg_name. (so that .name == pkg_name and pkg_name in self._subdirs)
def _get_package_dir ( self, pkg_name ): if not pkg_name in self._subdirs: self._lock.acquire() try: if not pkg_name in self._subdirs: newpkg = self.packagedir_cls ( name = pkg_name, logger = self.logger, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_package(cls, name: str):\n pkg = Package(name=name)\n return pkg", "def package(self, pkg_name):\n return self._pkgs[pkg_name]", "def get_package_init_path(self, pkgname, pkgdir):\n\n pkgdir = os.path.abspath(pkgdir)\n\n # Try __init__.py\n pkginitfile = os.pat...
[ "0.68937254", "0.656034", "0.6443994", "0.59734964", "0.59458435", "0.58853984", "0.58319086", "0.581458", "0.57995313", "0.57426775", "0.57172537", "0.56824833", "0.5629492", "0.5595609", "0.55765647", "0.5556298", "0.5520097", "0.5514718", "0.5506703", "0.5490725", "0.54855...
0.83574843
0
Imports ebuilds into this category.
def import_ebuilds ( self, catview, **kwargs ): stats = self.STATS for eview in catview: self._get_package_dir ( eview.name ).import_ebuilds ( eview, stats=stats, **kwargs )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n pedigree = list(self._yield_pedigree())\n # Create new case or get existing one.\n with transaction.atomic():\n case, case_created = Case.objects.get_or_create(\n name=self.import_job.case_name,\n project=self.import_job.project,\n ...
[ "0.5500543", "0.5338352", "0.52724683", "0.5227147", "0.5134364", "0.51059294", "0.5103101", "0.50705004", "0.5063628", "0.50142604", "0.5003569", "0.49937722", "0.49665478", "0.49544486", "0.49371675", "0.49265817", "0.49140865", "0.48860252", "0.48854074", "0.4872245", "0.4...
0.7081166
0
Returns True if manifest writing is thread safe for this category, else False. Also returns True for empty categories.
def supports_threadsafe_manifest_writing ( self, unsafe=True ): if unsafe: return self.packagedir_cls.MANIFEST_THREADSAFE else: for pkgdir in self._subdirs.values(): #if not pkgdir.__class__.MANIFEST_THREADSAFE: if not pkgdir.MANIFEST_THREADSAFE: retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_atomic(self) -> bool:\n return False", "def writeable(self):\n return self._cc[14] == 0", "def is_safe(self):\n return self.is_setup and self.pocs.is_safe()", "def canwrite(self):\n return False", "def is_writable(self, object, content_type):\n return False", "de...
[ "0.58368367", "0.57796663", "0.57748014", "0.57293296", "0.5587174", "0.5549749", "0.55229753", "0.5516022", "0.5454598", "0.5415429", "0.53498614", "0.53498614", "0.5345543", "0.53407896", "0.53292304", "0.5284343", "0.51511306", "0.5137616", "0.51123214", "0.5107751", "0.50...
0.75129515
0
Generates Manifest files for all packages in this category. Manifest files are automatically created when calling write().
def write_manifest ( self, **manifest_kw ): for package in self._subdirs.values(): package.write_manifest ( **manifest_kw )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_package_scripts(self, output_dir):\n manifest_sh = os.path.join(output_dir, 'manifest.pkgs.sh')\n installed_sh = os.path.join(output_dir, 'installed.pkgs.sh')\n\n minimal_sh = os.path.join(output_dir, 'minimal.pkgs.sh')\n also_installed_sh = os.path.join(output_dir, 'also_inst...
[ "0.64744246", "0.64411634", "0.63114595", "0.6242559", "0.622506", "0.6207353", "0.61745715", "0.6134012", "0.61128265", "0.6088034", "0.60367125", "0.60358196", "0.60259587", "0.5991755", "0.58986217", "0.5853809", "0.5843672", "0.582667", "0.57907486", "0.5748083", "0.56825...
0.77140653
0
Unit test to benchmark the performance of our implementation compared to sklearn.
def test_compare(self): config = { 'num_components': 512, 'num_features': 128, 'covariance': 'spherical' } samples = self.generate_samples(config, 100_000) sklearn_time = np.mean([self.train_sklearn(config, samples) for _ in range(3)]) ours_cp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pima_indians_diabetes_scikit_learn_comparison():\n\n print('\\n===============================')\n print('=== PROJECT IMPLEMENTATION ====')\n print('===============================')\n\n seed(1)\n\n pid = PimaIndiansDiabetes()\n pid.data_preprocessing()\n project_efficiency_percent = ...
[ "0.6827115", "0.66697884", "0.63848716", "0.6302794", "0.6184869", "0.61220306", "0.6100869", "0.6096605", "0.6089097", "0.60702074", "0.60450333", "0.6043078", "0.60103905", "0.6006184", "0.59567857", "0.5935422", "0.5890135", "0.5884574", "0.5880393", "0.5876085", "0.587576...
0.7656122
0
Unit test to benchmark the performance when training on mini batches.
def test_minibatch(self): config = { 'num_components': 512, 'num_features': 128, 'covariance': 'spherical' } samples = self.generate_samples(config, 10_000_000) samples = samples.repeat(10, 1) total_time = np.mean([ self.train_our...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_training(self):\n\t\tpass", "def test_batch(self):\n pass", "def train(self, num_batches: int):", "def Run(benchmark_spec):\n _UpdateBenchmarkSpecWithFlags(benchmark_spec)\n vm = benchmark_spec.vms[0]\n\n if benchmark_spec.tpus:\n mnist_benchmark_script = 'mnist_tpu.py'\n mnist_bench...
[ "0.6711016", "0.66944337", "0.6671615", "0.66390496", "0.66274613", "0.64866453", "0.6436474", "0.64098835", "0.63644505", "0.6343893", "0.6329472", "0.6313193", "0.62909144", "0.628816", "0.62834287", "0.62648", "0.62292325", "0.6229006", "0.6222681", "0.62121975", "0.619840...
0.75304
0
Generates samples by initializing a random GMM with the specified configuration.
def generate_samples(self, config, num_samples): tic = time.time() generator = GMM(**config) weights = torch.rand(config.num_components) generator.component_weights.set_(weights / weights.sum()) generator.gaussian.means.set_(torch.randn(config.num_components, config.num_features...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_gmm_data(self):\n \n # randomly generate means and covariances of GMM if params not given\n if not self.params:\n self.params = generate_GMM_params(self.n_clusters, self.spread) \n\n # sample from the GMM\n return [np.random.multivariate_normal(mean, std,...
[ "0.66630393", "0.6544777", "0.6383246", "0.6339896", "0.6339896", "0.6209863", "0.60525465", "0.60519755", "0.5975643", "0.59697765", "0.5968183", "0.59236133", "0.59182876", "0.59152627", "0.59120244", "0.5907306", "0.5896049", "0.5888585", "0.5884394", "0.58833355", "0.5873...
0.7922972
0
Fits an sklearn GMM as defined by the config on the given samples.
def train_sklearn(self, config, samples): samples = samples.numpy() tic = time.time() gmm = GaussianMixture( config['num_components'], covariance_type=config['covariance'], init_params='random', tol=1e-5 ) gmm.fit(samples) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_samples(self, config, num_samples):\n tic = time.time()\n\n generator = GMM(**config)\n weights = torch.rand(config.num_components)\n generator.component_weights.set_(weights / weights.sum())\n generator.gaussian.means.set_(torch.randn(config.num_components, config.n...
[ "0.62902045", "0.6266645", "0.6126089", "0.612546", "0.5990494", "0.5830797", "0.5809653", "0.5804665", "0.5766111", "0.57340187", "0.56539786", "0.5643225", "0.5609683", "0.5604417", "0.5593932", "0.5526738", "0.5517", "0.5506849", "0.55063", "0.5496705", "0.5488865", "0.5...
0.72439784
0
Search all gfw collection for an object
def test_search_collection(): col = Collection(search='forest', app=['gfw']) assert len(col) > 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_collection_object_type():\n col = Collection(search='forest', object_type=['layer', 'dataset', 'widget'], app=['gfw'])\n assert len(col) > 1", "def test_search_collection_filters():\n col = Collection(search='forest', object_type=['layer'], filters={'provider': 'gee'}, app=['gfw'])\n ...
[ "0.6768818", "0.6466514", "0.6327102", "0.62810105", "0.6136088", "0.6025288", "0.60107744", "0.60010976", "0.5985929", "0.59806067", "0.5951483", "0.59395784", "0.5912067", "0.590747", "0.5897895", "0.58658385", "0.5856799", "0.5827652", "0.58125365", "0.5790817", "0.5782774...
0.677982
0
Search all gfw collection for an object
def test_search_collection_object_type(): col = Collection(search='forest', object_type=['layer', 'dataset', 'widget'], app=['gfw']) assert len(col) > 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_collection():\n col = Collection(search='forest', app=['gfw'])\n assert len(col) > 1", "def test_search_collection_filters():\n col = Collection(search='forest', object_type=['layer'], filters={'provider': 'gee'}, app=['gfw'])\n assert len(col) > 1", "def search(self, query):", "d...
[ "0.677982", "0.6466514", "0.6327102", "0.62810105", "0.6136088", "0.6025288", "0.60107744", "0.60010976", "0.5985929", "0.59806067", "0.5951483", "0.59395784", "0.5912067", "0.590747", "0.5897895", "0.58658385", "0.5856799", "0.5827652", "0.58125365", "0.5790817", "0.57827747...
0.6768818
1
Test converstion of gpmap to dict.
def test_dict(test_data): # Stupidly trivial map gpmap.read_dict({"wildtype":"0", "data":{"genotype":["0"]}}) # Make sure wildtype check is working with pytest.raises(ValueError): gpmap.read_dict({"data":{"genotype":["0"]}}) # Make sure wildtype length/...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_map_basics(self):\n self.assertDigitizerMapBasics(self.map, self.dgroup)", "def test_to_dict(self):\n self.assertEqual('to_dict' in dir(self.place), True)", "def test_map_deserialization(self):\r\n \r\n original = DeserializationTestModel.create(count=5, text='happy')\r\n ...
[ "0.6401023", "0.60420966", "0.59306026", "0.5907573", "0.5900593", "0.586643", "0.5864303", "0.58509773", "0.5716002", "0.5677782", "0.56667197", "0.5644079", "0.56002975", "0.5599843", "0.55447507", "0.5533458", "0.55287415", "0.5507433", "0.5461061", "0.545926", "0.5435331"...
0.7144822
0
Test case for get_attribute_data
def test_get_attribute_data(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_attributes(self):\n pass", "def test_custom_attribute_get(self):\n gen = self.generator.generate_custom_attribute\n _, cad = gen(\"product\", attribute_type=\"Text\", title=\"normal text\")\n pid = models.Person.query.first().id\n\n product_data = [\n {\n \"produ...
[ "0.7924169", "0.7017472", "0.684704", "0.67626387", "0.67021054", "0.6680571", "0.66677076", "0.6661068", "0.6599781", "0.65405506", "0.6511445", "0.647598", "0.6311808", "0.6294494", "0.6259967", "0.62530553", "0.622021", "0.62115633", "0.62096655", "0.6207016", "0.62068415"...
0.9313305
0
Test case for remove_a_single_attribute
def test_remove_a_single_attribute(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_one(self):\n pass", "def remove_attribute(self, name):\n\n pass", "def test_handle_removals_add_if_named_in_attribute(self):\n self.assertFalse(False)", "def test_del_attribute_is_assigned_properly(self):\r\n class DelModel(Model):\r\n id = columns.UUID...
[ "0.72282505", "0.7199577", "0.7026164", "0.70148695", "0.69740164", "0.69740164", "0.69740164", "0.69360054", "0.67617524", "0.66840416", "0.6664598", "0.6607666", "0.6481913", "0.6480623", "0.6479518", "0.6474927", "0.64719874", "0.6470567", "0.6440419", "0.6427863", "0.6410...
0.9478605
0
Test case for update_attribute_data
def test_update_attribute_data(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_metadata_by_attribute(self):\n pass", "def test_update_metadata_by_attribute1(self):\n pass", "def test_custom_attr_change(self):\n custom_attribute_values = [{\n \"custom_attribute_id\": self.cad1.id,\n \"attribute_value\": \"test value\",\n }]\n response =...
[ "0.81036913", "0.78911966", "0.708605", "0.7061594", "0.7009237", "0.7005302", "0.7005302", "0.7005302", "0.7004755", "0.69371647", "0.68755186", "0.6767223", "0.67525774", "0.67321706", "0.6709867", "0.67065316", "0.6699277", "0.6688184", "0.66800594", "0.6575178", "0.655062...
0.9366533
0
Plots the cumulative distribution of a dataset
def plot_cumulative_distribution(data, fig_title, ax_labels=None, resolution=.01, filename=None): if not isinstance(data, ndarray): return TypeError('Expected data as numpy array.') cumulative_function = estimate_cumulative(data, num_bins=int(1 / resolution * 2)) cumulative_function = vectoriz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_cumulative_distr_plot(data):\n x = data.index\n y = data[\"cumprop\"]\n plot = go.Bar(x=x, y=y, showlegend=False)\n\n return plot", "def plot_cdf(self, **options):\n plt.plot(self.xs, self.ps, **options)", "def gc_plot(data, **kwargs):\n hist = gc_percent_hist(data)\n sns.line...
[ "0.74792033", "0.6748491", "0.65972036", "0.65029603", "0.64194006", "0.64100325", "0.6361284", "0.635033", "0.626816", "0.61954415", "0.61860913", "0.61574465", "0.6061767", "0.6048372", "0.60477215", "0.6018012", "0.6007764", "0.598921", "0.596509", "0.59641474", "0.5933305...
0.72081286
1
Plots the joint (but assumed independent) distribution of two sets of data
def plot_joint_distribution(data_a, data_b, fig_title, ax_labels=None, resolution=.01): if not isinstance(data_a, ndarray) or not isinstance(data_b, ndarray): return TypeError('Expected data as numpy array.') joint_cumulative_function = estimate_joint_cumulative(data_a, data_b, resolution) x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PlotJointDist(pmf1, pmf2, thresh=0.8):\n def Clean(pmf):\n \"\"\"Removes values below thresh.\"\"\"\n vals = [val for val in pmf.Values() if val < thresh]\n [pmf.Remove(val) for val in vals]\n\n Clean(pmf1)\n Clean(pmf2)\n pmf = thinkbayes2.MakeJoint(pmf1, pmf2)\n\n thinkplo...
[ "0.6475229", "0.6474538", "0.63267577", "0.62504435", "0.62379134", "0.61566466", "0.6145226", "0.6105726", "0.60993713", "0.60859406", "0.60638833", "0.60427994", "0.5987907", "0.59788674", "0.59662586", "0.59645915", "0.5962484", "0.5933013", "0.5915756", "0.5914334", "0.59...
0.7200761
0
blocks the xbox key until it's released
def block(xbox_key): while xbox_key(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lockKeyboard():\r\n while True:\r\n # locks the keyboard for 5s\r\n # command: xinput float keyborad_ID\r\n os.system('xinput float 8')\r\n time.sleep(5)\r\n\r\n # Enable the keyboard fo 10s\r\n # command: xinput float keyborad_ID slave_keyboard_number\r\n os...
[ "0.7022082", "0.6896044", "0.6840802", "0.6834396", "0.677237", "0.6754511", "0.6736897", "0.66934323", "0.6641417", "0.661111", "0.6569983", "0.6550441", "0.6523159", "0.65079135", "0.63917357", "0.63885784", "0.63720596", "0.6312968", "0.62649035", "0.62481654", "0.62163365...
0.8191775
0
Returns a list of available voiceids
def available_voices(): engine = pyttsx.init() voices = engine.getProperty('voices') return [voice.id for voice in voices]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def voices(self):\n logging.debug(\"voices...\")\n v = []\n for voice in self._eng.getProperty(\"voices\"):\n v.append(voice.name)\n return v", "async def voicelist(self, ctx):\n await send_msg(ctx, 'Voice List', r\"\"\"\n \n **AU_M:** Australian Male\n **AU...
[ "0.67262083", "0.6580266", "0.62992275", "0.62375027", "0.61905503", "0.6126072", "0.60753584", "0.6044927", "0.59386516", "0.5904285", "0.58421695", "0.57690704", "0.57410985", "0.56861717", "0.55675644", "0.5559343", "0.55553204", "0.550353", "0.54905355", "0.5448678", "0.5...
0.77031964
0
Inits a pyttsx engine and launches the event loop
def run(self): self.__engine = engine = pyttsx.init() if self.__voice_id is not None: engine.setProperty('voice', self.__voice_id) engine.connect('finished-utterance', self.__next_utterance) engine.say('Starting voice process') engine.startLoop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._eng = pyttsx.init()\n self._eng.connect(\"started-utterance\", self._onStart)\n self._eng.connect(\"started-word\", self._onWord)\n self._eng.connect(\"finished-utterance\", self._onEnd)", "def start(self):\n self.running = True\n while self.r...
[ "0.7177499", "0.6214811", "0.61921996", "0.61630267", "0.61571604", "0.60395694", "0.60264736", "0.6003537", "0.5947501", "0.59466106", "0.590539", "0.590491", "0.58569163", "0.57899326", "0.5787105", "0.57191396", "0.5705461", "0.56987536", "0.56496716", "0.5649488", "0.5634...
0.7609148
0
Queues the text to be spoken
def say(self, text): self.__say_queue.put(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speak(self, text):\r\n self.engine.say(text)\r\n self.engine.runAndWait()", "def send(self, text):\n if text:\n self.text_queue.put(text)", "async def speak(self, ctx, *, text: str):\n state = self.get_voice_state(ctx.message.server)\n opts = {\n 'qu...
[ "0.6762613", "0.67554414", "0.6751568", "0.6670509", "0.6351083", "0.6330004", "0.63214684", "0.6250465", "0.624648", "0.6176096", "0.61648977", "0.61648977", "0.6085973", "0.60540605", "0.60162747", "0.59897715", "0.5967982", "0.5938423", "0.5927148", "0.591521", "0.59038067...
0.68986374
0
Calculate the damage done by program.
def calculate_damage(program): strength, damage = 1, 0 for instruction in program: if instruction == 'C': strength *= 2 else: damage += strength return damage
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_damage(self) -> float:\n res = 0.05 + self.experience / 100\n self.experience = self.experience + 1\n return res", "def do_damage(self) -> float:\n sum = 0\n for operator in self.__operators:\n if operator.is_alive:\n operator.experience += 1\n ...
[ "0.75097543", "0.72761405", "0.72384214", "0.69057035", "0.6885933", "0.67915595", "0.6719608", "0.67165685", "0.66535056", "0.6641837", "0.6598513", "0.64524263", "0.6427418", "0.63568294", "0.63514775", "0.6347094", "0.6334354", "0.6328708", "0.6323224", "0.63218856", "0.63...
0.75633895
0
Finds minimum number of hacks needed if possible.
def minimum_hacks(program, damage): num_hacks = 0 while 'CS' in program and calculate_damage(program) > max_damage: program = hack_once(program) num_hacks += 1 if calculate_damage(program) <= max_damage: return num_hacks else: return 'IMPOSSIBLE'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_num_iterations_():\n rows, cols = map_shape\n error = 1\n it = 0\n minErr = 1e-4\n while (error > minErr):\n bkp_utilities = utilities.copy()\n update_utils(utilities, map_shape, map_arr, rewards, final_arr, actions, gamma)\n diff = [(bkp_utilities[(r,c)] - utilities[(r,...
[ "0.5895472", "0.58697045", "0.58440393", "0.58440393", "0.5765669", "0.5661616", "0.55783147", "0.5577814", "0.55310094", "0.55257034", "0.5449159", "0.5436397", "0.54301804", "0.5383003", "0.53604954", "0.53470355", "0.53418744", "0.5339067", "0.5334955", "0.5321203", "0.528...
0.6912351
0
Takes an article written in markdown and looks for the presence of a ticket reference and replaces it with autual link to the ticket.
def on_page_markdown(self, markdown, **kwargs): for autolink in self.config["autolinks"]: markdown = replace_autolink_references(markdown, autolink["reference_prefix"], autolink["target_url"]) return markdown
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ref_to_link(txt):\n text = txt.group(1) # because it was a match in a regular expression\n\n thecite, everythingelse = first_bracketed_string(text)\n thecite = thecite[1:-1] # strip curly brackets\n thecite = thecite.replace(\"\\\\\",\"\") # \\href --> href\n\n refs = thecite.split(\",\")\n...
[ "0.6174294", "0.6074019", "0.5927576", "0.5870128", "0.5821623", "0.56717366", "0.5632068", "0.5630263", "0.5629399", "0.5591201", "0.55312127", "0.5522641", "0.5491864", "0.54909474", "0.5443015", "0.54416543", "0.53799397", "0.5376083", "0.53716475", "0.5331599", "0.5292975...
0.6506522
0
generate the mat file to interface with genInput.py. Needs to save Lx_p, Ly_p, Lz_p, Lo, Ny_divs, rho_p, nu_p, snl, inl and onl. note that the snl and obst_list need to be combined into one list
def write_mat_file(self): mat_dict = {} mat_dict['Lx_p'] = self.Lx_p mat_dict['Ly_p'] = self.Ly_p mat_dict['Lz_p'] = self.Lz_p mat_dict['Lo'] = self.obst.get_Lo() mat_dict['Ny_divs'] = self.N_divs mat_dict['rho_p'] = self.rho_p mat_dict['nu_p'] = self.nu_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_mat_file(self, geom_filename):\n mat_dict = {}\n mat_dict['Lx_p'] = self.Lx_p\n mat_dict['Ly_p'] = self.Ly_p\n mat_dict['Lz_p'] = self.Lz_p\n mat_dict['Lo'] = self.obst.get_Lo()\n mat_dict['Ny_divs'] = self.N_divs\n mat_dict['rho_p'] = self.rho_p\n ...
[ "0.6112342", "0.5891669", "0.57490486", "0.57241046", "0.5666318", "0.56461734", "0.56205946", "0.56129766", "0.56079984", "0.55490524", "0.55265933", "0.5514139", "0.5487988", "0.5483245", "0.5425574", "0.54249007", "0.53842944", "0.53675", "0.5361831", "0.53582114", "0.5335...
0.6735665
0
set up to 4 walls as solid walls for the simulation
def set_channel_walls(self,walls=['left','right','top','bottom']): solid_list_a = np.empty(0).flatten() solid_list_b = np.empty(0).flatten() solid_list_c = np.empty(0).flatten() solid_list_d = np.empty(0).flatten() for w in walls: if w=='right': solid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_walls(self):\n for x in range(self.width):\n self.add_thing(Wall(), (x, 0))\n self.add_thing(Wall(), (x, self.height - 1))\n\n for y in range(self.height):\n self.add_thing(Wall(), (0, y))\n self.add_thing(Wall(), (self.width - 1, y))", "def add_w...
[ "0.7185255", "0.71295714", "0.7112708", "0.7019965", "0.6887845", "0.68790036", "0.6748633", "0.6713246", "0.670495", "0.6689467", "0.6594738", "0.6531566", "0.6519977", "0.6483145", "0.6464001", "0.6451071", "0.63679594", "0.6308632", "0.625671", "0.62035424", "0.61838555", ...
0.73184085
1
Recursively adds overrides to record. Overwrites existing fields where conflicts arise.
def override(record: Dict, overrides: Dict): for key in overrides.keys(): if key not in record: record[key] = overrides[key] else: existing_value = record[key] overwrite_value = overrides[key] if isinstance(existing_value, dict): overri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeOverrides(self):\n\t\tself.overridesWithValues = self.dataOverrides", "def _write_overrides(\n self, node, parent=None, parent_packmode=None, path_parts=tuple(), root=None\n ):\n if root is None:\n root = node\n if (parent is root) or (\n parent_packmode and ...
[ "0.5900967", "0.579883", "0.579366", "0.568634", "0.55019647", "0.54487", "0.54330117", "0.5415858", "0.53873384", "0.5373979", "0.5364726", "0.53547835", "0.5197315", "0.5175894", "0.51622444", "0.5138847", "0.5097999", "0.50953", "0.50814605", "0.5073235", "0.5045781", "0...
0.7228511
0
Applies schematic updates to the structure of `.csvmetadata.json` files.
def refactor_structure_with_updates(csvw_mapping: Dict, allow_human_input: bool): # Populate our variables. dt_now = datetime.now().isoformat() prov_derivation_object = csvw_mapping["prov:hadDerivation"] concept_root_uri: str = csvw_mapping["@id"] csv_url: str = csvw_mapping["url"] existing_labe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_metadata_shell_for_csv(csv_file_path: str) -> str:\n metadata_file = f\"{csv_file_path}-metadata.json\"\n if path.exists(metadata_file):\n raise Exception(f\"Metadata file {metadata_file} already exists.\")\n if not path.exists(csv_file_path):\n raise Exception(f\"CSV file {csv_fi...
[ "0.61766934", "0.61283374", "0.5936572", "0.56449986", "0.55909854", "0.5575214", "0.5548966", "0.55084074", "0.5493395", "0.5483722", "0.54730207", "0.5460299", "0.5455474", "0.53871405", "0.5380864", "0.53521824", "0.5302653", "0.52995676", "0.5281447", "0.5218691", "0.5215...
0.638237
0
Generates column schema structure for a given column name. If the column name matches one of the standard GSS codelist column names then we link up the associated metadata.
def generate_schema_for_column(column_name: str, concept_scheme_uri: str) -> Dict: column_name = column_name.strip() column_name_lower = column_name.lower() column_name_snake_case = re.sub("\\s+", "_", column_name_lower) column = { "titles": column_name, "name": column_name_snake_case ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCustomColumnDetails(self, column_name):\n column_info = {}\n con = self.getMetadataDatabaseConnection()\n found = False\n column_name = column_name.upper()\n \n # Init some variables\n description = ''\n extra_table_name = ''\n common_table_name...
[ "0.54967517", "0.54065436", "0.5280851", "0.5269493", "0.5134195", "0.5116717", "0.50107056", "0.50103444", "0.5008218", "0.49700236", "0.49682936", "0.49602994", "0.4953684", "0.493729", "0.49180484", "0.49123484", "0.4908672", "0.49083507", "0.48968217", "0.4865214", "0.486...
0.6378657
0
Display the binary from ir.attachment, if already exist
def _get_binary_filesystem(self, cr, uid, ids, name, arg, context=None): res = {} attachment_obj = self.pool.get('ir.attachment') for record in self.browse(cr, uid, ids, context=context): res[record.id] = False attachment_ids = attachment_obj.search(cr, uid, [('res_model...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getIndicator(request, pagename):\n _ = request.getText\n attach_dir = getAttachDir(request, pagename)\n if not os.path.exists(attach_dir):\n return ''\n\n files = os.listdir(attach_dir)\n if not files:\n return ''\n\n fmt = request.formatter\n attach_count = _('[%d attachment...
[ "0.57750267", "0.5660807", "0.56039304", "0.5546055", "0.5449558", "0.54370326", "0.5303953", "0.5225518", "0.5215533", "0.51764774", "0.5161627", "0.51435465", "0.5116666", "0.51081127", "0.50638396", "0.5054406", "0.5043422", "0.4997788", "0.49960378", "0.49936476", "0.4984...
0.5664474
1
Create or update the binary in ir.attachment when we save the record
def _set_binary_filesystem(self, cr, uid, id, name, value, arg, context=None): attachment_obj = self.pool.get('ir.attachment') attachment_ids = attachment_obj.search(cr, uid, [('res_model','=',self._name),('res_id','=',id),('binary_field','=',name)], context=context) if value: if at...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_attachment(self, root, context=None):\n fecha = time.strftime('%Y_%m_%d_%H%M%S')\n name = 'IVA_' + fecha + '.' + 'txt'\n self.env['ir.attachment'].create({\n 'name': name,\n 'datas': base64.encodestring(root),\n 'datas_fname': name,\n 'res...
[ "0.64156145", "0.6076", "0.60543984", "0.5940438", "0.586536", "0.5817706", "0.58091503", "0.58050215", "0.5795125", "0.57870203", "0.57551926", "0.57389456", "0.5735879", "0.57199365", "0.5704884", "0.5691851", "0.5659876", "0.56447124", "0.5642498", "0.56044054", "0.5587311...
0.6999703
0
Plots a color color grid and on the diagonal a histogram with the distribution of the colors are shown
def color_color_grid(self, cols, labels=None, bins=100): if labels is None: labels = [] for c in cols: labels.append('{} - {}'.format(c[0], c[-1])) length = len(cols) pl.clf() pl.subplots_adjust(wspace=0.0, hspace=0.0) for i, (c, l1) in enu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_channel_histogram(img, tri):\n rgb = ['red', 'green', 'blue']\n\n f = img[tri == 255]\n b = img[tri == 0]\n\n for source in [f, b]:\n for channel in range(source.shape[-1]):\n sns.distplot(source[:, channel], color=rgb[channel])", "def plot_histogram(img):\n rgb_hist = r...
[ "0.68900746", "0.66420245", "0.65426326", "0.64926547", "0.6383372", "0.6239631", "0.62261796", "0.61941427", "0.60870206", "0.60870206", "0.60870206", "0.6085647", "0.603908", "0.6027393", "0.60048896", "0.59987235", "0.5997538", "0.5996089", "0.5955558", "0.59383005", "0.59...
0.68454194
1
Adds negative tag to every word between appearance of negation term and the next punctuation mark or next line
def handle_negation(sentence): def add_space(matched_obj): return " " + matched_obj.group(0) # add a period upon new line if new line does not already end with punctuation and is not followed by another new line #sentence = re.sub(r"(?<![[^\w\s']])\n(?!\n)",". ",sentence) # add space be...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def negation_check(self,sentence):", "def negations(self) -> str:", "def negation_sentence(p):\n p.match('~')\n return sentence(p)", "def negation(document):\n negation=[]\n for item in document:\n if '\\'t' in item:\n negation.append('not')\n negation.append(item)\n ...
[ "0.68375283", "0.6815307", "0.6800492", "0.66639876", "0.6617661", "0.64742243", "0.6426137", "0.63648826", "0.6169081", "0.6148458", "0.6114002", "0.5956248", "0.58563274", "0.5852575", "0.5821845", "0.5790721", "0.5790001", "0.57546663", "0.5727668", "0.5704176", "0.5677542...
0.7171216
0
Drops the table 'movies' if it exists.
def drop_table(): try: sql = "DROP TABLE IF EXISTS movies" conn = psycopg2.connect(dsn=DB_DSN) cur = conn.cursor() cur.execute(sql) conn.commit() except psycopg2.Error as e: print e.message else: cur.close() conn.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_data(self):\n conn = self._connect_DB()\n cur = conn.cursor()\n cur.execute(\"DELETE FROM movie_table;\")\n self._close_connection(conn)", "def drop_table_if_exists(self, table): \n results = self.quick(\"DROP TABLE IF EXISTS {}\".format(table),context=\"MYDB\")", ...
[ "0.7220969", "0.71991235", "0.7072267", "0.6921489", "0.6913279", "0.6714259", "0.6670462", "0.66222185", "0.659017", "0.6559897", "0.6526929", "0.6509647", "0.6471058", "0.64583015", "0.6406326", "0.6398586", "0.63742787", "0.63665724", "0.63539016", "0.63429654", "0.6309417...
0.73804015
0
Read labeled movie reviews and randomly assign them to a title. In other words, make up some data.
def get_reviews(titles): neg_files = glob.glob("txt_sentoken/neg/*.txt") pos_files = glob.glob("txt_sentoken/pos/*.txt") review_dict = {'sentiment' : list(), 'review' : list(), 'title' : list()} for file in neg_files: with open(file, 'r') as f: review_text = f.read() re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def picktitle(genre, n):\n\tmovie_titles = []\n\tfile_name = \"{}.txt\".format(genre) \n\n\twith open(file_name, 'r') as f: \n\t\tfor title in f: \n\t\t\tmovie_titles.append(title.strip())\n\n\n\tshuffle(movie_titles) \n\t\n\t# make sure n is less than the number of titles in the file \n\tif n > len(movie_titles):...
[ "0.65723836", "0.6350321", "0.6328556", "0.62635565", "0.6179323", "0.6136289", "0.61172885", "0.6015771", "0.59525937", "0.58936626", "0.58364254", "0.5832611", "0.57735604", "0.57440305", "0.57037747", "0.56990194", "0.5694078", "0.56806904", "0.5659275", "0.56478405", "0.5...
0.6479549
1
Adjacent floors that could be moved to
def possible_floors(self): if self.lift_floor == 1: return (2,) elif self.lift_floor == self.num_floors: return (self.lift_floor - 1,) else: return self.lift_floor + 1, self.lift_floor - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __one_forward_closed(x, y, c, l):\n x -= 1\n if not c: x, y = l - y, l - x\n return x, y", "def adjacent(self):\n x, y = self.opentile\n return (x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1) # left, right, up, down", "def move(self):\n # neighbor offsets\n offset = [(-...
[ "0.6109999", "0.6088403", "0.6006237", "0.6006237", "0.60028094", "0.58129036", "0.5767766", "0.5763159", "0.5674256", "0.55400515", "0.55124843", "0.55004", "0.54829127", "0.54790807", "0.5478103", "0.54776645", "0.5475146", "0.5432906", "0.5426453", "0.53971565", "0.5393948...
0.62959677
0
All combinations of single and pairs of items on the current floor
def possible_items(self): available_items = self.floors[self.lift_floor] single_items = [(i,) for i in available_items] double_items = [i for i in combinations(available_items, 2)] return single_items + double_items
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_combinations(items):\n\n def inner(items, r):\n \"\"\"\n recursively yields partitioned remainders of original partition lists\n \"\"\"\n items = set(items)\n if not len(items):\n yield ()\n ...
[ "0.64475656", "0.63692224", "0.62618876", "0.6216736", "0.6138283", "0.6118885", "0.6045089", "0.5813359", "0.57994807", "0.578476", "0.5737762", "0.57309914", "0.57185173", "0.5679787", "0.5659566", "0.5651483", "0.56491107", "0.5627445", "0.5588651", "0.55649525", "0.556304...
0.74521583
0
Functie print beginstation/rangnummer, eindstation/rangnummer, afstand in aantal stations, ritpijst en reisoverzicht
def omroepen_reis(stations, beginstation, eindstation): rang_beginstation = stations.index(beginstation)+1 rang_eindstation = stations.index(eindstation)+1 afstand = rang_eindstation - rang_beginstation prijs = afstand * 5 print() print("Het beginstation " + beginstation + " is het " + str(ran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printStations(self):\n print(\"Bus numero \" + str(self._num) + \" :\")\n for i in range(len(self._stations)) :\n print(self._stations[i])\n print('\\n')", "def get_station_boroughs(self):\\", "def run():\n\n for d in hiv_drms.drms:\n print \"\\\"%s\\\",\" % unicod...
[ "0.71776944", "0.6000583", "0.57128495", "0.56246346", "0.56176376", "0.5608581", "0.5607232", "0.5575118", "0.5569292", "0.55147105", "0.5500812", "0.5483303", "0.54688454", "0.5456968", "0.5434981", "0.5416819", "0.54116213", "0.5392134", "0.5378183", "0.5378183", "0.537818...
0.6862827
1
Test measuring the DeconvolvedPsf quantities of an elliptical Gaussian
def testEllipticalGaussian(self): # # Make and the objects # ab_vals = [(1.0, 0.0), (2.0, 0.0), (2.0, 0.1), ] nIter = 2 for dx in (0.0, 0.5,): for dy in (0.0, 0.5,): for alpha, b in ab_vals: for objFlux in (1e2, 1e3, 1e4, 1e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testEllipticalGaussian(self):\n\n width, height = 200, 200\n xcen, ycen = 0.5*width, 0.5*height\n #\n # Make the object\n #\n gal = afwImage.ImageF(afwGeom.ExtentI(width, height))\n a, b, theta = float(10), float(5), 20\n flux = 1e4\n I0 = flux/(2*...
[ "0.7007774", "0.60713637", "0.59241897", "0.5862583", "0.5844651", "0.5779211", "0.57643455", "0.5700486", "0.56673807", "0.5664943", "0.56617093", "0.55869156", "0.55798334", "0.5573386", "0.55001515", "0.5492193", "0.54889727", "0.5482711", "0.5463764", "0.5461931", "0.5458...
0.7485559
0
Universal schema name for use throughout testing
def test_schema(): return 'test_schema'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"schema_name\")", "def create_schema(self, schema: str):\n return", "def resolver(schema):\n name = schema.__name__\n if name.endswith(\"Schema\"):\n return name[:-6] or name\n return name", "def schema() -> ...
[ "0.7329161", "0.69939667", "0.6973403", "0.6872807", "0.6767461", "0.6763858", "0.6700538", "0.66625565", "0.6654833", "0.6612061", "0.654118", "0.65244323", "0.6504708", "0.6492985", "0.649126", "0.6484589", "0.64555913", "0.6444674", "0.6432784", "0.6413402", "0.6286717", ...
0.75505733
0
Universal S3 key for a DataFrame used throughout testing
def test_df_key(): return 'test_df.csv'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_s3_keys(task, fmt):\n table_key = fmt.format(task.db_name, task.orm.__tablename__)\n version_key = fmt.format(task.db_name, \"__version__\")\n return table_key, version_key", "def _get_key():\n conn = boto.connect_s3()\n bucket = conn.create_bucket(settings.MESSY_BUCKET)\n key = Key(bu...
[ "0.65833485", "0.6364653", "0.60677886", "0.58778423", "0.5794352", "0.5674574", "0.56711274", "0.56025046", "0.5601402", "0.55523163", "0.55473834", "0.54990697", "0.5490763", "0.5480928", "0.54800034", "0.5462984", "0.5462984", "0.5442805", "0.5440372", "0.5437297", "0.5425...
0.66980153
0
Dataframe for use throughout testing. Multiple data types used to test for proper encoding/decoding.
def test_df(): return pd.DataFrame({ 'intcol': [1, 2, 3], 'strcol': ['four', 'five', 'six'], 'floatcol': [7.0, 8.0, 9.0] })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_df_all_types():\n return pd.DataFrame({\n 'intcol': [1, 2],\n 'strcol': ['three', 'four'],\n 'floatcol': [5.0, 6.0],\n 'boolcol': [True, False],\n 'datetimecol': [\n np.datetime64('2020-01-01'), np.datetime64('2020-01-02')],\n })", "def test_dataframe(...
[ "0.780617", "0.70338774", "0.6768025", "0.6612174", "0.6568058", "0.6500609", "0.6445286", "0.6444563", "0.6380059", "0.636831", "0.6317683", "0.63111144", "0.6281577", "0.62707293", "0.6257744", "0.62492484", "0.6222682", "0.6203517", "0.61987567", "0.61880684", "0.6169078",...
0.77932775
1
Dataframe for use throughout testing. Contains all data types that are compatible with hive that will also be supported by honeycomb.
def test_df_all_types(): return pd.DataFrame({ 'intcol': [1, 2], 'strcol': ['three', 'four'], 'floatcol': [5.0, 6.0], 'boolcol': [True, False], 'datetimecol': [ np.datetime64('2020-01-01'), np.datetime64('2020-01-02')], })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_df():\n return pd.DataFrame({\n 'intcol': [1, 2, 3],\n 'strcol': ['four', 'five', 'six'],\n 'floatcol': [7.0, 8.0, 9.0]\n })", "def data_all_types(df):\n \n printmd (\"**Type of every column in the data**\")\n print(\"\")\n print(df.dtypes)", "def pandas_typecast...
[ "0.67936194", "0.6623528", "0.64548767", "0.6390123", "0.63642853", "0.62651926", "0.6253463", "0.623658", "0.61469364", "0.61410254", "0.61294603", "0.6107452", "0.6092851", "0.6080563", "0.6037181", "0.60293585", "0.6026896", "0.6009763", "0.60072345", "0.6003875", "0.59899...
0.72792745
0
Mocks all s3 connections in any test or fixture that includes it
def mock_s3_client(): with mock_s3(): yield
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_s3_fixture():\n with mock_s3():\n yield", "def test_connect_to_aws_s3(self):\n conn = boto3.resource('s3', region_name='us-east-1')\n # We need to create the bucket since this is all in Moto's 'virtual' AWS account\n conn.create_bucket(Bucket='foobucket')\n\n s3_con...
[ "0.7698033", "0.74761134", "0.7365603", "0.72936386", "0.69809866", "0.6960244", "0.6876748", "0.6869636", "0.68177277", "0.6808054", "0.6802281", "0.6683109", "0.66047436", "0.6581167", "0.6508467", "0.64775556", "0.6405281", "0.63997096", "0.6395747", "0.6391783", "0.638771...
0.7715398
0
Add a named mouse function with callback functions + optional icon
def addFunction(name, callables, icon=None): if not _funcDict.has_key(name): _functionOrder.append(name) _funcDict[name] = callables if icon: imageDict[name] = icon if _mouseCategory: _mouseCategory.addFunc(name, callables)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_callbacks(self, defaults):\n defaults.update(self.mouse_callbacks)\n self.mouse_callbacks = defaults", "def handle_mouse_data(data):\n pass", "def add_function(self, func_name, *args, **kwargs):\n if len(args) > 0:\n attr = args[0]\n else:\n attr = f...
[ "0.61178905", "0.59508234", "0.5928415", "0.59145796", "0.5779913", "0.57500565", "0.5709002", "0.5657408", "0.56533897", "0.5491843", "0.541405", "0.5388819", "0.5361219", "0.5335027", "0.53146756", "0.52921", "0.52818173", "0.5251217", "0.52433527", "0.5240746", "0.52372247...
0.7056408
0