query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Test conversion of html with opacity style to pdf Opacity style in a web pages causes Segmentation Fault only if wkhtmltopdf is not connected to a graphical service like Xorg.
def testConvertHtmlWithOpacityStyleToPdf(self): self._testBase("data/test_with_opacity_style.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testConvertHtmlWithScriptToPdf(self):\n self._testBase(\"data/test_with_script.html\")", "def testConvertHtmlWithPngDataUrlToPdf(self):\n self._testBase(\"data/test_with_png_dataurl.html\")", "def test_html_output(self):\n pass", "def get_raw_pdf(html_path, pdf_path, width='', height=''):\n ...
[ "0.5745884", "0.57315564", "0.5591224", "0.5549338", "0.5359335", "0.5307319", "0.5298692", "0.52929", "0.52359253", "0.52262336", "0.5177624", "0.517652", "0.517652", "0.517652", "0.51568556", "0.5088497", "0.50467056", "0.5041735", "0.502852", "0.5027255", "0.4982086", "0...
0.8207992
0
Test conversion of html with an additional table of content
def testConvertHtmlWithTableOfContent(self): self._testBase( "data/test_with_toc.html", toc=True, xsl_style_sheet_data=b64encode(open("data/test_toc.xsl").read()), ) # XXX how to check for table of content presence ?
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_html_output(self):\n pass", "def test_table_html():\n in_json = {\n \"pandoc-api-version\": [1, 17, 5, 1],\n \"meta\": {\n \"$$references\": {\n \"t\": \"MetaMap\",\n \"c\": {\n \"tbl:id\": {\n \"t...
[ "0.7307433", "0.70207417", "0.692731", "0.6697066", "0.6632389", "0.66201836", "0.647758", "0.64540756", "0.63525", "0.6324208", "0.62797827", "0.62352824", "0.6216845", "0.61915964", "0.61899865", "0.6164262", "0.61589146", "0.61560684", "0.61545765", "0.6143673", "0.6142696...
0.8216785
0
The worst performance score.
def worst_score(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def personal_best(scores):\n return max(scores)", "def get_high_score(self) -> float:\n return max(self._scores)", "def personal_best(scores: list) -> int:\n return max(scores)", "def getHighScore(self):\n return max(self.scores)", "def personal_best(scores):\n# return sorted(scores,...
[ "0.74220115", "0.7369095", "0.73529595", "0.73461914", "0.73064435", "0.7243378", "0.7224825", "0.7153096", "0.71314156", "0.70326936", "0.7029879", "0.69835705", "0.69788337", "0.683283", "0.68274", "0.68151915", "0.681463", "0.6754643", "0.6749474", "0.67342293", "0.6727097...
0.8989782
0
Function to return whether current performance score is better than current best. This should be implemented.
def is_better(self, curr, best, **kwargs): score_threshold = kwargs.pop('score_threshold', 1e-3) relative_eps = 1.0 + score_threshold return curr >= best*relative_eps
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_best(self, metric: float) -> bool:", "def is_greater_better(scoring_function):\n if scoring_function in [\n 'accuracy', 'adjusted_rand_score', 'average_precision',\n 'balanced_accuracy','f1', 'f1_macro', 'f1_micro', 'f1_samples',\n 'f1_weighted', 'precision', 'precision_macro', 'pr...
[ "0.747881", "0.69427603", "0.68955714", "0.6772527", "0.67018735", "0.6515344", "0.64800745", "0.6424358", "0.637624", "0.6329296", "0.6233212", "0.6227178", "0.62026936", "0.61884624", "0.6162716", "0.6149905", "0.6149203", "0.60921496", "0.6070137", "0.6038295", "0.6034611"...
0.7845648
0
prettyfy the name for pysc2 map lookup
def standardizeMapName(mapName): newName = os.path.basename(mapName) newName = newName.split(".")[0] newName = newName.split("(")[0] newName = re.sub("[LTE]+$", "", newName) return re.sub(' ', '', newName, flags=re.UNICODE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n tmp = {str(c)+\" (id=\"+str(id(c))+\")\":v for c,v in self.items()}\n return \"ComponentMap(\"+str(tmp)+\")\"", "def __str__(self) -> str:\n mapping_str = ', '.join(\n f'{variable!s} -> {term!s}'\n for (variable, term) in self.mapping.items()\n ...
[ "0.6393425", "0.60165125", "0.58980197", "0.5882158", "0.58780026", "0.58731437", "0.58240795", "0.58021384", "0.57964367", "0.5765265", "0.57649297", "0.57419497", "0.57268083", "0.57015693", "0.56951237", "0.5690049", "0.5683217", "0.5683217", "0.5683217", "0.5683217", "0.5...
0.62320554
1
Return the default class hierarchy dictionary.
def default_class_hierarchy_dict(): return {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derive_class_hierarchy():\n logger.info('Deriving class hierarchy ...')\n data = statistics.get_json_data('classes')\n\n hierarchy = defaultdict(dict)\n keys = ['i', 's', 'ai', 'as', 'sc', 'sb', 'r']\n\n for cid in data:\n for key in keys:\n if key in data[cid] and data[cid][ke...
[ "0.6781914", "0.65062606", "0.63813835", "0.6267545", "0.62473226", "0.62175924", "0.6178537", "0.5954751", "0.5953997", "0.5932108", "0.59195054", "0.59142965", "0.5901989", "0.58595765", "0.58321863", "0.5818339", "0.5804834", "0.5788862", "0.5709798", "0.56741977", "0.5646...
0.9351468
0
Return the default file hierarchy dictionary.
def default_file_hierarchy_dict(): return { directory("include"): { directory("with spaces"): { file("with spaces.hpp"): { namespace("with_spaces"): { function("int", "value"): parameters() } } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_class_hierarchy_dict():\n return {}", "def get_default_paths(self):\n return {key: value.default_path for key, value in self}", "def get(self):\n for path, dirs, files in os.walk(self.directory):\n folders = path[self.start:].split(os.sep)\n if self.branches:\...
[ "0.7365556", "0.6702656", "0.6633775", "0.623178", "0.6229957", "0.61596197", "0.6079739", "0.5987825", "0.59239", "0.58614475", "0.5858239", "0.58376956", "0.58376956", "0.58376956", "0.5832336", "0.57800734", "0.57799923", "0.5694619", "0.5684486", "0.56160605", "0.5611224"...
0.7459949
0
Converts the specified memory quantity from one unit to another. Supported units are ["B", "KB", "MB", "GB", "TB", "PB"].
def convertMem(mem, fromCode="GB", toCode="MB"): assert mem is not None and (isinstance(mem, int) or isinstance(mem, float)) and mem >= 0, "Invalid memory: " % (mem) indices = ["B", "KB", "MB", "GB", "TB", "PB"] assert fromCode is not None and fromCode.strip().upper() in indices, "Invalid from code: %s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_unit(size_in_bytes, unit):\n if unit == 'KB':\n return size_in_bytes/1024\n elif unit == 'MB':\n return size_in_bytes/(1024*1024)\n elif unit == 'GB':\n return size_in_bytes/(1024*1024*1024)\n else:\n return size_in_bytes", "def convertFromBytes(size, unit):\n\tif (uni...
[ "0.7277126", "0.6947695", "0.68115354", "0.67552584", "0.67162085", "0.66954976", "0.65725", "0.63952094", "0.63424766", "0.63257724", "0.6288342", "0.62289834", "0.62005645", "0.6162397", "0.6162149", "0.61009115", "0.60763556", "0.60662353", "0.6020919", "0.6008452", "0.598...
0.7538796
0
Merges the specified output lines into a single string.
def formatOutput(output): assert output is not None, "Output is None" return "\n" + " ".join(output)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_lines(*args, **kwargs):\n return check_output(*args, **kwargs).splitlines()", "def print_output():\n\tprint ''.join([str(x)+\"\" for x in output])", "def return_fixed_output(output, rstrip=True):\n fixed_output = filter(_non_debug_line, output.split('\\r\\n'))\n joiner = '' if rstrip else '...
[ "0.66480833", "0.6211222", "0.60794544", "0.6075036", "0.58680034", "0.5830498", "0.5799025", "0.5767128", "0.57403636", "0.5715186", "0.570294", "0.5701719", "0.56530124", "0.5616031", "0.5598391", "0.5587614", "0.55386454", "0.54745513", "0.54627925", "0.54505545", "0.54416...
0.65789884
1
Returns a subcollection of the specified one, whose elements are not empty strings.
def filterEmptyStrings(collection): assert collection is not None, "Collection is None" return filter(lambda s: str(s).strip() != "", collection)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_collection(self):\n raise NotImplementedError", "def without_empty(s):\n return {i for i in s if not i.is_empty()}", "def _sanitize_value(self, value):\n if isinstance(value, collections.Iterable):\n newcollection = []\n for i in value:\n if len(i...
[ "0.54911816", "0.5484122", "0.5454712", "0.5401307", "0.53774446", "0.53146577", "0.5274968", "0.5272938", "0.5188137", "0.51744777", "0.51707447", "0.51608723", "0.5136659", "0.5076466", "0.5059283", "0.5058749", "0.5056052", "0.5051178", "0.5041587", "0.50303704", "0.497972...
0.6488247
0
Return the version prefix if any
def prefix(self) -> Optional[str]: return RE_VERSION.match(str(self._version)).group(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verPrefix(version, versionPattern=''):\n if not versionPattern:\n versionPattern = os.environ.get('KOMBI_VERSION_PATTERN', DEFAULT_VERSION_PATTERN)\n\n patternParts = __splitVersionPattern(versionPattern)\n return str(version)[:len(patternParts['prefix'])]", "def GetPrefix():\n m = BRANCH_R...
[ "0.7351603", "0.71091646", "0.6788119", "0.6688422", "0.6561797", "0.6536458", "0.6536458", "0.6536458", "0.65189993", "0.65139455", "0.64992476", "0.6489926", "0.64207184", "0.6407056", "0.6391019", "0.6385414", "0.6351009", "0.6347237", "0.6335778", "0.63176703", "0.6288917...
0.86012506
0
Return a bool to indicate alpha version.
def alpha(self) -> bool: return "a" in self.modifier if self.modifier else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasAlpha(self) :\n return self.m_hasAlpha", "def is_stable(self) -> bool:\n return not self.is_prerelease", "def enable_kubernetes_alpha(self) -> bool:\n return pulumi.get(self, \"enable_kubernetes_alpha\")", "def is_on(self) -> bool:\n current = self.coordinator.data.info.ver...
[ "0.71558696", "0.68556184", "0.66215545", "0.6604386", "0.62436414", "0.6219088", "0.6163636", "0.6142863", "0.6137229", "0.6127662", "0.6059142", "0.6059142", "0.6059142", "0.6052503", "0.6046842", "0.6028268", "0.59896886", "0.5884365", "0.58294576", "0.57802516", "0.576235...
0.7095586
1
Return a bool to indicate beta version.
def beta(self) -> bool: return "b" in self.modifier if self.modifier else "beta" in self.string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_installed_beta_no_newer_stable(self):\n self.change_version(self.version_1_2_2, '1.2beta')\n self.change_status(self.version_1_2_2, amo.STATUS_BETA)\n\n version, file = self.get('1.2beta', self.version_int,\n self.app, self.platform)\n assert ver...
[ "0.6776148", "0.6726279", "0.6702003", "0.660505", "0.65905607", "0.6581529", "0.6487351", "0.64485204", "0.64485204", "0.628221", "0.6265156", "0.62314755", "0.6192408", "0.61612093", "0.61580074", "0.61532915", "0.6114675", "0.608962", "0.608962", "0.608962", "0.608962", ...
0.7676527
0
Return a int representaion of the number of sections in the version.
def sections(self) -> int: return len(self.string.split("."))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_sections(self):\n #print (len(self.config.sections()))\n return len(self.config.sections())", "def number_of_sections(self):\n sections = self.config.sections()\n return len(sections)", "def testSectionCount(self):\n\n self.sectionCount(3640)", "def section(se...
[ "0.7290255", "0.71390265", "0.7022638", "0.6800033", "0.6529658", "0.6438036", "0.63203466", "0.629719", "0.62520695", "0.6229295", "0.6214037", "0.61139905", "0.6018662", "0.6015436", "0.5944503", "0.592994", "0.5904244", "0.58882594", "0.58861005", "0.58535624", "0.5848062"...
0.7857107
0
Return the modifier of the version if any.
def modifier(self) -> str: match = RE_MODIFIER.match(self.string.split(".")[-1]) return match.group(1) if match else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modifier(self):\n return self._modifier", "def modifier(self) -> str:\n return self._modifier", "def last_modifier(self) -> str:\n return pulumi.get(self, \"last_modifier\")", "def version_patch(self):\n assert self._version_patch != NotImplemented\n return self._versio...
[ "0.7436179", "0.74236995", "0.6400592", "0.63046837", "0.62790924", "0.62790924", "0.62790924", "0.617146", "0.6152442", "0.61241037", "0.6110316", "0.60718215", "0.605894", "0.6057274", "0.605401", "0.60382944", "0.60236037", "0.59833145", "0.5965063", "0.59624547", "0.59554...
0.78408784
0
Return the version strategy.
def strategy(self) -> AwesomeVersionStrategy: return version_strategy(self.string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strategy(self) -> Optional[pulumi.Input['UpgradeSettingsStrategy']]:\n return pulumi.get(self, \"strategy\")", "def get_version(self):\n pass", "def get_algorithm_version(self):\n return self.get_attr('algorithm_version')", "def get_version():\n return 1", "def get_version(self)...
[ "0.7340707", "0.7004464", "0.6950592", "0.68829256", "0.6777264", "0.6774704", "0.6755827", "0.6669227", "0.65694803", "0.6558051", "0.6553694", "0.6553694", "0.65459174", "0.65300995", "0.65300995", "0.6527395", "0.6527395", "0.6527395", "0.6527395", "0.6527395", "0.6495148"...
0.8231897
0
Return True if the version string is simple.
def simple(self) -> bool: return is_simple(self.string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_python_version(s: str) -> bool:\n\n return s.startswith(\"2\") or s.startswith(\"3\")", "def is_simple(self): # -> bool:\n ...", "def version_is_full_release(version_string):\n match = VERSION_REGEX.match(version_string)\n\n if match and match.groupdict()[\"modifier\"] == \"\":\n ...
[ "0.6629746", "0.65817094", "0.6550173", "0.6395718", "0.6303441", "0.6069128", "0.59459835", "0.59038144", "0.58978236", "0.5895466", "0.58661574", "0.5808034", "0.58048254", "0.58044857", "0.57614726", "0.57409894", "0.5707732", "0.56662035", "0.56323236", "0.55764836", "0.5...
0.7469431
0
Request the list of groups for the account. Print out how many groups there are, then use the first group where the test property lives.
def getGroup(): print print "Requesting the list of groups for this account" groups_result = getResult('/papi/v0/groups') return (groups_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_groups(self):\n response = self.client.get_groups()\n uri, args = response[\"uri\"].split(\"?\")\n\n self.assertEqual(response[\"method\"], \"GET\")\n self.assertEqual(uri, \"/admin/v1/groups\")\n self.assertEqual(util.params_to_dict(args), {\"account_id\": [self.cli...
[ "0.76318985", "0.72561604", "0.7251496", "0.7251496", "0.7171868", "0.69862527", "0.69726115", "0.69587696", "0.69490767", "0.6907517", "0.68522304", "0.6844985", "0.6844985", "0.67527145", "0.6748885", "0.6688267", "0.66860783", "0.66860723", "0.66638684", "0.66486186", "0.6...
0.7699433
0
Get the properties for the associated group/contract combination
def getProperties(groupId, contractId): print "Getting properties for group %s and contract %s" % (groupId, contractId) property_parameters = { "contractId":contractId, "groupId":groupId } property_result = getResult('/papi/v0/properties', property_parameters) if "properties" in property_result: property_items ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_properties():", "def getPropertiesAll():", "def get_params(self):\n return {'physical_properties_actor': {'group': self.group}}", "def getProperties():", "def test_properties_stats_group_by_group_by_and_sub_group_by_get(self):\n pass", "def get_properties(self):\n return COMM...
[ "0.595744", "0.58036405", "0.5743681", "0.5725618", "0.56826746", "0.5637038", "0.5632564", "0.54945195", "0.5491524", "0.54664433", "0.5392897", "0.5355023", "0.5322294", "0.52961135", "0.5288239", "0.5287506", "0.52869225", "0.52772146", "0.5272553", "0.52705836", "0.521649...
0.69252104
0
Create a custom range instance
def create_range(range_class): if not hasattr(range_class, 'name'): raise exceptions.ValidationError( "A custom range must have a name attribute") return Range.objects.create( name=range_class.name, proxy_class=_class_path(range_class))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, range):\n raise NotImplementedError", "def range_maker(low, hi, step, lst=None):\n return numpy.arange(low, hi, step)", "def new_range(r):\n if isinstance(r, list) or isinstance(r, tuple) and len(r) == 2:\n lower = r[0]\n upper = r[1]\n else:\n lower = r\n ...
[ "0.7898044", "0.7348169", "0.707552", "0.7064517", "0.7046968", "0.6874818", "0.6799003", "0.67599416", "0.67424244", "0.6694247", "0.66876024", "0.666282", "0.66363037", "0.6542488", "0.65385115", "0.64849585", "0.64830506", "0.64606047", "0.6450502", "0.6440675", "0.6436779...
0.7600169
1
Create a custom condition instance
def create_condition(condition_class): return Condition.objects.create( proxy_class=_class_path(condition_class))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create( name ):\n if name == 'splunk':\n return SplunkCondition()\n\n elif name == 'base':\n return _BaseCondition()\n\n else:\n raise EncoreException('Unrecognised condition: {0}'.format( name ))", "def __init__(self, condition: typing.Callable[..., bool]):\n super().__i...
[ "0.74090016", "0.7075004", "0.6859647", "0.6859647", "0.68583304", "0.6705134", "0.6695043", "0.6613352", "0.631761", "0.6232662", "0.61909944", "0.6052121", "0.6037356", "0.6036718", "0.6023041", "0.59498423", "0.5853378", "0.5791596", "0.5791596", "0.5791596", "0.5791596", ...
0.7530871
0
Returns a date and time formatted as per HTTP RFC 2616.
def http_date_time(when): gmtime = time.gmtime(when) return '%s, %02d %3s %4d %02d:%02d:%02d GMT' % ( WEEKDAY_ABR[gmtime.tm_wday], gmtime.tm_mday, MONTH_ABR[gmtime.tm_mon - 1], gmtime.tm_year, gmtime.tm_hour, gmtime.tm_min, gmtime.tm_sec)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatRFC2616Date(secs=None):\n\tif secs is None:\n\t\tsecs = time.time()\n\treturn emailutils.formatdate(secs, localtime=False, usegmt=True)", "def rfc3999(date):\n if not date: return ''\n date = date + datetime.timedelta(seconds = -time.timezone)\n if time.daylight:\n date += datetime.time...
[ "0.73714656", "0.7116985", "0.69873196", "0.6974283", "0.68409675", "0.6838362", "0.68314415", "0.681626", "0.6791276", "0.6748883", "0.67287123", "0.6700428", "0.6695328", "0.6688156", "0.668528", "0.6676679", "0.6670514", "0.66421837", "0.66373765", "0.66150707", "0.6611124...
0.72268707
1
Handles incoming WSGI requests. Requests that start with the configured path simply serve up any files under the configured location on the file system. Other requests are passed on to the next WSGI app in the chain.
def __call__(self, env, start_response): path = os.path.normpath(env['PATH_INFO'].strip('/')) if path == self.path: path = '.' elif path.startswith(self.path + '/'): path = path[len(self.path) + 1:] if not path: path = '.' elif self.pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handler ( self, environ, start_response ) :\n url = urlparse ( reconstruct_url ( environ ) ) \n \n if self.mount_point is not None:\n split_url = url.path.split ( self.mount_point, 1 ) \n serve_file = split_url [ 1 ] \n else:\n serve_file = url.path...
[ "0.65474683", "0.63074946", "0.62397385", "0.60925007", "0.60817075", "0.60779226", "0.599752", "0.59761715", "0.5958712", "0.59400415", "0.5929748", "0.5829383", "0.5764965", "0.5761285", "0.5758303", "0.57550424", "0.572396", "0.5721223", "0.56893045", "0.5639996", "0.55924...
0.7011241
0
Translates the overall server configuration. The conf is translated into an appspecific configuration dict suitable for passing as ``parsed_conf`` in the
def parse_conf(cls, name, conf): parsed_conf = { 'path': conf.get(name, 'path', '/').strip('/'), 'serve_path': conf.get_path(name, 'serve_path').rstrip('/')} if not parsed_conf['serve_path']: raise Exception('[%s] serve_path must be set' % name) return parsed_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_synapse_config(self):\n hookenv.log(\n \"Rendering synapse configuration to {}\".format(self.synapse_config),\n hookenv.DEBUG,\n )\n if self.pgsql_configured():\n render_result = templating.render(\n \"homeserver.yaml.j2\",\n ...
[ "0.56515485", "0.5574661", "0.5523583", "0.5518153", "0.55050313", "0.5503376", "0.54650676", "0.54127175", "0.53931737", "0.53750205", "0.5345372", "0.53380966", "0.5308977", "0.5239369", "0.5234539", "0.52209145", "0.52013206", "0.51886344", "0.5155737", "0.51472735", "0.51...
0.5918209
0
Collates the different files for each cluster into a dictionary. This will also remove any clusters we request and perform a check that all clusters have the required files.
def file_pairing(self, include=None, exclude=None): # List the file names for both the images and the catalogs if isinstance(self._irac_image_dir, list): image_files = list(chain.from_iterable(glob.glob(f'{img_dir}/*.fits') for img_dir in self._irac_image_dir)) else: ima...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clustering(self): \n clusterOfFiles=self.getClusters()\n \n #group files based on the hash of their contents\n self.keyingMethod=md5Hash\n [self.addFile(afile) for acluster in clusterOfFiles for afile in acluster]\n clusterOfFiles=self.getClusters()\n sel...
[ "0.71143055", "0.63735855", "0.6250435", "0.6203251", "0.616796", "0.6153523", "0.6134056", "0.59433764", "0.58170253", "0.5809386", "0.57750106", "0.5771018", "0.5729723", "0.5688608", "0.5670634", "0.56091005", "0.55651087", "0.55550224", "0.5547735", "0.55256015", "0.55040...
0.6880145
1
Matches the science images to the official SPT catalog. Uses the center pixel coordinate of the 3.6 um science image to match against the SZ center of the clusters in the official SPT catalog. Clusters are kept only if their images match an SZ center within the given maximum separation. If multiple images match to the ...
def image_to_catalog_match(self, max_image_catalog_sep): catalog = self._spt_catalog # Create astropy skycoord object of the SZ centers. sz_centers = SkyCoord(catalog['RA'], catalog['DEC'], unit=u.degree) for cluster in self._catalog_dictionary.values(): # Get the RA and D...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, max_clusters):\n sample_dist_matrix = self.matrix_dist()\n self.link.print_link()\n first_clus = self.clusters[0] # initialize first cluster to merge into\n second_clus = self.clusters[0] # initialize second cluster to merge\n max_samples_dist = max(sample_dist_ma...
[ "0.5848657", "0.5763144", "0.5756294", "0.56484246", "0.55037874", "0.5455271", "0.5440703", "0.53846854", "0.53790927", "0.5324826", "0.5324202", "0.5316579", "0.5308012", "0.52924293", "0.529075", "0.5288194", "0.52846956", "0.52782357", "0.52688426", "0.5266597", "0.526298...
0.76026565
0
Generates a binary good pixel map using the coverage maps. Creates a new fits image where every pixel has values of `1` if the coverage values in both IRAC bands are above the given thresholds or `0` otherwise.
def coverage_mask(self, ch1_min_cov, ch2_min_cov): for cluster_id, cluster_info in self._catalog_dictionary.items(): # Array element names irac_ch1_cov_path = cluster_info['ch1_cov_path'] irac_ch2_cov_path = cluster_info['ch2_cov_path'] # Read in the two coverag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_iou(boxes_true, boxes_pred, scores, thresholds = [0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75]):\n\n # According to the introduction, images with no ground truth bboxes will not be\n # included in the map score unless there is a false positive detection (?)\n\n # return None if both are empty, don'...
[ "0.6125997", "0.5634476", "0.5634476", "0.5634476", "0.56280094", "0.5526669", "0.54829973", "0.54744196", "0.54724973", "0.54532164", "0.54526675", "0.54316235", "0.53706366", "0.5351472", "0.53411156", "0.5336489", "0.53259146", "0.53125376", "0.5258427", "0.5242191", "0.52...
0.58262676
1
Performs additional masking on the good pixel maps for requested clusters. If a cluster has a DS9 regions file present in the directory specified as `region_file_dir` in initialization then we will read in the file, and set pixels within the shapes present in the file to `0`. Notes The allowable shapes in the regions f...
def object_mask(self): # Region file directory files if isinstance(self._region_file_dir, list): reg_files = {self._keyfunct(f): f for f in chain.from_iterable(glob.glob(f'{reg_dir}/*.reg') for reg_dir in self._regio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fix_mask(self):\n fixable_mask = mapreader.Map(os.path.join(tests.TEST_DATA_PATH, 'segmentations', 'test_fixable_mask.map'))\n self.assertFalse(fixable_mask.is_mask)\n fixable_mask.fix_mask()\n self.assertTrue(fixable_mask.is_mask)", "def _region_mask(self, cs, all_regions, x...
[ "0.53000647", "0.52897805", "0.5226478", "0.50740224", "0.5040365", "0.49909344", "0.49804494", "0.49571514", "0.49495628", "0.49361882", "0.4911906", "0.49107993", "0.4890557", "0.48747185", "0.48293045", "0.48280445", "0.48280445", "0.4828019", "0.48067454", "0.47801915", "...
0.65371066
0
This function computes a modified Hogg et al. (2002) definition of the Kcorrection. The observed filter and zeropoint will be the IRAC 4.5 um values.
def cluster_k_correction(self): # Load in the IRAC 4.5 um filter as the observed filter irac_45 = SpectralElement.from_file('Data_Repository/filter_curves/Spitzer_IRAC/080924ch2trans_full.txt', wave_unit=u.um) # Store the official IRAC 4.5 um zero po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kcorrect(self, filter_list_q=None, filter_list_r=None, band_shift=0.):\n if not filter_list_q: filter_list_q = self.filter_list\n if not filter_list_r: filter_list_r = self.filter_list\n\n if len(filter_list_q) != len(filter_list_r):\n raise ValueError('Numbers of filters must m...
[ "0.6049725", "0.593412", "0.5909316", "0.5889606", "0.5803568", "0.57738686", "0.5743096", "0.5700665", "0.5682678", "0.56737506", "0.56637645", "0.55764914", "0.5571384", "0.555053", "0.5475023", "0.54531264", "0.54312754", "0.54308134", "0.53924924", "0.53894144", "0.538182...
0.6409771
0
Computes the Jband absolute magnitudes for use in the Assef et al. (2011) luminosity function. We will use the observed apparent 3.6 um magnitude and assume a Polleta QSO2 SED for all objects to Kcorrect to the absolute FLAMINGOS Jband magnitude. Returns
def j_band_abs_mag(self): # Load in the IRAC 3.6 um filter as the observed filter irac_36 = SpectralElement.from_file(self._irac_filter, wave_unit=u.um) flamingos_j = SpectralElement.from_file(self._j_band_filter, wave_unit=u.nm) # We will use the official IRAC 3.6 um zero-point flux ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def j_band_abs_mag(self):\n\n # Load in the IRAC 3.6 um filter as the observed filter\n irac_36 = SpectralElement.from_file(self._irac_filter, wave_unit=u.um)\n flamingos_j = SpectralElement.from_file(self._j_band_filter, wave_unit=u.nm)\n\n # We will use the official IRAC 3.6 um zero-p...
[ "0.7629827", "0.5995928", "0.58825415", "0.5783412", "0.56100976", "0.5591324", "0.5488376", "0.54337126", "0.540519", "0.5386843", "0.53587943", "0.53322387", "0.5304681", "0.5287902", "0.52460724", "0.5208159", "0.5202377", "0.5188505", "0.5181547", "0.51752573", "0.5162223...
0.7608973
1
Selects the objects in the clusters as AGN subject to a color cut. Reads in the SExtractor catalogs and performs all necessary cuts to select the AGN in the cluster. First, a cut is made on the SExtractor flag requiring an extraction flag of `< 4`. A magnitude cut is applied on the faintend of the selection band. This ...
def object_selection(self, ch1_bright_mag, ch2_bright_mag, selection_band_faint_mag, selection_band='I2_MAG_APER4'): clusters_to_remove = [] for cluster_id, cluster_info in self._catalog_dictionary.items(): # Read in the catalog se_catalog = Table.read(cluster_info['se_cat_path'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purify_selection(self, ch1_ch2_color_cut):\n\n # Read in the number count distribution file\n with open(self._field_number_dist, 'r') as f:\n field_number_distribution = json.load(f)\n field_number_counts = field_number_distribution['normalized_number_counts']\n color_bin...
[ "0.60852695", "0.59461117", "0.5622022", "0.5604209", "0.55619615", "0.5407059", "0.532152", "0.52783316", "0.52493685", "0.5190198", "0.5146076", "0.5125246", "0.5118821", "0.5116043", "0.5110162", "0.5108866", "0.5107161", "0.5097582", "0.5056697", "0.5037951", "0.5032283",...
0.6899919
0
Merges the SExtractor photometry catalog with information about the cluster in the official SPT catalog.
def catalog_merge(self, catalog_cols=None): for cluster_info in self._catalog_dictionary.values(): # Array element names catalog_idx = cluster_info['SPT_cat_idx'] se_catalog = cluster_info['catalog'] # Replace the existing SPT_ID in the SExtractor catalog with t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_catalogs(self):\n n_exposures = len(self.info['Module'])\n self.info['point_source'] = [None] * n_exposures\n self.info['galaxyListFile'] = [None] * n_exposures\n self.info['extended'] = [None] * n_exposures\n self.info['convolveExtended'] = [False] * n_exposures\n ...
[ "0.60301304", "0.5513732", "0.55033004", "0.54286397", "0.5401107", "0.530687", "0.5304147", "0.523912", "0.5212986", "0.5149777", "0.51291513", "0.5106632", "0.50841045", "0.5069048", "0.5041999", "0.5037942", "0.50347835", "0.50220233", "0.50186545", "0.49860176", "0.495794...
0.7108529
0
Calculates the separations of each object relative to the SZ center. Finds both the angular separations and physical separations relative to the cluster's r500 radius.
def object_separations(self): for cluster_info in self._catalog_dictionary.values(): catalog = cluster_info['catalog'] # Create SkyCoord objects for all objects in the catalog as well as the SZ center object_coords = SkyCoord(catalog['ALPHA_J2000'], catalog['DELTA_J2000'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_separations(self):\n\n for cutout_info in self._catalog_dictionary.values():\n catalog = cutout_info['catalog']\n\n # Create SkyCoord objects for all objects in the catalog as well as the image center\n object_coords = SkyCoord(catalog['ALPHA_J2000'], catalog['DEL...
[ "0.7033934", "0.6200771", "0.61623174", "0.58938783", "0.57421154", "0.5588339", "0.557842", "0.5490397", "0.54819787", "0.5392507", "0.53449166", "0.5322467", "0.53214264", "0.5309282", "0.52883315", "0.5286885", "0.52770865", "0.5261102", "0.52358395", "0.5215119", "0.51844...
0.77854586
0
Adds completeness simulation data to the catalog. Takes the completeness curve values for the cluster, interpolates a function between the discrete values, then
def completeness_value(self, selection_band='I2_MAG_APER4'): # Load in the completeness simulation data from the file if isinstance(self._completeness_results, list): json_dicts = [] for comp_results in self._completeness_results: with open(comp_results, 'r') as ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_cluster_accuracies():\n accuracies = {}\n with Parallel(n_jobs=morphs.parallel.N_JOBS) as parallel:\n for block_path in morphs.paths.blocks():\n print(block_path)\n spikes = morphs.load.ephys_data(block_path, collapse_endpoints=True)\n\n if len(spikes[\"recordi...
[ "0.5378484", "0.52962726", "0.527498", "0.52039576", "0.515216", "0.51226455", "0.5103976", "0.50949556", "0.50500226", "0.50090396", "0.49913463", "0.4972856", "0.495353", "0.49418268", "0.49357253", "0.49216944", "0.49161276", "0.4904244", "0.49036115", "0.49016604", "0.489...
0.61809057
0
Collates all catalogs into one table then writes the catalog to disk.
def final_catalogs(self, filename=None, catalog_cols=None): final_catalog = vstack([cluster_info['catalog'] for cluster_info in self._catalog_dictionary.values()]) # If we request to keep only certain columns in our output if catalog_cols is not None: final_catalog.keep_columns(cat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commit_all(catalog):\n data = _sort(catalog)\n for i in (\"space\", \"folder\", \"dataset\"):\n for x in data[i]:\n x.commit()", "def catalog_merge(self, catalog_cols=None):\n\n for cluster_info in self._catalog_dictionary.values():\n # Array element names\n ...
[ "0.6468309", "0.5989688", "0.56459284", "0.5489879", "0.5469518", "0.5309471", "0.5253361", "0.52173823", "0.5171973", "0.515313", "0.5135029", "0.5130573", "0.5085238", "0.5084769", "0.50752443", "0.5074923", "0.5034462", "0.50288045", "0.502765", "0.5023414", "0.50230813", ...
0.608957
1
Calculates the angular separations of each object relative to the image center.
def object_separations(self): for cutout_info in self._catalog_dictionary.values(): catalog = cutout_info['catalog'] # Create SkyCoord objects for all objects in the catalog as well as the image center object_coords = SkyCoord(catalog['ALPHA_J2000'], catalog['DELTA_J2000'],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def naturalAspectRatio(self):\n return math.sin(self.view_angle_h) / math.sin(self.view_angle_v)", "def barycentre (liste_objets):\r\n x = 0\r\n y = 0\r\n summass = 0\r\n for i in liste_objets:\r\n x += i.mass * i.posx\r\n y += i.mass * i.posy\r\n summass += i.mass\r\n x /=...
[ "0.5753707", "0.5689572", "0.56501245", "0.5601185", "0.55973375", "0.5538094", "0.55155957", "0.5512323", "0.55011624", "0.54460406", "0.54402614", "0.5406486", "0.53141814", "0.5306149", "0.5304944", "0.5300432", "0.5297689", "0.52513605", "0.52495813", "0.524905", "0.52183...
0.6110831
0
Computes the Jband absolute magnitudes for use in the Assef et al. (2011) luminosity function. We will use the observed apparent 3.6 um magnitude and assume a Polleta QSO2 SED for all objects to Kcorrect to the absolute FLAMINGOS Jband magnitude. Returns
def j_band_abs_mag(self): # Load in the IRAC 3.6 um filter as the observed filter irac_36 = SpectralElement.from_file(self._irac_filter, wave_unit=u.um) flamingos_j = SpectralElement.from_file(self._j_band_filter, wave_unit=u.nm) # We will use the official IRAC 3.6 um zero-point flux ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def j_band_abs_mag(self):\n\n # Load in the IRAC 3.6 um filter as the observed filter\n irac_36 = SpectralElement.from_file(self._irac_filter, wave_unit=u.um)\n flamingos_j = SpectralElement.from_file(self._j_band_filter, wave_unit=u.nm)\n\n # We will use the official IRAC 3.6 um zero-p...
[ "0.7608049", "0.59964824", "0.58822817", "0.57833415", "0.56102043", "0.55912673", "0.5488814", "0.5432965", "0.54048514", "0.53869367", "0.53587365", "0.5332131", "0.5304899", "0.528779", "0.52466476", "0.52075094", "0.5202391", "0.5187904", "0.51815224", "0.51740694", "0.51...
0.7629013
0
Generates twodimensional training data from two classes. The number of examples in the data is "example_size". Each example is randomly generated from one of two classes. Data belonging to each class are generated using two twodimensional Gaussian distribution with different means and covariance matrices.
def generate_data(example_size): # A placeholder for data. x = np.zeros((example_size, 2)) # Randomly selects one of two classes for each example. class_id = np.random.randint(2, size=example_size) # Generates data for the class 0. class_0_idx = np.where(class_id == 0) mean0 = [0.0, 1.0]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_data(num_sample=None):\n I = np.eye(3, dtype=np.float32)\n\n\n if (num_sample == None):\n num_sample = 100\n\n # Generate first class\n m1 = np.asarray([0.5, 0.5], dtype=np.float32)\n cov1 = np.asarray([[0.1, 0],\n [0, 0.1]], dtype=np.float32)\n data1 = rng...
[ "0.65752196", "0.6445264", "0.62967867", "0.621237", "0.61468756", "0.61384785", "0.61201763", "0.60479647", "0.60273725", "0.60257494", "0.6001405", "0.597554", "0.5915635", "0.58671814", "0.58343005", "0.58264834", "0.5801961", "0.5795742", "0.57617813", "0.57445174", "0.57...
0.7620779
0
Compute the node volumes.
def computeNodeVolumes(self): for i in np.arange(0,self.ni): for j in np.arange(0,self.nj): for k in np.arange(0,self.nk): V = self.dh[0]*self.dh[1]*self.dh[2] if (i==0 or i==self.ni-1): V*=0.5 if (j==0 or j==self.n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volumes(self):", "def volume(nodes, graph):\n ###TODO\n pass", "def volume(self):\n return [node.volume for node in self]", "def list_volumes(self):\n print '# Listing existing volumes'\n self.compute.list_volumes()", "def list_volumes(self, node=None):\n\n data = self...
[ "0.74941075", "0.731756", "0.7136064", "0.68049896", "0.6739897", "0.66602635", "0.6347831", "0.62408555", "0.61435556", "0.6129233", "0.60676765", "0.60538983", "0.60538983", "0.5960976", "0.59290266", "0.5905389", "0.5893624", "0.58917075", "0.58512735", "0.5849365", "0.584...
0.7711581
0
Compute the charge density.
def computeChargeDensity(self): self.rho = np.zeros((self.ni, self.nj, self.nk)) for species in self.speciesList: if species.charge!=0: self.rho += species.charge*species.den
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _density(self):\n fraction = np.array([0.]+[m.value for m in self.fraction])\n # TODO: handle invalid fractions using penalty functions\n # S = sum(fraction)\n # scale = S/100 if S > 100 else 1\n # fraction[0] = 100 - S/scale\n # penalty = scale - 1\n fraction[0...
[ "0.7530408", "0.73343456", "0.7283132", "0.72509116", "0.72509116", "0.72509116", "0.71329844", "0.70839", "0.7079626", "0.69515586", "0.6775504", "0.67077136", "0.6704856", "0.66575205", "0.65954286", "0.65954286", "0.6564065", "0.6545288", "0.65450436", "0.65390414", "0.653...
0.79801714
0
Changes the bot's behavior mode for a given Discord server.
def switch_mode(guild_id: int, mode: str): key = _mode_key(guild_id) db[key] = mode if mode == fixtures.chat: del db[key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sendModeChange(self, msg, args=\"\", target=None):\n if target is None:\n target = \"#chan\"\n message = \":Wolf!~wolf@yok.utu.fi MODE {} {} {}\\r\\n\".format(target, msg, args)\n self.client.dataReceived(message)", "def mode_auto(self):\n if self.__check_mode_change()...
[ "0.6364935", "0.60535496", "0.6029431", "0.59094155", "0.5875401", "0.57205594", "0.571679", "0.56967366", "0.5678905", "0.56336373", "0.5626705", "0.5526063", "0.5517209", "0.55169755", "0.5493964", "0.54108804", "0.5406695", "0.537454", "0.53577685", "0.53499895", "0.534988...
0.6939989
0
Fetches the bot's behavior mode for a given Discord server.
def get_mode(guild_id: int): key = _mode_key(guild_id) if key not in db: return fixtures.chat return db[key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mode(self) -> str:\n\n return self.send(self.cmd.GET_MODE)", "def get_mode(self):\r\n return self._api.get_mode()", "def game_mode(self):\n return self._get(\"game_mode\")", "def _get_mode():\n return context.get_context('mode')", "def get_mode(self, ):\n return self....
[ "0.62315625", "0.59785706", "0.5904186", "0.5902793", "0.57068723", "0.5660874", "0.5515341", "0.55088925", "0.5500647", "0.5492132", "0.5484353", "0.54668605", "0.5456963", "0.545687", "0.5452248", "0.54438627", "0.54055154", "0.5392773", "0.53837216", "0.5282799", "0.525653...
0.7134497
0
Increments the number of times the bot has called upon GPT3.
def increment_gpt_completions(): _increment_counter("gpt_completions")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increment_counter(self) -> None:", "def counter(self) -> int:", "def counter(self) -> int:", "def inc( self ):\n self.count += 1", "def inc(self):\n \n self.count += 1", "def updateGACount(self):\n self.ga_count += 1", "async def count(self, ctx):\n #Small chance ...
[ "0.67757624", "0.66366524", "0.66366524", "0.6491001", "0.64446753", "0.6382773", "0.62987596", "0.6295936", "0.6291472", "0.62065566", "0.6206188", "0.6173869", "0.6125122", "0.6102132", "0.60631764", "0.60457885", "0.6040812", "0.6036177", "0.6021704", "0.60163426", "0.6010...
0.6777141
0
Fetches the number of times the bot has called upon GPT3.
def get_gpt_completions() -> int: return _get_counter("gpt_completions")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_count(results):\n return len(results)", "def get_count(self):\r\n return self.count", "def count(self) -> int:\n return pulumi.get(self, \"count\")", "async def quote_count(self):\n await self.bot.type()\n result = self.count()\n await self.bot.say(result)",...
[ "0.62120426", "0.6207076", "0.6195694", "0.6195053", "0.6193064", "0.6166276", "0.6166276", "0.6158104", "0.6152014", "0.6130577", "0.6130577", "0.6126625", "0.6117636", "0.61127734", "0.6110218", "0.61096126", "0.61037076", "0.6097694", "0.60685635", "0.60685635", "0.6068563...
0.6642437
0
Increments the number of times the bot has joined a new Discord server.
def increment_guild_count(): _increment_counter("guilds_joined")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_guild_count() -> int:\n return _get_counter(\"guilds_joined\")", "async def count(ctx):\n users = len(set(bot.get_all_members()))\n servers = len(bot.servers)\n\n colour = ''.join([random.choice('0123456789ABCDEF') for x in range(6)])\n colour = int(colour, 16)\n embed = discord.Embed(c...
[ "0.67351145", "0.6580996", "0.64553255", "0.6380524", "0.62797195", "0.6258795", "0.6256039", "0.60467", "0.60429853", "0.6021418", "0.59913725", "0.5839755", "0.57931155", "0.57805455", "0.57604533", "0.57604533", "0.57604533", "0.57604533", "0.57604533", "0.57604533", "0.57...
0.8089962
0
Fetches the number of times the bot has joined a new Discord server.
def get_guild_count() -> int: return _get_counter("guilds_joined")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increment_guild_count():\n _increment_counter(\"guilds_joined\")", "async def count(ctx):\n users = len(set(bot.get_all_members()))\n servers = len(bot.servers)\n\n colour = ''.join([random.choice('0123456789ABCDEF') for x in range(6)])\n colour = int(colour, 16)\n embed = discord.Embed(col...
[ "0.71610075", "0.6775801", "0.6639288", "0.6386706", "0.6309916", "0.62673753", "0.6198729", "0.6164844", "0.615084", "0.61471665", "0.6077989", "0.5998459", "0.5978479", "0.5959258", "0.5931924", "0.59211755", "0.59084696", "0.58824116", "0.58693665", "0.5832288", "0.5808841...
0.7822986
0
Increments the number of times the bot has called the Etherscan API.
def increment_etherscan_calls(): _increment_counter("etherscan_calls")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_etherscan_calls() -> int:\n return _get_counter(\"etherscan_calls\")", "def increment_counter(self) -> None:", "def inc( self ):\n self.count += 1", "def inc(self):\n \n self.count += 1", "def add_count(self):\n self.count += 1", "def _increase_counter(self, respons...
[ "0.6934852", "0.67007434", "0.6490865", "0.6485326", "0.6322484", "0.62933683", "0.6238643", "0.62330043", "0.62144375", "0.61618984", "0.6143483", "0.6143483", "0.61156535", "0.6038863", "0.601487", "0.6003469", "0.6001606", "0.5975672", "0.59506804", "0.5885791", "0.5883150...
0.8248691
0
Fetches the number of times the bot has called the Etherscan API.
def get_etherscan_calls() -> int: return _get_counter("etherscan_calls")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\r\n url = '{0}/{1}'.format(self.get_url(), 'count')\r\n\r\n return http.Request('GET', url), parsers.parse_json", "def GetCount(self):\n return self._server.get_count()", "def increment_etherscan_calls():\n _increment_counter(\"etherscan_calls\")", "def _get_wireguard...
[ "0.66338074", "0.65768725", "0.65583724", "0.64269334", "0.63450223", "0.63380396", "0.6315614", "0.6310543", "0.6267673", "0.62313205", "0.6201313", "0.6194689", "0.619361", "0.61920506", "0.61883724", "0.6185133", "0.6167828", "0.61490756", "0.6132312", "0.6128996", "0.6118...
0.7939709
0
Returns the formatted key representing a server's interaction mode.
def _mode_key(guild_id: int) -> str: return f"mode/{guild_id}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getkey(self) -> str:\n return self.screen.getkey()", "def get_mode(self) -> str:\n\n return self.send(self.cmd.GET_MODE)", "def get_key(self) -> str:\n return f'{self.address}_{self.port}'", "def keypad_key(m) -> str:\n return f\"keypad_{m.digit}\"", "def scat_key(self):\n ...
[ "0.64127934", "0.6240811", "0.6202982", "0.61066186", "0.610295", "0.6052676", "0.5982132", "0.5955124", "0.5954061", "0.5954061", "0.5953439", "0.5855512", "0.58451843", "0.58385724", "0.58207315", "0.58051056", "0.58004147", "0.58004147", "0.5794554", "0.5794554", "0.579332...
0.749164
0
Create instance of ReleasePduSession class
def __init__(self, connection=None, prompt=None, newline_chars=None, runner=None): super(ReleasePduSession, self).__init__(connection, operation='execute', prompt=prompt, newline_chars=newline_chars, runner=runner) self.ret_required = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\r\n # create a session id\r\n self.session = ViSession()", "def __init__(self, username=None, password=None, terminal_id=None):\n if username is None:\n raise Exception('Username is empty')\n if password is None:\n raise Exception('Password is...
[ "0.59411764", "0.53526604", "0.5335359", "0.5335359", "0.5335359", "0.531777", "0.5271947", "0.5268836", "0.5240727", "0.5178478", "0.5159803", "0.5155766", "0.5059394", "0.5057607", "0.50530124", "0.5051264", "0.5038893", "0.50235176", "0.5016713", "0.50115156", "0.49998862"...
0.65711516
0
Polynomial extension from j=1 to degree of each components of tx
def build_poly(tx, degree) : shape = tx.shape poly = np.zeros((shape[0], shape[1] * degree)) poly[:,:shape[1]] = tx for deg in range(2, degree + 1) : for j in range(0, shape[1]) : poly[:, shape[1] * (deg - 1) + j] = tx[:,j] ** deg return poly
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_poly(x, degree):\n tx = np.zeros((x.shape[0], x.shape[1]*(degree+1)))\n \n for j in range(degree+1):\n tx[:,x.shape[1]*j:x.shape[1]*(j+1)] = np.power(x,j)\n \n return tx", "def build_poly(x, degree):\n phi = np.ones(len(x))\n phi = np.vstack((phi, [x**(j+1) for j in rang...
[ "0.7282244", "0.6993958", "0.66993797", "0.6652448", "0.6533176", "0.65030074", "0.6482124", "0.6463599", "0.64258146", "0.63943446", "0.63770676", "0.6372877", "0.6317858", "0.62753487", "0.6219246", "0.61877716", "0.60899425", "0.60714346", "0.6067437", "0.60603696", "0.602...
0.7406272
0
Manage the 999s in the DER_mass_MMC column (to do it we found an interval in which the distribution of (1, 1) is pretty similar as the one of 999, the interval is (60, 80). The masses are going to be uniformely distributed over this interval), substract 125 (Approximate of the mass of the Higgs boson) and compute the a...
def mass_abs(tx) : x = tx.copy() nb999 = np.sum(x[:,0] == -999) uni = np.random.uniform(60, 80, nb999) for i in range(x.shape[1]) : if (x[i, 0] == -999) : x[i, 0] = uni[int(np.random.randint(nb999, size = 1))] x[:,0] = np.abs(x[:,0] - 125) return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale_massmet(mass):\n upper_84 = np.interp(mass, massmet[:, 0], massmet[:, 3])\n lower_16 = np.interp(mass, massmet[:, 0], massmet[:, 2])\n return (upper_84-lower_16)", "def Mass_diff_005(self, rmax):\n rmax = 10**rmax\n mass_enc = self.int_over_density(rmax)\n return np.abs(ma...
[ "0.62112576", "0.5987842", "0.5915239", "0.57330024", "0.57113755", "0.56495", "0.5595405", "0.546798", "0.5456707", "0.5407901", "0.5397664", "0.5354576", "0.5337269", "0.5292073", "0.52603114", "0.5234231", "0.5220511", "0.5217592", "0.52087736", "0.51893", "0.5187847", "...
0.6446909
0
Computes forces for equilibrium.
def _compute_forces(self): # get new coeffs self._get_coeffs() # instead of writing many time awa = self.awa / 180.0 * np.pi # lift and drag self.lift = 0.5 * self.rho * self.aws ** 2 * self.area * self.cl self.drag = 0.5 * self.rho * self.aws ** 2 * self.area *...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_forces(self):\n # get converged calculation\n # create new calculation with l_f =T, gff allow for relaxation of certain\n # atomtyps or species\n # dont copy broyden files, copy cdn1?\n # run fleur\n self.ctx.loop_count2 = self.ctx.loop_count2 + 1\n la...
[ "0.6720713", "0.6611699", "0.6556102", "0.64517087", "0.6272964", "0.6248414", "0.62275743", "0.6218866", "0.61995935", "0.6125085", "0.6073322", "0.5916495", "0.59148777", "0.59105724", "0.5849148", "0.58283186", "0.58266735", "0.5764739", "0.5763695", "0.57629067", "0.57327...
0.66481227
1
generate sailset total lift and drag coefficient.
def _get_coeffs(self): # lift (Clmax) and parasitic drag (Cd0max) self.cl = 0.0 self.cd = 0.0 kpp = 0.0 for sail in self.sails: self.cl += sail.cl(self.awa) * sail.area * sail.bk self.cd += sail.cd(self.awa) * sail.area * sail.bk kpp += sail....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cost(self):\n\t\treturn self.g + self.h", "def get_lift(self):\n return 0.0", "def main(l, k):\n S = 0\n T = product(xrange(2), repeat=k)\n for ts in T:\n tmp = []\n\n for t, c in zip(ts, cs):\n tmp.append(((-1)*c)**t)\n\n S += (sum(tmp)**l)\n val = (s...
[ "0.56124866", "0.5534608", "0.5531715", "0.5531715", "0.55162984", "0.551232", "0.55093086", "0.5502523", "0.54637873", "0.5462315", "0.5420496", "0.5391726", "0.539018", "0.5386778", "0.5361632", "0.53331506", "0.5307801", "0.53052086", "0.5300728", "0.52987695", "0.52978647...
0.6082229
0
Fill sail area variable
def _area(self): self.area = 0.0 for sail in self.sails: self.area += sail.area
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):", "def fillingrid(self):\n\n if self.imagearray is None:\n if self.gs.isfixed:\n for n in range(0, self.numcols):\n self.vspins[n].setValue(self.currentvalues[n])\n elif self.gs.isperc:\n for n in range(0, self.numcols)...
[ "0.65842456", "0.64734346", "0.6444428", "0.6345076", "0.63240373", "0.61849344", "0.6145598", "0.60974485", "0.59381616", "0.59381616", "0.593126", "0.592286", "0.58886546", "0.5878622", "0.5837911", "0.58069104", "0.5780059", "0.574524", "0.5735918", "0.5735614", "0.5735614...
0.68048114
0
Train and evaluate a BERT NER Model
def train_and_evaluate(OUTPUT_DIR,do_train = True,do_eval=True): BATCH_SIZE = 32 LEARNING_RATE = 2e-5 NUM_TRAIN_EPOCHS = 5.0 #in this steps lr will be low and training will be slow WARMUP_PROPORTION = 0.1 if os.path.exists(OUTPUT_DIR) and os.listdir(OUTPUT_DIR) and do_train: raise ValueError("Output dire...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, X, y):\n tf.logging.set_verbosity(\n tf.logging.INFO) # comment if you don't want to display the information during training/evaluation\n\n X_train, X_test, y_train, y_test = train_test_split(\n X, y, test_size=self.params[\"TEST_SIZE\"], random_state=42, strati...
[ "0.6732188", "0.66579294", "0.6617429", "0.6609218", "0.65915716", "0.6566272", "0.6564456", "0.6536589", "0.6532117", "0.6528989", "0.6522149", "0.6457771", "0.64378786", "0.64107096", "0.6403063", "0.63879454", "0.63494843", "0.6348164", "0.6344589", "0.6325119", "0.6324392...
0.7334636
0
Given a url, set or replace a query parameter and return the modified url.
def set_url_query_param(url: str, param_name: str, param_value: str): parsed_url: ParseResult = urlparse(url) query_params: dict = dict(parse_qsl(parsed_url.query)) query_params[param_name] = param_value new_query_string = urlencode(query_params) return urlunparse(( parsed_url.scheme, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _replace_url_query(url, new_query):\n scheme, netloc, path, _, fragment = urlparse.urlsplit(url)\n return urlparse.urlunsplit((scheme, netloc, path, new_query, fragment))", "def replace_query_params(cls, url: str, **params: Mapping[str, str]) -> str:\n url, _ = cls.separate_query_params(url, par...
[ "0.7598249", "0.7557596", "0.7520044", "0.7314738", "0.7273958", "0.691234", "0.67587596", "0.6752881", "0.67470497", "0.67071164", "0.67071164", "0.6613174", "0.658672", "0.6533154", "0.6533154", "0.64942557", "0.64076775", "0.6387804", "0.63828295", "0.6361286", "0.6291151"...
0.80038387
0
For every partition whose idle resources do not meet the requirements add the maximally available idle resources.
def add_max_resources(idle_res, hwinfo): hwinfo_idle = hwinfo.filter_idle() idle_partitions = [r.partition() for r in idle_res] max_resources = resources.get_maximal_resources(hwinfo_idle) for p in np.unique(hwinfo_idle['partition']): if p not in idle_partitions:# and max_resources[p].cpus() > 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calc_worker_assign_limits(self, initial_count, occupied=None):\n occupied = occupied or dict()\n actual_count = initial_count - sum(occupied.values())\n\n endpoint_res = sorted(self._worker_slots.items(), key=operator.itemgetter(1),\n reverse=True)\n\n ...
[ "0.60580754", "0.55720556", "0.5522742", "0.54593384", "0.5274331", "0.5196709", "0.5186926", "0.5179052", "0.51778924", "0.51728237", "0.5168364", "0.5154532", "0.5147112", "0.5139551", "0.510703", "0.50974077", "0.50913036", "0.5090747", "0.5088053", "0.503926", "0.50236523...
0.766325
0
Extract common date features from date
def dataset_extract_features_from_date(dataset,date_feature): dataset['dayofmonth'] = dataset[date_feature].dt.day dataset['dayofyear'] = dataset[date_feature].dt.dayofyear dataset['dayofweek'] = dataset[date_feature].dt.dayofweek dataset['month'] = dataset[date_feature].dt.month dataset['ye...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_date_features(df = None, date = None):\n #TODO", "def get_date_pred():\r\n \r\n date_now = dt.datetime.now()\r\n date_pred = [date_now - dt.timedelta(days=1)+dt.timedelta(days=i) for i in range(8)]\r\n month_pred = [item.month for item in date_pred]\r\n day_pred = [item.day for item ...
[ "0.6753624", "0.61724424", "0.6038192", "0.6005854", "0.598948", "0.5953757", "0.5917281", "0.58833474", "0.5878825", "0.5850257", "0.56891733", "0.5656723", "0.5644662", "0.5643887", "0.5638506", "0.55055416", "0.5479335", "0.5466917", "0.54546124", "0.54105663", "0.5387948"...
0.70033276
0
(str) > int sibling returns the next sibling of node, v.
def sibling(self, v): # method here
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_sibling(node):\n try:\n i = node.get_parent().child_nodes.index(node)\n return node.get_parent().get_children()[i+1]\n except(IndexError, AttributeError):\n return None", "def sibling(self, n):\n parent = self.parent(n)\n if parent is None: ...
[ "0.72265977", "0.69937146", "0.6873892", "0.6821024", "0.68124634", "0.68124634", "0.67741656", "0.6749736", "0.67117226", "0.6628516", "0.6586244", "0.65458", "0.64845926", "0.64164186", "0.6274164", "0.62141037", "0.6191131", "0.61486363", "0.6053174", "0.60463643", "0.6020...
0.7328032
0
Test when user logs in again redis cache entry for that user is cleared
def test_redis_cache_updated(self, mocked_complete): def log_user_again(request, *args, **kwargs): # pylint: disable=unused-argument """mock function to login the user again""" request.user = self.user return HttpResponse() mocked_complete.side_effect = log_user_aga...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testClear(self):\n user = User(u'testuser', 'hash', u'fullname',\n u'email@example.com', Role.USER)\n user.objectID = UUID('04585bec-28cf-4a21-bc3e-081f3ed62680')\n user.id = 1\n self.userCache.save(user)\n self.assertNotEqual({}, json.loads(self.cache.get(...
[ "0.7129745", "0.6567952", "0.6401381", "0.6393035", "0.63523793", "0.6336943", "0.6291996", "0.62612945", "0.6211057", "0.6142848", "0.61335856", "0.6117898", "0.61128783", "0.6107032", "0.60976183", "0.6087185", "0.608674", "0.60846674", "0.607397", "0.6073541", "0.5962341",...
0.6671589
1
Filter detected spots and get coordinates of the remaining spots. In order to make the thresholding robust, it should be applied to a
def spots_thresholding(image, mask_local_max, threshold, remove_duplicate=True): # check parameters stack.check_array(image, ndim=[2, 3], dtype=[np.uint8, np.uint16, np.float32, np.float64]) stack.check_array(mask_local_max, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _detect_spots_from_images(images, threshold=None, remove_duplicate=True,\n return_threshold=False, voxel_size_z=None,\n voxel_size_yx=100, psf_z=None, psf_yx=200):\n # initialization\n sigma = stack.get_sigma(voxel_size_z, voxel_size_yx, psf_z, ps...
[ "0.6502218", "0.6376775", "0.62228143", "0.62143093", "0.61916566", "0.61537147", "0.6047404", "0.60279536", "0.59590685", "0.59526235", "0.59399045", "0.5929654", "0.5877842", "0.5805837", "0.5779849", "0.5760951", "0.5747893", "0.5747553", "0.57224065", "0.57049763", "0.569...
0.64943624
1
Choose the candidate thresholds to test for the spot detection.
def _get_candidate_thresholds(pixel_values): # choose appropriate thresholds candidate start_range = 0 end_range = int(np.percentile(pixel_values, 99.9999)) if end_range < 100: thresholds = np.linspace(start_range, end_range, num=100) else: thresholds = [i for i in range(start_range,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_candidate_thresholds(self, node, vec):\n\n if vec >= self.n_vec:\n msg = \"BUG: try to split on {0} which is after max_n_vec ({1})\"\n raise SplitError(msg.format(vec, self.n_vec))\n\n # the projections on the selected eigen-vector\n evs = self.E[node.ids, vec]\n...
[ "0.61890835", "0.5996674", "0.59721863", "0.5928042", "0.58958036", "0.5890723", "0.5830171", "0.58152485", "0.580196", "0.5703099", "0.56979644", "0.5694947", "0.5664172", "0.56454784", "0.5606317", "0.55890864", "0.5572626", "0.55543137", "0.553795", "0.5525567", "0.5504682...
0.62408847
0
Compute and format the spots count function for different thresholds.
def _get_spot_counts(thresholds, value_spots): # count spots for each threshold count_spots = np.log([np.count_nonzero(value_spots > t) for t in thresholds]) count_spots = stack.centered_moving_average(count_spots, n=5) # the tail of the curve unnecessarily flatten the slop ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_detection_counts(kinds, valid_mask, aoi_mask, scene_counts):\n scene_counts = np.maximum(scene_counts, 1)\n if len(kinds):\n pairs = (kinds == 'pair_trawlers')\n singles = (kinds == 'single_trawler')\n scales = (kinds == 'pair_trawlers') * 2 + (kinds == 'single_trawler')\n ...
[ "0.63846546", "0.5974033", "0.577967", "0.5751799", "0.56716186", "0.56405896", "0.56206876", "0.56012255", "0.5585708", "0.5550997", "0.54943913", "0.5460852", "0.5453262", "0.5421152", "0.5420449", "0.5406624", "0.5376833", "0.5374169", "0.53562254", "0.53440434", "0.529568...
0.69019306
0
Select the xaxis value where a Lcurve has a kink. Assuming a Lcurve from A to B, the 'breaking_point' is the more distant point to the segment [A, B].
def _get_breaking_point(x, y): # select threshold where curve break slope = (y[-1] - y[0]) / len(y) y_grad = np.gradient(y) m = list(y_grad >= slope) j = m.index(False) m = m[j:] x = x[j:] y = y[j:] if True in m: i = m.index(True) else: i = -1 breaking_point =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_k(x, k, linewidth = 1.5, \n marker = 'o', color = 'k', marker_facecolor = 'k'):\n\n # Plot the first variable\n x1 = x[0]\n plt.figure(figsize = (9,5))\n plt.plot(x1, k, c = color, lw = linewidth, marker = marker, \n mec = color, mfc = marker_facec...
[ "0.5472993", "0.53096104", "0.5299262", "0.5272989", "0.5262331", "0.5251701", "0.52380073", "0.5229801", "0.5160584", "0.51584435", "0.50303984", "0.50249135", "0.5024208", "0.499612", "0.4986702", "0.49020177", "0.48961875", "0.4894596", "0.4867856", "0.48623985", "0.484006...
0.61048186
0
Basic function to make email messages RFC2822 2.1.1 Compliant (Line Length Limit) Split the message at {max_line_length} (default 900)
def email_rfc2822_compliance(message, max_line_length=900): returnmsg = "" while len(message) > 0: returnmsg = returnmsg + message[:max_line_length] + "\r\n" message = message[max_line_length:] return returnmsg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_message(message, max_length):\n ms = []\n while len(message) > max_length:\n ms.append(message[:max_length])\n message = message[max_length:]\n ms.append(message)\n return ms", "def split_message(text, max_length=640):\n res = []\n sub_message = ''\n sentences = split...
[ "0.6790232", "0.6611094", "0.6376905", "0.61982185", "0.6119895", "0.5845836", "0.5761279", "0.5732705", "0.56816584", "0.5646598", "0.55363816", "0.55151194", "0.5499898", "0.5486851", "0.54598796", "0.5451781", "0.54024404", "0.5397445", "0.5381521", "0.536209", "0.53542113...
0.7511238
0
Validates multiple predictions at a time for a specified date range. predictions = list of dataframes with predictions (submissions) test_source = original data to compare with start = starting date in format "%Y%m%d" end = ending date in format "%Y%m%d" summary_df = regions summary information dataframe key = column w...
def get_validation_results( predictions, test_source, start, end, summary_df, key="region", name_col="csse_province_state", custom_ids=None, ): fixed_predictions = [] for prediction_df in predictions: preds = prediction_df.copy() preds["geoname_code"] = preds[key]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, orig_target_df):\n\n # For each fold\n for fold_idx, (fold_training_set_df, fold_testing_set_df, fold_target_df, fold_truth_df) in enumerate(self._generate_validation_fold()):\n train_test_date_split = fold_training_set_df[\"date\"].max()\n eval_start_date = train_...
[ "0.6189123", "0.5795984", "0.5755057", "0.56774807", "0.5629217", "0.55658317", "0.553849", "0.55241734", "0.54923284", "0.5492266", "0.5489832", "0.5391152", "0.53785956", "0.5373168", "0.536862", "0.53663355", "0.53045744", "0.5297892", "0.5294176", "0.5293914", "0.5279209"...
0.74037975
0
Register a recipient in the DMPlatform
def register_recipient(self, id, gender, need_score, age_range, ethnicity, home_loc): r = Recipient(id) r.set_gender(gender) r.set_need_score(need_score) r.set_age_range(age_range) r.set_ethnicity(ethnicity) r.set_home_location(home_loc) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_recipient(self, recipient):\n\n self.recipients.append(recipient)", "def recipient(self, recipient):\n\n self._recipient = recipient", "def manage_addMailSender( self, id='MailHost', title='', host=None, port=None, REQUEST=None ):\n self._setObject( id, MailSender( id, title, host, por...
[ "0.61973524", "0.59831744", "0.5846386", "0.5775348", "0.57607996", "0.5657584", "0.56348884", "0.5614726", "0.5613135", "0.54141515", "0.53985727", "0.53896177", "0.5369155", "0.53325903", "0.5322393", "0.53180146", "0.53143936", "0.52928996", "0.5290928", "0.52667665", "0.5...
0.61426806
1
Registers a restaurant in the DMPlatform
def register_restaurant(self, id, location, meals_list): r = Restaurant(id) r.set_location(location) r.set_meals_offered_list(meals_list) self._restaurants_list.append(r)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(self):\n self.logger.info(\"Registering agent %s\", \"/registry/\" + self._configuration[\"identification\"][\"uuid\"])\n self._coordination.update(\"/registry/\" + self._configuration[\"identification\"][\"uuid\"], self._configuration[\"identification\"])", "def post(self):\n r...
[ "0.62473947", "0.6196962", "0.61499894", "0.59200966", "0.5669677", "0.56151634", "0.5595705", "0.5543274", "0.5539966", "0.5462055", "0.5462055", "0.5450199", "0.54481614", "0.54412204", "0.54329973", "0.5423446", "0.5412657", "0.54084283", "0.53993064", "0.5379552", "0.5378...
0.72535706
0
Parses the .ac lines and modifies the frequency of each voltage source and set impedances of passive elements
def ac_parse(obj_list, ac_lines): freq_set = set() for obj in obj_list: if obj.form == 'dc': freq_set.add(0) for line in ac_lines: tokens = line.split() if len(tokens) != 3: print("ERR: Invalid .ac command:", line) return None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_afos(self):\n # at most, only look at the top four lines\n data = \"\\n\".join([line.strip()\n for line in self.sections[0].split(\"\\n\")[:4]])\n tokens = re.findall(\"^([A-Z0-9 ]{4,6})$\", data, re.M)\n if tokens:\n self.afos = tokens[0]", ...
[ "0.5577595", "0.5564011", "0.54784346", "0.5393736", "0.5388402", "0.534639", "0.5306698", "0.5298406", "0.52770185", "0.5204404", "0.5174855", "0.51437944", "0.50771433", "0.5069645", "0.5057304", "0.5054266", "0.5053029", "0.5044348", "0.5043592", "0.5039836", "0.5017756", ...
0.7144079
0
Takes path to netlist file and converts to data usable for circuit solving
def netlist_to_data(path): # Open file try: f = open(path, 'r') except FileNotFoundError: print("ERR: File not found:", path) return None # Read file lines = f.readlines() f.close() # Remove comment portion, and extra leading and trailing space of each line lin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_file(path, name=None, seq_types=None):\n ext = path.split(\".\")[-1]\n if name is None:\n name = path.split(\"/\")[-1].replace(f\".{ext}\", \"\")\n with open(path, \"r\") as f:\n netlist = f.read()\n if ext == \"v\":\n return verilog_to_circuit(netlist, name, seq_types)\n ...
[ "0.6311136", "0.60333127", "0.5969786", "0.59286124", "0.588238", "0.5635766", "0.56275123", "0.557719", "0.55747956", "0.5564225", "0.55455184", "0.5541207", "0.5479334", "0.54560566", "0.54214746", "0.5388568", "0.53870106", "0.53783447", "0.5365531", "0.5320062", "0.531274...
0.74806345
0
Takes list of Element objects and returns them as dictionary of elements grouped by type
def separate_types(obj_list): obj_dict = { 'R':[], 'L':[], 'C':[], 'V':[], 'I':[], 'E':[], 'G':[], 'H':[], 'F':[] } for obj in obj_list: obj_dict[obj.el_type].append(obj) return obj_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_elements_by_property_type_and_element_type(elements, pid_data):\n # find unique groups\n #print(\"pid_data = \\n%s\\n\" % str(pid_data))\n pid_elementnum = unique2d(pid_data[:, 1:])\n\n data2 = {}\n etype_map = {\n 1 : 'CROD', 5: 'CONROD',\n 2 : 'CBEAM', 3 : 'CBAR',\n ...
[ "0.6465859", "0.6432415", "0.6038449", "0.5934554", "0.579664", "0.5792297", "0.5668392", "0.55965745", "0.5593538", "0.5515256", "0.5470534", "0.5427659", "0.5405782", "0.53900087", "0.5383047", "0.5328841", "0.52936536", "0.5274927", "0.5270392", "0.526419", "0.52565235", ...
0.6921661
0
Takes dictionary of objects by type and the node mapping, returns Numpy arrays representing equations governing the circuit.
def get_equation_matrix(obj_dict, node_dict): v_src_count = len(obj_dict['V']) v_src_map = {} for ind in range(len(obj_dict['V'])): v_src_map[obj_dict['V'][ind].name] = ind node_count = len(node_dict.keys())-1 # excluded GND A = np.zeros((node_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodedict2xarraydict(nodedict):\n return {name:getXarray(node) for name,node in nodedict.items()}", "def get_data(nodes=[]):\n\n # get nodes\n if not nodes:\n nodes = mc.ls(sl=1)\n\n # decipher if the nodes are constraints themselves or are driven by constraints\n nodes = mc.ls(nodes)\n ...
[ "0.57185227", "0.56100166", "0.54828674", "0.51971954", "0.5119138", "0.51168716", "0.5112834", "0.509553", "0.50917715", "0.5088738", "0.50783044", "0.49970037", "0.4962442", "0.49544486", "0.4950212", "0.49017525", "0.4892764", "0.48732916", "0.4864263", "0.4856209", "0.485...
0.68733394
0
Takes solution vector and variable names in the form of node voltages and voltage source currents, and prints them in userfriendly fashion
def display_sol(sol, node_list, v_src_list): print("\n") node_list = node_list[1:] for i in range(len(node_list)): print("V_" + node_list[i] + ": ", ffs(np.real(sol[i]), precision=5), '+', ffs(np.imag(sol[i]), precision=5)+'j') for i in range(len(v_src_list)): v = v_src_list[i] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printSolution(self):\n print \"----- Solution -----\"\n for feature in self.features:\n print \"Name = \" + feature.name + \" Value = \" + str(feature.value)", "def print_solution():\n pass", "def print_solution(self):\n print(f'Objective: {self.solution.ObjectiveValue()}')\n...
[ "0.70311254", "0.6513373", "0.63381404", "0.6321742", "0.62229276", "0.62111807", "0.6145689", "0.595207", "0.59471786", "0.5912587", "0.5911108", "0.58804804", "0.58691436", "0.5866293", "0.57992846", "0.57930803", "0.57446843", "0.5736822", "0.5732533", "0.57235485", "0.571...
0.6904997
1
If var is None, it means an error has happened (and been reported by earlier prints), so exit execution with code 1
def EXIT_ON_NONE(var): try: if not var.any(): pass except: if var == None: sys.exit(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exit_error(message: Optional[str] = None) -> NoReturn:\n\n\tif (message != None):\n\t\tprint(message)\n\tsys.exit(EXIT_FAILURE)", "def error(message, code=None):\n print_error(message)\n sys.exit(code or 1)", "def finalize_error():\n print('')\n exit(-1)", "def check_error(err):\n if err !...
[ "0.6083959", "0.6044611", "0.60042363", "0.60028774", "0.59937257", "0.5983206", "0.5926563", "0.59169286", "0.5879745", "0.5866192", "0.58173686", "0.5799356", "0.57898295", "0.57889676", "0.57837886", "0.5783207", "0.5754361", "0.57477415", "0.57348764", "0.5712263", "0.571...
0.68557256
0
Unable to continue because the server could not fulfill the request. Most of the time is due to a third party request.
def not_implemented(self): response.status = 501 return {'message':'server was not able to complete this request'}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _raise_performing_request_error(self, *args, **kwargs):", "def _retry_occurred(self):", "def _raise_http_error(self, *args, **kwargs):", "def _raise_if_inprogress_or_timeout(self):\n if self._stack_result is None or self._recm_data is None:\n # If the response is not ready and the timeo...
[ "0.7025658", "0.60970294", "0.5991379", "0.59823847", "0.5957003", "0.58494574", "0.58302826", "0.58297503", "0.58086425", "0.57881504", "0.5785328", "0.5778837", "0.5773076", "0.576584", "0.57561743", "0.57517314", "0.57288325", "0.57262796", "0.5704582", "0.56889284", "0.56...
0.65417635
1
Get embedded EXIF data from image file.
def get_exif_data(fname): ret = {} try: img = Image.open(StringIO.StringIO(fname)) if hasattr( img, '_getexif' ): exifinfo = img._getexif() if exifinfo != None: for tag, value in exifinfo.items(): decoded = TAGS.get(tag, tag) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_exif_data(self):\n self.exif_data = piexif.load(self.img_path)\n return self.exif_data", "def get_exif_data(fname):\n ret = {}\n try:\n img = Image.open(fname)\n if hasattr( img, '_getexif' ):\n exifinfo = img._getexif()\n if exifinfo != None:\n ...
[ "0.7258743", "0.7192131", "0.7121678", "0.705259", "0.69628465", "0.6757472", "0.67125493", "0.6626685", "0.6603185", "0.6571405", "0.65506035", "0.6476884", "0.64304584", "0.6219957", "0.61542845", "0.60704327", "0.5961148", "0.5961018", "0.57735795", "0.57373935", "0.570169...
0.7227778
1
Sets the Tile as a mine self.count attribute is changed to 9, index of the mine image in Tile.images marks self.mine boolean attribute to be true
def setMine(self): self.count = 13 self.mine = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enumerate_tiles(self):\n # Iterates through entire game board.\n for row in range(self.rows):\n for col in range(self.cols):\n\n # Doesn't count mines adjacent to mine tiles.\n if self.board[row][col].category == Tiles.mine:\n continue\n...
[ "0.67524004", "0.6709142", "0.66603965", "0.6585605", "0.64893264", "0.64514196", "0.63818496", "0.63528097", "0.63202614", "0.62961346", "0.62728107", "0.62516195", "0.62442756", "0.6236275", "0.62213844", "0.62194306", "0.6208039", "0.61843634", "0.6172285", "0.61482275", "...
0.7026651
0
Changes the image to pressed button, Tile.images[0] Only works for Tiles that are in play (self.inPlay == True)
def buttonPress(self): if self.inPlay and not self.shown: self.configure(image = Tile.images[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_imgs(self):\n\n for b in self.gamebuttons:\n b.update_img()\n self.start_but.update_img()", "def boutton_press(self,a,img):\r\n x,y=self.can.coords(self.button[a])\r\n self.can.delete(self.button[a])\r\n self.button[a]=self.creat_image(img,x,y)", "def ch...
[ "0.6658446", "0.65949404", "0.6556653", "0.6481363", "0.64126843", "0.6371399", "0.6321544", "0.63166", "0.61455536", "0.60779876", "0.60149246", "0.5937855", "0.593545", "0.59137666", "0.5902924", "0.5878515", "0.58688813", "0.5859732", "0.5858953", "0.58473176", "0.5811791"...
0.78256506
0
Toggles the flag on the tile if it is still unknown and in play self.flag boolean attribute is toggled Returns 1 if flag is toggled on and 1 if flag is toggled off Returns 0 if flag was not toggled
def setFlag(self): if self.inPlay and not self.shown: self.flag = not(self.flag) image_index = 11 if self.flag else 10 self.configure(image = Tile.images[image_index]) return 1 if self.flag else -1 return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggleFlag(self, event): \n clicked = event.widget\n if clicked.isInPlay(): self.changeSmile(1)\n value = clicked.setFlag()\n for adjTile in self.getAdjacentTiles(clicked.row, clicked.col):\n adjTile.numFlags += value\n ...
[ "0.7438908", "0.676971", "0.62580466", "0.6238106", "0.6185206", "0.6137376", "0.60840374", "0.6058401", "0.6057641", "0.5971555", "0.59167653", "0.5901829", "0.58407146", "0.58136433", "0.5802496", "0.5797119", "0.57912606", "0.57860863", "0.56620306", "0.5659031", "0.561729...
0.7420534
1
A function used to set self.count used by Board
def setCount(self, num): self.count=num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_count(self):\n pass # Do nothing", "def update_count(self):\n pass", "def __call__(self, *args):\n self.count = self.count + 1", "def _update_count(self):\n self._count = len(self._items)", "def add_count(self):\n self.count += 1", "def set_count(c):\n gl...
[ "0.71770173", "0.71657187", "0.69234514", "0.6896584", "0.6862326", "0.68291837", "0.67461693", "0.67281395", "0.6694756", "0.66242033", "0.6550625", "0.6524782", "0.65234715", "0.6470743", "0.64682573", "0.64680815", "0.64680815", "0.64680815", "0.64680815", "0.6439154", "0....
0.7432971
0
Removes the self.button myLabel() that has been hiding the value/mine Has no effect on Tiles that are already being shown Calls self.showAround() to cascade if self.count == 0 Returns 1 if one or more of the revealed Tiles is a Mine. Returns the number of Tiles revealed by it as an Integer.
def show(self): if not self.shown and not self.flag: self.shown = True self.configure(image=Tile.images[self.count]) return -1 if self.mine else 1 return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showAdjTiles(self,event):\n clicked = event.widget\n if clicked.isInPlay():\n self.changeSmile(1)\n #if tile is Safe, reveal adjacent tiles and cascade if needed\n if clicked.isSafe():\n returned = 0\n for adjTile in self.getA...
[ "0.5823116", "0.58139676", "0.5568885", "0.54501146", "0.54450107", "0.5411542", "0.53524137", "0.5317927", "0.5260474", "0.5220331", "0.51799744", "0.5176658", "0.5174279", "0.5155872", "0.5153838", "0.5134267", "0.5128716", "0.5122763", "0.5103027", "0.5050029", "0.503795",...
0.63438165
0
returns self.shown which is True if the Tile is revealed
def isShown(self): return self.shown
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsShown(self):\r\n\r\n return self._shown", "def showTile(self, event):\n clicked = event.widget\n if clicked.isInPlay():\n self.changeSmile(1)\n returned = clicked.show()\n if returned == 1 and clicked.isZero():\n returned += self.cascadeS...
[ "0.739741", "0.7251842", "0.7121201", "0.68841034", "0.6844302", "0.68267983", "0.66852266", "0.6665799", "0.6665799", "0.65777355", "0.6567036", "0.6543213", "0.65341944", "0.65341944", "0.6508172", "0.65051925", "0.64582306", "0.6448889", "0.64341176", "0.64185053", "0.6388...
0.75655967
0
returns self.mine which is True if the Tile is a mine
def isMine(self): return self.mine
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_won(self):\n for tile in self:\n if not tile.is_mine and tile.visibility != 1:\n return False\n return True", "def is_mine(self) -> bool:\n return self.proto.alliance == ALLIANCE.Self.value", "def is_mine(self, coords):\n try:\n if coords[...
[ "0.7636543", "0.7621583", "0.73764515", "0.7335211", "0.7304841", "0.7171517", "0.6615718", "0.64297485", "0.6389095", "0.6372669", "0.62786186", "0.6278285", "0.6270997", "0.6176634", "0.6149281", "0.61392736", "0.61352473", "0.6128118", "0.6124146", "0.6122007", "0.61073", ...
0.824674
0
returns self.inPlay which is True when the game is being played
def isInPlay(self): return self.inPlay
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isPlaying(self) :\n raise NotImplementedError(\"isPlaying not implemented\")", "def playing(self): # type: () -> bool\n return xbmc.getCondVisibility(\"Player.Playing\")", "def game_play(self):", "def is_game_started(self):\r\n\t\treturn self._is_game_started", "def is_playing(self):\n ...
[ "0.75845695", "0.75283724", "0.7370583", "0.728609", "0.72555286", "0.7232817", "0.71996415", "0.71901125", "0.7180946", "0.7111877", "0.70412475", "0.70058084", "0.7004731", "0.69960487", "0.69873065", "0.6971001", "0.69605577", "0.6921104", "0.69201666", "0.6918572", "0.690...
0.8621334
0
clears self.frame and destroys it so it can be rebuilt
def clearFrame(self, event=None): for widget in self.winfo_children(): widget.destroy() del self.tiles[:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_frame(self):\n if self.frame is not None:\n self.frame.destroy()\n\n self.frame = Frame(self.root,\n width=self._width,\n height=self._height,\n bg=Game.BACKGROUND_COLOUR)\n self.frame.pack()", ...
[ "0.7760308", "0.7735232", "0.76537466", "0.7313428", "0.7302228", "0.7171346", "0.7010329", "0.700973", "0.69976103", "0.6972827", "0.69609433", "0.6927987", "0.6858457", "0.68578225", "0.6823086", "0.68147045", "0.67939603", "0.6778618", "0.6772166", "0.6730643", "0.6709295"...
0.7825959
0
sets up the Frame and Labels to be used
def setUpFrame(self): #adds labels to the Board self.mineLabel = tk.Label(self, text="Mines: "+str(self.numMines)) self.mineLabel.grid(row=0, column=0, sticky="W", columnspan=int((self.cols-2)/2)) self.smileButton = tk.Label(self, image=self.images[1]) self.smileButton.grid(row=0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Define_Frame(self):\n self.frame=Frame(self.master, relief=GROOVE, bd=4)\n self.frame.grid(row=0,column=1,rowspan=2,columnspan=2)\n frame_title = Label(self.frame,text=\"Stage Control\",relief=RAISED,bd=2,width=24, bg=\"light yellow\",font=(\"Times\", 16))\n frame_title.grid(row=0, ...
[ "0.7544622", "0.75399923", "0.7160371", "0.700181", "0.6993383", "0.6987549", "0.693042", "0.68723804", "0.68431395", "0.6841213", "0.68293494", "0.6811473", "0.67933005", "0.67782164", "0.6755658", "0.67353123", "0.67290145", "0.66983646", "0.66882557", "0.66620207", "0.6655...
0.76427805
0
Adds all the needed tiles on the Board
def addTiles(self, rows, cols, minecount): for row in range(rows): self.tiles.append([]) for col in range(cols): tile = Tile(self, row, col) tile.grid(row=row+1, column=col) self.tiles[row].append(tile) #left click listeners...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_tiles(self):\n\n # grid format :\n # grid(x,y,z)[0]: A valid WorldTile type (i.e. WorldTile.door)\n # grid(x,y,z)[1]: A list of ASCII color or format codes for ColorIze\n # grid(x,y,z)[2]: The tile object\n\n self.t_count = 0 # Tile count, increment for each tile ...
[ "0.7357654", "0.6758766", "0.6640157", "0.6556963", "0.64719063", "0.64707685", "0.64605796", "0.64567256", "0.6433377", "0.64320713", "0.6412151", "0.63864046", "0.63160187", "0.6314387", "0.6299924", "0.6276776", "0.6269016", "0.62673545", "0.6259894", "0.6252422", "0.62348...
0.73305285
1
Changes smileButton image to self.images[num]
def changeSmile(self, num, event=None): self.smileButton.configure(image=self.images[num])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_image(self):\n image_lst = [\"images/hangman01.png\",\n \"images/hangman02.png\",\n \"images/hangman03.png\",\n \"images/hangman04.png\",\n \"images/hangman05.png\",\n \"images/hangman06.png\",\n ...
[ "0.7132109", "0.6939925", "0.649007", "0.62246907", "0.6144239", "0.6120769", "0.60779893", "0.60716736", "0.60617447", "0.6057991", "0.6031894", "0.6001782", "0.59618104", "0.5947578", "0.59292924", "0.57726", "0.5738294", "0.5729699", "0.5716061", "0.5704813", "0.57009625",...
0.8161651
0
Returns a list of Tiles adjacent to self.tiles[row][col]
def getAdjacentTiles(self, row, col): adjacency = [] if row-1 >= 0: if col-1 >= 0: adjacency.append(self.tiles[row-1][col-1]) if col+1 < self.cols: adjacency.append(self.tiles[row-1][col+1]) adjacency.append(self.tiles[row-1][col]) if col-1 >= 0: adjacency.app...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjacent_tiles(self,tile,pattern):\n\n # Initialize the list of tiles to return\n adj_tiles = []\n\n # Find the row and column of the input tile\n for i in self.tilelist:\n for j in i:\n if j == tile:\n row = self.tilelist.index(i)\n ...
[ "0.72973114", "0.71875554", "0.7148474", "0.71376336", "0.705874", "0.6981794", "0.69214076", "0.68788856", "0.68238246", "0.68225366", "0.67235833", "0.6686271", "0.6669075", "0.6657436", "0.6635436", "0.6622865", "0.65752494", "0.6510529", "0.6490984", "0.6426009", "0.64188...
0.80199665
0
Changes the image on the clicked Tile accordingly i.e. if Tile not isFlagged() Changes the Smiley button's image so it animates on clicks also calls setUpBombs() if this is the first left click of the game
def pressTile(self, event): clickedTile = event.widget if clickedTile.isInPlay(): self.changeSmile(2) if not clickedTile.isFlagged(): clickedTile.buttonPress() if not self.minesArmed and event.num == 1: self.setUpBombs(event)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buttonPress(self):\n if self.inPlay and not self.shown:\n self.configure(image = Tile.images[0])", "def update_image(self):\n if self.updated_sprite_list:\n self.image = self.increment_sprite_index(True)\n self.updated_sprite_list = False\n self.updat...
[ "0.66302764", "0.62137914", "0.62118137", "0.62015975", "0.61229986", "0.6108913", "0.6084819", "0.60612625", "0.60522854", "0.60503805", "0.6035717", "0.6031627", "0.60065144", "0.6004971", "0.5978538", "0.5958254", "0.5944373", "0.5938037", "0.59312075", "0.5902276", "0.588...
0.72606826
0
Calls setFlag() on the Tile that was right clicked Updates the self.numFlags counter accordingly and updates label on the board Reverts Smiley button's image to default smile to animate on clicks
def toggleFlag(self, event): clicked = event.widget if clicked.isInPlay(): self.changeSmile(1) value = clicked.setFlag() for adjTile in self.getAdjacentTiles(clicked.row, clicked.col): adjTile.numFlags += value self.n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pressTile(self, event):\n clickedTile = event.widget\n if clickedTile.isInPlay(): self.changeSmile(2)\n if not clickedTile.isFlagged():\n clickedTile.buttonPress()\n if not self.minesArmed and event.num == 1:\n self.setUpBombs(event)", "def flag(self,...
[ "0.6642763", "0.6635976", "0.6471024", "0.6449346", "0.64119965", "0.63664156", "0.6306046", "0.62559724", "0.6244577", "0.62244415", "0.61597365", "0.61555517", "0.6153825", "0.6059769", "0.6005872", "0.589099", "0.58645517", "0.58640367", "0.58401346", "0.5822118", "0.58197...
0.7922562
0
Changes the image on the adjacent Tiles to be clicked only if the adjacent Tile is not flagged. Changes Smiley button's image to animate on clicks
def pressAdjTiles(self, event): clickedTile = event.widget if clickedTile.isInPlay(): self.changeSmile(2) for adjTile in self.getAdjacentTiles(clickedTile.row, clickedTile.col): if not adjTile.isFlagged(): adjTile.buttonPress()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showAdjTiles(self,event):\n clicked = event.widget\n if clicked.isInPlay():\n self.changeSmile(1)\n #if tile is Safe, reveal adjacent tiles and cascade if needed\n if clicked.isSafe():\n returned = 0\n for adjTile in self.getA...
[ "0.71017325", "0.648041", "0.64698595", "0.62327427", "0.6209187", "0.6125583", "0.60775197", "0.597811", "0.5892851", "0.5829729", "0.5796278", "0.57661337", "0.57153255", "0.5674777", "0.566453", "0.5633023", "0.56284046", "0.5595467", "0.5584798", "0.5573565", "0.55453783"...
0.7350363
0
calls show() on every tile adjacent to the given tile continues cascade if shown tile is zero returns the total number of tiles newly revealed
def cascadeShow(self, tile): value = 0 for adjTile in self.getAdjacentTiles(tile.row, tile.col): returned = adjTile.show() value += returned if returned == 1 and adjTile.isZero(): value += self.cascadeShow(adjTile) return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showAdjTiles(self,event):\n clicked = event.widget\n if clicked.isInPlay():\n self.changeSmile(1)\n #if tile is Safe, reveal adjacent tiles and cascade if needed\n if clicked.isSafe():\n returned = 0\n for adjTile in self.getA...
[ "0.714055", "0.7036135", "0.6740042", "0.5885403", "0.576607", "0.57298493", "0.5698092", "0.56953084", "0.56464475", "0.5641887", "0.56332046", "0.5593228", "0.55830514", "0.55693036", "0.5568158", "0.5554808", "0.5553236", "0.55482566", "0.5500011", "0.54978377", "0.5483443...
0.70521516
1
Calls show() on clicked Tile if applicable Reverts Smiley button's image to default smile to animate on clicks
def showTile(self, event): clicked = event.widget if clicked.isInPlay(): self.changeSmile(1) returned = clicked.show() if returned == 1 and clicked.isZero(): returned += self.cascadeShow(clicked) self.checkEnd(returned)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showAdjTiles(self,event):\n clicked = event.widget\n if clicked.isInPlay():\n self.changeSmile(1)\n #if tile is Safe, reveal adjacent tiles and cascade if needed\n if clicked.isSafe():\n returned = 0\n for adjTile in self.getA...
[ "0.70960873", "0.702084", "0.6491204", "0.64384776", "0.6199169", "0.5966352", "0.5956875", "0.5948234", "0.59471923", "0.59469694", "0.5903998", "0.5832787", "0.57578105", "0.5723929", "0.5723466", "0.5685981", "0.5650508", "0.5596597", "0.55943763", "0.55925274", "0.552771"...
0.7800496
0
calls showAround() on clicked Tile if applicable
def showAdjTiles(self,event): clicked = event.widget if clicked.isInPlay(): self.changeSmile(1) #if tile is Safe, reveal adjacent tiles and cascade if needed if clicked.isSafe(): returned = 0 for adjTile in self.getAdjacentTiles...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showTile(self, event):\n clicked = event.widget\n if clicked.isInPlay():\n self.changeSmile(1)\n returned = clicked.show()\n if returned == 1 and clicked.isZero():\n returned += self.cascadeShow(clicked)\n self.checkEnd(returned)", "def...
[ "0.74901944", "0.63370013", "0.6282459", "0.60075176", "0.5984413", "0.58725184", "0.5865513", "0.5808913", "0.57776076", "0.57593286", "0.57503843", "0.57025725", "0.5689865", "0.5677591", "0.5671587", "0.56301147", "0.5627339", "0.5608963", "0.5573536", "0.55536336", "0.553...
0.67923003
1
If win == True, flags the unflagged mines otherwise it reveals the unrevealed mines and marks the incorrect flags
def revealBombs(self, win): for row in self.tiles: for tile in row: tile.inPlay = False if tile.isMine(): if win: #flag non-flagged mines after winning if not tile.isFlagged(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_revealed(self, i, j):\n if not self.revealed[i, j]:\n # If not revealed cell\n if self.mines_count[i, j] < 0:\n # If wrong guess, games is over\n self.wrong = ~self.mines & self.flags\n self.wrong[i, j] = True\n sel...
[ "0.6455586", "0.6382103", "0.6161107", "0.6144557", "0.6141855", "0.6128536", "0.59943545", "0.59508157", "0.59508157", "0.59508157", "0.59508157", "0.59508157", "0.59508157", "0.59415877", "0.5753732", "0.57524306", "0.5717041", "0.5663946", "0.5627639", "0.5537732", "0.5537...
0.70450246
0
Calculates game duration based on self.startTime and time.time() calls revealBomb() to reveal/flag remaining bombs prints the given message and elapsed time in a readable format in a pop up messagebox
def endGame(self, msg, win): elapsedTime = time.time() - self.startTime readableTime = str(int((elapsedTime / 60) / 60)) readableTime += ":" + str(int(elapsedTime / 60)) readableTime += ":" + str(elapsedTime % 60)[0:6] msg +="Time: " + readableTime self.revealBombs(win) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_time(self, time):\n pygame.draw.rect(self.screen, self.font_fgcolor, self.time_rect)\n self.screen.blit(self.small_font.render(\"Elapsed time: %.0f s\" % time, -1, (0, 0, 0)), (5, 720))\n pygame.display.update(self.time_rect)\n return", "def timer_update(self):\n if...
[ "0.63711405", "0.62700844", "0.62045985", "0.6160741", "0.6118818", "0.606114", "0.600875", "0.59369403", "0.5876301", "0.5856027", "0.5779341", "0.5773944", "0.5736033", "0.5725558", "0.5696176", "0.56574124", "0.56115764", "0.56063986", "0.55996895", "0.5567945", "0.5563839...
0.66032505
0
unchecks menu custom game checkbox appropriately and resizes self.myBoard
def resize(self, rows, cols, mines): if self.menuVar.get() != 4: self.checkVar.set(0) self.myBoard.resize(rows, cols, mines)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, rows, cols, mines):\n tk.Tk.__init__(self)\n \n #load all needed images into Tile.images\n for i in range(14):\n Tile.images.append(tk.PhotoImage(file = \"images/tile-\"+str(i)+\".gif\"))\n \n self.menu = tk.Menu(self)\n self.configure(...
[ "0.67420113", "0.5735204", "0.56506914", "0.55636704", "0.55593777", "0.5487704", "0.54679674", "0.542365", "0.5423146", "0.5422084", "0.5379945", "0.53320664", "0.5271477", "0.52714485", "0.52524525", "0.5247694", "0.52458036", "0.5245706", "0.5222096", "0.51987946", "0.5181...
0.67196774
1
Handles the custom game options window button click. Resizes the board according to specifications. If Custom game was chosen but specifications are invalid, a popup message notifies the user without closing the options window
def optionSet(self): choice = self.optionVar.get() #if custom game is chosen if choice == 4: msg = "Invalid Input!" valid = True nums = [] #make sure all inputs are integers for i in range(3): try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def options(self):\n self.checkVar.set(self.menuVar.get())\n #create window then set window size & title\n self.optionsWindow = tk.Toplevel(self)\n self.optionsWindow.grab_set()\n self.optionsWindow.title(\"Options\")\n windowWidth = \"225\"\n windowHeight = \"175\"...
[ "0.6645034", "0.6050015", "0.59368014", "0.58010167", "0.57743067", "0.571248", "0.5672358", "0.56640756", "0.5635978", "0.5627065", "0.5618419", "0.56161207", "0.55233985", "0.5507695", "0.54934543", "0.54858404", "0.54275507", "0.5421459", "0.54163617", "0.5387098", "0.5378...
0.7077302
0