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
Parse special keywords in commits to determine further postcommit actions.
def determine_keywords(self): split = dict() split['email_cc'] = re.compile("^\s*CC[-_]?MAIL[:=]\s*(.*)") split['email_cc2'] = re.compile("^\s*C[Cc][:=]\s*(.*)") split['fixed_in'] = re.compile("^\s*FIXED[-_]?IN[:=]\s*(.*)") numeric = dict() numeric['bug_fixed'] = re.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_commit_message(message):\n # ['closes', 'close', 'fix', ...]\n keywords = []\n [keywords.extend(val) for val in KEYWORDS.values()]\n # we need to sort to match longuest command possible\n keywords.sort(lambda x, y: cmp(len(y), len(x)))\n # 'closes|close|fix...'\n keywords_re = '|'.jo...
[ "0.599186", "0.520402", "0.5114426", "0.5038884", "0.5008906", "0.49850717", "0.49810693", "0.48139718", "0.47817907", "0.46998245", "0.4676912", "0.46327248", "0.46078002", "0.46047723", "0.4595017", "0.45620742", "0.45620742", "0.45582268", "0.45472842", "0.45239753", "0.45...
0.56862926
1
Send the commmit notification to CIA. The message is created incrementally using lxml's "E" builder.
def notify(self, builder): # Build the <files> section for the template... commit = builder.commit files = E.files() commit_msg = commit.message.strip() commit_msg = re.sub(r'[\x00-\x09\x0B-\x1f\x7f-\xff]', '', commit_msg) for filename in commit.files_changed: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify(guid, message):", "def notify(self, id, command, data = None):\n print \"sending:\", id, command, data\n if command == Code.START: data = [id]\n try:\n msg = Message(command = command, data = data)\n self.contacts[id].send(msg.encode())\n except:\n ...
[ "0.5887094", "0.5750634", "0.57312334", "0.57009876", "0.5486229", "0.54457545", "0.5437605", "0.53316367", "0.5314361", "0.52677506", "0.52383125", "0.5220476", "0.52009946", "0.5194496", "0.5170836", "0.51647365", "0.51592344", "0.51445454", "0.5126826", "0.5122613", "0.511...
0.5796216
1
Check for potential problems in a commit.
def check_commit_problems(self, commit, diff): # Initialise self._license_problem = False self._commit_problem = False self._commit_notes = defaultdict(list) # Unsafe regex checks... unsafe_matches = list() unsafe_matches.append( r"\b(KRun::runCommand|K3?ShellPr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commit_check(ctx):\n result = ctx.run(f\"{VENV_PREFIX} cz check --rev-range master..\", warn=True)\n if result.exited == 3: # NO_COMMIT_FOUND\n exit(0)\n else:\n exit(result.exited)", "def verify_git_clean(path):\n\n sys.stdout.write(\" - Checking for uncommitted changes:\")\n r...
[ "0.7050094", "0.69747615", "0.6810369", "0.6753324", "0.67024326", "0.66566247", "0.6637356", "0.65921104", "0.65602815", "0.65418464", "0.6462754", "0.6436193", "0.6383709", "0.6378951", "0.62852246", "0.6269505", "0.6268365", "0.6259074", "0.6205398", "0.6135695", "0.609353...
0.800173
0
Returns index of the resource to use for making requests to get data if none of the resources are available, then send number of seconds until the resource is not available
def get_resource_index(self): result = -1 max_sleep_time = self.time_window with self._lock: while result == -1: for i in range(0, self.num_keys): curr_sleep_time = max((self.timers[i][0] + self.time_window) - time.time(), 0) m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_get():\n for resource in resources:\n\n # acquire lock\n res_lock = resource.get(\"lock\")\n res_lock.acquire()\n\n # Get if available\n if resource.get(\"available\") == \"true\":\n # Available - acquire resource and return\n resource.update({...
[ "0.6093405", "0.5707536", "0.56445384", "0.5552679", "0.55315655", "0.54823583", "0.5422522", "0.5402123", "0.5400669", "0.538704", "0.5379008", "0.5378094", "0.53733474", "0.535927", "0.5357638", "0.53508085", "0.53386307", "0.5338582", "0.5338395", "0.53344756", "0.5322996"...
0.67190135
0
Test Chronos GR Config plugin writes new config when config has changed
def test_chronos_gr_config_changed(self, mock_run_command, mock_safely_write): # Create the plugin plugin = ChronosGRConfigPlugin({}) # Set up the config strings to be tested old_config_string = "Old Chronos GR config" new_config_string = "New Chronos GR config" # Call...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_config_update(get_config):\n cfg = get_config(Config, {'test': 'main'})\n update_from = {\"name\": \"new_name\"}\n cfg.update(update_from)\n\n assert cfg.data.get('name') == \"new_name\", \"config was not updated\"", "def test_update_wait():\n wait = '10 seconds'\n config_info = read_c...
[ "0.72591335", "0.72113305", "0.71514034", "0.7107235", "0.7026826", "0.69808435", "0.69801", "0.6910698", "0.6887558", "0.68464094", "0.6824999", "0.68176496", "0.67969394", "0.67067325", "0.6699056", "0.6610438", "0.6609877", "0.6593223", "0.6569542", "0.6516883", "0.6515605...
0.75435835
0
Load the draft results.
def test_load_draft(league): draft = league.draft_results() assert(len(draft) == 144) #mcdavid 1st assert(draft[0]['player_key'] == '396.p.6743') # carter hart 67th assert(draft[66]['player_key'] == '396.p.7156') # zadorov last assert(draft[-1]['player_key'] == '396.p.5995')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_enriched_results(self):\n return super().load_results()", "def load(self):\n self.results = pickle_load('results', self.main_dir)", "def run(self):\n results = self.fetch()\n return results", "def load_results_internal(self):\r\n filename = f\"{self.search_interna...
[ "0.6382324", "0.6246874", "0.5810889", "0.5807111", "0.57492447", "0.56064266", "0.5601259", "0.55607885", "0.54455495", "0.5442246", "0.5427821", "0.5390353", "0.53654075", "0.5347294", "0.53464603", "0.53339255", "0.53226596", "0.53156066", "0.5312531", "0.5308264", "0.5294...
0.6256367
1
Return team roster at given date.
def get_team_roster(league): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def roster(\n self, ctx: commands.Context, season: Optional[YearFinder] = None, *, search: HockeyTeams\n ) -> None:\n season_str = None\n season_url = \"\"\n if season:\n if season.group(3):\n if (int(season.group(3)) - int(season.group(1))) > 1:\n ...
[ "0.6794363", "0.63804543", "0.5813007", "0.5741318", "0.57277983", "0.5647605", "0.5467505", "0.5346135", "0.5336544", "0.53275824", "0.53005236", "0.5272862", "0.5261342", "0.521931", "0.5192084", "0.514297", "0.51121926", "0.50987285", "0.5097064", "0.50702137", "0.50670063...
0.65519655
1
Calibrate the chemical shifts of each spin in the peak list.
def calibrate_peaklist(peaklist, calibration, attr='shift'): if len(calibration) != peaklist.dims: raise ValueError('incorrect calibration list length') for peak in peaklist: for spin, cal in zip(peak, calibration): shift = getattr(spin, attr) shift -= cal set...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updatePeakShifts(peak):\n\n for peakDim in peak.peakDims:\n for contrib in peakDim.peakDimContribs:\n if contrib.peakDimComponent:\n continue\n updateResonShift(contrib.resonance,peakDim)", "def apply_calibration(self, cal):\n\n n_edges = len(self.channels) + 1\n channel_ed...
[ "0.61754125", "0.56453633", "0.5504699", "0.5399412", "0.5393503", "0.5272751", "0.5264761", "0.5158035", "0.5157666", "0.51486784", "0.51470107", "0.5123972", "0.51041424", "0.50907195", "0.5079858", "0.5070017", "0.5054352", "0.50522673", "0.5047045", "0.50407064", "0.50199...
0.6538406
0
Map each unique spin link to all of its corresponding peaks. NOESY peak lists represent spin links between Hydrogen atoms. Whether 2D, 3D or 4D, each peak in a NOESY peak list has exactly two Hydrogen spins. Here, a spin link is represented by a frozenset containing the spin.assignment tuples for each Hydrogen atom. Th...
def get_spin_link_dict(peaklist): spin_link_dict = {} for peak in peaklist: spins = [spin for spin in peak if spin.atom is not None and spin.atom[0] == 'H'] if len(spins) != 2: err = ('expected 2 Hydrogens in each peak, ' 'found %d' % len(spins)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mod_map(mods, plinkmap):\n modmap = {}\n for chrom in plinkmap:\n if chrom not in modmap:\n modmap[chrom] = []\n markers = plinkmap[chrom]\n modif = mods[chrom]\n for i, m in enumerate(modif):\n if m == 'I':\n p2 = float(markers[i+1][3])\n ...
[ "0.4860738", "0.4834604", "0.48159462", "0.4767646", "0.47199568", "0.46659744", "0.46064976", "0.4587481", "0.4538893", "0.45380697", "0.45124298", "0.44684395", "0.44490376", "0.4414482", "0.4384815", "0.43777874", "0.4372807", "0.43616307", "0.43376932", "0.43176925", "0.4...
0.7973843
0
Sort peaks by the assignments of their constituent spins. Sort the peaks by the assignments of spins in particular dimensions. The default order sorts the peaks by the dimensions associated with spin anchors first then by the remaining dimensions in the order they appear in each peak. Optionally place all commented pea...
def sort_by_assignments(peaklist, order=None, commented_at_end=False): anchors = peaklist.anchors anchored = tuple(i for anchor in anchors for i in anchor) unanchored = set(range(peaklist.dims)) - set(anchored) default_order = anchored + tuple(sorted(unanchored)) order = order if order is not None e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sort_cubelist(self, cubelist):\n sorted_cubelist = []\n realization_num = 1\n cubelist = cubelist.merge(unique=False)\n for cube in cubelist:\n # If time is a scalar coordinate, promote it to a dimension \n # coordinate, this is because all cubes must have the...
[ "0.5235512", "0.51029795", "0.5057203", "0.50256133", "0.4997207", "0.49645668", "0.49587327", "0.49490315", "0.4915132", "0.4911893", "0.48918042", "0.4875538", "0.4869072", "0.48368287", "0.4831977", "0.48246452", "0.48140344", "0.47824505", "0.47735858", "0.4757741", "0.47...
0.73416525
0
Return an shellescaped version of the string using double quotes. Reliably quote a string which may contain unsafe characters (e.g. space or quote characters), while retaining some shell features such as variable interpolation. The returned value can be used in a shell command line as one token that gets to be further ...
def DoubleQuote(s): if not s: return '""' elif all(c in _SafeShellChars for c in s): return s else: return '"' + s.replace('"', '\\"') + '"'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shlex_quote(s):\n if not s:\n return \"''\"\n if _find_unsafe(s) is None:\n return s\n\n # use single quotes, and put single quotes into double quotes\n # the string $'b is then quoted as '$'\"'\"'b'\n return \"'\" + s.replace(\"'\", \"'\\\"'\\\"'\") + \"'\"", "def shlex_quote(s)...
[ "0.7271046", "0.7253869", "0.72336555", "0.7229503", "0.70458126", "0.6944718", "0.6929941", "0.69232047", "0.69232047", "0.6779495", "0.67524135", "0.6597111", "0.65538913", "0.6536574", "0.65330154", "0.65087634", "0.6507119", "0.64975196", "0.64822", "0.646473", "0.644913"...
0.7298411
0
Constructs a shell snippet for a command using a variable to shrink it. Takes into account all quoting that needs to happen.
def ShrinkToSnippet(cmd_parts, var_name, var_value): def shrink(value): parts = (x and SingleQuote(x) for x in value.split(var_value)) with_substitutions = ('"$%s"' % var_name).join(parts) return with_substitutions or "''" return ' '.join(shrink(part) for part in cmd_parts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def substshell(command, path=None, output=os.devnull, mode='w'):\n _compile = SubstCommandCompiler(path)\n _compile.init_command(command)\n return functools.partial(_compile, output, mode)", "def make_shell_cmd(self, locals):\n\t\tdef cmd_shell():\n\t\t\timport code\n\t\t\tcode.interact(banner=self.shel...
[ "0.5757063", "0.53830165", "0.53762203", "0.5325956", "0.53113496", "0.5278688", "0.518739", "0.5154804", "0.51409817", "0.5108147", "0.50834435", "0.50418144", "0.5036694", "0.49932173", "0.49862692", "0.4973778", "0.49597052", "0.49114555", "0.49044985", "0.4899245", "0.489...
0.7213392
0
An fcntlbased implementation of _IterProcessStdout.
def _IterProcessStdoutFcntl(process, iter_timeout=None, timeout=None, buffer_size=4096, poll_interval=1): # pylint: disable=too-many-nested-blocks import fcntl try: # Enable non-blocking reads from ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _stdout_reader(self):\n self._is_launched.wait()\n stdout_iterator = iter(self._popen.stdout.readline, b\"\")\n for line in stdout_iterator:\n self._log(\"raw\", \"stdout : {0}\".format(line.strip()))\n self.stdout_queue.put_nowait(line.strip())\n self.stdout_q...
[ "0.6449587", "0.6135046", "0.60871077", "0.595699", "0.594129", "0.58840406", "0.5684317", "0.5682602", "0.5677694", "0.5666196", "0.565126", "0.55647177", "0.5556993", "0.55479926", "0.54802346", "0.5458966", "0.5452489", "0.54261523", "0.5415573", "0.539853", "0.53972363", ...
0.67283905
0
Create a SparseAutoEncoder object.
def __init__(self, n_inpt, n_hidden, hidden_transfer='sigmoid', out_transfer='identity', reconstruct_loss='squared', c_sparsity=1, sparsity_loss='bern_bern_kl', sparsity_target=0.01, tied_weights=True, batch_size=None, optimizer='lbfgs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_sparseDB():\n datas = data.Kmercount_to_matrix()\n datas.run()\n print('***Sparse matrix created***')", "def make_sparse(data):\n assert data.train_pos_edge_index is not None\n\n (row, col), N = data.train_pos_edge_index, data.num_nodes\n perm = (col * N + row).argsort()\n row, co...
[ "0.63621956", "0.62124324", "0.60858965", "0.59326434", "0.5876335", "0.5779511", "0.576974", "0.5758959", "0.5684206", "0.56325567", "0.56308913", "0.5587562", "0.55547976", "0.5466962", "0.5456364", "0.52503127", "0.5241987", "0.5203801", "0.5184267", "0.51695746", "0.51491...
0.63101643
1
Create a DenoisingAutoEncoder object.
def __init__(self, n_inpt, n_hidden, hidden_transfer='sigmoid', out_transfer='identity', reconstruct_loss='squared', noise_type='gauss', c_noise=.2, tied_weights=True, batch_size=None, optimizer='lbfgs', max_iter=1000, verbose=False): super(Den...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _define_encoder(self):\n raise NotImplementedError", "def build_autoencoder(input_dim):\r\n input_layer = Input(shape=(input_dim, 1))\r\n enc = Conv1D(filters=16, kernel_size=2, padding='same', activation='relu')(input_layer)\r\n enc = MaxPooling1D(pool_size=2, padding='same')(enc)\r\n enc = C...
[ "0.6016746", "0.55889976", "0.545366", "0.54502213", "0.5415948", "0.54003376", "0.54001844", "0.53689516", "0.534991", "0.5316329", "0.5203007", "0.51553774", "0.5107471", "0.5106341", "0.5100852", "0.50989753", "0.5094069", "0.5073897", "0.50694823", "0.5016635", "0.5007310...
0.6117516
0
Fixture for setting up configuration parser
def setup_config(): config = configparser.ConfigParser() config.read(CONFIG_PATH) return config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.parser = create_parser()", "def setup(self):\n file_under_test = os.path.join(os.curdir, 'application-core',\n 'app.core.config.xml')\n with open(file_under_test) as f:\n config = f.read()\n self.config = objecti...
[ "0.70605105", "0.7017709", "0.7011017", "0.692149", "0.692149", "0.690285", "0.68758297", "0.68144774", "0.6782708", "0.6702887", "0.66660374", "0.6653196", "0.66530657", "0.6643987", "0.6641886", "0.6610034", "0.6574361", "0.65678746", "0.6562894", "0.6540612", "0.6537637", ...
0.7371306
0
Fixture for retrieving mock event
def get_mock_event(): event = { "httpMethod": "GET", "//body": "{\"name\": \"Sam\"}", "resource": "/{proxy+}", "queryStringParameters": {}, "pathParameters": { "proxy": "users" }, "requestContext": { "accountId": "222222222", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_factory_fixture():\n def _factory(device_id, event_type=\"DEVICE_EVENT\", capability='',\n attribute='Updated', value='Value', data=None):\n event = Mock()\n event.event_type = event_type\n event.device_id = device_id\n event.component_id = 'main'\n e...
[ "0.74541396", "0.724666", "0.72374237", "0.71662945", "0.7073701", "0.7027783", "0.68203604", "0.68195695", "0.680202", "0.6784378", "0.6762648", "0.67611665", "0.66722715", "0.66431737", "0.6619424", "0.65345937", "0.65251654", "0.65242076", "0.65172464", "0.6512973", "0.650...
0.74155563
1
Unit test get_ip_type_by_address method of the Bad Bots class
def test_get_ip_type_by_address(setup_config, get_mock_event): # !ARRANGE! bad_bots = BadBots(setup_config, get_mock_event) ipv4_address_1 = '1.1.1.1' ipv4_address_2 = '11.22.33.44' ipv4_address_3 = '123.123.123.123' ipv6_address_1 = '2a02:a445:6d36:1:1e3:a188:313c:1d31' ipv6_address_2 = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ip_addresses_exists():\n load_ips()\n validate_names()", "def test_external_ip_get_kind(self):\n assert_equal(self.test_external_ip.get_kind(), 'mpexternalip')", "def test_ipam_ip_addresses_read(self):\n pass", "def test_get_source_ip(self):\n pass", "def test_ip(self):\n ...
[ "0.67973435", "0.6795078", "0.67154825", "0.66857165", "0.66440994", "0.6609387", "0.65462726", "0.6507168", "0.649237", "0.6404722", "0.63306016", "0.6302462", "0.6274524", "0.6213682", "0.6204644", "0.62016076", "0.61814064", "0.6152368", "0.6097284", "0.60947865", "0.60787...
0.78166175
0
Unit test check_bot_confidence method of the Bad Bots class
def test_check_bot_confidence(setup_config, get_mock_event): # !ARRANGE! bad_bots = BadBots(setup_config, get_mock_event) bot_1 = Bot() bot_1.source_ip = '1.1.1.1' bot_1.http_query_string_parameters = '<script></script>' bot_1.http_body = 'EXEC' bot_1.geolocation = 'United States' bot_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_word_confidences(self):\n self._api.SetImageFile(self._image_file)\n words = self._api.AllWords()\n self.assertEqual(words, [])\n self._api.Recognize()\n words = self._api.AllWords()\n confidences = self._api.AllWordConfidences()\n self.assertEqual(len(word...
[ "0.67971265", "0.6142417", "0.61158496", "0.6029153", "0.57504106", "0.572192", "0.56564856", "0.5608764", "0.5544521", "0.554337", "0.55383706", "0.55253214", "0.54930353", "0.5490882", "0.5488589", "0.54793096", "0.5459387", "0.5425729", "0.540067", "0.5386406", "0.5373596"...
0.7511095
0
Generates IDL files from a template for user and system marshaling.
def _Main(): cmd_parser = argparse.ArgumentParser( description='Tool to generate IDL from template.') cmd_parser.add_argument('--idl_template_file', dest='idl_template_file', type=str, required=True, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildAutogenContents(self):\n if len(self.mTemplates) == 0:\n return None\n \n content = \"/** Autogenerated temporary file for template instantiation. */\\n\"\n for t in self.mTemplates:\n template_type = t.mTemplateType\n typedef_name = t.mTypedefName\n con...
[ "0.60924524", "0.5882521", "0.5875414", "0.5807833", "0.57298577", "0.5695035", "0.56720126", "0.55950695", "0.55856544", "0.55830556", "0.557712", "0.55616045", "0.555261", "0.5524907", "0.5512638", "0.5499624", "0.5496154", "0.5461171", "0.54406464", "0.54035246", "0.540047...
0.6245206
0
add rankig to each node using google pagerank algorithm
def add_pagerank(self): query = ''' MATCH (c1:)-[r:INTERACTS]->(c2:) RETURN c1.name, c2.name, r.weight AS weight ''' ig = IGraph.TupleList(self.graph.run(query), weights=True) pg = ig.pagerank() pgvs = [] for p in zip(ig.vs, pg): print(p) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_rank(self):\n self.__rank += 1", "def rank():\n return 0", "def set_rank_order(self):\n for k in self._run:\n self._run[k].sort(key=lambda x:x.get_rank(),reverse=False)\n tot_res = len(self._run[k])\n for r in self._run[k]:\n r.set_sco...
[ "0.6782681", "0.6664084", "0.6492858", "0.64766073", "0.6452059", "0.6438518", "0.64112085", "0.6404493", "0.62282807", "0.6224711", "0.62225074", "0.61820155", "0.6177658", "0.61345315", "0.61322975", "0.6032352", "0.6016183", "0.59991485", "0.59905785", "0.5985397", "0.5966...
0.75397
0
add community membership to each node using walktrap algorithm implemented in igraph
def add_communites(self): query = ''' MATCH (c1:)-[r:INTERACTS]->(c2:) RETURN c1.name, c2.name, r.weight AS weight ''' ig = IGraph.TupleList(self.graph.run(query), weights=True) clusters = IGraph.community_walktrap(ig, weights="weight").as_clustering() nodes = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_communities(graph):\n communities = nx.algorithms.community\\\n .greedy_modularity_communities(nx.Graph(graph))\n for node in graph.nodes:\n graph.nodes[node]['community'] = [i for i,c in enumerate(communities)\n ...
[ "0.5967038", "0.5503575", "0.54628575", "0.5436496", "0.54320776", "0.54097146", "0.53649384", "0.53567284", "0.5344505", "0.53354657", "0.5303637", "0.5284366", "0.52824575", "0.52807456", "0.525839", "0.52522177", "0.52431047", "0.52199847", "0.5210583", "0.51947844", "0.51...
0.6357265
0
Advance the time reference by the given amount.
def advance_by(self, amount: float): if amount < 0: raise ValueError("cannot retreat time reference: amount {} < 0" .format(amount)) self.__delta += amount
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def advance(self, amount):\n raise NotImplementedError()", "def advance(self, amount=1):\n self._current += amount\n if self._current - self._updateRate >= self._lastUpdated:\n self.redraw()\n # go to nearest multiple of updateRate less than current\n self._l...
[ "0.74948883", "0.7390248", "0.7373512", "0.72310776", "0.7102698", "0.70964295", "0.688938", "0.6812329", "0.6760769", "0.6728943", "0.64948493", "0.6393024", "0.6281656", "0.6251204", "0.619589", "0.61536574", "0.6126449", "0.60908896", "0.6087889", "0.6015486", "0.60153484"...
0.8371448
0
Advance the time reference so that now is the given timestamp.
def advance_to(self, timestamp: float): now = self.__original_time() if timestamp < now: raise ValueError("cannot retreat time reference: " "target {} < now {}" .format(timestamp, now)) self.__delta = timestamp - now
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_time(self, new_time):\r\n self.when = new_time", "def update_timestamp(self):\n self._timestamp = datetime.datetime.now()", "def advance_time(self, set_to=None, increment_by=None):\n self._time_condition.acquire()\n if set_to is not None:\n self._time = set_to\...
[ "0.6708446", "0.6519798", "0.63856924", "0.63803643", "0.6373168", "0.63460845", "0.6326127", "0.62440217", "0.62124366", "0.6148152", "0.614451", "0.61350346", "0.6095682", "0.604849", "0.6047468", "0.60337085", "0.60114896", "0.6003276", "0.6003276", "0.6003276", "0.6003276...
0.7582537
0
Email the given document to the given email address.
def email_document(document, to, template='django_dms/email.txt', subject=''): # Start a new thread to email the document # This avoids a frozen screen while the email is being sent (particularly if the document is big). t = threading.Thread(target=_email_document, args=[document, to, template, subject]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _email_document(document, to, template='django_dms/email.txt', subject=''): \n # TODO: A really cool system would delay sending the email for 10 seconds or so, \n # to allow the user to quickly undo :-) This could probably also be done client-side (ie JS)\n # Create the message\n message = EmailMes...
[ "0.7192423", "0.62836236", "0.6040218", "0.6037075", "0.59470624", "0.591903", "0.591903", "0.591903", "0.591903", "0.591903", "0.591903", "0.591903", "0.591903", "0.591903", "0.591903", "0.58806413", "0.58806413", "0.58301985", "0.5820901", "0.5814947", "0.5814947", "0.581...
0.7277005
0
Helper function to email document in another thread.
def _email_document(document, to, template='django_dms/email.txt', subject=''): # TODO: A really cool system would delay sending the email for 10 seconds or so, # to allow the user to quickly undo :-) This could probably also be done client-side (ie JS) # Create the message message = EmailMessage(to=t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_document(document, to, template='django_dms/email.txt', subject=''):\n # Start a new thread to email the document\n # This avoids a frozen screen while the email is being sent (particularly if the document is big).\n t = threading.Thread(target=_email_document, args=[document, to, template, subj...
[ "0.7538517", "0.6329317", "0.5854818", "0.57976854", "0.57880086", "0.57461154", "0.57316077", "0.5677812", "0.56468177", "0.56263226", "0.5602722", "0.5572509", "0.55519354", "0.554117", "0.55247223", "0.5500545", "0.546613", "0.5464859", "0.5459716", "0.5438996", "0.5438996...
0.662225
1
Send the specified document to the user's email address (AJAX version).
def send_ajax(self, request, id, tribe_slug): document = self.get_document(id, tribe_slug) form = self._set_user_email_address(request) email = self._get_user_email_address(request) if not email and not form: form = EmailForm() if form: conte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self, request, id, tribe_slug):\n tribe = get_object_or_404(Tribe, slug=tribe_slug)\n document = self.get_document(id, tribe_slug)\n \n form = self._set_user_email_address(request)\n email = self._get_user_email_address(request)\n if form or not email:\n ...
[ "0.7083903", "0.6592813", "0.6592162", "0.6246286", "0.5818268", "0.58028346", "0.5787325", "0.5658083", "0.56290865", "0.5581146", "0.55060256", "0.5494548", "0.5458515", "0.54515415", "0.544656", "0.5391331", "0.5326866", "0.53013676", "0.52664655", "0.5242208", "0.5226229"...
0.7920855
0
Gets a custom defined or default email address for the current user.
def _get_user_email_address(self, request): return request.session.get(SESSION_VAR_EMAIL_ADDRESS, not request.user.is_anonymous() and request.user.email)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_email(self):\n member = self.get_user()\n if member:\n return member.getProperty('email')", "def get_email(self):\n return self.reference[REF_EMAIL_ADDRESS][REF_VALUE]", "def user_email(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"user_email\")", ...
[ "0.79681355", "0.77469647", "0.7720694", "0.76566875", "0.7597106", "0.75681674", "0.7504296", "0.74986595", "0.74986595", "0.74986595", "0.74986595", "0.7492597", "0.7372196", "0.7372196", "0.7372196", "0.7372132", "0.73386735", "0.72807336", "0.72577626", "0.7211655", "0.72...
0.793554
1
If a new email address is posted, remember it.
def _set_user_email_address(self, request): if request.method == 'POST': form = EmailForm(request.POST) if form.is_valid(): request.session[SESSION_VAR_EMAIL_ADDRESS] = form.cleaned_data['email'] else: return form
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_duplicate_email(self, email):\r\n request = self.req_factory.post('unused_url', data={\r\n 'new_email': email,\r\n 'password': 'test',\r\n })\r\n request.user = self.user\r\n self.assertFailedRequest(self.run_request(request), 'An account with this e-mail...
[ "0.65422535", "0.64260054", "0.63118654", "0.63064903", "0.60563016", "0.6038557", "0.6014613", "0.5898787", "0.58314365", "0.5781677", "0.577932", "0.5769288", "0.575497", "0.5719079", "0.57139456", "0.5708547", "0.5708547", "0.5700854", "0.5699276", "0.56723505", "0.5661490...
0.6590844
0
Print list of instances with their attached volume id/size to console, ie
def list_ebss_by_instance(): ec2 = u.create_ec2_resource() instances = [(u.seconds_from_datetime(i.launch_time), i) for i in ec2.instances.all()] sorted_instances = sorted(instances, key=itemgetter(0)) for (seconds, instance) in sorted_instances: volumes = instance.volumes.all() volume_strs = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_asm_volumes(self):\n sql = \"select NAME from v$asm_diskgroup_stat ORDER BY 1\"\n self.cur.execute(sql)\n res = self.cur.fetchall()\n key = ['{#ASMVOLUME}']\n lst = []\n for i in res:\n d = dict(zip(key, i))\n lst.append(d)\n print(jso...
[ "0.66387", "0.65122116", "0.64756095", "0.6264545", "0.61685747", "0.61603457", "0.6125444", "0.61109924", "0.6072397", "0.60526633", "0.60198474", "0.59469944", "0.5940197", "0.5938797", "0.59375834", "0.5925745", "0.5900101", "0.5888648", "0.58722466", "0.5867416", "0.58226...
0.6720033
0
Grows EBS volume for given task.
def grow_ebs_for_task(task_fragment, target_size_gb): ec2 = u.create_ec2_resource() client = u.create_ec2_client() # todo: don't crash on missing/duplicate names instances = {u.get_name(i.tags): i for i in ec2.instances.all()} ec2 = u.create_ec2_resource() instances = [(u.seconds_from_datetime(i.launch_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grow_volume(self, volume, growth, async=False):\n\n assert isinstance(volume, dict), \"volume configuration is invalid, 'dict' type expected\"\n assert volume.get('id'), \"volume.id can't be blank\"\n\n async_result = __node__['bollard'].apply_async('api.postgresql.grow-volume',\n ...
[ "0.64236933", "0.6261913", "0.60468847", "0.587187", "0.5659941", "0.5560449", "0.53718984", "0.534629", "0.5339353", "0.53099704", "0.52602965", "0.5249011", "0.518899", "0.5125479", "0.50864977", "0.5082796", "0.5080378", "0.50407803", "0.50402933", "0.5031618", "0.5022762"...
0.69317895
0
This class tests the PyTorchYolo object detector.
def get_pytorch_yolo(get_default_cifar10_subset): import cv2 import torch from pytorchyolo import models from pytorchyolo.utils.loss import compute_loss from art.estimators.object_detection.pytorch_yolo import PyTorchYolo model_path = "/tmp/PyTorch-YOLOv3/config/yolov3.cfg" weights_path =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detection(input_path, output_path, yolo_model_path):\n detector = VideoObjectDetection()\n # this function sets the model type of the object detection instance you created to the YOLOv3 model\n detector.setModelTypeAsYOLOv3()\n # this function accepts a string that must be the path to the model fil...
[ "0.6627789", "0.6447896", "0.6315877", "0.62284786", "0.6174531", "0.61566085", "0.6096233", "0.60372835", "0.58174103", "0.5799088", "0.5774036", "0.5773982", "0.57679653", "0.56752574", "0.5674558", "0.5668986", "0.5649171", "0.5648845", "0.5647306", "0.5644756", "0.5634993...
0.7094565
0
Splits image into tiles by size of tile. tile_w tile width tile_h tile height
def split_image_into_tiles_of_size(arr: Image, tile_w: int, tile_h: int, overlap: int): x_axis = -1 y_axis = -2 arr_width, arr_height = arr.shape[x_axis], arr.shape[y_axis] x_ntiles = ( arr_width // tile_w if arr_width % tile_w == 0 else (arr_width // tile_w) + 1 ) y_ntiles = ( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _split_image_into_tiles(\n self, image: np.ndarray\n ) -> t.Sequence[t.Tuple[t.Tuple[t.Any, ...], np.ndarray]]:\n h, w, c = image.shape\n tile_height = (\n math.ceil(h / (self._n_tiles // 2 - 1))\n if self._n_tiles > 4\n else math.ceil(h / (self._n_tiles...
[ "0.76203066", "0.71610355", "0.69022644", "0.6677268", "0.6614609", "0.6609202", "0.6596505", "0.6574447", "0.6529179", "0.652334", "0.650743", "0.650743", "0.6493861", "0.6485636", "0.64644873", "0.6450046", "0.644942", "0.6383776", "0.6369156", "0.634634", "0.63084143", "...
0.7902135
0
Splits image into tiles by number of tile. x_ntiles number of tiles horizontally y_ntiles number of tiles vertically
def split_image_into_number_of_tiles( arr: Image, x_ntiles: int, y_ntiles: int, overlap: int ): img_width, img_height = arr.shape[-1], arr.shape[-2] tile_w = img_width // x_ntiles tile_h = img_height // y_ntiles return split_image_into_tiles_of_size(arr, tile_w, tile_h, overlap)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _split_image_into_tiles(\n self, image: np.ndarray\n ) -> t.Sequence[t.Tuple[t.Tuple[t.Any, ...], np.ndarray]]:\n h, w, c = image.shape\n tile_height = (\n math.ceil(h / (self._n_tiles // 2 - 1))\n if self._n_tiles > 4\n else math.ceil(h / (self._n_tiles...
[ "0.7743909", "0.7442206", "0.7223278", "0.6875224", "0.6805701", "0.6805701", "0.68043333", "0.6783657", "0.67152864", "0.6648476", "0.6550898", "0.6506808", "0.6499578", "0.644437", "0.64369965", "0.64329946", "0.6417711", "0.6391121", "0.6388546", "0.637921", "0.6316766", ...
0.8323475
0
Generates an array of ppxf_util.gaussian emission lines to be used as gas templates in PPXF. Generally, these templates represent the instrumental line spread function (LSF) at the set of wavelengths of each emission line. In this case, pPXF will return the intrinsic (i.e. astrophysical) dispersion of the gas lines. Al...
def emission_lines(logLam_temp, lamRange_gal, FWHM_gal, pixel=True, tie_balmer=False, limit_doublets=False, vacuum=False): if tie_balmer: # Balmer decrement for Case B recombination (T=1e4 K, ne=100 cm^-3) # Table 4.4 of Dopita & Sutherland 2003 https://www.amazon.com/dp/35404336...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Generate_BG_Template(outputSize=300, angularSize = 10, fileOut = 'BGRateMap.pickle' ):\r\n template = np.zeros((outputSize,outputSize))\r\n ppd=float(outputSize)/float(angularSize) # pixels per deg\r\n \r\n events110 = ParseFermi.Import_File('photons.txt', energyRange = (120000,140000),lonRange=(-...
[ "0.5699116", "0.5599356", "0.5230809", "0.5207666", "0.5170641", "0.5158478", "0.51580274", "0.5144128", "0.5076723", "0.5075624", "0.50331193", "0.50331193", "0.5024959", "0.49573076", "0.49408728", "0.49217612", "0.48975858", "0.48955354", "0.48943654", "0.48930743", "0.487...
0.58730155
0
Combine SSP traces to have mass/luminosity weighted properties
def weighted_traces(parnames, trace, nssps): weights = np.array([trace["w_{}".format(i+1)].data for i in range( nssps)]) wtrace = [] for param in parnames: data = np.array([trace["{}_{}".format(param, i+1)].data for i in range(nssps)]) t = np.average(data, we...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_combined_variation(nums, SSC, band, rms):\n\n def get_spectra(nums, SSC, band, rms):\n spectrum = spectra[str(SSC['no'])][band]\n frequency = spectrum['frequency'].to(u.GHz)\n intensity = spectrum['spectrum'].to(u.K)\n # shift spectrum to rest frequency\n velshift =...
[ "0.53677773", "0.52855563", "0.52082103", "0.5192049", "0.50655925", "0.50220954", "0.5019231", "0.4980716", "0.496982", "0.49639016", "0.496379", "0.49591964", "0.49528778", "0.49409777", "0.4926693", "0.49150053", "0.48961598", "0.4841809", "0.48396593", "0.48142034", "0.48...
0.5468182
1
update learning rate of optimizers
def updatelearningrate(self, epoch): self.lr = getlearningrate(epoch=epoch, opt=self.opt) # update learning rate of model optimizer if isinstance(self.model, list): count = 0 for param_group in self.optimzer.param_groups: # if type(model) is <list> then up...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_learning_rate(self):\r\n\r\n self.n_steps += 1\r\n lr = self.factor * self._get_lr_scale()\r\n for param_group in self._optimizer.param_groups:\r\n param_group['lr'] = lr", "def update_learning_rate(self):\n self.scheduler.step()\n lr = self.optimizer.par...
[ "0.82430375", "0.8091104", "0.8081948", "0.8057003", "0.7882125", "0.7729992", "0.7728464", "0.7728464", "0.77180463", "0.7680515", "0.7672647", "0.7670474", "0.76550764", "0.76442766", "0.762199", "0.76109266", "0.7595715", "0.758477", "0.7532394", "0.7522077", "0.75184435",...
0.81921303
1
Return apitools message object for give message name.
def GetApiMessage(message_name): messages = apis.GetMessagesModule(_BQ_API, _BQ_API_VERSION) return getattr(messages, message_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def msg(name):\n msg = Message.ByKeys(name)\n if msg is not None:\n txt = msg.message_ml\n if msg_is_ignored(name):\n txt = IGNORE_PREFIX + txt\n else:\n misc.cdblogv(misc.kLogErr, 0,\n \"bomcreator: could not find message '%s'\" % name)\n txt = n...
[ "0.69583714", "0.65979904", "0.64236474", "0.62720525", "0.62713873", "0.625511", "0.6236496", "0.6140541", "0.61393994", "0.6108671", "0.6034471", "0.6006937", "0.5988172", "0.5965715", "0.5953879", "0.5941471", "0.5921525", "0.5919041", "0.5918195", "0.590729", "0.5900649",...
0.80781776
0
Builds a bigquery AccessValueListEntry array from input file. Expects YAML or JSON formatted file.
def PermissionsFileProcessor(input_file): access_value_msg = GetApiMessage('Dataset').AccessValueListEntry try: permissions_array = [] permissions_from_file = yaml.load(input_file[0]) permissions_from_file = permissions_from_file.get('access', None) if not permissions_from_file or not isinstance(per...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_from_file(self, file):\n self.value = []\n with open(file, \"r\") as f:\n fl = f.readlines()\n\n for l in fl:\n self.value.append([int(x) for x in l.split()])", "def load_vals(txtfile):\n import ast\n \n data = []\n li = load_help(txtfile)\n ...
[ "0.56744987", "0.5283599", "0.5243404", "0.5234778", "0.5156196", "0.51066506", "0.5005265", "0.5005265", "0.49895862", "0.4981226", "0.49759138", "0.49112916", "0.49017558", "0.48792005", "0.48355103", "0.48244855", "0.48244855", "0.48212677", "0.4802652", "0.47956467", "0.4...
0.5508567
1
Set projectId value for a BigQueryXXXRequests.
def SetProjectId(ref, args, request): del ref project = args.project or properties.VALUES.core.project.Get(required=True) project_ref = resources.REGISTRY.Parse(project, collection='bigquery.projects') request.projectId = project_ref.Name() return request
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_project_quotas(self, project_id, request_model, extra_headers=None,\n use_auth=True, user_name=None):\n resp = self.client.post(\n 'project-quotas/' + project_id,\n request_model=request_model,\n response_model_type=quota_models.ProjectQuota...
[ "0.61926836", "0.6037495", "0.5940458", "0.58782727", "0.58782727", "0.5392154", "0.53831047", "0.5383003", "0.5351515", "0.5217758", "0.52084017", "0.51797605", "0.51797605", "0.51708114", "0.5099718", "0.5095747", "0.5076841", "0.50675255", "0.50642264", "0.5054526", "0.504...
0.7350548
0
Ensure that view parameters are set properly tables create request.
def SetViewParameters(ref, args, request): del ref # unused if not args.view: request.table.view = None return request
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create(self, tables, views, schema_name, config):\n if not isinstance(tables, dict):\n return False # Raise Exception That Tables Are In A Wrong Format???!!!\n success = True\n if schema_name is not None:\n self._create_schema(schema_name)\n for table_name_in...
[ "0.63214684", "0.6122003", "0.60363513", "0.59719974", "0.583535", "0.5826202", "0.5768594", "0.57384115", "0.55392927", "0.55050695", "0.54572743", "0.54387593", "0.5411729", "0.53755325", "0.53628856", "0.5360331", "0.5358349", "0.53566074", "0.53360575", "0.5325151", "0.53...
0.65944326
0
Process the overwrite flag on tables create.
def ProcessTableOverwrite(ref, args, request): dataset_id = ref.datasetId table_id = ref.Name() project_id = ref.projectId if args.overwrite: if _TableExists(dataset_id, table_id, project_id): _TryDeleteTable(dataset_id, table_id, project_id) return request
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tables_and_apply_patches(self):\n\n if self.authorized and not self.db_tables_initiated:\n with self.connection.cursor() as cursor:\n for statement in self.parse_mysql_sql_file():\n cursor.execute(statement)\n\n PyFunceble.LOGGER.info(\n...
[ "0.6433206", "0.6371944", "0.6202041", "0.61849165", "0.60638314", "0.5852797", "0.580371", "0.5792183", "0.5743237", "0.5713558", "0.5528236", "0.5432233", "0.54164076", "0.5352115", "0.5333362", "0.5304936", "0.52447927", "0.5226724", "0.52159977", "0.52028906", "0.5177918"...
0.6969729
0
Process the overwrite flag on tables copy.
def ProcessTableCopyOverwrite(ref, args, request): del ref # Unused if args.overwrite: request.job.configuration.copy.writeDisposition = 'WRITE_TRUNCATE' return request
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ProcessTableOverwrite(ref, args, request):\n dataset_id = ref.datasetId\n table_id = ref.Name()\n project_id = ref.projectId\n\n if args.overwrite:\n if _TableExists(dataset_id, table_id, project_id):\n _TryDeleteTable(dataset_id, table_id, project_id)\n\n return request", "def process_override...
[ "0.67875683", "0.5678444", "0.5599842", "0.55489415", "0.53554213", "0.52686346", "0.52098215", "0.5204137", "0.51888007", "0.51499987", "0.5148369", "0.5104553", "0.5098129", "0.5079654", "0.50565994", "0.50067544", "0.49729812", "0.4921561", "0.49208447", "0.49190444", "0.4...
0.8015918
0
Build JobConfigurationTableCopy from request resource args.
def ProcessTableCopyConfiguration(ref, args, request): del ref # Unused source_ref = args.CONCEPTS.source.Parse() destination_ref = args.CONCEPTS.destination.Parse() arg_utils.SetFieldInMessage( request, 'job.configuration.copy.destinationTable.datasetId', destination_ref.Parent().Name()) arg_ut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetTableCopyResourceArgs():\n table_spec_data = yaml_data.ResourceYAMLData.FromPath('bq.table')\n arg_specs = [\n resource_args.GetResourcePresentationSpec(\n verb='to copy from', name='source', required=True, prefixes=True,\n attribute_overrides={'table': 'source'}, positional=False,\...
[ "0.6806518", "0.51471066", "0.5135233", "0.5034788", "0.4957393", "0.49131292", "0.483293", "0.4809419", "0.47891185", "0.47865072", "0.4757659", "0.46871853", "0.46683812", "0.46534342", "0.46357578", "0.46097738", "0.45914286", "0.45865327", "0.457555", "0.45609608", "0.455...
0.73063713
0
Process schema Updates (additions/mode changes) for the request. Retrieves the current table schema for ref and attempts to merge in the schema provided in the requests. This is necessary since the API backend does not handle PATCH semantics for schema updates (e.g. process the deltas) so we must always send the fully ...
def ProcessSchemaUpdate(ref, args, request): table = request.table relaxed_columns = args.relax_columns if not table.schema and not relaxed_columns: # if not updating schema, return request # then just return. original_schema = _TryGetCurrentSchema(ref.Parent().Name(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_schema_updates(self):\n data = self.client._perform_json(\n \"GET\", \"/projects/%s/recipes/%s/schema-update\" % (self.project_key, self.recipe_name))\n return RequiredSchemaUpdates(self, data)", "async def upgradeSchema(self) -> None:", "def merge_schema_entry(\n se...
[ "0.65370333", "0.61016726", "0.59257406", "0.59054583", "0.57786834", "0.5593872", "0.5549331", "0.5481114", "0.5472658", "0.54690826", "0.5401272", "0.5361555", "0.53470576", "0.5315268", "0.5254957", "0.52487254", "0.5139043", "0.50770354", "0.5074396", "0.5061819", "0.5033...
0.8179473
0
Try to retrieve the current BigQuery TableSchema for a table_ref. Tries to fetch the schema of an existing table. Raises SchemaUpdateError if table is not found or if table is not of type 'TABLE'.
def _TryGetCurrentSchema(dataset_id, table_id, project_id): client = GetApiClient() service = client.tables get_request_type = GetApiMessage('BigqueryTablesGetRequest') get_request = get_request_type(datasetId=dataset_id, tableId=table_id, projec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_table_schema(dataset_id, table_id):\n logging.info('getting table schema')\n bigquery_client = bigquery.Client()\n dataset_ref = bigquery_client.dataset(dataset_id)\n bg_tableref = bigquery.table.TableReference(dataset_ref, table_id)\n bg_table = bigquery_client.get_table(bg_tableref)\n r...
[ "0.73889893", "0.6379297", "0.6305416", "0.6051959", "0.58043814", "0.57696646", "0.56733495", "0.5627315", "0.5534374", "0.5378048", "0.5363961", "0.53382576", "0.5309689", "0.5298764", "0.5259146", "0.52387893", "0.52369916", "0.52243495", "0.52111673", "0.5200395", "0.5174...
0.74110204
0
Change mode to `NULLABLE` for columns in existing schema. Tries set mode on existing columns in orig_schema_map to `NULLABLE`. Raises SchemaUpdateError if column is not found in orig_schema_map.
def _GetRelaxedCols(relaxed_columns, orig_schema_map): updated_schema_map = orig_schema_map.copy() for col in relaxed_columns: if col in orig_schema_map: updated_schema_map[col].mode = 'NULLABLE' else: raise SchemaUpdateError(_INVALID_SCHEMA_UPDATE_MESSAGE) return updated_schema_map
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_mode(self, old_schema_entry, new_schema_entry, base_path):\n old_info = old_schema_entry['info']\n new_info = new_schema_entry['info']\n old_mode = old_info['mode']\n old_name = old_info['name']\n old_type = old_info['type']\n old_status = old_schema_entry['statu...
[ "0.581769", "0.5178056", "0.5142687", "0.5107475", "0.50148743", "0.4938137", "0.49304643", "0.4709507", "0.4704251", "0.4693166", "0.46439534", "0.460573", "0.45949084", "0.4564342", "0.45579243", "0.44939494", "0.4487079", "0.44671857", "0.44571728", "0.44475183", "0.442848...
0.637235
0
Add new columns to an existing schema. Tries add new fields to an existing schema. Raises SchemaUpdateError if column already exists in the orig_schema_map.
def _AddNewColsToSchema(new_fields, orig_schema_map): updated_schema_map = orig_schema_map.copy() for new_field in new_fields: if new_field.name in orig_schema_map: raise SchemaUpdateError(_INVALID_SCHEMA_UPDATE_MESSAGE) updated_schema_map[new_field.name] = new_field return updated_schema_map
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_column(self, schema):\n self[schema.name] = schema.copy()", "def _add_to_schema(self, new: dict):\n self._defaults.update(new)\n self._migrate()", "def _GetRelaxedCols(relaxed_columns, orig_schema_map):\n updated_schema_map = orig_schema_map.copy()\n for col in relaxed_columns:\n...
[ "0.6689222", "0.6531303", "0.60537446", "0.6039341", "0.60350144", "0.5883875", "0.5845651", "0.5813085", "0.5690668", "0.5641946", "0.56057465", "0.54915494", "0.54909086", "0.5434344", "0.542425", "0.5340224", "0.53072643", "0.5284575", "0.52605635", "0.5229555", "0.5223570...
0.82155335
0
Try to delete a dataset, propagating error on failure.
def _TryDeleteDataset(dataset_id, project_id): client = GetApiClient() service = client.datasets delete_request_type = GetApiMessage('BigqueryDatasetsDeleteRequest') delete_request = delete_request_type(datasetId=dataset_id, projectId=project_id, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_dataset(self, dataset):\n raise NotImplementedError('delete_dataset')", "def _handle_creation_failure(session: Session, stub_dataset: Dataset, error: str):\n try:\n dataset.delete(session, stub_dataset)\n except requests.HTTPError:\n raise CreationFailure(\n f\"Cr...
[ "0.7605005", "0.7107175", "0.70523417", "0.69809973", "0.6883148", "0.6740322", "0.6667521", "0.65653944", "0.6536053", "0.65328515", "0.65034896", "0.6410687", "0.6386324", "0.6328574", "0.63253295", "0.62904114", "0.6277353", "0.62735856", "0.6252367", "0.61857146", "0.6168...
0.74737805
1
Get Table resource args (source, destination) for copy command.
def GetTableCopyResourceArgs(): table_spec_data = yaml_data.ResourceYAMLData.FromPath('bq.table') arg_specs = [ resource_args.GetResourcePresentationSpec( verb='to copy from', name='source', required=True, prefixes=True, attribute_overrides={'table': 'source'}, positional=False, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ProcessTableCopyConfiguration(ref, args, request):\n del ref # Unused\n source_ref = args.CONCEPTS.source.Parse()\n destination_ref = args.CONCEPTS.destination.Parse()\n arg_utils.SetFieldInMessage(\n request, 'job.configuration.copy.destinationTable.datasetId',\n destination_ref.Parent().Name(...
[ "0.62132674", "0.56889355", "0.55710876", "0.55588037", "0.5540921", "0.54608697", "0.54608697", "0.54608697", "0.53417224", "0.5325953", "0.52964944", "0.52829", "0.5282849", "0.52788526", "0.52047265", "0.52009565", "0.51657414", "0.51652837", "0.516145", "0.5143834", "0.51...
0.8508633
0
Print a simple greeting to each user in the list.
def greet_users(names): for name in names: msg = "Hello, " + name.title() + "!" print(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def greet_users(names):\n for name in names:\n print(f\"Hello, {name.title()}!\")", "def greeting(list_of_guests):\r\n for i in list_of_guests: \r\n print('Witaj ' + i)", "def greet_users(names):\n for name in names:\n msg = f\"Hello, {name.title()}\"\n print(msg)", "...
[ "0.7734112", "0.77260417", "0.77145106", "0.76987046", "0.76987046", "0.7657923", "0.7309932", "0.7257354", "0.72450185", "0.71396", "0.7127663", "0.71238464", "0.70934796", "0.70934796", "0.7048947", "0.70248073", "0.69579583", "0.69458425", "0.6898827", "0.6775238", "0.6753...
0.7734813
1
Register the message handlers that every journal should support.
def register_message_handlers(journal): journal.dispatcher.register_message_handler( DumpQuorumMessage, _dumpquorumhandler)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _register_handlers(self):\n DBG(\"\\nregister handlers\")\n for hook, handler in self.handlers:\n g.registerHandler(hook, handler)\n\n signal_manager.connect(self.c, 'body_changed', self._after_body_key)", "def _register_handlers(self):\n import handlers as th\n ...
[ "0.72620213", "0.70435107", "0.66157293", "0.65716064", "0.6314305", "0.62207043", "0.6180045", "0.60054207", "0.6003531", "0.5998502", "0.5990488", "0.59491366", "0.5929773", "0.5925832", "0.5805171", "0.58019876", "0.5768111", "0.575978", "0.5712927", "0.5671215", "0.566424...
0.8429424
0
Constructor for DumpQuorumMessage class.
def __init__(self, minfo=None): if minfo is None: minfo = {} super(DumpQuorumMessage, self).__init__(minfo) self.IsSystemMessage = False self.IsForward = True self.IsReliable = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump(self):\n result = super(DumpQuorumMessage, self).dump()\n return result", "def __init__(self):\n super().__init__()\n\n self.__encoded_msg = ''", "def __init__(self, msg):\n\n self.msg = msg", "def __init__(self, msg):\n self.msg = msg", "def __init__(self...
[ "0.7168633", "0.57381815", "0.5708409", "0.56985074", "0.56985074", "0.56985074", "0.56985074", "0.56985074", "0.56985074", "0.56985074", "0.56985074", "0.56985074", "0.56985074", "0.56985074", "0.56985074", "0.569133", "0.5681516", "0.5638713", "0.5632342", "0.5632342", "0.5...
0.7561885
0
Returns a dict with information about the dump quorum message.
def dump(self): result = super(DumpQuorumMessage, self).dump() return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dumps(self) -> Dict[str, Any]:\n return {\n \"commitId\": self.commit_id,\n \"parentCommitId\": self.parent_commit_id,\n \"message\": self.message,\n \"committer\": self.committer.dumps(),\n }", "def __init__(self, minfo=None):\n if minfo is No...
[ "0.6006111", "0.567213", "0.5670017", "0.5648441", "0.5578808", "0.53971803", "0.5394207", "0.5387473", "0.53841007", "0.5374053", "0.5371038", "0.53614724", "0.53580964", "0.5316283", "0.5305731", "0.52922034", "0.52715415", "0.51807743", "0.5176574", "0.51549894", "0.513852...
0.7622692
0
Retrieve a known stored filter object from the db
def retrieve_filter(self, filter_id): LOG.debug("Retrieve filter {}".format(filter_id)) filter_obj = self.filter_collection.find_one({"_id": ObjectId(filter_id)}) # use _id to preselect the currently loaded filter, and drop it while we are at it filter_obj.update([("filters", filter_obj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter():\n return get_filter_data(db, MyTable)", "def get_instance(self, data):\n if self.transient:\n return None\n props = get_primary_keys(self.opts.model)\n filters = {prop.key: data.get(prop.key) for prop in props}\n if None not in filters.values():\n ...
[ "0.6960243", "0.62703", "0.62410784", "0.61514443", "0.6141893", "0.61203706", "0.60491437", "0.60114807", "0.585763", "0.5800049", "0.578962", "0.5782984", "0.5733101", "0.5730981", "0.571787", "0.5717332", "0.5716527", "0.5708957", "0.5699338", "0.5699338", "0.5699338", "...
0.6990458
0
Obtain a cursor for all filters available to an institute in a category.
def filters(self, institute_id, category="snv"): filters_res = self.filter_collection.find( {"institute_id": institute_id, "category": category} ) return filters_res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select(self, eng_category):\r\n sql_select_query = \"SELECT Name, URL, Ingredients FROM \"+ str(eng_category)\r\n self.mycursor.execute(sql_select_query)\r\n records = self.mycursor.fetchall()\r\n \r\n return records", "def filter():\n return get_filter_data(db, MyTable)...
[ "0.5364717", "0.53382677", "0.5266764", "0.5199028", "0.51203734", "0.51203734", "0.5113741", "0.508854", "0.5086552", "0.5083298", "0.50145316", "0.49857625", "0.4980039", "0.49589002", "0.49563545", "0.49544093", "0.49255437", "0.48955005", "0.48900995", "0.48809904", "0.48...
0.6988995
0
Copy `in_tree` to `out_tree`, checking selection(in_tree) for each event.
def tree_copy_selection(in_tree, out_tree, selection): for entry in in_tree: if selection(entry): out_tree.Fill()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_tree_checker(src, dst):\n copy_tree(src, dst)\n return True", "def execute(self, context):\n\n # go to subtree, select all except input and output groups and mark nodes to be copied\n group_node = context.active_node\n sub_tree = group_node.group_tree\n\n ...
[ "0.62684405", "0.5746463", "0.5593152", "0.5558629", "0.5449127", "0.5425309", "0.53680193", "0.5225137", "0.51527005", "0.5107789", "0.5051202", "0.504769", "0.5014795", "0.50122386", "0.49738657", "0.49728838", "0.49718148", "0.496103", "0.49524227", "0.4934227", "0.4934111...
0.78454643
0
Copy `in` to `out` for events where event.`key` does not exist in `keys` `keys` is the set of keys seen so far.
def tree_copy_duplicate_removal(in_tree, out_tree, key, keys): for entry in in_tree: key_value = getattr(entry, key) if not key_value in keys: out_tree.Fill() keys.add(key_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_missing_values(events):\n ret = deepcopy(events)\n srchd, key_events = [], []\n for evt in events:\n _tmp = [(j, e) for j, e in enumerate(events) if e['key']\n == evt['key'] and not e['key'] in srchd]\n if _tmp != []:\n key_events.append(_tmp)\n sr...
[ "0.623754", "0.6082424", "0.5918844", "0.59167224", "0.56955945", "0.5677415", "0.5673033", "0.5609741", "0.55079687", "0.55027145", "0.5486954", "0.5394884", "0.53932744", "0.5390138", "0.53668404", "0.53537357", "0.533538", "0.52792567", "0.5232413", "0.5232282", "0.5213723...
0.663589
0
Convert the numpy array representing the GOL grid to a QImage.
def numpy_to_qimage(np_array: np.ndarray, show_age: bool): # Only support 2D array of bytes assert len(np_array.shape) == 2 and np_array.dtype == np.uint8 width = np_array.shape[1] height = np_array.shape[0] bytes_per_line = width image = QImage(np_array, width, height, bytes_per_line, QImage....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertNumpy2Image(self, array):\n cv2image = cv2.cvtColor(array, cv2.COLOR_BGR2RGBA)\n img = Image.fromarray(cv2image)\n imgtk = ImageTk.PhotoImage(image=img)\n return imgtk", "def make_image(self, save=False):\n\n # image_grid = np.full((self.size_x, self.size_y), '#88888...
[ "0.6397902", "0.6196134", "0.60192525", "0.59758794", "0.5931983", "0.5765702", "0.5721111", "0.5687924", "0.56588805", "0.5628664", "0.55947673", "0.55882084", "0.5583067", "0.55810326", "0.55731523", "0.5548744", "0.5506583", "0.54962564", "0.54832053", "0.54686344", "0.546...
0.68053734
0
Prepare paths specified as config. The input is a list of either strings, or 2tuples (source, target). Where single strings are supplied, the basenames are used as targets. Where targets are given explicitly, they must not be absolute paths. Returns a list of 2tuples, or throws ConfigError if something is wrong in the ...
def process_path_specs(specs): processedSpecs = [] for spec in specs: if not isinstance(spec, (list, tuple)): source = spec target = None elif len(spec) != 2: raise ConfigError("path spec must be a list or tuple of " "length two") e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_paths(src, dst, paths, *, exclude=None):\n files = []\n\n for path in paths:\n if isinstance(path, tuple):\n files += copy_path(src, dst, path[0], path[1], exclude=exclude)\n else:\n files += copy_path(src, dst, path, exclude=exclude)\n\n return files", "def ...
[ "0.5550079", "0.5392351", "0.5171191", "0.5132501", "0.5108284", "0.5076208", "0.5054015", "0.5015645", "0.4951827", "0.4932448", "0.49286622", "0.49249643", "0.48797044", "0.48406097", "0.48093775", "0.4735485", "0.47257975", "0.47036657", "0.47026363", "0.46804345", "0.4679...
0.6430958
0
Return the paths of directories which contain files that should not be included, generally because they contain standard system libraries.
def _GetDefaultBinPathExcludes(self): if sys.platform == "win32": import cx_Freeze.util systemDir = cx_Freeze.util.GetSystemDir() windowsDir = cx_Freeze.util.GetWindowsDir() return [windowsDir, systemDir, os.path.join(windowsDir, "WinSxS")] elif sys.platfo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeduppaths():\r\n # This ensures that the initial path provided by the interpreter contains\r\n # only absolute pathnames, even if we're running from the build directory.\r\n L = []\r\n known_paths = set()\r\n for dir in sys.path:\r\n # Filter out duplicate paths (on case-insensitive ...
[ "0.68841964", "0.66146666", "0.6608054", "0.6544238", "0.6524269", "0.65076166", "0.64406294", "0.64142877", "0.63882494", "0.6343896", "0.6316815", "0.6312666", "0.6243478", "0.6181976", "0.6178829", "0.6160177", "0.615914", "0.61474144", "0.61427253", "0.61281586", "0.61181...
0.7017395
0
Return true if the file should be copied to the target machine. This is done by checking the binPathIncludes, binPathExcludes, binIncludes and binExcludes configuration variables using first the full file name, then just the base file name, then the file name without any version numbers. Files are included unless speci...
def _ShouldCopyFile(self, path): # check for C runtime, if desired path = os.path.normcase(path) dirName, fileName = os.path.split(path) if fileName.startswith("msvcr") and fileName.endswith(".dll"): self.msvcRuntimeDir = dirName return self.includeMSVCR ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conditional_copy(asciitest_out_dir, doc_file):\n # path join uses backslash win32 which is not cmake compatible\n\n filename = save_cmake_filename(doc_file)\n\n filename1 = os.path.join(asciitest_out_dir, filename + \".temp\").replace(\"\\\\\",\"/\")\n filename2 = os.path.join(asciitest_out_dir, fi...
[ "0.5926794", "0.576537", "0.5734732", "0.563512", "0.55802953", "0.5525144", "0.5376832", "0.5344218", "0.5341193", "0.5339224", "0.5329194", "0.53072923", "0.5279975", "0.5243441", "0.5227413", "0.5205067", "0.51915103", "0.51590645", "0.5157132", "0.51411957", "0.512988", ...
0.80116713
0
Takes a user and a group name, and returns `True` if the user is in that group.
def is_in_group(user, group_name): return is_in_group_user_id(user.id, group_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_user_in_group(user, group):\n users = group.get_users()\n if user in users:\n return True\n return False", "def is_in_group(user, group_name):\n return user.groups.filter(name__exact=group_name).exists()", "def is_in_group(user, group_name):\n return Group.objects.get(name=group_na...
[ "0.90404195", "0.89909446", "0.8921993", "0.88956964", "0.8691311", "0.8651488", "0.85226196", "0.8471016", "0.8424121", "0.83981097", "0.83976525", "0.8325658", "0.8266118", "0.8199991", "0.81931895", "0.7539715", "0.7505139", "0.7332905", "0.726839", "0.7217727", "0.7149777...
0.90948594
0
'If you create a Lambda function that processes events from streambased services (Amazon Kinesis Streams), the number of shards per stream is the unit of concurrency. If your stream has 100 active shards, there will be 100 Lambda functions running concurrently. Then, each Lambda function processes events on a shard in ...
def handler(event, context): debug = False rewind = False dry_run = False table = _ensure_dynamo_table() consumer_id = 'test-consumer' if debug: state = table.scan() print "Active leases in Dynamo:", state["Count"] for item in state["Items"]: print json.dump...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lambda_handler(event, context):\n\n mytime, lambda_name, env_vars = lambda_init.init_lambda(context)\n stage = env_vars[\"stage\"]\n consumer_master_past_lambda = env_vars[\"consumer_master_past_name\"]\n\n apps, test_params = init_apps_from_test_params(event)\n filters = init_filters()\n\n s...
[ "0.6036465", "0.5968453", "0.5582644", "0.54831797", "0.5460034", "0.54361176", "0.5364517", "0.53256035", "0.52649206", "0.5256149", "0.5254377", "0.5188891", "0.5165099", "0.5165099", "0.5149605", "0.51353747", "0.51282066", "0.51216805", "0.5100538", "0.50952226", "0.50934...
0.61084247
0
Test if the path holder contains a shot render.
def test(cls, pathHolder, parentCrawler): if not super(ShotRenderCrawler, cls).test(pathHolder, parentCrawler): return False renderType = pathHolder.baseName().split(".")[0].split("_")[-1] return renderType == "sr"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point_is_shot(self, point: Point):\n return point in self.shot_locations", "def test(cls, pathHolder, parentCrawler):\n if not super(TurntableCrawler, cls).test(pathHolder, parentCrawler):\n return False\n\n renderType = pathHolder.baseName().split(\".\")[0].split(\"_\")[-1]\n...
[ "0.66429377", "0.6288864", "0.6145428", "0.6053248", "0.6007993", "0.5842656", "0.5803181", "0.5795196", "0.57627773", "0.5747576", "0.56485415", "0.56485415", "0.5615542", "0.55867237", "0.5571235", "0.55255395", "0.55035883", "0.54886705", "0.5453938", "0.545361", "0.542327...
0.7443225
0
Find links in jsoncompatible data.
def find_links(obj): if isinstance(obj, dict): for key, value in obj.iteritems(): for url in find_links(value): yield url elif isinstance(obj, list): for item in obj: for url in find_links(item): yield url else: try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_urls(json_dict):\n url_list = []\n count = 0\n for i in json_dict[\"items\"]:\n if i[\"is_answered\"]:\n url_list.append(i[\"link\"])\n count += 1\n if count == 3 or count == len(i):\n break\n \n for i in url_list:\n wb.open(i)", "def g...
[ "0.64437044", "0.6328608", "0.6288369", "0.62582314", "0.5989727", "0.5896046", "0.58893055", "0.58317786", "0.58317786", "0.5802547", "0.5788355", "0.57476854", "0.5663333", "0.5635389", "0.5627574", "0.5625349", "0.56044173", "0.5590741", "0.55799675", "0.5561591", "0.55544...
0.66384387
0
Load the correct backend driver for data persistent.
def _load_driver(backend, **kargs): bk_module = importlib.import_module('backend', __package__) driver_cls = getattr(bk_module, str.capitalize(backend) + 'Backend') return driver_cls(**kargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_backend(cls) -> IBackend:\n cls.Lock.acquire()\n try:\n return cls._load_backend()\n finally:\n cls.Lock.release()", "def set_backend(self, backend):\n if backend not in AVAILABLE_BACKENDS:\n raise StorageError(f'Unrecognized backend {backend}...
[ "0.64767873", "0.6454533", "0.6352563", "0.6303405", "0.6164173", "0.59922636", "0.5975386", "0.58862835", "0.58696896", "0.5819013", "0.58041245", "0.5792222", "0.5769137", "0.575706", "0.5755538", "0.5722598", "0.5693296", "0.5691711", "0.5683557", "0.5676043", "0.5659401",...
0.7439424
0
Get the table name to save data from the url.
def _get_table_name(url): try: return urlparse(url).path.strip('/').split('/')[1] except IndexError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tablename(self):\n _, tail = os.path.split(self.url)\n return tail[:-4]", "def table_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"table_name\")", "def table_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"table_name\")", "def table_name(self) -> pu...
[ "0.72730315", "0.6656085", "0.6656085", "0.6656085", "0.65448517", "0.64656055", "0.6451091", "0.6374937", "0.6281148", "0.6230515", "0.61168766", "0.60657483", "0.6009189", "0.5981553", "0.5945678", "0.5933731", "0.5901814", "0.5891688", "0.5882904", "0.58783686", "0.5870253...
0.7577692
0
Save data from response to backend persistent driver. Only save the detail item from a url, filter out the overall items like
def save(self, response): url = response.url if self.item_url(url): table_name = self._get_table_name(url) if table_name: data = response.json() self.backend.save(table_name, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_detail(self, response):\n\n self.logger.log(self.log_lvl, 'scraping data @ {}'.format(response.url))\n\n item_list = list()\n image_urls = list()\n # extract image\n try:\n pattern = re.compile(r\"(.*imagearray:)(.*)(,.*displaymode.*)\", re.MULTILINE | re.DOT...
[ "0.5922734", "0.5857825", "0.5833559", "0.5798279", "0.5555864", "0.55542606", "0.5488991", "0.5482613", "0.54276925", "0.5380093", "0.53528607", "0.5344608", "0.53070605", "0.5304953", "0.5301043", "0.5283759", "0.52696395", "0.5248865", "0.52482927", "0.5235908", "0.5224081...
0.690983
0
Tests that a keyvault with 0 access policies is processed properly and doesn't raise an exception.
def test_whitelist_zero_access_policies(self): p = self.load_policy({ 'name': 'test-key-vault', 'resource': 'azure.keyvault', 'filters': [ {'type': 'value', 'key': 'name', 'op': 'glob', 'value_type': 'normaliz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_authz_file_empty_raises(self):\n self.env.config.set('authz_policy', 'authz_file', '')\n self.assertRaises(ConfigurationError, self.check_permission,\n 'WIKI_VIEW', 'änon', None, None)", "def noaccess(self):\n self.assertEqual(self.client.get(self.ENDPOINT)....
[ "0.615517", "0.6075056", "0.6071155", "0.6068709", "0.59903747", "0.5970702", "0.59659946", "0.5951002", "0.5945882", "0.5927157", "0.59155506", "0.5856525", "0.58519167", "0.5801739", "0.5789592", "0.5782919", "0.5781346", "0.577808", "0.5775319", "0.576997", "0.57695985", ...
0.7272632
0
Filters a list of elements. 'viewer' is the viewer that we are filtering elements for. 'parent' is the parent element. 'elements' is the list of elements to filter. Returns a list containing only those elements for which 'select' returns True.
def filter(self, viewer, parent, elements): return [e for e in elements if self.select(viewer, parent, e)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select(self, viewer, parent, element):\n\n return True", "def filter_by_reviewers(reviews, selected_reviewers):\n return [x for x in reviews if x.reviewer in selected_reviewers]", "def validate(elements):\n return list(filter(lambda el: el.is_valid, elements))", "def select(elements, val...
[ "0.53416806", "0.5286004", "0.516275", "0.51596725", "0.5059366", "0.5055007", "0.50266373", "0.49372914", "0.4907756", "0.47648945", "0.47609642", "0.46878317", "0.46518713", "0.46268824", "0.46157223", "0.4608182", "0.4597628", "0.45550662", "0.45305058", "0.45274553", "0.4...
0.87938285
0
Returns True if the element is 'allowed' (ie. NOT filtered). 'viewer' is the viewer that we are filtering elements for. 'parent' is the parent element. 'element' is the element to select. By default we return True.
def select(self, viewer, parent, element): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_element_in_view(self, element: Element) -> bool:\n return self.find_element_view(element=element) is not None", "def tag_visible(element):\n\n if element.parent.name in ['style', 'script', 'head', 'title', 'meta', '[document]']:\n return False\n if isinstance(element, Comment):\n ...
[ "0.59139556", "0.57015985", "0.5638367", "0.54528904", "0.5326502", "0.52207935", "0.5189183", "0.51695454", "0.5162016", "0.51491517", "0.50781363", "0.49656478", "0.49402714", "0.49008185", "0.48731193", "0.48402408", "0.4839491", "0.48392522", "0.48301572", "0.48110285", "...
0.6605754
0
Is the filter affected by changes to an element's trait? 'element' is the element. 'trait_name' is the name of the trait. Returns True if the filter would be affected by changes to the trait named 'trait_name' on the specified element. By default we return False.
def is_filter_trait(self, element, trait_name): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_element_in_view(self, element: Element) -> bool:\n return self.find_element_view(element=element) is not None", "def has_visibility(trait, visibility_name):\n\n return trait.visibility == getattr(schema.Trait.Visibility, visibility_name)", "def contains(self, element) -> bool:\n\n return ...
[ "0.5432807", "0.5380321", "0.5154928", "0.50004315", "0.49823684", "0.4972386", "0.49546346", "0.49431932", "0.4915069", "0.4896147", "0.48712415", "0.48191318", "0.48169592", "0.47890756", "0.4781882", "0.47721133", "0.47471988", "0.47195056", "0.47182444", "0.46942788", "0....
0.7937278
0
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
def minDepth(self, root: TreeNode) -> int: return self.bfs(root)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_depth(node):\n if not node:\n return 0\n elif (not node.left) and (not node.right):\n # found leaf\n return 1\n elif not node.left:\n # if the root has only 1 child, this prevents the minimum depth from\n # equaling zero\n return min_depth(node.right) + 1\...
[ "0.8461286", "0.8181243", "0.71641576", "0.7144373", "0.6993832", "0.6950117", "0.6907654", "0.6858466", "0.68347263", "0.6743698", "0.67391497", "0.6727257", "0.6615435", "0.6594133", "0.657416", "0.6555998", "0.6510495", "0.64694285", "0.646406", "0.6413745", "0.6391296", ...
0.86733794
0
Converts the complex number `c` to a string in Fortranformat, i.e. (Re c, Im c). If c is iterable, it returns a string of the form [(Re c_1, Im c_1), ...].
def str_complex(c, kindstr=''): if hasattr(c, '__iter__'): return '[' + ', '.join([str_complex(c_i, kindstr) for c_i in c]) + ']' else: c = complex(c) return '({}{}, {}{})'.format(c.real, kindstr, c.imag, kindstr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complex_vct_str ( vct , format = '%.5g%-+.5gj' ) :\n try :\n lst = [] \n for c in vct :\n cc = complex ( c )\n item = format % ( cc.real , cc.imag )\n lst.append ( cc ) \n return '[ ' + ', '.join ( lst ) + ' ]' \n except TypeError :\n ...
[ "0.7047887", "0.58852553", "0.5754803", "0.5726591", "0.57228047", "0.56523186", "0.56442934", "0.56111693", "0.5576192", "0.55657303", "0.5538955", "0.55268145", "0.5501663", "0.54070234", "0.5394753", "0.53852344", "0.536029", "0.535686", "0.53531355", "0.53468204", "0.5337...
0.7722821
0
Select PORT update events, notify the observers upon a port update in APPL_DB/CONFIG_DB or a XCVR insertion/removal in STATE_DB
def handle_port_update_event(sel, asic_context, stop_event, logger, port_change_event_handler): if not stop_event.is_set(): (state, _) = sel.select(SELECT_TIMEOUT_MSECS) if state == swsscommon.Select.TIMEOUT: return if state != swsscommon.Select.OBJECT: logger.log_war...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _port_status_handler(self, ev):\n msg = ev.msg\n reason = msg.reason\n port_no = msg.desc.port_no\n dpid = msg.datapath.id\n ofproto = msg.datapath.ofproto\n\n reason_dict = {ofproto.OFPPR_ADD: \"added\",\n ofproto.OFPPR_DELETE: \"deleted\",\n ...
[ "0.62168676", "0.6123209", "0.60724276", "0.60613334", "0.60579395", "0.6057897", "0.60528636", "0.59052724", "0.58132577", "0.5790811", "0.5715928", "0.5668344", "0.56622344", "0.5567299", "0.55424833", "0.54548216", "0.5438808", "0.5418422", "0.5405286", "0.5364919", "0.534...
0.6788266
0
Select CONFIG_DB PORT table changes, once there is a port configuration add/remove, notify observers
def handle_port_config_change(sel, asic_context, stop_event, port_mapping, logger, port_change_event_handler): if not stop_event.is_set(): (state, _) = sel.select(SELECT_TIMEOUT_MSECS) if state == swsscommon.Select.TIMEOUT: return if state != swsscommon.Select.OBJECT: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_port( self ):\n # disconnect and delete controller\n self.delete_controller()\n \n # update port\n self.update_port()", "def check_device_changes(self):\n\n #---------------------------------------------------------------------------\n # USB ports\n ...
[ "0.60486573", "0.601688", "0.6003362", "0.5990358", "0.5919747", "0.5897559", "0.5824499", "0.5805411", "0.57939553", "0.5755642", "0.5738589", "0.57356256", "0.56507355", "0.5590035", "0.55844575", "0.5562933", "0.5554786", "0.55488783", "0.5544349", "0.5528714", "0.55249166...
0.6089049
0
Get port mapping from CONFIG_DB
def get_port_mapping(namespaces): port_mapping = PortMapping() for namespace in namespaces: asic_id = multi_asic.get_asic_index_from_namespace(namespace) config_db = daemon_base.db_connect("CONFIG_DB", namespace=namespace) port_table = swsscommon.Table(config_db, swsscommon.CFG_PORT_TABL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDbPort():\n\n if \"DB_PORT\" in controller.CONF.keys():\n return controller.CONF[\"DB_PORT\"]\n\n return basedefs.DB_PORT", "def db_port(self) -> Optional[int]:\n return pulumi.get(self, \"db_port\")", "def get_all_port(self, conf, dpid):\n\t\tpass", "def get_port_binding():\n ...
[ "0.6964796", "0.6683577", "0.653418", "0.65336806", "0.6416702", "0.628645", "0.6283446", "0.6275742", "0.6270378", "0.6266905", "0.62222916", "0.6177558", "0.60762554", "0.60760283", "0.597032", "0.59239864", "0.5915565", "0.59000075", "0.58872294", "0.5862604", "0.5836161",...
0.6833719
1
Add a class that doesn't descend from Pickleable to the pickle whitelist
def addClassToPickleWhitelist(cls): unpickleWhitelist_.add(cls)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_class(self, module, name):\n raise pickle.UnpicklingError(\"global '%s.%s' is forbidden\" %\n (module, name))", "def test__pickle_unpickle(self):\n pass", "def __reduce__(self) -> NoReturn:\n raise TypeError(\n \"can't...
[ "0.5848995", "0.5714878", "0.5440713", "0.5331448", "0.53248143", "0.5274852", "0.5263136", "0.5262969", "0.5250038", "0.52005446", "0.5171152", "0.515845", "0.5151149", "0.51253116", "0.51061636", "0.51053673", "0.5073575", "0.5070191", "0.5066985", "0.5048813", "0.50263953"...
0.8570413
0
Recursively searches for 'datacubedefinition.prj' in a level2 directory and returns its parent directory.
def _get_datacubeprj_dir(directory): prj_path = [] for path in Path(directory).rglob('datacube-definition.prj'): prj_path.append(path) if len(prj_path) < 1: raise FileNotFoundError(f"'datacube-definition.prj' not found in {directory}") elif len(prj_path) > 1: raise RuntimeError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_parent_path(self):\n return os.path.join(os.getcwd(), \"src\", \"data\", \"genes\")", "def find_in_parent_dir(fname):\n p = os.path.abspath(os.path.curdir)\n \n while not os.path.exists(os.path.join(p, project_conf_name)):\n oldp, p = p, os.path.dirname(p)\n if p == oldp:\n...
[ "0.59310746", "0.5910224", "0.5907544", "0.56730086", "0.567043", "0.54829234", "0.5468787", "0.5349158", "0.53045815", "0.52922255", "0.52142084", "0.52010685", "0.519746", "0.51958925", "0.51642823", "0.5158747", "0.51506376", "0.51362514", "0.5133889", "0.51276433", "0.511...
0.72337234
0
Create a vocabulary from the training directory return a sorted vocabulary list
def create_vocabulary(directory, cutoff): top_level = os.listdir(directory) a = cutoff vocab = {} for d in top_level: subdir = d if d[-1] == '/' else d+'/' files = os.listdir(directory+subdir) for f in files: with open(directory+subdir+f,'r', encoding="utf-8") as doc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_vocabulary(vocabulary_path, json_vocab_path):\n if not gfile.Exists(vocabulary_path):\n print(\"Transform vocabulary to %s\" % vocabulary_path)\n with gfile.GFile(json_vocab_path, mode=\"rb\") as f:\n jvocab = json.load(f)\n vocab = jvocab['w2id']\n voca...
[ "0.72303003", "0.7164037", "0.71459424", "0.7054131", "0.7033178", "0.700483", "0.68919396", "0.68904585", "0.68769383", "0.6866679", "0.6859989", "0.6854887", "0.6839105", "0.6836058", "0.68341655", "0.6810794", "0.6810794", "0.6805193", "0.6802589", "0.6783411", "0.6731821"...
0.7643122
0
return the class conditional probability of label over all words, with smoothing
def p_word_given_label(vocab, training_data, label): smooth = 1 # smoothing factor word_prob = {} # TODO: add your code here total_word = 0 word_prob[None] = 0 for dic in training_data: for index0, i0 in enumerate(dic['bow']): if (list(dic['bow'])[index0] in word_prob): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predictability(self):\n temp = self.probs\n for n in range(10):\n temp = temp.dot(temp)\n final = temp[0,:]\n #Let's assume that all words have unique initial letters\n probs = map(len, self.words)\n probs = array(probs)\n probs = (probs + self.probs....
[ "0.7158563", "0.68635947", "0.6840666", "0.66153693", "0.6609253", "0.6576637", "0.6564863", "0.653211", "0.6521681", "0.6498006", "0.6471072", "0.640781", "0.63957083", "0.6352886", "0.6348521", "0.6348173", "0.634401", "0.634401", "0.6340316", "0.63331866", "0.6293823", "...
0.7195733
0
Find all pairs of unique indices which form a palindrome.
def palindromePairs(lst): results = [] for i, e1 in enumerate(lst): for j, e2 in enumerate(lst): if i != j: if isPalindrome(e1+e2): results.append((i, j)) return results
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def palindromePairs(self, words: List[str]) -> List[List[int]]:\n d = {w : i for i, w in enumerate(words)}\n \n res = []\n for idx, word in enumerate(words):\n for i in range(len(word)+1):\n str1 = word[:i]\n str2 = word[i:]\n # fi...
[ "0.7363634", "0.7076098", "0.70694715", "0.6878793", "0.67712194", "0.67707276", "0.67490494", "0.65257967", "0.6466228", "0.63992494", "0.63456815", "0.633291", "0.6321037", "0.62712246", "0.6258766", "0.6231323", "0.6217285", "0.62059194", "0.6202977", "0.6194959", "0.61816...
0.78059846
0
Convert a dictionary to an earth engine feature server side
def dict_to_feature(d): f = ee.Feature(None,ee.Dictionary(d)) return f
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _preprocess(self, feature_dict):\n return feature_dict", "def from_dict(cls, dikt) -> 'Features':\n return util.deserialize_model(dikt, cls)", "def dict_to_feature(feature_dict, keys, max_value=None):\n feature = []\n for key, val in feature_dict.items(): # First level\n if key not ...
[ "0.6012967", "0.5905541", "0.58329165", "0.57612747", "0.5738102", "0.5726723", "0.5687374", "0.56813467", "0.5624164", "0.56068397", "0.5599818", "0.5524402", "0.548304", "0.5466543", "0.5398618", "0.53919345", "0.53797644", "0.5355627", "0.53457856", "0.5333529", "0.5318250...
0.78169143
0
Convert volume to flux
def volumeToFlux(volume_image): image = ee.Image(volume_image) flux_image = image.divide(ee.Image(AREA_PFAF6_30MIN)).multiply(1e6).copyProperties(image) flux_image = flux_image.set("units","m") flux_image = flux_image.set("convertedToFlux", 1) return flux_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertflux(self, *args, **kwargs):\n return _image.image_convertflux(self, *args, **kwargs)", "def flux(source, freq=0.0, deltafreq=0.0, daysback=0.0) :\n x = queryFlux(source,freq,deltafreq,daysback)\n return x.flux", "def flux(self, x):\n return self.cal_spec.get_flux(self(x))", "d...
[ "0.6863947", "0.65460765", "0.6410462", "0.63754797", "0.6337502", "0.63291806", "0.63291806", "0.62562454", "0.61814946", "0.61583227", "0.60439867", "0.60325944", "0.592126", "0.5912541", "0.5898983", "0.5894703", "0.58924603", "0.58740014", "0.5857131", "0.58522546", "0.58...
0.8054486
0
filters an imagecollection based on year and month
def filter_ic(ic,year,month): ic_filtered = (ic.filter(ee.Filter.eq("month",month)) .filter(ee.Filter.eq("year",year))) image = ee.Image(ic_filtered.first()) return(image)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filter_temporal(self, start_date: str, end_date: str) -> 'ImageCollection':\n process_id = 'filter_daterange'\n args = {\n 'imagery': self.graph,\n 'extent': [start_date, end_date]\n }\n\n return self.graph_add_process(process_id, args)", "def fi...
[ "0.6298117", "0.5903462", "0.58848464", "0.5747459", "0.5735303", "0.5665092", "0.54974794", "0.5486667", "0.5385302", "0.5352185", "0.5291872", "0.5263054", "0.5232077", "0.52078956", "0.519673", "0.51886106", "0.5142435", "0.510914", "0.50958353", "0.50748765", "0.50723386"...
0.77574176
0
Zonal statistics with rasters as input and rasters and lists as output
def zonalStatsToRaster(image,zonesImage,geometry,maxPixels,reducerType): # reducertype can be mean, max, sum, first. Count is always included for QA # the resolution of the zonesimage is used for scale reducer = ee.Algorithms.If(ee.Algorithms.IsEqual(reducerType,"mean"),ee.Reducer.mean(), ee.Algorithms...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zonal_stats(src_poly, src_raster, operator=['mean'], features=None):\n assert src_raster.geo_transform is not None, \"src_raster.geo_transform should not be None\"\n assert isinstance(operator, list), \"operator should be a list of string. ex: ['mean']\"\n features = list(range(src_raster.bands)) if f...
[ "0.68493986", "0.6522732", "0.62442964", "0.62096614", "0.6187095", "0.60611725", "0.60029554", "0.5962458", "0.5880883", "0.58487236", "0.5846595", "0.5792119", "0.57755446", "0.57681596", "0.5670428", "0.55730975", "0.5560811", "0.5551571", "0.55226356", "0.55010265", "0.54...
0.71548915
0
Instantiate the daily profile class..
def __init__(self, profile: Dict[datetime.time, float] = None) -> None: if profile is None: profile = dict() if not isinstance(profile, dict): raise ProgrammerJudgementFault( "The input daily profile provided is not a mapping of the correct type." ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, name):\n self.__username = name\n self.__startDate = datetime.now().date().today() # This attributes will not be change ever once it has been initialized.", "def __init__(self, dt=60*60*24):\n pass", "def __init__(self, student, start_date, day_periods):\n self...
[ "0.6303617", "0.6276865", "0.61957604", "0.6129965", "0.60512453", "0.5994838", "0.59334636", "0.5906946", "0.57980454", "0.57551837", "0.5752836", "0.57355404", "0.5726834", "0.5710793", "0.5709311", "0.56886977", "0.5673901", "0.5655608", "0.5648033", "0.5615956", "0.559050...
0.6949065
0
Updates the internal profile with the mapping provided.
def update(self, profile: Dict[datetime.time, float]) -> None: if self._profile is None: self._profile = profile else: self._profile.update(profile)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, mapping):\n if not ismapping(mapping):\n raise TypeError(\"mapping type required\")\n field_names = getpyattr(type(self), 'field_names')\n for key, value in mapping.items():\n if key in field_names:\n setattr(self, key, value)", "def upda...
[ "0.63624704", "0.609009", "0.60749924", "0.5952606", "0.59126085", "0.5860821", "0.5851326", "0.58165675", "0.57689905", "0.5755722", "0.57045287", "0.56417894", "0.5599517", "0.55890405", "0.5579434", "0.55684793", "0.55682325", "0.5558063", "0.55190516", "0.5518738", "0.549...
0.7125943
0
The density of air varies as a function of temperature.
def density_of_air(self) -> float: return self.pressure / (SPECIFIC_GAS_CONSTANT_OF_AIR * self.ambient_temperature)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def air_density(self):\n return self.flow_field.air_density", "async def air_density(self, temperature, station_pressure):\n if temperature is not None and station_pressure is not None:\n kelvin = temperature + 273.15\n pressure = station_pressure\n r_specific = 287...
[ "0.7871237", "0.77620345", "0.73548687", "0.7349471", "0.6937895", "0.6883913", "0.6820493", "0.6713705", "0.6696069", "0.66546506", "0.6654112", "0.6648508", "0.6641304", "0.6609871", "0.65910405", "0.6577765", "0.6577765", "0.6577765", "0.6552875", "0.654293", "0.65178937",...
0.7765341
1
The dynamic viscosity of air varies as a function of temperature.
def dynamic_viscosity_of_air(self) -> float: return (1.458 * (10 ** (-6)) * (self.ambient_temperature**1.5)) / ( self.ambient_temperature + 110.4 )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kinematic_viscosity_of_air(self) -> float:\n\n return self.dynamic_viscosity_of_air / self.density_of_air", "def latent_heat_vapourisation(self, tair):\n return (2.501 - 0.00237 * tair) * 1E06", "def air_density(self):\n return self.flow_field.air_density", "def thermal_expansivity_o...
[ "0.7093741", "0.6370206", "0.617513", "0.6122823", "0.61151516", "0.6091893", "0.6021482", "0.59835947", "0.592721", "0.5878499", "0.58544457", "0.5826623", "0.58215696", "0.5811718", "0.58073586", "0.56892794", "0.56720847", "0.56465936", "0.5620597", "0.5558093", "0.5547346...
0.82398015
0
Return the heat capacity of air in Joules perkilogram Kelvin. The heat capacity of air varies with a function of temperature and is given by an empiricallyderived formula.
def heat_capacity_of_air(self) -> float: return 1002.5 + 275 * (10 ** (-6)) * (self.ambient_temperature - 200) ** 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heatCapacity(self, Tk=None, Tc=None):\n Tk = getTk(Tc, Tk)\n self.checkPropertyTempRange(\"heat capacity\", Tk)\n return (\n sum(\n [\n +1.38642e-13 * Tk**4,\n -6.47481e-10 * Tk**3,\n +1.02345e-06 * Tk**2,\n...
[ "0.72807765", "0.70755357", "0.67571175", "0.6657788", "0.6539134", "0.63971967", "0.63434315", "0.6203374", "0.62022215", "0.61694735", "0.61694306", "0.6157651", "0.61571056", "0.61204106", "0.6098233", "0.60910946", "0.6065617", "0.6051415", "0.60473984", "0.6033305", "0.6...
0.77720433
0
The kinematic viscosity of air varies as a function of temperature.
def kinematic_viscosity_of_air(self) -> float: return self.dynamic_viscosity_of_air / self.density_of_air
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dynamic_viscosity_of_air(self) -> float:\n\n return (1.458 * (10 ** (-6)) * (self.ambient_temperature**1.5)) / (\n self.ambient_temperature + 110.4\n )", "def latent_heat_vapourisation(self, tair):\n return (2.501 - 0.00237 * tair) * 1E06", "def dispersion(self, k):\n ...
[ "0.7809844", "0.62890047", "0.62317854", "0.6194581", "0.61644995", "0.61163557", "0.600697", "0.5984969", "0.5790677", "0.575207", "0.5744783", "0.5729746", "0.5714137", "0.57019544", "0.5691392", "0.56809", "0.56597465", "0.56572974", "0.5655333", "0.56213343", "0.56118655"...
0.8016766
0
Determines the radiative temperature of the sky. The "sky," as a black body, has a radiative temperature different to that of the surrounding air, or the ambient temperature. This function converts between them and outputs the sky's radiative temperature.
def sky_temperature(self) -> float: return 0.0552 * (self.ambient_temperature**1.5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sky_ir_temperature(self) -> float:\n self.serial.write(b\"S!\")\n sky_ir_temp = self.__extract_int(self.__read_response(1)[0], b\"!1\")\n\n return round(sky_ir_temp / 100, 2)", "def temperature() -> float:", "def temperature(self):\n names = ['anc_air_temperature']\n ...
[ "0.677967", "0.65615", "0.64276695", "0.6416784", "0.64141804", "0.6408829", "0.62878555", "0.6222289", "0.6220975", "0.61991245", "0.6182677", "0.61740917", "0.61678636", "0.6091844", "0.60883605", "0.6079088", "0.6072627", "0.6015334", "0.60076296", "0.59943837", "0.5990562...
0.77121866
0
The thermal conductivity of air varies as a function of temperature.
def thermal_conductivity_of_air(self) -> float: # This more accurate equation is not used by the paper. # return (0.02646 * self.ambient_temperature ** 1.5) / ( # self.ambient_temperature + 254.4 * (10 ** (-12 / self.ambient_temperature)) # ) # The reference suggests this e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thermal_expansivity_of_air(self) -> float:\n\n return 1 / self.ambient_temperature", "def thermal_conductivity(temperature):\n a0 = -4.1236\n a1 = 13.788\n a2 = -26.068\n a3 = 26.272\n a4 = -14.663\n a5 = 4.4954\n a6 = -0.6905\n a7 = 0.0397\n ...
[ "0.79880536", "0.764283", "0.7523666", "0.75130093", "0.7090662", "0.70669293", "0.7042304", "0.6954361", "0.6936385", "0.6905874", "0.6894696", "0.68758714", "0.6788131", "0.6774004", "0.677208", "0.67583066", "0.6724294", "0.67135936", "0.66866106", "0.66677165", "0.6657772...
0.8359033
0
The thermal expansion coefficient of air varies as a function of temperature.
def thermal_expansivity_of_air(self) -> float: return 1 / self.ambient_temperature
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thermal_conductivity_of_air(self) -> float:\n\n # This more accurate equation is not used by the paper.\n # return (0.02646 * self.ambient_temperature ** 1.5) / (\n # self.ambient_temperature + 254.4 * (10 ** (-12 / self.ambient_temperature))\n # )\n\n # The reference sug...
[ "0.7279272", "0.68165576", "0.6797786", "0.6684487", "0.66219014", "0.6579864", "0.6570214", "0.6559898", "0.649577", "0.64194864", "0.63722163", "0.6345614", "0.6337939", "0.6337814", "0.6305888", "0.6286312", "0.6284374", "0.6271602", "0.6268423", "0.62625694", "0.62529576"...
0.76827806
0
Determines the convective heat transfer coefficient, either free, or forced. In the absence of any wind, the "free" wind_heat_transfer_coefficient is returned. If there is wind present, then this parameter is known as the "forced" wind_heat_transfer_coefficient.
def wind_heat_transfer_coefficient(self) -> float: return 3.8 + 2 * self.wind_speed # return 4.5 + 2.9 * self.wind_speed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thermalConductivity(self, Tk=None, Tc=None):\n Tk = getTk(Tc, Tk)\n self.checkPropertyTempRange(\"thermal conductivity\", Tk)\n thermalConductivity = (\n 2.13014e-08 * Tk**3\n - 6.31916e-05 * Tk**2\n + 1.11629e-01 * Tk\n - 2.00043e00\n )\n...
[ "0.6343963", "0.59971076", "0.59249985", "0.5791971", "0.576443", "0.5683115", "0.565232", "0.55878526", "0.5570194", "0.54607165", "0.5381237", "0.52986056", "0.5273817", "0.5269059", "0.5203606", "0.5199913", "0.5169069", "0.5163147", "0.5161178", "0.51067317", "0.510497", ...
0.69990456
0
Return a nice representation of the weather conditions.
def __repr__(self) -> str: return ( "WeatherConditions(" f"ambient_temperature: {self.ambient_temperature:.3f}K, " f"azimuthal_angle: {self.azimuthal_angle}deg, " f"declination: {self.declination}deg, " f"density: {self.density_of_air:.3f}kg/m^3, " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conditions(self, json):\n conditions = str(json['forecast']['simpleforecast']['forecastday'][0]['conditions'])\n return conditions", "def genWeather():\n\n weather = random.choice(weather_conditions.keys())\n condition = weather_conditions[weather]\n (tMax, tMin) = condition[\"temperat...
[ "0.63701195", "0.6170547", "0.6153412", "0.6075571", "0.59051156", "0.5875144", "0.582113", "0.5815576", "0.5801642", "0.5736014", "0.5721063", "0.5704934", "0.56886274", "0.5640063", "0.56320167", "0.5610608", "0.5609194", "0.55756634", "0.5571646", "0.5566451", "0.5524659",...
0.79582655
0
Create a Model from a formula and dataframe.
def from_formula(cls, formula, data, subset=None, drop_cols=None, *args, **kwargs): # TODO: provide a docs template for args/kwargs from child models # TODO: subset could use syntax. GH#469. if subset is not None: data = data.loc[subset] eval_env = kwargs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_formula():\n config = {\"samples\": {\"x1\": onp.ones((2, 10)), \"x2\": onp.ones((2, 10))}}\n\n class Model(Poisson):\n dv = \"y\"\n features = dict(\n x1=dict(transformer=1, prior=dist.Normal(0, 1)),\n x2=dict(transformer=2, prior=dist.Normal(0, 1)),\n )\n...
[ "0.64051425", "0.6352155", "0.6185541", "0.5942793", "0.58994234", "0.5815461", "0.5793945", "0.565781", "0.5657534", "0.56343275", "0.5602399", "0.5592737", "0.55794835", "0.5542218", "0.5530604", "0.5495615", "0.54892266", "0.54615164", "0.5460569", "0.54572856", "0.5424416...
0.6909729
0
Score vector of model. Default implementation sums score_obs. The gradient of loglike with respect to each parameter.
def score(self, params, *args, **kwargs): try: # If an analytic score_obs is available, try this first before # falling back to numerical differentiation below return self.score_obs(params, *args, **kwargs).sum(0) except NotImplementedError: # Fallback in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(self, s):\n fv = s.feature_vector\n product = fv.dot(self.params.T)[0, 0]\n return s.score(lmwt=self.lmwt) + product", "def svm_loss(scores, y):\r\n\r\n N = scores.shape[0]\r\n\r\n # Compute svm data loss\r\n correct_class_scores = scores[range(N), y]\r\n margins = np.m...
[ "0.6385058", "0.6369366", "0.6337341", "0.62241894", "0.6202223", "0.6085212", "0.6069365", "0.5963406", "0.59437096", "0.59082556", "0.5902111", "0.58229357", "0.5803482", "0.57961464", "0.5775284", "0.5754475", "0.5751942", "0.5720772", "0.5715828", "0.57079184", "0.5697270...
0.6393054
0