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
Mock out _branch, this is tested by TestBranch.
def branch_(): with mock.patch.object(branch, '_branch') as branch_: yield branch_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_branching(self):\r\n repo_dir = self.GIT_REPO_DIR\r\n # Test successful import from command\r\n if not os.path.isdir(repo_dir):\r\n os.mkdir(repo_dir)\r\n self.addCleanup(shutil.rmtree, repo_dir)\r\n\r\n # Checkout non existent branch\r\n with self.asse...
[ "0.65736276", "0.63967484", "0.63671947", "0.63618445", "0.63068736", "0.6106301", "0.61058015", "0.6075282", "0.6075282", "0.6057084", "0.6010536", "0.597324", "0.58579177", "0.5852116", "0.5834708", "0.57880634", "0.5748627", "0.574554", "0.57327986", "0.5725962", "0.572367...
0.8044098
0
Branch if carry flag is not set (opposite boolean).
def test_branch_if_carry_clear(self, test_cpu, branch_, carry_flag): test_cpu.status.carry = carry_flag branch.branch_if_carry_clear(test_cpu, 10) branch_.assert_called_with(test_cpu, not carry_flag, 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_branch_if_carry_set(self, test_cpu, branch_, carry_flag):\n test_cpu.status.carry = carry_flag\n\n branch.branch_if_carry_set(test_cpu, 10)\n\n branch_.assert_called_with(test_cpu, carry_flag, 10)", "def c_flag(opt, test_not=False):\n if test_not:\n if opt: return \"FALSE\...
[ "0.6183922", "0.5844638", "0.5806364", "0.5750527", "0.57275176", "0.56755394", "0.55569404", "0.55245805", "0.5501461", "0.5484228", "0.54686785", "0.5444376", "0.54403514", "0.5418086", "0.53900665", "0.53640515", "0.5346114", "0.5340459", "0.5321535", "0.53028655", "0.5296...
0.6691115
0
Branch if carry flag is set.
def test_branch_if_carry_set(self, test_cpu, branch_, carry_flag): test_cpu.status.carry = carry_flag branch.branch_if_carry_set(test_cpu, 10) branch_.assert_called_with(test_cpu, carry_flag, 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_branch_if_carry_clear(self, test_cpu, branch_, carry_flag):\n test_cpu.status.carry = carry_flag\n\n branch.branch_if_carry_clear(test_cpu, 10)\n\n branch_.assert_called_with(test_cpu, not carry_flag, 10)", "def bcs(self, arg):\n\n self.pc += arg if self.p & const.FLAG_CARRY ...
[ "0.69193953", "0.59351563", "0.59240377", "0.58313906", "0.5759881", "0.567168", "0.5390048", "0.5348741", "0.52125174", "0.515934", "0.5122923", "0.51042837", "0.5098164", "0.5060835", "0.4999578", "0.49543428", "0.49496254", "0.49317282", "0.49147722", "0.49086714", "0.4902...
0.68277466
1
Branch if overflow flag is unset.
def test_branch_if_overflow_clear(self, test_cpu, branch_, overflow_flag): test_cpu.status.overflow = overflow_flag branch.branch_if_overflow_clear(test_cpu, 10) branch_.assert_called_with(test_cpu, not overflow_flag, 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_branch_if_overflow_set(self, test_cpu, branch_, overflow_flag):\n test_cpu.status.overflow = overflow_flag\n\n branch.branch_if_overflow_set(test_cpu, 10)\n\n branch_.assert_called_with(test_cpu, overflow_flag, 10)", "def check_overflow(self):\n self.stateC = self.toConceptua...
[ "0.6769022", "0.6407199", "0.6227063", "0.5745773", "0.55910957", "0.5551193", "0.5530446", "0.54808986", "0.5403389", "0.5357843", "0.53023404", "0.526327", "0.52607274", "0.525825", "0.5255608", "0.51768935", "0.5154061", "0.5141711", "0.51349884", "0.51071596", "0.5096703"...
0.7106471
0
Branch if overflow flag is set.
def test_branch_if_overflow_set(self, test_cpu, branch_, overflow_flag): test_cpu.status.overflow = overflow_flag branch.branch_if_overflow_set(test_cpu, 10) branch_.assert_called_with(test_cpu, overflow_flag, 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_branch_if_overflow_clear(self, test_cpu, branch_, overflow_flag):\n test_cpu.status.overflow = overflow_flag\n\n branch.branch_if_overflow_clear(test_cpu, 10)\n\n branch_.assert_called_with(test_cpu, not overflow_flag, 10)", "def check_overflow(self):\n self.stateC = self.toC...
[ "0.6801041", "0.6539321", "0.6054046", "0.5630919", "0.56198674", "0.5586873", "0.54616684", "0.53812474", "0.5342437", "0.53366995", "0.53180367", "0.5248717", "0.5209558", "0.51688653", "0.5122645", "0.5121323", "0.5119085", "0.51142883", "0.5073467", "0.5071009", "0.506864...
0.70716465
0
We represent root parents in both gold and system data by '0'. For gold data, we represent nonroot parent by corresponding gold word. For system data, we represent nonroot parent by either gold word aligned to parent system nodes, or by None if no gold words is aligned to the parent.
def fill_parents(self): for words in self.matched_words: words.gold_parent = ( words.gold_word.parent if words.gold_word.parent is not None else 0 ) words.system_parent_gold_aligned = ( self.matched_words_map.get(words....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_parent_space(self):\n\n parent_node = self.node+'_ZERO'\n parent_node = mc.ls(parent_node)\n\n if not parent_node:\n parent_node = utils.get_parent(self.const_node)\n\n parent_node = mc.ls(parent_node)\n\n if parent_node:\n return ['parent', par...
[ "0.6415481", "0.5966567", "0.59262", "0.57995415", "0.55822134", "0.5563317", "0.5521825", "0.548323", "0.5399164", "0.53862596", "0.5347177", "0.53467196", "0.532689", "0.53051907", "0.5294234", "0.52848643", "0.5279704", "0.52470237", "0.5223586", "0.5193566", "0.5190029", ...
0.72374785
0
We know gold_words[gi].is_multiword or system_words[si].is_multiword. Find the start of the multiword span (gs, ss), so the multiword span is minimal.
def find_multiword_span(self, gold_words, system_words, gi, si): # Initialize multiword_span_end characters index. if gold_words[gi].is_multiword: multiword_span_end = gold_words[gi].span.end if ( not system_words[si].is_multiword and system_words...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_dist_solution(self, words, keyword_dict = None):\r\n\r\n\t\t# default settings\r\n\t\tif keyword_dict == None:\r\n\t\t\tkeyword_dict = self.keyword_dict\r\n\r\n\t\tindexed_text = list(enumerate(words))\r\n\t\t# all found keyword positions\r\n\t\tkeyword_pos = []\r\n\t\tkw_counts = [(len(kw.split()),kw) for...
[ "0.6207649", "0.5810559", "0.57143867", "0.56734926", "0.5609558", "0.55828047", "0.5514523", "0.545097", "0.5436555", "0.5395388", "0.5383953", "0.53748393", "0.5373446", "0.53506786", "0.5343408", "0.5341844", "0.534122", "0.53321636", "0.53077775", "0.5304675", "0.5301188"...
0.7172623
0
Takes a list of gold an predicted sentence objects and computes the F1 LAS score between them.
def get_las_score_for_sentences( self, gold_sentences: List[str], predicted_sentences: List[str] ) -> Dict[str, Union[float, Dict[str, Dict[str, float]]]]: gold_buffer = io.StringIO("".join(gold_sentences)) pred_buffer = io.StringIO("".join(predicted_sentences)) gold_connl = self.l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_f1(self, predicted, gold):\n correct_labeled = 0\n correct_unlabeled = 0\n num_predicted = 0\n num_gold = 0\n\n for p, g in zip(predicted, gold):\n if p != '_':\n num_predicted += 1\n if p == g:\n correct_labeled...
[ "0.65566087", "0.64335585", "0.64117527", "0.6268287", "0.6258071", "0.62303233", "0.62149304", "0.6199279", "0.6167042", "0.6146054", "0.61266416", "0.6086773", "0.6020068", "0.600916", "0.5999621", "0.5938859", "0.5919036", "0.58886796", "0.5885134", "0.58830076", "0.584534...
0.64451283
1
Adds the specified tag to all boxes with names
def add_tag(names, tag): for name in names: b = Box.query.filter_by(name=name).first() b.tags.add(tag) db.session.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addNames(self, names):\n for name in names:\n self.tags.setdefault(name, ModelTag(name))", "def add(self, tag):\n self.tags[tag.name] = tag", "def add_tag(self, obj, tag_name):\r\n tag_names = parse_tag_input(tag_name)\r\n if not len(tag_names):\r\n raise A...
[ "0.61151737", "0.6037251", "0.5971428", "0.5880172", "0.5836316", "0.57400155", "0.56325096", "0.56085664", "0.5600071", "0.5527539", "0.5497695", "0.5423026", "0.5413826", "0.5405627", "0.53955483", "0.53923285", "0.53772324", "0.53741163", "0.537357", "0.53731817", "0.53702...
0.7477503
0
Sample new trust regions.
def sample_v(self): samp_trust_regions = self.trust_regions v = [None] * len(samp_trust_regions) for d in range(len(samp_trust_regions)): if isinstance(samp_trust_regions[d], list): v[d] = np.random.uniform(samp_trust_regions[d][0], samp_trust_regions[d][1]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sample_regions(region_rois, gt_regions, voc_sign):\n # overlaps: (rois x gt_regions)\n overlaps_gt = bbox_overlaps(\n np.ascontiguousarray(region_rois[:, 1:5], dtype=np.float),\n np.ascontiguousarray(gt_regions[:, :4], dtype=np.float))\n # gt_assignment = overlaps_gt.argmax(axis=1)\n ...
[ "0.57850075", "0.557254", "0.55701876", "0.5531986", "0.5462202", "0.538958", "0.5356898", "0.52364945", "0.5210683", "0.5210683", "0.5189559", "0.5188199", "0.5111312", "0.51103514", "0.5105807", "0.5101252", "0.5097297", "0.5079841", "0.50438017", "0.5022857", "0.5016465", ...
0.5867658
0
Obtain all constraints using the list of sufficient statistics and the batch.
def main_constraints(self, batch, l_suff_stats): if self.mode == 'parametric': kl = 'i-projection' else: kl = 'm-projection' policy = self.mc.get('policy', target=False) t_states = torch.Tensor(batch.states) t_policy = self.mc.get('policy', target=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_constraints():\n return list(chain(collect_rows(), collect_columns(), collect_blocks()))", "def constraints_all(u, H, gamma, D, C, tol = 0.05, verbose = 0):\n constraints = [constraint(u, H[i], gamma[i], D[i], C[i], tol, verbose) for i in range(len(H))]\n constraints = pd.DataFrame(constrai...
[ "0.68722254", "0.6746316", "0.65001404", "0.6450816", "0.6216016", "0.6133641", "0.6133641", "0.60693604", "0.60367805", "0.5971558", "0.5968997", "0.5942404", "0.5937965", "0.5927213", "0.5922303", "0.58967656", "0.5874045", "0.5868334", "0.5866954", "0.5862949", "0.58554924...
0.7148417
0
Assert that the two states are equal.
def assert_state(actual: State | None, expected: State | None) -> None: if actual is None or expected is None: assert actual == expected return assert actual.entity_id == expected.entity_id assert actual.state == expected.state assert actual.attributes == expected.attributes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_eq(self):\n st_1 = State(substance=\"water\", T=Q_(400.0, \"K\"), p=Q_(101325.0, \"Pa\"))\n st_2 = State(substance=\"water\", T=Q_(400.0, \"K\"), p=Q_(101325.0, \"Pa\"))\n assert st_1 == st_2", "def test_eq_not_two_states(self):\n assert not State(substance=\"water\") == 3\n ...
[ "0.765772", "0.75668615", "0.7544982", "0.71696746", "0.7099022", "0.70094883", "0.69932425", "0.6974211", "0.6931788", "0.68958557", "0.6889566", "0.6868116", "0.68653053", "0.68567234", "0.68371964", "0.6836369", "0.6779797", "0.67308235", "0.6717804", "0.67175525", "0.6625...
0.7761076
0
Test setup where existing token does not have sufficient scopes.
async def test_existing_token_missing_scope( hass: HomeAssistant, token_scopes: list[str], component_setup: ComponentSetup, config_entry: MockConfigEntry, ) -> None: await component_setup() entries = hass.config_entries.async_entries(DOMAIN) assert len(entries) == 1 assert entries[0].st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_good_with_no_prior_key(self):\n # config seems to be shared across tests, so we have to specifically set\n # it to None.\n config.set(xsrf_token_key=None)\n tool = utils.XsrfTool()\n token = tool.generate_token(12345, 'test_action')\n self.assertTrue(tool.verify_t...
[ "0.66060394", "0.6446283", "0.6427734", "0.6411109", "0.6395821", "0.6386319", "0.6365879", "0.6337021", "0.6335847", "0.63339245", "0.6327335", "0.62977475", "0.6295482", "0.62670904", "0.62594974", "0.6250421", "0.6250282", "0.6245764", "0.62408274", "0.62391514", "0.622701...
0.7784333
0
Test setup where the config entry options requires reauth to match the scope.
async def test_config_entry_scope_reauth( hass: HomeAssistant, token_scopes: list[str], component_setup: ComponentSetup, config_entry: MockConfigEntry, ) -> None: await component_setup() assert config_entry.state is ConfigEntryState.SETUP_ERROR flows = hass.config_entries.flow.async_progre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_auth0_config_anon(anontestapp, registry):\n _test_auth_config(anontestapp, registry)", "async def test_reauth_flow(\n hass: HomeAssistant,\n mock_setup_entry: AsyncMock,\n mock_verisure_config_flow: MagicMock,\n mock_config_entry: MockConfigEntry,\n) -> None:\n mock_config_entry.add_to...
[ "0.63536966", "0.6325146", "0.62727624", "0.6168258", "0.6064623", "0.60573286", "0.60310614", "0.60276365", "0.59530056", "0.59214944", "0.5915192", "0.58961505", "0.5893077", "0.5845422", "0.58321923", "0.5786506", "0.57680845", "0.5762742", "0.5741144", "0.5725173", "0.572...
0.6970076
0
Test service call that adds an event with various time ranges.
async def test_add_event_date_in_x( hass: HomeAssistant, component_setup: ComponentSetup, mock_calendars_list: ApiResult, mock_insert_event: Callable[[..., dict[str, Any]], None], test_api_calendar: dict[str, Any], mock_events_list: ApiResult, date_fields: dict[str, Any], start_timedelta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_add_event_date_time(\n hass: HomeAssistant,\n component_setup: ComponentSetup,\n mock_calendars_list: ApiResult,\n mock_insert_event: Callable[[str, dict[str, Any]], None],\n test_api_calendar: dict[str, Any],\n mock_events_list: ApiResult,\n aioclient_mock: AiohttpClientMocker,...
[ "0.7136187", "0.666334", "0.6390659", "0.6387705", "0.6342569", "0.6323017", "0.6270349", "0.6256989", "0.6241976", "0.6228554", "0.61652535", "0.6161143", "0.6145388", "0.6145039", "0.6136344", "0.6129385", "0.6117005", "0.6108405", "0.6100021", "0.60832196", "0.60830784", ...
0.685161
1
Test service call that adds an event with a date time range.
async def test_add_event_date_time( hass: HomeAssistant, component_setup: ComponentSetup, mock_calendars_list: ApiResult, mock_insert_event: Callable[[str, dict[str, Any]], None], test_api_calendar: dict[str, Any], mock_events_list: ApiResult, aioclient_mock: AiohttpClientMocker, add_eve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_add_event_date_in_x(\n hass: HomeAssistant,\n component_setup: ComponentSetup,\n mock_calendars_list: ApiResult,\n mock_insert_event: Callable[[..., dict[str, Any]], None],\n test_api_calendar: dict[str, Any],\n mock_events_list: ApiResult,\n date_fields: dict[str, Any],\n st...
[ "0.71885216", "0.7053687", "0.67415506", "0.6708787", "0.6521647", "0.65123206", "0.64840037", "0.6397157", "0.63075966", "0.63002455", "0.62883985", "0.6265419", "0.62653506", "0.6260593", "0.6236992", "0.6230316", "0.62144303", "0.61731064", "0.61678535", "0.61510533", "0.6...
0.7210349
0
Test case where reauth is required for token that cannot be refreshed.
async def test_expired_token_requires_reauth( hass: HomeAssistant, component_setup: ComponentSetup, aioclient_mock: AiohttpClientMocker, ) -> None: aioclient_mock.post( "https://oauth2.googleapis.com/token", status=http.HTTPStatus.BAD_REQUEST, ) await component_setup() ent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_refresh_token(self):\n\n content_type = 'application/x-www-form-urlencoded'\n # Generate an auth and a refresh token.\n resp_1 = self.app.post('/v1/openid/token',\n params={\n 'refresh_token': 'invalid_refresh_tok...
[ "0.6976277", "0.6827745", "0.6798438", "0.669153", "0.6671915", "0.66000515", "0.65949583", "0.6585366", "0.6570169", "0.6564486", "0.65555704", "0.6543437", "0.6532987", "0.64937395", "0.64608955", "0.64507073", "0.6448669", "0.6445473", "0.64415866", "0.6359006", "0.6355563...
0.7794217
0
Test updating the yaml file with a new calendar.
async def test_calendar_yaml_update( hass: HomeAssistant, component_setup: ComponentSetup, mock_calendars_yaml: Mock, mock_calendars_list: ApiResult, test_api_calendar: dict[str, Any], mock_events_list: ApiResult, calendars_config: dict[str, Any], expect_write_calls: bool, ) -> None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_calendar_yaml_error(\n hass: HomeAssistant,\n component_setup: ComponentSetup,\n mock_calendars_list: ApiResult,\n test_api_calendar: dict[str, Any],\n mock_events_list: ApiResult,\n) -> None:\n mock_calendars_list({\"items\": [test_api_calendar]})\n mock_events_list({})\n\n ...
[ "0.6777261", "0.66780204", "0.65874475", "0.6569175", "0.65299773", "0.64555514", "0.6421196", "0.64173406", "0.640922", "0.6395701", "0.6294646", "0.6277652", "0.62417525", "0.6222642", "0.62127405", "0.61752164", "0.61325437", "0.6123968", "0.61160105", "0.6113465", "0.6082...
0.7799881
0
Test updating config entry options will trigger a reload.
async def test_update_will_reload( hass: HomeAssistant, component_setup: ComponentSetup, mock_calendars_list: ApiResult, test_api_calendar: dict[str, Any], mock_events_list: ApiResult, config_entry: MockConfigEntry, ) -> None: mock_calendars_list({"items": [test_api_calendar]}) mock_even...
{ "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_edit_configuration(self):\n configuration = copy.deepcopy(...
[ "0.7071387", "0.6939815", "0.6914877", "0.6914877", "0.6914877", "0.66837025", "0.6661579", "0.6619994", "0.6582278", "0.6553534", "0.6544683", "0.65072876", "0.650643", "0.64675474", "0.6390268", "0.6361998", "0.6310013", "0.6288794", "0.6234391", "0.6190131", "0.61858517", ...
0.6947725
1
This function should be used for getting statistics on fastq files. The results are returned as a report type object.
def run_app_fastq_ea_utils_stats(self, ctx, input_params): # ctx is the context object # return variables are: report #BEGIN run_app_fastq_ea_utils_stats print (input_params) token = ctx['token'] wsClient = workspaceService(self.workspaceURL, token=token) headers...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MainStats(path, filetype, NrExp, col, start, stop):\n# path= path.split('/') # here is better to google and see what is going on. Or experiment alone\n# path= \"/\".join(path[:-1]) \n dato=ExtractData_raw_files(path, filetype)\n dBase=dato.createDictBase()\n stats = Stats(dBase, NrExp, col, ...
[ "0.59068304", "0.5783996", "0.5749884", "0.5708528", "0.56867737", "0.5631786", "0.5610607", "0.55995595", "0.5591347", "0.55847937", "0.55189806", "0.55075693", "0.5504182", "0.54946774", "0.5467445", "0.54512376", "0.5420627", "0.5414194", "0.54000074", "0.5399801", "0.5387...
0.5869081
1
Generates a new case Dictionary object
def genCase(self, CID, client, rat): ret = { CID: { 'client': client, 'rat': rat, } } return (ret)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def navigate_case_dictionary(case_list_for_run, num_cases):", "def to_dict(self):\n\n case_dict = dict()\n for case, data in self._case_data.items():\n case_dict[case] = dict(longname=data.longname, vals=data.vals)\n\n return dict(\n name=self.name, cases=case_dict, tim...
[ "0.6294336", "0.61372876", "0.5951377", "0.59463495", "0.5836048", "0.582997", "0.5741833", "0.5672863", "0.5635418", "0.5570384", "0.5557052", "0.5552489", "0.55312496", "0.5506557", "0.5491031", "0.5483038", "0.54823494", "0.54773057", "0.5470926", "0.5469403", "0.54601926"...
0.62938017
1
manually purges a case via CID
def purge(self, x, y, z): CID = int(x[1]) log("purge", "attempting puge of CID [{}] from db...".format(CID), 17) if self.db.remove(CID): log("purge", "Purge sucessful", 17) else: log("purge", "purge failed - no such CID [{}]".format(CID), 20)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill_candidate(self, confid):\n for dct in self.c.select(gaid=confid):\n self.c.update(dct.id, extinct=1)", "def delete_case_cascaded(sender, instance, **kwargs):\n if sender == Case:\n SmallVariant.objects.filter(case_id=instance.id).delete()\n for plugin in BackgroundJobs...
[ "0.58115596", "0.56446564", "0.54110163", "0.5359899", "0.5309047", "0.5309047", "0.5280437", "0.5228242", "0.52242506", "0.51767915", "0.51700497", "0.516294", "0.5143805", "0.5141319", "0.5137646", "0.51225", "0.5114552", "0.51141214", "0.5088487", "0.5087672", "0.5057581",...
0.68164116
0
Parse a json string into ProjectSettings. Return None if the string is invalid.
def from_json(json_str: str) -> Optional[ProjectSettings]: try: obj = json.loads(json_str) try: due_date = date_helper.date_from_str(obj['due_date']) except KeyError: due_date = None try: open_method = obj['open_me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_config_string(self, json_string=\"\"):\n\t\tself.project_tags = json.loads(json_string)\n\t\treturn True", "def parse_json_settings(file: str):\n with open(file) as f:\n return json.load(f)", "def load_JSON_settings(settings_name):\n with open(settings_name, 'r') as fp:\n s...
[ "0.652395", "0.6343593", "0.624324", "0.6064568", "0.59724253", "0.5946418", "0.58026826", "0.57741064", "0.5773538", "0.5733681", "0.56995463", "0.56995463", "0.56995463", "0.569504", "0.5689777", "0.5687134", "0.5679477", "0.5673233", "0.56612617", "0.5647138", "0.5638271",...
0.79422677
0
View details about a flow run.
async def inspect(id: UUID): async with get_client() as client: try: flow_run = await client.read_flow_run(id) except httpx.HTTPStatusError as exc: if exc.response.status_code == status.HTTP_404_NOT_FOUND: exit_with_error(f"Flow run {id!r} not found!") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def inspect(id: UUID):\n async with get_client() as client:\n try:\n flow_run = await client.read_flow_run(id)\n except httpx.HTTPStatusError as exc:\n if exc.response.status_code == fastapi.status.HTTP_404_NOT_FOUND:\n exit_with_error(f\"Flow run {id!r} ...
[ "0.72246647", "0.69468206", "0.6423817", "0.631174", "0.6294037", "0.5980551", "0.5947605", "0.5945805", "0.59018576", "0.5892309", "0.5853867", "0.58477026", "0.57766086", "0.5776393", "0.57153887", "0.56804025", "0.56660235", "0.56608045", "0.5618656", "0.55753106", "0.5557...
0.711418
1
View recent flow runs or flow runs for specific flows
async def ls( flow_name: List[str] = typer.Option(None, help="Name of the flow"), limit: int = typer.Option(15, help="Maximum number of flow runs to list"), state: List[str] = typer.Option(None, help="Name of the flow run's state"), state_type: List[StateType] = typer.Option( None, help="Type of...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def ls(\n flow_name: List[str] = None,\n limit: int = 15,\n state_type: List[StateType] = None,\n):\n async with get_client() as client:\n flow_runs = await client.read_flow_runs(\n flow_filter=FlowFilter(name={\"any_\": flow_name}) if flow_name else None,\n flow_run_...
[ "0.6522288", "0.5756976", "0.56147736", "0.55840653", "0.5578543", "0.54874504", "0.5450466", "0.5408531", "0.5407379", "0.5384264", "0.53760093", "0.53448355", "0.5290793", "0.5263188", "0.52597415", "0.5243341", "0.5226486", "0.52094555", "0.5202545", "0.52017087", "0.51968...
0.6663428
0
Delete a flow run by ID.
async def delete(id: UUID): async with get_client() as client: try: await client.delete_flow_run(id) except ObjectNotFound as exc: exit_with_error(f"Flow run '{id}' not found!") exit_with_success(f"Successfully deleted flow run '{id}'.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def delete_flow_run(\n self,\n flow_run_id: UUID,\n ) -> None:\n try:\n await self._client.delete(f\"/flow_runs/{flow_run_id}\"),\n except httpx.HTTPStatusError as e:\n if e.response.status_code == status.HTTP_404_NOT_FOUND:\n raise prefect....
[ "0.830749", "0.7133216", "0.7119943", "0.677153", "0.6761292", "0.65617865", "0.647617", "0.647558", "0.647558", "0.645698", "0.6414809", "0.64058846", "0.6397334", "0.6303853", "0.62992346", "0.6277049", "0.6263307", "0.62089014", "0.618968", "0.61813855", "0.6164215", "0....
0.8356969
0
Cancel a flow fun by ID.
async def cancel(id: UUID): async with get_client() as client: cancelling_state = State(type=StateType.CANCELLED, name="Cancelling") try: result = await client.set_flow_run_state( flow_run_id=id, state=cancelling_state ) except ObjectNotFound as exc: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel_run(self, run_id):\n raise NotImplementedError()", "def cancel(self, id):\n def _cancel(pipe):\n if self.redis.zrank(self.feed_claimed, id) is None:\n return # raise exception?\n pipe.multi()\n pipe.hincrby(self.feed_cancelled, id, 1)\n ...
[ "0.6757145", "0.6619877", "0.6422101", "0.631366", "0.614409", "0.614409", "0.614409", "0.61353314", "0.61088586", "0.5991783", "0.5989739", "0.5980397", "0.5952417", "0.59447193", "0.5940001", "0.590856", "0.58909357", "0.5865082", "0.58394974", "0.58277136", "0.5773372", ...
0.70730513
0
View logs for a flow run.
async def logs(id: UUID): page_size = 200 offset = 0 more_logs = True log_filter = LogFilter(flow_run_id={"any_": [id]}) async with get_client() as client: # Get the flow run try: flow_run = await client.read_flow_run(id) except ObjectNotFound as exc: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_run_logs(id_, **kwargs):\n run = get_run_object(id_)\n check_run_permission(run, kwargs[\"token_info\"])\n query = \"ilyde-run-{}\".format(run.id)\n return query_elasticsearch(query)", "def get_run_log(self, run_id):\n postresult = requests.get(\n f\"{self.proto}://{self.h...
[ "0.66671044", "0.64290035", "0.63139445", "0.6228037", "0.6184796", "0.6184796", "0.6112892", "0.6052989", "0.59571064", "0.59108114", "0.58995515", "0.58742326", "0.5859901", "0.5811451", "0.57748145", "0.575747", "0.5729072", "0.57002956", "0.5698595", "0.5687374", "0.56764...
0.6776977
0
Internal fn mapped over all images. Sets last image of each mimetype in out hash.
def proc_fid(out, fid): img = imageHash.get(fid, []) if len(img) == 2: out[img["mime"]] = (img["img"], fid) return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def images_mapped(self):\n try:\n return dict([x for x in enumerate(self.images())])\n except:\n return None", "def _iter_images(self):\n raise NotImplementedError", "def _iter_images(self):\n for image in self._images:\n yield image", "def getimgs...
[ "0.63978136", "0.60659355", "0.5960727", "0.59060544", "0.5792186", "0.5779685", "0.577615", "0.5745593", "0.57202584", "0.57027423", "0.5673841", "0.56723267", "0.5627154", "0.56172514", "0.5582821", "0.55722284", "0.5556", "0.5549074", "0.5541311", "0.55299467", "0.5512783"...
0.6303201
1
Processes intermediate divs in the structMap.
def process_intermediate(div, new_ranges=None): new_ranges = new_ranges or [] for sd in div: # leaf node, get canvas info if is_page(sd): my_range = process_page(sd) else: my_range = process_intermediate(sd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_struct_divs(div, ranges):\n\trangeKey = get_rangeKey(div)\n\n\t# when the top level div is a PAGE\n\tif is_page(div):\n\t\tp_range = process_page(div)\n if p_range:\n ranges.append(p_range)\n else:\n subdivs = div.xpath('./mets:div', namespace...
[ "0.6495034", "0.5467104", "0.51635855", "0.50800556", "0.50659806", "0.50587827", "0.4989944", "0.49201077", "0.48998722", "0.48709348", "0.48658156", "0.48486286", "0.48414052", "0.48127645", "0.4742323", "0.470842", "0.4703197", "0.4687566", "0.46849164", "0.4675139", "0.46...
0.6052635
1
Trim the s3 bucket name and only return relative path
def trim_s3_bucket_from_path(self, fullpath): return fullpath.replace(self.bucket_base, '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url(cls, bucket, path):\n if path.startswith('/'):\n path = path[1:]\n if bucket.startswith('http://') or bucket.startswith('https://'):\n url = bucket\n else:\n url = cls.S3_BASE + bucket\n if not url.endswith('/'):\n url += '/'\n ...
[ "0.73336446", "0.7295355", "0.7216898", "0.7216898", "0.7194941", "0.69576335", "0.6896974", "0.67195576", "0.67082715", "0.66437954", "0.65441966", "0.6542863", "0.65393937", "0.6514954", "0.64863515", "0.64204514", "0.6392971", "0.63689435", "0.6339648", "0.63037205", "0.63...
0.8421893
0
Return evaluation of op(first, second)
def evaluate_op(op, first, second): if op in ops_prec.keys(): if op == '+': output = first + second elif op == '-': output = first - second elif op == '*': output = first * second elif op == '/' and second != 0: output = first / second...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc(operand_1, operand_2):\n return operand_1 + operand_2", "def calc(operand_1, operand_2):\n return operand_1 + operand_2", "def fun(op, v1, v2):\n if op == '+':\n return v1+v2\n elif op == '-':\n return v1-v2\n elif op == '*':\n return v1*v2\n elif op == '...
[ "0.6937654", "0.6937654", "0.684084", "0.6815212", "0.67404455", "0.6653598", "0.66001284", "0.65789473", "0.65586424", "0.65586424", "0.6420415", "0.64193857", "0.63866496", "0.63808733", "0.6342855", "0.6318334", "0.6314743", "0.62981844", "0.61924857", "0.6191659", "0.6170...
0.73230225
0
Create and return a new vector by rotating this vector by angle_radians radians.
def rotated(self, angle_radians): cos = math.cos(angle_radians) sin = math.sin(angle_radians) x = self.x*cos - self.y*sin y = self.x*sin + self.y*cos return Vec2d(x, y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate(self, angle):\r\n radians = angle*pi/180\r\n return Vector(self.x*cos(radians) - self.y*sin(radians),\r\n self.x*sin(radians) + self.y*cos(radians))", "def rotatedBy(self, angle):\n\t\tx, y = self.x, self.y\n\t\tc, s = cos(angle), sin(angle)\n\t\treturn Vector((c * x...
[ "0.75861394", "0.7204621", "0.7192354", "0.7153503", "0.71468675", "0.70803744", "0.7019237", "0.69536906", "0.69425535", "0.6921448", "0.6911125", "0.6868035", "0.68463176", "0.68337744", "0.68185484", "0.67892724", "0.6685926", "0.6674861", "0.66311365", "0.65861464", "0.64...
0.78401434
0
A unit vector pointing up
def unit(): return Vec2d(0, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit(self):\r\n return Vector(self.x/self.length(), self.y/self.length())", "def getUnitVector(self):\n return Vector.createFromPolar(1, self.angle)", "def unit(direction):\r\n return Vector(0, -1).rotate(direction)", "def unit_vector(self,vector):\n return vector / np.linalg.norm...
[ "0.7451307", "0.7118181", "0.70831156", "0.6992387", "0.6897176", "0.6890229", "0.6890229", "0.6890229", "0.6878542", "0.68711114", "0.6854694", "0.68440104", "0.68313295", "0.6804538", "0.6782493", "0.6782493", "0.6782493", "0.6782493", "0.6782493", "0.6782493", "0.6782493",...
0.7370234
1
A vector where both x and y is 1
def ones(): return Vec2d(1, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testOnes(self):\n v1 = Vector.ones(8)\n assert v1 == [1, 1, 1, 1, 1, 1, 1, 1, ]\n assert v1.norm() == math.sqrt(8)", "def make_binary(y, positive):\n pos = np.in1d(y, positive).reshape(y.shape)\n new_y = np.zeros(y.shape, dtype=np.int)\n new_y[pos] = 1\n retur...
[ "0.6837237", "0.6624419", "0.6610563", "0.6588469", "0.6476871", "0.64379853", "0.6316194", "0.63048846", "0.62783253", "0.62322915", "0.61866784", "0.61840606", "0.6140005", "0.61368126", "0.61276394", "0.6084759", "0.6055273", "0.60285366", "0.6014829", "0.5969256", "0.5937...
0.80285114
0
The inverse of cpvrotate
def cpvunrotate(self, other): return Vec2d(self.x*other.x + self.y*other.y, self.y*other.x - self.x*other.y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cpvrotate(self, other):\n return Vec2d(self.x*other.x - self.y*other.y, self.x*other.y + self.y*other.x)", "def rotation(self):\n\t\treturn self.piv.a.rotate.v", "def rotate90(self):", "def rotate(q, v):\n if v.ndim == 1:\n qv = np.append(v,0)\n else:\n qv = np.hstack([v,np.zer...
[ "0.67939645", "0.6476489", "0.6346613", "0.6209692", "0.6133544", "0.6102341", "0.60707045", "0.6060311", "0.60145193", "0.5921906", "0.5916746", "0.58852106", "0.58700246", "0.5814341", "0.5810796", "0.57921314", "0.5778874", "0.57585424", "0.5688931", "0.56787646", "0.56752...
0.6514002
1
Racetrack filter for accelerated fatigue testing. The racetrack amplitude filter removes low amplitude cycles from the reversals without altering the sequence of the remaining cycles. The racetrack filter therefore allows to accelerate variable amplitude fatigue testing by removing low amplitude cycles which does not s...
def racetrack_filter(reversals, h): y = reversals yprev = None ix = [] for n, yn in enumerate(y): if (n == 0) or (n == y.size-1): yprev = yn ix.append(n) continue dy = yn - yprev if fabs(dy) > h / 2.: yprev = yn - dy/fabs(dy) * h/2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_transition_spectrum_fluor(self,tr):\n \n\n ta = tr[\"ta\"] # TimeAxis\n dd = tr[\"dd\"] # transition dipole strength\n om = tr[\"om\"] # frequency - rwa\n gg = tr[\"gg\"] # natural broadening (constant or time dependent)\n fwhm = tr[\"fwhm\"] # Additional gaussian ...
[ "0.5530088", "0.5525722", "0.54898864", "0.54299957", "0.529618", "0.5213222", "0.5186702", "0.51707417", "0.51678175", "0.5154203", "0.5122184", "0.50967175", "0.50935155", "0.50804454", "0.50766295", "0.50646424", "0.5064125", "0.5063108", "0.5060969", "0.5055473", "0.50490...
0.55650514
0
Return racetrack filtered reversals and indices in `y`. The data points in the dataseries `y` are classified into `k` constant sized intervals and then peakvalley filtered to yield the successive extremas of the dataseries `y`. The reversals are then filtered with the racetrack amplitude filter and then peakvalley filt...
def find_reversals_racetrack_filtered(y, h, k=64): _, ix = find_reversals(y, k=k) z, ixz = racetrack_filter(y[ix], h) ix = ix[ixz] rev, ixr = find_reversals(z, k=k) return y[ix[ixr]], ix[ixr]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def racetrack_filter(reversals, h):\n\n y = reversals\n yprev = None\n ix = []\n for n, yn in enumerate(y):\n if (n == 0) or (n == y.size-1):\n yprev = yn\n ix.append(n)\n continue\n dy = yn - yprev\n if fabs(dy) > h / 2.:\n yprev = yn - ...
[ "0.6172422", "0.5120299", "0.5107523", "0.50750124", "0.5058833", "0.50034505", "0.48254004", "0.47696286", "0.47526288", "0.47043502", "0.46886638", "0.46651587", "0.4658787", "0.46556625", "0.4653265", "0.46075886", "0.46051684", "0.45850822", "0.45697755", "0.45637277", "0...
0.7087292
0
Returns a list containing the Fibonacci series up to n (default 100).
def fibonacci(n=100): result = [] # list a, b = 0, 1 while a < n: result.append(a) a, b = b, a + b return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fib(n):\r\n to_return = []\r\n for i in range(0, n):\r\n to_return.append(FibSeq.fib_r(i))\r\n\r\n return to_return", "def fibonacci(n):\n fibs = [0] * n\n fibs[1] = 1\n for i in range(2, n):\n fibs[i] = fibs[i-1] + fibs[i-2]\n return fibs", "def fibonacci...
[ "0.8387381", "0.8314457", "0.8284237", "0.81879747", "0.81779563", "0.81595564", "0.8140572", "0.8057815", "0.8018652", "0.8010789", "0.80088073", "0.7960859", "0.7951698", "0.7919604", "0.79038876", "0.78657526", "0.78639764", "0.78565395", "0.78502923", "0.78502923", "0.784...
0.8528098
0
Attempt to parse a string containing a moneyline. If the string cannot be interpreted, return None.
def parse_moneyline(string): if string.lower() in ["ev", "even", "100", "+100"]: return 1.0 elif re.match("[+-][0-9]+?", string): line = float(string[1:]) if string[0] == '+': return line/100.0 else: return 100.0/line elif re.match("[0-9]+?", string): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_line(line: str) -> str:\n return line", "def parse_line(line: str) -> str:\n return line", "def parse_line(line: str) -> str:\n return line", "def parse_line(line: str) -> str:\n return line", "def parse_or_reject_line(line):\n try:\n return convert_to_parkme_format(line)\n excep...
[ "0.6066493", "0.6066493", "0.6066493", "0.6066493", "0.60108775", "0.5790907", "0.57896024", "0.5783624", "0.5757135", "0.56411123", "0.5559326", "0.55494714", "0.55239415", "0.55221343", "0.54764634", "0.5405302", "0.53714937", "0.5315158", "0.5313925", "0.531198", "0.529881...
0.7246834
0
Called first to rewrite a JSONAPI request.
def rewrite_request(self, request): if not self.should_rewrite(request): return request body = request.get('body', None) if body is not None: body = json.loads(body) self.rewrite_body(body) request['body'] = body
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_from_rest_data(self) -> None:", "def opt_engine_rest_api():\n request_json = request.get_json()\n return process_request(request_json)", "def __update_request(self, request_dict, namespace, apikey):\n request_dict['namespace'] = namespace if namespace else self.namespace\n reque...
[ "0.6003671", "0.59897494", "0.59430915", "0.57611895", "0.57548296", "0.57496166", "0.5723294", "0.56857574", "0.56811357", "0.56486696", "0.5618279", "0.5585331", "0.55551547", "0.553689", "0.5534487", "0.54991174", "0.54796416", "0.5474721", "0.5461787", "0.5449491", "0.541...
0.70500153
0
fuction find the albums by the specific user
def get_albums(username): cur = mysql.connection.cursor() cur.execute("SELECT * FROM album WHERE username = '{0}'".format(username)) return cur.fetchall()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_albums():\n return query_multiple(request.args, album_search, \\\n album_filter, Album, albums_schema)", "def search_for_album(album_name):\n\n print(f'Searching for album: {album_name}')\n\n search_result = spotifyObject.search(q=f'\"{album_name}\"', limit=20, type='album')\n\n ...
[ "0.6953249", "0.6903466", "0.6739908", "0.6713428", "0.6615677", "0.6496691", "0.64462966", "0.64320195", "0.6426906", "0.6384075", "0.6330058", "0.62992376", "0.62987506", "0.62832665", "0.6244915", "0.61971134", "0.61836463", "0.6182213", "0.6136979", "0.6099048", "0.608416...
0.75439364
0
Build the company kinds (ltd, corp., s/a etc) regex and the list of their values for extraction Company kinds can often occur with variable characters inbetween, such as [' ', '.', '.', '/'], so this is built into the regex. Also, since these acronyms might occur elsewhere in the string by coincidence, we force company...
def build_company_kind_pats(company_kinds_map: Dict[str, str], short_company_kind_start: bool): spacing_pat = r"[ \.,\/\\]?" company_kinds = sorted(company_kinds_map.keys(), key=len, reverse=True) patterns, replacements = [], [] for company_kind in company_kinds: is_short = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_company_kind(self, raw_names: pd.Series) -> pd.Series:\n\n kind = pd.Series(np.nan, index=raw_names.index)\n kind[self.is_email_mask(raw_names)] = 'email'\n kind[self.is_website_mask(raw_names)] = 'website'\n\n # Clean names up to company kinds. This increases the chance of ...
[ "0.6284233", "0.62379915", "0.60107523", "0.59582007", "0.58524525", "0.58423334", "0.5587887", "0.5351156", "0.5263403", "0.51411235", "0.5120985", "0.49753103", "0.49746895", "0.49620345", "0.49343765", "0.49134964", "0.48761424", "0.4858296", "0.4811409", "0.47904345", "0....
0.6417804
0
Extract the company kinds from `self.COMPANY_KINDS_MAP` into their own column.
def extract_company_kind(self, raw_names: pd.Series) -> pd.Series: kind = pd.Series(np.nan, index=raw_names.index) kind[self.is_email_mask(raw_names)] = 'email' kind[self.is_website_mask(raw_names)] = 'website' # Clean names up to company kinds. This increases the chance of matching an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_company_kind_pats(company_kinds_map: Dict[str, str], short_company_kind_start: bool):\n spacing_pat = r\"[ \\.,\\/\\\\]?\"\n company_kinds = sorted(company_kinds_map.keys(), key=len, reverse=True)\n patterns, replacements = [], []\n\n for company_kind in company_kinds:\n ...
[ "0.5608804", "0.51699716", "0.51433", "0.511698", "0.47336614", "0.4659679", "0.4637385", "0.46364528", "0.46087486", "0.4586718", "0.45591187", "0.45118663", "0.44828856", "0.44678736", "0.44648474", "0.44558316", "0.44544086", "0.44492656", "0.441688", "0.44146273", "0.4410...
0.59396833
0
Extract the company uids matching `self.extract_uid_pat` into their own column.
def extract_uid(self, raw_names: pd.Series) -> pd.Series: name_patterns = (patterns for kind, patterns in self.abolish_patterns.items() if kind != 'uid') cleaned_names = self._clean_name(raw_names, chain(*name_patterns)) return cleaned_names.str.extract(self.extract_uid_pat, expand=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_company(row):\n global unknown_company_count_global\n associated_company = []\n\n # Identify the target company using known patterns in the tweet text.\n tweet = row['text_derived'].lower()\n author = row['user_screen_name'].lower()\n for company_pattern in PTN_companies:\n if ...
[ "0.54834795", "0.5477508", "0.5406373", "0.50166327", "0.4832243", "0.47998986", "0.47831786", "0.4651213", "0.46463442", "0.46406296", "0.4630403", "0.46233618", "0.46153215", "0.45944312", "0.45875332", "0.45853752", "0.45391092", "0.45289016", "0.4524619", "0.45049787", "0...
0.58374155
0
Wraps around setJobParameter of state update client
def __setJobParam( self, name, value ): if not self.jobID: return S_ERROR( 'JobID not defined' ) self.log.verbose( 'setJobParameter(%s, %s, %s)' % ( self.jobID, name, value ) ) return RPCClient( 'WorkloadManagement/JobStateUpdate', timeout = 120 ).setJobParameter( int( self.jobID ), str( name ), str(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_job_state(self, job):", "def modify_job(self, job, parameter):\n job.set_encut(parameter[0])\n job.set_kpoints(parameter[1])\n return job", "def update(self, job_name, param_name, value, description=None):\n if job_name in self._jobs:\n getattr(self._jobs[job_n...
[ "0.6833531", "0.65922815", "0.62260073", "0.61187375", "0.60990846", "0.5972672", "0.59210455", "0.5899428", "0.5899428", "0.5899428", "0.5899428", "0.5884561", "0.5813575", "0.58097994", "0.5768316", "0.57636386", "0.57345355", "0.5727094", "0.56686336", "0.5653183", "0.5649...
0.82593566
0
creating the tokens list
def build_tokens(self): self.advance() while self.__token != "": self.__tokens.append(self.token_type()) self.advance()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokens():\n pass", "def __create_list(self, tokens : List[Union[str,int]]) -> List[List[Union[str,int]]]:\n if tokens:\n return [self.__add_instruction(cp(tokens[:1+syntaxParametersDict.get(tokens[0])]))] + self.__create_list(cp(tokens[1+syntaxParametersDict.get(tokens[0]):]))\n r...
[ "0.75507045", "0.73815393", "0.7340161", "0.6890527", "0.685617", "0.68503374", "0.68324804", "0.68296474", "0.66490906", "0.6637407", "0.6630783", "0.6574473", "0.6514024", "0.6496726", "0.6486389", "0.64783233", "0.6452465", "0.6426687", "0.6420167", "0.637822", "0.63627315...
0.75680673
0
Righthand side function, f(t,y), for the Dahlquist IVP
def f(t,y): return (lam*y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ret_f(t,y):\n\n f = np.zeros(3)\n f[0] = 77.27*(y(1) - y(0)*y(1)+ y(0)-8.375e-6*y(0)*y(0))\n f[1] = (1.0/77.27)*(-y(1)-y(0)*y(1)+y(2))\n f[2] = 0.161*(y(0)-y(2))\n\n return f", "def fdq2(f, x, h=1e-5):\n return (-3*f(x) + 4*f(x+h) - f(x+2*h))/(2*h)\n raise NotImplementedError(\"Problem 2...
[ "0.69918156", "0.67442256", "0.67246836", "0.6603709", "0.6590321", "0.6433287", "0.64289606", "0.6390395", "0.63551927", "0.63487315", "0.6348303", "0.6347704", "0.63267815", "0.63180244", "0.6314089", "0.6199225", "0.6172904", "0.60991484", "0.60973847", "0.609486", "0.6089...
0.6844053
1
Test the tag string representation
def test_tag_str(self): tag = models.Tag.objects.create( user=sample_user(), name='Docker' ) self.assertEqual(str(tag), tag.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tag_str(self):\n tag = models.Tag.objects.create(\n user=sample_user(),\n name='Internal'\n )\n\n self.assertEqual(str(tag), tag.name)", "def test_tag_str(self):\n tag = models.Tag.objects.create(\n user=sample_user(),\n name='Vegan...
[ "0.7169322", "0.6938016", "0.6938016", "0.69214636", "0.692024", "0.68987286", "0.68849856", "0.68607813", "0.66859275", "0.6493124", "0.6378444", "0.6312169", "0.63072884", "0.6214954", "0.61638004", "0.6154574", "0.6083939", "0.6064174", "0.6059077", "0.59844977", "0.594746...
0.70695263
1
Testa a reperesentacao da string de montagem
def test_montagem_str(self): montagem = models.Montagem.objects.create( user=sample_user(), titulo='Desenvolvendo uma solucao com Docker', tempo_execucao=5, preco=5.00 ) self.assertEqual(str(montagem), montagem.titulo)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_string():", "def test_str(self, r, rep):\n assert str(r) == rep", "def test_get_result_string_1(self):\n attr_list = [\"type\", \"phage_id\", \"eval_mode\"]\n string = import_genome.get_result_string(self.tkt, attr_list)\n exp = \"type: replace, phage_id: Trixie, eval_mode:...
[ "0.7018505", "0.6447906", "0.613356", "0.61034465", "0.6094777", "0.6088724", "0.6051407", "0.6032233", "0.6016387", "0.60151625", "0.6015092", "0.5993868", "0.59296596", "0.59091103", "0.58491033", "0.5844211", "0.58230877", "0.5801284", "0.575063", "0.5735467", "0.5734799",...
0.6686813
1
Compute case B recombination rate coefficient for H This is what we use in AthenaTIGRESS (fit to Ferland)
def get_rec_rate_H_caseB(T): Tinv = 1.0/T bb = 315614.0*Tinv cc = 115188.0*Tinv dd = 1.0 + np.power(cc, 0.407) return 2.753e-14*np.power(bb, 1.5)*np.power(dd, -2.242)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rec_rate_H_caseB_Dr11(T):\n T4 = T*1e-4\n return 2.54e-13*T4**(-0.8163 - 0.0208*np.log(T4))", "def alpha_B_HII(temperature):\n # HII recombination rate\n # input : T in K\n # output : HII recombination rate (in cm3 / s)\n l = 315614./temperature\n a = 2.753e-14 * l**1.5 / (1...
[ "0.6419693", "0.63521016", "0.6305081", "0.61786574", "0.6131481", "0.60687125", "0.60208255", "0.60160524", "0.5985892", "0.5860865", "0.5776246", "0.577273", "0.57655877", "0.5759185", "0.57219684", "0.57088226", "0.570869", "0.56462514", "0.5636552", "0.5632006", "0.556662...
0.7156105
0
Generate primes up to N
def gen_primes(N): primes = set() for n in range(2, N): if all(n % p > 0 for p in primes): primes.add(n) yield n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_primes():\n\n n = 1\n while True:\n while not isPrime(n):\n n += 1\n\n yield n\n n += 1", "def primes(n):\n sieve = [True]*n\n for p in range(2, n):\n if sieve[p]:\n yield p\n for i in range(p*p, n, p):\n sieve[i] = F...
[ "0.81729954", "0.78177893", "0.7789462", "0.7778804", "0.7733157", "0.7720552", "0.76989216", "0.7661029", "0.7561679", "0.75602835", "0.75321436", "0.7531842", "0.7508048", "0.7486564", "0.74682903", "0.7464435", "0.74508405", "0.74491936", "0.74491936", "0.7375513", "0.7370...
0.8190111
0
Checks whether its right to send reminder. First users local time is retrived from user's timezone
def right_time(user): timezone = user.timezone start_time = float(user.night_start.replace(':', '.')) end_time = float(user.night_end.replace(':', '.')) #Get user's timezon's local time local_time = utils.local_from_timezone(timezone) return not (local_time >= start_time or local_time < end_tim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_guest_timezone(self):\n self.check_guest_timezone()", "def test_guest_timezone(self):\n self.check_guest_timezone()", "def test_guest_timezone(self):\n self.check_guest_timezone()", "def test_guest_timezone(self):\n self.check_guest_timezone()", "def test_guest_timezone...
[ "0.60362005", "0.60362005", "0.60362005", "0.60362005", "0.60362005", "0.60362005", "0.60362005", "0.60362005", "0.60362005", "0.60362005", "0.60362005", "0.60362005", "0.60362005", "0.60362005", "0.60362005", "0.60362005", "0.5977217", "0.5918671", "0.5907384", "0.58711076", ...
0.6597944
0
Create the session directory of this session. The directory is `/root_dir/month/time/session_id`.
def _make_session_dir(self, root_dir): now = datetime.datetime.now() session_dir = os.path.join(root_dir, *[ '{}_{}'.format(*map(str, (now.year, now.month))), str(now.day), '{}_{}_{}_{}'.format(*map(str, (now.hour, now.minute, now.second, self.session_id))) ])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_session_dir(self):\n\n fnd = os.path.join(self.config.capture_dir, self.timestamp.date_string(), self.timestamp.time_string())\n if not os.path.isdir(fnd):\n os.makedirs(fnd)\n\n return fnd", "def _create_session_data(self, abs_path, sess_root):\n sess_path = os.pa...
[ "0.72528374", "0.69515073", "0.68711746", "0.6754665", "0.6628056", "0.6614891", "0.65434974", "0.6453034", "0.64006126", "0.6399137", "0.6333838", "0.63071936", "0.6303696", "0.63018036", "0.62859833", "0.62768", "0.62756675", "0.6244827", "0.62336516", "0.6174249", "0.61708...
0.87452704
0
Save the image to the session directory, then load it to memory as a numpy array.
def register_image_file(self, image): save_path = os.path.join(self.session_dir, 'image.jpg') image.save(save_path) self.image = np.array(Image.open(save_path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_mem_load(self):\n if len(self.get_data_shape())==4 and self._img:\n data = np.zeros(self.get_data_shape())\n self._data = np.rot90(data)\n self._loaded_time_list = [0]\n self._data[..., 0] = np.rot90(self._img.dataobj[..., 0])\n else:\n ...
[ "0.6653567", "0.629725", "0.62756205", "0.6212242", "0.6209386", "0.6202015", "0.6201412", "0.615231", "0.615231", "0.59568936", "0.59094125", "0.5856062", "0.57779574", "0.57742226", "0.57672656", "0.57433885", "0.56831753", "0.5666048", "0.5619988", "0.55960214", "0.5585631...
0.65878177
1
Save the peripheral json to the session directory, then load it to memory as a json object.
def register_peripheral_file(self, peripheral): save_path = os.path.join(self.session_dir, 'peripheral.json') peripheral.save(save_path) with open(save_path) as in_file: self.peripheral = json.loads(in_file.read())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session_dump(self) -> json:\n resp = self.__get_updates()\n try:\n if not os.path.exists(self.dirDownloads):\n os.mkdir(self.dirDownloads)\n local_path = os.path.join(self.dirDownloads, 'session_dump.json')\n\n with open(local_path, 'w+', encoding='...
[ "0.6714122", "0.6425025", "0.6158821", "0.6126959", "0.6111895", "0.6111895", "0.6111895", "0.6111446", "0.610963", "0.60989773", "0.6097421", "0.60670775", "0.5984623", "0.5967466", "0.5928697", "0.59286666", "0.5919195", "0.590851", "0.58997715", "0.5884482", "0.58507997", ...
0.73410493
0
Store the recognition result for the session, which is represented as a json string.
def save_recognition_file(self, recognition_json): save_path = os.path.join(self.session_dir, '{}.{}'.format('recognition', 'json')) with open(save_path, 'w') as out_file: out_file.write(recognition_json)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_result(result: dict, filepath: str):\n\n raise NotImplementedError", "def save_results(self, instagram_results):", "def on_trial_result(self, trial_id: str, result: Dict):\r\n pass", "def storeResult(request, run_uuid):\n if request.method == 'POST':\n trialresult = TrialRes...
[ "0.6184141", "0.58768874", "0.58028704", "0.56466", "0.5646266", "0.564621", "0.5631478", "0.5627005", "0.5625674", "0.55871737", "0.5572897", "0.55409014", "0.55409014", "0.5537074", "0.5535738", "0.5533504", "0.5532316", "0.5520645", "0.55075556", "0.55037326", "0.54943943"...
0.62400305
0
Save a file to record the collection label, which includes the name and weight of the food. This method is only used for collection sessions.
def register_collection_label(self, name, weight): save_path = os.path.join(self.session_dir, 'collection_label.txt') with open(save_path, 'w') as in_file: in_file.write('{}: {}\n{}: {}\n'.format('name', name, 'weight', weight))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, filename):\n pass", "def save(self, fname):\n pass", "def store(self, filename):", "def save_to_disk(self, file_name = \"vehicle_classifier.pkl\"):\n self.classifier.save_to_disk(file_name)", "def save_file(self):\n f = open(self._file_name, \"w\")\n try:\n...
[ "0.62453806", "0.62185884", "0.61631477", "0.6146024", "0.6072307", "0.59955835", "0.5945804", "0.5941978", "0.5938002", "0.5889384", "0.58586884", "0.584255", "0.5837969", "0.58378416", "0.5836154", "0.58153975", "0.58050466", "0.58019537", "0.5798622", "0.57720894", "0.5771...
0.7043883
0
Calculates the cost of the direct path (which is assume to exist) between specified start and end nodes based on the distance between them.
def get_dist_cost(data, start_node_id, end_node_id): p1 = get_coords(data, start_node_id) p2 = get_coords(data, end_node_id) return great_circle_distance(p1, p2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_speed_cost(data, start_node_id, end_node_id):\n start_node = data[start_node_id]\n dist_cost = get_dist_cost(data, start_node_id, end_node_id)\n # Get the speed limit along the way that connects the starting and ending nodes\n speed_limit_between_nodes = start_node['adjacent'][end_node_id]\n ...
[ "0.7142137", "0.70797265", "0.7060887", "0.68590754", "0.68188316", "0.67531306", "0.6717431", "0.6709536", "0.6704493", "0.6673947", "0.6656351", "0.66260684", "0.6626049", "0.65931654", "0.65251565", "0.6505729", "0.6503182", "0.64715284", "0.6396269", "0.63136685", "0.6309...
0.7998344
0
Returns the GPS coordinates of a node in the form of a (lat, lon) tuple given its id number
def get_coords(data, id): return data[id]['lat'], data[id]['lon']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCoords(nodeName, nodeDatabase):\n\n\ttheNode = nodeDatabase[nodeName]\n\n\tif theNode == None:\n\t\treturn None\n\n\txTen = int(nodeName[0])\n\txOne = int(nodeName[1])\n\tyTen = int(nodeName[2])\n\tyOne = int(nodeName[3])\n\n\tx = xTen * 10 + xOne\n\ty = yTen * 10 + yOne\n\n\tx = float(x) + theNode[0]\n\ty ...
[ "0.71329355", "0.69038033", "0.68649656", "0.6678277", "0.64483297", "0.6437842", "0.6384114", "0.63782245", "0.6376769", "0.63460857", "0.62688994", "0.6231134", "0.620093", "0.61817425", "0.6147002", "0.6127867", "0.6123884", "0.61216366", "0.6117178", "0.61138505", "0.6066...
0.7358231
0
Return the shortest path between the two locations
def find_short_path(aux_structures, loc1, loc2): node1 = get_closest_node(aux_structures, loc1) node2 = get_closest_node(aux_structures, loc2) p = find_min_cost_path( aux_structures, node1, lambda x: x == node2, lambda parent_id: aux_structures[parent_id]['adjacent'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path(most_important_up, most_important_down, total_distance, to_source2, to_source1):\n\n if total_distance == min(total_distance, to_source2[0], to_source1[0]):\n return source_to_source(most_important_up, most_important_down), total_distance\n elif to_source2[0] == min(total_distance, to_source2...
[ "0.7344353", "0.73343515", "0.73073864", "0.71712095", "0.7103075", "0.709081", "0.7021918", "0.6950538", "0.6949197", "0.6885333", "0.68516684", "0.68488204", "0.68472445", "0.6845822", "0.68318", "0.680509", "0.6756939", "0.6733128", "0.6720433", "0.66910446", "0.66163874",...
0.7458285
0
Calculates the closest node in the given dataset to a specified query location
def get_closest_node(data, loc): min_dist = None closest = None for i in data: # Standard min-value search loop dist = great_circle_distance(get_coords(data, i), loc) if closest is None or dist < min_dist: closest = i min_dist = dist return closest
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearest(self, query):\n nearest_trees = list(map(lambda t: t.get_nearest_neighbor(query), self.trees))\n distances_pool = list(zip(map(lambda x: self.dist_fn(x, query), self.pool), self.pool))\n best = None\n best_cost = np.inf\n for cost, near in nearest_trees + distances_po...
[ "0.6762309", "0.64828414", "0.6479973", "0.63704467", "0.6340299", "0.6289788", "0.6275571", "0.6218076", "0.6161571", "0.61138684", "0.6088722", "0.6031872", "0.60286736", "0.59927785", "0.59881276", "0.59858656", "0.59744406", "0.58517927", "0.5811977", "0.58055955", "0.576...
0.7300712
0
Return the shortest path between the two locations, in terms of expected time (taking into account speed limits).
def find_fast_path(aux_structures, loc1, loc2): node1 = get_closest_node(aux_structures, loc1) node2 = get_closest_node(aux_structures, loc2) p = find_min_cost_path( aux_structures, node1, lambda x: x == node2, lambda parent_id: aux_structures[parent_id]['adjacent'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_short_path(aux_structures, loc1, loc2):\n node1 = get_closest_node(aux_structures, loc1)\n node2 = get_closest_node(aux_structures, loc2)\n p = find_min_cost_path(\n aux_structures,\n node1,\n lambda x: x == node2,\n lambda parent_id: aux_structures[parent_id]['adjacen...
[ "0.68621296", "0.6838797", "0.67794997", "0.6742132", "0.66601163", "0.6558029", "0.6545053", "0.6442407", "0.6440501", "0.64143556", "0.6411659", "0.6408043", "0.638472", "0.638061", "0.638061", "0.638061", "0.638061", "0.638061", "0.638061", "0.638061", "0.638061", "0.638...
0.7118161
0
Calculates the cost of the direct path (which is assume to exist) between specified start and end nodes based on the speed limit between them.
def get_speed_cost(data, start_node_id, end_node_id): start_node = data[start_node_id] dist_cost = get_dist_cost(data, start_node_id, end_node_id) # Get the speed limit along the way that connects the starting and ending nodes speed_limit_between_nodes = start_node['adjacent'][end_node_id] return di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dist_cost(data, start_node_id, end_node_id):\n p1 = get_coords(data, start_node_id)\n p2 = get_coords(data, end_node_id)\n return great_circle_distance(p1, p2)", "def calc_distance_efficiency(edgenode1: NodeID, edgenode2: NodeID, endnode: NodeID):\n \n (edgenode1_x, edgenode1_y) = G.nodes[...
[ "0.72310984", "0.6555049", "0.63811135", "0.63492346", "0.632483", "0.6281962", "0.6256531", "0.61671335", "0.6140901", "0.61125714", "0.6095206", "0.60840917", "0.60697466", "0.60603595", "0.6047342", "0.6030168", "0.59875757", "0.597641", "0.5971852", "0.5951847", "0.594243...
0.77096564
0
Converts the output of rekall's `pslist` plugin to a series of dictionaries that represent a process getting launched. Returns Generator[dict, None, None] Yields one process launch event
def pslist(self) -> Generator[dict, None, None]: # Function to switch fields to represent a parent def _convert_to_parent_fields(process: dict) -> dict: output = {} for left, right in [ (FieldNames.PROCESS_IMAGE, FieldNames.PARENT_PROCESS_IMAGE), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_processes():\n yield from psutil.process_iter()", "def get_process_list() -> Dict:\n return {proc.pid: proc.name() for proc in psutil.process_iter()}", "def get_processes(self):\n processes = {}\n # Get ps output\n cmd = [\"ps\", \"-Z\"]\n # Split by newlines and remov...
[ "0.6924706", "0.6768775", "0.6297654", "0.6143478", "0.60605407", "0.60443914", "0.6038552", "0.60323393", "0.59858847", "0.59577066", "0.585973", "0.58388156", "0.5796907", "0.57576954", "0.5756859", "0.57051915", "0.5663605", "0.56089604", "0.5578495", "0.5567964", "0.55656...
0.7391139
0
Converts the output of the rekall `handles` plugin to a series of events which represent accessing registry keys or file. Yields Generator[dict, None, None] One file or registry key access event a time.
def handles(self) -> Generator[dict, None, None]: for handle in self.session.plugins.handles().collect(): # Regardless of if we use this handle or not, can make a process node # if this is a process that wasnt in pslist/pstree. e_proc = handle["_EPROCESS"] pid =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RecurseKeys(self):\n root_key = self.GetRootKey()\n if root_key:\n for registry_key in root_key.RecurseKeys():\n yield registry_key", "def hookregistry():\n registry = HookRegistry()\n yield registry", "def walk (root, ignore_access_errors=False, _want_types=False):\n root = regist...
[ "0.61464757", "0.5975714", "0.59317523", "0.57884747", "0.5579635", "0.54803085", "0.547669", "0.53810596", "0.53520006", "0.5316987", "0.5316987", "0.52135235", "0.52016133", "0.5145512", "0.5128108", "0.51243407", "0.5116911", "0.510154", "0.5088898", "0.5076942", "0.507694...
0.6914233
0
Outputs all tasks for today
def show_today_tasks(self): today = datetime.today() tasks = self.session.query(self.Table).filter(self.Table.deadline == today.strftime('%Y-%m-%d')).all() print(f'Today {today.strftime("%d %b")}:') if tasks: for n, task in enumerate(tasks, 1): print(f'{n}. {t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_all_tasks(self):\n tasks = self.session.query(self.Table).order_by(self.Table.deadline).all()\n print('All tasks:')\n if tasks:\n for n, task in enumerate(tasks, 1):\n print(f'{n}. {task.task}. {task.deadline.strftime(\"%d %b\")}')\n else:\n ...
[ "0.7415264", "0.718579", "0.69847673", "0.6934783", "0.6687807", "0.65485847", "0.649769", "0.64286005", "0.63895726", "0.63242805", "0.62161577", "0.6139277", "0.6120085", "0.60914505", "0.60645705", "0.60268193", "0.593979", "0.5875494", "0.5870167", "0.5861685", "0.5844967...
0.82035047
0
Outputs all tasks for next seven days
def show_weeks_tasks(self): for day in [datetime.today() + timedelta(days=i) for i in range(7)]: tasks = self.session.query(self.Table).filter(self.Table.deadline == day.strftime('%Y-%m-%d')).\ order_by(self.Table.deadline).all() print(f'{day.strftime("%A")} {day.strftime...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extra_tasks_for_today(self):\n localtz = tzlocal()\n datetime_today = datetime.fromtimestamp(rospy.get_rostime().to_sec(), tz=localtz)\n day_today = datetime_today.strftime(\"%A\")\n date_today = datetime_today.date()\n rospy.loginfo('Looking for daily tasks for %s, %s' % (da...
[ "0.6525943", "0.64713687", "0.6307339", "0.61137074", "0.61084795", "0.61000574", "0.6076621", "0.6073103", "0.5991018", "0.594191", "0.5933454", "0.5871212", "0.5792566", "0.57387775", "0.5732741", "0.5723883", "0.5695668", "0.568644", "0.56864196", "0.5653754", "0.56522554"...
0.7575403
0
Shows all tasks from the database
def show_all_tasks(self): tasks = self.session.query(self.Table).order_by(self.Table.deadline).all() print('All tasks:') if tasks: for n, task in enumerate(tasks, 1): print(f'{n}. {task.task}. {task.deadline.strftime("%d %b")}') else: print('Nothin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_tasks():\n\n task = Task(connection=connection, cursor=cursor)\n\n all_tasks = task.get_all_tasks()\n\n context = {\n 'all_tasks': all_tasks\n }\n\n return render_template('pages/tables/tasks.html', **context)", "def dashboard_showall():\n tasks = Task.query.all()\n return re...
[ "0.8783496", "0.79877347", "0.78228956", "0.77925193", "0.75930774", "0.7560194", "0.75213826", "0.74824816", "0.7458337", "0.7390845", "0.73861516", "0.7362085", "0.73245263", "0.7259508", "0.7200233", "0.713119", "0.713119", "0.709036", "0.70341647", "0.69570655", "0.693124...
0.8335778
1
Shows all missed tasks from the database
def show_missed_tasks(self): tasks = self.session.query(self.Table).filter(self.Table.deadline < datetime.today().strftime('%Y-%m-%d')).\ order_by(self.Table.deadline).all() print('Missed tasks:') if tasks: for n, task in enumerate(tasks, 1): print(f'{n}. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_unfinished():\n\n cur = db.get_db().cursor()\n\n create_new_task(cur)\n\n cur.execute('SELECT * FROM todos WHERE completed = false')\n todos = cur.fetchall()\n cur.close()\n\n return render_template(\"index.html\", todos=todos)", "def view_tasks(self):\n if self.db_link.get_num_...
[ "0.6813596", "0.65634406", "0.65557", "0.6515568", "0.64375067", "0.6211616", "0.6192441", "0.6164491", "0.6161131", "0.61577725", "0.60829145", "0.6078705", "0.60431814", "0.6013176", "0.600436", "0.5906585", "0.58327776", "0.5822058", "0.5822041", "0.5810805", "0.58065087",...
0.8387552
0
Delete a chosen task from the database
def delete_task(self): tasks = self.session.query(self.Table).order_by(self.Table.deadline).all() if tasks: print('Chose the number of the task you want to delete:') for n, task in enumerate(tasks, 1): print(f'{n}. {task.task}. {task.deadline.strftime("%d %b")}') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _delete():\n\tquery = myTaskSession.query(WorkToolkitDB.db.Task)\n\n\tIDStr = myOpt.id\n\tIDs = re.split('\\s*,\\s*', IDStr)\n\n\tif len(IDs) == 0:\n\t\tprint('ERR: no deleting id input')\n\t\treturn 1\n\n\tfor ID in IDs:\n\t\tmyTask = query.get(ID)\n\t\tmyTaskSession.delete(myTask)\n\n\t\n\tmyTaskSession.comm...
[ "0.8132668", "0.80514956", "0.77895945", "0.77546376", "0.76735175", "0.7670852", "0.7641198", "0.7548639", "0.75130296", "0.74725443", "0.7467442", "0.74369425", "0.7432077", "0.7360633", "0.73344076", "0.7333783", "0.73195636", "0.7312928", "0.7308505", "0.73043287", "0.728...
0.8348445
0
Adds a new triplet (context, action, reward) to the dataset. The reward for the actions that weren't played is assumed to be zero.
def add(self, context, action, reward): if self.intercept: c = np.array(context[:]) c = np.append(c, 1.0).reshape((1, self.context_dim + 1)) else: c = np.array(context[:]).reshape((1, self.context_dim)) if self.contexts is None: self.contexts = c else: self.contexts = np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, obs_t, action, reward, obs_tp1, done):\n data = (obs_t, action, reward, obs_tp1, done)\n\n if self._next_idx >= len(self._storage):\n self._storage.append(data)\n else:\n self._storage[self._next_idx] = data\n self._next_idx = (self._next_idx + 1) % s...
[ "0.671483", "0.65043765", "0.6210862", "0.6172742", "0.6168113", "0.6030715", "0.6001803", "0.5970362", "0.5970274", "0.59486765", "0.58892787", "0.58603483", "0.58072466", "0.57922786", "0.5744286", "0.57405937", "0.57405937", "0.57405937", "0.57405937", "0.57405937", "0.574...
0.6981478
0
Returns a random minibatch of (contexts, rewards) with batch_size.
def get_batch(self, batch_size): n, _ = self.contexts.shape if self.buffer_s == -1: # use all the data ind = np.random.choice(range(n), batch_size) else: # use only buffer (last buffer_s observations) ind = np.random.choice(range(max(0, n - self.buffer_s), n), batch_size) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_batch_with_weights(self, batch_size):\n n, _ = self.contexts.shape\n if self.buffer_s == -1:\n # use all the data\n ind = np.random.choice(range(n), batch_size)\n else:\n # use only buffer (last buffer_s obs)\n ind = np.random.choice(range(max(0, n - self.buffer_s), n), batch_s...
[ "0.6808502", "0.6685455", "0.65886897", "0.6290288", "0.6240917", "0.6183174", "0.615778", "0.61459816", "0.60907954", "0.60796595", "0.6040223", "0.60264456", "0.60125655", "0.6002749", "0.5991994", "0.59778047", "0.5950535", "0.5946423", "0.5935481", "0.5933893", "0.5932923...
0.6939629
0
Returns all (context, reward) where the action was played.
def get_data(self, action): n, _ = self.contexts.shape ind = np.array([i for i in range(n) if self.actions[i] == action]) return self.contexts[ind, :], self.rewards[ind, action]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getReward(self):\n return self._mdp.R[self._prev_state,self._cur_state]", "def get_action_history(self):\n\t\treturn self._action_history", "def find_reward(self, opponent: Player) -> Dict[Action, Dict[Action, Score]]:\n\n if len(opponent.history) == 0:\n opp_prev_action = self._ra...
[ "0.6147814", "0.6022552", "0.59876364", "0.5973903", "0.5973903", "0.5939489", "0.5894192", "0.5869531", "0.58425534", "0.5841221", "0.5807607", "0.5780774", "0.5763582", "0.57488453", "0.573541", "0.5716168", "0.5705829", "0.570321", "0.57015854", "0.56991476", "0.56766206",...
0.70654607
0
Returns number of points in the buffer (after applying function f).
def num_points(self, f=None): if f is not None: return f(self.contexts.shape[0]) return self.contexts.shape[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_points(self):\n\n if self.data_reduced:\n return len(self.data_reduced[0])\n else:\n return 0", "def nr_points(self):\n return len(self.x)", "def count_frames(f):\n def counted(n):\n counted.open_count += 1\n counted.max_count = max(counted.max_...
[ "0.6374237", "0.6270925", "0.62252533", "0.6166829", "0.6152495", "0.60545135", "0.5885264", "0.5865867", "0.5838218", "0.5826639", "0.5796383", "0.57556164", "0.57513106", "0.5739175", "0.57384235", "0.5730908", "0.57269245", "0.5716227", "0.57125664", "0.570249", "0.5696085...
0.77345204
0
Group by the moveline location destination
def iter_mls(self, mls): for _location_dest_id, grouped_mls in mls.groupby("location_dest_id"): yield grouped_mls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate_location(request):\n try:\n start_date = request.GET.get('startDate', None)\n end_date = request.GET.get('endDate', None)\n\n items = __getQuerysetGivenInterval('item', start_date, end_date)\n\n items_grouped_by_location = list(\n items.annotate(location=F('d...
[ "0.5899574", "0.52549607", "0.52465934", "0.520161", "0.51479113", "0.5012909", "0.49838233", "0.49466768", "0.4930132", "0.49000987", "0.4856069", "0.484746", "0.48310947", "0.48293048", "0.48087308", "0.47998804", "0.47866955", "0.47846776", "0.47822848", "0.47816217", "0.4...
0.57097214
1
Generate C_ell as function of ell for a given Omega_c and Sigma8 Inputs
def euclid_ccl(Omega_c, sigma8=0.83): cosmo_fid = ccl.Cosmology(Omega_c=Omega_c, Omega_b=0.045, h=0.71, sigma8=sigma8, n_s=0.963) dNdzs = np.zeros((nbins, z.size)) shears = [] for i in range(nbins): # edges of 1 equal width redshift bins, between 0 and 2 zmin, zmax = i*(2./nbins),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def N_EE_EB(self, L):\n if L>2.*self.CMB.lMaxP:\n return 0.\n # integrand\n def integrand(x):\n theta = x[1]\n l1 = np.exp(x[0])\n l2 = self.l2(L, l1, theta)\n if l2<self.CMB.lMin or l2>self.CMB.lMaxP:\n return 0.\n phi = self.phi(L, l1, the...
[ "0.5866796", "0.5760539", "0.57180786", "0.5700963", "0.56136435", "0.5604692", "0.55994725", "0.55702585", "0.5557166", "0.5517213", "0.54780996", "0.54679424", "0.5453729", "0.5405519", "0.5398123", "0.5386056", "0.5378074", "0.537038", "0.53637236", "0.5362621", "0.5357898...
0.59700304
0
stores the width and height. It also calls setUpGUI to create a new Tkinter window. It also stores the fractal that is going to be used to create the image.
def __init__(self, fractal, gradient): self.width = fractal.getWidth() self.height = fractal.getHeight() self.fractal = fractal self.window = Tk() self.img = PhotoImage(width=self.width, height=self.height) self.setUpGUI() self.grad = self.developGradient(gradient...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUpGUI(self):\n WHITE = '#ffffff'\n # Set up the GUI so that we can paint the fractal image on the screen\n canvas = Canvas(self.window, width=self.width, height=self.height, bg=WHITE)\n canvas.pack()\n canvas.create_image((self.width/2, self.height/2), image=self.img, stat...
[ "0.74250853", "0.6660677", "0.66237396", "0.64372146", "0.6435464", "0.6225826", "0.6150365", "0.6107587", "0.6064386", "0.6051492", "0.6045349", "0.6009063", "0.60025173", "0.5977283", "0.5911118", "0.5909652", "0.5864038", "0.58625364", "0.58620816", "0.5854645", "0.5854252...
0.6842664
1
takes a Fractal Object and creates the image. Calls makeRow() repeatedly and updates the image after every call.
def makeImage(self): for row in range(self.height): self.makeRow(row) self.window.update() # display a row of pixels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeRow(self, row):\n for col in range(self.width):\n count = self.fractal.calculateIterations(row, col)\n color = self.grad.getColor(count)\n self.img.put(color, (col, row))", "def _fractalize(self, f, compMap):\n\n from PIL import Image\n\n def toImage(...
[ "0.6590113", "0.60703623", "0.58575183", "0.58255225", "0.5796585", "0.57538164", "0.5669956", "0.56590974", "0.5528286", "0.5519179", "0.551833", "0.55000067", "0.54842395", "0.5469326", "0.53263646", "0.5321058", "0.5313186", "0.5312811", "0.5302167", "0.5301955", "0.530068...
0.72246456
0
gets the name from the fractal and then saves the image as a PNG to the CWD.
def saveImage(self, fileName="mandelbrot.frac"): # Save the image as a PNG if fileName == "": fileName = "mandelbrot.frac" directories = fileName.split("/") for n in directories: if ".frac" in n: name = n.rsplit(".", 1)[0] self.img.write(f"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _output_path(name):\n output = Path(\"../Analysis Results/\").joinpath(str(date.today()))\n output.mkdir(parents=True, exist_ok=True)\n return output.joinpath(f\"{name}.png\")", "def img_save(self):\n file_name, extension = return_folder_file_extension(self.img_name)[1:]\n image_name_s...
[ "0.66554195", "0.6543979", "0.652645", "0.64313185", "0.6424981", "0.6423328", "0.6403917", "0.63762975", "0.6350019", "0.63253224", "0.630369", "0.627746", "0.6267398", "0.6238501", "0.6236487", "0.6234515", "0.62180203", "0.6182984", "0.61370903", "0.61204976", "0.6118144",...
0.75794995
0
Recomputes energies and the contour, e.g. after a control point has been added.
def update(self): # compute the contour and normals spline = Spline() spline.addControlPoints(*self.controlpoints) lencontrolpoints = len(self.controlpoints) self.contour = spline.interpolation self.normals = spline.normals # the following is not needed a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computation(*args):\n contour, initial = segment_one_image(\n nodes=self.control_points,\n image=self.image_data,\n degree=degree,\n resolution=resolution,\n sigma=sigma,\n )\n self.initial = initial\n ...
[ "0.618839", "0.61744183", "0.6113207", "0.58756137", "0.5860518", "0.58572257", "0.5821885", "0.5793746", "0.5662219", "0.5585819", "0.55836177", "0.55470634", "0.5543066", "0.55393887", "0.5527119", "0.55120873", "0.55015886", "0.54988736", "0.54973865", "0.5464207", "0.5462...
0.7437726
0
Sets the step size with which a controlpoint moves upon optimization.
def setStepSize(self, step_size): assert isinstance(step_size, int) self.step_size = step_size self.step_directions = [np.array([i[0], i[1]]) for i in [(0,0), (0,step_size), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_step_size(self, step_size):\r\n # Max step size for each unit is based on one byte of SIGNED data -> range = 2**8 / 2 = 128\r\n # if step_size < 12.8:\r\n # if self._current_units != 'A':\r\n # self.set_units('A')\r\n # time.sleep(1)\r\n # s...
[ "0.73840964", "0.69926745", "0.6812066", "0.6692926", "0.6541196", "0.639004", "0.63062125", "0.6227273", "0.61918414", "0.6174771", "0.6134594", "0.6123805", "0.60291445", "0.5886498", "0.58772904", "0.5875955", "0.5859523", "0.58458984", "0.5799336", "0.57466084", "0.574648...
0.7011417
1
Toggles wether the steo size should be fixed or not, i.e. when it is not fixed the external energy object defines the step size dependent of the current iteration. The step size can still be changed, but does not change within an optimization of the snake.
def fixStepSize(self, fixit): self.step_size_fixed = fixit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsFixed(self):\r\n \r\n return not self.HasFlag(self.optionResizable)", "def onSetToHalfSize(self, evt):\n\t\tself.halfResampleZ.Enable(1)\n\t\tif self.dataUnits:\n\t\t\tx, y, z = self.dataUnits[0].dataSource.getOriginalDimensions()\n\t\t\tzf = 1\n\t\t\t\n\t\t\tif self.halfResampleZ.GetValue():...
[ "0.5842221", "0.5603142", "0.55219823", "0.5449089", "0.53771526", "0.5296812", "0.5281798", "0.5266489", "0.5171781", "0.51345706", "0.5070011", "0.5067429", "0.5057515", "0.5056535", "0.5054745", "0.5048425", "0.50436544", "0.5037792", "0.4954957", "0.4949152", "0.4935354",...
0.6171139
0
Adds a control point to the snake.
def addControlPoints(self, *controlpoints): self.controlpoints.extend(controlpoints) self.update()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_point(self):\r\n self.command_stack.do(model.structure.AddPoint(self._structure, self._point_index+1, 0, 0))", "def __add_node(self):\n next_pos = self.__get_next_tail_pos(self.__snake[-1])\n next_d = self.__snake[-1].direct()\n node = Snake(self, direction=next_d, size=self....
[ "0.61087155", "0.5854334", "0.57319814", "0.57319814", "0.57319814", "0.57319814", "0.5709353", "0.5614755", "0.56054807", "0.5538422", "0.5524413", "0.5470329", "0.5450645", "0.5430251", "0.52992016", "0.52843386", "0.52827954", "0.52781624", "0.5276773", "0.523357", "0.5226...
0.5994802
1
Returns the sum of the internal and the external energy. The internal energy gets approximately ampped into the same range of values as the external energy. The external range of values is known. The internal range of values is theoretically unbound but limited in practice.
def totalEnergy(self, controlpoints): # spacing is positive and unbound, but smaller than n-1 in pratice # curvature is within [0, 2*(n-2)] internal = self.spacingEnergy(controlpoints) + self.curvatureEnergy(controlpoints) n = len(self.controlpoints) internal_max = n-1 + 2*(n-2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_over_energy(self):\n raise NotImplementedError(\"MapBase.sum_over_energy()\")", "def sum_range(self, lower, upper):\n if upper>self.upper:\n upper=self.upper\n if lower<self.lower:\n lower = self.lower\n\n i_l = int(np.floor((lower-self.lower)/self._dx))\...
[ "0.62917477", "0.62254065", "0.62173504", "0.61850643", "0.61629695", "0.61573035", "0.6146259", "0.606433", "0.6050024", "0.60491025", "0.59185344", "0.5907157", "0.58055913", "0.5776813", "0.5765693", "0.5756732", "0.5706109", "0.56993127", "0.5698565", "0.5696164", "0.5618...
0.6801587
0
Returns the snake's spacing energy. This energy tends to zero the more all adjacent control points inbwtween distance tends to the goal length. This energy is theoretically unbound, e.g. control points and infinitely far away from each other, but settles within 0 and n1 in practice, where n ist the number of control po...
def spacingEnergy(self, controlpoints): # only remember each spacing energy if the given control points are # the snakes current control points memorize_energies = np.equal(controlpoints, self.controlpoints).all() # reset the spacing energy list if necessary if memorize_energies:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(self) -> int:\n return 0", "def manhatam_distance(self) -> int:\n return abs(self.north) + abs(self.east)", "def potentialEnergy(self):\n return 0.5*(pdist(self.positions)**2).sum()", "def getDistance(self):\n return sqrt(self.state[0] * self.state[0] + self.state[2] ...
[ "0.5513054", "0.5502019", "0.5427583", "0.54053986", "0.53456986", "0.53450596", "0.53161526", "0.5307237", "0.5282292", "0.5258847", "0.523342", "0.5197538", "0.5181827", "0.5180391", "0.5162493", "0.5128561", "0.51216435", "0.50994825", "0.50795114", "0.5078731", "0.5071806...
0.73741144
0
Returns the snake's curvature energy. The straighter the snake the less the curvature energy. This energy's values are within 0 and 2(n2), where n is the number of control points. The curvature is measured by measuring the angles between all threepairs of control points.
def curvatureEnergy(self, controlpoints): # only remember each curvature energy if the given control points are # the snakes current control points memorize_energies = np.equal(controlpoints, self.controlpoints).all() # reset the curvature energy list if necessary if memorize_ene...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def curvature(self):\n return self.circle().curvature(self.o, self.r, p = self.a)", "def _curvature(self):\n y_eval = self.left_fitx.shape[0] - 10\n left_curverad = (((1 + (2 * self.left_fit[0] * y_eval + self.left_fit[1]) ** 2) ** 1.5) /\n np.absolute(2 * self.left_f...
[ "0.70094925", "0.6831601", "0.6831484", "0.68248147", "0.6619458", "0.6403633", "0.63608927", "0.6249435", "0.6113684", "0.6083346", "0.6066849", "0.5933526", "0.5919591", "0.591756", "0.5869741", "0.5812689", "0.5791419", "0.5716179", "0.5649723", "0.56450933", "0.5627129", ...
0.7586239
0
Optimizes the snake to minimize it's energy.
def optimize(self, goal_length=100, optimization_steps=15): self.update() # start set of control points cpoints = {} j = 0 for i in map(lambda x: np.array([x[0], x[1]]), self.controlpoints): cpoints[j] = i j += 1 # optimization parameters ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimize(self):\n pass", "def _optimise(self):\n better = True\n self.solutions = set()\n\n # Rebuild the neighbours\n self.neighbours = {}\n\n for i in self.heuristic_path:\n self.neighbours[i] = []\n\n for j, dist in enumerate(TSP.edges[i]):\n...
[ "0.6176374", "0.59620726", "0.59463626", "0.59009045", "0.5774275", "0.57524925", "0.5667658", "0.5607546", "0.54908603", "0.5461481", "0.5418839", "0.5402698", "0.5363033", "0.53579384", "0.53152955", "0.5251095", "0.5244987", "0.5231546", "0.5211921", "0.52087736", "0.52042...
0.6889111
0
Greedily optimizes every control point of the snake. Proceeds one by the other over the list of control points. If no improvement for a control point can be estimated it does not get moved.
def greedyOptimize(self, cpoints): # the currently best known energy is the current energy best_energy = self.totalEnergy(cpoints.values()) best_before = best_energy cpoints_ = cpoints.copy() # iterate over each control point in order to find the movement # that improves ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize(self, goal_length=100, optimization_steps=15):\n self.update()\n # start set of control points\n cpoints = {}\n j = 0\n for i in map(lambda x: np.array([x[0], x[1]]), self.controlpoints):\n cpoints[j] = i\n j += 1\n \n # optimizati...
[ "0.6761999", "0.59673804", "0.58893645", "0.5640086", "0.56112486", "0.5577661", "0.5543646", "0.5500207", "0.5462697", "0.5384906", "0.5346757", "0.5332411", "0.53099006", "0.52876675", "0.52847", "0.52768433", "0.5274538", "0.5246288", "0.5235588", "0.5224353", "0.51750296"...
0.7016052
0
Inverts the orientation of the normals.
def flipNormals(self): self.flip = not self.flip
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invert(self):\n self.vertices.reverse()", "def inverse(self):\n def inv(v):\n v[0], v[1] = v[1] , v[0]\n for v in [self.point1 , self.pointN , self.unitv, self.normalv]:\n inv(v)\n\n self.points = numpy.roll(self.points,1,axis=1)\n self.a, self.b = sel...
[ "0.7056541", "0.64426666", "0.6291677", "0.62704265", "0.623405", "0.6185095", "0.61838543", "0.6166996", "0.6090015", "0.6045846", "0.59323657", "0.58985794", "0.58811", "0.5854597", "0.58504355", "0.58213025", "0.5807872", "0.5775443", "0.5772331", "0.57636875", "0.5761133"...
0.7673181
0
Return key associated with maximum value in d.
def key_of_max(d): keys = list(d.keys()) keys.sort() return max(keys, key=lambda x: d[x])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keywithmaxval(d):\n\treturn max(d, key=lambda k: d[k])", "def keywithmaxval(d): \r\n v=list(d.values())\r\n k=list(d.keys())\r\n return k[v.index(max(v))]", "def keywithmaxval(d): \n v=list(d.values())\n k=list(d.keys())\n return k[v.index(max(v))]", "def keywithmaxval(d): \n ...
[ "0.8774806", "0.8453903", "0.8435321", "0.8435321", "0.8435321", "0.79708344", "0.77387995", "0.77312034", "0.7670042", "0.7646165", "0.75395495", "0.7414345", "0.73909384", "0.71985465", "0.7174916", "0.7070747", "0.69902855", "0.69356674", "0.69131494", "0.6890645", "0.6775...
0.87593484
1
Check that inverse_transform rolls back transform result in case of given out_column
def test_inverse_transform_out_column(example_df_: pd.DataFrame): expected_out_column = "target_add_10.1" preprocess = AddConstTransform(in_column="target", value=10.1, inplace=False) transformed_target = preprocess.fit_transform(df=example_df_) inversed = preprocess.inverse_transform(df=transformed_tar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse_transform(self, X):\n ...", "def inverse_transform(self, X):\n ...", "def inverse_transform(self, X):\n ...", "def inverse_transform(self, X):\n ...", "def inverse_transform(self, X):\n ...", "def inverse_transform(self, X_in):\n\n # fail fast\n ...
[ "0.6661727", "0.6661727", "0.6661727", "0.6661727", "0.6661727", "0.6445931", "0.6428597", "0.63860476", "0.6360324", "0.6345075", "0.63437986", "0.63262707", "0.62864536", "0.6279477", "0.6278267", "0.6184647", "0.61690956", "0.6156222", "0.61443853", "0.606856", "0.60191584...
0.7265796
0
Get or Create Hbase Connection from Repoconfig.
def _get_conn(self, config: RepoConfig): store_config = config.online_store assert isinstance(store_config, HbaseOnlineStoreConfig) if not self._conn: self._conn = Connection(host=store_config.host, port=int(store_config.port)) return self._conn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_connection(cfg, verbose=None):\n if verbose:\n print \"Parsing config: {0}\".format(cfg)\n # Get the redcap mysql configuration\n config = ConfigParser.RawConfigParser()\n config_path = os.path.expanduser(cfg)\n config.read(config_path)\n\n user = config.get('github', 'user')\n ...
[ "0.65109974", "0.6094864", "0.60679626", "0.5942467", "0.582348", "0.5774959", "0.5728813", "0.5719577", "0.5713489", "0.5704945", "0.5664257", "0.5651353", "0.5626177", "0.559795", "0.5589353", "0.55522084", "0.5549691", "0.55388933", "0.5531699", "0.55136603", "0.54946077",...
0.73264974
0
Returns table name given the project_name and the feature_view.
def _table_id(project: str, table: FeatureView) -> str: return f"{project}_{table.name}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_name() -> str:\n pass", "def test_table_name(self):\n obs = SampleTemplate._table_name(self.test_study.id)\n self.assertEqual(obs, \"sample_1\")", "def name(self) -> str:\n return f\"lookup_table_{self.table_number}\"", "def get_table_name_from_model(model):\n return ...
[ "0.63852304", "0.6269045", "0.6207112", "0.6078357", "0.60209805", "0.5971054", "0.5963951", "0.59466404", "0.59393275", "0.589815", "0.58583134", "0.5838769", "0.58252686", "0.58252686", "0.58252686", "0.580889", "0.576508", "0.5700783", "0.5685492", "0.56453544", "0.5640338...
0.7514799
0
check if the string is a variable
def is_var (string): if (string[0] == '?'): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_variable(s):\n return s[0] >= 'u' and s[0] <= 'z' and s.isalnum()", "def is_variable_string(value):\n if not isinstance(value, basestring):\n return False\n return bool(_property_string_pattern.match(value))", "def _check_variable(string, varname):\r\n prefix = '[(, ]' # Any characte...
[ "0.8160038", "0.784164", "0.7687841", "0.7619167", "0.7570177", "0.73787373", "0.7303772", "0.72203046", "0.71468085", "0.70688415", "0.69642395", "0.6875475", "0.68696576", "0.68268836", "0.67248994", "0.6621854", "0.65842247", "0.65682334", "0.6462668", "0.636754", "0.63565...
0.8200682
0
match an antecedent and knowledge in the working memory
def match_antecedent(anteceds, wm, sub): # print("-------- Matching Antecedent --------------") antec = anteceds[0] def ma_helper(states, wm_left): # print(" ---------- ma_helper --------") # print("states = ", states) # print("sub = ", sub) if wm_left == []: # If wm_left...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matches(self, accession):\n pass", "def match(self, other):", "def additionalMatch(handIn, indx):", "def match_rule(name, lhs, rhs, wm):\n print(\" ------------ Matching Rule '\", name, \"' --------------\")\n print(\" lhs = \", lhs)\n print(\" rhs = \", rhs)\...
[ "0.57929456", "0.5672864", "0.5623951", "0.55551845", "0.55379426", "0.5507479", "0.547602", "0.54390085", "0.5419532", "0.5358792", "0.5294308", "0.5258793", "0.5247581", "0.52431643", "0.52022254", "0.51657254", "0.51394176", "0.5132393", "0.51254255", "0.5117034", "0.51118...
0.595333
0
substitute the variables in patterns
def execute(subs,patterns,wm): res = [] for p in patterns: tmp = substitute(subs, p) if tmp not in wm: res.append(tmp) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_vars(params, contents):\n if isinstance(contents, str):\n contents = [contents]\n replace_contents = []\n\n if params != None and contents != None:\n for content in contents:\n replace_content = content\n for match in regexp_replace_var.findall(content):\n ...
[ "0.6331912", "0.632703", "0.63136256", "0.62746614", "0.61820346", "0.61343473", "0.6079956", "0.60760856", "0.6030244", "0.59886456", "0.5977037", "0.59300756", "0.5917595", "0.58670866", "0.58488166", "0.5841134", "0.58060896", "0.57700133", "0.57628125", "0.57580477", "0.5...
0.64295936
0
Matches each rules and return new patterns derived from matching rules
def match_rules(rules, wm): res = [] for r in rules: new_patterns = match_rule(r[0],r[1],r[2], wm) if new_patterns: print(" Match succeeds") print(" Adding assertions to WM") else: print(" Match fails") for n in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_all_rules(self):\n\n def compatible(pattern1, pattern2, direction):\n \"\"\"Returns `True` if `pattern2` is compatible with `pattern1` in the `direction`,\n otherwise return `False`.\"\"\"\n if direction == 0:\n return pattern1[:-1] == pattern2[1:]\n ...
[ "0.6899324", "0.64688843", "0.6427405", "0.63606447", "0.62112725", "0.6090403", "0.6024381", "0.6010944", "0.5967414", "0.59641206", "0.5944773", "0.5923941", "0.5922416", "0.5920496", "0.5899685", "0.58971447", "0.5879691", "0.58781594", "0.5875939", "0.58681065", "0.586216...
0.7129834
0
Register default hooks for training.
def register_training_hooks( self, lr_config, optimizer_config=None, checkpoint_config=None, log_config=None ): if optimizer_config is None: optimizer_config = {} if checkpoint_config is None: checkpoint_config = {} if lr_config is not None: assert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_default_hooks(self):\n\n self.create_hooks(\"commands\")\n self.create_hooks(\"commands_out\")\n self.create_hooks(\"hooks\")", "def setup_hooks(self):\n pass", "def _training_before_hook(self):\n pass", "def set_hooks(self):\n for layer_idx, layer in enum...
[ "0.73374665", "0.7097142", "0.70754343", "0.64571023", "0.64513034", "0.64056474", "0.6324692", "0.6158269", "0.6158269", "0.6151601", "0.60589737", "0.6053565", "0.596277", "0.59435725", "0.59414166", "0.59243643", "0.5916747", "0.58905953", "0.58247924", "0.5811105", "0.581...
0.7313006
1
Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary representation of that number. You can guarantee that input is nonnegative.
def count_bits(n): return sum(1 for x in bin(n) if x == "1")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countBits(n):\n binary = bin(n)[2:]\n counter = 0\n \n for i in binary:\n if i == '1':\n counter += 1\n \n return counter", "def num_bits_for_int(n: int):\n n = abs(int(n))\n bits = 0\n while n > 0:\n n >>= 1\n bits += 1\n return bits", "def cou...
[ "0.80497015", "0.78334594", "0.7825608", "0.77976567", "0.77628064", "0.7750137", "0.77479005", "0.77274317", "0.7572168", "0.7345996", "0.7342621", "0.7316735", "0.7297823", "0.728073", "0.72787666", "0.7249538", "0.72118604", "0.71544254", "0.7112444", "0.70494026", "0.7012...
0.8381372
0