query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Given a list of reference genome names returns the best according to the
def choose_best_assembly_name(assembly_names): assembly_names = set(assembly_names) if len(assembly_names) == 1: return list(assembly_names)[0] assembly_names_ucsc = { name for name in assembly_names if is_ucsc_reference_name(name)} assembly_names_ensembl = assembly_names.difference(as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_match(self, list):\n raise NotImplementedError", "def best(score, names):\n top_score_name = \"\"\n for name in names:\n if score(top_score_name) < score(name):\n top_score_name = name\n\n return top_score_name + \" has the longest name.\"", "def find_best_candida...
[ "0.6477794", "0.63218313", "0.60948557", "0.60762525", "0.5899916", "0.5894953", "0.5872837", "0.5856848", "0.5763685", "0.5707531", "0.5655844", "0.5644592", "0.561053", "0.5608763", "0.5585851", "0.5583666", "0.5568447", "0.55484927", "0.5491456", "0.54838514", "0.5476156",...
0.63775575
1
First infer a canonical Ensembl or UCSC reference name (e.g. hg19 or GRCh37) and if it's a UCSC genome then map it to the equivalent in Ensembl.
def infer_genome_for_reference_name(reference_name): converted_ucsc_to_ensembl = False reference_name = infer_reference_name(reference_name) if is_ucsc_reference_name(reference_name): if reference_name not in ucsc_to_ensembl_reference_names: raise ValueError( "Unrecognize...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infer_genome(genome_object_string_or_int):\n converted_ucsc_to_ensembl = False\n if isinstance(genome_object_string_or_int, Genome):\n genome = genome_object_string_or_int\n elif is_integer(genome_object_string_or_int):\n genome = cached_ensembl_release(genome_object_string_or_int)\n ...
[ "0.5884876", "0.5743903", "0.539047", "0.52179694", "0.517914", "0.5144969", "0.51363647", "0.50561935", "0.50515586", "0.50493926", "0.49660003", "0.4945003", "0.49441254", "0.49250114", "0.49206647", "0.48964727", "0.4891561", "0.48705563", "0.48544684", "0.48525798", "0.48...
0.6860531
0
If given an integer, get the human EnsemblRelease object for that Ensembl version. If given a string, return latest EnsemblRelease which has an equivalent reference. If the given name is a UCSC genome (e.g. hg19) then convert it to the equivalent Ensembl reference (e.g. GRCh37). If given a PyEnsembl Genome, simply use ...
def infer_genome(genome_object_string_or_int): converted_ucsc_to_ensembl = False if isinstance(genome_object_string_or_int, Genome): genome = genome_object_string_or_int elif is_integer(genome_object_string_or_int): genome = cached_ensembl_release(genome_object_string_or_int) elif is_st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infer_genome_for_reference_name(reference_name):\n converted_ucsc_to_ensembl = False\n reference_name = infer_reference_name(reference_name)\n if is_ucsc_reference_name(reference_name):\n if reference_name not in ucsc_to_ensembl_reference_names:\n raise ValueError(\n \...
[ "0.6439983", "0.5448234", "0.52595913", "0.48241457", "0.48233008", "0.47625998", "0.47586852", "0.473882", "0.47120637", "0.4677732", "0.467509", "0.4669614", "0.46572727", "0.4632468", "0.4614374", "0.4588308", "0.4553197", "0.4529159", "0.4483664", "0.44710606", "0.4470605...
0.58101034
1
Combine & minify all .css files in supplied dir
def combine_css(directory): composed = fu.lcompose([ partial(get_path_files_with_ext, '.css'), fu.fmap(fu.file_to_str), '\n'.join, ]) return composed(directory)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimise(dummy, dirname, filesindir):\n for fname in filesindir:\n if fname[-4:] == '.css' and fname[-8:] != '.min.css':\n oldfile = os.path.join(dirname, fname)\n newfile = os.path.join(dirname, fname[:-4] + '.min.css')\n\n print(\"CSS: Minimising: \" + oldfile +\n ...
[ "0.7011022", "0.6763698", "0.65458214", "0.6463882", "0.6105728", "0.58594495", "0.58530825", "0.5792829", "0.57486534", "0.5707456", "0.5686341", "0.563204", "0.5572905", "0.5545066", "0.5539306", "0.55196446", "0.5489846", "0.5454152", "0.5436028", "0.5409641", "0.53038216"...
0.7902445
0
Combine all .js files in supplied dir
def get_js(directory): composed = fu.lcompose([ partial(get_path_files_with_ext, '.js'), fu.fmap(fu.file_to_str), '\n'.join, ]) return composed(directory)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_js_files(self, root):\n res = []\n\n for fname in os.listdir(root):\n mo = re.match(r'(\\w+)\\.js$', fname)\n if mo:\n res.append({\n 'name': mo.group(1),\n 'src': file_contents(os.path.join(root, mo.group()))\n ...
[ "0.6964281", "0.69593936", "0.64801484", "0.6399067", "0.6311294", "0.62708926", "0.62615126", "0.6221955", "0.610704", "0.60863435", "0.59412277", "0.5907971", "0.5851446", "0.5785374", "0.5769434", "0.5755123", "0.57511866", "0.5601873", "0.55832875", "0.5574986", "0.556445...
0.70003706
0
Delete all files with given extension from directory
def remove_extention(extension, directory): map(os.remove, get_path_files_with_ext(extension, directory))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_files(files):\n for file in files:\n if os.path.exists(file):\n if file.startswith(\"./\") or file.startswith(\".\\\\\"):\n file = file[2:]\n if os.path.isdir(file):\n rmtree(file)\n else:\n os.unlink(file)", "def ...
[ "0.7016264", "0.70012045", "0.6924682", "0.69238365", "0.67830074", "0.6757118", "0.6737126", "0.6732129", "0.6725096", "0.6632278", "0.65911704", "0.65819293", "0.6581058", "0.65620923", "0.65602493", "0.65327275", "0.6524596", "0.649113", "0.64846593", "0.64460665", "0.6445...
0.8080184
0
Make cachebusted css & js files, return dict of filenames
def make_static_assets(opts): css_filename = do_css(opts['css_source_dir'], opts['out_dir']) js_filename = do_js(opts['js_source_dir'], opts['out_dir']) return { 'primary_css': css_filename, 'js': js_filename }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_assets():\n assets = {}\n\n # Load all static files\n for root, dirs, files in os.walk(STATIC_DIR):\n for fname in files:\n filename = os.path.join(root, fname)\n with open(filename, \"rb\") as f:\n assets[os.path.relpath(filename, STATIC_DIR)] = f.re...
[ "0.61966217", "0.60148317", "0.5884821", "0.58727264", "0.5826044", "0.577117", "0.5764453", "0.5734105", "0.57224226", "0.571173", "0.5699573", "0.5696266", "0.5694141", "0.5681537", "0.56407696", "0.5586501", "0.5582102", "0.5470518", "0.54468906", "0.54387635", "0.54299986...
0.6669365
0
Take input css, combine, cachebust, replace
def do_css(css_input_dir, css_output_dir): # primary css css_str = combine_css(css_input_dir) css_name = get_cachebusting_name(css_str) + '.css' # remove and write remove_extention('.css', css_output_dir) fu.str_to_file(css_output_dir + css_name, css_str) return css_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_clevercss(source, filepath):\n return clevercss.convert(source)", "def do_cssmin(input_file, output_file):\n with open(output_file, mode='wb') as out:\n out.write(cssmin.cssmin(open(input_file, mode='rb').read()))", "def process_single_css_file(css_file_path):\n log.info(\"Processin...
[ "0.6879922", "0.63250375", "0.6277127", "0.6223683", "0.5958826", "0.5894168", "0.583482", "0.5812858", "0.5797653", "0.5706017", "0.56983274", "0.5677478", "0.5660276", "0.566019", "0.5625188", "0.56242156", "0.56144553", "0.55879253", "0.5559319", "0.5542068", "0.5519815", ...
0.72925496
0
Take input js, combine, cachebust, replace existing output
def do_js(js_input_dir, js_output_dir): remove_extention('.js', js_output_dir) js_str = get_js(js_input_dir) js_name = get_cachebusting_name(js_str) + '.js' fu.str_to_file(js_output_dir + js_name, js_str) return js_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_js(scheme, netloc, host, port, cname, type_):\n js = get_cache(host, port, type_)\n if not js:\n js = TEMPLATE\n js = __replace(js, '$SCHEMA', str(scheme))\n js = __replace(js, '$NETLOC', str(netloc))\n js = __replace(js, '$HOST', str(host))\n js = __replace(js, '$...
[ "0.64247453", "0.63225514", "0.6023301", "0.5829465", "0.5827293", "0.5815055", "0.5748662", "0.56742823", "0.5654985", "0.5526006", "0.55024683", "0.54439366", "0.5379791", "0.5324677", "0.5317639", "0.53101695", "0.52518547", "0.5246709", "0.52406454", "0.5182187", "0.51720...
0.6564667
0
This method uses simple font render functionality
def render(self, transform, alpha=255): Renderer.render_simple_font(self, transform, alpha)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_text(text, font_size, bold, text_color):\n myfont = pygame.font.SysFont(\"Courier\", font_size, bold)\n surface = myfont.render(text,True,text_color)\n return surface", "def renderText(self, taille = 24, text = \"\", couleur = (0,0,0)):\n self.pygamePol = pygame.font.SysFont(self.path...
[ "0.7470834", "0.7279434", "0.72786534", "0.7018614", "0.6987648", "0.6922841", "0.6894829", "0.68806845", "0.68218905", "0.6769625", "0.6754096", "0.67527944", "0.6748659", "0.6676057", "0.6675347", "0.6654453", "0.66436416", "0.66372406", "0.6611475", "0.65640616", "0.655889...
0.73465437
1
Autodiscover INSTALLED_APPS panels.py modules and fail silently when not present. This forces an import on them to register any panels they define. Copied from django/contrib/admin/__init__.py, Thanks!
def _auto_discover(self): if self._initialized: return from django.conf import settings from django.utils.importlib import import_module from django.utils.module_loading import module_has_submodule self._initialized = True for app in settings.INSTALLED_APPS:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autodiscover():\n from django.utils.importlib import import_module\n global LOADED\n if LOADED:\n return\n LOADED = True\n for app in settings.INSTALLED_APPS:\n try:\n import_module(\"%s.page_widgets\" % app)\n except ImportError, e:\n if \"WidgetModel\...
[ "0.7180066", "0.7077164", "0.7053253", "0.69949466", "0.68018234", "0.63648283", "0.6158401", "0.60535663", "0.5966996", "0.59198654", "0.58738637", "0.5691806", "0.5668465", "0.5666456", "0.5645346", "0.5621228", "0.55803525", "0.5508848", "0.5504454", "0.54845816", "0.54731...
0.7595425
0
Register a Panel class with this site. This will create the queue in celery and start routing the events from that queue to the given panel instance.
def register(self, panel): new_instance = panel() new_event_type = new_instance._meta.event_type if new_event_type in self.__class__._panels: raise Exception("Two panels with the same event type: %s" % \ new_event_type) self.__class__._panels[new_event_type] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_panel(self, panel):\n assert panel.PANEL_ID not in self.panels\n assert not self.tools, \"tools must be added after panels\"\n self.panels[panel.PANEL_ID] = panel\n panel.register_panel(self)", "async def service_panel_start(self, call):\r\n if self.SystemStarted:\r\n ...
[ "0.5726213", "0.533663", "0.52742654", "0.5094796", "0.5069265", "0.49911258", "0.49898887", "0.49495342", "0.48323926", "0.48308855", "0.4826233", "0.4824577", "0.48157656", "0.4795146", "0.47577876", "0.47553855", "0.47045642", "0.46938205", "0.46920118", "0.4688692", "0.46...
0.6869604
0
Retrieve a registered panel instance by the event type it handles.
def get_panel(self, event_type): self._auto_discover() if event_type in self.__class__._panels: return self.__class__._panels[event_type] raise exceptions.PanelDoesNotExist("Panel '%s' does not exist" % event_type)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(self, panel):\n new_instance = panel()\n new_event_type = new_instance._meta.event_type\n if new_event_type in self.__class__._panels:\n raise Exception(\"Two panels with the same event type: %s\" % \\\n new_event_type)\n self.__class__._panels[new...
[ "0.6551277", "0.61205554", "0.5846125", "0.5210679", "0.5161614", "0.5144627", "0.50778073", "0.49563506", "0.495533", "0.4914394", "0.4912022", "0.4866108", "0.48621988", "0.4835246", "0.4811418", "0.48000115", "0.47777092", "0.47659224", "0.4762531", "0.47620296", "0.475663...
0.81290853
0
Test the Sequence grammar.
def test__parser__grammar_sequence(seg_list, caplog): bs = StringParser("bar", KeywordSegment) fs = StringParser("foo", KeywordSegment) g = Sequence(bs, fs) # If running in the test environment, assert that Sequence recognises this if getenv("SQLFLUFF_TESTENV", ""): assert g.test_env gc ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__parser__grammar_sequence_indent(seg_list, caplog):\n bs = StringParser(\"bar\", KeywordSegment)\n fs = StringParser(\"foo\", KeywordSegment)\n g = Sequence(Indent, bs, fs)\n ctx = ParseContext(dialect=None)\n with caplog.at_level(logging.DEBUG, logger=\"sqlfluff.parser\"):\n m = g.m...
[ "0.65691507", "0.64379364", "0.63356596", "0.63244706", "0.6309889", "0.6309889", "0.6309889", "0.6309889", "0.6309889", "0.6309889", "0.6309889", "0.6309889", "0.6309889", "0.6280302", "0.6275134", "0.62441903", "0.62371135", "0.620139", "0.61992955", "0.61657536", "0.615065...
0.71126795
0
Test the Sequence grammar when nested.
def test__parser__grammar_sequence_nested(seg_list, caplog): bs = StringParser("bar", KeywordSegment) fs = StringParser("foo", KeywordSegment) bas = StringParser("baar", KeywordSegment) g = Sequence(Sequence(bs, fs), bas) ctx = ParseContext(dialect=None) with caplog.at_level(logging.DEBUG, logge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__parser__grammar_sequence_indent(seg_list, caplog):\n bs = StringParser(\"bar\", KeywordSegment)\n fs = StringParser(\"foo\", KeywordSegment)\n g = Sequence(Indent, bs, fs)\n ctx = ParseContext(dialect=None)\n with caplog.at_level(logging.DEBUG, logger=\"sqlfluff.parser\"):\n m = g.m...
[ "0.64429593", "0.62853265", "0.59997797", "0.59176314", "0.5851315", "0.5692735", "0.56275356", "0.56033015", "0.5529237", "0.5463232", "0.54368114", "0.53964365", "0.534567", "0.53456587", "0.53339267", "0.5285038", "0.5281772", "0.5271321", "0.5259766", "0.5256389", "0.5253...
0.68778837
0
Test the Sequence grammar with indents.
def test__parser__grammar_sequence_indent(seg_list, caplog): bs = StringParser("bar", KeywordSegment) fs = StringParser("foo", KeywordSegment) g = Sequence(Indent, bs, fs) ctx = ParseContext(dialect=None) with caplog.at_level(logging.DEBUG, logger="sqlfluff.parser"): m = g.match(seg_list, pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__parser__grammar_sequence_indent_conditional(seg_list, caplog):\n bs = StringParser(\"bar\", KeywordSegment)\n fs = StringParser(\"foo\", KeywordSegment)\n # We will assume the default config has indented_joins = False.\n # We're testing without explicitly setting the `config_type` because\n ...
[ "0.6519503", "0.62401825", "0.6147939", "0.6111043", "0.5894646", "0.5784145", "0.57754326", "0.5731375", "0.57012355", "0.5629549", "0.5569424", "0.5537508", "0.54972917", "0.54654115", "0.54473716", "0.5437541", "0.5437541", "0.5436883", "0.5357742", "0.53287536", "0.531817...
0.7309385
0
Test the Sequence grammar with indents.
def test__parser__grammar_sequence_indent_conditional(seg_list, caplog): bs = StringParser("bar", KeywordSegment) fs = StringParser("foo", KeywordSegment) # We will assume the default config has indented_joins = False. # We're testing without explicitly setting the `config_type` because # that's the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__parser__grammar_sequence_indent(seg_list, caplog):\n bs = StringParser(\"bar\", KeywordSegment)\n fs = StringParser(\"foo\", KeywordSegment)\n g = Sequence(Indent, bs, fs)\n ctx = ParseContext(dialect=None)\n with caplog.at_level(logging.DEBUG, logger=\"sqlfluff.parser\"):\n m = g.m...
[ "0.7309385", "0.62401825", "0.6147939", "0.6111043", "0.5894646", "0.5784145", "0.57754326", "0.5731375", "0.57012355", "0.5629549", "0.5569424", "0.5537508", "0.54972917", "0.54654115", "0.54473716", "0.5437541", "0.5437541", "0.5436883", "0.5357742", "0.53287536", "0.531817...
0.6519503
1
Shows an rgb viewer inside a new window Returns as soon as the stream has been terminated.
def show_rgb_viewer(): if not IS_INITIALIZED: print "Device not initialized" return device = openni2.Device.open_any() rgb_stream = _rgb_stream_from_device(device) rgb_stream.start() done = False while not done: key = cv2.waitKey(1) & 255 if key == 27: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self, window):\r\n\r\n return", "def view(self, name_of_window=\"Image\") -> None:\n cv2.namedWindow(name_of_window, cv2.WINDOW_NORMAL)\n cv2.imshow(name_of_window, self.img)\n cv2.waitKey(0)\n cv2.destroyAllWindows()", "def preview(self):\n win_name = 'RTSP'\...
[ "0.6716372", "0.6670684", "0.6455085", "0.63648653", "0.63104045", "0.62640524", "0.62354565", "0.6202929", "0.6124266", "0.6072557", "0.60579914", "0.60009944", "0.59859836", "0.5975382", "0.59729373", "0.5941784", "0.59172404", "0.5913296", "0.59121615", "0.5903601", "0.589...
0.7514981
0
Home page with auth links.
def home(request): if request.user.is_authenticated(): return HttpResponse("{0} <a href='/accounts/logout'>exit</a>".format(request.user)) else: return HttpResponse("<a href='/login/vk-oauth2/'>login with VK</a>")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(request):\n\n\tif request.user.is_authenticated:\n\t\treturn HttpResponseRedirect('home')\n\treturn HttpResponseRedirect('login')", "def homepage():\n if g.user:\n return redirect(f\"/user/{g.user.id}\")\n else:\n return redirect(\"/landing\")", "def home(request):\n if request...
[ "0.7620997", "0.757061", "0.7545057", "0.75089806", "0.7498317", "0.74462444", "0.74266213", "0.73984593", "0.7378062", "0.7289403", "0.7249242", "0.7248388", "0.72273856", "0.7214283", "0.7200972", "0.7195424", "0.71573", "0.7152052", "0.7133126", "0.7122047", "0.7100568", ...
0.7823744
0
Determine the correct SO term for the given URS ISNDC ncRNA type. The URS may be an Rna object, or a known rna_type. If there is no known mapping then the SO term defined in 'UNKNOWN' will be used (transcript). Generally this will just look up the known rna_type and then using the mapping dict to get the corresponding ...
def assign_term(urs): if isinstance(urs, six.string_types): return MAPPING.get(urs, UNKNOWN) return assign_term(urs.get_rna_type())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rna_type(entry):\n\n basic = basic_rna_type(entry)\n if basic == \"rrna\":\n return \"rRNA\"\n if basic == \"trna\":\n return \"tRNA\"\n if basic == \"ncrna\":\n return \"other\"\n if basic == \"snrna\":\n return \"snRNA\"\n raise ValueError(\"Cannot determine rna ...
[ "0.64846957", "0.5072221", "0.5071017", "0.49768868", "0.49488005", "0.4939044", "0.49028826", "0.49005616", "0.4894166", "0.48395282", "0.4804173", "0.4751976", "0.47358134", "0.47281468", "0.4724007", "0.47132796", "0.4699889", "0.46821812", "0.46719375", "0.4654556", "0.46...
0.5291235
1
Get only the SO label for the given URS. This can effectively cover the label using by ISNDC to the one used by the SO. Most of them are the same, but a few are different. In addition, some terms in ISNDC don't have a clear correspondence to the SO terms.
def get_label(urs): return assign_term(urs)[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label(efo):\n url = 'https://www.ebi.ac.uk/ols/api/ontologies/efo/terms?iri=http://www.ebi.ac.uk/efo/'+efo\n try:\n response = requests.get(url).json()\n except:\n return \"\"\n if 'error' in response.keys():\n return \"\"\n return response['_embedded']['terms'][0]['label']"...
[ "0.585502", "0.5712389", "0.5689227", "0.5635668", "0.55014604", "0.5448202", "0.53863704", "0.5340129", "0.5317041", "0.53089845", "0.5301399", "0.5266836", "0.52411747", "0.52118117", "0.5205693", "0.51929814", "0.51733476", "0.5173161", "0.5161184", "0.5161005", "0.5157511...
0.6207063
0
Get the source of a twiki topic
def get_topic_raw(session, web_topic, twiki_root, timeout=DEFAULT_TIMEOUT_SECONDS, rawmode="debug"): web,topic = web_topic.split(".") rd = session.get("{0}/view/{web}/{topic}?skin=text&raw=debug&contenttype=text/plain".format(twiki_root.rstrip("/"), web=web, topic=topic), timeout=timeout) return rd.content....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_topic(self,topic_path):\n twiki_cgi = \"{:s}/bin/view/{:s}\".format(self.url,topic_path)\n\n params = {'username': self.settings['auth']['username'],\n 'password': self.settings['auth']['password'],\n 'raw': 'text'}\n response = self.session.get(twiki_cgi, param...
[ "0.6564979", "0.6374605", "0.61488175", "0.6109156", "0.60493195", "0.6022833", "0.60068303", "0.60047984", "0.5971288", "0.59624434", "0.594792", "0.58943874", "0.5814889", "0.58054847", "0.5792774", "0.57667786", "0.57210386", "0.57210386", "0.57210386", "0.57210386", "0.57...
0.6836473
0
Get the webbacklinks page for a twiki topic
def get_topic_webbacklinks(session, web_topic, twiki_root, timeout=DEFAULT_TIMEOUT_SECONDS): web,topic = web_topic.split(".") rd = session.get("{0}/oops/{web}/{topic}?template=backlinksweb".format(twiki_root.rstrip("/"), web=web, topic=topic), timeout=timeout) return rd.content.decode(rd.apparent_encoding)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_backlinks(self, title):\n title = title.replace(' ', '%20')\n sq = query.Prefix(\"links\", title + ':')\n results = set()\n for doc in self.index.run_query(self.name, sq, limit=8000):\n results.add(doc['title'])\n return results", "def get_topic (url):\n ...
[ "0.6166323", "0.58109796", "0.5793948", "0.57568353", "0.5717611", "0.570152", "0.56055933", "0.5495066", "0.5455497", "0.54360896", "0.54041505", "0.53633034", "0.534561", "0.53435665", "0.5342019", "0.5329988", "0.53164864", "0.5301412", "0.5278596", "0.5276193", "0.5272154...
0.81839347
0
Returns the cost of the current route based on adjacency matrix
def calculate_cost(route, adjacency_matrix): route_shifted = np.roll(route,1) cost = np.sum(adjacency_matrix[route, route_shifted]) st_dev = np.std(adjacency_matrix[route, route_shifted]) return st_dev, cost
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_routecost(self, route):\n return np.sum(self.parent.edges.lengths[route])", "def route_cost(self, route):\n total_weight = 0\n c = 0\n start = route[0]\n for end in route[1:]:\n y = float(self.stars[start][end]['weight']) - c\n t = total_weight + y...
[ "0.7413573", "0.7263539", "0.7253151", "0.70447296", "0.69634026", "0.6827153", "0.6776299", "0.6765283", "0.6592688", "0.65870917", "0.6550151", "0.65307516", "0.6440233", "0.6423966", "0.6409097", "0.63839984", "0.63477504", "0.6324744", "0.63231564", "0.62892765", "0.62878...
0.8176411
0
Run function for greedy two_opt function
def run_two_opt(tsp_file, N_sim, max_chain_length): best_routes = [] costs = [] adjacency_matrix = make_matrix(tsp_file) cost_lists = [] for _ in range(N_sim): x = list(range(len(adjacency_matrix))) init_route = random.sample(x,len(x)) best_route, cost_list = two_opt(init_ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Example_2():\r\n print \"\\n** Example_2: Finding the minimum of the Rosenbrock function with 2 variables under constraints **\"\r\n\r\n Ex = optim_wrapper()\r\n X0 = np.zeros(2)\r\n lim = [(-2.0, 2.0)]*2\r\n Ex.set_X0(X0)\r\n Ex.set_lim(lim)\r\n Ex.set_penalties_func(pen)\r\n Ex.set_no...
[ "0.62940747", "0.6191152", "0.59845823", "0.5775905", "0.5606854", "0.5596363", "0.55398977", "0.5537767", "0.5522014", "0.54946876", "0.54761624", "0.5461915", "0.5453281", "0.5430775", "0.5422188", "0.54198366", "0.54101133", "0.5379571", "0.53332925", "0.53257424", "0.5318...
0.64252627
0
Select connectors necessary for circular assemblie(s) in this mix. This method assumes that the parts provided in the mix are the main parts of either a single or a combinatorial assembly (with welldefined slots), and the provided list of ``connector_records`` contains "bridging" parts, some of which may be necessary f...
def autoselect_connectors(self, connectors_records): original_parts = self.parts all_part_ids = [c.id for c in original_parts] connectors_records = [ c for c in connectors_records if c.id not in all_part_ids ] slotted_parts_records = [ self.parts_dict[lis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_connectors(self, connectors, connector_type, default_label='C',\n return_groups=False, in_group=False,\n return_labels=False):\n if isinstance(connectors, int):\n if connectors < 0:\n raise ValueError(\"Number of conne...
[ "0.48051178", "0.47280377", "0.47208178", "0.46267396", "0.45916992", "0.44972733", "0.44801214", "0.44623733", "0.44337353", "0.4380441", "0.43737307", "0.4341765", "0.43395966", "0.43348256", "0.4333026", "0.43278086", "0.43028805", "0.42945957", "0.4269791", "0.42630684", ...
0.7715741
0
Formats a list of events according to the user's settings. We can format in JSON, text, or keyvalue pairs. Once the event is formatted, it's passed to writeEventString() to be written to the destination.
def formatEvents(eventList): firstEv = True for ev in eventList: evStr = json.dumps(ev) xmlStr = "<event><data>%s</data></event>" % xml.sax.saxutils.escape(evStr) print xmlStr if (firstEv): firstEv = False logging.info("cphalo: first event in batch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, file_, format=format_, header=header): #@ReservedAssignment\n str_list = []\n if header and '{' in header:\n str_list.append(header.format(len(self)))\n if format == self.format_LATEX or format == self.format_LATEX2:\n for event in self:\n ...
[ "0.69461125", "0.6248655", "0.5708993", "0.5700383", "0.5675077", "0.5669681", "0.56667876", "0.56451845", "0.5622864", "0.55898297", "0.54931223", "0.54635507", "0.54244244", "0.54218876", "0.5388984", "0.5370598", "0.53428817", "0.5337241", "0.53222936", "0.53201634", "0.52...
0.67293614
1
This method runs a host of preparations for the evaluation of the criterion function that are specific to the current RESPY implementation. So, major cleanup as we settle on the revised interface.
def _prepare_evaluate(self): labels = list() labels += ['num_procs', 'num_periods', 'is_debug', 'seed_emax', 'seed_sim'] labels += ['num_draws_emax', 'num_agents_sim', 'num_types', 'edu_spec', 'version'] labels += ['num_draws_prob', 'seed_prob'] num_procs, num_periods, is_debug, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_criterion(self) -> None:\n # get criterion class lists\n criterion_names = get_class_names_in_files(\n \"src\" + os.path.sep + \"criterions.py\"\n )\n criterion_names.remove(\"Criterion\")\n\n # Check config criterion exists\n assert self.config[\"CRIT...
[ "0.5816474", "0.5775948", "0.56430566", "0.5612488", "0.55995435", "0.5544727", "0.55085975", "0.5500183", "0.549634", "0.5492102", "0.54798216", "0.54783255", "0.5453038", "0.5449413", "0.5447639", "0.5437415", "0.54213494", "0.54188454", "0.5415266", "0.53999156", "0.539420...
0.6055227
0
Tries to find the biggest patch size that can be send to GPU for inference without throwing CUDA out of memory
def find_maximum_patch_size(model, device): logger = get_logger('PatchFinder') in_channels = model.in_channels patch_shapes = [(64, 128, 128), (96, 128, 128), (64, 160, 160), (96, 160, 160), (64, 192, 192), (96, 192, 192)] for shape in patch_shapes: # ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_maximum_patch_size(model, device):\n logger = get_logger('PatchFinder')\n in_channels = model.in_channels\n\n patch_shapes = [(64, 128, 128), (96, 128, 128),\n (64, 160, 160), (96, 160, 160),\n (64, 192, 192), (96, 192, 192)]\n\n for shape in patch_shapes:...
[ "0.72705436", "0.68294334", "0.65867734", "0.65867734", "0.6326499", "0.6293365", "0.6254337", "0.6254337", "0.62225777", "0.6203681", "0.62007403", "0.6055225", "0.6034449", "0.6018449", "0.60072476", "0.5993449", "0.5988849", "0.5974822", "0.59689575", "0.5952202", "0.59435...
0.72677773
1
Method to get all user comments based on their usename
def all_user_comments(username): return commentslist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_user_comments(username):\n # comment = [\n # comment for comment in commentslist if comment[\"username\"] == username\n # ]\n return commentslist", "def find_comment_by_user(self, pat):\n return [com for th in self for com in th['comment'] if pat in com['user']]", "def comments(s...
[ "0.7935762", "0.6870037", "0.676165", "0.6424526", "0.64237475", "0.6084879", "0.6027987", "0.6017626", "0.5908568", "0.58126515", "0.580057", "0.5797701", "0.57582295", "0.5718413", "0.57156247", "0.5708942", "0.5699195", "0.5665293", "0.5647388", "0.56454194", "0.5634658", ...
0.82215124
0
Method that deletes a user comment by id
def delete_user_comment(username, comment_id): result = get_comment_by_id(username, comment_id) # remove from list commentslist.remove(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_comment(self, id, **args): \n args.update(id=id)\n return self.fetch(\"/comment/delete\", post_args=args)", "def delete_comment(request, comment_id):\n raise NotImplementedError", "def delete_user(id):\n pass", "def delete_comment(self, uid: str):\n pass", "async def d...
[ "0.80835074", "0.795648", "0.7517867", "0.7516066", "0.7288504", "0.72729516", "0.7270589", "0.7219247", "0.7210315", "0.72079253", "0.70929927", "0.7066745", "0.70305216", "0.70274734", "0.7021515", "0.70141834", "0.69647086", "0.69235736", "0.6909409", "0.68783104", "0.6872...
0.82798046
0
Method to get all user comments based on their usename
def all_user_comments(username): # comment = [ # comment for comment in commentslist if comment["username"] == username # ] return commentslist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_user_comments(username):\n return commentslist", "def find_comment_by_user(self, pat):\n return [com for th in self for com in th['comment'] if pat in com['user']]", "def comments(self):\r\n return comments.UserComments(self)", "def get_commenters(self):\n def get_user(comment...
[ "0.82224154", "0.68693316", "0.67634743", "0.64261967", "0.64258474", "0.60869855", "0.6031014", "0.60217047", "0.5909544", "0.5815813", "0.580312", "0.5801521", "0.5758065", "0.5721508", "0.5718769", "0.57075715", "0.5702652", "0.5668432", "0.5650648", "0.56448597", "0.56338...
0.7936108
1
Method that deletes a user comment by id
def delete_user_comment(username, comment_id): result = get_comment_by_id(username, comment_id) # remove from list commentslist.remove(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_comment(self, id, **args): \n args.update(id=id)\n return self.fetch(\"/comment/delete\", post_args=args)", "def delete_comment(request, comment_id):\n raise NotImplementedError", "def delete_comment(self, uid: str):\n pass", "def delete_user(id):\n pass", "async def d...
[ "0.80853015", "0.79570305", "0.75172764", "0.751665", "0.72890204", "0.7271549", "0.7270069", "0.7222997", "0.72107214", "0.72056663", "0.70919967", "0.70667714", "0.7029909", "0.7026337", "0.7020322", "0.70149815", "0.6964976", "0.69238496", "0.6910604", "0.6879388", "0.6872...
0.8280085
1
Check if username exists in USERS_LIST
def check_username(search_username): for find_username in USERS_LIST: if find_username["username"] == search_username: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def username_exists(self, username):\n user = [user for user in ALL_USERS if user['username'] == username]\n if user:\n return True\n return False", "def user_exist(cls,user_name):\n for user in cls.user_list:\n if user.user_name == user_name:\n re...
[ "0.8187873", "0.7988705", "0.79704976", "0.780848", "0.7756037", "0.7718504", "0.77091545", "0.7587402", "0.7567572", "0.7428611", "0.7393606", "0.72743034", "0.72455513", "0.7195781", "0.71853507", "0.7183082", "0.7158173", "0.714916", "0.7100002", "0.7096488", "0.7095625", ...
0.8427725
0
Check if there are any queries Returns
def __checkForEmptyQuery(self): empty = True for key in self.queries: if len(self.queries[key]) > 0: empty = False break return empty
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _query_is_empty(self):\n return not self.query._query", "def has_results(self):\n pass", "def _check_available() -> None:\n current_session().query(\"1\").from_statement(text(\"SELECT 1\")).all()", "def test_query_1(self):\n with app.test_request_context():\n agency_non...
[ "0.70236415", "0.69732225", "0.6490821", "0.64587784", "0.637352", "0.6317755", "0.6306362", "0.62670535", "0.6208331", "0.6188718", "0.6179318", "0.6166884", "0.61639357", "0.6135277", "0.6123547", "0.6104064", "0.60649073", "0.6053935", "0.60507345", "0.6043634", "0.6026636...
0.7729787
0
Produce a block of queries for the given type (without parantheses)
def __produceBlock(self, qType, qList=None): block = "" first = True for query in (qList if not (qList is None) else self.queries[qType]): if first: block += qType + ":" + query first = False else: block += self.connectorStr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql_filter(sql, *types):\r\n stmts = cached_parse(sql)\r\n fstmts = []\r\n\r\n for stmt in stmts:\r\n if not stmt.is_group:\r\n return False\r\n for token in stmt.tokens:\r\n if token.ttype in types:\r\n fstmts.append(str(stmt))\r\n return fstmts",...
[ "0.6363933", "0.5889129", "0.58603036", "0.57676965", "0.5566484", "0.5453767", "0.54121876", "0.539752", "0.5337488", "0.53051466", "0.5266319", "0.52009887", "0.52008677", "0.51876116", "0.5171248", "0.5166698", "0.51505125", "0.51446724", "0.51376307", "0.5136774", "0.5113...
0.705958
0
Give a list of all title queries that are searched for Returns
def getAllTitleQueries(self): return self.queries["ti"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_title() -> list:\n return [i[\"title\"] for i in Blogs_Manager.TablePost.all_query()]", "def getResults():", "def filter_by_title(self):\n\n \"\"\" validate data \"\"\"\n if not self.title or not self.body:\n api.abort(400, \"Incorrect Data Format. Try again\")\n\n ...
[ "0.6569117", "0.6474973", "0.6429163", "0.632736", "0.6219932", "0.62077045", "0.6162094", "0.6085321", "0.60649407", "0.60478246", "0.60081244", "0.60028374", "0.59820855", "0.5973132", "0.5962796", "0.5937682", "0.5930596", "0.59255445", "0.5899153", "0.5862088", "0.5844524...
0.6973486
0
Add an author to be contained in the query string Add an author to also search for. All authors, title, and abstract queries will be searched for (orconnected). At least one of them has to be specified to have a valid query string.
def addAuthorQuery(self, authorName): if not (authorName in self.queries["au"]): self.queries["au"].append(authorName)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_author_simple(self):\n invenio_search = 'author:\"ellis, j*\"'\n spires_search = 'find a ellis, j'\n self._compare_searches(invenio_search, spires_search)", "def add_query_to_article(article, query=''):\n article['query'] = query\n return article", "def test_exac...
[ "0.6492298", "0.6438799", "0.625433", "0.6231473", "0.62001836", "0.6060498", "0.602473", "0.6007073", "0.60066", "0.60010284", "0.5999584", "0.59954685", "0.59950745", "0.5944127", "0.59228975", "0.590848", "0.590794", "0.5890232", "0.58612674", "0.58102274", "0.5797397", ...
0.7642857
0
Add an string to be contained in a title to the query string Add a word to search in titles for. All authors, title, and abstract queries will be searched for (orconnected). At least one of them has to be specified to have a valid query string.
def addTitleQuery(self, titleQuery): if not (titleQuery in self.queries["ti"]): self.queries["ti"].append(titleQuery)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_title_criteria(self, title):\n self.criteria.append({'title': title})", "def add_article(str_):\n if str_.istitle() or str_.find('the ') > -1:\n str_ = str_\n else:\n str_ = 'the ' + str_\n return str_", "def modify_search(add=[], remove=[]):\n\n query = request.args.ge...
[ "0.6552853", "0.6406436", "0.6287916", "0.62635875", "0.6258321", "0.62318444", "0.62197846", "0.60607255", "0.60526603", "0.6031666", "0.5951542", "0.5843359", "0.58276796", "0.5781459", "0.57457817", "0.5685286", "0.56738716", "0.56672406", "0.5661504", "0.56511486", "0.564...
0.6602423
0
Remove an author from the query string Stop searching for a given author. At least one query has to be specified overall to have a valid query string.
def removeAuthorQuery(self, authorName): try: self.queries["au"].remove(authorName) except ValueError: raise NotInQueryException
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_author():\n try:\n key = list(request.args.keys())[0]\n val = request.args[key].strip('\"')\n if key is None:\n return render_template(\"error.html\", message=\"Please enter a correct key\"), 400\n except IndexError:\n queryVal = request.form.to_dict()\n ...
[ "0.63906455", "0.60878175", "0.60549474", "0.5955258", "0.589001", "0.5886378", "0.58244", "0.56123495", "0.5580916", "0.55190593", "0.5477509", "0.539876", "0.53931725", "0.53720534", "0.53611284", "0.52503943", "0.5232828", "0.52286285", "0.51985455", "0.5191687", "0.517290...
0.7376638
0
Remove all authors from the query string Stop searching for authors. At least one query has to be specified overall to have a valid query string.
def removeAllAuthorQueries(self): self.queries["au"] = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeAuthorQuery(self, authorName):\n try:\n self.queries[\"au\"].remove(authorName)\n except ValueError:\n raise NotInQueryException", "def test_absorbs_naked_author_search(self):\n invenio_search = \"author:ellis\"\n spi_search = \"author ellis\"\n...
[ "0.6460686", "0.59563625", "0.5929364", "0.5927409", "0.5901221", "0.56442225", "0.5642697", "0.5618", "0.5583691", "0.55610514", "0.55272347", "0.5521602", "0.54397136", "0.5396025", "0.5377775", "0.53773004", "0.53489244", "0.53321236", "0.5322012", "0.52854526", "0.5273246...
0.6729235
0
Remove an title query from the query string Stop searching for a given string in titles. At least one query has to be specified overall to have a valid query string.
def removeTitleQuery(self, titleQuery): try: self.queries["ti"].remove(titleQuery) except ValueError: raise NotInQueryException
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_stop_words(self, query):\n ans=\"\"\n words= query.split()\n for word in words:\n if word.lower() not in self.stop_words:\n ans+=word+\" \"\n return ans", "def cleanQuery(self, query):\n query_input = re.sub(r\"\\W+\", \" \", query).lower()\...
[ "0.6047439", "0.5972838", "0.5912851", "0.58979875", "0.57817745", "0.5739062", "0.5732167", "0.57241404", "0.568972", "0.56563324", "0.5653758", "0.5622596", "0.5554066", "0.5552708", "0.553492", "0.55233943", "0.55226713", "0.551869", "0.5503779", "0.54541826", "0.54541117"...
0.6863148
0
Remove all titles from the query string Stop searching for titles. At least one query has to be specified overall to have a valid query string.
def removeAllTitleQueries(self): self.queries["ti"] = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_stop_words(self, query):\n ans=\"\"\n words= query.split()\n for word in words:\n if word.lower() not in self.stop_words:\n ans+=word+\" \"\n return ans", "def cleanQuery(self, query):\n query_input = re.sub(r\"\\W+\", \" \", query).lower()\...
[ "0.6332364", "0.63181734", "0.58596796", "0.5843576", "0.58280593", "0.57760656", "0.57576734", "0.5753348", "0.57079124", "0.55776286", "0.5564692", "0.5541824", "0.5467683", "0.5456264", "0.5455307", "0.54119843", "0.5365931", "0.5338442", "0.53148293", "0.52942544", "0.528...
0.63582546
0
Remove an abstract query from the query string Stop searching for a given string in abstracts. At least one query has to be specified overall to have a valid query string.
def removeAbstractQuery(self, abstractQuery): try: self.queries["abs"].remove(abstractQuery) except ValueError: raise NotInQueryException
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_abstract_phrases(self, abstract):\n sfp = SciFullTextProcessor()\n try:\n clean_abstract = sfp.remove_abstract_phrases(abstract)\n except TypeError:\n clean_abstract = abstract\n except UnboundLocalError:\n clean_abstract = abstract\n\n ...
[ "0.6073411", "0.5893175", "0.5781647", "0.5735561", "0.54955906", "0.54891753", "0.5478972", "0.5444385", "0.54124886", "0.54013145", "0.5379987", "0.5364279", "0.5342807", "0.5337475", "0.53320533", "0.5319611", "0.5308588", "0.52715427", "0.5259219", "0.5230137", "0.5224172...
0.6479908
0
Starts creating new graph.
def start_new_graph(self): self.nodes = {} self.reset_graph()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_graph(self, obj, *args, **kwargs):\n self._executor.new_graph(obj, *args, *(kwargs.values()))", "def do_create_graph(self, args):\n if (len(args.split()) > 0):\n self.__bad_arguments(\"create_graph\")\n else:\n AssassinsManager.create_graph(self.assassins_manage...
[ "0.68113154", "0.66579825", "0.6467915", "0.6393893", "0.63477886", "0.6328821", "0.6290141", "0.6205508", "0.6196761", "0.6196761", "0.6190521", "0.61739194", "0.61654264", "0.61430395", "0.61369246", "0.6122952", "0.6107019", "0.61059445", "0.61028254", "0.60786885", "0.607...
0.76942396
0
Resets the internal state of graph creator.
def reset_graph(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_graph(self):\n self.nodes = {}\n self.add_node(self.initial_state)\n self.add_node(self.final_state)", "def ResetGraph(self):\n self.nodes = []\n self.edges = []\n self.connections = []\n Node.resetNodeCount()\n Edge.resetEdgesCount()", "def res...
[ "0.77192545", "0.7501422", "0.74564093", "0.7375027", "0.7288866", "0.70874035", "0.70852244", "0.70083344", "0.6941422", "0.6887695", "0.6795558", "0.6790847", "0.6751094", "0.67293686", "0.66874146", "0.6669162", "0.66679835", "0.66592574", "0.6632466", "0.6621493", "0.6619...
0.7872323
0
Parses a `dataflow` that comes from Pipeline Manager application. If any error during parsing occurs it is returned. If parsing is successful a kenning pipeline is returned.
def parse_dataflow(self, dataflow: Dict) -> Tuple[bool, Union[Dict, str]]: try: interface_to_id = {} graph = dataflow['graph'] for dataflow_node in graph['nodes']: kenning_node = self.nodes[dataflow_node['type']] parameters = dataflow_node['pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(known_args, pipeline_args):\n\n if known_args.testmode:\n pipeline_args.append('--runner=DirectRunner')\n else:\n pipeline_args.append('--runner=DataflowRunner')\n\n pipeline_args.extend([\n '--project={project}'.format(project=known_args.project),\n '--staging_location=gs://{bucket}/sta...
[ "0.5381274", "0.5298463", "0.529222", "0.52800006", "0.527353", "0.51908153", "0.5183692", "0.5180774", "0.51611406", "0.5043725", "0.5026395", "0.50210154", "0.5014848", "0.50018287", "0.4964186", "0.4941819", "0.4929424", "0.49269995", "0.4914601", "0.4909162", "0.49031794"...
0.56391686
0
Creates a node interface based on it's IO specification.
def _create_interface( self, io_spec: Dict[str, List], direction: str ) -> Tuple[str, List]: interface_id = self.gen_id() interface = { 'name': io_spec['name'], 'id': interface_id, 'direction': direction } return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_io_specification(cls, input_memory_layout):\n raise NotImplementedError", "def create_node(name, node_type):\n if node_type in NODE_REGISTRY:\n return Node(name, NODE_REGISTRY[node_type])\n raise TypeError('The specified node type \\'%s\\' could not be found within imagegen.' % node_...
[ "0.59045625", "0.5857854", "0.5843483", "0.5683247", "0.5531639", "0.55212116", "0.55181134", "0.54775643", "0.54457855", "0.5439553", "0.54051954", "0.5403759", "0.53998494", "0.5398486", "0.532775", "0.5324524", "0.5283349", "0.5282323", "0.52801", "0.52639115", "0.5252614"...
0.6250594
0
Build a graph using build_graph and write it out.
def write_graph(build_graph, out_dir): g = ops.Graph() with g.as_default(): build_graph(out_dir) filename = os.path.join(out_dir, 'test_graph_%s.pb' % build_graph.__name__) with open(filename, 'wb') as f: f.write(g.as_graph_def().SerializeToString())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_graph(g, filename):\n with open(filename, 'w') as f:\n f.write(repr(g))", "def generate_graphml_output(self, path):\n self.restructure_edge_info()\n self.restructure_node_info()\n return nx.write_graphml(self.G, path)", "def writeGraph2File(self, file, genGraph=1, isRoo...
[ "0.71535766", "0.70315915", "0.7017146", "0.7010791", "0.6989418", "0.69507116", "0.6915492", "0.6904038", "0.68311703", "0.6816835", "0.67910683", "0.67439765", "0.6684626", "0.6674016", "0.6608328", "0.6574046", "0.65731245", "0.6552922", "0.6521417", "0.6495196", "0.648679...
0.7912126
0
This function prepares code_batch dictionary. If code_x is not provided, it is sampled from gaussian distribution. if code_y is not provided, it is sampled from uniform distribution.
def sample_codes(self, batch_size, code_x=None, code_y=None, name='codes'): with tf.name_scope(name): if code_x is None: code_x = tf.random_normal( [batch_size, self.code_size], mean=0.0, stddev=1.0, name='x', dtype=tf.float32) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_fake_samples_constant_code(generator, code_dim, noise_dim, code, n_samples, available_codes, training_noise_dict):\r\n codes = np.ones(n_samples) * code\r\n z_noise = np.random.choice(training_noise_dict[code], n_samples)\r\n z_input = np.vstack((z_noise, codes)).T\r\n fake_samples = gener...
[ "0.56039685", "0.5368515", "0.5328322", "0.52517796", "0.5246924", "0.5236677", "0.5232409", "0.52232856", "0.5202629", "0.5190905", "0.5181514", "0.51425284", "0.51029456", "0.51024246", "0.5095545", "0.5087024", "0.5078478", "0.5071542", "0.50664866", "0.503014", "0.4989762...
0.6770823
0
client.add(source_id, "graph_string", dest_id || [dest_ids]) => None
def add(self, source, graph, dest): return self.server.execute(self._execute_operation( source, graph, dest, ttypes.ExecuteOperationType.Add))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addN(self, quads, docid = None):\n assert self.__open, \"The Store must be open.\"\n\n graphs = {}\n resources = {}\n json_ld = []\n bnodes = {}\n def skolemize_bnodes(x):\n if isinstance(x, rdflib.Graph):\n x = x.identifier\n if is...
[ "0.57782996", "0.57645124", "0.5678263", "0.56357276", "0.55844986", "0.5577297", "0.55442417", "0.5538991", "0.5526866", "0.55046403", "0.5491278", "0.54716796", "0.5444202", "0.54207504", "0.5402503", "0.5396373", "0.5368343", "0.5333798", "0.5330285", "0.53197736", "0.5313...
0.72241783
0
client.remove(source_id, "graph_string", dest_id || [dest_ids]) => None
def remove(self, source, graph, dest): return self.server.execute(self._execute_operation( source, graph, dest, ttypes.ExecuteOperationType.Remove))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_edge (self, src, dst):\n raise NotImplementedError", "def remove(self, src: int, dst: int) -> None:\n if src and dst is None:\n raise ValueError(\n \"tfgraph and dst must not be None \")\n self.run_tf([tf.scatter_nd_add(self.A_tf, [[src, dst]], [-1.0]),\n tf.scatter_n...
[ "0.639494", "0.6310217", "0.59374446", "0.5924436", "0.58999425", "0.588994", "0.5877113", "0.58621", "0.5828552", "0.582321", "0.5820485", "0.58186555", "0.5806356", "0.5802003", "0.5792036", "0.5788588", "0.57711816", "0.5704145", "0.56630105", "0.5635265", "0.5630829", "...
0.7556235
0
client.get(source_id, "graph_string", dest_id || [dest_ids]) => (edges,)
def get(self, source, graph, dest): return self.get_all([(source, graph, dest)])[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dfs_edges_generator(graph, source, reverse=...):\n ...", "def findDist(digraph, src, dest):\n for i in digraph.edges[src]:\n if i[0]==str(dest):\n result=i[1][0]\n return result", "def extract_edges(graph):\n return graph.get_edges()", "def get_source_and_sink_comps...
[ "0.60261655", "0.59963983", "0.58113366", "0.5743149", "0.5730949", "0.5721694", "0.5713164", "0.56001955", "0.55412", "0.55412", "0.55105543", "0.54830265", "0.54773664", "0.54619676", "0.5453242", "0.5394359", "0.5387668", "0.5368663", "0.5353496", "0.53413177", "0.5340562"...
0.694978
0
client.get_metadata(source,_id, "graph_string") => obj.source_id/state_id/count/updated_at
def get_metadata(self, source, graph): return self.server.get_metadata(source, self.graphs.get(graph))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetMetadata(self):\n return self.dict['meta']", "def test_get_metadata_value(self):\n pass", "def metadata(self):\n raise NotImplementedError('yet')\n return OntGraphMetadata(self)", "def graphcall():\n endpoint = config.RESOURCE + config.API_VERSION + '/me'\n http_headers =...
[ "0.53797954", "0.53738403", "0.53004766", "0.5293672", "0.5271952", "0.5241413", "0.5234683", "0.51998305", "0.5182546", "0.51796687", "0.510493", "0.51042455", "0.5066971", "0.5054483", "0.5026037", "0.50197023", "0.4987349", "0.49867707", "0.4975231", "0.4973664", "0.497249...
0.6778714
0
Fit the classifier using the generator gen that yields batches as specified. This function is not supported for this detector.
def fit_generator(self, generator: "DataGenerator", nb_epochs: int = 20, **kwargs) -> None: raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, X, y):\n self.classifiers = []\n self.label_count = len(y[0])\n self.sample_models()\n for i in xrange(self.model_count):\n classifier = copy.deepcopy(self.classifier)\n y_subset = self.generate_data_subset(y,self.label_sets[i])\n classifie...
[ "0.6952053", "0.6919419", "0.6806383", "0.6796326", "0.6766061", "0.6751881", "0.67230767", "0.6698017", "0.6644409", "0.66092247", "0.6607565", "0.65447646", "0.6498409", "0.6497064", "0.64770544", "0.64399123", "0.6420713", "0.6365073", "0.63567495", "0.63563246", "0.634964...
0.7124096
0
Return the sequential id for this test for the passed in client
def sequential_id(self, client): if client.client_id not in self._sequential_ids: id_ = sequential_id("e:{0}:users".format(self.name), client.client_id) self._sequential_ids[client.client_id] = id_ return self._sequential_ids[client.client_id]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_id(self):\n result = self.test_client.id\n\n assert result == \"10423098\"", "def test_id(self):\n result = self.test_client.id\n\n assert result == \"86576599\"", "def client_id(self) -> str:", "def client_id(self) -> str:\n return pulumi.get(self, \"client_id\")"...
[ "0.7615263", "0.7568501", "0.70711666", "0.69174904", "0.69174904", "0.69174904", "0.68759865", "0.68759865", "0.68759865", "0.68759865", "0.68759865", "0.68759865", "0.68759865", "0.68759865", "0.68759865", "0.68759865", "0.68759865", "0.6854908", "0.67177993", "0.6639061", ...
0.8105151
0
Constructs the nodes and edges of a section using a mapping of section data, and returns a reference to those nodes and edges in a sequence. Does not construct junction nodes/edges.
def build_section(self, section_map): section = [] for coordinate_map in section_map['shape']: vertex = self.graph.add_vertex() # Build a property map containing the geolocation, speed, ID, and bearing. self.node_locations[vertex] = [coordinate_map['lon'], coordinate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_sections(self):\n\t\t# NOTE: cell=self is required to tell NEURON of this object.\n\t\tself.node = [h.Section(name='node',cell=self) for x in range(self._axonNodes)]\n\t\tself.mysa = [h.Section(name='mysa',cell=self) for x in range(self._paraNodes1)]\n\t\tself.flut = [h.Section(name='flut',cell=self) f...
[ "0.6326445", "0.6172947", "0.5648973", "0.55593157", "0.552109", "0.55089635", "0.53783727", "0.53628623", "0.5326665", "0.52523375", "0.5223305", "0.5199537", "0.5195584", "0.51758087", "0.51749223", "0.51669085", "0.5125043", "0.5103691", "0.50975835", "0.5046222", "0.50212...
0.7277883
0
Adds an edge and node to the end of a section, representing the departure from a section into a junction.
def add_entrance(self, section, junction): assert section # The section may not be an empty sequence. previous_node = section[-1] junction_node = self.graph.add_vertex() # Update property map with the node's geolocation, speed, ID, and bearing. self.node_locations[junction_nod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_exit(self, section, junction):\n assert section # The section may not be an empty sequence.\n\n next_node = section[0]\n junction_node = self.graph.add_vertex()\n\n \"Build a property map containing the geolocation, speed, ID, and bearing\"\n self.node_locations[junction...
[ "0.7257028", "0.60954386", "0.6071044", "0.604721", "0.59209025", "0.58892876", "0.5859711", "0.5826807", "0.5793456", "0.57901484", "0.57751995", "0.5766114", "0.5753708", "0.5656359", "0.5621304", "0.55910957", "0.55749774", "0.55567324", "0.55500954", "0.55364543", "0.5524...
0.69303954
1
Adds an edge and node to the beginning of a section, representing the departure from a junction into a section.
def add_exit(self, section, junction): assert section # The section may not be an empty sequence. next_node = section[0] junction_node = self.graph.add_vertex() "Build a property map containing the geolocation, speed, ID, and bearing" self.node_locations[junction_node] = [junc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_entrance(self, section, junction):\n assert section # The section may not be an empty sequence.\n\n previous_node = section[-1]\n junction_node = self.graph.add_vertex()\n\n # Update property map with the node's geolocation, speed, ID, and bearing.\n self.node_locations[...
[ "0.6625786", "0.57441413", "0.5615292", "0.560601", "0.5529281", "0.54857343", "0.5459787", "0.5456263", "0.53915566", "0.5353584", "0.5341963", "0.53401774", "0.5334562", "0.5331108", "0.5274388", "0.52606386", "0.52531797", "0.5247963", "0.52421486", "0.52242494", "0.522254...
0.629305
1
Increases the number of nodes in the graph by adding new nodes between each edge which carries a weight greater than maximum_distance. The new nodes inherit the attributes of the destination node, unless it is a junction in which case they inherit from the source node.
def split_edges(self, maximum_distance): """ Iterate through the vertices of each section. For each vertex v, evaluate edges for which v is a source. If an edge of weight greater than maximum_distance, then split it. """ for section_id in self.sections: utils.print_progress(len(self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addDistance(graph):\n distanceList = graphCalculate._calculateDistance(graph)\n for dist, edge in zip(distanceList, graph.edges(data=True)):\n edge[2]['distance'] = dist", "def equalize_node_density(self, maximum_distance, maximum_angle_delta, greedy=True):\n print('network: s...
[ "0.6095217", "0.6066469", "0.59955007", "0.587002", "0.58660376", "0.58612627", "0.5844505", "0.56440455", "0.5642333", "0.5639829", "0.5637137", "0.55744195", "0.5532751", "0.5531616", "0.5505792", "0.55010307", "0.54987645", "0.54917926", "0.5482247", "0.5465443", "0.546045...
0.61364716
0
Computes the total change in angle is given by calculating the sum of the difference in angle between each vertex pair.
def total_edge_angle(e1, e2): e1_source = section.index(e1[0]) e2_target = section.index(e2[1]) """ Given a pair of vertices, call angle_delta between them. """ f = lambda pair: utils.angle_delta(self.node_heading[pair[0]], self.node_heading[pair[1]]) """ Ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_angle(v1, v2, v3):\n v1 = v1 - v2\n v3 = v3 - v2\n return v1.angle(v3)", "def calculate_angle(opp, adjacent):\n return math.degrees(math.atan((opp / adjacent)))", "def angle(self) -> float:\n ...", "def angle_diff(self, i):\n (h0, k0, l0) = [int(np.rint(x)) for x in self.hk...
[ "0.64207923", "0.6239662", "0.6238178", "0.62220424", "0.62130904", "0.61082965", "0.5996338", "0.5979163", "0.59753376", "0.5924639", "0.5920839", "0.5915086", "0.58997065", "0.5899426", "0.5886293", "0.5878227", "0.57676476", "0.57654905", "0.57335705", "0.5728126", "0.5726...
0.672861
0
Compute the total distance traversed by two adjacent edges, either of which might be compound edges.
def total_edge_length(e1, e2): return cumulative_edge_length(e1) + cumulative_edge_length(e2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_distance(self, node1, node2):\n if node1 == node2:\n return 0.0\n for i, (n1, n2) in enumerate(zip(self.paths[node1], self.paths[node2])):\n if n1 != n2:\n break\n else:\n i = min(len(self.paths[node1]), len(self.paths[node2]))\n ...
[ "0.67926395", "0.67865", "0.673719", "0.6647653", "0.65871346", "0.65646225", "0.6517104", "0.6510719", "0.6460144", "0.645926", "0.64384097", "0.6416402", "0.6408104", "0.6402361", "0.63905793", "0.6374769", "0.63597757", "0.63467425", "0.63241124", "0.6310525", "0.6296967",...
0.7246124
0
Determines if a merge is allowable. A merge is allowable if... the target of the first edge is the source of the second edge (they are adjacent) length(e1) + length(e2) < minimum_distance delta(bearing_1, bearing_2) + delta(bearing_2, bearing_3) < maximum_angle_delta
def permissible(e1, e2): return e1[1] == e2[0] and \ total_edge_length(e1, e2) < maximum_distance and \ total_edge_angle(e1, e2) < maximum_angle_delta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_merge( group1, group2, target_dir, max_list_size, split_toplevel=True ):\n if len( group1 ) <= 0 or len( group2 ) <= 0:\n return True\n if ( lsize( group1 ) + lsize( group2 ) ) <= max_list_size:\n return ( not split_toplevel ) or toplevel_subdir( group1[0].path, target_dir ) == toplev...
[ "0.60358053", "0.58441794", "0.57616156", "0.57503325", "0.5732198", "0.57282776", "0.57196575", "0.5693033", "0.56803364", "0.56803364", "0.56756544", "0.56436515", "0.5637631", "0.55444276", "0.5542877", "0.55092204", "0.5464913", "0.5463189", "0.5462968", "0.54602313", "0....
0.58866096
1
Merges edges e1 and e2 together. An edge is a sequence where the first two elements are [source, target]. An edge may have additional elements.
def merge(e1, e2): assert permissible(e1, e2) return [e1[0], e2[1], None] # A merged edge has not been added, so it has no ID.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, v1, v2):\n pass # TODO", "def add_edge(self, node1: Node, node2: Node):\n self.__add_edge(node1, node2)\n self.__add_edge(node2, node1)", "def e(src, dst):\n edge = pydot.Edge(src, dst)\n graph.add_edge(edge)", "def _append_source_and_target(self, graph):\n g...
[ "0.65857697", "0.6536037", "0.64098305", "0.63119984", "0.6236003", "0.6228107", "0.61946976", "0.61817974", "0.6142903", "0.61362994", "0.6070242", "0.60662323", "0.60038453", "0.5995417", "0.59614384", "0.59572506", "0.5942834", "0.5903284", "0.5892013", "0.58893585", "0.58...
0.76180565
0
Find a path between two sections.
def find_section_path(self, section_id1, section_id2): result = graph_tool.topology.shortest_path( self.graph, self.sections[str(section_id1)][0], self.sections[str(section_id2)][-1], weights=self.edge_weights) edges = result[1] for edge in edges: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_path(self, start, end, path=[]):\n path = path+[start]\n if start == end:\n return path\n for node in self.graph[start]:\n if node not in path:\n newpath = self.find_path(node, end, path)\n if newpath:\n return new...
[ "0.6534203", "0.62061375", "0.6198344", "0.6135417", "0.6104496", "0.595805", "0.5940553", "0.5831767", "0.57553416", "0.5648884", "0.5589624", "0.5588844", "0.55513805", "0.54625386", "0.54624957", "0.545751", "0.54531103", "0.5341289", "0.5298588", "0.52980375", "0.5296688"...
0.77597976
0
Find the vertices and edges in a path between two vertices.
def find_vertex_path(self, vertex_id1, vertex_id2, as_network_object): v1 = self.graph.vertex(vertex_id1) v2 = self.graph.vertex(vertex_id2) vertices, edges = graph_tool.topology.shortest_path(self.graph, v1, v2, weights=self.edge_weights) if v1 == v2: vertices = [v1, v1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all_path(self, start_vertex, end_vertex, path=[]):\n\n graph = self.__graph_dict\n path = path + [start_vertex]\n if start_vertex == end_vertex:\n return [path]\n\n if start_vertex not in graph:\n return []\n\n paths = []\n for vertex in grap...
[ "0.7329514", "0.7283999", "0.6987896", "0.69515866", "0.6841042", "0.6803832", "0.66505146", "0.6536854", "0.6475874", "0.6376036", "0.6355218", "0.630835", "0.63034046", "0.62733376", "0.6261531", "0.6253476", "0.62175727", "0.6213531", "0.6207917", "0.6200342", "0.61860853"...
0.7495715
0
Given a section ID, returns the exit junction.
def get_exit_junction(self, id): return self.sections[id][-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entrance_junction(self, id):\n return self.sections[id][0]", "def add_exit(self, section, junction):\n assert section # The section may not be an empty sequence.\n\n next_node = section[0]\n junction_node = self.graph.add_vertex()\n\n \"Build a property map containing ...
[ "0.6822769", "0.59332705", "0.5805975", "0.57141274", "0.57141274", "0.5322126", "0.50983816", "0.49157253", "0.4781765", "0.47307342", "0.46997768", "0.46618962", "0.46301967", "0.45927903", "0.45757714", "0.45563766", "0.45235908", "0.44990906", "0.44369406", "0.44302198", ...
0.80073035
0
Given a section ID, returns the exit junction.
def get_entrance_junction(self, id): return self.sections[id][0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_exit_junction(self, id):\n return self.sections[id][-1]", "def add_exit(self, section, junction):\n assert section # The section may not be an empty sequence.\n\n next_node = section[0]\n junction_node = self.graph.add_vertex()\n\n \"Build a property map containing the...
[ "0.8006567", "0.5934267", "0.5802692", "0.57120705", "0.57120705", "0.5319635", "0.50961906", "0.49149528", "0.47821558", "0.4729822", "0.46974754", "0.4664183", "0.46328917", "0.4592097", "0.45744672", "0.4555806", "0.4520674", "0.45023713", "0.4435973", "0.44295722", "0.442...
0.6818978
1
Given a section ID, returns the entrance and exit junctions.
def get_junctions(self, section_id): return self.get_entrance_junction(section_id), self.get_exit_junction(section_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entrance_junction(self, id):\n return self.sections[id][0]", "def get_exit_junction(self, id):\n return self.sections[id][-1]", "def find_section_path(self, section_id1, section_id2):\n result = graph_tool.topology.shortest_path(\n self.graph, self.sections[str(section_i...
[ "0.7172618", "0.64476705", "0.62997204", "0.55667067", "0.5479791", "0.5479791", "0.5467152", "0.48970345", "0.4825514", "0.47968078", "0.47180638", "0.46015504", "0.4597946", "0.45263848", "0.4489687", "0.4456345", "0.44345292", "0.43955576", "0.43824732", "0.4374473", "0.43...
0.7576963
0
Computes the real distance between two vertices, given their vertex IDs.
def vertex_distance(self, v1, v2): return utils.real_distance(self.node_locations[v1], self.node_locations[v2])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(v1, v2):\r\n return magnitude(*subtract(v2, v1))", "def _vector_dist(self, vec1, vec2):\r\n return sqrt(sum([(float(v1) - float(v2)) ** 2 for v1, v2 in\r\n zip(vec1, vec2)]))", "def dist(v1: vect2d, v2: vect2d) -> float:\n d = ((v2.x - v1.x)**2 + (v2.y - v1.y)**2...
[ "0.6689806", "0.6653809", "0.66066384", "0.6561086", "0.6508852", "0.65006506", "0.6498293", "0.6445875", "0.64357215", "0.64178735", "0.638211", "0.6373817", "0.63566583", "0.63436407", "0.63207", "0.63198066", "0.63142335", "0.6303946", "0.6285145", "0.62819755", "0.6276703...
0.7256061
0
Converts a list of vertices to a list of sections
def to_sections(self, path): return list(map(lambda tup: tup[0], groupby(path, key=lambda v_id: self.node_id[v_id])))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edgify(vertices:list)->list:\n edges = []\n for k in range(0, len(vertices) - 1):\n edges.append([vertices[k], vertices[k + 1]])\n return edges", "def segments(self):\n L = len(self.vertices)\n return itertools.chain((self._subset((i,i+1)) for i in range(len(self)-1)),\n ...
[ "0.62259054", "0.58248794", "0.58015734", "0.57692754", "0.5723749", "0.56403744", "0.558485", "0.55455804", "0.5526755", "0.55040306", "0.5496741", "0.5471195", "0.54504377", "0.5447247", "0.54373115", "0.5436795", "0.5432312", "0.54210705", "0.5419155", "0.5418142", "0.5414...
0.6655905
0
Delete an edge edgeNumber Edge number to be deleted
def deleteEdge(self, edgeNumber): edge = self.edgeIndex[edgeNumber] startVertex = edge.startVertex endVertex = edge.endVertex startVertexNumber = startVertex.vertexNumber endVertexNumber = endVertex.vertexNumber vertexIndex = self.vertexIndex parentInde...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_model_deleting_works_properly(self):\r\n e1 = TestEdge.create(self.v1, self.v2, numbers=3)\r\n \r\n e1.delete()\r\n edges = self.v1.outE()\r\n assert len(edges) == 0", "def remove_edge(self, edge: Edge) -> Edge:", "def del_edge(self, n1, n2):\n try:\n ...
[ "0.6917926", "0.6849659", "0.65886813", "0.65401673", "0.6535369", "0.6387603", "0.6386809", "0.6378192", "0.6300792", "0.6283217", "0.62328327", "0.6190903", "0.6176485", "0.6175802", "0.6120432", "0.61198837", "0.6105319", "0.60875857", "0.60776794", "0.6067624", "0.6043449...
0.74511147
0
Deletes a vertex. Should be used with care vertexNumber Vertex number to be deleted
def deleteVertex(self, vertexNumber): del self.vertexIndex[vertexNumber]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_vertex(self, vertex_name):\n for vertex in self.vertices:\n if vertex.name == vertex_name:\n self.vertices.remove_by_value(vertex)\n for vertex in self.vertices:\n vertex.delete_neighbour(vertex_name)", "def delete_vertex(self, key):\n # Delete...
[ "0.7455443", "0.7124412", "0.6877231", "0.6829791", "0.68262553", "0.67984784", "0.67869943", "0.62170804", "0.6129377", "0.61032766", "0.59578913", "0.59241325", "0.5918542", "0.5908069", "0.5893938", "0.5849818", "0.5754613", "0.5712812", "0.5626035", "0.5557595", "0.552380...
0.8689845
0
Get all graph vertex numbers an array consisting of all the vertices numbers
def getVertexNumbers(self): return self.vertexIndex.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertices(self):\n return list(self.__graph.values())", "def vertices(self):\n return list(self._graph)", "def vertices(self):\n return list(self.graph_dict.keys())", "def get_vertices(self):\n return self.graph.keys()", "def vertices(self):\r\n return list(self.__grap...
[ "0.7608723", "0.7587752", "0.7485285", "0.7477596", "0.7420833", "0.7383841", "0.73785895", "0.73764884", "0.73764884", "0.73764884", "0.73442924", "0.7276738", "0.7180534", "0.7058785", "0.7030377", "0.6955908", "0.69398487", "0.6928327", "0.6922639", "0.69173735", "0.690185...
0.779428
0
Get the last edge number __lastEdgeNumber the last edge number assigned to edges.
def getLastEdgeNumber(self): return self.__lastEdgeNumber
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_edge(self):\n return self._edge", "def last_index(self) -> int:\n return self._last_index", "def last_node(self):\n return self._array[self._size-1]", "def get_max(self):\n return self.max[-1]", "def get_last_framenumber(self):\n return self._frame_number", "de...
[ "0.7556472", "0.6783178", "0.6715328", "0.66097325", "0.6586115", "0.65181774", "0.65079015", "0.64952546", "0.6433164", "0.6431386", "0.6372128", "0.6369549", "0.6354774", "0.6353139", "0.63428015", "0.6339895", "0.63355786", "0.62993526", "0.6290487", "0.6267261", "0.626365...
0.8791472
0
Get neighbors for a vertex vertexNumber Vertex number for which neighbors have to be obtained
def getNeighbors(self, vertexNumber): parentIndex = self.parentIndex neighborNumbers = parentIndex[vertexNumber] neighbors = [] for neighborNumber in neighborNumbers: neighbors.append(Vertex(neighborNumber)) return neighbors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_neighbors(self, vertex_id):\n pass # TODO", "def neighbors_in(self, vertex):\n return list(self.neighbor_in_iterator(vertex))", "def get_neighbours(self, vertex):\n output = []\n \n if vertex in self.adjacency_list:\n for neighbour in self.adjacency_list[v...
[ "0.74170166", "0.7049547", "0.6987094", "0.6830533", "0.68224734", "0.67998946", "0.677096", "0.67500776", "0.67500776", "0.67500776", "0.67500776", "0.67500776", "0.67500776", "0.67425364", "0.66493183", "0.6648307", "0.6648307", "0.66254044", "0.6588132", "0.6588132", "0.65...
0.81096107
0
Get number of neighbors for a vertex vertexNumber Vertex number for which number of neighbors have to be obtained Number of neighbors
def getNumberOfNeighbors(self, vertexNumber): return self.__degreeCount[vertexNumber]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkNumNeighbors():", "def num_neighbors(self):\n return self._num_neighbors", "def n_neighbors(self,n):\n return sum(1 for x in self.hex.get_neighbors_ring(n) if x is not None and x.is_occupied == 1)", "def get_neighbors_count(self, atom):\n return self._graph.get_connected_vertice...
[ "0.71318686", "0.7121119", "0.7106842", "0.68900824", "0.6869653", "0.68133", "0.6799557", "0.6777617", "0.67546225", "0.6724507", "0.66827786", "0.66445255", "0.6593691", "0.6583154", "0.6571344", "0.6505484", "0.64901924", "0.6486399", "0.6476767", "0.64468306", "0.6419721"...
0.81819767
0
Get degree distribution degreeDistribution Dictionary indexed on degree. Values are the number of nodes for a degree
def getDegreeDistribution(self): degreeDistribution = {} degreeCount = self.__degreeCount vertexNumbers = self.vertexIndex.keys() for vertexNumber in vertexNumbers: try: numberOfNeighbors = degreeCount[vertexNumber] except KeyError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_degree_distribution(digraph):\n degree_distr = {}\n num_degree = compute_in_degrees(digraph)\n for node in num_degree:\n degree_distr[num_degree[node]] = degree_distr.get(num_degree[node],0) + 1\n return degree_distr", "def in_degree_distribution (digraph) :\n\n in_degree_dist = dict...
[ "0.7860551", "0.75099766", "0.7433562", "0.7404509", "0.740422", "0.73904234", "0.736361", "0.7328416", "0.73258513", "0.7281278", "0.7219032", "0.7219032", "0.71553224", "0.70751774", "0.6981271", "0.68752795", "0.6863816", "0.6769662", "0.6714096", "0.6704316", "0.67020136"...
0.8446572
0
Write the connected components to a file fileName File name to store the connected components allSCC List of list of connected components
def writeCC(self, fileName, allSCC): f = open(fileName,'w') for compNumber in range(0,len(allSCC)): f.write("Component number %s: " % (compNumber)) f.write("%s\n" % (str(allSCC[compNumber]))) f.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def savecomp(comp):\n with open('componentes.gcl', mode='w') as key:\n key.write(str(comp[3])+'\\n'+str(comp[4])+'\\n'+str(comp[5]))", "def write_conformers(self, filename): # ccids):\n cnt = 0\n for confId in range(self.nconf): #ccids:\n w = Chem.SDWriter('%s_c%03d.sdf'%(filen...
[ "0.66767985", "0.6197701", "0.57234114", "0.565026", "0.555533", "0.5550202", "0.5547117", "0.55146474", "0.54847294", "0.5478632", "0.5438539", "0.54345316", "0.5431646", "0.5430078", "0.5356212", "0.53312844", "0.528512", "0.5255513", "0.5249054", "0.5247201", "0.5245371", ...
0.78411525
0
Write edges to file fileName File name to store edges in
def writeEdges(self, fileName, format): edges = self.edgeIndex.values() if format == 'simple': f = open(fileName,'w') for edge in edges: f.write("%s -- %s\n" % (edge.startVertex.vertexNumber, edge.endVertex.vertexNumber)) f.close() elif format ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_edges(\n edges: Mapping[str, Any],\n filename: str,\n jsonlines: bool = False,\n gzipflag: bool = False,\n yaml: bool = False,\n):\n pass", "def write_graph_to_file(self, filename):\n with open(filename, 'w') as f:\n f.write(\"# graph number = 0 name = interval_graph...
[ "0.7056676", "0.69792265", "0.6908125", "0.6893098", "0.6865619", "0.68020445", "0.6794255", "0.67571914", "0.67566097", "0.6735779", "0.6731966", "0.6730126", "0.6727282", "0.6679642", "0.66539913", "0.6630889", "0.6625665", "0.6625665", "0.6525656", "0.6486126", "0.63409156...
0.78400195
0
Read edges from file fileName File name to read edges from
def readEdges(self, fileName, format): f = open(fileName) if format == 'simple': edgesRaw = f.read().split("\n") if edgesRaw[-1] == '': edgesRaw = edgesRaw[:-1] for edge in edgesRaw: [startVertex, endVertex] = edge.split("--") newEdge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_graph(filename):\n return nx.read_edgelist(filename, create_using=nx.DiGraph(), nodetype=str)", "def _read_edge_file(self):\n self.edge_df = gt.remove_colons(pd.read_csv(self.edge_file, dtype=str))", "def read_graph(filename):\n\n print(\"\\n\\n========== Loading graph: \" + filename + '=...
[ "0.7586688", "0.71611387", "0.7030448", "0.7000342", "0.6986807", "0.69693214", "0.69566387", "0.6868951", "0.6800026", "0.67323667", "0.67020416", "0.66746145", "0.6653586", "0.6648884", "0.66487247", "0.6610943", "0.6596535", "0.65916866", "0.6583764", "0.65805817", "0.6565...
0.804204
0
Find edge with a given edge number edgeNumber Edge number to look for
def findEdge(self, edgeNumber): try: return self.edgeIndex[edgeNumber] except KeyError: raise EdgeError(edgeNumber, ErrorMessages.edgeNotFound)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findEdge(self,edge,param):\r\n\t\t\r\n\t\t#TODO: it would be good to find a faster way to \r\n\t\t#do this,ie, to hash by parameter or sort instead\r\n\t\t#of looping through all\r\n\t\t\r\n\t\tfor n in self.edges[edge].values():\r\n\t\t\tif param >= n.p1 and param <= n.p2:\r\n\t\t\t\treturn n;\r\n\t\t\r\n\t\t...
[ "0.7012414", "0.6170609", "0.6108618", "0.6028481", "0.59747356", "0.5963117", "0.59520555", "0.5949649", "0.590151", "0.58796245", "0.5835875", "0.5809034", "0.5804233", "0.57642615", "0.56946117", "0.5665985", "0.5650194", "0.5612303", "0.5564996", "0.5557837", "0.55258656"...
0.7627934
0
Find vertex with a given vertex number vertexNumber Vertex number to look for
def findVertex(self, vertexNumber): try: return self.vertexIndex[vertexNumber] except KeyError: raise VertexError(vertexNumber, ErrorMessages.vertexNotFound)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vertex(self, n):\n #returns the vertex if it is in the graph\n if self.vert_list[n] != None:\n return self.vert_list[n]\n else:\n raise KeyError(\"It would appear the vertex you are searching for does not exist\")", "def search_vertex(ls, vertex):\n for idx i...
[ "0.7443542", "0.7378228", "0.69175625", "0.6667672", "0.65189385", "0.6512487", "0.6432812", "0.6322145", "0.6293682", "0.62505054", "0.618724", "0.61007744", "0.60908926", "0.6003493", "0.6001514", "0.5997934", "0.5984903", "0.5906147", "0.5894773", "0.58663774", "0.5863817"...
0.79939896
0
Checks if vertex is present vertexNumber Vertex number of the vertex to check 0 if found. 1 if not found
def hasVertex(self, vertexNumber): try: rs = self.findVertex(vertexNumber) return 0 except VertexError, e: return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findVertex(self, vertexNumber):\n try:\n return self.vertexIndex[vertexNumber]\n except KeyError:\n raise VertexError(vertexNumber, ErrorMessages.vertexNotFound)", "def contains_vertex(self, vertex_name: n):\n return vertex_name in self._graph.keys()", "def addVer...
[ "0.6863727", "0.6382592", "0.62019235", "0.61812454", "0.615458", "0.60068333", "0.5919511", "0.5910919", "0.58352286", "0.5816891", "0.5815018", "0.5808216", "0.5808216", "0.57568246", "0.57512385", "0.57203674", "0.5701726", "0.5694227", "0.5689005", "0.5617341", "0.5612347...
0.81352335
0
Returns an extra keyword arguments dictionary that is used with the `add_item` call of the feed generator. Add the 'tags' field of the Page, to be used by the custom feed generator.
def item_extra_kwargs(self, obj): result = {'tags':obj.get_meta_keywords(), 'short_description':obj.get_meta_description()[:90] if obj.get_meta_description() else '', 'image_url':''} try: page_rss_feed = PageRSSFeed.objects.get(page=obj) result...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_extra_args(self):\n pass", "def addPage(self, name, page, **attrs):\n page.globalConfig = self.globalConfig\n page.pageConfig['pageName'] = name\n self.globalConfig.pageList.append(name)\n self.globalConfig.pageAttributes[name] = dict(attrs)\n setattr(self,name,p...
[ "0.5984139", "0.570035", "0.5559413", "0.54578155", "0.5355853", "0.53220266", "0.52179086", "0.5201268", "0.51696575", "0.5129199", "0.510419", "0.50985706", "0.5080326", "0.50629073", "0.5058627", "0.5046125", "0.5038361", "0.5032351", "0.503015", "0.502017", "0.5015073", ...
0.7154709
0
Just pass table_widget object, and all rows will be deleted
def delete_all_rows(table_widget: QTableWidget): row_count = table_widget.rowCount() table_widget.setSelectionMode(QAbstractItemView.ExtendedSelection) setSel(list(range(row_count)), table_widget) remove_row_all_table(table_widget) table_widget.setSelectionMode(QAbstractItemView.ExtendedSelection)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_rows(self):\n ...", "def _delete (self):\n self._exec ('delete from table_name where id=%(id)s')", "def _delete_table(self, db, table_name):\n pass", "def remove_row(self, row_id):", "def delete_all_rows(self, table):\n sql = f\"DELETE FROM {table}\"\n connectio...
[ "0.69077104", "0.6880675", "0.67890525", "0.67691374", "0.67564994", "0.66747123", "0.6652686", "0.6571734", "0.6547909", "0.65424013", "0.65101016", "0.6483867", "0.6454314", "0.6444184", "0.6444184", "0.6423177", "0.6420589", "0.64070576", "0.6328134", "0.63248354", "0.6316...
0.73659587
0
Normalize facecolor values by vmin/vmax and return rgbcolor strings This function takes a tuple color along with a colormap and a minimum (vmin) and maximum (vmax) range of possible mean distances for the given parametrized surface. It returns an rgb color based on the mean distance between vmin and vmax
def map_face2color(face, colormap, scale, vmin, vmax): if vmin >= vmax: raise exceptions.PlotlyError( "Incorrect relation between vmin " "and vmax. The vmin value cannot be " "bigger than or equal to the value " "of vmax." ) if len(colormap) == 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def floatRgb(mag, cmin, cmax):\n\n try:\n # normalize to [0,1]\n x = float(mag-cmin)/float(cmax-cmin)\n except:\n # cmax = cmin\n x = 0.5\n blue = min((max((4*(0.75-x), 0.)), 1.))\n red = min((max((4*(x-0.25), 0.)), 1.))\n green= mi...
[ "0.6355739", "0.6305222", "0.63000625", "0.62511104", "0.6185546", "0.6176093", "0.606545", "0.6016953", "0.5822575", "0.57824856", "0.5774134", "0.57507443", "0.5727211", "0.5711442", "0.56687313", "0.5645279", "0.56380075", "0.5635395", "0.56177574", "0.5608867", "0.5580502...
0.65537333
0
Refer to FigureFactory.create_trisurf() for docstring
def trisurf( x, y, z, simplices, show_colorbar, edges_color, scale, colormap=None, color_func=None, plot_edges=False, x_edge=None, y_edge=None, z_edge=None, facecolor=None, ): # numpy import check if not np: raise ImportError("FigureFactory._trisur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_trisurf(\n x,\n y,\n z,\n simplices,\n colormap=None,\n show_colorbar=True,\n scale=None,\n color_func=None,\n title=\"Trisurf Plot\",\n plot_edges=True,\n showbackground=True,\n backgroundcolor=\"rgb(230, 230, 230)\",\n gridcolor=\"rgb(255, 255, 255)\",\n zerol...
[ "0.7060444", "0.5570508", "0.54913974", "0.5388143", "0.5310718", "0.52952105", "0.5241994", "0.52118146", "0.51613504", "0.5085663", "0.49975595", "0.49586868", "0.49517468", "0.48795164", "0.48657578", "0.4858447", "0.48466435", "0.4826225", "0.48213544", "0.48134583", "0.4...
0.6264887
1
Convenience function to report some broadcasted EphIDs
def report_broadcasted_ephids(name, app): ephids = [ephid.hex() for ephid in app.current_ephids] print("{} broadcasts [{}, {}, ...]".format(name, ephids[0], ephids[1]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_experiment_phn_info():\n phone_list = ['##', 'aa', 'ae', 'ao', 'aw', 'ax', 'ay', 'bb', 'br',\n 'ch', 'dd', 'dh', 'eh', 'er', 'ey', 'ff', 'gg', 'hh', 'ih',\n 'iy', 'jh', 'kk', 'll', 'mm', 'ng', 'nn', 'ow', 'oy', 'pp',\n 'rr', 'sh', 'sp', 'ss', 'th', 'tt'...
[ "0.5641883", "0.52146614", "0.5167297", "0.5061556", "0.49849737", "0.49358165", "0.48763213", "0.48617208", "0.48617208", "0.48337263", "0.48261157", "0.48258424", "0.47985873", "0.4784133", "0.476962", "0.47676858", "0.47603318", "0.47315216", "0.47315192", "0.47225633", "0...
0.80313206
0
Returns the builder for the target class, what you want to predict
def target_builder(self): return object_loader.get('target_builder')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBuilder():", "def build_model():", "def getBuilder(name):", "def getBuilder(name):", "def do_new(self, args):\n model_name = questionary.text(\"Target name:\").ask()\n model_name = model_name.replace(\" \", \"\")\n\n available_frameworks = list(CFState.get_instance().loaded_frameworks.keys(...
[ "0.6686732", "0.60648537", "0.60176766", "0.60176766", "0.5986701", "0.59617466", "0.5923246", "0.5900478", "0.5851888", "0.5778412", "0.57747024", "0.5771202", "0.57694954", "0.5753663", "0.57424885", "0.57155466", "0.5707933", "0.5707933", "0.5702985", "0.5695671", "0.56590...
0.6826123
0
Consume lines upon matching a criterion. Returns (consensuswithoutfirstline, firstline) if end_of_field(firstline) returns True, else returns (consensuswithfirstline, None)
def scrap(consensus, end_of_field): if b'\n' not in consensus: return consensus, None line, remaining = consensus.split(b'\n', 1) if end_of_field(line): return consensus, None return remaining, line
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_line(self, line):\n columns = line.split('|')\n\n if len(line) == 0 or len(columns) < 16:\n return None # empty line or malformed line\n\n cmte_id, name, zip_code = columns[0], columns[7], columns[10][:5]\n transaction_dt, transaction_amt = columns[13], columns...
[ "0.56625706", "0.55481184", "0.54639757", "0.54456925", "0.5416383", "0.53174317", "0.53029203", "0.52963674", "0.52418363", "0.5232009", "0.5228834", "0.52143353", "0.5143357", "0.5128375", "0.50272465", "0.5021245", "0.5010465", "0.5010465", "0.49809405", "0.4980618", "0.49...
0.72046185
0
Take Torformatted named ranges, then returns a keywordbased dictionary of list of integers or mix of integers and range tuples (as returned by parse_range_once), expanded or not.
def parse_ranges(ranges, expand=True): pairs = ranges.split(' ') content = {} for key, value in [pair.split('=') for pair in pairs if '=' in pair]: content[key] = parse_range_once(value, expand) return content
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_numeric_word_range(\n names: str, from_: int, to_: int = None, step: int = 1\n) -> pp.MatchFirst:\n\n def define_numeric_word(nm: str, val: int):\n return pp.CaselessKeyword(nm).add_parse_action(lambda: val)\n\n names = names.split()\n if to_ is None:\n to_ = from_\n values ...
[ "0.61373496", "0.60764265", "0.60685986", "0.5994778", "0.59931386", "0.5766354", "0.5742473", "0.5733436", "0.5689746", "0.5685166", "0.5678069", "0.56762993", "0.56722933", "0.56311953", "0.5627335", "0.5601042", "0.5601042", "0.5601042", "0.5601042", "0.5574036", "0.555788...
0.7209257
0
Take Torformatted parameters, then returns a keywordbased dictionary of integers.
def parse_params(params): pairs = params.split(' ') content = dict() for key, value in [pair.split('=') for pair in pairs]: content[key] = int(value) return content
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cmd_params_to_dict(params):\n return {t[0]: t[1] for t in params}", "def internal_values(self) -> Dict[str, Union[int, float]]:\n return {name: self.hyperparams[name][1] for name in self.names()}", "def get_params(self):\n return {\"d\": \"155\"}", "def params_commandline(lista):\n i...
[ "0.60945463", "0.60826254", "0.60622036", "0.60351175", "0.59806514", "0.5945806", "0.5841221", "0.5836121", "0.5818292", "0.57963246", "0.57784796", "0.5776802", "0.57602525", "0.5729591", "0.5719634", "0.57064015", "0.57049423", "0.5680224", "0.56789863", "0.5670259", "0.56...
0.6446185
0
Consume consensus headers if present, then returns the remaining input to be further processed and a set of headers (or None, if none present).
def consume_headers(consensus, flavor='unflavored', sanity=True): if flavor not in ['unflavored', 'microdesc']: raise NotImplementedError( 'Consensus flavor "{}" not supported.'.format(flavor)) whitelist = [ b'network-status-version', b'vote-status', b'consensus-method', b'v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consume_http(consensus):\n def end_of_field(line):\n return line[-1:] != b'\\r'\n\n fields = dict(headers=dict())\n valid = False\n while True:\n consensus, header = scrap(consensus, end_of_field)\n if header is None:\n return consensus, fields if valid else None\n\n...
[ "0.60711914", "0.59664035", "0.59197897", "0.5692224", "0.5632385", "0.5602984", "0.5549503", "0.5511029", "0.5501737", "0.5477403", "0.5417068", "0.53882945", "0.5374378", "0.5373171", "0.53586024", "0.53322047", "0.5323661", "0.5319351", "0.529788", "0.52645785", "0.5263623...
0.70424783
0
Consume consensus footer if present, then returns the remaining input to be further processed and a set of footers (or None, if none present).
def consume_footer(consensus, flavor='unflavored', sanity=True): if flavor not in ['unflavored', 'microdesc']: raise NotImplementedError( 'Consensus flavor "{}" not supported.'.format(flavor)) whitelist = [ b'directory-footer', b'bandwidth-weights', b'directory-signature'] def ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_footer(self): # -> tuple[list[Unknown], str]:\n ...", "def parse_footer(self): # -> tuple[list[Unknown], str]:\n ...", "def parse_footer(self):\n lines=self.lines\n bodyfinish=re.compile(r\"</body>\", re.IGNORECASE).search(lines).span()[0]\n self.footer=lines[bodyfi...
[ "0.63678926", "0.63678926", "0.62331396", "0.60654324", "0.5765358", "0.5568215", "0.53039014", "0.5289612", "0.5167745", "0.5153075", "0.5141", "0.50676244", "0.5013932", "0.5013932", "0.49907497", "0.49868968", "0.49286976", "0.48803014", "0.48659173", "0.48652282", "0.4812...
0.71369654
0
Parse a raw consensus with the given flavor, then returns a sanitized JSONified version (or an equivalent python dictionary if needed).
def jsonify(consensus, flavor='unflavored', encode=True, sanity=True): fields = dict(flavor=flavor) consensus, http = consume_http(consensus) if http is not None: fields['http'] = http consensus, headers = consume_headers(consensus, flavor, sanity) if headers is not None: fields['h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consume_routers(consensus, flavor='unflavored', sanity=True):\n if flavor not in ['unflavored', 'microdesc']:\n raise NotImplementedError(\n 'Consensus flavor \"{}\" not supported.'.format(flavor))\n\n if flavor == 'unflavored':\n whitelist = [b'r', b'm', b's', b'v', b'pr', b'w',...
[ "0.562026", "0.5465906", "0.5228372", "0.5087735", "0.49450284", "0.48848748", "0.48003247", "0.47126365", "0.4702446", "0.46968877", "0.46968877", "0.46640414", "0.46449172", "0.46417078", "0.46161187", "0.460198", "0.46005657", "0.4551025", "0.45269686", "0.45176807", "0.45...
0.64542854
0
More tests for save and reload
def test_save_reload(self): base = BaseModel() idd = base.id base.name = "betty" base.save() storage.reload() key = "BaseModel.{}".format(idd) objs = storage.all()[key] self.assertTrue(hasattr(objs, "name")) self.assertTrue(objs.name == "betty") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_save(self):", "def test_save(self):", "def test_reload_method(self):\n\n self.assertTrue(models.storage.reload() is None)", "def test_save_and_load(self):\n with test_util.TempDirectory() as f:\n self.model.save(f)\n self.model = tc.load_model(f)\n\n tr...
[ "0.7459888", "0.7459888", "0.7331689", "0.73310554", "0.7214134", "0.7141441", "0.7137338", "0.71144754", "0.7067591", "0.703387", "0.6964054", "0.6783614", "0.6783614", "0.6783614", "0.6783614", "0.6783614", "0.6756532", "0.6748529", "0.67375857", "0.6727264", "0.67183644", ...
0.7832448
0
Use the estimate for A to construct analytic model.
def analytic_model(ell,A_est,slope): return total_Cl_noise(ell)+A_est*ell**(-slope)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ModelEstimation(data, S, A):\n\n counts_sas = np.zeros((S,A,S))\n counts_sa = np.zeros((S,A))\n R_est = np.zeros((S,A))\n P_est = np.zeros((S,A,S))\n for traj in data:\n for sample in traj:\n (s,a,r,s_next) = sample\n counts_sa[s,a] += 1\n counts_sas[s,a,...
[ "0.5967721", "0.58632183", "0.5861299", "0.5823863", "0.5685751", "0.5569206", "0.55685025", "0.55622756", "0.55434877", "0.55372214", "0.55326265", "0.55070764", "0.54797685", "0.54747623", "0.5457769", "0.5451337", "0.5446178", "0.5435037", "0.54329354", "0.54243225", "0.54...
0.6628028
0
Given two sets of ra/dec's return median difference in degrees. The first is the reference.
def check_astrometry(ra1,dec1,ra2,dec2,pt_size=0.3): ra_diff = ra2-ra1 dec_diff = dec2-dec1 ra_med_diff = np.median(ra_diff) dec_med_diff = np.median(dec_diff) return ra_med_diff, dec_med_diff
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mdiff(x):\n return ma.median(ma.diff(x))", "def calc_ra_dec():\n \n pos_str = source['ra_hms'].val + \" \" + source['dec_dms'].val\n pos_str = re.sub(r'[,:dhms]', ' ', pos_str)\n args = pos_str.split()\n\n if len(args) != 6:\n raise ValueError(\"Input source position '%s' needs 6 val...
[ "0.60086775", "0.59513265", "0.5949132", "0.5938339", "0.58688223", "0.58204025", "0.5813034", "0.57762396", "0.57626474", "0.57608783", "0.57595474", "0.56784165", "0.56722087", "0.5671501", "0.5659303", "0.563309", "0.56262964", "0.5607121", "0.5603749", "0.5541154", "0.553...
0.7052813
0
Given a list [g,r,z] magnitudes, apply the cut and return an indexing boolean vector.
def FDR_cut(grz): g,r,z=grz; yrz = (r-z); xgr = (g-r) ibool = (r<23.4) & (yrz>.3) & (yrz<1.6) & (xgr < (1.15*yrz)-0.15) & (xgr < (1.6-1.2*yrz)) return ibool
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_response_weights_vector(zenith,azimuth,binsize=5,cut=57.4):\n\n # assuming useful input:\n # azimuthal angle is periodic in the range [0,360[\n # zenith ranges from [0,180[ \n # checking azimuth range (can be exactly 360?)\n azimuth[azimuth == 360] -= 0.01\n \n # check which pixel (ind...
[ "0.521971", "0.509759", "0.5082711", "0.5072972", "0.5066906", "0.50294566", "0.50115013", "0.49336937", "0.49336937", "0.48923323", "0.48779804", "0.48694667", "0.48394978", "0.47827396", "0.4778929", "0.4778221", "0.4775203", "0.47593403", "0.47533178", "0.4749747", "0.4712...
0.57625973
0