query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
plot the background stars (HR diagram). The plot is a 2d histogram, for better readability. Only bins with at least 10 stars a shown.
def plot_hr_diag(hr_df, x='B_V', y='M_V', cutoff=0.2, bvcutoff=0.05): plt.figure(figsize=(11., 10.)) print "Plotting background stars.." plt.set_cmap('gray_r') plt.hist2d(hr_df[x].tolist(), hr_df[y].tolist(), (200, 200), norm=LogNorm(), cmin=10) plt.axis([-0.2, 2.35, -3., 7.]) plt.gca().invert_y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_histogram(img):\n rgb_hist = rgb_histogram(img)\n plt.figure()\n for color, hist in rgb_hist.items():\n plt.plot(hist, color=color)\n plt.xlim([0, 256])", "def plot_hist(self):\n labels = [self.get_class_str(action, obj)\n for (action, obj, subj, rec, beg, ...
[ "0.5921788", "0.5898935", "0.586834", "0.586834", "0.586834", "0.5814485", "0.575388", "0.5714343", "0.5698721", "0.56886125", "0.5656541", "0.5636839", "0.56319624", "0.5586074", "0.55594313", "0.5537156", "0.54848033", "0.54779595", "0.5466038", "0.54587734", "0.5457407", ...
0.66867584
0
Parent function of get_variable_stars. Sequencially select 'variableTypes' variable stars and plot them on the HR diagram.
def plot_variable_stars(variablesdf, variabletype=None, x='B_V', y='M_V'): if variabletype is None: variabletype = ['CEP', 'BCEP', 'BCEPS', 'DSCT', 'SR', 'SRA', 'SRB', 'SRC', 'SRD', 'RR', 'RRAB', 'RRC', 'GDOR', 'SPB', 'M', 'LPV', 'roAp'] markers = ['^', 'D', 'D', 'v', 's', 'D', '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_variable_stars(df_data, df_variables_names, variabletype=None):\n if variabletype is None:\n variabletype = ['CEP', 'BCEP', 'BCEPS', 'DSCT', 'SR', 'SRA', 'SRB', 'SRC', 'SRD', 'RR', 'RRAB', 'RRC',\n 'GDOR', 'SPB', 'M', 'LPV']\n\n print \"Selecting variable stars..\"\n ...
[ "0.6919843", "0.5500659", "0.5284528", "0.5282017", "0.49810436", "0.49508908", "0.49358875", "0.47995615", "0.47526926", "0.4750297", "0.4654779", "0.4653055", "0.46524152", "0.46244058", "0.46109277", "0.45994213", "0.45680085", "0.45665252", "0.45277017", "0.4504224", "0.4...
0.76934016
0
Child function fo plot_variable_stars. Process the DataFrame to select only stars marked as 'var_type' variable stars.
def get_variable_stars(df_data, df_variables_names, variabletype=None): if variabletype is None: variabletype = ['CEP', 'BCEP', 'BCEPS', 'DSCT', 'SR', 'SRA', 'SRB', 'SRC', 'SRD', 'RR', 'RRAB', 'RRC', 'GDOR', 'SPB', 'M', 'LPV'] print "Selecting variable stars.." # create a st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_variable_stars(variablesdf, variabletype=None, x='B_V', y='M_V'):\n if variabletype is None:\n variabletype = ['CEP', 'BCEP', 'BCEPS', 'DSCT', 'SR', 'SRA', 'SRB', 'SRC', 'SRD', 'RR', 'RRAB', 'RRC', 'GDOR',\n 'SPB', 'M', 'LPV', 'roAp']\n markers = ['^', 'D', 'D', 'v', 's...
[ "0.7149481", "0.53572685", "0.49779034", "0.49217516", "0.4668608", "0.46611875", "0.46530828", "0.46240893", "0.46187612", "0.45908424", "0.4562476", "0.45395714", "0.4536326", "0.45301196", "0.4524316", "0.4492281", "0.4465708", "0.44525927", "0.4432995", "0.44032437", "0.4...
0.72028685
0
plot a Cepheid at its reddened position on the HR diag. (assume that deredden_cepheids() have been used)
def plot_dereddening(): extinction_coefficients = {'2365-2764-1': np.array([0.2622, 0.844]), '4109-638-1': np.array([0.0524, 0.1576]), '2058-56-1': np.array([0.0751, 0.248]), '3642-2459-1': np.array([0.1907, 0.608]), '3999-1391-1': np.array([0.3911, 1.24...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_1d_path(self):\n\n fig = plt.figure(figsize=(8,5))\n \n matches = (self.a_scale == self.c_scale)\n plt.plot(self.a_scale[matches], self.E_coh[matches])\n plt.xlabel('linear deformation coefficient: 0=fcc, 1=bcc')\n plt.ylabel('Cohesive energy (eV/atom)')\n ...
[ "0.563348", "0.5631599", "0.5533224", "0.5502739", "0.5487151", "0.5443683", "0.5419953", "0.5403358", "0.5385931", "0.53529364", "0.5345485", "0.53156674", "0.53142434", "0.53062516", "0.5289918", "0.52762717", "0.527185", "0.5271523", "0.524425", "0.52201706", "0.5217703", ...
0.6225962
0
Initializes the connection with IMDb.
def initialize_connection(): session = imdb.IMDb() return session
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup_connection(cls):\n try:\n cls.imdb_access = imdb.IMDb()\n except imdb.IMDbError, err:\n print \"Problem with connectivity to imdb.com due to %s \" \\\n % (err)", "def initialize():\n\t\tDBHelper.con = mdb.connect('localhost', 'root', 'sensepass', 'sens...
[ "0.75613075", "0.7126608", "0.70486325", "0.70344806", "0.6966653", "0.6887101", "0.6868013", "0.6741305", "0.6721468", "0.67194366", "0.6630532", "0.65871525", "0.6585673", "0.6537051", "0.6491186", "0.64337355", "0.6409378", "0.6344977", "0.6321777", "0.63136494", "0.628949...
0.75485164
1
Displays a generic error message when there is a connection error.
def display_error(): clear_screen() line = '#' * 20 print(f'{line}\n# CONNECTION ERROR #\n{line}') exit(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_error(self, conn, msg):\n print(\"ERROR PLACEHOLDER\")\n\n return", "def __display_error(self, socket_error):\r\n\t\tif socket_error == QAbstractSocket.RemoteHostClosedError:\r\n\t\t\tself._window.open_dialog(\"Serveur déconnecté\", \"Le serveur s'est déconnecté !\")\r\n\t\t\t# Add signal ...
[ "0.7256641", "0.70974416", "0.7031372", "0.70112437", "0.69415045", "0.6857179", "0.6755222", "0.6755222", "0.67330766", "0.6692993", "0.66359854", "0.65511245", "0.6525908", "0.6504783", "0.6490381", "0.64878225", "0.64797825", "0.64601153", "0.64406806", "0.64355856", "0.64...
0.738177
0
Displays the ratings that were scraped.
def display_ratings(ratings): # only attempt to display the ratings if any were found if ratings: print('\n[RATINGS]\n') for rating in ratings: print(f' {rating}', end=' ') # needed to get printing back to normal print()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_ratings(all_ratings):\n print(\"Here is the current list of all ratings:\")\n for restaurant, rating in sorted(all_ratings.items()):\n print(f'{restaurant} is rated at {rating}.')", "def display_player_ratings(player_ratings):\r\n print('\\nCLASSEMENT DES PARTICIPANTS:\\n Nom ELO ...
[ "0.6716487", "0.66836923", "0.6439657", "0.6439657", "0.64141905", "0.6388619", "0.6368018", "0.635137", "0.62618804", "0.6109449", "0.61091423", "0.609001", "0.6076961", "0.60705274", "0.6063568", "0.60551393", "0.60547274", "0.60209185", "0.60183233", "0.60183233", "0.60046...
0.74975514
0
Scrapes the plot from the provided URL.
def get_plot(url): soup = get_soup(url.rsplit('/', 1)[0]) if soup: # scrape the plot section plot_div = soup.find('div', {'id': 'titleStoryLine'}) # fixes bug were no plot is found try: plot_class = plot_div.find('span', {'itemprop': 'description'}) plot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def scrape_page(session, url):\n logging.info('Scraping %s', url)\n images = await get_url_images(session, url)\n await save_url_images(images)", "def scrape_url(url):\n html = requests.get(url).text\n return scrape_html(html)", "def fn_GetMoviePlot(self, details):\n\n # If the cust...
[ "0.59756243", "0.59229475", "0.5871458", "0.5760079", "0.56895536", "0.5675282", "0.56477475", "0.55973434", "0.5542551", "0.55007184", "0.54510456", "0.54468447", "0.54364306", "0.54364306", "0.54296917", "0.5414543", "0.53710335", "0.53710335", "0.5366538", "0.5339143", "0....
0.6619968
0
Cleans up the given comments.
def cleanup_comments(comments): clean_comments = [] if comments: for comment in comments: cleaned_up = sub(r'\n\n {8}\n {8}\n {12}\n {16}\n {16}\n {12}\nEdit', '', comment) clean_comments.append(cleaned_up) return clean_comments
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_comments(self):\n new_lines = list()\n for line in self.lines:\n if ((not line.startswith(\"//\")) & (not line.isspace()) &\n (not line.startswith(\"/*\") & (not line.startswith(\"*/\")))):\n line = Parser.strip_line(line)\n new_li...
[ "0.6856925", "0.64137363", "0.6254925", "0.6239691", "0.6239691", "0.62174577", "0.6139259", "0.5952024", "0.5854225", "0.5823274", "0.5761137", "0.5758094", "0.5758094", "0.5758094", "0.5758094", "0.5737992", "0.573623", "0.5734576", "0.5660582", "0.5650429", "0.56369406", ...
0.7856755
0
Parses the certificates specific to the United States.
def parse_certificates(soup): # removes the first item because it does not needed rating_tags = soup.find_all('a')[1:] rating_codes = [code.string for code in rating_tags] mpaa = [] if rating_codes: for rating in rating_codes: # sorry international folks, only interested in the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_country_states(self):\n pass", "def test_addr_country_good_values(self):\n for input_val, output_val in self.known_values:\n self.line._parse_addr_country(input_val)\n self.assertEqual(output_val, self.line.addr_country)", "def test_county_limit_by_state__valid_...
[ "0.52510595", "0.5242316", "0.50890213", "0.5040012", "0.49885833", "0.49216333", "0.49208397", "0.49044296", "0.48793742", "0.47967193", "0.4782242", "0.47812676", "0.4777004", "0.47749475", "0.47335306", "0.47322056", "0.47285786", "0.46640974", "0.46594405", "0.46486455", ...
0.54531664
0
Parses the given section.
def parse_section(soup): section_tag = soup.find_all('a', {'class': 'advisory-severity-vote__message'}) section_scale = [code.string for code in section_tag] section = section_scale[0] if section_scale else None section_comment_tags = soup.find_all('li', {'class': 'ipl-zebra-list__item'}) section_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_section(self, root, fmt):\n return self.parse_tag(root, fmt)", "def parse(self):\n for section in self.sections:\n section.parse()", "def do_section(parser, token, template='parts/section.html', end='endsection'):\n bits = token.split_contents()[1:]\n if len(bits) is 0:...
[ "0.7374695", "0.6986738", "0.68131596", "0.68070054", "0.6706419", "0.6671083", "0.65692985", "0.6440196", "0.64307415", "0.63216704", "0.62620395", "0.6214296", "0.6185266", "0.61728215", "0.6125363", "0.6123458", "0.61100674", "0.6085565", "0.6084057", "0.6030608", "0.60254...
0.71823096
1
Return True if ``value`` is an health check.
def is_healthcheck(self, value): return is_healthcheck(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(self, value) -> bool:\n return self._check_helper(value, raise_exceptions=False)", "def has_value(cls, value):\n return bool(isinstance(value, numbers.Number) or isinstance(value, time) or \\\n isinstance(value, datetime) or value)", "def is_true(value):\n \n return ...
[ "0.70862806", "0.6380764", "0.61718976", "0.598836", "0.5963879", "0.59439", "0.5902455", "0.5843611", "0.5777476", "0.57587725", "0.57587725", "0.57569546", "0.56969887", "0.56509334", "0.5631042", "0.55776083", "0.554896", "0.5548796", "0.55426407", "0.5515357", "0.55148315...
0.867911
0
Return copy of TestSuite where only health checks remain.
def filter_suite(self, suite): if isinstance(suite, unittest.TestSuite): suite_copy = self.suiteClass() for sub in suite: if isinstance(sub, unittest.TestSuite): suite_copy.addTest(self.filter_suite(sub)) else: if se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dry_run(self):\n self.result.report = self._new_test_report()\n\n for pyunit_testcase in self.cfg.testcases:\n testsuite_report = TestGroupReport(\n name=pyunit_testcase.__name__,\n uid=pyunit_testcase.__name__,\n category=ReportCategories.T...
[ "0.63560736", "0.6105774", "0.59605616", "0.58906287", "0.588734", "0.58871996", "0.5851725", "0.58468413", "0.5832818", "0.5828046", "0.57777184", "0.57675064", "0.57567066", "0.5658222", "0.5646921", "0.56121224", "0.56025547", "0.56018823", "0.5576602", "0.5569374", "0.556...
0.7639181
0
Load healthchecks from TestCase.
def loadTestsFromTestCase(self, testCaseClass): suite = super(HealthCheckLoader, self).loadTestsFromTestCase( testCaseClass) return self.filter_suite(suite)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_health_get(self):\n pass", "def test_lint(self):\n l = self.l\n l.loadTestsFromTestCase\n l.loadTestsFromModule\n l.loadTestsFromName\n l.loadTestsFromNames", "def loadTestsFromModule(self, module, *args, **kwargs):\n suite = super(HealthCheckLoader, se...
[ "0.6312396", "0.62286896", "0.61631715", "0.6092404", "0.6075559", "0.60417944", "0.6005269", "0.6000439", "0.5768636", "0.57478154", "0.57459795", "0.57209116", "0.5693739", "0.5679516", "0.56593746", "0.56551856", "0.56339574", "0.55915415", "0.55771744", "0.5574354", "0.55...
0.68875015
0
Load healthchecks from module.
def loadTestsFromModule(self, module, *args, **kwargs): suite = super(HealthCheckLoader, self).loadTestsFromModule( module, *args, **kwargs) return self.filter_suite(suite)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def healthcheck(parameters): \n\n print(\"In healthcheck module\")", "def _load(self):\n p = os.path.join(paths.setup_dir, 'system_health.yaml')\n if os.path.isfile(p):\n with open(p, 'r') as rfile:\n config = yaml.load(rfile)\n if config:\n ...
[ "0.6399756", "0.6244733", "0.600857", "0.5915704", "0.57699925", "0.569914", "0.565888", "0.5624556", "0.5607272", "0.560578", "0.55228066", "0.5457219", "0.541206", "0.5375242", "0.53745407", "0.53611326", "0.5358373", "0.5354235", "0.53232366", "0.53232366", "0.53232366", ...
0.6768524
0
Load healthchecks from name.
def loadTestsFromName(self, name, module=None): suite = super(HealthCheckLoader, self).loadTestsFromName(name, module) return self.filter_suite(suite)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadTestsFromNames(self, names, module=None):\n suite = super(HealthCheckLoader, self).loadTestsFromNames(names,\n module)\n return self.filter_suite(suite)", "def load(name):\n return []", "def deserialize(data):\n health...
[ "0.6285826", "0.5823373", "0.5733951", "0.56802326", "0.56788814", "0.56367904", "0.5605188", "0.5547318", "0.5484213", "0.5442093", "0.5427454", "0.53923076", "0.53107464", "0.5194388", "0.51722986", "0.51498437", "0.5135828", "0.511639", "0.5114361", "0.50697315", "0.504881...
0.65243924
0
Load healthchecks from names.
def loadTestsFromNames(self, names, module=None): suite = super(HealthCheckLoader, self).loadTestsFromNames(names, module) return self.filter_suite(suite)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadTestsFromName(self, name, module=None):\n suite = super(HealthCheckLoader, self).loadTestsFromName(name, module)\n return self.filter_suite(suite)", "def deserialize(data):\n healthchecks = []\n if data is None:\n return []\n for k, v in data.iteritems():\n hc = Healt...
[ "0.6379476", "0.59809893", "0.58267564", "0.5661063", "0.56127495", "0.5603886", "0.5571648", "0.55102366", "0.5353344", "0.5339407", "0.53231657", "0.5272784", "0.5235252", "0.5182474", "0.5097241", "0.5064218", "0.5057405", "0.504696", "0.5042437", "0.5037706", "0.49992388"...
0.7157677
0
Validate the public key if it is related to the given EC curve and formats the public key to a uncompressed byte string. Afterwards the function create a hash value of the uncompressed public key value
def get_public_key_fingerprint(curve: object, temp_public_key: object) \ -> object: vk = VerifyingKey.from_string(bytes.fromhex(temp_public_key), curve=curve) uncompressed_pub_key = vk.to_string('uncompressed') pub_key_hash_fingerprint = hashlib.sha256(uncompressed_pub_key) return pub_key_ha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forge_public_key(value) -> bytes:\n prefix = value[:4]\n res = base58.b58decode_check(value)[4:]\n\n if prefix == 'edpk':\n return b'\\x00' + res\n elif prefix == 'sppk':\n return b'\\x01' + res\n elif prefix == 'p2pk':\n return b'\\x02' + res\n\n raise ValueError(f'Unrec...
[ "0.70852506", "0.69108117", "0.6854899", "0.68222594", "0.6751205", "0.65805644", "0.65697986", "0.65697986", "0.64765847", "0.6456603", "0.6373267", "0.6364895", "0.6352023", "0.63497204", "0.6304584", "0.6302101", "0.6292437", "0.620116", "0.6189922", "0.6148473", "0.611294...
0.70131516
1
Save model hyperparameters/metadata to output directory. model_options is an argparse Namespace, and is converted to a dictionary and pickled.
def save_model_options(output_dir, model_options, predictor='classify'): if not isinstance(model_options.training_data, str): training_data = '.'.join(model_options.training_data) else: training_data = model_options.training_data output_file = construct_filename(output_dir, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model(output_dir, model, gene, model_options, predictor='classify'):\n\n if not isinstance(model_options.training_data, str):\n training_data = '.'.join(model_options.training_data)\n else:\n training_data = model_options.training_data\n\n output_file = construct_filename(output_dir...
[ "0.7630544", "0.7089318", "0.7027596", "0.6957321", "0.6957321", "0.6957321", "0.6866317", "0.68396884", "0.6824873", "0.6792376", "0.6774526", "0.66822237", "0.6664956", "0.6664538", "0.66604686", "0.6630448", "0.66119593", "0.6600588", "0.6593003", "0.65876275", "0.6582033"...
0.7801818
0
Charge given price to the card, assuming sufficient card limit Return True if charge was processed;False if charge was denied
def charge(self,price): if price + self._balance> self._limit: return False else: self._balance+=price return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charge(self, price):\n if not isinstance(price, (int, float)):\n raise TypeError('Price must be numeric')\n if price + self._balance > self._limit: # if charge would exceed limit\n return False # cannot accept charge\n self._balance += price\n...
[ "0.8322736", "0.8296711", "0.7829243", "0.6570418", "0.6408199", "0.612218", "0.61032504", "0.60590565", "0.6037275", "0.60188115", "0.5950383", "0.59281176", "0.59213865", "0.5874455", "0.58660394", "0.5860026", "0.5825693", "0.5783239", "0.57501924", "0.5738126", "0.5724947...
0.8432956
0
Process customer payment that reduces balance
def make_payment(self,amount): self._balance-=amount
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_payment(self, payment):\n self._balance -= payment", "def make_payment(self, amount):\n if not isinstance(amount, (int, float)):\n raise TypeError('Amount must be numeric')\n self._balance -= amount", "def make_payment(self, amount):\n if not isinstance(amount, (...
[ "0.66964227", "0.6128591", "0.61197674", "0.5983254", "0.5962717", "0.59586847", "0.5945208", "0.59426755", "0.59344083", "0.59324026", "0.5862457", "0.58423245", "0.5832974", "0.58243793", "0.58243793", "0.58215094", "0.582141", "0.5816743", "0.58033234", "0.5802297", "0.577...
0.6793116
0
Generate random bytes to use as csrf secret
def gen_csrf_secret(): return Random.new().read(csrf_secret_len)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_password():\n return urlsafe_b64encode(urandom(32)).decode('utf-8')", "def generate_token():\n chars = ('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')\n rand = random.SystemRandom()\n random_string = ''.join(rand.choice(chars) for _ in range(40))\n return hmac.new(\...
[ "0.751621", "0.7423662", "0.7333086", "0.7329716", "0.7236352", "0.7232258", "0.71953297", "0.71489805", "0.7082189", "0.70771956", "0.7053713", "0.70158905", "0.70001644", "0.6955148", "0.69448227", "0.6937748", "0.69271857", "0.692591", "0.69196445", "0.6904558", "0.6870434...
0.87860125
0
Read csrf secret from session if it exists; otherwise generate it and store in session
def get_csrf_secret(): sess = managers.request_manager.get_request().session() secret = sess.get(csrf_secret_sess_var_name, None) if not secret: secret = gen_csrf_secret() sess[csrf_secret_sess_var_name] = secret return secret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_csrf_secret():\n\treturn Random.new().read(csrf_secret_len)", "def getcsrf(session):\n session.get(\"http://anichart.net\")", "def generate_csrf_token():\n if '_csrf_token' not in login_session:\n login_session['_csrf_token'] = b64encode(urandom(64)).decode() # Cryptographically secure ra...
[ "0.7415861", "0.74125195", "0.72343606", "0.69048315", "0.686525", "0.6681955", "0.65113086", "0.64043695", "0.6368639", "0.6332918", "0.6305956", "0.625523", "0.6235409", "0.6150814", "0.6095577", "0.60392517", "0.6010801", "0.59956753", "0.59555525", "0.59422135", "0.590692...
0.7971118
0
Generate csrf token based on existing/new csrf secret and provided/new salt
def create_csrf_token(salt=''): if not salt: salt = Random.new().read(csrf_salt_len).encode('hex') h = SHA256.new() h.update(get_csrf_secret() + salt) return h.hexdigest() + salt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_csrf_secret():\n\treturn Random.new().read(csrf_secret_len)", "def generate_csrf_token() -> int:\r\n ...", "def generate_csrf_token():\n if '_csrf_token' not in login_session:\n login_session['_csrf_token'] = b64encode(urandom(64)).decode() # Cryptographically secure random key\n print...
[ "0.768297", "0.7293141", "0.70243514", "0.67706597", "0.6689844", "0.6654554", "0.6647972", "0.66283864", "0.6550067", "0.6501651", "0.64808244", "0.6338237", "0.6312519", "0.6307513", "0.6307513", "0.6238732", "0.62366146", "0.6235569", "0.6225915", "0.6221798", "0.6175029",...
0.80260617
0
Verify csrf token against csrf secret from the session; if token is not provided it's read from request arguments
def verify_csrf_token(token=''): if not token: token = managers.request_manager.get_request().arguments().arguments().get(csrf_token_arg_name, "") if token: token = token[0] if len(token) != 2 * digest_size + 2 * csrf_salt_len: debug('Incorrect csrf token length') raise VDOM_csrf_exception() salt = token[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csrf_protect():\n if request.method == \"POST\" and request.path[0:5] != \"/api/\":\n token = login_session.pop('_csrf_token', None)\n request_token = request.form.get('_csrf_token')\n print(\"Comparing server token [\" + token + \"]\")\n print(\"with client token [\" + request_t...
[ "0.75995755", "0.73856825", "0.73174137", "0.71832883", "0.7028827", "0.6969976", "0.69217205", "0.68938845", "0.68345594", "0.68069303", "0.66359556", "0.66284615", "0.6612116", "0.644829", "0.63917625", "0.6361629", "0.6360583", "0.63481784", "0.6308884", "0.6281791", "0.62...
0.79013884
0
list starter arguments that must be applied conditionally based on version
def get_version_specific_arguments(self, version: str): result = [] semversion = semver.VersionInfo.parse(version) # Extended database names were introduced in 3.9.0 if self.supports_extended_names: result += ["--args.all.database.extended-names-databases=true"] # T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_prelim_opts_args(application):\n opts, args = application.parse_preliminary_options(\n ['--foo', '--verbose', 'src', 'setup.py', '--statistics', '--version'])\n\n assert opts.verbose\n assert args == ['--foo', 'src', 'setup.py', '--statistics', '--version']", "def full_args():\n retur...
[ "0.6652257", "0.6436489", "0.64220834", "0.624852", "0.601735", "0.59371823", "0.5928165", "0.5906079", "0.59029114", "0.5887085", "0.58200306", "0.58132803", "0.57993174", "0.5784199", "0.57690525", "0.5752837", "0.573312", "0.57010204", "0.56947035", "0.5688802", "0.5674345...
0.74655694
0
get the list of dbservers managed by this starter
def get_dbservers(self): ret = [] for i in self.all_instances: if i.is_dbserver(): ret.append(i) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_servers(self):\n\t\treturn self.__servers", "def get_all_servers(self) -> List[Server]:\n pass", "def servers(self):\n return self._servers", "def get_databases(self):\n pass", "def databases(self):\n return self._databases", "def list_databases():\n config = load_c...
[ "0.7709002", "0.73207456", "0.7205934", "0.72003657", "0.70308435", "0.701856", "0.70004505", "0.69486785", "0.6863328", "0.6820925", "0.6803907", "0.6767398", "0.67585117", "0.67491573", "0.6748919", "0.6736712", "0.67257047", "0.6720556", "0.6672018", "0.6666036", "0.655856...
0.85010105
0
get the list of agents managed by this starter
def get_agents(self): ret = [] for i in self.all_instances: if i.instance_type == InstanceType.AGENT: ret.append(i) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manager_agents(self):\n return self.get(\"manager_agents\")", "def get_agents(self):\n if self.retrieved:\n raise errors.IllegalState('List has already been retrieved.')\n self.retrieved = True\n return objects.AgentList(self._results, runtime=self._runtime)", "def li...
[ "0.77033234", "0.7416487", "0.7300729", "0.7252941", "0.72281355", "0.7117161", "0.70339304", "0.6690089", "0.666582", "0.66602963", "0.6639476", "0.6470405", "0.6329325", "0.62738615", "0.6230014", "0.61977404", "0.61977404", "0.61977404", "0.61977404", "0.6167947", "0.61341...
0.76709455
1
get the first frontendhost of this starter
def get_frontend(self): servers = self.get_frontends() assert servers, "starter: don't have instances!" return servers[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFrontend(self):\n return self.header['FRONTEND']", "def head_host(self) -> str:\n return self.head_args.host if self.head_args else None", "def get_host(self):\r\n return self.host", "def getHost():", "def getHost():", "def get_host(self):\n return self.host", "def ma...
[ "0.6992638", "0.6583565", "0.65169436", "0.6433285", "0.6433285", "0.6352371", "0.63019204", "0.63019204", "0.63019204", "0.62645936", "0.6246942", "0.62244636", "0.61690867", "0.6142307", "0.6142307", "0.61053056", "0.61049336", "0.6103162", "0.60861087", "0.60844123", "0.60...
0.7496468
0
get the first dbserver of this starter
def get_dbserver(self): servers = self.get_dbservers() assert servers, "starter: don't have instances!" return servers[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stored_primary_server_name(db):\n if \"last_primary_server\" in db.collection_names():\n stored_primary_server = db.last_primary_server.find_one()[\"server\"]\n else:\n stored_primary_server = None\n\n return stored_primary_server", "def get_sync_master(self):\n servers = se...
[ "0.7175073", "0.68898433", "0.6632575", "0.6597116", "0.65586126", "0.6534296", "0.6407233", "0.63766783", "0.63378835", "0.6261345", "0.6257781", "0.61878526", "0.6167295", "0.6121482", "0.61021817", "0.61021364", "0.6087449", "0.6070265", "0.6051888", "0.599604", "0.5983254...
0.8454486
0
get the first agent of this starter
def get_agent(self): servers = self.get_agents() assert servers, "starter: have no instances!" return servers[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agent(self):\n return self.__agent", "def agent(self) -> Entity:\n return self.__agent", "def getfirstbot(self):\n\n return self.bots[0]", "def get_first(self):\n raise NotImplementedError(\"get_first: You should have implemented this method!\")", "def test_get_agent_name(self):...
[ "0.66546506", "0.6309816", "0.61794835", "0.5938089", "0.5912412", "0.5894221", "0.58619547", "0.58138776", "0.57892704", "0.57603174", "0.5742176", "0.57214665", "0.5696438", "0.568106", "0.5669796", "0.5664195", "0.5583705", "0.55532354", "0.55385774", "0.5535078", "0.55320...
0.76360667
0
get the first arangosync master of this starter
def get_sync_master(self): servers = self.get_sync_masters() assert servers, "starter: don't have instances!" return servers[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def master(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"master\")", "def master(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"master\")", "def master(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"master\")", "def getMaster(sel...
[ "0.6829638", "0.6829638", "0.6791485", "0.6693696", "0.6673793", "0.6628041", "0.657018", "0.63935375", "0.62487674", "0.61431384", "0.6016861", "0.5940178", "0.5940178", "0.58904886", "0.5833857", "0.5826365", "0.57743245", "0.5721033", "0.57085377", "0.5699552", "0.56985486...
0.72852707
0
get the essentials of all instances controlled by this starter
def get_instance_essentials(self): ret = [] for instance in self.all_instances: ret.append(instance.get_essentials()) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getEssentialList(self):\n return self.essentials", "def show_all_instances(self):\n if not self.all_instances:\n logging.error(\"%s: no instances detected\", self.name)\n return\n instances = \"\"\n for instance in self.all_instances:\n instances +...
[ "0.64952594", "0.61609066", "0.6024103", "0.57624537", "0.5747617", "0.5703971", "0.56971", "0.5676145", "0.56370413", "0.5501353", "0.547217", "0.54002124", "0.53892356", "0.53773415", "0.5376807", "0.53593886", "0.5353485", "0.5344247", "0.5336788", "0.5326446", "0.53020716...
0.8199698
0
print all instances of this starter to the user
def show_all_instances(self): if not self.all_instances: logging.error("%s: no instances detected", self.name) return instances = "" for instance in self.all_instances: instances += " - {0.name} (pid: {0.pid})".format(instance) logging.info("arangod in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_out():\n pass", "def print_results(self):\n pass", "def print_all(self) -> None:\n\n print(\"title: \" + str(self.title))\n print(\"simple_title: \" + str(self.simple_title))\n print(\"info: \" + str(self.info))\n print(\"exists: \" + str(self.exists))\n ...
[ "0.67142516", "0.6560021", "0.636873", "0.63599074", "0.6321213", "0.62887406", "0.6230574", "0.62254745", "0.6211867", "0.621094", "0.6190211", "0.6186281", "0.61838835", "0.61825544", "0.61808974", "0.6177476", "0.6169501", "0.6163866", "0.61381304", "0.61379516", "0.613546...
0.7568982
0
retrieve token from the JWT secret file which is cached for the future use
def get_jwt_token_from_secret_file(self, filename): # pylint: disable=consider-iterating-dictionary if filename in self.jwt_tokens.keys(): # token for that file was checked already. return self.jwt_tokens[filename] cmd = [ self.cfg.bin_dir / "arangodb", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peek_app_token():\n if not os.path.exists(_token_storage_path):\n return None\n\n try:\n with open(_token_storage_path) as secret_file:\n return json.loads(secret_file.read())\n\n except Exception as exc:\n log.error(f'Could not read secret file.\\n{exc}')\n trac...
[ "0.77592856", "0.7595998", "0.75481737", "0.7526818", "0.69495", "0.69054925", "0.6903875", "0.6800849", "0.6775595", "0.6755065", "0.6746886", "0.6740278", "0.67240804", "0.6659499", "0.66390276", "0.6621728", "0.6608063", "0.659404", "0.6589575", "0.65768105", "0.6572895", ...
0.8024519
0
return jwt header from current installation
def get_jwt_header(self): if self.jwt_header: return self.jwt_header self.jwt_header = self.get_jwt_token_from_secret_file(str(self.jwtfile)) return self.jwt_header
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authentication_header():\n with open(KEY_FILE, \"r\") as file:\n header = json.load(file)\n return header", "def get_authorization_header(self):\n return {\"Authorization\": \"Bearer {}\".format(self.get_jwt())}", "def get_jwt(self, request):\n auth_header_prefix = self.auth_head...
[ "0.7406444", "0.7215993", "0.7196089", "0.7186894", "0.7012713", "0.6979103", "0.6942568", "0.69397306", "0.69034165", "0.6893624", "0.6858153", "0.68385124", "0.6749719", "0.6743572", "0.6729134", "0.6724721", "0.6700563", "0.6690566", "0.6663717", "0.66617864", "0.663666", ...
0.8041909
0
set the passvoid to the managed instance
def set_passvoid(self, passvoid, write_to_server=True): if write_to_server: print("Provisioning passvoid " + passvoid) self.arangosh.js_set_passvoid("root", passvoid) self.passvoidfile.write_text(passvoid, encoding="utf-8") self.passvoid = passvoid for i in se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance(self, instance):\n self._instance = instance", "def set_instance(self, instance):\n self.instance = instance", "def set_instance(self, instance):\n self.instance = instance", "def set_instance(self, instance):\n self.instance = instance", "def set_instance(self, ins...
[ "0.6201083", "0.614531", "0.614531", "0.614531", "0.614531", "0.614531", "0.6030137", "0.5798542", "0.57683265", "0.5758265", "0.5750186", "0.57295257", "0.567436", "0.56572455", "0.56152976", "0.5603632", "0.5594542", "0.5575087", "0.55718654", "0.55426687", "0.54812384", ...
0.6298621
0
get the passvoid to the managed instance
def get_passvoid(self): return self.passvoid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n pass", "def get(self):\n pass", "def get(self):\n pass", "def get(self):\n pass", "def object(self):", "def retrieve(self):\n pass", "def context(self) -> Any:\n ...", "def context(self) -> CONTEXT:", "def get_transfer(self):\n return se...
[ "0.59444445", "0.59444445", "0.59444445", "0.59444445", "0.58766246", "0.5858545", "0.5811761", "0.5790257", "0.57571363", "0.57146895", "0.5700108", "0.5700108", "0.5633125", "0.5611686", "0.55938387", "0.55938387", "0.5585385", "0.55678827", "0.55678827", "0.55592895", "0.5...
0.6621574
0
make all managed instances plus the starter itself crash.
def crash_instances(self): try: if self.instance.status() == psutil.STATUS_RUNNING or self.instance.status() == psutil.STATUS_SLEEPING: print("generating coredump for " + str(self.instance)) gcore = psutil.Popen(["gcore", str(self.instance.pid)], cwd=self.basedir) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n cause_a_bunch_of_exceptions_to_happen()", "def detect_fatal_errors(self):\n for instance in self.all_instances:\n instance.detect_fatal_errors()", "def test_too_many_cores(self):\n compute1 = self.start_service('compute', host='host1')\n compute2 = self.start_se...
[ "0.6183212", "0.6157061", "0.5949658", "0.5940772", "0.58803564", "0.5872182", "0.58227324", "0.57449096", "0.573384", "0.5643141", "0.5623912", "0.5593848", "0.5592989", "0.559106", "0.55775046", "0.5566891", "0.5562831", "0.555892", "0.55581", "0.5557331", "0.5549696", "0...
0.70966077
0
wait for our instance to create a logfile
def wait_for_logfile(self): counter = 0 keep_going = True logging.info("Looking for log file.\n") while keep_going: self.check_that_instance_is_alive() if counter == 20: raise Exception("logfile did not appear: " + str(self.log_file)) c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_log_file_created(self, mock_parsing_handler, mock_api_handler, mock_progress):\n\n directory = path.join(path_to_module, \"fake_ngs_data\")\n directory_status = DirectoryStatus(directory)\n log_file = path.join(directory, \"irida-uploader.log\")\n # Check that log file does not...
[ "0.6342506", "0.6339533", "0.632533", "0.62805986", "0.61698097", "0.6142417", "0.60563993", "0.5989396", "0.58973587", "0.58555603", "0.5847372", "0.5842015", "0.5833766", "0.58280855", "0.58130676", "0.5812685", "0.5794679", "0.57772213", "0.5774569", "0.57051474", "0.56672...
0.7679139
0
wait for our instance to bind its TCPports
def wait_for_port_bind(self): if self.starter_port is not None: count = 0 while count < 10: for socket in self.instance.connections(): if socket.status == "LISTEN" and socket.laddr.port == self.starter_port: print("socket found!...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for_open_ports(self, instance_name=\"\"):\n ports = None\n if instance_name in wellknownports:\n ports = wellknownports[instance_name]\n else:\n elements = self.systemd_name.split(\"@\")\n if elements[0] in wellknownports:\n ports = well...
[ "0.7288536", "0.70136964", "0.699281", "0.669659", "0.663772", "0.66184366", "0.6514401", "0.6453551", "0.6413905", "0.63941497", "0.63894254", "0.6319579", "0.6308585", "0.6289045", "0.6239562", "0.6228363", "0.6223435", "0.62091696", "0.62067133", "0.6188757", "0.6175939", ...
0.8042169
0
kill the instance of this starter (it won't kill its managed services)
def kill_instance(self): logging.info("StarterManager: Killing: %s", str(self.default_starter_args + self.arguments)) self.instance.kill() try: logging.info(str(self.instance.wait(timeout=45))) self.add_logfile_to_report() except Exception as ex: raise...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill(self):\n # Prevent a weird behavior: when STOPPED and kill() is called, app crashes (FIXME)\n if self.__state is not ServiceState.STOPPED:\n os.kill(int(self.__properties['MainPID']), signal.SIGKILL)\n # Not nice but simple and currently working (FIXME)\n # TODO: Cha...
[ "0.7303505", "0.7108762", "0.70873225", "0.70490146", "0.69961184", "0.6964912", "0.6952806", "0.69508827", "0.6916327", "0.688939", "0.686323", "0.681936", "0.6806005", "0.6758173", "0.6745181", "0.6741397", "0.6677145", "0.6674688", "0.6668985", "0.6658009", "0.6651729", ...
0.7906417
0
replace the parts of the installation with information after an upgrade kill the starter processes of the old version revalidate that the old arangods are still running and alive replace the starter binary with a new one. this has not yet spawned any children
def replace_binary_for_upgrade(self, new_install_cfg, relaunch=True): # On windows the install prefix may change, # since we can't overwrite open files: old_version = self.cfg.version self.default_starter_args = new_install_cfg.default_starter_args.copy() self.enterprise = new_in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade(self):\n # The workaround we need in order to fix [1]. In few words,\n # when new Docker is installed the containers MUST NOT start\n # again because in this case puppet inside them will install\n # latest packages and breaks dependencies in some soft.\n #\n # ...
[ "0.63134474", "0.5887858", "0.5887858", "0.58364576", "0.57861626", "0.57441574", "0.57368964", "0.57141185", "0.57095736", "0.56810385", "0.56625885", "0.56388724", "0.5615103", "0.5612521", "0.5526397", "0.55071336", "0.5483531", "0.5466706", "0.54461366", "0.5432789", "0.5...
0.7012954
0
kill specific instances of this starter (it won't kill starter itself)
def kill_specific_instance(self, which_instances): for instance_type in which_instances: for instance in self.all_instances: if instance.instance_type == instance_type: instance.terminate_instance()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill_instance(self):\n logging.info(\"StarterManager: Killing: %s\", str(self.default_starter_args + self.arguments))\n self.instance.kill()\n try:\n logging.info(str(self.instance.wait(timeout=45)))\n self.add_logfile_to_report()\n except Exception as ex:\n ...
[ "0.70153147", "0.68872017", "0.68046296", "0.6784485", "0.6766652", "0.6715903", "0.6670214", "0.660583", "0.660212", "0.6543471", "0.65000117", "0.65000117", "0.64805627", "0.6475557", "0.6455918", "0.6429913", "0.6328956", "0.6207044", "0.6205789", "0.62014425", "0.6166641"...
0.7285985
0
wait for the upgrade commanding starter to finish
def wait_for_upgrade(self, timeout=60): ret = None try: ret = self.upgradeprocess.wait(timeout=timeout) except psutil.TimeoutExpired as timeout_ex: msg = "StarterManager: Upgrade command [%s] didn't finish in time: %d" % ( str(self.basedir), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_wait_for_upgrade(self):\n self.run_test_suites(self.wait_for_upgrade_test_suite_list)", "def waitUntilFinished():", "def waitUntilFinished():", "def waitUntilFinished():", "def waitUntilFinished():", "def test_do_upgrade(self):\n with self.with_config_update():\n result ...
[ "0.77359796", "0.7126432", "0.7126432", "0.7126432", "0.7126432", "0.6678276", "0.66306156", "0.6630208", "0.66240835", "0.64890206", "0.6419722", "0.640707", "0.640707", "0.64049435", "0.63792473", "0.6337039", "0.63248074", "0.62579197", "0.6122265", "0.6120902", "0.6113800...
0.73207533
1
tries to wait for the server to restart after the 'restore' command
def wait_for_restore(self): for node in self.all_instances: if node.instance_type in [ InstanceType.RESILIENT_SINGLE, InstanceType.SINGLE, InstanceType.DBSERVER, ]: node.detect_restore_restart()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finished_restarting():\n flags.restarting = False\n group_spawn(qtile.current_group)\n qtile.cmd_spawn(\"nitrogen --restore\")", "def continue_server():\n update_server_status({'ready': True})", "async def async_restore(self):\n await self._client.restore()\n self.async_write_ha_s...
[ "0.69105613", "0.6523955", "0.63679016", "0.62714815", "0.6169232", "0.6149965", "0.61382735", "0.61187077", "0.61115396", "0.61071575", "0.606816", "0.6046619", "0.6045591", "0.6022971", "0.6000961", "0.59798926", "0.59677154", "0.5965609", "0.59406596", "0.5929384", "0.5921...
0.7891546
0
use arangosh to run a command on the frontend arangod
def execute_frontend(self, cmd, verbose=True): return self.arangosh.run_command(cmd, verbose)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_command(self, args):\n pass", "def command():\n pass", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():...
[ "0.6615906", "0.6522063", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "0.6375979", "...
0.79413956
0
get the port of a syncmaster arangosync
def get_sync_master_port(self): self.sync_master_port = None pos = None sm_port_text = "Starting syncmaster on port" sw_text = "syncworker up and running" worker_count = 0 logging.info("detecting sync master port") while worker_count < 3 and self.is_instance_runni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def master_port(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"master_port\")", "def master_port(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"master_port\")", "def masterPort(self):\r\n return self._masterPort", "def port(self) -> int:", "def get_slave_port():\n ...
[ "0.70510185", "0.70510185", "0.70024353", "0.6852463", "0.68338513", "0.679988", "0.6775076", "0.6759334", "0.66923726", "0.6612166", "0.6540162", "0.6490325", "0.64330757", "0.6365352", "0.63405347", "0.6295224", "0.61943614", "0.6190745", "0.6190299", "0.6183827", "0.617589...
0.7340527
0
get the logfile of the dbserver instance
def read_db_logfile(self): server = self.get_dbserver() assert server.logfile.exists(), "don't have logfile?" return server.logfile.read_text(errors="backslashreplace")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logfile(self):\n return self._get('logfile')", "def log_db():\n return pymongo.MongoClient(SCITRAN_PERSISTENT_DB_LOG_URI).get_database()", "def getLogFile(self):\r\n return LOG.getLogFile().name", "def get_log(self):\n\n open_lf = open(self.logfile, 'r')\n log_str = open_lf...
[ "0.7550862", "0.7224536", "0.6880102", "0.6592017", "0.6583927", "0.6482713", "0.6482713", "0.6469686", "0.6463902", "0.63621795", "0.63040406", "0.6289661", "0.6283953", "0.6207564", "0.6207564", "0.6109618", "0.6103252", "0.6098555", "0.6073537", "0.60647166", "0.6054933", ...
0.7439977
1
get the agent logfile of this instance
def read_agent_logfile(self): server = self.get_agent() assert server.logfile.exists(), "don't have logfile?" return server.logfile.read_text(errors="backslashreplace")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logfile(self):\n return self._get('logfile')", "def get_log(self):\n\n open_lf = open(self.logfile, 'r')\n log_str = open_lf.read()\n sys.stdout.write(log_str)\n\n return log_str", "def getLogFile(self):\r\n return LOG.getLogFile().name", "def getLog(self):\n ...
[ "0.79751503", "0.73155695", "0.72758114", "0.72477007", "0.72477007", "0.70513636", "0.6913755", "0.68768865", "0.68585616", "0.6792453", "0.6792453", "0.6751899", "0.6743848", "0.6700573", "0.66865516", "0.66694623", "0.66520137", "0.66206974", "0.66192824", "0.66146636", "0...
0.7742073
1
detect the arangod instance PIDs
def detect_instance_pids(self): for instance in self.all_instances: instance.detect_pid( ppid=self.instance.pid, full_binary_path=self.cfg.real_sbin_dir, offset=0, ) self.show_all_instances() self.detect_arangosh_instances(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_instances(self):\n lh.subsection(\"Instance Detection for {0.name}\".format(self))\n jwt = self.get_jwt_header()\n self.all_instances = []\n logging.debug(\"waiting for frontend\")\n logfiles = set() # logfiles that can be used for debugging\n\n # the more inst...
[ "0.6319383", "0.61950517", "0.6192594", "0.61528647", "0.6111595", "0.6052284", "0.605194", "0.59694993", "0.59247625", "0.5862299", "0.5763337", "0.5762358", "0.5724921", "0.5709404", "0.5638399", "0.56117487", "0.5553753", "0.55345756", "0.54887575", "0.54887056", "0.545983...
0.77291846
0
scan all instances for `FATAL` statements
def detect_fatal_errors(self): for instance in self.all_instances: instance.detect_fatal_errors()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def errors_fatal(self) -> List[Error]:", "def fatal_error_processor(self):\n while True:\n _ = (yield)\n self.failed = True\n self.converged = False\n self.solve_completed = False", "def getFatalErrors(self):\n global hadFatalErrors\n if hadFatal...
[ "0.61938083", "0.6015998", "0.59813035", "0.5981033", "0.5679613", "0.55990446", "0.550483", "0.54907763", "0.5387474", "0.5358392", "0.5331162", "0.53206944", "0.5311066", "0.5309457", "0.5303004", "0.5290556", "0.5203423", "0.5195811", "0.51785743", "0.517628", "0.51631856"...
0.69902325
0
launch an arangobench instance to the frontend of this starter
def launch_arangobench(self, testacse_no, moreopts=None): arangobench = ArangoBenchManager(self.cfg, self.get_frontend()) arangobench.launch(testacse_no, moreopts) return arangobench
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n tng.api.runner()", "def train_main(cls):\n launcher = cls()\n launcher.launch()", "def launch_test():\n import sys\n from kothrak.envs.KothrakEnv import KothrakEnv\n from kothrak.envs.game.MyApp import style\n from PyQt5.QtWidgets import QApplication, QWidget\n\n q...
[ "0.6429091", "0.6309221", "0.62545246", "0.61604047", "0.6152724", "0.60954607", "0.6065459", "0.6057383", "0.60311", "0.59965384", "0.59894437", "0.5950306", "0.58948225", "0.5882779", "0.5840209", "0.5838446", "0.5817836", "0.58095634", "0.5783761", "0.5774965", "0.57688946...
0.78506184
0
in active failover detect whether we run the leader
def detect_leader(self): # Should this be moved to the AF script? lfs = self.read_db_logfile() became_leader = lfs.find("Became leader in") >= 0 took_over = lfs.find("Successful leadership takeover:" + " All your base are belong to us") >= 0 self.is_leader = became_leader or too...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_failover_detect_host_now_follower(self):\n self.check_that_instance_is_alive()\n lfs = self.get_log_file()\n if lfs.find(\"resilientsingle up and running as follower\") >= 0:\n self.is_master = False\n return True\n return False", "def probe_leader(sel...
[ "0.73940504", "0.7367778", "0.72519314", "0.724043", "0.7167702", "0.70824057", "0.69250184", "0.69241196", "0.67583", "0.65203124", "0.65203124", "0.6361834", "0.6304819", "0.6293747", "0.6229859", "0.6190928", "0.61597836", "0.604024", "0.60138893", "0.5951151", "0.58495647...
0.7651802
0
talk to the frontends to find out whether its a leader or not.
def probe_leader(self): # Should this be moved to the AF script? self.is_leader = False for instance in self.get_frontends(): if instance.probe_if_is_leader(): self.is_leader = True return self.is_leader
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_leader(self):\n # Should this be moved to the AF script?\n lfs = self.read_db_logfile()\n\n became_leader = lfs.find(\"Became leader in\") >= 0\n took_over = lfs.find(\"Successful leadership takeover:\" + \" All your base are belong to us\") >= 0\n self.is_leader = bec...
[ "0.7640331", "0.74470776", "0.74470776", "0.74285924", "0.713586", "0.6762263", "0.6751401", "0.6734137", "0.6681536", "0.65391123", "0.64464325", "0.629198", "0.6276058", "0.62618124", "0.61972916", "0.61910975", "0.6164121", "0.59911203", "0.5944456", "0.5918337", "0.587292...
0.78123844
0
detect hosts for the active failover
def active_failover_detect_hosts(self): self.check_that_instance_is_alive() # this is the way to detect the master starter... lfs = self.get_log_file() if lfs.find("Just became master") >= 0: self.is_master = True else: self.is_master = False regx ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sniff_hosts(self):\n previous_sniff = self.last_sniff\n hosts = []\n try:\n # reset last_sniff timestamp\n self.last_sniff = time.time()\n try:\n hosts = self.get_es_node_addresses()\n except Exception:\n raise Trans...
[ "0.6949691", "0.6628178", "0.6534761", "0.6527784", "0.64729506", "0.64609885", "0.64203495", "0.64133173", "0.63669676", "0.6323245", "0.6245519", "0.6221742", "0.6206262", "0.62053776", "0.61899376", "0.61697066", "0.61608654", "0.6157352", "0.6157352", "0.61356586", "0.612...
0.8014416
0
detect whether we successfully respawned the instance, and it became a follower
def active_failover_detect_host_now_follower(self): self.check_that_instance_is_alive() lfs = self.get_log_file() if lfs.find("resilientsingle up and running as follower") >= 0: self.is_master = False return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def respawn(self):\n # If we are in the middle of respawning, this is non-zero.\n self.respawning = 1\n self.center_x = SCREEN_WIDTH / 2\n self.center_y = 600", "def respawn(self):\n # If we are in the middle of respawning, this is non-zero.\n self.respawning = 1\n ...
[ "0.62327015", "0.61734205", "0.5913024", "0.58508074", "0.58208185", "0.58022654", "0.5687446", "0.56421936", "0.56058353", "0.55823416", "0.55794746", "0.55337363", "0.5507955", "0.5464997", "0.54603153", "0.54300016", "0.5409948", "0.540742", "0.54065454", "0.54039454", "0....
0.6564329
0
Add starter log to allure report
def add_logfile_to_report(self): logfile = str(self.log_file) attach.file(logfile, "Starter log file", AttachmentType.TEXT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logStarted(build, step, log):", "def setup_logfile():\r\n from core.general.appinit import log_init\r\n log_init(\r\n 'general',\r\n 'django_api'\r\n )", "def write_terraform_apply_log_header(self):\n with open(self.terraform_install_log, 'a+') as logfile:\n logfile...
[ "0.6069437", "0.5960698", "0.59574604", "0.5930421", "0.5885275", "0.5810344", "0.57965165", "0.5733731", "0.5677679", "0.567086", "0.56483895", "0.5602861", "0.5598323", "0.5581187", "0.5545258", "0.5526509", "0.55119", "0.5511117", "0.5473258", "0.5438435", "0.54359597", ...
0.6250697
0
get HTTP protocol for this starter(http/https)
def get_http_protocol(self): if self.cfg.ssl: return "https" else: return "http"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_protocol():\n if https():\n protocol = 'https'\n else:\n protocol = 'http'\n return protocol", "def get_protocol(self):\n if self.ssl:\n return \"https\"\n else:\n return \"http\"", "def protocol(self):\n return 'https' if self.allow_htt...
[ "0.85699964", "0.8152591", "0.7916452", "0.74209046", "0.7311242", "0.7305693", "0.7218571", "0.7194539", "0.70896435", "0.69592017", "0.68593144", "0.68068993", "0.6778132", "0.6735765", "0.67253834", "0.65918314", "0.6591383", "0.6480884", "0.6470097", "0.64394146", "0.6407...
0.8308429
1
Check that starter instance is alive
def check_that_instance_is_alive(self): if not self.instance.is_running(): raise Exception(f"Starter instance is not running. Base directory: {str(self.basedir)}") if self.instance.status() == psutil.STATUS_ZOMBIE: raise Exception(f"Starter instance is a zombie. Base directory: {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_alive(self):\n pass", "def is_alive(self):\n return True", "def is_alive(self):", "def alive(self):\n return True", "def is_instance_up(self):\n logging.debug(\"checking if starter instance booted: \" + str(self.basedir))\n if not self.instance.is_running():\n ...
[ "0.77166504", "0.7615171", "0.74846673", "0.7292565", "0.7082333", "0.69093466", "0.69083273", "0.687419", "0.6822564", "0.66718936", "0.66718936", "0.66681343", "0.6643307", "0.6634902", "0.6621218", "0.6621218", "0.66178095", "0.66134834", "0.6612024", "0.6602468", "0.65610...
0.820519
0
check whether substring is present in the starter log
def check_that_starter_log_contains(self, substring: str): if self.count_occurances_in_starter_log(substring) > 0: return else: raise Exception( f"Expected to find the following string: {substring}\n in this log file:\n{str(self.log_file)}" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_contains(self, s: str) -> bool:\n return len(list(filter(lambda str: s in str, self.logs))) > 0", "def hasSubstring(self, s):\n node, off = self.followPath(s)\n return node is not None", "def _is_substring(s1, s2):\n\treturn s1.find(s2) != -1", "def match_substring(self, str):\n ...
[ "0.68737906", "0.6771097", "0.6496623", "0.6410618", "0.63869303", "0.63129365", "0.61710656", "0.61576027", "0.6072304", "0.6054336", "0.6003412", "0.5982007", "0.596408", "0.576148", "0.5692559", "0.5674016", "0.5639905", "0.563524", "0.56121904", "0.56079257", "0.55621016"...
0.82817847
0
count occurrences of a substring in the starter log
def count_occurances_in_starter_log(self, substring: str): number_of_occurances = self.get_log_file().count(substring) return number_of_occurances
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_substring(string, sub_string):\n return string.count(sub_string)", "def count_sub(sub, s):\n count = 0\n for i in range(len(s) - len(sub) + 1):\n if s[i:i + len(sub)] == sub:\n count += 1\n return count", "def recCountString():\r\n target = raw_input(\"Enter target st...
[ "0.69256353", "0.6731468", "0.6658297", "0.6571659", "0.6564363", "0.6540324", "0.6493924", "0.6485271", "0.64711386", "0.6334691", "0.63335073", "0.6273863", "0.626735", "0.6240192", "0.62162554", "0.6199468", "0.6196827", "0.61422545", "0.6131402", "0.6095801", "0.6036622",...
0.8001489
0
fake run starter method
def run_starter(self, expect_to_fail=False):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startTestRun(self):", "def test_get_run(self):\n pass", "def run(_):\n pass", "def Run():\r\n pass", "def runtest(self):", "def run_experiment():\n pass", "def run():\n main()", "def runTests(self):\n \n pass", "def test_run_started(self):", "def run_test(self...
[ "0.74126184", "0.73602825", "0.7261935", "0.72602695", "0.72600466", "0.7242399", "0.72393954", "0.7110345", "0.71020657", "0.7089417", "0.70837325", "0.7037372", "0.7013169", "0.70076424", "0.6999183", "0.6999183", "0.6967566", "0.6933449", "0.6933449", "0.6933449", "0.69334...
0.8099833
0
Test case for basketballteams_get
def test_basketballteams_get(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_basketballteams_id_get(self):\n pass", "def test_get_teams(self):\n pass", "def test_get_teams(self):\n pass", "def test_teams_get_teams_v2(self):\n pass", "def test_retrieve_team(self):\n pass", "def test_teams_get_teams_v1(self):\n pass", "def test_t...
[ "0.8449335", "0.84178495", "0.84178495", "0.81079006", "0.81024987", "0.7863653", "0.7826981", "0.7781774", "0.7720299", "0.7501402", "0.7489745", "0.7379568", "0.7356525", "0.72275877", "0.7195928", "0.71437454", "0.71002096", "0.70476884", "0.69918925", "0.6990166", "0.6847...
0.93158627
0
Test case for basketballteams_id_get
def test_basketballteams_id_get(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_basketballteams_get(self):\n pass", "def test_workflows_id_team_get(self):\n pass", "def test_gridironfootballplayers_id_get(self):\n pass", "def test_data_source_soaps_id_team_get(self):\n pass", "def test_brains_id_get(self):\n pass", "def test_cyclingleagues...
[ "0.7799063", "0.7685305", "0.7607886", "0.74427456", "0.72060305", "0.6990276", "0.6840412", "0.68341905", "0.68341905", "0.6772549", "0.6731343", "0.67035055", "0.6620671", "0.66105074", "0.6533537", "0.6475667", "0.645218", "0.6435485", "0.63834304", "0.6345525", "0.630249"...
0.939899
0
Update the internal state of the Plot to represent the given key tuple (where integers represent frames). Returns this state.
def update(self, key): return self.state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_frame(self, key, ranges=None):", "def _get_frame(self, key):\n layout_frame = self.layout.clone(shared_data=False)\n keyisint = isinstance(key, int)\n if not isinstance(key, tuple): key = (key,)\n nthkey_fn = lambda x: zip(tuple(x.name for x in x.kdims),\n ...
[ "0.6366824", "0.57968193", "0.57502097", "0.5714252", "0.56339014", "0.5459689", "0.54484665", "0.54372066", "0.5365949", "0.5340403", "0.5326292", "0.5320078", "0.5305696", "0.52860016", "0.52631617", "0.52473605", "0.5218694", "0.52184427", "0.5185107", "0.51785284", "0.515...
0.64864296
0
Get the state of the Plot for a given frame number.
def __getitem__(self, frame): if not self.dynamic == 'open' and isinstance(frame, int) and frame > len(self): self.warning("Showing last frame available: %d" % len(self)) if not self.drawn: self.handles['fig'] = self.initialize_plot() if not self.dynamic == 'open' and not isinstance(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFrame(self, num):\n\n return self.data[num]", "def get_plot_state(self_or_cls, obj, renderer=None, **kwargs):\n if not isinstance(obj, Plot):\n obj = self_or_cls.get_plot(obj=obj, renderer=renderer, **kwargs)\n return obj.state", "def get_frame(self, frame):\n retu...
[ "0.6576043", "0.64040893", "0.6168167", "0.61134017", "0.6076815", "0.6055128", "0.5951637", "0.5882845", "0.58641803", "0.5848422", "0.5799237", "0.5756058", "0.5718137", "0.5702686", "0.56998396", "0.56985414", "0.5595627", "0.5593545", "0.5543105", "0.5521952", "0.5484779"...
0.6989357
0
Traverses any nested DimensionedPlot returning a list of all plots that match the specs. The specs should be supplied as a list of either Plot types or callables, which should return a boolean given the plot class.
def traverse(self, fn=None, specs=None, full_breadth=True): accumulator = [] matches = specs is None if not matches: for spec in specs: matches = self.matches(spec) if matches: break if matches: accumulator.append(fn(self) if fn els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_available_figures(self):\n return sorted((method[5:], func) \\\n for method, func in self.__class__.__dict__.iteritems() \\\n if method.startswith(\"plot_\") and callable(func))", "def get_plots(self):\n return list(self.plots.values())", "def _sp...
[ "0.52858", "0.52142483", "0.51448363", "0.50744987", "0.50589556", "0.48802635", "0.48739997", "0.48073155", "0.4798928", "0.4749356", "0.47428975", "0.47420156", "0.47197765", "0.46932372", "0.46918872", "0.4680866", "0.46731734", "0.46569225", "0.4638593", "0.46093962", "0....
0.56958634
0
Given an object, a specific key and the normalization options this method will find the specified normalization options on the appropriate OptionTree, group the elements according to the selected normalization option (i.e. either per frame or over the whole animation) and finally compute the dimension ranges in each gr...
def compute_ranges(self, obj, key, ranges): all_table = all(isinstance(el, Table) for el in obj.traverse(lambda x: x, [Element])) if obj is None or not self.normalize or all_table: return OrderedDict() # Get inherited ranges ranges = self.ranges if ranges is None else dict(ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_norm_opts(self, obj):\n norm_opts = {}\n\n # Get all elements' type.group.label specs and ids\n type_val_fn = lambda x: (x.id, (type(x).__name__, util.group_sanitizer(x.group, escape=False),\n util.label_sanitizer(x.label, escape=False))) \\\n ...
[ "0.6445774", "0.48843622", "0.4852263", "0.48259893", "0.4770748", "0.47455063", "0.4726611", "0.4720005", "0.4644569", "0.46267", "0.45563284", "0.4543702", "0.454177", "0.45273983", "0.4494524", "0.4494449", "0.44733185", "0.44697282", "0.44692782", "0.44428465", "0.4435969...
0.689226
0
Gets the normalization options for a LabelledData object by traversing the object for to find elements and their ids. The id is then used to select the appropriate OptionsTree, accumulating the normalization options into a dictionary. Returns a dictionary of normalization options for each element in the tree.
def _get_norm_opts(self, obj): norm_opts = {} # Get all elements' type.group.label specs and ids type_val_fn = lambda x: (x.id, (type(x).__name__, util.group_sanitizer(x.group, escape=False), util.label_sanitizer(x.label, escape=False))) \ if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dictize(self):\n dict = {}\n for node in self.sort():\n logger.debug(\"Dictize: id %s has name %s\" % (node._id, node.name))\n x = node._kwargs()\n dict[node._id]={\"klass\":node.__class__.__name__, \n \"kwargs\": x,\n ...
[ "0.4882127", "0.48138362", "0.46735653", "0.46150512", "0.45790586", "0.44817707", "0.44758487", "0.4465512", "0.442252", "0.44222006", "0.43991864", "0.43809223", "0.4366402", "0.43599775", "0.4356347", "0.43552524", "0.43511787", "0.42940468", "0.42261603", "0.42139208", "0...
0.6927882
0
Traverses the supplied object getting all options in opts for the specified opt_type and specs. Also takes into account the plotting class defaults for plot options. If a keyfn is supplied the returned options will be grouped by the returned keys.
def _traverse_options(cls, obj, opt_type, opts, specs=None, keyfn=None, defaults=True): def lookup(x): """ Looks up options for object, including plot defaults, keyfn determines returned key otherwise None key is used. """ options = cls.lookup_options(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _all_opt_infos(self):\n for info in self._opts.values():\n yield info, None\n for group in self._groups.values():\n for info in group._opts.values():\n yield info, group", "def get_plot_kwargs(cfg, option, key=None):\n plot_kwargs = cfg.get(option, {}).ge...
[ "0.5892671", "0.5606828", "0.56063414", "0.550141", "0.54399914", "0.5378535", "0.5304472", "0.52757764", "0.52567726", "0.52553415", "0.52336997", "0.5221113", "0.5217911", "0.51816285", "0.5152726", "0.51514137", "0.5142801", "0.51401424", "0.5134124", "0.5131874", "0.51075...
0.86038965
0
Looks up options for object, including plot defaults, keyfn determines returned key otherwise None key is used.
def lookup(x): options = cls.lookup_options(x, opt_type) selected = {o: options.options[o] for o in opts if o in options.options} if opt_type == 'plot' and defaults: plot = Store.registry[cls.backend].get(type(x)) selected['defa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _traverse_options(cls, obj, opt_type, opts, specs=None, keyfn=None, defaults=True):\n def lookup(x):\n \"\"\"\n Looks up options for object, including plot defaults,\n keyfn determines returned key otherwise None key is used.\n \"\"\"\n options = cl...
[ "0.6476717", "0.6211503", "0.57079715", "0.5571008", "0.5534396", "0.547191", "0.54293185", "0.5385394", "0.53531367", "0.53213716", "0.5306876", "0.5284712", "0.5159889", "0.51395476", "0.5116941", "0.51114714", "0.50779635", "0.507736", "0.5073758", "0.5022548", "0.5020879"...
0.6997502
0
Uses traversal to find the appropriate projection for a nested object. Respects projections set on Overlays before considering Element based settings, before finally looking up the default projection on the plot type. If more than one nonNone projection type is found an exception is raised.
def _get_projection(cls, obj): isoverlay = lambda x: isinstance(x, CompositeOverlay) opts = cls._traverse_options(obj, 'plot', ['projection'], [CompositeOverlay, Element], keyfn=isoverlay) from_overlay = not all(p is None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def projectionManip(*args, fitBBox: bool=True, projType: int=0, switchType: bool=True, q=True,\n query=True, **kwargs)->Union[None, Any]:\n pass", "def create_projection_from_projector_element(\n self, element, weight, type, projector_id\n ):\n projection = {\n \...
[ "0.61008054", "0.57861453", "0.541124", "0.5349921", "0.5343465", "0.5273637", "0.5211582", "0.51546365", "0.5075276", "0.504999", "0.49605206", "0.49293154", "0.48868015", "0.48221928", "0.48099476", "0.4738513", "0.47346017", "0.47128424", "0.47019666", "0.46675426", "0.459...
0.6758612
0
Computes the zorder of element in the NdOverlay taking into account possible batching of elements.
def get_zorder(self, overlay, key, el): spec = util.get_overlay_spec(overlay, key, el) try: return self.ordering.index(spec) except ValueError: self.ordering = sorted(self.ordering+[spec]) return self.ordering.index(spec)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getz_index(self):\n return self._getz_index", "def optimise_z(z, *args):\n x, y, elements, coordinates = args\n window_com = np.array([x, y, z])\n return pore_diameter(elements, coordinates, com=window_com)[0]", "def z(self):\r\n return self.position.z", "def _set_planar_pixel_order(im...
[ "0.57028675", "0.55984366", "0.5478423", "0.54625237", "0.5441317", "0.537248", "0.5289451", "0.52060914", "0.5195802", "0.51892036", "0.51678", "0.5121228", "0.51193726", "0.50830746", "0.507015", "0.5063056", "0.5060691", "0.5056381", "0.5056132", "0.50311744", "0.5008574",...
0.72016543
0
Gets the extents for the axes from the current View. The globally computed ranges can optionally override the extents.
def get_extents(self, view, ranges): ndims = len(view.dimensions()) num = 6 if self.projection == '3d' else 4 if self.apply_ranges: if ranges: dims = view.dimensions() x0, x1 = ranges[dims[0].name] if ndims > 1: y0, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extents(self):\n self._updateExtents()\n return self.mExtents", "def extents(self):\n x0, y0, width, height = self._rect_bbox\n xmin, xmax = sorted([x0, x0 + width])\n ymin, ymax = sorted([y0, y0 + height])\n return xmin, xmax, ymin, ymax", "def extents(self):\n\n ...
[ "0.72161704", "0.6875994", "0.6859144", "0.67906785", "0.65129864", "0.63847166", "0.63576", "0.6300293", "0.6264915", "0.6224861", "0.61757976", "0.61531943", "0.61249256", "0.61061025", "0.60827875", "0.6021081", "0.5992878", "0.599001", "0.59846133", "0.5962699", "0.596207...
0.7218878
0
Given a HoloMap compute the appropriate (mapwise or framewise) ranges in order to apply the Compositor collapse operations in display mode (data collapse should already have happened).
def _apply_compositor(self, holomap, ranges=None, keys=None, dimensions=None): # Compute framewise normalization defaultdim = holomap.ndims == 1 and holomap.kdims[0].name != 'Frame' if keys and ranges and dimensions and not defaultdim: dim_inds = [dimensions.index(d) for d in holoma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _modify_map_size(self, merged_map):\n pos_x_white, pos_y_white = np.where(merged_map == 255)\n pos_x_black, pos_y_black = np.where(merged_map == 0)\n\n pos_x_M = np.amax(np.hstack((pos_x_black, pos_x_white)))\n pos_x_m = np.amin(np.hstack((pos_x_black, pos_x_white)))\n pos_y_...
[ "0.53061557", "0.5123476", "0.50569475", "0.5041872", "0.4931829", "0.49258262", "0.4896154", "0.4868902", "0.4862584", "0.48051956", "0.48001003", "0.47694784", "0.47593305", "0.47555342", "0.4747587", "0.47454724", "0.47438157", "0.47292355", "0.47042343", "0.46995413", "0....
0.77395713
0
This Function is used to control the Movement of the Snake
def Movement(): keys = pygame.key.get_pressed() if keys[pygame.K_LEFT] and not snake.ang==90: snake.x_change = -snake.vel snake.y_change = 0 snake.left = True snake.right = False snake.up = False snake.down = False snake.ang = -90 elif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self):\r\n piece = []\r\n if self.direction == \"UP\":\r\n piece = [self.body[0][0], self.body[0][1] - self.POS_CHANGE] # create piece at new coordinates\r\n elif self.direction == \"DOWN\":\r\n piece = [self.body[0][0], self.body[0][1] + self.POS_CHANGE]\r\n ...
[ "0.7399674", "0.6836237", "0.6778097", "0.6765576", "0.67256254", "0.66972667", "0.65777445", "0.6498739", "0.6492528", "0.6492464", "0.64858997", "0.6451853", "0.64459854", "0.640347", "0.64023644", "0.6400139", "0.6397963", "0.6363882", "0.6341559", "0.63338673", "0.6333867...
0.78153515
0
This Function Calculates distance between Food and Snake
def Distance(foodx,foody): di = ((snake.x - foodx)**2) + ((snake.y - foody)**2) d = int(math.sqrt(di)) return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure_distance(self):\n # set Trigger to HIGH\n GPIO.output(self.GPIO_TRIGGER, True)\n\n # set Trigger after 0.01ms to LOW\n time.sleep(0.00001)\n GPIO.output(self.GPIO_TRIGGER, False)\n\n start_time = time.time()\n stop_time = time.time()\n\n # save St...
[ "0.6700603", "0.6521232", "0.6514296", "0.63147444", "0.62802625", "0.6160367", "0.61424226", "0.6136788", "0.61203325", "0.6113802", "0.6087659", "0.6070107", "0.6063656", "0.6058297", "0.60548335", "0.60548335", "0.60385036", "0.6023612", "0.60140026", "0.5991973", "0.59842...
0.8156581
0
Updates the value of a leaf node and all the sums above it. Idx expected in the [0, capacity] range.
def update(self, idx, value): idx = self.__capacity - 1 + idx self.__tree[idx] = value self.__update(idx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(\n self, index: Union[int, np.ndarray], value: Union[float, np.ndarray]\n ):\n\n tree_index = self.capacity + index\n self._tree[tree_index] = value\n\n # Propagate up the tree.\n parent = tree_index // 2\n while np.any(parent > 0):\n left = self._...
[ "0.74209356", "0.6767374", "0.6753369", "0.6640915", "0.62751794", "0.6238642", "0.61967045", "0.61868465", "0.618199", "0.6152516", "0.6152516", "0.6152516", "0.6084542", "0.5986752", "0.5953413", "0.5944968", "0.58795923", "0.581223", "0.5790687", "0.57693315", "0.57603663"...
0.74235
0
Receives the idx of a leaf node and updates the sums on all the nodes above it based on its current value.
def __update(self, idx): parent = (idx - 1) // 2 while parent >= 0: left, right = 2 * parent + 1, 2 * parent + 2 self.__tree[parent] = self.__tree[left] + self.__tree[right] parent = (parent - 1) // 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(\n self, index: Union[int, np.ndarray], value: Union[float, np.ndarray]\n ):\n\n tree_index = self.capacity + index\n self._tree[tree_index] = value\n\n # Propagate up the tree.\n parent = tree_index // 2\n while np.any(parent > 0):\n left = self._...
[ "0.70218706", "0.6763772", "0.65720445", "0.6464258", "0.634624", "0.62440336", "0.62352777", "0.6203399", "0.6152715", "0.61511225", "0.61511225", "0.61511225", "0.61307853", "0.6130343", "0.6128592", "0.61171615", "0.6116346", "0.60709554", "0.60432565", "0.60112834", "0.59...
0.75952435
0
Given an arbitrary number of functions we create a pipeline where the output is piped between functions. You can also specify a tuple of arguments that should be passed to the functions in the pipeline. The first argument is always the output of the previous function. This version uses the reduce builtin instead of usi...
def ReducePipeline(*funcs, **kwargs): def accum(val, func): funcArgs = kwargs.get(func.__name__, tuple()) if hasattr(val, "__call__"): return func(val(), *funcArgs) else: return func(val, *funcArgs) def wrapper(*data): newFuncs = (partial(funcs[0], *data)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pipe(*functions):\n\n return reduce(compose, functions, identity)", "def make_pipeline(steps):\n def compose2(f, g):\n return lambda x: g(f(x))\n return functools.reduce(compose2, steps)", "def compose(*fns):\n return functools.reduce(lambda f,g: lambda x: f(g(x)), fns)", "def compose(...
[ "0.85493785", "0.79058933", "0.7589019", "0.75349104", "0.7516276", "0.7404753", "0.7371548", "0.7317679", "0.7314664", "0.7298046", "0.7296629", "0.7294338", "0.7245193", "0.719107", "0.71188146", "0.7108474", "0.710505", "0.7088272", "0.69122714", "0.6900706", "0.68673223",...
0.8107064
1
Check move possibility using observation window
def is_move_possible(obs_window, displacement): pos_row = obs_window.shape[0] // 2 pos_col = obs_window.shape[1] // 2 new_pos_row = pos_row + displacement[0] new_pos_col = pos_col + displacement[1] is_traversable = obs_window[new_pos_row, new_pos_col] == 0 is_shortcut = obs_window[new_pos_row,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ismoving(self):\n return self.dp.state()==PyTango.DevState.MOVING", "def move_window():\n\tif SLIDING_WINDOW:\n\t\t# get the chosen predicates\n\t\tpred = Predicate.objects.filter(pk__in=[p+1 for p in toggles.CHOSEN_PREDS])\n\n\t\t# handle window properties\n\t\tfor p in pred:\n\t\t\tp.move_window()"...
[ "0.6529597", "0.6286072", "0.6259327", "0.6203149", "0.6197683", "0.6197294", "0.6170365", "0.601616", "0.5998505", "0.5931079", "0.5923095", "0.5921639", "0.5878888", "0.5877249", "0.58698124", "0.585277", "0.5812267", "0.5797952", "0.5775176", "0.57483536", "0.5737459", "...
0.7049266
0
Returns the CPModule from within the loaded Python module m an imported module returns the CPModule class
def find_cpmodule(m): for v, val in list(m.__dict__.items()): if isinstance(val, type) and issubclass(val, cellprofiler_core.module.Module): return val raise ValueError( "Could not find cellprofiler_core.module.Module class in %s" % m.__file__ )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _module(self):\n if self._module_cache is None:\n self._module_cache = load_module(self._name, self._path)\n return self._module_cache", "def base_module(self) -> nn.Module:\n return getattr(__import__(\"src.modules\", fromlist=[\"\"]), self.name)", "def get_module(self):\n ...
[ "0.6648748", "0.64653724", "0.64607435", "0.6405533", "0.63600814", "0.6347188", "0.63392264", "0.63091576", "0.625608", "0.6237327", "0.61681557", "0.6154078", "0.6154078", "0.6154078", "0.6154078", "0.6154078", "0.6122566", "0.6057319", "0.6050425", "0.6026159", "0.6026159"...
0.7351052
0
CPU mnist test for TF Training Instance Type c5.4xlarge Given above parameters, registers a task with family named after this test, runs the task, and waits for the task to be stopped before doing teardown operations of instance and cluster.
def test_ecs_tensorflow_training_mnist_cpu(cpu_only, ecs_container_instance, tensorflow_training, training_cmd, ecs_cluster_name): instance_id, cluster_arn = ecs_container_instance ecs_utils.ecs_training_test_executor(ecs_cluster_name, cluster_arn, training_cmd, tenso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mnist():\n env = os.environ.copy()\n if not \"CUDA_VISIBLE_DEVICES\" in env:\n env[\"CUDA_VISIBLE_DEVICES\"] = \"\"\n subprocess.run(\n \"edflow -b template_tfe/config.yaml -t --max_batcher_per_epoch --num_epochs 1\",\n shell=True,\n check=True,\n env=env,\n ...
[ "0.67484915", "0.63618076", "0.60620654", "0.5980725", "0.5914939", "0.59113973", "0.59051156", "0.58966136", "0.5866718", "0.58654135", "0.5864061", "0.58606243", "0.5860597", "0.58368456", "0.58136004", "0.5806316", "0.57960474", "0.5792729", "0.57621115", "0.5742489", "0.5...
0.6672013
1
GPU mnist test for TF Training Instance Type p3.2xlarge Given above parameters, registers a task with family named after this test, runs the task, and waits for the task to be stopped before doing teardown operations of instance and cluster.
def test_ecs_tensorflow_training_mnist_gpu(gpu_only, ecs_container_instance, tensorflow_training, training_cmd, ecs_cluster_name): instance_id, cluster_arn = ecs_container_instance num_gpus = ec2_utils.get_instance_num_gpus(instance_id) ecs_utils.ecs_training_tes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mnist():\n env = os.environ.copy()\n if not \"CUDA_VISIBLE_DEVICES\" in env:\n env[\"CUDA_VISIBLE_DEVICES\"] = \"\"\n subprocess.run(\n \"edflow -b template_tfe/config.yaml -t --max_batcher_per_epoch --num_epochs 1\",\n shell=True,\n check=True,\n env=env,\n ...
[ "0.6628726", "0.6221861", "0.6108858", "0.6095782", "0.60324526", "0.60173756", "0.6013705", "0.60083187", "0.59039736", "0.58947945", "0.58934516", "0.5819561", "0.5818858", "0.5764458", "0.5733247", "0.5716348", "0.57152057", "0.5713483", "0.5712434", "0.569594", "0.5687781...
0.6573886
1
GPU Faster RCNN test for TF Training Instance Type g3.8xlarge Given above parameters, registers a task with family named after this test, runs the task, and waits for the task to be stopped before doing teardown operations of instance and cluster.
def test_ecs_tensorflow_training_fasterrcnn_gpu(gpu_only, ecs_container_instance, tensorflow_training, training_cmd, ecs_cluster_name): instance_id, cluster_arn = ecs_container_instance num_gpus = ec2_utils.get_instance_num_gpus(instance_id) ecs_utils.ecs_trainin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_testing(gpu=0):\n # expected environment variables\n os.environ[\"BERT_BASE_DIR\"] = \"pretrained/cased_L-12_H-768_A-12\"\n os.environ[\"DATA_DIR\"] = \"dataset\"\n os.environ[\"OUTPUT_DIR\"] = \"output\"\n assert os.environ.get(\"BERT_BASE_DIR\") is not None\n assert os.environ.get(\"DATA...
[ "0.63982433", "0.63317746", "0.6286564", "0.62145746", "0.6099212", "0.6017336", "0.59935385", "0.5987405", "0.59732693", "0.5968696", "0.59411806", "0.58942217", "0.58580977", "0.58526134", "0.5831714", "0.58247334", "0.5802177", "0.57978106", "0.5790498", "0.5788643", "0.57...
0.6722839
0
Takes a results list and puts it in a pandas dataframe together with other relevant variables (runs, generations, and language class)
def language_stats_to_dataframe(results, n_runs, n_gens, possible_form_lengths): if len(possible_form_lengths) == 1: n_language_classes = 4 else: n_language_classes = 7 #TODO: or should this be 6 (i.e. collapsing the two different reduplication strategies?) column_proportion = np.array(re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataframe(result):\n # List of elements in the search result\n names = []\n snippet = []\n url = []\n \n # Append search results to list\n for j,item in enumerate(result):\n for i,element in enumerate(result[j]['items']):\n names.append(result[j]['items'][i]['title...
[ "0.72283614", "0.71309644", "0.6913391", "0.6884854", "0.6688005", "0.65761745", "0.6487272", "0.6475751", "0.6433946", "0.632648", "0.6261752", "0.6226283", "0.6154", "0.6113945", "0.610395", "0.6074205", "0.6056309", "0.60420865", "0.6016165", "0.5957813", "0.59397256", "...
0.73413634
0
Takes a pandas dataframe which contains the proportions of language classes over generations and plots timecourses
def plot_timecourse_language_types(lang_class_prop_over_gen_df, title, file_path, file_name): sns.set_style("darkgrid") sns.set_context("talk") fig, ax = plt.subplots() if len(possible_form_lengths) == 1: palette = sns.color_palette(["black", "red", "green", "grey"]) else: palette ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_word_class_pr_genre(df):\n df['nouns'] = df['nouns'] * 100\n df['verbs'] = df['verbs'] * 100\n df['adverbs'] = df['adverbs'] * 100\n # plotting nouns\n plotting_helper_method('nouns', 'genre', df)\n plt.title('Amount of nouns pr song pr. genre')\n plt.xlabel(\"Amount of nouns in each ...
[ "0.6448972", "0.6392558", "0.6383187", "0.6325968", "0.58468354", "0.5693776", "0.5645798", "0.5629048", "0.5622483", "0.5611402", "0.55704165", "0.5545969", "0.54707754", "0.5421868", "0.541172", "0.5408939", "0.53972", "0.5382327", "0.5376701", "0.5373505", "0.5348653", "...
0.66838074
0
Takes a pandas dataframe which contains the proportions of language classes over generations and generates a barplot (excluding the burnin period)
def plot_barplot_language_types(lang_class_prop_over_gen_df, title, file_path, file_name, n_runs, n_batches, n_gens, gen_start, lang_class_baselines_all, lang_class_baselines_fully_expressive, possible_form_lengths): sns.set_style("darkgrid") sns.set_context("talk") if len(possible_form_lengths) == 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bar_plot(df_NP):\n cnt = Counter()\n for tax_list in df_NP.taxonomy:\n for tax in list(tax_list):\n if tax != 'no':\n cnt[tax] += 1\n plt.bar(cnt.keys(),cnt.values())\n plt.xlabel('taxonomic provenance')\n plt.ylabel('number of molecules')\n plt.title('number ...
[ "0.6668762", "0.6598685", "0.6580668", "0.65461254", "0.6532494", "0.6513617", "0.6504175", "0.6385042", "0.63797927", "0.63521934", "0.6340164", "0.63299674", "0.619069", "0.61589485", "0.6137865", "0.6120342", "0.607238", "0.6047123", "0.60318536", "0.59974545", "0.5966363"...
0.6864728
0
Initialize a new HTTP client event router object uri is a URI for this event router. A new URI derived from this is created for the HTTP client event relay. host is the IP address of host name to which the HTTP connection is made. port is the TCP port number to which the HTTP connection is made.
def __init__(self, uri=None, host='', port=8082, simplex=False): super(EventRouterHTTPC, self).__init__(uri) relayuri = self.getUri()+"/HTTPC" self._relay = EventRelayHTTPC(self, relayuri, host, port, simplex) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, router, uri=None, host='', port=8082, simplex=False):\n super(EventRelayHTTPC, self).__init__(uri)\n self._router = router\n self._queue = Queue()\n self._event = threading.Event()\n self._closing = False\n self._queueEvent = threading.Event()\n ...
[ "0.74562943", "0.6506829", "0.63234913", "0.63234913", "0.63085514", "0.621488", "0.60746145", "0.6005634", "0.59841245", "0.5979701", "0.5968453", "0.5921957", "0.5919456", "0.58944875", "0.58941567", "0.5850365", "0.58042604", "0.5793125", "0.5780519", "0.5780519", "0.57790...
0.7386842
1
Function called to close down event router.
def close(self): self._relay.close() super(EventRouterHTTPC, self).close() return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closeEvent(self, event):\n\n sys.exit()", "def on_closing_event(self):\n self.exit_event(None)", "def closeEvent(self, event):\n sys.exit(0)", "def close(self) -> None:\n self.relay(\"close\")()", "def closeEvent(self, event):\n self.exit()\n event.accept()", ...
[ "0.71471226", "0.71452016", "0.70188725", "0.7006168", "0.6977439", "0.6927479", "0.68837065", "0.6871763", "0.68616617", "0.68096364", "0.6793978", "0.6784437", "0.67712516", "0.6754609", "0.6701007", "0.6697934", "0.6681519", "0.6672537", "0.6667044", "0.66509724", "0.66509...
0.73405606
0
Initialize a new HTTP client event passing object An HTTP client is associated with an existing event router, and sends all messages received from that router to the HTTP connection, and forwards all messages received from the HTTP connection to the router. Interaction with the indicated EventRouter object takes place ...
def __init__(self, router, uri=None, host='', port=8082, simplex=False): super(EventRelayHTTPC, self).__init__(uri) self._router = router self._queue = Queue() self._event = threading.Event() self._closing = False self._queueEvent = threading.Event() self._si...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, uri=None, host='', port=8082, simplex=False):\n super(EventRouterHTTPC, self).__init__(uri)\n relayuri = self.getUri()+\"/HTTPC\"\n self._relay = EventRelayHTTPC(self, relayuri, host, port, simplex)\n return", "def __init__(self, router):\n self._router = ro...
[ "0.61509657", "0.5864122", "0.57680523", "0.5765937", "0.5636957", "0.542871", "0.53911084", "0.5345458", "0.52738434", "0.52246845", "0.517456", "0.51684", "0.51025426", "0.5091683", "0.50771654", "0.5053803", "0.50480044", "0.50263023", "0.501474", "0.49918574", "0.49689016...
0.74102676
0
Add item to the queue, and return a deferred object that fires when an item is removed (or the queue is empty).
def queueItem(self, item): Trace("%s queueItem (%s)"%(self.getUri(),item), "EventLib.EventRelayHTTPC") if not self._closing: self._queue.put(item) self._queueEvent.set() return makeQueueDeferred(StatusVal.OK, self._queue, self._event) return makeDeferr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, item):\n completeDeferred = defer.Deferred()\n self.queue.append((item, completeDeferred))", "def add(self, item: T) -> None:\n self._queue.append(item)\n if not self.is_empty():\n self._queue.sort(reverse=True)", "def enqueue(self, item):\n self.queu...
[ "0.809805", "0.66659725", "0.6658853", "0.6658853", "0.649351", "0.6432891", "0.6412939", "0.6350026", "0.6251586", "0.623737", "0.6233821", "0.6162664", "0.6149751", "0.6137725", "0.6091136", "0.60882497", "0.60764444", "0.6054781", "0.5985582", "0.5985582", "0.598518", "0...
0.6929844
1
Wait for an item to be queued, then return it.
def getQueuedItem(self): Trace("%s getQueuedItem ..."%(self.getUri()), context="EventLib.EventRelayHTTPC") item = self._queue.get() Trace("%s getQueuedItem (%s)"%(self.getUri(),item), context="EventLib.EventRelayHTTPC") self._event.set() return item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item_from_queue(Q, timeout=0.01):\n try:\n item = Q.get(True, 0.01)\n except queue.Empty:\n return None\n return item", "def get_item_from_queue(Q, timeout=0.01):\n try:\n item = Q.get(True, 0.01)\n except Queue.Empty:\n return None\n return item", "def wor...
[ "0.69198966", "0.69057333", "0.6884813", "0.6864645", "0.68376034", "0.6821141", "0.6660425", "0.6638609", "0.65500504", "0.6460967", "0.6446401", "0.63761413", "0.63736504", "0.6362188", "0.6324351", "0.62841207", "0.6243727", "0.61811554", "0.6120136", "0.61119175", "0.6085...
0.734153
0
Recursively load all teachers that can be found in the current experiment's directory.
def load_teachers(self): # Get the experiment's directory to load from ex_dir = ask_for_experiment(max_display=10, env_name=self.env_real.name, perma=False) self.load_teacher_experiment(ex_dir) if len(self.teacher_policies) < self.num_teachers: print( f"You ha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_teacher_experiment(self, exp: Experiment):\n _, _, extra = load_experiment(exp)\n self.unpack_teachers(extra)", "def preload_all_problems(self):\n for _, _, filenames in os.walk(self.problemDir):\n for filename in filenames:\n if filename[-3:] == \".py\" an...
[ "0.66310847", "0.59174895", "0.5706464", "0.56006503", "0.5449008", "0.5424291", "0.54034406", "0.53829217", "0.5337041", "0.53273314", "0.53095233", "0.5307464", "0.52964854", "0.5285679", "0.52551943", "0.5226202", "0.5178625", "0.5178625", "0.51691693", "0.5146963", "0.514...
0.7492254
0
Load teachers from PDDRTeachers experiment.
def load_teacher_experiment(self, exp: Experiment): _, _, extra = load_experiment(exp) self.unpack_teachers(extra)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_teachers(self):\n # Get the experiment's directory to load from\n ex_dir = ask_for_experiment(max_display=10, env_name=self.env_real.name, perma=False)\n self.load_teacher_experiment(ex_dir)\n if len(self.teacher_policies) < self.num_teachers:\n print(\n ...
[ "0.7358244", "0.5859265", "0.5856855", "0.5826998", "0.5742936", "0.552974", "0.5405307", "0.5320931", "0.5187403", "0.5179637", "0.5173516", "0.5170551", "0.51504564", "0.51137877", "0.50919735", "0.5080042", "0.5077611", "0.50590116", "0.5048102", "0.5040496", "0.50286186",...
0.7384021
0
Unpack teachers from PDDRTeachers experiment.
def unpack_teachers(self, extra: dict): self.teacher_policies.extend(extra["teacher_policies"]) self.teacher_envs.extend(extra["teacher_envs"]) self.teacher_expl_strats.extend(extra["teacher_expl_strats"]) self.teacher_critics.extend(extra["teacher_critics"]) self.teacher_ex_dirs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_teacher_experiment(self, exp: Experiment):\n _, _, extra = load_experiment(exp)\n self.unpack_teachers(extra)", "def prune_teachers(self):\n self.teacher_policies = self.teacher_policies[: self.num_teachers]\n self.teacher_envs = self.teacher_envs[: self.num_teachers]\n ...
[ "0.6385784", "0.5618853", "0.54759747", "0.54556435", "0.5198481", "0.5048664", "0.49990323", "0.4985974", "0.49433678", "0.4874634", "0.47989118", "0.47896883", "0.4787353", "0.47753018", "0.4730215", "0.46576267", "0.46548298", "0.46495625", "0.4646888", "0.46451658", "0.46...
0.67790115
0
Prune teachers to only use the first num_teachers of them.
def prune_teachers(self): self.teacher_policies = self.teacher_policies[: self.num_teachers] self.teacher_envs = self.teacher_envs[: self.num_teachers] self.teacher_expl_strats = self.teacher_expl_strats[: self.num_teachers] self.teacher_critics = self.teacher_critics[: self.num_teachers...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanOrphanedLearners(self):\n\n # Before deleting Learners, ensure that if any Learners that are about to be\n # deleted point to a Team as their action, then that Team's count of\n # referincing Learners is decremented.\n for learner in self.learner_pop:\n if learner.ge...
[ "0.5696694", "0.545549", "0.54449904", "0.5432693", "0.52488464", "0.5203805", "0.5048298", "0.50102764", "0.493123", "0.49195728", "0.48889333", "0.48790887", "0.4860135", "0.48572624", "0.48336893", "0.48332903", "0.4776946", "0.47586012", "0.47427273", "0.47353852", "0.473...
0.7730154
0
return orthanc object of study
def get(self): return orthanc.study(self.orthanc_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orthanc_studies(self):\n return [orthanc.study(x.orthanc_id) for x in self.studies]", "def salome_study_init(theStudyId=0):\n\n global salome_study_initial\n global myStudyManager, myStudyId, myStudy, myStudyName\n global orb, lcc, naming_service, cm\n\n if salome_study_initial:\n s...
[ "0.6370708", "0.5323299", "0.51920646", "0.5153776", "0.5107432", "0.5070821", "0.5055284", "0.49911162", "0.49496976", "0.49446896", "0.49231794", "0.49001023", "0.4827991", "0.48052597", "0.4804953", "0.47864586", "0.4774238", "0.47692737", "0.4762107", "0.4743235", "0.4733...
0.7259197
0
return orthanc objects of studies
def orthanc_studies(self): return [orthanc.study(x.orthanc_id) for x in self.studies]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n return orthanc.study(self.orthanc_id)", "def studies(self):\n return self._study_queryset", "def DumpStudies():\n for name in myStudyManager.GetOpenStudies():\n s=myStudyManager.GetStudyByName(name)\n print \"study:\",name, s._get_StudyId()\n DumpStudy(s)", "def searc...
[ "0.6256025", "0.5748354", "0.5600851", "0.5587314", "0.5289076", "0.52684903", "0.52684903", "0.5218291", "0.50912505", "0.509042", "0.50746655", "0.50711817", "0.50640666", "0.5047204", "0.49905527", "0.49653897", "0.49444157", "0.49329725", "0.49328998", "0.4929676", "0.492...
0.7746891
0