query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Construct from a string.
def __init__(self, url): self.scheme, self.netloc, self.path, self.params, self.query, self.fragment = urlparse.urlparse(url) self.args = dict(cgi.parse_qsl(self.query))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_str(cls, string):", "def from_string(cls, string):\n normalised = cls.normalise_string(string)\n return cls.from_normalised_string(normalised)", "def from_str(cls, s):\n raise NotImplementedError", "def fromString(cls, string):\n raise NotImplementedError(\n 'f...
[ "0.85356504", "0.81620204", "0.80366236", "0.7843013", "0.75405395", "0.7214952", "0.71933556", "0.71382374", "0.70977336", "0.708849", "0.70854414", "0.69782305", "0.6877925", "0.6861888", "0.68387073", "0.68277013", "0.6827524", "0.68031204", "0.67619115", "0.6694249", "0.6...
0.0
-1
Turn back into a URL.
def __str__(self): self.query = urllib.urlencode(self.args) self.query = urllib.unquote(self.query) return urlparse.urlunparse((self.scheme, self.netloc, self.path, self.params, self.query, self.fragment))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_url(self):\n ...", "def _get_url(self, absolute):", "def getURLForThing(thing):", "def url_python(name):\n\n return reverse(name)", "def make_linkback_url(self, entity_id, linkback_url=LINKBACK_URL):\n return urljoin(self.reaqta_url, linkback_url.format(entity_id))", "def encod...
[ "0.7465716", "0.67603785", "0.66695213", "0.6654594", "0.6653037", "0.6630416", "0.66212803", "0.6593365", "0.65877587", "0.6565282", "0.65167004", "0.6515478", "0.65044045", "0.63881636", "0.63784254", "0.6364418", "0.6336821", "0.6325689", "0.62948734", "0.6294366", "0.6294...
0.0
-1
Safe conversion of page to utf
def __init__(self, page): try: self.page = page.encode("utf8") except UnicodeDecodeError: self.page = page.decode('iso-8859-1').encode('utf8')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertFromUnicode(content):\n return content", "def process_page(page):\n content = utils.any2unicode(page, 'utf8').strip()\n content = re.sub(r\"[^a-zA-Z]\", \" \", content)\n \n return content", "def fix_unicode_encode_error(cls, safe=False):\n from .path9 import Path\n from...
[ "0.65442806", "0.6308765", "0.62095857", "0.6024676", "0.59617436", "0.5852157", "0.58336884", "0.5832144", "0.5830336", "0.5777034", "0.5749223", "0.5742238", "0.5740002", "0.57341146", "0.57124454", "0.56925076", "0.5677184", "0.5604121", "0.5572304", "0.5555498", "0.555383...
0.64852524
1
Convert page to str
def __str__(self): return str(self.page)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_to_string(page, alph):\n s = ''\n links = Measurements.get_all_links(page)\n for l in links:\n s += alph[l]\n return s", "def process_page(page):\n content = utils.any2unicode(page, 'utf8').strip()\n content = re.sub(r\"[^a-zA-Z]\", \" \", content)\n \n ...
[ "0.72416747", "0.6311964", "0.61297363", "0.61254025", "0.6117378", "0.6117378", "0.5759532", "0.5716281", "0.5664423", "0.5635445", "0.5631912", "0.5611601", "0.55995196", "0.5591691", "0.5526723", "0.551222", "0.5453172", "0.5440903", "0.5410642", "0.54025006", "0.5399925",...
0.68699765
1
Read the table with a TextField but not using it
def handle(self, *args, **options): fname = sys.argv[-1:][0] with open(fname, 'rb') as csvfile: spamreader = csv.reader(csvfile, delimiter=',') for row in spamreader: OsmUser.objects.get_or_create(osm_uid=row[0], user...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, reader, font, tableDict):\n raise NotImplementedError(self)", "def read_table(self, table):\n return READ_TABLE(table, db=self.db)", "def read_table_data(self, table):\n data = []\n index = 0\n for row in table.rows:\n data.append([])\n fo...
[ "0.62954724", "0.62869", "0.5819639", "0.5769961", "0.5718858", "0.5705405", "0.56715155", "0.55771077", "0.54952884", "0.54704595", "0.5406692", "0.5393933", "0.53732544", "0.53460866", "0.53425133", "0.53248733", "0.53228766", "0.5319017", "0.53152037", "0.52845067", "0.528...
0.0
-1
Create the association rules
def generateRules(L, support_data, min_confidence=0.5): rules = [] for i in range(1, len(L)): for freqSet in L[i]: H1 = [frozenset([item]) for item in freqSet] if (i > 1): rules_from_conseq(freqSet, H1, support_data, rules, min_confidence) else:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateAssociationRule(freqSet):", "def _populate_rules(self,rules):\n rule2_index = {}\n for rule in rules:\n relation = rule.get_attribute('relation')[0] # vals are now lists\n ##: Time signals of IS_INCLUDED should not be used in relative time evaluation. They may cau...
[ "0.7194264", "0.64298874", "0.62917304", "0.6201002", "0.6114039", "0.6044059", "0.5934298", "0.58875114", "0.58138055", "0.5782265", "0.57409334", "0.57329404", "0.5725848", "0.5725742", "0.56868804", "0.5658817", "0.5649701", "0.560628", "0.5596754", "0.5576119", "0.5553087...
0.0
-1
Returns the type of applying the binary operator with the current type and the type of the right operand, or returns None if the operation is not valid
def binop_type(cls, op, right_type): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_operation(\n statement: ast.BinOp,\n) -> Optional[Union[int, float, str, bytes]]:\n if isinstance(statement.left, ast.BinOp):\n left = evaluate_operation(statement.left)\n else:\n left = evaluate_node(statement.left)\n\n if isinstance(statement.right, ast.BinOp):\n rig...
[ "0.6980014", "0.6376216", "0.63047373", "0.6289566", "0.6168144", "0.5986405", "0.594299", "0.5919433", "0.59048015", "0.58846456", "0.58320713", "0.5771884", "0.5764865", "0.5709627", "0.57065237", "0.56597155", "0.5610864", "0.5607209", "0.55886", "0.5584397", "0.5579483", ...
0.7616685
0
Returns the type of applying the unary operator to the current type
def unaryop_type(cls, op): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unary_operator(op):\n # Only negate is currently supported for all our possible input types.\n valid_ops = {'-'}\n if op not in valid_ops:\n raise ValueError(\"Invalid unary operator %s.\" % op)\n\n def unary_operator(self):\n # This can't be hoisted up a scope because the types retur...
[ "0.7026326", "0.62878203", "0.62745595", "0.6230687", "0.61832154", "0.6153777", "0.6153615", "0.6035553", "0.60099876", "0.5954016", "0.59390163", "0.5836451", "0.58051866", "0.5675768", "0.56312513", "0.55480313", "0.55199814", "0.5483337", "0.54803765", "0.5456091", "0.539...
0.73739296
0
Ensure that pytest's config.option.verbose is <= 0.
def nonverbose_config(config) -> Generator[None, None, None]: if config.option.verbose <= 0: yield else: saved = config.option.verbose config.option.verbose = 0 yield config.option.verbose = saved
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_valid_verbose(verbose: Any) -> None:\n check_verbose(verbose)", "def test_verbose_non_bool_error(self):\n\n with pytest.raises(ValueError):\n\n BaseTransformer(verbose=1)", "def test_invalid_verbose(verbose: Any) -> None:\n with pytest.raises(ValueError, match=r\".*Invalid verb...
[ "0.72909325", "0.7116359", "0.69435227", "0.67122096", "0.6585893", "0.65532297", "0.65245336", "0.6418826", "0.62999177", "0.62315834", "0.62073755", "0.6173831", "0.6169409", "0.61526793", "0.6150769", "0.6149129", "0.6140586", "0.61110395", "0.6096457", "0.6042438", "0.604...
0.66538364
4
Ensure that settings are restored after test_settings_before.
def test_settings_restored(self) -> None: from django.conf import settings assert TestLiveServer._test_settings_before_run is True # type: ignore[attr-defined] assert ( f"{settings.__class__.__module__}.{settings.__class__.__name__}" == "django.conf.Settings" ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def teardown_function():\n\n # Force module reload as the default test settings have been restored\n importlib.reload(defaults)", "def teardown_method(self, method):\n restore_settings()", "def teardown(self):\n # dump persistent storage to file\n dump_persistent_settings(self.settin...
[ "0.73878825", "0.6784818", "0.6733559", "0.6715742", "0.6488583", "0.6481755", "0.6481755", "0.64424235", "0.64274263", "0.6407588", "0.6295553", "0.6175864", "0.61559063", "0.61030084", "0.609804", "0.6097769", "0.60595536", "0.60365754", "0.6018529", "0.60083866", "0.598593...
0.775121
0
LiveServer always serves statics with ``django.contrib.staticfiles`` handler.
def test_serve_static_with_staticfiles_app(self, django_testdir, settings) -> None: django_testdir.create_test_module( """ from urllib.request import urlopen from django.utils.encoding import force_str class TestLiveServer: def test_a(self, live_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serve_static_files(request, path, insecure=False, **kwargs):\n\n if not settings.DEBUG and not insecure:\n raise Http404\n normalized_path = posixpath.normpath(unquote(path)).lstrip('/')\n absolute_path = finders.find(normalized_path)\n if not absolute_path:\n if path.endswith('/') or...
[ "0.692166", "0.6793395", "0.672456", "0.66780925", "0.6508464", "0.6489936", "0.646022", "0.6422593", "0.6398329", "0.6394773", "0.6379119", "0.6352794", "0.63344926", "0.6232494", "0.6215064", "0.6189717", "0.61667037", "0.6146262", "0.61179745", "0.6043764", "0.60087985", ...
0.70656496
0
Because ``django.contrib.staticfiles`` is not installed LiveServer can not serve statics with django >= 1.7 .
def test_serve_static_dj17_without_staticfiles_app(self, live_server, settings) -> None: with pytest.raises(HTTPError): urlopen(live_server + "/static/a_file.txt").read()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_serve_static_with_staticfiles_app(self, django_testdir, settings) -> None:\n django_testdir.create_test_module(\n \"\"\"\n from urllib.request import urlopen\n\n from django.utils.encoding import force_str\n\n class TestLiveServer:\n def te...
[ "0.6716268", "0.6231927", "0.6190265", "0.61497104", "0.592605", "0.59110135", "0.58870727", "0.5886149", "0.5850551", "0.5821276", "0.5779303", "0.5771501", "0.57279146", "0.57038695", "0.56011933", "0.5590249", "0.55280924", "0.5513304", "0.5501698", "0.5489761", "0.5481401...
0.6403566
1
TextResponse will be not applied by RuleExtractor. Need convert to HtmlResponse
def process_response(request, response, spider): headers = ['text/html; charset=UTF-8', 'text/html; charset=utf-8', 'text/html;charset=UTF-8', 'text/html;charset=utf-8', 'text/html;charset=ISO-8859-1', 'application/xhtml+xml; charset=utf-8'] # log.msg("In Midd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_html_output(self):\n pass", "def get_html(self):\r\n pass", "def _format_response(self, response):\n texts = []\n for result in response.results: \n texts.append(result.alternatives[0].transcript)\n return texts", "def process_response(self, request, res...
[ "0.61386234", "0.59616053", "0.5953273", "0.5924247", "0.5882797", "0.5802751", "0.57943356", "0.5772422", "0.5726808", "0.5726808", "0.5669942", "0.56435025", "0.5613142", "0.55854046", "0.5585026", "0.5578091", "0.55673695", "0.55666703", "0.5552076", "0.553761", "0.5524938...
0.65883505
0
Authenticates and logs in a user to the site using the username and password in POST.
def auth_user(request): username = request.POST['username'] password = request.POST['password'] user = authenticate(username=username, password=password) if user is not None: if user.is_active: login(request, user) url_redirect = reverse('profile:profile', kwargs={'pk': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n args = login_parser.parse_args()\n if request.form:\n username = request.form['username']\n password = request.form['password']\n else:\n username = args['username'] # form['username']\n password = args['password'] # form['password'...
[ "0.80378044", "0.7825943", "0.7822236", "0.78152466", "0.77747136", "0.7735378", "0.772263", "0.7710776", "0.76991826", "0.7623518", "0.76190025", "0.75116575", "0.7507971", "0.7465829", "0.74558264", "0.74076825", "0.73826706", "0.73760235", "0.7357261", "0.73495364", "0.733...
0.0
-1
Tests a given component dataframe for convergence, returning True for converged components
def test_component(self, component_dataframe, ignore_weight=False): # define our acceptable bounds skew_range = [-0.6, 0.6] kurt_range = [-1.5, 0.75] # accept shorter tails for bang-on data weight_low = 0.008 # perform weight test first if not ignored if not ignore_wei...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def converged(self) -> bool:", "def converged(self) -> bool:", "def converged(self) -> bool:", "def has_convergence_delta(self) -> bool:\n return False", "def converged(self) -> bool:\n if self._species is not None and self._species.n_atoms == 1:\n return True # Optimisation 0 DOF...
[ "0.6538666", "0.6538666", "0.6538666", "0.6366643", "0.6296365", "0.605637", "0.58805627", "0.58160526", "0.57632166", "0.5750119", "0.5745037", "0.57065284", "0.5695569", "0.5663899", "0.56550163", "0.5587026", "0.55850583", "0.5548356", "0.553449", "0.5469594", "0.5452946",...
0.6763347
0
Return a copy of the dynamics estimate.
def copy(self): dyn = type(self)(self._hyperparams) dyn.Fm = np.copy(self.Fm) dyn.fv = np.copy(self.fv) dyn.dyn_covar = np.copy(self.dyn_covar) return dyn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return MultivariateDerivative(self.variables.copy())", "def get_estimate(self) -> np.ndarray:\n return self.fit_function(self.x, self.coefficients)", "def estimate(self) -> None:\n pass", "def derivative ( self ):\n return self.__derivative", "def copy(self):\n...
[ "0.65137255", "0.62424964", "0.61908615", "0.59357244", "0.5865188", "0.58616906", "0.58283806", "0.57059515", "0.5626296", "0.562039", "0.56190413", "0.56190413", "0.56011146", "0.5548338", "0.5543138", "0.5528686", "0.54649377", "0.54125106", "0.5405548", "0.540251", "0.539...
0.5863494
6
Copy source file to target, do SWA edits, then add BUILD time stamp.
def GenerateSwaMainHtml(source, target): # Copy source (main.html) file to the target (main.html) file. shutil.copyfile(source, target) # Edit the target file. for line in fileinput.input(target, inplace=True): # Add _SWA <script> tag after the <head> tag. if line.find('<head>') >= 0: print(line...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_script(self):\n copy_source = self.script_file\n copy_dest = os.path.join(self.build_dir, os.path.basename(self.script_file))\n\n logging.debug('Copying {src} to {dst}..'.format(src=copy_source, dst=copy_dest))\n\n shutil.copyfile(\n src=copy_sour...
[ "0.61420363", "0.5990112", "0.58942825", "0.57998633", "0.57883006", "0.5784454", "0.57043713", "0.56820434", "0.5580893", "0.55276066", "0.5526816", "0.5500946", "0.54975355", "0.54962784", "0.5444876", "0.5443569", "0.5413264", "0.5413264", "0.5413264", "0.54041624", "0.540...
0.57934564
4
Take location (code2,code3,country name) return countryName and coords
def locate(location): coord = None country_name = None if location: location = location.lower() for ind, row in country_map.iterrows(): if ( (re.match(r'(.*\W|\W*){}\b'.format(row['code2']), location)) or(re.match(r'(.*\W|\W*){}\b'.format(row['code3']), location...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loc_to_coord(codes):\n def adfilter(codes):\n return re.findall(\"\"\"[a-zA-Z]+, [A-Z]{2}\"\"\", \";\".join(codes))\n\n api_key = \"AIzaSyCxQCjOrHFAf7T-W3vtUYqWkgSFkvMjxN4\"\n\n g = geocoders.GoogleV3(api_key = api_key)\n coords = {\"lat\":[], \"long\":[]}\n for code in adfilter(codes):\n...
[ "0.6872996", "0.6658761", "0.6427587", "0.64248663", "0.6413235", "0.6389267", "0.6352416", "0.6344214", "0.6342886", "0.6201723", "0.61685705", "0.61586225", "0.614145", "0.61208564", "0.6072315", "0.606234", "0.6036042", "0.6028122", "0.6024029", "0.60227036", "0.6012603", ...
0.7792582
0
Read the steering file to gather user inputs from the GUI of pyRiverBed. Parameters are declared as global variables.
def read_steering(): print('+> Trying to read steering file...', end='') try: d = np.loadtxt('steering.txt', delimiter=',', skiprows=1) print(' [done]') except IOError: print('\nNo steering file found') print('Please provide steering file first\n') job_done() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_input(self):\n try:\n path = tkFileDialog.askdirectory()\n if not path: # User the cancelled dialog box so bug out\n return False\n # Search the user-provided path for all the input files.\n foundall, missing = self.files.locate_input(path)...
[ "0.6534614", "0.6480986", "0.6264293", "0.61416334", "0.6109954", "0.5936167", "0.5849614", "0.5842282", "0.5826436", "0.578414", "0.57564574", "0.57386065", "0.5683754", "0.567388", "0.5645699", "0.5645465", "0.5632296", "0.56240624", "0.56231207", "0.55820847", "0.5581234",...
0.68253434
0
Print a table displaying parameters read from the steering file. Require 'tabulate' library.
def print_para_table(s): if MODE == 1: t = [['Parameter', 'Value', 'Unit'], ['Number of bends', NBENDS, '/'], ['Width', WIDTH, 'm'], ['Depth', DEPTH, 'm'], ['Length', LAMBDA*(NBENDS+1), 'm'], ['Arc wavelength', LAMBDA, 'm'], ['Sl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tab_printer(args):\n args = vars(args)\n keys = sorted(args.keys())\n tab = Texttable()\n tab.add_rows([[\"Parameter\", \"Value\"]])\n tab.add_rows([[k.replace(\"_\", \" \").capitalize(), args[k]] for k in keys])\n print(tab.draw())", "def tab_printer(args):\n args = vars(args)\n keys...
[ "0.6731898", "0.6727638", "0.6693523", "0.66596514", "0.66596514", "0.64847577", "0.6466909", "0.63867766", "0.6372735", "0.63454986", "0.6304587", "0.629846", "0.62803787", "0.62803787", "0.62415814", "0.6233019", "0.621662", "0.6205308", "0.61270964", "0.6085865", "0.608106...
0.7408522
0
Print a table displaying mean, median and mode of centerline grid size before and after resampling. Require 'tabulate' library.
def print_resamp_table(mean1, median1, mode1, mean2, median2, mode2): t = [['Streamwise\nresolution', 'Before ' +'After\nresampling --> resampling', '\nUnit'], ['Mean', str(mean1) + ' --> ' + str(mean2), 'm'], ['Median', str(median1) + ' --> ' + str(median2), 'm'], ['Mode', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summarize_as_table(self):\n h = human_readable_size\n h_throughput = human_readable_throughput\n table = [\n ['Total Time (seconds)', '%.3f' % self.total_time,\n self.std_dev_total_time],\n ['Maximum Memory', h(self.max_memory), h(self.std_dev_max_memory)]...
[ "0.6565323", "0.6138334", "0.6114011", "0.6073732", "0.60654634", "0.605878", "0.60337764", "0.60322475", "0.60169584", "0.6001512", "0.59973735", "0.5922056", "0.58799005", "0.58584213", "0.58325213", "0.58321124", "0.5765773", "0.5743075", "0.572621", "0.5705246", "0.567230...
0.7362937
0
Print Kinoshita Curve equation. Only work for Mode 1.
def print_eqn(): if sys.stdout.encoding.lower().startswith('utf'): if JS != 0 and JF != 0: print('Eqn: \u03B8=' + str(np.around(THETA0, decimals=6)) + '*sin(2\u03C0s/' + str(np.around(LAMBDA, decimals=6)) + ')\n +' + str(np.around(THETA0**3, decimals=6)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_kinoshita():\n if MODE != 1:\n return [], [], [], [], []\n print('MODE 1: GENERATE KINOSHITA CURVE FROM EQUATION is selected')\n print('Kinoshita Curve parameters are read from steering file:')\n print_eqn()\n s = np.linspace(0, NBENDS*LAMBDA, int(NBENDS*LAMBDA/DS) + 1)\n print_p...
[ "0.6009057", "0.59244484", "0.57258797", "0.5719299", "0.5606414", "0.5596424", "0.5556299", "0.55449724", "0.5524112", "0.5523874", "0.55117285", "0.5498666", "0.5461777", "0.5460435", "0.5453134", "0.5452214", "0.53886247", "0.5387569", "0.53753626", "0.53699505", "0.536399...
0.6549474
0
Build Kinoshita Curve (noncomputational part). Only work for Mode 1.
def build_kinoshita(): if MODE != 1: return [], [], [], [], [] print('MODE 1: GENERATE KINOSHITA CURVE FROM EQUATION is selected') print('Kinoshita Curve parameters are read from steering file:') print_eqn() s = np.linspace(0, NBENDS*LAMBDA, int(NBENDS*LAMBDA/DS) + 1) print_para_table(s)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_k(self):\n\t\n\tself.k = -np.array([self.sth*self.cphi, self.sth*self.sphi, self.cth])\n\n\treturn", "def createAnisotropicK(powerSpectrum,center,aniso):\n\n if aniso > 1.:\n anisoNew = 1. / aniso\n padDim = int( np.round( powerSpectrum.shape[0] / ( anisoNew ) ) )\n else:\n ...
[ "0.61084265", "0.58661884", "0.5722478", "0.56312686", "0.562919", "0.55858815", "0.558461", "0.5543797", "0.55313665", "0.5458351", "0.5447106", "0.5440787", "0.5429062", "0.5335893", "0.5293114", "0.52813584", "0.5255335", "0.5196818", "0.51894844", "0.5181761", "0.5176679"...
0.73484176
0
Build Kinoshita Curve (computational part). Numba nopyton mode is on. Only work for Mode 1.
def compute_kinoshita(s): length = int(NBENDS*LAMBDA/DS) + 1 x = np.zeros(length) y = np.zeros(length) cur = np.zeros(length+1) theta = THETA0*np.sin(2*np.pi*s/LAMBDA) \ + THETA0**3*(JS*np.cos(6*np.pi*s/LAMBDA) \ - JF*np.sin(6*np.pi*s/LAMBDA)) theta[np.abs(theta)<ZERO] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_kinoshita():\n if MODE != 1:\n return [], [], [], [], []\n print('MODE 1: GENERATE KINOSHITA CURVE FROM EQUATION is selected')\n print('Kinoshita Curve parameters are read from steering file:')\n print_eqn()\n s = np.linspace(0, NBENDS*LAMBDA, int(NBENDS*LAMBDA/DS) + 1)\n print_p...
[ "0.6981509", "0.58476263", "0.56384975", "0.5578285", "0.55455077", "0.55335504", "0.5531249", "0.54656094", "0.5413885", "0.53875285", "0.53695947", "0.53582776", "0.5350835", "0.5343008", "0.533532", "0.5330708", "0.5330406", "0.5329246", "0.5329064", "0.53226274", "0.53211...
0.511144
43
Read river centerline coordinates from userprepared centerline file. Centerline is then resampled to prevent ununiform spacing. Only work for Mode 2.
def read_centerline(s, x, y, cur, theta): if MODE == 2: print('MODE 2: READ YOUR OWN RIVER CENTERLINE FROM FILE is selected') try: centerlinexy = np.loadtxt(FNAME) except IOError: print('\'' + FNAME + '\' not found') print('Please place \'' + FNAME + '\' i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ds9_line(self, center_coordinates, width=20 ):\n for fn in self.images:\n print(fn)\n ff = pyfits.open(fn)\n w = wcs.WCS(ff[0].header)\n co = center_coordinates\n print(co.ra.deg, co.dec.deg )\n #pix = w.wcs_world2pix([co.ra], [co.dec], 0...
[ "0.5484611", "0.54598975", "0.541714", "0.5410985", "0.53711194", "0.5348809", "0.53283346", "0.5277495", "0.5272035", "0.52507305", "0.52339166", "0.5203206", "0.5176077", "0.5174357", "0.5174031", "0.51609975", "0.51548326", "0.5138431", "0.5123837", "0.50979066", "0.508635...
0.74167114
0
Extend centerline to have straight channels at both ends.
def extend_centerline(s, x, y, cur, theta): print('+> Extending centerline to have straight channels at both ends...', end='') if MODE == 1: extlength = LAMBDA/10 d = DS elif MODE == 2: extlength = WIDTH d = INTERVAL num = int(extlength/d) coshead = (x[1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def centerAxis():\n dislin.center()", "def linecenter(l):\n return scale3(add(l[0],l[1]),0.5)", "def centerline_to_polygon(\n centerline: np.ndarray, width_scaling_factor: float = 1.0, visualize: bool = False\n) -> np.ndarray:\n # eliminate duplicates\n _, inds = np.unique(centerline, axis=0, re...
[ "0.6367526", "0.6277636", "0.60933346", "0.58676577", "0.58125347", "0.57696474", "0.5726331", "0.5680378", "0.56134474", "0.5567007", "0.55354726", "0.5523416", "0.5488831", "0.5460297", "0.5416137", "0.5398362", "0.53754103", "0.5371892", "0.5368449", "0.5356547", "0.534115...
0.7979626
0
Impose a phase lag to the curvature signal by replacing the local curvature with the upstreamwise moving averaged curvature.
def lag(s, cur, t): if LAG == 0: return cur else: if MODE == 1: num = int(WIDTH*LAGSTR/DS) elif MODE == 2: num = int(WIDTH*LAGSTR/np.mean(np.diff(s))) if np.mod(t, LPRINT) == 0: print('+> Adding phase lag to local curvature...', end='') cur = compu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_baseline(self):\n\n print(\" \\t Apply Savitzky-Golay filter \\t %d\" %self.nwin)\n base_savgol = signal.savgol_filter(self.input, self.nwin, 1)\n self.input_nobase = self.input - base_savgol", "def adjust_u(self):\r\n # compute the volume integrals of the x,y, and z compon...
[ "0.5069656", "0.49511254", "0.4938894", "0.49136677", "0.48906946", "0.48032054", "0.46865338", "0.46588433", "0.4652921", "0.4643875", "0.4641906", "0.46012482", "0.4595003", "0.45939776", "0.45844513", "0.45730233", "0.45540237", "0.45404497", "0.4538936", "0.45381907", "0....
0.49604023
1
Compute phase lag. Numba nopyton mode is on.
def compute_lag(cur, num): length = cur.size cur0 = np.copy(cur) for i in range(2, length): M = i if i < num else num c = 0 for j in range(M): c += (2/M-j*2/M/(M-1))*cur0[i-j] cur[i] = c return cur
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phase_shift(annuli,annulus):\n delta_t = viscous_timescale(annuli[annulus+1]) - viscous_timescale(annuli[annulus])\n return int(delta_t)", "def phase_Jupiter_2(alpha):\n # inds = np.where(alpha > 180.)[0]\n # alpha[inds] = [180.]*len(inds)\n # assert np.all((1.0 - 1.507*(alpha/180.) - 0.363*(a...
[ "0.568884", "0.5633076", "0.558322", "0.5543549", "0.5504063", "0.5492323", "0.5485697", "0.5387924", "0.5384837", "0.5380682", "0.5380151", "0.53639066", "0.52793896", "0.52783406", "0.5265017", "0.52533853", "0.5246012", "0.5243909", "0.52438074", "0.52425396", "0.5214989",...
0.5392978
7
Compute curvature using 'arctan2' method.
def tan2curv(s, x, y): length = x.size cur = np.zeros(length) forw = np.zeros(length) back = np.zeros(length) for i in range(1, length-1): forw[i] = np.arctan2(y[i+1]-y[i], x[i+1]-x[i]) back[i] = np.arctan2(y[i]-y[i-1], x[i]-x[i-1]) angle_atan2 = forw[i] - back[i] cur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arccurv(x, y):\n curv = curvature(x, y)\n steps = np.sqrt(np.diff(x, axis=0)**2 + np.diff(y, axis=0)**2)[:-1]\n arc = np.cumsum(steps)\n return arc, curv", "def arccurv_i(x, y, l=0):\n if l==0:\n l = len(x)\n interp_coords = ia.interparc(l, x, y)\n x_i = interp_coords[:,0]\n y_...
[ "0.6816503", "0.6449396", "0.61861104", "0.6150632", "0.60887814", "0.5969641", "0.59119236", "0.5848616", "0.5770604", "0.5740051", "0.56768745", "0.5649155", "0.5575538", "0.5567511", "0.5558377", "0.5544352", "0.5520114", "0.5505947", "0.54986966", "0.5483227", "0.5448365"...
0.53391874
32
Compute curvature using 'law of cosine' method.
def coscurv(s, x, y): length = x.size cur = np.zeros(length) for i in range(1, length-1): a = np.array([x[i+1]-x[i], y[i+1]-y[i]]) b = np.array([x[i]-x[i-1], y[i]-y[i-1]]) c = np.array([1, 0]) flag = 1 if flag == 1 and a[1] < 0: flag = -1 elif flag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def curvature(x, y):\n dalpha = np.pi/1000\n xd1 = np.gradient(x, 2)\n xd2 = np.gradient(xd1, 2)\n yd1 = np.gradient(y, 2)\n yd2 = np.gradient(yd1, 2)\n\n return np.abs(xd1*yd2 - yd1*xd2) / np.power(xd1**2 + yd1**2, 3.0/2.0)", "def curvature(self):\n return self.circle().curvature(self.o...
[ "0.76586115", "0.7557801", "0.74021304", "0.7344014", "0.7253225", "0.70292807", "0.697398", "0.6943343", "0.68664813", "0.6865032", "0.6755068", "0.66258067", "0.6600955", "0.65058094", "0.6376265", "0.6309172", "0.62980443", "0.62669426", "0.6178336", "0.6120311", "0.606228...
0.5981495
24
Compute curvature using 'triangle's circumscribed circle ' method.
def threeptscurv(x, y): length = x.size R = np.zeros(length) cur = np.zeros(length) for i in range(1, length-1): a = np.sqrt((x[i+1]-x[i])**2 + (y[i+1]-y[i])**2) b = np.sqrt((x[i+1]-x[i-1])**2 + (y[i+1]-y[i-1])**2) c = np.sqrt((x[i]-x[i-1])**2 + (y[i]-y[i-1])**2) p = (a+b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def curvature(self):\n return self.circle().curvature(self.o, self.r, p = self.a)", "def curvature(self, t):\n dx = self.dx(t)\n dy = self.dy(t)\n dxx = self.dxx(t)\n dyy = self.dyy(t)\n return np.abs(dx * dyy - dy * dxx) / np.power(dx * dx + dy * dy, 1.5)", "def curva...
[ "0.7887616", "0.7790393", "0.74798626", "0.7411039", "0.7347205", "0.7338861", "0.72747785", "0.7150064", "0.69930804", "0.697757", "0.6951256", "0.6819586", "0.6756915", "0.6693438", "0.6556853", "0.64711803", "0.64556247", "0.63826823", "0.63458794", "0.6335935", "0.6330669...
0.56674206
41
Build synthetic bed topography (noncomputational part).
def build_beck(cur, s, t): if np.mod(t, LPRINT) == 0: print('+> Calculating synthetic riverbed topography...', end='') beck_bed = compute_beck(cur, s) beck_bed[np.abs(beck_bed)<ZERO] = 0 if np.mod(t, LPRINT) == 0: print(' [done]') return beck_bed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(self):\n nk_table = self.nk_table\n # Check for even interaction\n neighbor = int(self.order / 2)\n if self.order % 2 == 0:\n pre_neighbor = neighbor - 1\n else:\n pre_neighbor = neighbor\n # Use NK table to build phenotypes\n phenoty...
[ "0.58953184", "0.5699495", "0.56461006", "0.5644794", "0.5598251", "0.54474026", "0.54360324", "0.5419926", "0.540777", "0.5390797", "0.5360608", "0.5349371", "0.5319972", "0.5319779", "0.53049564", "0.52962375", "0.52820504", "0.526801", "0.5259576", "0.5209306", "0.5208436"...
0.52213037
19
Build synthetic bed topography using Beck1988 formula (computational part). Numba nopyton mode is on.
def compute_beck(cur, s): halfwidth = WIDTH/2 A = 3.8*(1+halfwidth/6.96/DEPTH*np.exp(-6.96*DEPTH/halfwidth)) st = -A*DEPTH*cur*STCORR length = cur.size hc = np.ones(length) for i in range(length): if np.abs(st[i]) < ZERO: st[i] = ZERO hc[i] = (4*halfwidth*DEPTH*np.abs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_beck(cur, s, t):\n if np.mod(t, LPRINT) == 0:\n print('+> Calculating synthetic riverbed topography...', end='')\n beck_bed = compute_beck(cur, s)\n beck_bed[np.abs(beck_bed)<ZERO] = 0\n if np.mod(t, LPRINT) == 0:\n print(' [done]')\n return beck_bed", "def bcL(self, rng=No...
[ "0.5774911", "0.56372297", "0.55830455", "0.5558612", "0.5527662", "0.54958844", "0.54610884", "0.545397", "0.5450368", "0.54146516", "0.540978", "0.5405097", "0.54040176", "0.5401028", "0.54001254", "0.5399316", "0.53932416", "0.5379748", "0.53642637", "0.534697", "0.5338786...
0.0
-1
Compute left and right offset polylines of centerline with an offset distance of L. Thank Y. Luo for improving the offsetting method.
def offset(x, y, L): length = x.size offsetx = np.zeros((length, 2)) offsety = np.zeros((length, 2)) dx = np.zeros(length-1) dy = np.zeros(length-1) dxL = np.zeros(length-1) dyL = np.zeros(length-1) xl = np.zeros(length) # counterclockwise xr = np.zeros(length) # clockwise yl = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_laneOffset(self):\n center_line = np.poly1d(np.mean([self.line_l.get_LinePoly().coeffs, self.line_r.get_LinePoly().coeffs], axis=0))\n # store the center line polynomial\n self.center_poly = center_line\n center_point = IMAGE_WIDTH/2 - center_line(709)\n offset_from_c...
[ "0.74781597", "0.6577585", "0.6375418", "0.6173955", "0.6073473", "0.6069938", "0.597449", "0.59539807", "0.59206563", "0.5882129", "0.58703756", "0.5837737", "0.58107406", "0.5750666", "0.57391214", "0.570022", "0.56990975", "0.5670591", "0.5662863", "0.56608677", "0.5651498...
0.7511953
0
Compute the offset polylines of centerline. Merge coordinates data (x & y information) with bed topography data (z information) to form a point cloud dataset in 3column xyz format.
def offset_all(x, y, beck_bed, t): length = x.size xyz1 = np.zeros((length, 3)) xyz2 = np.zeros((length, 3)) xyz1[:, 0] = np.copy(x) xyz1[:, 1] = np.copy(y) xyz1[:, 2] = np.copy(beck_bed[:, NUM]) allxyz = np.copy(xyz1) offsetx = np.zeros((length, 2)) offsety = np.zeros((length, 2)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_laneOffset(self):\n center_line = np.poly1d(np.mean([self.line_l.get_LinePoly().coeffs, self.line_r.get_LinePoly().coeffs], axis=0))\n # store the center line polynomial\n self.center_poly = center_line\n center_point = IMAGE_WIDTH/2 - center_line(709)\n offset_from_c...
[ "0.6411391", "0.57164943", "0.5699968", "0.5545373", "0.5483594", "0.53743315", "0.5361134", "0.5352067", "0.5319823", "0.5315895", "0.53050673", "0.53008056", "0.52951145", "0.5254391", "0.5216338", "0.5214085", "0.51875794", "0.51854825", "0.51789796", "0.51682115", "0.5153...
0.49207258
38
Write the point cloud of riverbed topography data.
def write_xyz_file(allxyz): if SAVEXYZ: print('+> Saving riverbed topography file...', end='') if MODE == 1: np.savetxt('kinoshita_topo.xyz', allxyz, fmt='%.6e') elif MODE == 2: np.savetxt(FNAME.rsplit('.', 1)[0] + '_topo.xyz', allxyz, fmt='%.6e') print(' [don...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writePointCloudVTP(self, outFile):\n #points\n vtkPts = vtk.vtkPoints()\n cells = vtk.vtkCellArray()\n\n # setup colors\n Colors = vtk.vtkFloatArray()\n #Colors.SetNumberOfComponents(3)\n Colors.SetNumberOfTuples(self.Npts)\n Colors.SetName(self.label) #c...
[ "0.676081", "0.61430436", "0.6105673", "0.5979034", "0.59036213", "0.5813448", "0.5647733", "0.5640388", "0.55900574", "0.55822045", "0.55764955", "0.55333817", "0.55268365", "0.55162495", "0.5514892", "0.5493977", "0.54869837", "0.54302067", "0.54266334", "0.5345584", "0.534...
0.54841113
17
Build and write the finite element mesh (noncompuational).
def write_mesh_file(allxyz, beck_bed): if SAVEMESH: print('+> Saving finite element mesh files...', end='') fname = FNAME.rsplit('.', 1)[0] ncol = beck_bed[0,:].size nrow = beck_bed[:,0].size nele = (nrow-1)*(ncol-1)*2 d = compute_mesh(nrow, ncol, nele) h = ':...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateDummyUpperDimensionalMesh(self):\n\n\n sys.stdout = open(os.devnull, \"w\")\n p = self.InferPolynomialDegree()\n mesh = Mesh()\n if self.element_type == \"tri\":\n mesh.Parallelepiped(nx=1,ny=1,nz=1, element_type=\"tet\")\n mesh.GetHighOrderMesh(p=p)\n ...
[ "0.67319965", "0.6486597", "0.641751", "0.6250623", "0.611316", "0.6060483", "0.6028214", "0.5988006", "0.59420913", "0.59015757", "0.5859401", "0.5840814", "0.5839659", "0.5817488", "0.581355", "0.57974845", "0.5776498", "0.57728815", "0.5749524", "0.57306874", "0.57267076",...
0.72402173
0
Build the finite element mesh (compuational). Numba nopyton mode is on.
def compute_mesh(nrow, ncol, nele): tri_index = np.zeros((nele, 3)) for i in range(nrow-1): for j in range(NUM): if j == 0: tri_index[i*4*NUM+j*4, 0] = (i+1)+(2*j+1)*nrow tri_index[i*4*NUM+j*4, 1] = (i+1) tri_index[i*4*NUM+j*4, 2] = (i+2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_forces_mesh(self):\n f = self.ptclgrid.grid[:self.size,:self.size]*self.grad_phi_mesh()\n return f", "def construct_linear_system(self):\n N=self.grid.Ncells()\n Nbc = len(self.dirichlet_bcs)\n self.Ncalc=Ncalc = N - Nbc\n\n # map cells to forced values\n ...
[ "0.6277017", "0.60608715", "0.6025423", "0.5964582", "0.59430224", "0.59073764", "0.58610296", "0.58496845", "0.57895", "0.57750237", "0.5748845", "0.5736129", "0.5713295", "0.56682", "0.56620336", "0.5630105", "0.56182766", "0.5547009", "0.5531999", "0.55184096", "0.5491587"...
0.53366375
41
Find neck cutoff. If found, remake centerline.
def cutoff(s, x, y): oxbowx, oxbowy = np.zeros(0), np.zeros(0) found_cutoff = False if MIGRATION: for i in range(1, s.size): for j in range(1, s.size): if j-i > 4*NUM and np.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2) < WIDTH: oxbowx, oxbowy = np.copy(x[i+1:j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cutout(self, centre, radius):", "def cut_neck(template, r0, c0, r1, c1):\n # rr, cc, _ = line_aa(r0, c0, r1, c1)\n rr, cc = line(r0, c0, r1, c1)\n template[rr, cc] = 0\n return template", "def _compute_cutoffs(self):\n self._cutoffidx=np.zeros(self.nsamples,dtype=np.int)\n # Find ...
[ "0.5898544", "0.5584039", "0.54813856", "0.547844", "0.53881294", "0.5382743", "0.5365016", "0.5333634", "0.5280446", "0.52618206", "0.5255998", "0.51932687", "0.51894706", "0.51854175", "0.50618666", "0.5061274", "0.49788883", "0.49771476", "0.49672613", "0.49562556", "0.495...
0.51696855
14
Make channel migration movie in gif format.
def make_gif(): if MIGRATION: import imageio for n, JPG_DIR in enumerate(JPG_DIRS): images, image_file_names = [], [] for file_name in os.listdir(JPG_DIR): if file_name.endswith('.jpg'): image_file_names.append(file_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_gif(ctx):\n ctx.run(\n 'ffmpeg '\n '-i resources/demo.mkv -filter_complex \"[0:v] palettegen\" '\n 'resources/palette.png',\n pty=True\n )\n ctx.run(\n 'ffmpeg -i resources/demo.mkv '\n '-i resources/palette.png '\n '-filter_complex \"[0:v][1:v]...
[ "0.7008671", "0.6884192", "0.6653024", "0.64807695", "0.6446074", "0.6423537", "0.636852", "0.63599503", "0.6167705", "0.61626273", "0.6134406", "0.6128358", "0.6097842", "0.6088125", "0.6085878", "0.6074961", "0.6070263", "0.606446", "0.6043163", "0.59980667", "0.59119076", ...
0.6775056
2
Clean cache if there is any. Print job done.
def job_done(): try: shutil.rmtree('__pycache__') except OSError: pass print('+> My job is done\n') input('Press <Enter> to quit\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_cache_step(self):\n logger.info('Step {}, cleaning cache'.format(self.name))\n self.output = None\n return self", "def clean_cache(self):\n return", "def clear_cache():\n # TODO\n pass", "def clear_cache(self):\n pass", "def _purge():\r\n _cache...
[ "0.7725692", "0.7319051", "0.7011005", "0.6974307", "0.69056773", "0.6748821", "0.6717088", "0.67004144", "0.6688451", "0.6663096", "0.6618994", "0.66112363", "0.66062546", "0.6599757", "0.655827", "0.6533588", "0.6507623", "0.64878786", "0.6484797", "0.6472741", "0.64311296"...
0.6479549
19
Execute the workflow of pyRiverBed.
def main(): print_banner() params = read_steering() s, x, y, cur, theta = build_kinoshita() s, x, y, cur, theta = read_centerline(s, x, y, cur, theta) s, x, y, cur, theta = extend_centerline(s, x, y, cur, theta) for t in range(TSTEPS+1): cur, theta = tan2curv(s, x, y) cur_ori = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n parser = argparse.ArgumentParser()\n parser.add_argument('--viewer', '-v', type=str, default='interactivemarker',\n help='The viewer to attach (none for no viewer)')\n parser.add_argument('--monitor', action='store_true',\n help='Display a UI to ...
[ "0.6846046", "0.6794627", "0.67054456", "0.6396308", "0.63676095", "0.631021", "0.6250054", "0.6245897", "0.6202542", "0.6198228", "0.6198228", "0.6198228", "0.6198228", "0.6198228", "0.6198228", "0.6198228", "0.6198228", "0.6198228", "0.6198228", "0.6198228", "0.6198228", ...
0.0
-1
Generate a rustanalyzer compatible rustproject.json file.
def generate_rust_project_json(self) -> None: if not self.rust_crates: return with open(os.path.join(self.environment.get_build_dir(), 'rust-project.json'), 'w', encoding='utf-8') as f: json.dump( { "sysroot_src": os.path.join...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createproject(destinationdir):\n print(f\"Writing json data files to {destinationdir}\")\n return", "def projectToJSONFile(projectPath):\n jsonProjectFileName = projectPath.split('.')[0] + '_summary.json'\n jsonProject = projectToJSON(projectPath)\n with open (jsonProjectFileName, 'w') as outF...
[ "0.5765005", "0.5750292", "0.56758595", "0.5569898", "0.55584913", "0.547835", "0.547835", "0.547835", "0.5442536", "0.5390132", "0.5291652", "0.52869755", "0.5279458", "0.52660453", "0.525721", "0.52367043", "0.5209489", "0.52066916", "0.5184295", "0.51825064", "0.5129931", ...
0.69861084
0
Returns a dictionary with the keys being the path to the file (relative to the build directory) and the value being the File object representing the same path.
def get_target_generated_sources(self, target: build.BuildTarget) -> T.MutableMapping[str, File]: srcs: T.MutableMapping[str, File] = OrderedDict() for gensrc in target.get_generated_sources(): for s in gensrc.get_outputs(): rel_src = self.get_target_generated_dir(target, gen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _file_dict(self, fn_):\n if not os.path.isfile(fn_):\n err = \"The referenced file, {} is not available.\".format(fn_)\n sys.stderr.write(err + \"\\n\")\n sys.exit(42)\n with salt.utils.files.fopen(fn_, \"r\") as fp_:\n data = fp_.read()\n return...
[ "0.6919517", "0.6863222", "0.63652253", "0.62779284", "0.60995907", "0.5967149", "0.595928", "0.59572923", "0.58941245", "0.58785695", "0.5851918", "0.5772072", "0.5767667", "0.5758123", "0.5751229", "0.5726455", "0.5722699", "0.57208216", "0.57204276", "0.57001", "0.56919104...
0.0
-1
Make source files absolute
def compute_path(file: mesonlib.FileOrString) -> str: if isinstance(file, File): return file.absolute_path(self.source_dir, self.build_dir) return os.path.normpath(os.path.join(self.build_dir, file))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sources_absolute_paths(self):\r\n abs_target_base = os.path.join(get_buildroot(), self.target_base)\r\n for src in self.sources:\r\n yield os.path.join(abs_target_base, src)", "def relative_to_buildroot(self):\n return [os.path.join(self.rel_path, source) for source in self.source_paths]", "d...
[ "0.71705025", "0.6414627", "0.63732827", "0.6066609", "0.60212094", "0.5882674", "0.58711624", "0.58533555", "0.5799905", "0.5785516", "0.57765865", "0.56890666", "0.5666928", "0.5614749", "0.5548962", "0.55128753", "0.5511436", "0.5492249", "0.5454488", "0.54247826", "0.5424...
0.0
-1
Peek into the sources of BuildTargets we're linking with, and if any of them was built with Vala, assume that it also generated a .vapi file of the same name as the BuildTarget and return the path to it relative to the build directory.
def determine_dep_vapis(self, target): result = OrderedSet() for dep in itertools.chain(target.link_targets, target.link_whole_targets): if not dep.is_linkable_target(): continue for i in dep.sources: if hasattr(i, 'fname'): i =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relative_to_buildroot(self):\n return [os.path.join(self.rel_path, source) for source in self.source_paths]", "def generate_vala_compile(self, target: build.BuildTarget) -> \\\n T.Tuple[T.MutableMapping[str, File], T.MutableMapping[str, File], T.List[str]]:\n (vala_src, vapi_src, other_s...
[ "0.64123094", "0.6297687", "0.60322136", "0.59872854", "0.57505876", "0.5746975", "0.57446456", "0.56533736", "0.55476505", "0.5485242", "0.54734313", "0.53989863", "0.53819764", "0.5362305", "0.53325355", "0.5314406", "0.5299155", "0.52888477", "0.5238422", "0.52343905", "0....
0.5790028
4
Splits the target's sources into .vala, .gs, .vapi, and other sources. Handles both preexisting and generated sources. Returns a tuple (vala, vapi, others) each of which is a dictionary with the keys being the path to the file (relative to the build directory) and the value being the object that generated or represents...
def split_vala_sources(self, t: build.BuildTarget) -> \ T.Tuple[T.MutableMapping[str, File], T.MutableMapping[str, File], T.Tuple[T.MutableMapping[str, File], T.MutableMapping]]: vala: T.MutableMapping[str, File] = OrderedDict() vapi: T.MutableMapping[str, File] = Ordered...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_vala_compile(self, target: build.BuildTarget) -> \\\n T.Tuple[T.MutableMapping[str, File], T.MutableMapping[str, File], T.List[str]]:\n (vala_src, vapi_src, other_src) = self.split_vala_sources(target)\n extra_dep_files = []\n if not vala_src:\n raise Invalid...
[ "0.6056835", "0.58320844", "0.56975776", "0.5695355", "0.56941354", "0.56379557", "0.55843604", "0.5572055", "0.5410893", "0.535213", "0.5313574", "0.53130484", "0.530888", "0.52893823", "0.5281984", "0.5279749", "0.5272755", "0.5268782", "0.5266625", "0.52504265", "0.5248615...
0.785854
0
Vala is compiled into C. Set up all necessary build steps here.
def generate_vala_compile(self, target: build.BuildTarget) -> \ T.Tuple[T.MutableMapping[str, File], T.MutableMapping[str, File], T.List[str]]: (vala_src, vapi_src, other_src) = self.split_vala_sources(target) extra_dep_files = [] if not vala_src: raise InvalidArguments(f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_glibc():\n if not os.path.exists(glibc_build_dir):\n docmd(\"mkdir %s\" % glibc_build_dir)\n glibc_subdir = \"glibc-%s\" % glibc_version\n if not os.path.exists(glibc_subdir):\n docmd(\"wget http://ftpmirror.gnu.org/glibc/\"\n \"%s.tar.bz2\" % glibc_subdir)\n docmd(\"tar jxf %s.tar.b...
[ "0.5602567", "0.543335", "0.53301674", "0.5304108", "0.5286191", "0.52635735", "0.5227829", "0.51943076", "0.5164394", "0.51239663", "0.5060787", "0.50462466", "0.5021612", "0.4998351", "0.4991233", "0.4991233", "0.49836853", "0.4957573", "0.494618", "0.49404785", "0.49330255...
0.64493704
0
Generate rules for transpiling Cython files to C or C++
def generate_cython_transpile(self, target: build.BuildTarget) -> \ T.Tuple[T.MutableMapping[str, File], T.MutableMapping[str, File], T.List[str]]: static_sources: T.MutableMapping[str, File] = OrderedDict() generated_sources: T.MutableMapping[str, File] = OrderedDict() cython_source...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pyo():\n local('python -O -m compileall .')", "def pyo():\n local('python -O -m compileall .')", "def compile_cutils():\r\n\r\n types = ['npy_' + t for t in ['int8', 'int16', 'int32', 'int64', 'int128',\r\n 'int256', 'uint8', 'uint16', 'uint32', 'uint64', 'uint128', 'uint256',\r\n 'f...
[ "0.644899", "0.644899", "0.63634294", "0.63512045", "0.6192792", "0.6134807", "0.5765677", "0.5760449", "0.5747454", "0.5743692", "0.56498545", "0.5609859", "0.55956745", "0.5582601", "0.5581401", "0.5578906", "0.5548663", "0.5526328", "0.55054164", "0.5475244", "0.54675543",...
0.65219265
0
Create a target to copy a source file from one location to another.
def _generate_copy_target(self, src: 'mesonlib.FileOrString', output: Path) -> None: if isinstance(src, File): instr = src.absolute_path(self.environment.source_dir, self.environment.build_dir) else: instr = src elem = NinjaBuildElement(self.all_outputs, [str(output)], 'C...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self, src_path: str, tgt_path: str) -> None:", "def copyfile(self, source, outputfile):\n shutil.copyfileobj(source, outputfile)", "def copyfile(self, source, outputfile):\n shutil.copyfileobj(source, outputfile)", "def copyfile(self, source, outputfile):\n shutil.copyfileobj(so...
[ "0.73829716", "0.7333408", "0.7333408", "0.7333408", "0.732937", "0.7263016", "0.7261521", "0.7118045", "0.71087444", "0.697479", "0.6830899", "0.656345", "0.6529164", "0.64964", "0.6474932", "0.6473316", "0.64412814", "0.64376616", "0.6422596", "0.6418557", "0.6409707", "0...
0.7072387
9
Helper method to get rsp options. rsp_file_syntax() is only guaranteed to be implemented if can_linker_accept_rsp() returns True.
def _rsp_options(self, tool: T.Union['Compiler', 'StaticLinker', 'DynamicLinker']) -> T.Dict[str, T.Union[bool, RSPFileSyntax]]: options = {'rspable': tool.can_linker_accept_rsp()} if options['rspable']: options['rspfile_quote_style'] = tool.rsp_file_syntax() return options
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_options(ret):\n attrs = {\"host\": \"host\", \"port\": \"port\", \"skip\": \"skip_on_error\", \"mode\": \"mode\"}\n\n _options = salt.returners.get_returner_options(\n __virtualname__, ret, attrs, __salt__=__salt__, __opts__=__opts__\n )\n return _options", "def compilation_options(se...
[ "0.50831187", "0.4936194", "0.4710779", "0.4703603", "0.47000256", "0.46416172", "0.46384525", "0.46382034", "0.46292686", "0.45956933", "0.45816252", "0.4573522", "0.45415303", "0.45326465", "0.45186582", "0.44897", "0.44642767", "0.44639853", "0.4455904", "0.44428545", "0.4...
0.7745526
0
Find all module and submodule made available in a Fortran code file.
def scan_fortran_module_outputs(self, target): if self.use_dyndeps_for_fortran(): return compiler = None # TODO other compilers for lang, c in self.environment.coredata.compilers.host.items(): if lang == 'fortran': compiler = c brea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_modules(x):\n return Path(x).rglob('*.py')", "def findModule(name):", "def _scan_fortran_file_deps(src: Path, srcdir: Path, dirname: Path, tdeps, compiler) -> T.List[str]:\n\n incre = re.compile(FORTRAN_INCLUDE_PAT, re.IGNORECASE)\n usere = re.compile(FORTRAN_USE_PAT, re.IGNORECASE)\n subm...
[ "0.6819265", "0.65223193", "0.652114", "0.6389625", "0.6138241", "0.6116626", "0.60589266", "0.60463464", "0.59813786", "0.5934519", "0.5933643", "0.5903426", "0.5874463", "0.5871645", "0.5862996", "0.5855652", "0.58545387", "0.58485526", "0.58388484", "0.58376634", "0.576273...
0.58034265
20
Find all module and submodule needed by a Fortran target
def get_fortran_deps(self, compiler: FortranCompiler, src: Path, target) -> T.List[str]: if self.use_dyndeps_for_fortran(): return [] dirname = Path(self.get_target_private_dir(target)) tdeps = self.fortran_deps[target.get_basename()] srcdir = Path(self.source_dir) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scan_fortran_module_outputs(self, target):\n if self.use_dyndeps_for_fortran():\n return\n compiler = None\n # TODO other compilers\n for lang, c in self.environment.coredata.compilers.host.items():\n if lang == 'fortran':\n compiler = c\n ...
[ "0.7063762", "0.6719846", "0.6627496", "0.6324317", "0.6165657", "0.6095867", "0.60750175", "0.6055428", "0.6054418", "0.60239345", "0.59913206", "0.597504", "0.5936399", "0.59242594", "0.5907928", "0.58924717", "0.5890326", "0.58276814", "0.5796725", "0.57962143", "0.5789822...
0.60256124
9
Compiles C/C++, ObjC/ObjC++, Fortran, and D sources
def generate_single_compile(self, target: build.BuildTarget, src, is_generated=False, header_deps=None, order_deps: T.Optional[T.List['mesonlib.FileOrString']] = None, extra_args: T.Optional[T.List[str]] = None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pyo():\n local('python -O -m compileall .')", "def pyo():\n local('python -O -m compileall .')", "def build_program(source_files, image_type='bare-metal', opt_level='-O3', cflags=None):\n assert isinstance(source_files, list)\n\n if not os.path.exists(OBJ_DIR):\n os.makedirs(OBJ_DIR)\n\n...
[ "0.6460845", "0.6460845", "0.6460829", "0.6281568", "0.62301815", "0.6133531", "0.6118104", "0.6079851", "0.6027266", "0.6002802", "0.5884031", "0.5878032", "0.5852781", "0.5839785", "0.5818881", "0.5815626", "0.5788101", "0.57821906", "0.57686496", "0.5767464", "0.57662016",...
0.0
-1
scan a Fortran file for dependencies. Needs to be distinct from target to allow for recursion induced by `include` statements.er It makes a number of assumptions, including `use`, `module`, `submodule` name is not on a continuation line Regex `incre` works for `include "foo.f90"` and `include "foo.f90"` `usere` works f...
def _scan_fortran_file_deps(src: Path, srcdir: Path, dirname: Path, tdeps, compiler) -> T.List[str]: incre = re.compile(FORTRAN_INCLUDE_PAT, re.IGNORECASE) usere = re.compile(FORTRAN_USE_PAT, re.IGNORECASE) submodre = re.compile(FORTRAN_SUBMOD_PAT, re.IGNORECASE) mod_files = [] src = Path(src) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scan_fortran_module_outputs(self, target):\n if self.use_dyndeps_for_fortran():\n return\n compiler = None\n # TODO other compilers\n for lang, c in self.environment.coredata.compilers.host.items():\n if lang == 'fortran':\n compiler = c\n ...
[ "0.66169536", "0.61312497", "0.58868647", "0.5637438", "0.55885524", "0.5586976", "0.5523092", "0.5467778", "0.5432288", "0.5417047", "0.5335516", "0.519833", "0.51949865", "0.51465106", "0.5142541", "0.5124167", "0.5095581", "0.50270045", "0.5003758", "0.49810615", "0.494451...
0.7567411
0
Returns a histogram over all relationships in a graph
def count_relations(graph): return Counter( data[RELATION] for _, _, data in graph.edges_iter(data=True) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_unique_relations(graph):\n return Counter(itt.chain.from_iterable(get_edge_relations(graph).values()))", "def multiple_connections_histogram(synapses):\n count_of_synapses = synapses.groupby(['pre', 'post']).size()\n return count_of_synapses", "def count_pathologies(graph):\n return Count...
[ "0.69387263", "0.6183445", "0.6046419", "0.6034515", "0.59751195", "0.57758623", "0.57072544", "0.5633479", "0.5611335", "0.56087476", "0.55993664", "0.5599142", "0.55365855", "0.5526105", "0.54780513", "0.547426", "0.54703754", "0.5457386", "0.54382086", "0.5435362", "0.5413...
0.7300097
0
Makes a dict that accumulates the values for each key in an iterator of doubles
def group_dict_set(iterator): d = defaultdict(set) for key, value in iterator: d[key].add(value) return dict(d)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_densities(densities):\n\n return {spin: sum(np.array(dens[spin]) for dens in densities) \n for spin in densities[0].keys()}", "def build_histogram(iterator, key):\n buckets = defaultdict(int)\n values = {}\n\n num_objects = 0\n for obj in iterator:\n num_objects += 1\n\n ...
[ "0.6195448", "0.5842633", "0.5762505", "0.5756769", "0.5659886", "0.5645777", "0.5627008", "0.5534746", "0.5509884", "0.55032265", "0.54376537", "0.54350764", "0.54216063", "0.5409323", "0.540671", "0.5402735", "0.53859186", "0.53531986", "0.53487366", "0.5334113", "0.5327092...
0.61645067
1
Returns a histogram of the different types of relations present in a graph.
def count_unique_relations(graph): return Counter(itt.chain.from_iterable(get_edge_relations(graph).values()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_relations(graph):\n return Counter(\n data[RELATION]\n for _, _, data in graph.edges_iter(data=True)\n )", "def relationship_types(self):\n return frozenset(self._relationships_by_type.keys())", "def get_all_relations(graph, u, v):\n return {\n data[RELATION]\n ...
[ "0.7243773", "0.5846342", "0.5788476", "0.5771844", "0.5683003", "0.55974525", "0.5592673", "0.55913526", "0.55775154", "0.5538538", "0.55222", "0.55188054", "0.53761876", "0.53658545", "0.5363041", "0.5343787", "0.529524", "0.52806026", "0.5279505", "0.5273678", "0.5265037",...
0.6904264
1
Iterates over the annotation keys
def _annotation_iter_helper(graph): return ( key for _, _, data in graph.edges(data=True) if ANNOTATIONS in data for key in data[ANNOTATIONS] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterkeys(self):", "def iterkeys(self):", "def iter_keypoints_labels(self):\n return iter(self.schema)", "def _key_index_iter(self: Any) -> Iterator[Tuple[str, Any]]:\n for k, v in vars(self).items():\n yield k, v", "def iterate_keys(\n self,\n keys: istr = None,\n ...
[ "0.6948478", "0.6948478", "0.6455085", "0.6263266", "0.6235896", "0.6149486", "0.6079361", "0.59984857", "0.5966069", "0.5909791", "0.5881101", "0.585842", "0.5820509", "0.58111554", "0.5806297", "0.58045775", "0.5788105", "0.5782316", "0.5751768", "0.5739767", "0.5723479", ...
0.69208306
2
Counts how many times each annotation is used in the graph
def count_annotations(graph): return Counter(_annotation_iter_helper(graph))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_annotation_values(graph, annotation):\n return Counter(iter_annotation_values(graph, annotation))", "def get_annotation_count(self):\n return self._num_annos", "def get_no_of_annotations(database, label, train_vids_all):\n count = 0\n for vid in train_vids_all:\n for ann in dat...
[ "0.8343825", "0.75170594", "0.68242604", "0.6573023", "0.64739114", "0.6471781", "0.6350306", "0.6324876", "0.6313155", "0.62601817", "0.6247608", "0.6229666", "0.6193566", "0.6186364", "0.61589694", "0.6157267", "0.6121791", "0.6050442", "0.6028076", "0.60266453", "0.6026645...
0.8530131
0
Gets the set of annotations used in the graph
def get_annotations(graph): return set(_annotation_iter_helper(graph))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def annotations(self):\n return self._annotations", "def annotations(self):\n\n return self._annotations", "def annotations(self) -> Mapping[str, str]:\n return pulumi.get(self, \"annotations\")", "def annotations(self) -> Mapping[str, str]:\n return pulumi.get(self, \"annotations...
[ "0.8111795", "0.8045864", "0.7362889", "0.7362889", "0.7331711", "0.70147973", "0.69533426", "0.69257975", "0.69232273", "0.69228804", "0.68237376", "0.6820551", "0.6820551", "0.67251045", "0.6618748", "0.6587142", "0.65761614", "0.652672", "0.6499983", "0.6469789", "0.633797...
0.8332945
0
Gets the set of all annotations that are defined in a graph, but are never used.
def get_unused_annotations(graph): return graph.defined_annotation_keywords - get_annotations(graph)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_annotations(graph):\n return set(_annotation_iter_helper(graph))", "def get_annotation_values(graph, annotation):\n return set(iter_annotation_values(graph, annotation))", "def get_unused_list_annotation_values(graph):\n result = {}\n for annotation, values in graph.annotation_list.items():...
[ "0.8046899", "0.6747276", "0.6727379", "0.6385317", "0.6370691", "0.6229582", "0.6198001", "0.59983647", "0.5742247", "0.57196945", "0.5694495", "0.5674026", "0.56460255", "0.56373686", "0.56286234", "0.55884176", "0.55659765", "0.55608773", "0.5503239", "0.5494925", "0.54823...
0.79468316
1
Gets all of the unused values for list annotations
def get_unused_list_annotation_values(graph): result = {} for annotation, values in graph.annotation_list.items(): used_values = get_annotation_values(graph, annotation) if len(used_values) == len(values): # all values have been used continue result[annotation] = set(values)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_unused_annotations(graph):\n return graph.defined_annotation_keywords - get_annotations(graph)", "def get_annotation_values(graph, annotation):\n return set(iter_annotation_values(graph, annotation))", "def metric_annotations_allow_list(self) -> Optional[pulumi.Input[str]]:\n return pulumi...
[ "0.68537354", "0.62805945", "0.59040225", "0.589097", "0.58017445", "0.575836", "0.5727465", "0.57149005", "0.56691", "0.56430316", "0.56349885", "0.5633079", "0.55975", "0.55915046", "0.55841595", "0.5538164", "0.5534096", "0.5508441", "0.5505978", "0.55038834", "0.54778254"...
0.7874108
0
Gets annotation/value pairs for values for whom the search string is a substring
def get_annotations_containing_keyword(graph, keyword): return [ { 'annotation': annotation, 'value': value } for annotation, value in iter_annotation_value_pairs(graph) if keyword.lower() in value.lower() ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _substring_occurrences(\n cls, in_str: str, substrings: Iterable[str]\n ) -> Dict[str, List[int]]:\n occurrences = {}\n for substring in substrings:\n occurrences[substring] = list(findall(substring, in_str))\n return occurrences", "def search_in_tree(self, tree, sub...
[ "0.5903146", "0.5488121", "0.5460287", "0.5396356", "0.53472704", "0.5338512", "0.53332084", "0.5275697", "0.5245533", "0.5171115", "0.51687026", "0.5167059", "0.5165257", "0.51592106", "0.5158753", "0.5154511", "0.5152063", "0.5150403", "0.5129545", "0.51103365", "0.51068866...
0.576712
1
Counts in how many edges each annotation appears in a graph
def count_annotation_values(graph, annotation): return Counter(iter_annotation_values(graph, annotation))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_annotations(graph):\n return Counter(_annotation_iter_helper(graph))", "def edgecount(self):\n\n raise NotImplementedError", "def num_edges(g):\n total_edges_with_duplicates = sum(len(v) for v in g.values())\n return total_edges_with_duplicates // 2", "def edge_count(self) -> int:\n...
[ "0.8137551", "0.73022085", "0.6926789", "0.69061303", "0.68878543", "0.6854445", "0.67950374", "0.6794573", "0.67014533", "0.6696235", "0.6683472", "0.66686267", "0.6668122", "0.6655918", "0.6652132", "0.6610412", "0.65590703", "0.65477306", "0.6536954", "0.6498154", "0.64939...
0.7824741
1
Get all values for the given annotation
def get_annotation_values(graph, annotation): return set(iter_annotation_values(graph, annotation))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_annotations(self):\n entity = self.get_object()\n serializer = AnnotationValueSerializer(entity.annotations.all(), many=True)\n return Response(serializer.data)", "def handle_enum(enum_annotations: Any) -> list:\n result = []\n for attribute in list(enum_annotations):\n...
[ "0.67769945", "0.6325543", "0.6274638", "0.6220138", "0.6180968", "0.6171129", "0.61034197", "0.60787046", "0.60713106", "0.6068879", "0.5992964", "0.59564936", "0.59216946", "0.59216946", "0.59015006", "0.5887698", "0.5887698", "0.5886613", "0.5818207", "0.5798842", "0.57982...
0.75477934
0
Counts in how many edges each annotation appears in a graph, but filter out source nodes and target nodes
def count_annotation_values_filtered(graph, annotation, source_filter=None, target_filter=None): source_filter = keep_node_permissive if source_filter is None else source_filter target_filter = keep_node_permissive if target_filter is None else target_filter return Counter( data[ANNOTATIONS][annota...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_annotations(graph):\n return Counter(_annotation_iter_helper(graph))", "def compute_num_edges(graph):\n # return the number of edges\n return sum([len(graph[source_node].keys()) for source_node in graph.keys()]) / 2", "def count_annotation_values(graph, annotation):\n return Count...
[ "0.64924645", "0.61406404", "0.60482", "0.5913293", "0.5882233", "0.5866123", "0.5851271", "0.58161896", "0.57976633", "0.57823884", "0.57695407", "0.57527435", "0.56889486", "0.5676223", "0.5665394", "0.5659691", "0.5659477", "0.56017035", "0.556301", "0.5519132", "0.5494026...
0.7213139
0
Iterates over unique nodenode pairs in the graph
def _iter_pairs(graph): for u, v in set(graph.edges_iter()): yield u, v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iteredges(self):\n for source, targets in self.successors.items():\n for target in targets:\n yield source, target", "def iter_nodes(self):", "def all_pairs(self):\n return chain(self.nx_graph.edges(), nx.non_edges(self.nx_graph))", "def nodes(self):\n for n...
[ "0.68542266", "0.6712754", "0.6575832", "0.6528945", "0.64538825", "0.6438056", "0.6314288", "0.62993896", "0.6280058", "0.6257878", "0.62574124", "0.625634", "0.6213354", "0.62093157", "0.6184859", "0.61808145", "0.61796695", "0.6145432", "0.60995543", "0.60977054", "0.60902...
0.78772706
0
Returns the set of all relations between a given pair of nodes
def get_all_relations(graph, u, v): return { data[RELATION] for data in graph.edge[u][v].values() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_pairs(self):\n return chain(self.nx_graph.edges(), nx.non_edges(self.nx_graph))", "def relations(self):\n return set(self.triples()[\"relation\"])", "def get_relations(self):\n triples = list(self.get_triples())\n\n for s, p, o in triples:\n if not p.startswith(\"...
[ "0.70479345", "0.6927845", "0.6710669", "0.6699805", "0.6634587", "0.65720505", "0.6555457", "0.65286154", "0.6481142", "0.6458834", "0.64464796", "0.63734806", "0.6327714", "0.6283819", "0.6210741", "0.6195693", "0.61790866", "0.61713094", "0.616871", "0.61438185", "0.613430...
0.6073819
24
Returns if the edges between the given nodes are consistent, meaning they all have the same relation
def pair_is_consistent(graph, u, v): relations = get_all_relations(graph, u, v) if 1 != len(relations): return False return list(relations)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __has_multiple_edges(self):\n return \\\n len(\n list(\n [\n tuple((edge.get_first_incident_node().get_name(), edge.get_second_incident_node().get_name()))\n for edge in self.get_edges()\n ] # ...
[ "0.710841", "0.68671525", "0.6761228", "0.66784406", "0.66491693", "0.66183716", "0.6618279", "0.65234625", "0.6509124", "0.64982206", "0.6469651", "0.644774", "0.6418613", "0.6405866", "0.6381723", "0.6370003", "0.63498205", "0.6347336", "0.63372046", "0.62504184", "0.622850...
0.6281837
19
Returns if the set of relations contains a contradiction
def relation_set_has_contradictions(relations): has_increases = any(relation in CAUSAL_INCREASE_RELATIONS for relation in relations) has_decreases = any(relation in CAUSAL_DECREASE_RELATIONS for relation in relations) has_cnc = any(relation == CAUSES_NO_CHANGE for relation in relations) return 1 < sum([...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_relations(self, relations):\n if self.debug:\n print(\"Checking relations\")\n result = False\n work_relations = []\n\n # Eliminate unnecessary(duplicated) clauses\n if relations[\"is_derived_from\"]:\n relations[\"has_derived_form\"] = True\n ...
[ "0.7122376", "0.67345405", "0.6449695", "0.6206758", "0.6205824", "0.6188202", "0.61652434", "0.61545885", "0.6087285", "0.60733366", "0.6025005", "0.6013213", "0.60035706", "0.5984546", "0.59587294", "0.5939061", "0.5924129", "0.5839123", "0.5822666", "0.5814324", "0.5813227...
0.7635147
0
Checks if a pair of nodes has any contradictions in their causal relationships.
def pair_has_contradiction(graph, u, v): relations = get_all_relations(graph, u, v) return relation_set_has_contradictions(relations)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relation_set_has_contradictions(relations):\n has_increases = any(relation in CAUSAL_INCREASE_RELATIONS for relation in relations)\n has_decreases = any(relation in CAUSAL_DECREASE_RELATIONS for relation in relations)\n has_cnc = any(relation == CAUSES_NO_CHANGE for relation in relations)\n return ...
[ "0.68102324", "0.6214052", "0.6207057", "0.60906833", "0.6065176", "0.60568976", "0.6026552", "0.6008109", "0.59604144", "0.59581804", "0.59490097", "0.5934767", "0.5910104", "0.59072256", "0.5901164", "0.5900084", "0.58665067", "0.58433616", "0.5840681", "0.5824252", "0.5824...
0.62543714
1
Iterates over contradictory node pairs in the graph based on their causal relationships
def get_contradictory_pairs(graph): for u, v in _iter_pairs(graph): if pair_has_contradiction(graph, u, v): yield u, v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_successors(self, node):\n succs = []\n parent_state = self.node_to_state(node)\n for it in self.children:\n child_node = (node[0] + it[0], node[1] + it[1])\n child_state = self.node_to_state(child_node)\n edge = self.interpolate(parent_state, child_state, self.distance_bw_states(pa...
[ "0.6238017", "0.5909709", "0.5907469", "0.58362544", "0.57939804", "0.5792186", "0.5703263", "0.5681727", "0.56771266", "0.5671722", "0.56632626", "0.5611376", "0.5602615", "0.559068", "0.5563447", "0.5538029", "0.55253816", "0.55157125", "0.5515107", "0.5483767", "0.5442139"...
0.69560146
0
Yields pairs of (source node, target node) for which all of their edges have the same type of relation.
def get_consistent_edges(graph): for u, v in _iter_pairs(graph): if pair_is_consistent(graph, u, v): yield u, v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _iter_pairs(graph):\n for u, v in set(graph.edges_iter()):\n yield u, v", "def iteredges(self):\n for source, targets in self.successors.items():\n for target in targets:\n yield source, target", "def all_pairs(self):\n return chain(self.nx_graph.edges(), n...
[ "0.6733386", "0.66894716", "0.6501065", "0.6438232", "0.6384303", "0.6357606", "0.6318119", "0.62464094", "0.6178377", "0.61569047", "0.60460675", "0.5998505", "0.5993081", "0.5944631", "0.59069026", "0.5852232", "0.5815307", "0.58126503", "0.57924825", "0.5792085", "0.578729...
0.56193626
31
Returns an iterator over inconsistent edges
def get_inconsistent_edges(graph): for u, v in _iter_pairs(graph): if not pair_is_consistent(graph, u, v): yield u, v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_inconsistent_edges(graph: BELGraph) -> Iterable[Tuple[BaseEntity]]:\n for u, v in graph.edges():\n if not pair_is_consistent(graph, u, v):\n yield u, v", "def edges(self) -> Iterable[Tuple[Node]]:\n edges = []\n for node in self.__graph_dict.keys():\n for nei...
[ "0.7528953", "0.7357906", "0.7300745", "0.7209116", "0.71582156", "0.69598824", "0.6937165", "0.69073635", "0.69073635", "0.67656124", "0.6638462", "0.66057724", "0.65948063", "0.6583909", "0.6570076", "0.6515526", "0.64862835", "0.648145", "0.6469323", "0.6456677", "0.645290...
0.7111966
5
Iterates over the diseases encountered in edges
def _pathology_iterator(graph): for u, v in _iter_pairs(graph): if graph.node[u][FUNCTION] == PATHOLOGY: yield u if graph.node[v][FUNCTION] == PATHOLOGY: yield v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iteredges(self):\n for source, targets in self.successors.items():\n for target in targets:\n yield source, target", "def edges(self):\n for e in self._edges:\n yield e", "def edges(self):\n return self.dovetails + self.containments + self.internals", ...
[ "0.6399897", "0.6153952", "0.61008126", "0.60606647", "0.6040917", "0.59607315", "0.5926328", "0.5895811", "0.5892186", "0.5819291", "0.5712466", "0.5706369", "0.56961864", "0.56956095", "0.56910306", "0.5677939", "0.5674862", "0.56623685", "0.5655787", "0.5648146", "0.564723...
0.0
-1
Returns a counter of all of the mentions of pathologies in a network
def count_pathologies(graph): return Counter(_pathology_iterator(graph))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_relations(graph):\n return Counter(\n data[RELATION]\n for _, _, data in graph.edges_iter(data=True)\n )", "def num_links(self):\n count=0.0\n for cluster in self.clusters:\n if self.clusters[cluster] == self.clusters[cluster].antecessor:\n numberofmembers=se...
[ "0.6493108", "0.6265583", "0.61763126", "0.58439344", "0.58234376", "0.5724303", "0.5712313", "0.56395566", "0.5600497", "0.5599743", "0.5586163", "0.55701447", "0.5519347", "0.55081844", "0.54878646", "0.54671645", "0.54594654", "0.54498696", "0.5437356", "0.543203", "0.5405...
0.7180617
0
Create a new point at the origin
def __init__(self): self.x = 0 self.y = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone(self):\n return Point(self.x, self.y)", "def clone(self):\n return Point(self.x, self.y)", "def makePoint( nX, nY ):\n oPoint = createUnoStruct( \"com.sun.star.awt.Point\" )\n oPoint.X = nX\n oPoint.Y = nY\n return oPoint", "def makePoint( nX, nY ):\n oPoint = createUno...
[ "0.6625126", "0.6625126", "0.652878", "0.652878", "0.64970213", "0.6491764", "0.6487044", "0.64737606", "0.64691556", "0.644956", "0.6440114", "0.63928", "0.6373065", "0.6364371", "0.63607216", "0.6351117", "0.6336342", "0.6333381", "0.6307605", "0.6301235", "0.62239677", "...
0.0
-1
method that calls the google maps API.
def find_distance(start, end, transit_mode=None): dis_url = build_url(start, end, transit_mode)[1] print(dis_url) json_response = json.loads(urllib.request.urlopen(dis_url).read().decode('utf-8')) travel_info = json_response[rows_key][0][elements_key][0] distance = travel_info[distance_key][text_key...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def google_map_api(request):\n\treturn {\n\t\t'GOOGLE_MAPS_API' : settings.GOOGLE_MAPS_API,\n\t}", "def googlemaps(request):\n assert False\n # return {\"GOOGLEMAPS_API_KEY\": settings.GOOGLEMAPS_API_KEY}", "def google(self):\r\n prefix ='https://maps.googleapis.com/maps/api/staticmap?center='\...
[ "0.6655652", "0.64451903", "0.6228928", "0.6192054", "0.61880857", "0.60813564", "0.5891248", "0.58714527", "0.5839972", "0.5789041", "0.57397115", "0.57201695", "0.5664012", "0.5558423", "0.55010176", "0.5402953", "0.5361477", "0.5352793", "0.5310342", "0.5282193", "0.526921...
0.0
-1
Takes advantage of html parser as google directions api returns instructions in html. So want to strip all html tags and just return text
def find_directions(start, end, transit_mode=None): dir_url = build_url(start, end, transit_mode)[0] json_response = json.loads(urllib.request.urlopen(dir_url).read().decode('utf-8')) route_legs = json_response[routes_key][0][legs_key] directions = [] for leg in route_legs: for step in leg[s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_html( html):\n return html2txt(html)", "def strip_html(text):\n soup = BeautifulSoup(text, \"html.parser\")\n return soup.get_text()", "def strip_html(inputString):\r\n return BeautifulSoup(inputString, \"html.parser\").text", "def strip_html_tags(text):\r\n soup = BeautifulSoup(text,...
[ "0.76679367", "0.7576908", "0.7565884", "0.72577864", "0.7234185", "0.7175138", "0.7175138", "0.7033482", "0.7032647", "0.6952287", "0.6933355", "0.6921029", "0.68994737", "0.6894347", "0.6892037", "0.68644744", "0.68379956", "0.6834254", "0.6825286", "0.67909366", "0.6725576...
0.0
-1
builds the url to get the static map. puts a marker on the start and end locations. assumes start and end are in a format / have enough info to give a proper location. does clean white spaces tho
def find_map(start, end, *otherlocs): small = "200x200" large = "512x512" start = start.replace(" ","+") end = end.replace(" ","+") small_url = g_api_base_url + static_url + small + map_type_url + small_marker_url + start + map_concat + end big_url = g_api_base_url + static_url + large + map_type_url + mark...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_url(self):\n if self.has_marker:\n marker_param = f'mlat={self.mlat}&mlng={self.mlng}&'\n else:\n marker_param = ''\n if self.start:\n start_param = 'start=true&'\n else:\n start_param = ''\n url = f'{MapController.MAP_URL}...
[ "0.7412921", "0.7408514", "0.6695499", "0.6539618", "0.65338993", "0.64012855", "0.6347697", "0.62790763", "0.625587", "0.61357576", "0.60827684", "0.60016644", "0.5909071", "0.5871183", "0.5864181", "0.58204234", "0.57807314", "0.5719914", "0.57073295", "0.5690754", "0.56851...
0.74909633
0
builds urls for the directions and distance matrix apis
def build_url(start, end, transit_mode): transit = "" traffic = "best_guess" depart = "now" if transit_mode: transit = transit_mode direc_url = g_api_base_url + dir_url + "origin=" + start + "&destination=" + end + trans_url \ + transit + goog_dir_key dist_url = g_api_base_url + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_url(_origin_details, travel_start_date, travel_start_time, destination_list):\n prefix = 'https://timetable.search.ch/api/route.json?one_to_many=1'\n\n origin_body = f'&from={_origin_details}&date={travel_start_date}&time={travel_start_time}'\n\n # Build iteratively with necessary syntax betwee...
[ "0.662632", "0.6459529", "0.64105844", "0.63785255", "0.61424583", "0.6120072", "0.61160785", "0.5975166", "0.5922255", "0.5866318", "0.58486396", "0.58353645", "0.5809004", "0.5791701", "0.5777878", "0.57720447", "0.5690597", "0.5641834", "0.56298447", "0.5613718", "0.560166...
0.7186997
0
Calls all the map methods and returns a tuple with all the info
def get_all_map_info(start, end, transit_mode=None): directions = find_directions(start, end, transit_mode) distance = find_distance(start, end, transit_mode) static_map = find_map(start, end) return (distance, directions, static_map)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map():", "def map(self):\r\n pass", "def _do_mapping(self):\n pass", "def get_data(self) -> Tuple[PoliciesMap, ZonesMap, LinksMap]:\n return self.policies_map, self.zones_map, self.links_map", "def _map_fn(self):\n raise NotImplementedError", "def map( self ) :\n\n self.rea...
[ "0.73169774", "0.66956455", "0.64216447", "0.62629515", "0.62388194", "0.61226577", "0.60859364", "0.60153437", "0.5962893", "0.5897065", "0.5868335", "0.58180994", "0.5802025", "0.57440436", "0.57440436", "0.5740578", "0.5721933", "0.5717749", "0.57169694", "0.5674728", "0.5...
0.5570534
24
Defines the way to parse the magic command ``%%maml``.
def maml_parser(): parser = MagicCommandParser(prog="maml", description='Runs a maml script.') parser.add_argument('-q', '--quiet', action='store_true', default=False, help='hide output') return parser
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maml(self, line, cell):\n parser = self.get_parser(CsMLMagics.maml_parser, \"maml\")\n args = self.get_args(line, parser)\n\n if args is not None:\n quiet = args.quiet\n out, err = maml(cell, not quiet)\n if out:\n print(out)\n if ...
[ "0.670974", "0.5512939", "0.51862484", "0.5175543", "0.50888264", "0.49876153", "0.49551958", "0.49524027", "0.49337393", "0.4880694", "0.48664626", "0.48470613", "0.4794826", "0.47836807", "0.4777479", "0.47459564", "0.47455326", "0.4718852", "0.46997732", "0.46576157", "0.4...
0.740539
0
Defines magic command ``%%maml``.
def maml(self, line, cell): parser = self.get_parser(CsMLMagics.maml_parser, "maml") args = self.get_args(line, parser) if args is not None: quiet = args.quiet out, err = maml(cell, not quiet) if out: print(out) if err: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maml_parser():\n parser = MagicCommandParser(prog=\"maml\",\n description='Runs a maml script.')\n parser.add_argument('-q', '--quiet', action='store_true', default=False,\n help='hide output')\n return parser", "def command(s...
[ "0.6546807", "0.5515294", "0.52751005", "0.52579564", "0.5237155", "0.51861405", "0.512959", "0.5102926", "0.49472788", "0.49453253", "0.49353927", "0.49225372", "0.4891675", "0.48703486", "0.47610494", "0.470173", "0.46908697", "0.4684091", "0.46759415", "0.4654112", "0.4648...
0.6613872
0
Defines the way to parse the magic command ``%%mlnet``.
def mlnet_parser(): parser = MagicCommandParser(prog="mlnet", description='Compiles and wrap a C# function into a Python function.\n' 'Automatically adds ML.net dependencies.') parser.add_argument('name', type=str, help=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mlnet(self, line, cell):\n line, cell = CsMagics._preprocess_line_cell_maml( # pylint: disable=W0212\n line, cell)\n\n parser = self.get_parser(CsMagics.CS_parser, \"CS\")\n args = self.get_args(line, parser)\n\n if args is not None:\n name = args.name\n ...
[ "0.57447124", "0.53171813", "0.5278795", "0.52074957", "0.5104776", "0.5055335", "0.50357693", "0.5034653", "0.49979833", "0.49518523", "0.4937366", "0.49060217", "0.49001834", "0.4745951", "0.47331885", "0.4656194", "0.46342298", "0.46050298", "0.46031177", "0.4588288", "0.4...
0.7271368
0
Defines magic command ``%%mlnet``.
def mlnet(self, line, cell): line, cell = CsMagics._preprocess_line_cell_maml( # pylint: disable=W0212 line, cell) parser = self.get_parser(CsMagics.CS_parser, "CS") args = self.get_args(line, parser) if args is not None: name = args.name dep = CsMa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mlnet_parser():\n parser = MagicCommandParser(prog=\"mlnet\",\n description='Compiles and wrap a C# function into a Python function.\\n'\n 'Automatically adds ML.net dependencies.')\n parser.add_argument('name', typ...
[ "0.6607906", "0.5527357", "0.54824287", "0.5431624", "0.54184914", "0.54072374", "0.53655416", "0.52886176", "0.5091649", "0.49965236", "0.4974869", "0.49429768", "0.49062353", "0.48281196", "0.48139057", "0.4807876", "0.47813764", "0.47685274", "0.47484493", "0.47436157", "0...
0.5684712
1
Normalize a ND numpy array along the specified axis.
def normalize(nparray, order=2, axis=0): norm = np.linalg.norm(nparray, ord=order, axis=axis, keepdims=True) return nparray / (norm + np.finfo(np.float32).eps)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(a, axis=None):\n a_sum = a.sum(axis)\n if axis and a.ndim > 1:\n a_sum[a_sum == 0] = 1\n shape = list(a.shape)\n shape[axis] = 1\n a_sum.shape = shape\n\n return a / a_sum", "def normalize_axis(x, axis, dtype=float):\n x = x.astype(dtype)\n ind_list = [sli...
[ "0.79087126", "0.77035505", "0.7302382", "0.7287287", "0.72832733", "0.71538836", "0.70283896", "0.69810927", "0.69810927", "0.69810927", "0.6960576", "0.69318247", "0.68613905", "0.68207276", "0.6742309", "0.67182606", "0.6710599", "0.669388", "0.665268", "0.6642963", "0.663...
0.7220615
5
Create a pyplot plot and save to buffer.
def gen_plot(fpr, tpr): plt.figure() plt.xlabel("FPR", fontsize=14) plt.ylabel("TPR", fontsize=14) plt.title("ROC Curve", fontsize=14) plot = plt.plot(fpr, tpr, linewidth=2) buf = io.BytesIO() plt.savefig(buf, format='jpeg') buf.seek(0) plt.close() # plt.show() return buf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_plot(self, ):\n pass", "def save_plot(self):\r\n\t\t# Generate the plot\r\n\t\tself.generate_plot()\r\n\t\t# Create save directory\r\n\t\tdirectory = self.dir + '/%s/' % str(int(self.universe.init_time))\r\n\t\tif not path_exists(directory):\r\n\t\t\tmakedirs(directory)\r\n\t\t# Save image file\r...
[ "0.6640928", "0.63603246", "0.6227816", "0.6167168", "0.61360306", "0.6119261", "0.6099436", "0.6096821", "0.60925245", "0.60660166", "0.60238034", "0.60147", "0.60147", "0.60105187", "0.6010414", "0.5986429", "0.5986346", "0.5965323", "0.59541225", "0.59522265", "0.59299445"...
0.62246305
3
training linear classifier using stochastic gradient desent
def train(self, X, y, learning_rate = 1e-3, reg = 1e-5, num_iter = 100, batch_size = 100, verbose = False): num_train, dim = X.shape num_classes = np.max(y) + 1 # assum y take values 0..K-1 # initialize weight if self.W is None: self.W = 0.001 * np.random...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self,features,y):\r\n \r\n if self.learn_type == \"nn\":\r\n #generate supervised dataset\r\n return(self.learner.train_on_batch(features,y))\r\n elif self.learn_type == \"linear\":\r\n grad = 0\r\n n = len(features)\r\n for i in...
[ "0.7036311", "0.6894752", "0.6888206", "0.6804692", "0.6742188", "0.6733776", "0.6727004", "0.67164975", "0.6693492", "0.666076", "0.6657247", "0.66092634", "0.65603244", "0.6525685", "0.6510231", "0.6499339", "0.64880437", "0.6471506", "0.64697635", "0.64687717", "0.6464059"...
0.0
-1
predict labels for test set by using the training weight
def predict(self, X): y_pred = np.zeros(X.shape[1]) y_pred = np.argmax(X.dot(self.W), axis = 1) return y_pred
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(test_dataset,test_tX,weights):\n for idx, dataset in enumerate(test_tX):\n test_dataset[idx]['Prediction'] = predict_labels(weights[idx],dataset)\n return test_dataset", "def predictTest(k, train, test):\r\n\r\n pred_labels = []\r\n\r\n # for each instance in the testing dataset, c...
[ "0.78087956", "0.7457491", "0.733405", "0.7281375", "0.7198543", "0.7198543", "0.7198543", "0.71389765", "0.71339434", "0.7059202", "0.7003482", "0.69429874", "0.6942311", "0.6911286", "0.68954164", "0.6894094", "0.6872331", "0.68667066", "0.68229765", "0.68118906", "0.681115...
0.0
-1
Attach a text label above each bar in rects, displaying its height.
def autolabel(rects, r, p): for j in range(len(rects)): rect = rects[j] height = rect.get_width() # print("height: ", height) ax.annotate( "F1: " + '{}'.format(height) + " (P: " + str(p[j]) + "; R: " + str(r[j]) + ")", xy=(height, rect.get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autolabel(rects, ax):\n global BAR_NUMBER_SIZE\n for rect in rects:\n height = rect.get_height()\n ax.text(rect.get_x() + rect.get_width()/2.,\n height,\n str(round(height, 1)),\n ha ='center',\n va ='bottom',\n size...
[ "0.807113", "0.79336554", "0.7861467", "0.7835557", "0.7822906", "0.77769476", "0.7776375", "0.7745001", "0.7730597", "0.7730573", "0.7708679", "0.77040344", "0.7690377", "0.7677892", "0.76754576", "0.76730984", "0.76562864", "0.7648832", "0.7645011", "0.7640306", "0.76307166...
0.69238454
80
Override and call super. Then do the deletion.
async def DeleteRoutine(self, name: str): #okay. problem was being cased by this line. #the problem is, that we delete items as part of updating #from gitlab. And in that case, we don't want to wipe out the local config. #so while it may seem like we should conveniently do this, probab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self):\n\n raise NotImplementedError('Must be implemented by subclasses')", "def delete(self):\n raise NotImplementedError", "def delete(self):\n raise NotImplementedError()", "def delete(self):\n raise NotImplementedError()", "def delete(self):\n ...", "def ...
[ "0.8312543", "0.8277076", "0.8197373", "0.8197373", "0.81892085", "0.81146294", "0.81122106", "0.81122106", "0.81122106", "0.81122106", "0.776644", "0.77381533", "0.76547843", "0.76547843", "0.7546651", "0.74831843", "0.7471033", "0.7380182", "0.73753977", "0.7372484", "0.736...
0.0
-1
Deletes the local configuration for a container.
async def delete_local_configuration_routine(self, name: str): plat = get_local_platform_routines() user = LocalUserRoutines(plat) manager = LocalContainerConfigurationManager(user) cont = self.GetItemByName(name) manager.DeleteByID(cont.GetID())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_local_config(self):\n with ignored(OSError):\n os.remove(os.path.join(self.rundir, const.LOCAL_CONFIG_FILE))", "def delete_container(self, container: Container):", "def delete_container(self, account, container):\n \n pass", "def delete_container(ContainerName=None)...
[ "0.68364567", "0.65952647", "0.65655595", "0.63887167", "0.6293753", "0.6252849", "0.6222041", "0.6218625", "0.6210771", "0.61385065", "0.6115384", "0.6097698", "0.60793775", "0.60496986", "0.6009285", "0.6003192", "0.59821314", "0.59776366", "0.5943736", "0.5928523", "0.5888...
0.7014883
0
Create a new container and put it in the local registry.
async def CreateUpdateRoutine(self, name: str): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def container(name, ostemplate, **kwargs):\n if not openvz.exists(name):\n ctid = openvz.get_available_ctid()\n openvz.create(ctid, ostemplate=ostemplate, **kwargs)\n openvz.set(ctid, name=name)\n return Container(name)", "def _create_container(self, container_name):\n try:\n ...
[ "0.6844575", "0.67954034", "0.6773649", "0.6728745", "0.65901256", "0.64971393", "0.64853096", "0.64367366", "0.6405615", "0.6405615", "0.6405615", "0.6405615", "0.6405615", "0.6378271", "0.6365454", "0.6297557", "0.6289078", "0.61622214", "0.6106284", "0.6105109", "0.6075229...
0.0
-1
provides list of model ids being managed by this service
def get(): return {'model_ids': mgmt.get_model_ids()}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_ids(self, protocol=None, groups=None):\n return [model.id for model in self.models(protocol, groups)]", "def getIDs(self):\n return self.multiengine.getIDs()", "def queryModelIDs(self):\n jobID = self.getJobID()\n modelCounterPairs = _clientJobsDB().modelsGetUpdateCounters(jobID)\n ...
[ "0.7586092", "0.7151575", "0.715052", "0.70966995", "0.6926851", "0.6900199", "0.6856862", "0.6841992", "0.6827314", "0.6738882", "0.6738882", "0.65993893", "0.6594838", "0.6443746", "0.64352286", "0.64352286", "0.6365598", "0.6365598", "0.6353262", "0.6318382", "0.6318382", ...
0.70333165
4
MS Access can't handle complex Decimal types
def convert_data_type(self, datatype): converted = Engine.convert_data_type(self, datatype) if "NUMERIC" in converted: converted = "NUMERIC" elif "VARCHAR" in converted: try: length = int(converted.split('(')[1].split(')')[0].split(',')[0]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_decimal_e(cursor: pyodbc.Cursor):\n value = Decimal((0, (1, 2, 3), 5)) # prints as 1.23E+7\n cursor.execute(\"create table t1(d decimal(10, 2))\")\n cursor.execute(\"insert into t1 values (?)\", value)\n result = cursor.execute(\"select * from t1\").fetchone()[0]\n assert result == value",...
[ "0.7193939", "0.6367631", "0.62804735", "0.61756307", "0.61756307", "0.5980316", "0.59415334", "0.58247906", "0.58159804", "0.58049774", "0.57988", "0.57257456", "0.57224286", "0.5637044", "0.5616838", "0.5612793", "0.5556482", "0.5542215", "0.5521639", "0.54359597", "0.54014...
0.0
-1
MS Access doesn't create databases.
def create_db(self): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_db():\n db.create_all()\n click.echo(\"DB criado com sucesso!\")", "def create_db():\n db.create_all()\n print(\"DB Created\")", "def create_db():\n db.create_all()\n click.echo(\"Banco de dados criado\")", "def create_new_db():\n global data_base, table\n data_base...
[ "0.7011877", "0.695819", "0.69425726", "0.69318235", "0.6931772", "0.6898847", "0.68810636", "0.68499804", "0.68499804", "0.68499804", "0.68499804", "0.68499804", "0.68499804", "0.68499804", "0.68499804", "0.68499804", "0.68499804", "0.68499804", "0.6847495", "0.6831007", "0....
0.6871423
7
Returns a drop table or database SQL statement.
def drop_statement(self, object_type, object_name): drop_statement = "DROP %s %s" % (object_type, object_name) return drop_statement
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop(name):\n\t\treturn \"DROP DATABASE {0};\".format(name)", "def _get_sql_drop_table(table_attr):\n template = 'DROP TABLE IF EXISTS \"%s\" CASCADE;' % (table_attr['name'])\n return template", "def drop_statement(self, objecttype, objectname):\n statement = Engine.drop_statement(self...
[ "0.7439682", "0.7192483", "0.7143962", "0.7049561", "0.67682046", "0.6763672", "0.6577111", "0.64398366", "0.6311948", "0.63029295", "0.6295627", "0.62305164", "0.62251985", "0.6221728", "0.6211469", "0.6206424", "0.6188908", "0.61786735", "0.6153751", "0.61287767", "0.612725...
0.7213489
1
Perform a bulk insert.
def insert_data_from_file(self, filename): self.get_cursor() if self.check_bulk_insert() and self.table.header_rows < 2 and ( self.table.delimiter in ["\t", ","]): print("Inserting data from " + os.path.basename(filename) + "...") if self.table.delimiter == "\t":...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _insert_bulk(self, iterable):\n self.cursor.executemany(self.INSERT, iterable)\n self.conn.commit()", "def bulkInsert(self, url, values):\n pass", "def insertmany(cls, *args):\n return InsertQuery(cls).bulk(True).set(*args)", "def bulk_insert(objects, model, session):\n ses...
[ "0.7786845", "0.77852196", "0.7621423", "0.7350911", "0.73435855", "0.7124371", "0.7046553", "0.7034076", "0.6918839", "0.68964547", "0.6739422", "0.67058235", "0.6680829", "0.66706884", "0.6661056", "0.66548723", "0.6608459", "0.6563865", "0.6560858", "0.6558214", "0.6519720...
0.0
-1