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
Dynamic library stub function
def stubFunc( *args, **keywords ): maya.cmds.dynamicLoad( library ) # call the real function which has replaced us return maya.cmds.__dict__[command]( *args, **keywords )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_stub(self):\n pass", "def generate_ext_stub(cls):\n # Qualified name (C Version)\n qname = '_'.join(symbol_table.prefix+[cls.name])\n self.exts.append(qname)\n\n if self.config.verbose:\n import sys\n mod_name = '.'.join(sy...
[ "0.65117", "0.6033104", "0.59740293", "0.59045887", "0.58740264", "0.5853005", "0.58475363", "0.58138716", "0.5795929", "0.5775147", "0.5775147", "0.5775147", "0.5775147", "0.5775147", "0.57486016", "0.5738319", "0.57080203", "0.56999254", "0.56829923", "0.5643429", "0.559001...
0.72174203
0
Process the "commandList" file that contains the mappings between command names and the libraries in which they are found. This function will install stub functions in maya.cmds for all commands that are not yet loaded. The stub functions will load the required library and then execute the command.
def processCommandList(): try: # Assume that maya.cmds.about and maya.cmds.internalVar are already registered # commandListPath = os.path.realpath( os.environ[ 'MAYA_LOCATION' ] ) platform = maya.cmds.about( os=True ) commandListPath = os.path.join( commandListPath, commandL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_commands(self, commands: List[str]):", "def __init__(self, command_list: list = None) -> None:\n if command_list is None:\n command_list = implemented_commands\n for command in command_list:\n setattr(self, command.get(\"name\").replace(\" \", \"_\"), self._SingleC...
[ "0.7030482", "0.61618656", "0.6115203", "0.5982748", "0.5949485", "0.58595926", "0.5814018", "0.5806937", "0.5794264", "0.5758835", "0.570823", "0.56881213", "0.5687735", "0.5672729", "0.5666066", "0.56065243", "0.5588865", "0.5588816", "0.5586607", "0.55086136", "0.5474133",...
0.8668142
0
This function creates rectangular in radom point with random params Exit code
def add_rand_rect() -> int: r = randint(10, 100) x = randint(r, WIDTH - r) y = randint(r, HEIGHT - r) vx = randint(-10, 10) vy = randint(-10, 10) color = COLORS[randint(0, len(COLORS) - 1)] add_rect(x, y, r, vx, vy, color, int(-100 / r)) return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RandomCoordinate(): \r\n return ReturnRounded(np.random.uniform(-10,10))", "def phantom_rectangles(n_points,R):\n \n \n #Rescaling according to image size \n R[:,0] = R[:,0]*n_points/2\n R[:,1] = R[:,1]*n_points/2\n R[:,2] = R[:,2]*n_points/2\n R[:,3] = R[:,3]*n_points/2\n R[:,4] =...
[ "0.6723634", "0.6521465", "0.61302173", "0.6013927", "0.5988419", "0.5915515", "0.5871867", "0.5845545", "0.58222014", "0.58034813", "0.57898873", "0.5784966", "0.57652074", "0.5758353", "0.57454664", "0.5727684", "0.5677776", "0.5668007", "0.5667086", "0.56670827", "0.566394...
0.6561995
1
Multiplatform dependency resolution for PEX files. Given a pants configuration and a set of requirements, return a list of distributions that must be included in order to satisfy them. That may involve distributions for multiple platforms.
def resolve_multi(config, requirements, interpreter=None, platforms=None, conn_timeout=None, ttl=3600): distributions = dict() interpreter = interpreter or PythonInterpreter.get() if not isinstance(interpreter, PythonInterpr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_multi(config,\r\n requirements,\r\n interpreter=None,\r\n platforms=None,\r\n conn_timeout=None,\r\n ttl=3600):\r\n distributions = dict()\r\n interpreter = interpreter or PythonInterpreter.get()\r\n if not isinstan...
[ "0.7110897", "0.6849487", "0.6503301", "0.61512494", "0.61512494", "0.60071385", "0.5982181", "0.59683037", "0.5945177", "0.5940623", "0.59356564", "0.5918351", "0.5888679", "0.58608896", "0.58577836", "0.58559006", "0.5855422", "0.58526754", "0.58373266", "0.58249384", "0.58...
0.71465963
0
Expand the init state parameter into the full state vector.
def _state_from_init(self, init_state: np.ndarray): assert ( self._init_space.shape == self._state_space.shape ), "Must override _state_from_init if init state space differs from state space!" return init_state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_state(self) -> None:\n self.state = np.zeros(self.shape, dtype=int)", "def from_vect(self,instate):\n instate = np.reshape(instate,self.shape())\n statearr = self.to_array()\n statearr.values = instate\n self.update(statearr.to_dataset(dim='variable'))", "def initial...
[ "0.6210097", "0.6167448", "0.60694176", "0.6065781", "0.60387975", "0.5996124", "0.5950681", "0.5912217", "0.5912217", "0.5912217", "0.5912217", "0.5912217", "0.5912217", "0.5912217", "0.5912217", "0.5912217", "0.5912217", "0.5912217", "0.5912217", "0.5912217", "0.5912217", ...
0.63458675
0
Initialize animation. Called by first render call.
def _init_anim(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n super().__init__()\n self._active = False\n # Counter, used in the animation\n self._time = 0\n # Store the current image id, initially it's 'default'\n self._image = 'default'", "def _init_frame(self : \"animation\",\n init_frame...
[ "0.69974357", "0.6579405", "0.6547325", "0.64473146", "0.64049774", "0.6344792", "0.6333705", "0.63244337", "0.6236016", "0.6223936", "0.62055165", "0.6190619", "0.61838394", "0.6117025", "0.61123455", "0.6103143", "0.61002237", "0.6091002", "0.6068729", "0.6032386", "0.60151...
0.8126538
0
Update animation. Called by each render call. Skips certain number of simulation steps per frame to achieve 60 Hz output.
def _update_anim(self): if self._skip_frames > 1: # Do not render while _skip_frames is > 1 self._skip_frames -= 1 else: # Render frame self._visualization.taskMgr.step() # Calculate number of frames that need to be skipped self._sk...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid_animation_quick(self, frames, iterations=10, fps=0.02, figsize=(6, 6)):\r\n color_map = matplotlib.colors.ListedColormap(['white', 'black'])\r\n\r\n fig, ax = plt.subplots(figsize=figsize)\r\n\r\n for r in np.arange(0, iterations):\r\n ax.cla()\r\n ax.axes.grid(F...
[ "0.67353886", "0.6680484", "0.66650397", "0.66557145", "0.66444975", "0.6517887", "0.649021", "0.64420825", "0.64265084", "0.6239542", "0.6208433", "0.6200715", "0.6192603", "0.61721265", "0.6136987", "0.6074246", "0.60647804", "0.6064689", "0.60567117", "0.6033081", "0.59899...
0.7681746
0
A main thread that focuses soley on grabbing frames from a camera, limited only by self.fps Thread is created at startThread, which can be called by setPaused Thread is ended only at endThread
def __videoThread(self): self.frameList = [] fpsTimer = FpsTimer(self.fps) printf("Starting videoStream thread.") while self.running: fpsTimer.wait() if not fpsTimer.ready(): continue if self.setCamera is not None: self.__setNewCamera(self.setC...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n if BaseCamera.thread is None:\n BaseCamera.last_access = time.time()\n\n # start background frame thread\n BaseCamera.thread = threading.Thread(target=self._thread)\n BaseCamera.thread.start()\n\n # wait until frames are available\...
[ "0.7088039", "0.69147956", "0.6765443", "0.64327663", "0.64192265", "0.638756", "0.6384798", "0.6164235", "0.6132149", "0.61036897", "0.6100919", "0.6074926", "0.5999895", "0.59563357", "0.5916945", "0.58964497", "0.588757", "0.5865779", "0.58643776", "0.5859386", "0.5821989"...
0.7575143
0
Load sweet datasets. Sweetlead is a dataset of chemical structures for approved drugs, chemical isolates from traditional medicinal herbs, and regulated chemicals. Resulting structures are filtered for the active pharmaceutical ingredient, standardized, and differing formulations of the same drug were combined in the f...
def load_sweet(featurizer='ECFP', split='index', reload=True, frac_train=.8, data_dir=None, save_dir=None, **kwargs): # Load Sweetlead dataset logger.info("About to load Sweetlead dataset.") SWEET_tasks = ["task"] if data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_sba_datasets(dbm, direc):\n foia_504_1991_present = pd.read_excel(direc + 'FOIA - 504 (FY1991-Present).xlsx')\n foia_7a_1991_1999 = pd.read_excel(direc + 'FOIA - 7(a) (FY1991-FY1999).xlsx', skiprows=1)\n foia_7a_2000_2009 = pd.read_excel(direc + 'FOIA - 7(a)(FY2000-FY2009).xlsx', skiprows=1)\n ...
[ "0.5910811", "0.58030725", "0.5660123", "0.5597031", "0.5595254", "0.5586176", "0.5569032", "0.55044585", "0.5473611", "0.54603606", "0.5439093", "0.54336035", "0.5362078", "0.53447014", "0.5343428", "0.5316086", "0.5292347", "0.52869546", "0.52805156", "0.5272248", "0.527162...
0.64931226
0
Test adding a class to widget without preexisting class attribute
def test_add_class_to_empty_widget(): widget = forms.CheckboxInput(attrs={}) new_class = "new-class" expected = {"attrs": {"class": "new-class"}} result = add_class(widget.__dict__, new_class) assert result["attrs"] == expected["attrs"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_class_to_widget_with_class():\n widget = forms.CheckboxInput(attrs={\"class\": \"old-class\"})\n new_class = \"new-class\"\n expected = {\"attrs\": {\"class\": \"old-class new-class\"}}\n result = add_class(widget.__dict__, new_class)\n assert result[\"attrs\"] == expected[\"attrs\"]", ...
[ "0.741316", "0.6779076", "0.67461246", "0.638963", "0.63019997", "0.61572343", "0.6032029", "0.6026303", "0.6026303", "0.59760284", "0.5943312", "0.59246916", "0.59152126", "0.5820595", "0.57375777", "0.57242674", "0.570726", "0.5699915", "0.5699915", "0.5669875", "0.5648169"...
0.7792497
0
Test adding a class to widget with preexisting class attribute
def test_add_class_to_widget_with_class(): widget = forms.CheckboxInput(attrs={"class": "old-class"}) new_class = "new-class" expected = {"attrs": {"class": "old-class new-class"}} result = add_class(widget.__dict__, new_class) assert result["attrs"] == expected["attrs"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_class_to_empty_widget():\n widget = forms.CheckboxInput(attrs={})\n new_class = \"new-class\"\n expected = {\"attrs\": {\"class\": \"new-class\"}}\n result = add_class(widget.__dict__, new_class)\n assert result[\"attrs\"] == expected[\"attrs\"]", "def test_add_widget_classes_simple()...
[ "0.77393425", "0.6972124", "0.6752947", "0.67016345", "0.6452122", "0.6351119", "0.6323454", "0.62827134", "0.62827134", "0.616877", "0.6088557", "0.59887946", "0.59715176", "0.5937744", "0.5933207", "0.59048957", "0.5755267", "0.57037884", "0.569965", "0.56985956", "0.569054...
0.7889995
0
Test widget is not a checkbox
def test_widget_is_not_checkbox(): form = ExampleForm() field = form["text"] assert is_checkbox(field) is False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_widget_is_checkbox():\n form = ExampleForm()\n field = form[\"checkbox\"]\n assert is_checkbox(field) is True", "def is_checkbox(field):\n return isinstance(field.field.widget, forms.CheckboxInput)", "def _create_boolean_widget(self,frame,name,widget_options):\n # CB: might be neces...
[ "0.78761363", "0.6998184", "0.66463333", "0.6511762", "0.63926727", "0.6291336", "0.6278951", "0.6221354", "0.61232686", "0.60545945", "0.6017455", "0.6001514", "0.5926528", "0.59030956", "0.59027416", "0.590179", "0.5807385", "0.5779362", "0.5761654", "0.575948", "0.5743314"...
0.82168114
0
Test widget is a checkbox
def test_widget_is_checkbox(): form = ExampleForm() field = form["checkbox"] assert is_checkbox(field) is True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_widget_is_not_checkbox():\n form = ExampleForm()\n field = form[\"text\"]\n assert is_checkbox(field) is False", "def is_checkbox(field):\n return isinstance(field.field.widget, forms.CheckboxInput)", "def _create_boolean_widget(self,frame,name,widget_options):\n # CB: might be nece...
[ "0.77814716", "0.7657677", "0.71951646", "0.7108259", "0.69604677", "0.6959242", "0.69066095", "0.6904737", "0.6780216", "0.6775661", "0.6465918", "0.63346624", "0.6301999", "0.62279457", "0.6089126", "0.60698724", "0.60291535", "0.6010922", "0.59529585", "0.59443384", "0.593...
0.84474516
0
Remove trailing company labels. Rule
def eliminate_company_labels(coname): company_eliminations = ('llp', 'llc', 'plc', 'limited', 'bv', 'gmbh', 'sa', 'inc') regex = re.compile('\W(' + '|'.join(company_eliminations) + ')\W?$') if len(coname.split(' ')) > 2: coname = regex.sub('', coname) return coname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_rule_for_company(text: str) -> str:\n match = re.search(LABEL_SPECIFICATION[\"RE_COMPANY_PRIMARY\"], text)\n if not match:\n match = re.search(LABEL_SPECIFICATION[\"RE_COMPANY_SECONDARY\"], text)\n if match:\n text = match.group(\"label\").strip()\n if len(text) > 1:\n ...
[ "0.7212325", "0.6618307", "0.6285967", "0.6285967", "0.592417", "0.5615679", "0.55322164", "0.5510219", "0.5489993", "0.5487208", "0.548587", "0.5438026", "0.5347555", "0.53363866", "0.53179765", "0.53119785", "0.52540267", "0.51799643", "0.51637065", "0.5151782", "0.5139857"...
0.791277
0
Returns a squared loss function for dnn to tree distillation.
def create_dnn_to_tree_squared_loss_fn(n_classes): def _dnn_to_tree_squared_loss(dnn_logits, tree_logits, example_weights): return head_lib._mean_squared_loss( # pylint: disable=protected-access labels=_logits_to_label_for_tree(dnn_logits, n_classes), logits=_logits_to_label_for_tree(tree_logits...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def l2_loss(embedding, tree, dist_function): \n # split tensor shape = (num_vertices, dim) into num_vertices number of tensors shape = (dim).\n embedding_tuple = torch.split(embedding, 1) \n \n # loss function is the sum of l2 norm (no sqrt) between the space distance and tree distance \n ...
[ "0.6345418", "0.6089642", "0.604723", "0.6034086", "0.6028389", "0.599274", "0.5869035", "0.5813661", "0.5807285", "0.5803496", "0.5777334", "0.5717182", "0.5707835", "0.5707232", "0.5666614", "0.56508774", "0.564901", "0.56327903", "0.55825174", "0.5579805", "0.5578603", "...
0.7447281
0
Returns a cross entropy loss function for dnn to tree distillation.
def create_dnn_to_tree_cross_entropy_loss_fn(n_classes): def _dnn_to_tree_cross_entropy_loss(dnn_logits, tree_logits, example_weights): if n_classes == 2: return head_lib._log_loss_with_two_classes( # pylint: disable=protected-access labels=_logits_to_label_for_tree(dnn_logits, n_classes), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_entropy_loss():\n return nn.CrossEntropyLoss()", "def loss_fn(outputs, labels):\n return nn.CrossEntropyLoss()(outputs, labels)", "def loss_fn(pred: torch.Tensor, truth: torch.Tensor):\n\n if truth is None or pred is None:\n return None\n\n return CrossEntropyLoss()(pred, truth)", ...
[ "0.72981083", "0.66527283", "0.63461035", "0.6343372", "0.62758875", "0.6175301", "0.61639184", "0.61602235", "0.6094912", "0.60944366", "0.6080397", "0.6054565", "0.60013235", "0.6001276", "0.5999888", "0.59844524", "0.5914654", "0.58692825", "0.58543164", "0.58519185", "0.5...
0.72756386
1
Create a basic tree with a battery to blackboard writer and a battery check that flashes the LEDs on the mock robot if the battery level goes low.
def tutorial_create_root() -> py_trees.behaviour.Behaviour: root = py_trees.composites.Parallel( name="Tutorial Two", policy=py_trees.common.ParallelPolicy.SuccessOnAll( synchronise=False ) ) topics2bb = py_trees.composites.Sequence(name="Topics2BB", memory=True) bat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, battery_size=75):\n self.battery_size = battery_size", "def __init__(self, battery_size=75):\n self.battery_size = battery_size", "def __init__(self, battery_size= 75):\n self.battery_size = battery_size", "def __init__(self, battery_size=70):\r\n\t\tself.battery_size ...
[ "0.5643367", "0.5643367", "0.5608296", "0.5592562", "0.5592101", "0.5592101", "0.5592101", "0.55572146", "0.55461454", "0.5498106", "0.54959106", "0.54520214", "0.5431685", "0.5410982", "0.54064524", "0.5403356", "0.53872925", "0.5385211", "0.5373222", "0.5351197", "0.5318733...
0.6854869
0
Read the path of the local database specified in the config file. An error will be raised if there is no such database, or more than one. This function is used by the "caldb" script and the set_local_database() function here.
def get_db_path_from_config(): if not globalConf.sections(): raise OSError("Cannot read config file.") databases = parse_databases() db_path = None for db in databases: if db[0] == LocalDB: if db_path is None: db_path = db[1] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDBPath():\n return os.path.join(CONFIG_DIR, CONFIG_DICT['common']['local_db'])", "def read_db():\n # read config file\n config = configparser.ConfigParser()\n config.read_file(open(\"options.cfg\"))\n\n return config['DEFAULT']['DatabaseFilename']", "def get_path_db():\n\taiqc_config = ge...
[ "0.7601635", "0.75734", "0.72934604", "0.71561885", "0.7063485", "0.6992215", "0.6971256", "0.6971256", "0.67331797", "0.663469", "0.6604691", "0.6503781", "0.64978737", "0.64587384", "0.6458058", "0.64289236", "0.638937", "0.63717663", "0.6280685", "0.62532043", "0.6071763",...
0.8613067
0
Initialize the calibration databases for a PrimitivesBASE object.
def init_calibration_databases(inst_lookups=None, procmode=None, ucals=None, upload=None): # Read the mdf_dict file and create an actual dict with the complete # paths to each of the MDF files try: masks = import_module('.maskdb', inst_lookups) mdf_dict = getat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_initialization_process():\n\n db1 = Database('TOBACCO_RAW;')\n con1, cur1 = db1.connect()\n cur1.execute('create index idl_doc_field_id_idx on idl_doc_field(id);')\n cur1.execute('create index idl_doc_id_idx on idl_doc(id);')\n add_timestamp_to_idl_doc()\n\n create_utf_text_files()\n\n ...
[ "0.6023248", "0.60092384", "0.5815747", "0.5811158", "0.578031", "0.5776491", "0.5769026", "0.5710211", "0.5708011", "0.56971985", "0.56527954", "0.5638689", "0.5624701", "0.56140167", "0.5595212", "0.55946684", "0.5583777", "0.55719703", "0.55538756", "0.55204964", "0.550002...
0.61077964
0
Parse the databases listed in the global config file. This returns a list provided information on how to build the cascase of databases, but does not instantiate any CalDB objects, so it can be used by the caldb script efficiently.
def parse_databases(default_dbname="cal_manager.db"): db_list = [] calconf = get_calconf() if not calconf: return db_list upload_cookie = calconf.get("upload_cookie") # Allow old-format file to be read try: databases = calconf["databases"] except KeyError: databases =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_databases():\n config = load_config()\n\n databases = [x for x in config.keys() if \"schemas\" in config[x]]\n return databases", "def config_parsing(configfile):\n config = ConfigParser.ConfigParser()\n config.read(configfile)\n db_connection = config.get('app:main', 'database_connect...
[ "0.71556365", "0.63972634", "0.6315254", "0.6269479", "0.6201598", "0.61059517", "0.6039825", "0.6018042", "0.5927069", "0.58826655", "0.58598214", "0.58555484", "0.5853016", "0.58385587", "0.5826395", "0.5825476", "0.5823567", "0.5823567", "0.58104885", "0.5800547", "0.57913...
0.7657391
0
User helper function to define a local calibration database based on the "dragonsrc" config file. Returns A LocalDB object
def set_local_database(): load_config() db_path = get_db_path_from_config() db = LocalDB(db_path, log=None) return db
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_local_database(db_file_path):\n conn = sql.connect(db_file_path)\n cur = conn.cursor()\n\n table = str('CREATE TABLE app_config ('\n 'ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,'\n 'Name TEXT UNIQUE NOT NULL,'\n 'Value TEXT);')\n cur.ex...
[ "0.6375822", "0.62055", "0.61780226", "0.6162955", "0.60500777", "0.6020546", "0.5967176", "0.5930668", "0.59141713", "0.5861882", "0.5850293", "0.5849473", "0.5848049", "0.5810362", "0.578116", "0.577531", "0.5756106", "0.57501054", "0.5743103", "0.57386154", "0.573841", "...
0.7368509
0
Component cannot be built due to its subcomponent remaining input incomplete.
def test_inner_deadlock_of_component(self): a = DummyProducingInputIncompleteBuild(scope="A") try: test = ComponentTest(component=a, input_spaces=dict(input_=float)) except RLGraphBuildError as e: print("Seeing expected RLGraphBuildError ({}). Test ok.".format(e)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_solution_of_inner_deadlock_of_component_with_must_be_complete_false(self):\n a = DummyProducingInputIncompleteBuild(scope=\"A\")\n deadlock_component = a.sub_components[\"dummy-calling-one-api-from-within-other\"]\n # Manually set the must_be_complete flag to false.\n deadlock_...
[ "0.6003138", "0.58036244", "0.57034343", "0.5630467", "0.56166065", "0.5606792", "0.5565328", "0.5564179", "0.5515907", "0.54965544", "0.5484223", "0.53754073", "0.53754073", "0.5374521", "0.5365614", "0.5365614", "0.53653276", "0.53653276", "0.53585935", "0.5328791", "0.5298...
0.69534314
0
Component can be built due to its subcomponent resolving a deadlock with `must_be_complete`.
def test_solution_of_inner_deadlock_of_component_with_must_be_complete_false(self): a = DummyProducingInputIncompleteBuild(scope="A") deadlock_component = a.sub_components["dummy-calling-one-api-from-within-other"] # Manually set the must_be_complete flag to false. deadlock_component.api...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_inner_deadlock_of_component(self):\n a = DummyProducingInputIncompleteBuild(scope=\"A\")\n try:\n test = ComponentTest(component=a, input_spaces=dict(input_=float))\n except RLGraphBuildError as e:\n print(\"Seeing expected RLGraphBuildError ({}). Test ok.\".form...
[ "0.6828113", "0.58759904", "0.5640557", "0.5590499", "0.556272", "0.54919034", "0.5406992", "0.5406992", "0.54033756", "0.5342669", "0.52576536", "0.5213345", "0.5185308", "0.5156774", "0.51279163", "0.51243275", "0.51208884", "0.5092463", "0.5070662", "0.5057657", "0.5054762...
0.7436549
0
Get the uploaded file, execute the dss in the background (multiple executions of the model)
async def exec_dss(req, resp): logger.info("got a request for executing a dss") media = await req.media('files') logger.debug("%s", str(media)) params = json.loads(media['input']['content']) if 'model_name' in media: params['model_run']['model_name'] = media['model_name'].decode() exec_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reaper(self):\n if not self.superuser_request:\n self.abort(402, 'uploads must be from an authorized drone')\n with tempfile.TemporaryDirectory(prefix='.tmp', dir=config.get_item('persistent', 'data_path')) as tempdir_path:\n try:\n file_store = files.FileStor...
[ "0.5591472", "0.5509878", "0.5504769", "0.54786956", "0.547423", "0.54169196", "0.5415467", "0.53959715", "0.53637743", "0.5355542", "0.53186345", "0.5317722", "0.5310746", "0.5300013", "0.5291285", "0.52872956", "0.5278462", "0.5226595", "0.5223359", "0.52202976", "0.5220049...
0.6811003
0
Plots how additional peaks are imputed in input_wavelist from reference_wavelist by WaveCrossValidator
def plot_cross_validator(input_wavelist: WaveList, reference_wavelist: WaveList, results: DataFrame, filename: str, plot_path: str): fig, axs = plt.subplots(nrows=2, ncols=2) # plot peaks after sub_c axs[0, 0].set_title('Peaks in Original Series') axs[0, 0].plot(input_wavelist....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_waveform(self, peaks=[]):\n if peaks is None:\n peaks = []\n data = self.amplitude\n x_axis = range(0, len(data))\n x_axis = [x / self.fs for x in x_axis]\n plt.plot(x_axis, data)\n plt.axhline(self.height)\n for p in peaks:\n plt.axvl...
[ "0.6153209", "0.58707404", "0.57681173", "0.5617294", "0.55997247", "0.5560818", "0.55468017", "0.54887295", "0.5438249", "0.5410866", "0.5409235", "0.53832775", "0.5370036", "0.5339262", "0.5334498", "0.5330733", "0.5290526", "0.52650946", "0.52564365", "0.5254666", "0.52228...
0.7009614
0
Receive data until the specified string of bytes is bytes is found. The needle is not stripped from the data.
def recvuntil(self, needle: bytes) -> bytes: data = b"" # We read one byte at a time so we don't overshoot the goal while not data.endswith(needle): next_byte = self.recv(1) if next_byte is not None: data += next_byte return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_until(self, data):\n\n while not data in self.buff:\n self.buff += self.socket.recv(1024)\n \n pos = self.buff.find(data)\n rval = self.buff[:pos + len(data)]\n self.buff = self.buff[pos + len(data):]\n \n return rval", "def read_until(self, data):\n\n ...
[ "0.7999478", "0.7999478", "0.79382706", "0.7246821", "0.6910376", "0.67496634", "0.6570922", "0.6418232", "0.64071643", "0.6406031", "0.6261758", "0.6165734", "0.614623", "0.607534", "0.60666174", "0.6056381", "0.6013656", "0.5945416", "0.58822405", "0.5880646", "0.5843492", ...
0.82938015
0
define distance_between function to calculate distance between 2 agents
def distance_between(agents_row_a, agents_row_b): return (((agents_row_a._y - agents_row_b._y)**2) + ((agents_row_a._x - agents_row_b._x)**2))**0.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agent_distance(self, agent):\n if self.type == 'Line':\n return self._line_intersection(self.params, (agent._position.x, agent._position.y))\n elif self.type == 'Circle':\n return self._circle_intersection(self.params, (agent._position.x, agent._position.y))\n elif se...
[ "0.67812973", "0.67544675", "0.6624835", "0.65831345", "0.6558213", "0.6517963", "0.6490686", "0.64873284", "0.64811265", "0.645943", "0.6455973", "0.6448196", "0.6403538", "0.63928527", "0.6379261", "0.6374585", "0.63732916", "0.6372178", "0.63591474", "0.63575906", "0.63536...
0.7354095
0
Prepare the prmtop and inpcrd files of the selected list of spawns.
def prepare_spawns(self, spawns, epoch): sim_count = 1 basedir = os.getcwd() spawn_folder_names = [] for traj_id, frame_id in spawns: logger.info('Building simulation {} of epoch {}'.format(sim_count, epoch)) folder_name = 'e{:02d}s{:02d}_{}f{:04d}'.format(epoch,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prep_data(self, num_processes):\n filenames = os.listdir(self.beatmaps_root)\n processes = []\n for i in range(num_processes):\n start = i * (len(filenames) // num_processes)\n end = None\n if i != num_processes - 1:\n end = (i + 1) * (len(fi...
[ "0.5822994", "0.5640463", "0.5550681", "0.5531895", "0.545077", "0.5334903", "0.5310665", "0.52848184", "0.5238615", "0.51830214", "0.5171756", "0.516098", "0.515843", "0.5146447", "0.5145911", "0.51302344", "0.5127587", "0.51138264", "0.5095258", "0.50653327", "0.50255686", ...
0.66021925
0
Create a bash script to run the jobs locally in the GPUs Requires pmemd.cuda_SPFP to be installed and in the $PATH bash environment variable.
def run_GPUs_bash(self, folders, run=True): if type(folders) == str: folders = glob(folders) elif type(folders) == list: pass else: raise ValueError('folders must be of type str or list') bash_cmd = "export CUDA_VISIBLE_DEVICES=0\n" bash_cmd +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_gpu_cuda_code() -> None:\n if get_from_environ(\"DISABLE_GPU_FOR_TESTING\") is not None:\n print(\"GPU payload disabled for testing\")\n return\n\n # if the command exists it can run on the hardware below\n proc = subprocess.Popen([\"nvidia-smi\"], stdout=subprocess.PIPE)\n stdou...
[ "0.58565634", "0.5829015", "0.56408805", "0.5608197", "0.5572243", "0.5511401", "0.5470014", "0.54624295", "0.5433461", "0.5427186", "0.54209", "0.54072654", "0.54013383", "0.5391396", "0.5360414", "0.5359389", "0.5348898", "0.5342166", "0.5309496", "0.5298081", "0.52940387",...
0.67427
0
Create symlinks between all the files inside the generator folders provided as a glob string and the input folder destination
def move_generators_to_input(self, generator_folder_glob): spawn_folder_names = [] generator_folders = glob(generator_folder_glob) for i, folder in enumerate(generator_folders): base_name = 'e01s{:02d}_{}f0000'.format(i + 1, os.path.basename(folder)) input_destination = o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_franny_symlinks(src_dirs, out_dir):\n\n for path, dirs, files in chain.from_iterable(os.walk(path)\n for path in src_dirs):\n print('Looking in %s' % path)\n for sta in ['NS12', 'NS13', 'NS14']:\n for filename in fnmatch.filter(fi...
[ "0.71133333", "0.65588665", "0.65161", "0.64801997", "0.6456491", "0.6369632", "0.6306505", "0.627164", "0.6246197", "0.619943", "0.6190338", "0.6169204", "0.6164171", "0.6154397", "0.6095598", "0.60587347", "0.6024996", "0.59829164", "0.5939647", "0.59356904", "0.59115773", ...
0.72281915
0
Move the Production.nc files inside each of the folders passed as a glob to their own subfolders inside the self.app.data_folder directory.
def move_trajs_to_folder(self, input_folders): if type(input_folders) == str: input_folders = glob(input_folders) elif type(input_folders) == list: pass else: raise ValueError('input_folders must be of type str or list') data_folder = os.path.abspath(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data_in_folder(self):\n print('loading files in data folder')\n n = len(self.filenames)\n idx_max = n // self.batch_size\n for idx in range(0, idx_max-1):\n data = []\n for f in self.filenames[idx:idx+64]:\n img = cv2.imread(f, int(self.colo...
[ "0.6202731", "0.6148555", "0.6145362", "0.61036813", "0.6101068", "0.60603684", "0.5980905", "0.5971773", "0.59518343", "0.5937501", "0.5891356", "0.5873109", "0.58078676", "0.5791588", "0.57874477", "0.57657754", "0.57594436", "0.57572466", "0.5714175", "0.56791556", "0.5661...
0.7128477
0
Fit the adaptive model onto the trajectories
def fit_model(self): logger.info('Fitting model') if self.traj_dict is None: self.traj_dict = self.get_traj_dict() self.model.fit(self.traj_dict.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit():\n pass", "def fit(self, X):", "def fit(self):\n converge = False\n while not converge:\n converge = True\n for xi, yi in zip(self.X, self.y):\n yhat = self.classify(xi)\n if yhat != yi:\n converge = False\n ...
[ "0.6692488", "0.6590946", "0.6487492", "0.646762", "0.64532554", "0.64378124", "0.6380393", "0.6379069", "0.63625103", "0.63625103", "0.63625103", "0.6333218", "0.6333218", "0.6333218", "0.6333218", "0.6333218", "0.6333218", "0.6333218", "0.6333218", "0.6333218", "0.6333218",...
0.72130895
0
get one line from the socket
def get_line(sock): # from red/pie getLine (redis) # yy=atpic.log.setname(xx,'get_line') line = b"" while True: next_byte = sock.recv(1) # read a byte if next_byte == b"\r": # if it's end of line, break break line += next_byte # otherwise, is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_line(self):\r\n line = \"\"\r\n while not line[-2:] == \"\\r\\n\":\r\n char = self.sock.recv(1)\r\n if not char:\r\n raise SocketClosedException\r\n line += char\r\n return line.strip()", "def recvline(self):\n return self.recv...
[ "0.803798", "0.78673536", "0.78072685", "0.75777656", "0.75243616", "0.75243616", "0.7488651", "0.71590877", "0.71435183", "0.7124684", "0.71031475", "0.7009135", "0.7001291", "0.69961816", "0.6950862", "0.6938723", "0.6819079", "0.67579776", "0.67553467", "0.6735071", "0.667...
0.83299303
0
command is one of 'incr' or 'decr'
def incrdecr(con,command,key,value=1): # yy=atpic.log.setname(xx,'incrdecr') thecommand="{command} {key} {value}\r\n".format(command=command,key=key,value=value) con.send(thecommand.encode('utf-8')) line=get_line(con) # atpic.log.debug(yy,line) if line==b'NOT_FOUND': return None else...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _incrdecr(self, cmd, key, delta):\n\t\tcheck_key(key)\n\t\tserver, key = yield self._get_server_for(key)\n\t\tif not server:\n\t\t\treturn\n\n\t\tcmd = \"%s %s %d\\r\\n\" % (cmd, key, delta)\n\n\t\ttry:\n\t\t\tyield server.sendall(cmd)\n\t\t\tline = yield server.read_line()\n\t\t\traise StopIteration(int(line)...
[ "0.7011128", "0.660569", "0.6230415", "0.61279076", "0.6108874", "0.602091", "0.5920075", "0.5847304", "0.5772811", "0.57724774", "0.574264", "0.57074124", "0.5691151", "0.567981", "0.5631203", "0.5577918", "0.5520286", "0.5517095", "0.5509518", "0.5490961", "0.54887533", "...
0.76081705
0
scatterplot of color 'color' for the points of L
def plot_points(L, color): X = list() Y = list() for p in L: X.append(p[0]) Y.append(p[1]) plt.scatter(X, Y, c=color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scatterPlot2():\n N = 100\n x = np.random.rand(N)\n y = np.random.rand(N)\n colors = np.random.rand(N)\n\n plt.scatter(x, y, c=colors, alpha=0.5)\n plt.show()", "def plot_colors(rgb_colors):\n nr_dots = len(rgb_colors)\n\n dots = []\n x = []\n y = []\n for i in range(nr_dots)...
[ "0.72418195", "0.704063", "0.66666645", "0.6631968", "0.66311115", "0.66116434", "0.65151936", "0.6427394", "0.6364602", "0.63060814", "0.6267257", "0.62623537", "0.62345916", "0.6197361", "0.61629504", "0.6145779", "0.6065766", "0.604194", "0.6001138", "0.59884024", "0.59615...
0.81629497
0
returns a list of n random points whose (x,y) coordinates make up a shape (n,2) ndarray; the nrandom points must be distinct in order to assign L as input in the algorithm
def scatter_points(n): P1 = np.random.randn(int(np.ceil(n/2)), 2) - 4 P2 = 3 * np.random.rand(int(np.ceil(n/4)), 2) - np.array([10, 0]) P3 = np.random.randn(int(np.ceil(n/4)), 2) + 3 """ P1=np.floor(P1) P2=np.floor(P2) P3=np.floor(P3) """ L = list(np.concatenate((P1,P2,P3), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_points(N): \n x1 = np.random.uniform(-1,1,N)\n x2 = np.random.uniform(-1,1,N)\n return (x1,x2)", "def create_random_points(n):\n\n\treturn [(random.randint(0,n),random.randint(0,n)) for i in range(n)]", "def random_points(N, condition=None):\n\n def stream():\n \"\"\" An in...
[ "0.7717317", "0.76276845", "0.6761621", "0.67410785", "0.6725108", "0.6723394", "0.6693359", "0.66715723", "0.6646731", "0.66218066", "0.6573408", "0.6567307", "0.6556614", "0.64901435", "0.64619774", "0.64348775", "0.6433242", "0.6387248", "0.6371732", "0.6369228", "0.636034...
0.77319294
0
function returning the points from the list L situated on the left side of the line passing through p of direction v p = point on the line, v=directional vector of the line p and v are (2,) ndarrays
def side_points(p, v, L): u = np.array([-v[1], v[0]]) # positive normal of v: N = list() # list of points on one side of the line p,v: for k in range(len(L)): if (L[k] - p).dot(u) >= 0: N.append(L[k]) return N
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_verts(v_l, v_r):\n\n\t\tv_l = v_l%chain.length\n\t\tv_r = v_r%chain.length\n\n\t\tpoints = []\n\t\tcoords = list(chain.coords)\n\t\tif v_r > v_l:\n\n\t\t\tfor i in range(1, len(coords)):\n\t\t\t\n\t\t\t\tpd = LineString(coords[:i+1]).length\n\n\t\t\t\tif pd > v_l and pd < v_r:\n\t\t\t\t\tpoints.append(coor...
[ "0.71643597", "0.7128908", "0.68142533", "0.67079157", "0.65747714", "0.6572509", "0.6561779", "0.6409816", "0.63894665", "0.6302099", "0.62836653", "0.62619257", "0.6258987", "0.6258032", "0.62064075", "0.6179941", "0.61505497", "0.6107346", "0.6048671", "0.6048366", "0.6010...
0.7856908
0
finds the next point of the convex hull; p = curent point; v= direction of support line; (p, v) defines the support line trough p of direction v; L = list of points on the left side of the support line; where the new point of the convex hull is searched for;
def next_in_hull(p, v, L): N = normalize(p, L) if N != []: q = N[0] index = 0 for k in range(1, len(N)): if (N[k] - q).dot(v) >= 0: # points on support line included q = N[k] index = k return index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convex_hull(L):\r\n CH=list()\r\n if L != []:\r\n P = list(L)\r\n # find the starting point of the algorithm and add it to the convex hull:\r\n ind0 = find_start(P)\r\n CH.append(P.pop(ind0))\r\n # find the next point and add it to the convex hull list CH:\r\n if...
[ "0.7018159", "0.64776105", "0.6332543", "0.6327088", "0.6299082", "0.62214756", "0.62113076", "0.61873055", "0.61550856", "0.61229056", "0.60984683", "0.602469", "0.59836024", "0.5978045", "0.5922133", "0.59168583", "0.591337", "0.5874701", "0.58707666", "0.5819191", "0.58015...
0.7877421
0
the main function returning corner points of the convex hull of L
def convex_hull(L): CH=list() if L != []: P = list(L) # find the starting point of the algorithm and add it to the convex hull: ind0 = find_start(P) CH.append(P.pop(ind0)) # find the next point and add it to the convex hull list CH: if P != []: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convex_hull(l):\n\tpass", "def convex_hull(points):\n\n # Sort the points lexicographically (tuples are compared lexicographically).\n # Remove duplicates to detect the case we have just one unique point.\n points = sorted(set(points))\n\n # Boring case: no points or a single point, possibly repe...
[ "0.7802536", "0.7609912", "0.71923506", "0.71395326", "0.7121198", "0.70486236", "0.70343816", "0.70062226", "0.69616634", "0.6932975", "0.68979055", "0.68684614", "0.6862273", "0.6788088", "0.67031807", "0.6696616", "0.6694903", "0.66554326", "0.6629436", "0.66106343", "0.65...
0.778182
1
Screens summary file to identify bins with particular thresholds of completeness, contamination, and contigs.
def parse_summary(infile, completeness, contamination, contigs, binpath, outfile): failed, passed = [], [] with open(infile, 'r') as fhin, open(outfile, 'a') as fhout: next(fhin) for line in fhin: if len(line.split('\t')) > 12: cols = line.split('\t') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bins(self):\n\n \n for filename in ['data/population_padang_1.asc', \n 'data/test_grid.asc']: \n \n R = read_coverage(filename)\n \n min, max = R.get_extrema() #use_numeric=True)\n \n for N in [2,3,5,7,10,16]:\n ...
[ "0.59393805", "0.5846943", "0.5824251", "0.57082117", "0.56558704", "0.55968004", "0.5595293", "0.5591168", "0.5585121", "0.5570465", "0.5558383", "0.55573976", "0.55197114", "0.5517921", "0.5517921", "0.5517653", "0.54925233", "0.5462388", "0.541623", "0.5410834", "0.5406046...
0.64799595
0
Test PBAlignFiles.__init__() with a reference repository.
def test_init(self): # Without region table p = PBAlignFiles(self.inputFileName, self.referencePath, self.outputFileName) self.assertTrue(filecmp.cmp(p.inputFileName, self.inputFileName)) self.assertTrue(p.referencePath, path.abspath(path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init_region_table(self):\n # With an artifical region table\n regionTable = path.join(self.rootDir, \"data/lambda.rgn.h5\")\n p = PBAlignFiles(self.inputFileName,\n self.referenceFile,\n self.outputFileName,\n reg...
[ "0.62803483", "0.60776395", "0.6074035", "0.60606027", "0.6036678", "0.6020233", "0.59328747", "0.5792134", "0.5783295", "0.57514167", "0.5745627", "0.5695448", "0.5677711", "0.5663948", "0.5652757", "0.5641693", "0.5638307", "0.56356263", "0.560679", "0.55909425", "0.5560872...
0.7788326
0
Test PBAlignFiles.__init__() with a region table.
def test_init_region_table(self): # With an artifical region table regionTable = path.join(self.rootDir, "data/lambda.rgn.h5") p = PBAlignFiles(self.inputFileName, self.referenceFile, self.outputFileName, regionTable) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init(self):\n # Without region table\n p = PBAlignFiles(self.inputFileName,\n self.referencePath,\n self.outputFileName)\n self.assertTrue(filecmp.cmp(p.inputFileName, self.inputFileName))\n self.assertTrue(p.referencePath, path.a...
[ "0.79167587", "0.6060171", "0.5885254", "0.58226097", "0.57932025", "0.5701988", "0.5682602", "0.56778866", "0.56713814", "0.56369597", "0.56369597", "0.56369597", "0.56369597", "0.56369597", "0.56369597", "0.56369597", "0.56369597", "0.56369597", "0.56369597", "0.56369597", ...
0.87365645
0
Method to initialize apscheduler
def initialize_scheduler(self): scheduler = BackgroundScheduler() scheduler.add_job(self.do, 'interval', minutes=1) scheduler.start() self.do()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_scheduler(self):\n self._sched = BackgroundScheduler()\n self._sched.add_job(self._check_rain, trigger='cron', minute='*/5')\n self._sched.start()", "def __init__(self):\n try:\n self.scheduler = ap_scheduler\n except Exception as e:\n logger_obj...
[ "0.7957172", "0.7594884", "0.7511692", "0.7477816", "0.74715924", "0.74572617", "0.71291786", "0.7065361", "0.7037644", "0.6962178", "0.6906121", "0.68748313", "0.6815364", "0.67771685", "0.6687212", "0.66796535", "0.65879136", "0.654168", "0.6524913", "0.6480765", "0.6468428...
0.8041467
0
Gets the (sub)sequence where the last element is less, greater or equal to target according to the sequence's order. If extend = True and the sequence's next element would contain more elements before the target this
def get_subsequence(self, target, extend=True): # get the index i of hypothetical position in sorted sequence i = bisect.bisect_left(self.sequence, target) if i: # i is max index but here might be more elements <= target if i == len(self.sequence) and extend: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand(sequence1: \"Sequence\", sequence2: \"Sequence\") -> \"Sequence\":\n if sequence1.start <= sequence2.stop:\n return Sequence(sequence1.start, sequence2.stop)\n else:\n return Sequence(sequence2.stop, sequence1.start)", "def find_period_below(self, start, end, target...
[ "0.5086548", "0.50799274", "0.50425124", "0.50191414", "0.49865168", "0.4884031", "0.48734006", "0.48432878", "0.48029026", "0.4758451", "0.47282988", "0.4662645", "0.46440113", "0.46426633", "0.46387488", "0.46369892", "0.45993978", "0.4573143", "0.45452526", "0.45346263", "...
0.79104257
0
Compute the log likelihood under Poisson distribution log poisson(k, r) = log(r^k e^(r) / k!) = k log(r) r log k! log poisson(k, r=exp(l)) = k l exp(l) lgamma(k + 1)
def poisson_log_likelihood(x, log_rate): return x * log_rate - np.exp(log_rate) - lax.lgamma(x + 1.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_poisson(k, l):\n return k*np.log(l) -l - gammaln(k+1)", "def LLR_poisson(k, mu0, b=0, EPS=1e-15):\n muhat = k - b # maximum likelihood non-negative truncated estimate\n muhat[muhat < EPS] = 2*EPS\n\n # Log-likelihood (density) ratios\n # -2[ Log(l(mu_0)) - Log(l(muhat))]\n LLR = 2*(mu0 ...
[ "0.85983634", "0.71267134", "0.70490605", "0.70171106", "0.70030177", "0.70030177", "0.70030177", "0.69289047", "0.6853471", "0.68229437", "0.6710962", "0.66251004", "0.6608753", "0.66048336", "0.66042256", "0.6581323", "0.655466", "0.6473782", "0.6455808", "0.64403427", "0.6...
0.8131659
1
Loglikelhood under a multidimensional Gaussian distribution with diagonal covariance. Returns the loglikelihood for the multidim distribution.
def diag_multidim_gaussian_log_likelihood(z_u, mean_u, logvar_u, varmin): return np.sum(diag_gaussian_log_likelihood(z_u, mean_u, logvar_u, varmin), axis=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GSM_log_likelihood(X, model):\n D, M = X.shape\n k = model.mix.shape[0]\n log_likelihood = 0\n for i in range(M):\n logpdf_X = 0\n for j in range(k):\n mvn = multivariate_normal(cov=model.cov[j, :])\n logpdf_X = mvn.logpdf(x=X[:, i]) * model.mix[j]\n log_l...
[ "0.67399085", "0.6726065", "0.6718359", "0.6690975", "0.6636074", "0.6582468", "0.6578395", "0.64080966", "0.63837916", "0.6369224", "0.63582486", "0.63048327", "0.6293092", "0.6288842", "0.6270701", "0.6242738", "0.6236148", "0.61677235", "0.6166594", "0.6087776", "0.6073809...
0.7078497
0
Sample KL between gaussian and gaussian mixture many times and average. See comments for kl_sample_gmm for full explanation.
def kl_samples_gmm(keys_sx2, q_mean_u, q_logvar_u, gmm_resps_c, gmm_p_mean_cxu, gmm_p_logvar_cxu, varmin): sample_kl = batch_samples_kl_sample_gmm kl_samples = sample_kl(keys_sx2, q_mean_u, q_logvar_u, gmm_resps_c, gmm_p_mean_cxu, gmm_p_logvar_cxu, varmin) kl = np.mean(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kl_sample_gmm(key, q_mean_u, q_logvar_u,\n gmm_resps_c, gmm_p_mean_cxu, gmm_p_logvar_cxu, varmin):\n\n # Handle case of one gaussian in the mixture with closed form equations.\n if gmm_resps_c.shape[0] == 1:\n return np.sum(kl_gauss_gauss(q_mean_u, q_logvar_u,\n ...
[ "0.8097279", "0.7002909", "0.6963438", "0.6866689", "0.63551277", "0.6180908", "0.6121434", "0.60961425", "0.591781", "0.59088385", "0.5886838", "0.58702284", "0.5850443", "0.58495057", "0.5838542", "0.5781357", "0.57350236", "0.57018584", "0.5690899", "0.56901944", "0.567265...
0.74375826
1
Seeks to each file in an archive and yields its size.
def files_in_archive(fd: BinaryIO) -> Iterable[int]: _check_next_bytes(fd, ARCHIVE_MAGIC, 'archive magic number') while True: # In some archives, the first file ends with an additional \n. If that # is present, skip it. if fd.read(1) != b'\n': fd.seek(-1, 1) # Each...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_package_iter(self):\n files = list()\n futures = list()\n\n amount = 0\n for file in self.file_iterator:\n if amount + self._estimate_file_size(file) > self.max_size:\n if len(files) == 0: # This file is too large for one archive, special handling\n ...
[ "0.66372603", "0.6201361", "0.62012774", "0.6083263", "0.60582364", "0.5977691", "0.59540606", "0.5874965", "0.58564705", "0.5831442", "0.5831299", "0.5737863", "0.57123107", "0.5696928", "0.56868017", "0.56639326", "0.5650282", "0.5596777", "0.55928975", "0.55735", "0.557074...
0.7121256
0
Reads a nullterminated string from the provided file descriptor.
def read_c_string(fd: BinaryIO) -> bytes: string = bytearray() while True: byte = fd.read(1) if not byte or byte == b'\0': return bytes(string) string += byte
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def netstring_readfd(fd, max_length=0):\n read_func = lambda length: os.read(fd, length)\n return _netstring_read(read_func, max_length)", "def read_string(stream, size):\n\t\n\tvalue = ''\n\tif size > 0:\n\t\tvalue = stream.read(size)\n\t\tvalue = value.partition(chr(0))[0]\n\treturn value", "def read_str(s...
[ "0.68129843", "0.64159715", "0.60958624", "0.6073359", "0.6067506", "0.60660225", "0.6050458", "0.60482794", "0.6025416", "0.5936739", "0.58037686", "0.57951295", "0.57093495", "0.56588453", "0.56097895", "0.5587004", "0.557562", "0.5544384", "0.5524973", "0.551961", "0.54665...
0.74095106
0
Peeks at the next bytes to see if they match the expected.
def _bytes_match(fd: BinaryIO, expected: bytes) -> bool: try: offset = fd.tell() data = fd.read(len(expected)) fd.seek(offset) return data == expected except IOError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasNextByte(self) -> bool:\n raise NotImplementedError", "def any_equal_block(b: bytes) -> bool:\n b = [b[i:i + 16] for i in range(0, len(b), 16)]\n return len(set(b)) != len(b)", "def _get_next_packet(self):\n offset_check = self.packet_counter * CsvAbstractReader.BUFFER_SIZE\n ...
[ "0.61394197", "0.58342236", "0.572061", "0.5706022", "0.5685208", "0.5665679", "0.5650298", "0.56094944", "0.55495685", "0.5529557", "0.55083495", "0.549685", "0.5470431", "0.539034", "0.5367962", "0.53483605", "0.5337731", "0.53350985", "0.5328996", "0.53174484", "0.53155714...
0.6764772
0
Returns a dict of structs used for converting bytes to integers.
def _determine_integer_format(self) -> Dict[int, struct.Struct]: endianness_byte = self._elf.read(1) # e_ident[EI_DATA] (endianness) if endianness_byte == b'\x01': endianness = '<' elif endianness_byte == b'\x02': endianness = '>' else: raise FileDeco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dict_of_int2(self):\n pass", "def to_int(data):\n return {int(k): data[k] for k in sorted(data.keys())}", "def decode_map(as_bytes: typing.List[int]) -> dict:\n raise NotImplementedError()", "def get_dict_of_bytes2(self):\n pass", "def decd(binary):\n result = {}\n whi...
[ "0.68280524", "0.6609406", "0.6602328", "0.6484319", "0.6250697", "0.6064725", "0.60590786", "0.59368396", "0.5923957", "0.588018", "0.58635813", "0.58271354", "0.5778409", "0.5752742", "0.57432646", "0.5733445", "0.5670739", "0.56411225", "0.5570107", "0.5546325", "0.5546187...
0.7155724
0
Reads the section headers to enumerate all ELF sections.
def _list_sections(self) -> Iterable['Elf.Section']: for _ in _elf_files_in_archive(self._elf): reader = FieldReader(self._elf) base = reader.read(FILE_HEADER.section_header_offset) section_header_size = reader.offset( SECTION_HEADER.section_header_end) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sections(self, elf_file_path):\n section_names = []\n try:\n output = subprocess.check_output([self.readelf_path, '-SW', elf_file_path])\n output = bytes_to_str(output)\n for line in output.split('\\n'):\n # Parse line like:\" [ 1] .note.android...
[ "0.72855216", "0.69050896", "0.6674625", "0.6245168", "0.61457765", "0.5947562", "0.5752167", "0.55844647", "0.5572117", "0.55539584", "0.5457647", "0.54557514", "0.5420563", "0.5410607", "0.53924954", "0.5369167", "0.5365167", "0.5286985", "0.5227172", "0.5214238", "0.521347...
0.7331083
0
Returns the section that contains the provided address, if any.
def section_by_address(self, address: int) -> Optional['Elf.Section']: # Iterate in reverse to give priority to sections with nonzero addresses for section in sorted(self.sections, reverse=True): if address in section.range(): return section return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_section_containing(self, addr):\n for s in self.sections:\n if s.contains_addr(addr - self.rebase_addr):\n return s\n\n return None", "def get_range(self, address):\n index = bisect.bisect(self.ranges, MemoryRange.from_addr(address))\n if index >= len(self.r...
[ "0.79777485", "0.65322", "0.6484256", "0.64789987", "0.63290364", "0.6012492", "0.59712535", "0.5960082", "0.59520346", "0.59450305", "0.58924216", "0.58774364", "0.5858443", "0.5850265", "0.58319354", "0.58101404", "0.57845306", "0.57845306", "0.57655644", "0.57516944", "0.5...
0.84220016
0
Dumps a binary string containing the sections matching the regex.
def dump_sections(self, name: Union[str, Pattern[str]]) -> Dict[str, bytes]: name_regex = re.compile(name) sections: Dict[str, bytes] = {} for section in self.sections: if name_regex.match(section.name): self._elf.seek(section....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def objdump_section(elf_path, section):\n assert isinstance(elf_path, str), 'ELF path must be str'\n assert section in SECTIONS, 'Not a vaild section'\n\n # Print the symbol table entries of the file. (-t)\n # Decode (demangle) low-level symbol names into user-level names. \n cmd = ['objdump', '-t',...
[ "0.5618182", "0.52968454", "0.5151692", "0.50999147", "0.50382054", "0.50097686", "0.48782483", "0.48392582", "0.4833646", "0.4833251", "0.4806635", "0.4752081", "0.4741569", "0.47281152", "0.47145468", "0.4710047", "0.46879074", "0.4660579", "0.46327552", "0.46313748", "0.46...
0.5936862
0
Returns the total nonnegative information theory entropy, give the number of observations for each different group
def entropy(group_counts): total = sum(group_counts) entro = 0 for item_count in group_counts: entro += item_entropy(item_count, total) return entro
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(Y):\n\n temp = np.unique(Y, return_counts=True)\n uniq_Y = list(temp[0])\n Y_count = list(temp[1])\n \n total = sum(Y_count)\n\n ent = 0\n for elem in uniq_Y:\n prob = Y_count[uniq_Y.index(elem)] / total\n # print(\"prob:\", prob)\n ent -= (prob * (math.log2(pr...
[ "0.70600384", "0.68918896", "0.68384033", "0.67932045", "0.67821366", "0.6753284", "0.673469", "0.67291254", "0.66924876", "0.6660583", "0.6636825", "0.6634891", "0.662265", "0.65900844", "0.65794265", "0.6562032", "0.65568435", "0.6515372", "0.650739", "0.64776325", "0.64713...
0.777499
0
Returns the nonnegative information theory entropy for a single item, give the number of observations of this item and the total number of observations.
def item_entropy(item_count, total_count): # Two cases where the entropy is 0 if item_count == total_count or item_count == 0: return 0 item_prob = 1.0 * item_count / total_count return -item_prob * math.log(item_prob)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(self):\n raise NotImplementedError", "def entropy(self):\n return self._normal.entropy()", "def entropy(group_counts):\n total = sum(group_counts)\n entro = 0\n for item_count in group_counts:\n entro += item_entropy(item_count, total)\n return entro", "def nats(s...
[ "0.685057", "0.672762", "0.6655158", "0.6543229", "0.64860266", "0.6456368", "0.63764286", "0.63019365", "0.6282704", "0.62645656", "0.6252446", "0.62362313", "0.62137896", "0.6163142", "0.61288327", "0.61129856", "0.60930246", "0.6091678", "0.60855293", "0.6058805", "0.60244...
0.70089054
0
Make Dataset with separate questions after cleaning them
def makedata(): # train print('Clean Train Dataset and separate questions') df = pd.read_csv(TRAIN_DATASET).replace(np.nan, ' ') t = df.shape[0] * 2 print t df['question1'] = cleanText(df['question1']) df['question2'] = cleanText(df['question2']) df.to_csv(os.path.join(rootpathdata_clea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_questions(self, number_of_questions):", "def _filter_unanswerable_samples(self):\n a = []\n q = []\n annotations = []\n for i in range(len(self.answers)):\n if len(self.answers[i].nonzero()) > 0:\n a.append(self.answers[i])\n q.append(s...
[ "0.6497021", "0.6374592", "0.63526404", "0.63425726", "0.60416114", "0.6011495", "0.59849167", "0.5970139", "0.59679186", "0.59492254", "0.59333664", "0.5916948", "0.5895329", "0.5882728", "0.5866233", "0.5852494", "0.578167", "0.57745177", "0.57384783", "0.57150567", "0.5704...
0.72315687
0
Helper function to get the dates out of the beautifulsoup response object
def get_dates(soup): return [res.get_text() for res in soup.find_all('a', attrs={'href':re.compile('/events/')})]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_listing_date(soup, dates):\r\n pdate = soup.find_all(name = 'div', class_='pdate')\r\n for i in pdate:\r\n # input(i)\r\n text = i.get_text()\r\n date = text.split(':')\r\n date = date[2:3]\r\n\r\n dates.append(date)\r\n\r\n return dates", "def parse_dates(pag...
[ "0.7227621", "0.71890837", "0.69590205", "0.68518174", "0.6651197", "0.66487515", "0.6525932", "0.6520851", "0.6460153", "0.64458275", "0.63115686", "0.62843174", "0.6270317", "0.62502563", "0.62217456", "0.621551", "0.60811263", "0.6070497", "0.60091525", "0.5976291", "0.597...
0.75097996
0
Helper function to impute the dates from the proboxingodds website into the tables that contain the fights.
def impute_dates(tables, dates): new_fights = [] for idx, date in enumerate(dates): if date == 'FUTURE EVENTS': break tables[idx]['Date'] = date for table in tables[:-1]: fights = [table[x:x+2] for x in range(0, len(table), 2)] for idxf, fight in enumerate(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_proboxingodds(soup):\n tables = []\n site = pd.read_html(str(soup))\n for idx, table in enumerate(site):\n if idx == 0:\n pass\n elif idx % 2 != 0:\n sliced = table[(table['Unnamed: 0'].str.contains(':')) | (table['Unnamed: 0'] == 'UTC')]\n sliced =...
[ "0.65812904", "0.5443871", "0.536314", "0.5343846", "0.52965736", "0.52789164", "0.52286977", "0.5214561", "0.5166764", "0.5133594", "0.5110339", "0.5098538", "0.50696176", "0.50583833", "0.5039751", "0.5029864", "0.5022725", "0.5017969", "0.49726832", "0.4966863", "0.4928293...
0.74339116
0
Creates a unique fight ID from combining the names of both fighters and the dates, without spaces or special characters. This should work with rematches well. A potential edge case, but one we probably won't run into, is two fights with fighters of the same name fight on the same date.
def impute_fightID(fight): red = fight.at[0, 'Fighter'] blue = fight.at[1, 'Fighter'] date = fight['Date'][0] fight_id = red + blue + date fight_id = fight_id.strip('-,').replace(' ', '') fight.at[0, 'fight_id'] = fight_id fight.at[1, 'fight_id'] = fight_id return fight
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_random_fightID():\n pass", "def create_id(uid, begintime, endtime):\n allowed_chars = string.ascii_lowercase[:22] + string.digits\n temp = re.sub('[^{}]'.format(allowed_chars), '', uid.lower())\n return re.sub('[^{}]'.format(allowed_chars), '', uid.lower()) + str(arrow.get(begintime).timestam...
[ "0.538992", "0.51855546", "0.51556164", "0.5067941", "0.5064117", "0.5042174", "0.49878252", "0.49513406", "0.49481347", "0.49373364", "0.4870385", "0.4864954", "0.4862721", "0.48584658", "0.48499587", "0.48478696", "0.48476604", "0.48139304", "0.4779611", "0.4775464", "0.477...
0.6535847
0
Returns the index used for the unknown token.
def unk_index(self) -> int: return self._unk_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unk_token(self):\r\n if self._unk_token is None:\r\n logger.error(\"Using unk_token, but it is not set yet.\")\r\n return self._unk_token", "def _value_token_index(self):\n # TODO: memoize this value\n for i, token in enumerate(self.tokens):\n if not token.ty...
[ "0.72003436", "0.6942262", "0.68594867", "0.67493963", "0.6612994", "0.6493423", "0.6222837", "0.619791", "0.61259353", "0.6096506", "0.6081844", "0.60786164", "0.605654", "0.60505426", "0.59887683", "0.5978605", "0.59053624", "0.5880216", "0.5852015", "0.5846026", "0.5835553...
0.76617646
0
Returns the index used for the endofsentence token.
def eos_index(self) -> int: return self._eos_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_of_text_token(self) -> str:\n return self._end_of_text_token", "def get_last_sentence_end(text: str) -> int:\n end = -1\n for e in sentence_ends:\n p_end = [m.end() for m in re.finditer(e, text)]\n end = max(end, p_end[-1] if len(p_end) > 0 else -1)\n return end", "def eos...
[ "0.69489163", "0.6631694", "0.65316284", "0.62150425", "0.614985", "0.6049897", "0.5994448", "0.5987369", "0.5985675", "0.59603405", "0.59585285", "0.5903485", "0.58980507", "0.58945006", "0.5892147", "0.5859628", "0.5856385", "0.5851119", "0.5822088", "0.58077884", "0.575548...
0.6858568
1
Returns the index used for padding.
def padding_index(self) -> int: return self._pad_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def padid(self):\r\n return self.word2idx.get(PAD, 0)", "def Offset(self) -> int:", "def Offset(self) -> int:", "def Offset(self) -> int:", "def to_index(self):\r\n return (BOARD_HEIGHT - 1 - self.y) * BOARD_HEIGHT + (BOARD_WIDTH - 1 - self.x)", "def idx2off(i):\n return i * 32 - (24 * (...
[ "0.72384465", "0.6775465", "0.6775465", "0.6775465", "0.66019714", "0.65446895", "0.6462349", "0.64010626", "0.6396798", "0.63369316", "0.62652266", "0.6255782", "0.6193014", "0.6142206", "0.6112773", "0.61080986", "0.61021554", "0.61016154", "0.61009765", "0.608965", "0.6088...
0.88537806
0
Returns the index used for masking.
def mask_index(self) -> int: return self._mask_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mask(self):\n return self.mask_index", "def masked_indices(mask):\n\treturn np.nonzero(np.ravel(mask,order='C'))[0]", "def non_masked_indices(mask):\n\treturn np.nonzero(np.ravel(mask-1,order='C'))[0]", "def getMask(self,filt):\n indx = [self.mask[i] for i in xrange(len(self._header)) if fi...
[ "0.8292295", "0.74047023", "0.73821837", "0.70974326", "0.7022145", "0.6828254", "0.67685896", "0.6646346", "0.6616001", "0.65767497", "0.6516475", "0.6475054", "0.63904303", "0.6369527", "0.6369527", "0.6369527", "0.6369527", "0.6355274", "0.6355274", "0.6354276", "0.6346948...
0.88710827
0
This function checks whether suggestions has seed keywords.
def checkSeedKeywordExists(self, keyword, meta_keyword): keyword_ = re.sub('[^A-Za-z0-9]+', '', keyword) split_meta_keyword = meta_keyword.split() condition = False """ splitting meta keyword with space and checking each word from meta keyword exists in the keyword exam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_keyword_present(self,text):\n if self.keywords_re.search(text) and not self.blocked_keywords_re.search(text):\n print self.blocked_keywords_re.search(text)\n return True\n return False", "def IsImportant(self, key):\n\n if any(x.lower() == key for x in se...
[ "0.67313564", "0.6352555", "0.6231023", "0.6097585", "0.59682447", "0.5963816", "0.5954134", "0.5869083", "0.582597", "0.5774812", "0.5728218", "0.57240635", "0.5721389", "0.5718693", "0.5712878", "0.56806475", "0.5676378", "0.5666818", "0.5658296", "0.56458634", "0.56441575"...
0.64882475
1
return list of suggestion based on the geolocation and language for a seed keyword
def fetchSuggestion(self, keyword, seed_keyword, meta_keyword): # user agent is an HTTP browser request header that gives servers information regarding the client device and/or operating system on which the browser is running user_agent_list = [ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSuggestions(self, query): # a suggestions method for all the suggestions\r\n\r\n \r\n suggestions =[] # a new list to add all the suggested words\r\n\r\n j = le...
[ "0.6738755", "0.6267569", "0.6113134", "0.6101123", "0.60902387", "0.5990677", "0.59711504", "0.587386", "0.5791649", "0.57696", "0.56940883", "0.5677929", "0.55937487", "0.5584599", "0.5582483", "0.55783206", "0.5576299", "0.5575877", "0.55594164", "0.5540818", "0.5529013", ...
0.6916142
0
checks json file exists in a path
def doesJsonFileExists(json_filename): return os.path.exists(json_filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_file_exists(self):\n self.assertTrue(os.path.exists(\"file.json\"))", "def add_json_file_path(self):\n found = False\n for folder in json_folders:\n try_path = os.path.join(folder, 'part{}.json'.format(self.cbg))\n self.logger.debug(f'Considering path {try_path...
[ "0.81270504", "0.76794165", "0.7592552", "0.74362725", "0.7244022", "0.7100581", "0.6954963", "0.6929455", "0.6871901", "0.684659", "0.68414944", "0.6825681", "0.68075573", "0.6801073", "0.67956764", "0.6789363", "0.67673874", "0.676294", "0.6748578", "0.6748486", "0.67347926...
0.83387053
0
Return all URLs available on a webpage when given an URL
def urls_in_url(url): global url_to_check_manually try: """Return all URLs when given an url""" html = urlopen(url) bsObj = BeautifulSoup(html.read(), "lxml") list_url = [] for link in bsObj.find_all('a'): sublink = link.get('href') try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_urls(url):\n try:\n #sock = urllib2.urlopen(url)\n result = urlfetch.fetch(url)\n sock = result.content\n parser = URLParser()\n #print sock.read()\n parser.feed(sock.read())\n sock.close()\n parser.close()\n return parser.urls\n except:...
[ "0.78919035", "0.77645457", "0.77268726", "0.75712234", "0.7567013", "0.7351647", "0.73447627", "0.73119706", "0.73077196", "0.7221987", "0.72173417", "0.7216986", "0.7213785", "0.719121", "0.7184347", "0.71809256", "0.71319926", "0.70663166", "0.70220536", "0.70175326", "0.7...
0.7906353
0
Returns a list of slashes indices in a string
def get_all_slash_indices(url): list_slash_indices = [] slash_ndx = 0 while slash_ndx != -1: slash_ndx = url.find('/', slash_ndx + 1) if slash_ndx != -1: list_slash_indices.append(slash_ndx) return list_slash_indices
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_to_index(s):\n s = Unquote(s)\n if s == \".\":\n return ()\n return tuple(s.split(\"/\"))", "def lines(string:str) -> List[int]:\n # find all index with new lines\n return find(string, '\\n')", "def find(string:str, char:str) -> List[int]:\n r...
[ "0.6580785", "0.5898524", "0.58867925", "0.5872233", "0.5859471", "0.5855735", "0.58529186", "0.5785244", "0.5772639", "0.57638735", "0.57608557", "0.575868", "0.5753656", "0.5733558", "0.5691506", "0.5681961", "0.56470704", "0.56438243", "0.5619379", "0.55685306", "0.5564593...
0.73646647
0
yields all nonhypoisomorphic hypo_indicators, each of which is a list of lists, where val = [ihypos], ind = ipatt.
def iter_hypo_indicator(nhypo, n_pattern, n_overlap): # for i, x in enumerate(iter_hypo_indicator(2,6,5)): # print(i, x) base_bag = [[]] base_count = 0 additional_bag =[[]] additional_count = 0 for hypo_base in pattern_hypo_product_space(nhypo, n_pattern): if hypo_indicator_filte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_all_hypo_isomorphic(hypo_indicator, nhypo):\n hypo_ind = [i for i in range(nhypo)]\n for permuted in uperm(hypo_ind):\n perm_hypo_indicator = []\n for li in hypo_indicator:\n if len(li) >= 1:\n perm_li = [permuted[v] for v in li]\n perm_hypo_ind...
[ "0.7172562", "0.57043946", "0.51082957", "0.50979763", "0.5024379", "0.50155944", "0.50155944", "0.5006111", "0.49870583", "0.49818754", "0.49676302", "0.4961464", "0.4960568", "0.4919646", "0.49182004", "0.4864977", "0.4855658", "0.4855658", "0.48522", "0.48485523", "0.48262...
0.67800134
1
Yields all hypo isomorphic indicators of input. Can deal with empty values.
def iter_all_hypo_isomorphic(hypo_indicator, nhypo): hypo_ind = [i for i in range(nhypo)] for permuted in uperm(hypo_ind): perm_hypo_indicator = [] for li in hypo_indicator: if len(li) >= 1: perm_li = [permuted[v] for v in li] perm_hypo_indicator.appen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_hypo_indicator(nhypo, n_pattern, n_overlap):\n # for i, x in enumerate(iter_hypo_indicator(2,6,5)):\n # print(i, x)\n base_bag = [[]]\n base_count = 0\n additional_bag =[[]]\n additional_count = 0\n for hypo_base in pattern_hypo_product_space(nhypo, n_pattern):\n if hypo_in...
[ "0.6780316", "0.59080976", "0.58561957", "0.5720207", "0.56647605", "0.56529135", "0.56529135", "0.54241025", "0.52539307", "0.5200523", "0.51851517", "0.51129967", "0.50811005", "0.5075875", "0.49981025", "0.49817088", "0.49561143", "0.495255", "0.4951932", "0.49485445", "0....
0.7139706
0
Distributed wordcount Flow successfully executes using a Local Dask cluster. The Flow run's state returns word count tuples stored in the state's associated Result object.
def test_mapreduce_wordcount(): state = mapreduce_wordcount.run( url="https://raw.githubusercontent.com/topher-lo/prefect-with-k8/main/src/prefect_kube_demo/data/dream.txt", executor=DaskExecutor(), ) task_ref = mapreduce_wordcount.get_tasks("reducer")[0] result = state.result[task_ref]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_and_get_word_count(self) -> int:\n r = requests.get(self.url)\n if r.status_code != status.HTTP_200_OK:\n raise ScraperException\n soup = BeautifulSoup(r.content, \"html.parser\")\n matches = soup(text=re.compile(f\"{self.word}\"))\n count = 0\n for matc...
[ "0.5197405", "0.51779485", "0.51757103", "0.5119365", "0.5105249", "0.5077378", "0.50673574", "0.5065178", "0.50648814", "0.5048469", "0.50481963", "0.5037075", "0.5012519", "0.5001033", "0.49984887", "0.49640208", "0.49514315", "0.49300393", "0.4928559", "0.49280038", "0.489...
0.6105681
0
return true, if the point x1,y1 is inside the circle
def isInCircle(self,x1,y1,radius1): if(distance(self.x,x1,self.y,y1) < (self.radius+radius1)): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point_inside_circle(x,y,center_x,center_y,radius):\n return (x-center_x)**2 + (y - center_y)**2 < radius**2", "def in_circle(x0, y0, x, y, r):\n return ((x - x0) ** 2 + (y - y0) ** 2) <= (r ** 2)", "def incircle(self,xpos,ypos,cellx,celly):\n xcell, ycell = self.getcellcenter(cellx,celly)\n ...
[ "0.861041", "0.8243542", "0.79211193", "0.7751971", "0.7741259", "0.7626933", "0.74056125", "0.7375218", "0.7361023", "0.7224813", "0.7188712", "0.7184341", "0.71725786", "0.71543485", "0.7150558", "0.7100634", "0.70758194", "0.7064576", "0.7006105", "0.6994791", "0.69880223"...
0.8587801
1
Returns a ist of pairs [name, template] for the given instrument. Templates are defined as JSON objects, with name stored in "reduction/dataflow/templates/..json".
def get_templates(instrument=''): import os, json template_path = os.path.dirname(__file__) template_names = [fn for fn in os.listdir(template_path) if fn.endswith(".json") and fn.startswith(instrument)] templates = dict([(tn[len(instrument)+1:-5], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_template(template, config):\n all_results = {}\n for nodenum, wires in template:\n # Find the modules\n node = template.modules[nodenum]\n module_id = node['module'] #template.modules[node]\n module = lookup_module(module_id)\n inputs = _map_inputs(module, wires)\n ...
[ "0.55452025", "0.5474284", "0.54666585", "0.54315674", "0.5427507", "0.5332231", "0.5303145", "0.52793384", "0.5269707", "0.5265125", "0.52575624", "0.52515024", "0.5250721", "0.5226359", "0.5199281", "0.51346874", "0.5112004", "0.5083223", "0.5079634", "0.50753623", "0.50628...
0.7779888
0
test whether rate article without token will fail.
def test_rate_article_without_token(self): response = self.client.post( self.rate_url, self.rate_details, format='json') self.assertIn( 'Authentication credentials were not provided.', str( response.data)) self.assertEqual(response....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unsuccessful_rating_of_own_article(self):\n response = self.client.post(\n reverse('articles:rate', kwargs={'slug': self.slug}),\n {'rating': None},\n format=\"json\",\n **self.author_headers)\n self.assertEqual(response.status_code, status.HTTP_40...
[ "0.7470178", "0.7465953", "0.7388795", "0.72328603", "0.6636202", "0.65985996", "0.653104", "0.63997334", "0.6340562", "0.61541426", "0.6136993", "0.6135138", "0.608342", "0.6076124", "0.6066384", "0.60158104", "0.60107666", "0.5995916", "0.59279543", "0.5847617", "0.58281684...
0.81620646
0
test whether rate article without article will fail.
def test_rate_article_not_found(self): self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.token) self.rate_details["user"]["slug"] = "-ss-dd-dd-ff" response = self.client.post( self.rate_url, self.rate_details, format='json') self.assertIn( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unsuccessful_rating_of_own_article(self):\n response = self.client.post(\n reverse('articles:rate', kwargs={'slug': self.slug}),\n {'rating': None},\n format=\"json\",\n **self.author_headers)\n self.assertEqual(response.status_code, status.HTTP_40...
[ "0.78261167", "0.7498871", "0.7443131", "0.7402631", "0.7304586", "0.6678314", "0.65706855", "0.6514573", "0.64715177", "0.6429115", "0.639798", "0.6339268", "0.6214938", "0.6198013", "0.6197333", "0.61033016", "0.6053459", "0.5992556", "0.59885514", "0.59804475", "0.5936695"...
0.79441893
0
test whether rate article with invalid data will fail.
def test_rate_article_invalid_rate(self): self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.token) self.rate_details["user"]["rate"] = 7 response = self.client.post( self.rate_url, self.rate_details, format='json') self.rate_details["user"]["...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_rate_article_not_found(self):\n self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.token)\n self.rate_details[\"user\"][\"slug\"] = \"-ss-dd-dd-ff\"\n response = self.client.post(\n self.rate_url,\n self.rate_details,\n format='json')\n ...
[ "0.7321892", "0.7151747", "0.71178585", "0.69698894", "0.69361943", "0.6869482", "0.6740184", "0.66798234", "0.6647462", "0.66111946", "0.65852267", "0.6337533", "0.62674284", "0.620593", "0.6205748", "0.6204665", "0.61944914", "0.61677474", "0.6126372", "0.6076587", "0.60725...
0.8335973
0
test whether rate article with token.
def test_get_rate_article(self): self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.token) self.client.post( self.rate_url, self.rate_details, format='json') self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.token_2) self.rate_detail...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_rate_article_without_token(self):\n response = self.client.post(\n self.rate_url,\n self.rate_details,\n format='json')\n self.assertIn(\n 'Authentication credentials were not provided.', str(\n response.data))\n self.assertEq...
[ "0.7210318", "0.6049662", "0.59960324", "0.59435606", "0.5923598", "0.5863462", "0.5765565", "0.57086027", "0.570428", "0.5696122", "0.56727237", "0.5531006", "0.5477901", "0.54732865", "0.5456026", "0.54417336", "0.54382604", "0.54163957", "0.54120475", "0.54111814", "0.5409...
0.6411341
1
Converts an RFC2253 DN string into an openssl one.
def __rfc_to_openssl(user_dn): dn_parts = [x.strip() for x in user_dn.split(',')] dn_parts.reverse() return '/%s' % '/'.join(dn_parts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_x509_name(name):\n types = {\n 'country_name': 'C',\n 'state_or_province_name': 'ST',\n 'locality_name': 'L',\n 'organization_name': 'O',\n 'organizational_unit_name': 'OU',\n 'common_name': 'CN',\n 'email_address': 'emailAddress'\n }\n\n return...
[ "0.5508678", "0.54845005", "0.5012062", "0.4976776", "0.48952284", "0.4741694", "0.46849376", "0.4653766", "0.46534392", "0.46064866", "0.45833877", "0.4550512", "0.445573", "0.44530204", "0.44428983", "0.44048032", "0.43419307", "0.4334071", "0.43117622", "0.4303301", "0.424...
0.7482935
0
Generate random ping values (in milliseconds) between 5 and 20, some of them will be assigned randomly to a low latency between 100 and 200 with direct close values between 40 and 80
def generate_fake_ping_data(random_state, size): values = random_state.random_integers(low=5, high=20, size=size) picked_low_latency_values_indexes = random_state.choice( size, round(0.001 * len(values)), replace=False ) # Sets the picked value to a random low ping (e.g.: [100, 200]), # and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_packets():\n num_packets = randrange(10)\n temp_packets = []\n for i in range(num_packets):\n temp_packets.append(randrange(1000))\n return temp_packets", "def RandomDelay():\r\n sleep(random())", "def _latency(self):\n\n return\n time.sleep(0.005 + random.rando...
[ "0.6549224", "0.6473065", "0.6374598", "0.63629764", "0.63007534", "0.62886626", "0.62327564", "0.61525434", "0.6147178", "0.5989403", "0.5946946", "0.58974904", "0.58592856", "0.58525425", "0.58462614", "0.57716644", "0.5742075", "0.57388645", "0.5709644", "0.5692329", "0.56...
0.7326371
0
Generate random OCO status, mostly assigned to 200 with some 300 status codes during a random range between 4 and 50 ticks
def generate_fake_oco_status(random_state, size): values = [200] * size picked_error_values_indexes = random_state.choice( size, round(0.001 * len(values)), replace=False ) for index in picked_error_values_indexes: values[index] = 300 _range = range(random_state.random_integers...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_fake_http_status(random_state, size):\n values = [200] * size\n picked_error_values_indexes = random_state.choice(\n size, round(0.0015 * len(values)), replace=False\n )\n picked_zero_values_indexes = random_state.choice(\n size, round(0.001 * len(values)), replace=False\n ...
[ "0.68448544", "0.6299806", "0.6133432", "0.6133432", "0.58981127", "0.57652456", "0.5718969", "0.569057", "0.5639926", "0.55422294", "0.55386275", "0.55349576", "0.5518699", "0.5515259", "0.5515259", "0.550914", "0.54684156", "0.54265535", "0.5388602", "0.5386833", "0.5385256...
0.7287352
0
Generate random database connections mostly between 10 and 20 occurrences, assigned some ticks with a maximum connection pick up to 200
def generate_fake_db_connections(random_state, size): values = random_state.random_integers(low=10, high=20, size=size) picked_max_connections_indexes = random_state.choice( size, round(0.005 * len(values)), replace=False ) for index in picked_max_connections_indexes: # Creates a linear...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_rnd(self):\n\n # query max number of threads\n gennum = apache.AP_MPMQ_MAX_SPARE_THREADS\n # make generators\n # this bit is from Python lib reference\n g = random.Random(time.time())\n result = [g]\n for i in range(gennum - 1):\n laststate = g.g...
[ "0.6073718", "0.5974244", "0.57532966", "0.5751731", "0.572404", "0.57141167", "0.5678083", "0.5616051", "0.5593124", "0.5589323", "0.5562536", "0.55545825", "0.551556", "0.548296", "0.54501927", "0.5440958", "0.5414827", "0.5375403", "0.5371529", "0.5350935", "0.5327943", ...
0.7374885
0
Generate random HTTP Status codes, mostly values will be 200, but some of them will be randomly assigned to a 500 during a random range between 1 and 20 ticks, or 0 (Curl returned value when Web sites are not reachable)
def generate_fake_http_status(random_state, size): values = [200] * size picked_error_values_indexes = random_state.choice( size, round(0.0015 * len(values)), replace=False ) picked_zero_values_indexes = random_state.choice( size, round(0.001 * len(values)), replace=False ) for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_status():\n p = randint(0, 10)\n\n if p < 7:\n return problem(\n status=200,\n title=\"Success\",\n detail=\"Il servizio funziona correttamente\",\n ext={\"result\": \"ok\"},\n headers={\"Cache-control\": \"no-cache\"},\n )\n if ...
[ "0.69940126", "0.69940126", "0.6744241", "0.59974784", "0.59199", "0.5853604", "0.57881576", "0.577729", "0.56888187", "0.56815845", "0.5667696", "0.5632593", "0.5630804", "0.562505", "0.5622406", "0.5615847", "0.5611005", "0.5606759", "0.5598005", "0.5595857", "0.55831283", ...
0.80144393
0
Listens to the Kafka updates and takes in a handler to process the information
def listen(self, handler): try: logger.info('Listening on topic: {}'.format(self.topic)) consumer = KafkaConsumer(self.topic) for msg in consumer: object_dict = self._extract_updated_object(msg) if object_dict: handler(obje...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _subscribe_update_callback(self, client, userdata, message):\n logger.info('Message recieved from {} topic'.format(message.topic))\n payload = message.payload\n try:\n payload_dict = json.loads(payload)\n light_data = payload_dict['current']['state']['desired']\n ...
[ "0.63225055", "0.6289907", "0.6207734", "0.6169839", "0.61065733", "0.6104087", "0.60993975", "0.59799695", "0.5972327", "0.5955253", "0.5955253", "0.5937061", "0.5928503", "0.5820025", "0.5792916", "0.5788568", "0.5752678", "0.57204837", "0.57182246", "0.5712616", "0.5697013...
0.7878974
0
Extracts core object data from Kafka message
def _extract_updated_object(self, msg): value = getattr(msg, 'value', None) if not value: return None str_value = str(msg.value, 'utf-8') payload = json.loads(str_value)['payload'] object_dict = payload['after'] return object_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decodeData(self, msg):\n stream_info = {}\n try:\n # Decode Streaming data\n stream_data = streaming_pb2.MsgProto()\n stream_data.ParseFromString(msg)\n stream_info = {\n \"topic\": stream_data.subject,\n \"timestamp\": str...
[ "0.5814129", "0.57360256", "0.54865336", "0.54360235", "0.5400411", "0.5398354", "0.53759235", "0.5354414", "0.5335589", "0.5330614", "0.53231025", "0.5321129", "0.5255818", "0.52450305", "0.52263457", "0.52176183", "0.5157237", "0.51568544", "0.5147842", "0.51438856", "0.512...
0.6105383
0
Return the Data from the nyc table (listings.csv).
def listings_data(): stmt = db.session.query(nyc).statement df = pd.read_sql_query(stmt, db.session.bind) df["latitude"] = pd.to_numeric(df["latitude"]) df["longitude"] = pd.to_numeric(df["longitude"]) df["accommodates"] = pd.to_numeric(df["accommodates"]) data = df.to_dict(orient='index') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(self, csv_file):\n pass", "def read_csv():", "def loan_data():\n return pd.read_csv(data_path / \"credit_data.csv\")", "def import_data():\n data = pd.read_csv('partA/bikes_October18.csv', ',')\n return data", "def get_data():\n with open(os.path.join('data', 'demo_file....
[ "0.61890984", "0.60342085", "0.60018224", "0.59828407", "0.5916176", "0.5891303", "0.5889863", "0.5724109", "0.56923395", "0.5666559", "0.5636994", "0.5636967", "0.56118476", "0.5610883", "0.56072223", "0.5600865", "0.5569014", "0.5568943", "0.55665857", "0.55617994", "0.5556...
0.6930467
0
Find the nunber of boundary edges that each node participate in. This is stored as a node level attribute 'b_deg' in nodes in g that are part of nbunch
def set_boundary_degrees_old(g, sg): boundary_degree = {} for u in sg.nodes(): boundary_degree[u] = 0 for v in g.neighbors(u): if not sg.has_node(v): boundary_degree[u] += g.number_of_edges(u, v) # for a multi-graph nx.set_node_attributes(sg, values=boundary_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boundary_nodes(G,nbunch):\n eboundary = nx.edge_boundary(nx.Graph(G),nbunch)\n nboundary = []\n for u,v in eboundary:\n if (u in nbunch) and (v not in nbunch):\n if u not in nboundary:\n # avoid duplicate entries\n nboundary.append(u)\n elif (u no...
[ "0.77327895", "0.6465779", "0.64423347", "0.6320274", "0.5931897", "0.5931611", "0.59037197", "0.5835765", "0.5821393", "0.5799897", "0.57672405", "0.57624716", "0.57101005", "0.57058245", "0.5704293", "0.56884634", "0.56703365", "0.5656793", "0.56268764", "0.5616624", "0.560...
0.65483385
1
Samples from an HMM (Gaussian outputs) with provided parameters.
def sample_HMM(parameters, T, seed=None): K = parameters["num_states"] pi_0 = parameters["init_prob"] A = parameters["trans_matrix"] D = parameters["obs_dim"] mean = parameters["mean"] cov = parameters["cov"] np.random.seed(seed) # create empty numpy arrays to store samples state...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian_parameters(h, dim=-1):\n m, h = torch.split(h, h.size(dim) // 2, dim=dim)\n v = F.softplus(h) + 1e-8\n return m, v", "def sample(self, like_params):\n\t\tassert len(like_params) == 1, f\"SphericalGaussianLikelihood only takes\"\\\n\t\t\t\t+ f\" a single parameter. Found {len(like_params)}.\...
[ "0.64712185", "0.6112422", "0.60827136", "0.60287106", "0.60221756", "0.59152335", "0.58934444", "0.5888099", "0.58843905", "0.58335674", "0.58257145", "0.5813412", "0.5784386", "0.5764342", "0.5741552", "0.5711274", "0.57028776", "0.5673057", "0.5638518", "0.5632263", "0.562...
0.6981797
0
Disconnect signals from the control buttons. This must be done before new signals can be added properly.
def _disconnect_buttons(cls): try: cls.btn_startpause.clicked.disconnect() except RuntimeError: pass try: cls.btn_stopsave.clicked.disconnect() except RuntimeError: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _after_disconnect(self):\r\n _debug('GUISignalGenerator: _after_disconnect()')\r\n self.button_sweep.disable()\r\n self.button_reset.disable()\r\n self.button_send_list.disable()\r\n self.button_rf.set_checked(False, block_events=True).disable()\r\n self.number_dbm.dis...
[ "0.7075591", "0.6849481", "0.6808928", "0.675683", "0.6733835", "0.66099083", "0.6497862", "0.649399", "0.6459956", "0.642244", "0.6315134", "0.63065934", "0.6289942", "0.62833315", "0.62390184", "0.6109949", "0.6098552", "0.6098552", "0.60809314", "0.6066603", "0.606277", ...
0.7565067
0
Set buttons to stoppedclock state.
def _set_mode_stopped(cls): cls._disconnect_buttons() cls.btn_startpause.setText("Start") cls.btn_startpause.setIcon(QIcon.fromTheme("media-playback-start")) cls.btn_startpause.setWhatsThis("Start a new timer.") cls.btn_startpause.clicked.connect(cls.start) cls.btn_stop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pauseRunning(self):\r\n self.start_button['state'] = 'normal'\r\n self.pause_button['state'] = 'disabled'\r\n self.running = False", "def _set_mode_running(cls):\n\n cls._disconnect_buttons()\n\n cls.btn_startpause.setText(\"Pause\")\n cls.btn_startpause.setIcon(QIco...
[ "0.6993939", "0.693941", "0.6659396", "0.66565657", "0.6656494", "0.66300124", "0.6577831", "0.62724304", "0.61642003", "0.615654", "0.6145925", "0.61336136", "0.6110425", "0.60946417", "0.60826224", "0.6073976", "0.6063515", "0.60490686", "0.6044271", "0.6033677", "0.6013967...
0.7900878
0
Set buttons to saveorreset state.
def _set_mode_save(cls): cls._disconnect_buttons() cls.btn_startpause.setText("Reset") cls.btn_startpause.setIcon(QIcon.fromTheme("edit-undo")) cls.btn_startpause.setWhatsThis("Discard time and reset timer.") cls.btn_startpause.clicked.connect(cls.prompt_reset) cls.btn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_buttons_values(self):\r\n pass", "def reset_buttons(self):\n global intervalAdd_\n global intervalDel_\n global annotationAdd_\n global annotationDel_\n\n # self.active_mode = 'default', 'intervalAdd', 'intervalDel'\n if self.active_mode != 'intervalAdd':...
[ "0.76084", "0.65428025", "0.6530788", "0.6467536", "0.64535373", "0.63752264", "0.63124067", "0.6305843", "0.6294539", "0.6227772", "0.62205535", "0.61544055", "0.6147563", "0.61214584", "0.609148", "0.6088591", "0.6075969", "0.6054853", "0.60379755", "0.6025561", "0.60076374...
0.72857726
1
Set buttons to resetprompt state.
def _set_mode_prompt_reset(cls): cls._disconnect_buttons() cls.btn_startpause.setText("Confirm Reset") cls.btn_startpause.setIcon(QIcon.fromTheme("edit-undo")) cls.btn_startpause.setWhatsThis("Discard time and reset timer.") cls.btn_startpause.clicked.connect(cls.reset) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Reset(self):\n self.prompt_str = self.prompt_ev.FirstPromptEvaluator()", "def reset_game_ui(self):\n for button in self.button_list:\n button.configure(state='normal', text='')\n self.instructions.configure(text=self.PROMPT.format(self.players[self.game.whose_turn]))\n self...
[ "0.7271416", "0.69852114", "0.6692109", "0.665375", "0.66360044", "0.6543945", "0.64558303", "0.644347", "0.6367087", "0.6281809", "0.62665826", "0.62448794", "0.61734205", "0.61626613", "0.6158813", "0.6125091", "0.6106521", "0.61056757", "0.61019343", "0.60933787", "0.60886...
0.8170068
0
Set buttons to runningclock state.
def _set_mode_running(cls): cls._disconnect_buttons() cls.btn_startpause.setText("Pause") cls.btn_startpause.setIcon(QIcon.fromTheme("media-playback-pause")) cls.btn_startpause.setWhatsThis("Pause timer.") cls.btn_startpause.clicked.connect(cls.pause) cls.btn_stopsave....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pauseRunning(self):\r\n self.start_button['state'] = 'normal'\r\n self.pause_button['state'] = 'disabled'\r\n self.running = False", "def initialize_buttons(self):\r\n self.start_button = tk.Button(self.master, text='Start', command = self.startRunning)\r\n self.start_butto...
[ "0.69890445", "0.64806527", "0.6479749", "0.64516985", "0.62913656", "0.6268325", "0.62614596", "0.61545545", "0.612091", "0.6110985", "0.6019341", "0.60112214", "0.5980356", "0.5966523", "0.5930903", "0.58914804", "0.58716834", "0.5860595", "0.58567125", "0.5829467", "0.5811...
0.7214415
0
Set buttons to pausedtime state.
def _set_mode_paused(cls): cls._disconnect_buttons() cls.btn_startpause.setText("Resume") cls.btn_startpause.setIcon(QIcon.fromTheme("media-playback-start")) cls.btn_startpause.setWhatsThis("Resume timer from current time.") cls.btn_startpause.clicked.connect(cls.resume) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pauseRunning(self):\r\n self.start_button['state'] = 'normal'\r\n self.pause_button['state'] = 'disabled'\r\n self.running = False", "def set_pause(self, pause):\n\n game_status = self.game.get_game_status();\n if(game_status == GameStatus.NotStarted or game_status == GameS...
[ "0.75215256", "0.7443539", "0.7351155", "0.73039067", "0.72980815", "0.72020006", "0.71098685", "0.7038338", "0.70222014", "0.6805279", "0.67249453", "0.6716562", "0.6697442", "0.6694803", "0.66640294", "0.66182137", "0.6597947", "0.6588095", "0.6575589", "0.65361243", "0.649...
0.7912897
0
Testing Crofton Method on data from Crofton 1971
def test_crofton_method(self): chi_sq = lambda pred, obs: np.sum((obs - pred)**2 / pred) para_crof = np.arange(0, 9) crof = PIHM() # Data from Crofton 1971 st1_obs = np.array([161, 111, 67, 65, 50, 30, 33, 13, 8]) st2_obs = np.array([189, 129, 86, 51, 27, 14, 8, 1, 2]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cockpit_captur_ii() -> None:\n response: models.KamereonVehicleDataResponse = fixtures.get_file_content_as_schema(\n f\"{fixtures.KAMEREON_FIXTURE_PATH}/vehicle_data/cockpit.captur_ii.json\",\n schemas.KamereonVehicleDataResponseSchema,\n )\n response.raise_for_error_code()\n ass...
[ "0.591036", "0.59009093", "0.5780899", "0.5772635", "0.5762341", "0.572158", "0.5605917", "0.5557134", "0.5451257", "0.5441077", "0.5409767", "0.537112", "0.5370728", "0.533519", "0.5321917", "0.5318306", "0.52777225", "0.5264037", "0.5263327", "0.52472895", "0.524456", "0....
0.6492486
0
Description Testing the the Adjei method that we coded gives the same answer as the Adjei method in the book. We know that the Crofton Method works pretty well. These results show that, as far as I can tell, our implementation of the Adjei method is returning pretty similar results to what Adjei is showing for St males...
def test_adjei_method(self): # Specify the Adjei Method Data st_females = np.repeat((0, 1, 2, 3, 4, 5, 6, 7), (201, 114, 63, 37, 19, 5, 3, 4)) st_males = np.repeat((0, 1, 2, 3, 4, 5), (226, 128, 62, 30, 3, 3)) su_females = np.repeat(np.arange(0, 8), (231...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_bias(ds: List[str], predicted: List[GENDER]) -> Dict:\r\n assert (len(ds) == len(predicted)) # must have same length to create tuples\r\n\r\n conf_dict = defaultdict(lambda: defaultdict(lambda: 0))\r\n total = defaultdict(lambda: 0) # increment values if we have any gender\r\n pred_cnt =...
[ "0.5681299", "0.5680674", "0.5543613", "0.55244184", "0.55180955", "0.5492687", "0.54871005", "0.5482099", "0.54445714", "0.5411524", "0.5401268", "0.53899825", "0.5369389", "0.5358834", "0.5356756", "0.5349101", "0.5346479", "0.5338135", "0.53196657", "0.5302856", "0.5299082...
0.6242136
0
Search and return all sub nodes which match the node path. Each element of the list is matched against sub node names of increasing depth. Regular expression pattern matching is used for each name. For example, the list ['sub.', 'level2_name'] will match all nodes whose first level child name matches 'sub.' and whose s...
def matchNodes(self, node_path_list): if type(node_path_list) != type([]): raise TypeError( 'argument not a list: "'+str(node_path_list)+'"' ) nodes = [self,] for pat in node_path_list: cpat = re.compile(pat) new_nodes = [] for nd in nodes: f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node_paths_by_full_object(self, name):\n components = re.split('[\\.:]', name)\n cur_node = self.top\n paths = []\n\n # Handle a case where we may have split things up by wildcard\n if '_' in components[0]:\n (left, right) = components[0].rsplit('_', 1)\n ...
[ "0.63235563", "0.60124", "0.58496034", "0.57926613", "0.5770309", "0.57200235", "0.569196", "0.56852955", "0.53977126", "0.5383091", "0.53375274", "0.5329562", "0.53087634", "0.5284985", "0.52425534", "0.5237866", "0.5201636", "0.51965714", "0.51948684", "0.5189998", "0.51782...
0.62397116
1
Writes this XML node into string form. If the recursive flag is true, writes all subnodes recursively too. The indent string is prepended to each line. Returns the total string.
def toString(self, recursive=True, indent=""): s = indent + '<' + self.name for (n,v) in self.attrs.items(): s = s + ' ' + n + '="' + v + '"' c = self.content.strip() if c or len(self.kids) > 0: s = s + '>\n' if c: s = s + indent + " " + c + '\n' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree_to_string(self, indent):\n\t\ts = self.indent_string(indent) + str(self)\n\t\tfor c in self.child_nodes:\n\t\t\ts += c.tree_to_string(indent + 1)\n\t\treturn s", "def tree_string(self, indent=0): # pragma: no cover\r\n return \"\"", "def dump_internal(self, indent):\n XML_INDENT = 4 # N...
[ "0.7190528", "0.6967208", "0.68142414", "0.6669996", "0.65078336", "0.64969987", "0.63850766", "0.6360391", "0.63594466", "0.63138396", "0.63080406", "0.6300737", "0.6280438", "0.624446", "0.6210749", "0.61899465", "0.61862755", "0.61584604", "0.61571324", "0.61510396", "0.61...
0.71017915
1
The constructor determines the error class used by ElementTree.parse().
def __init__(self): try: # this succeeds with python 2 import StringIO class_StringIO = StringIO.StringIO except Exception: # this succeeds with python 3 import io class_StringIO = io.StringIO # create some XML with an erro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,xmlnode_or_cond,error_type=None,copy=1,parent=None):\n if type(xmlnode_or_cond) is str:\n xmlnode_or_cond=unicode(xmlnode_or_cond,\"utf-8\")\n if type(xmlnode_or_cond) is unicode:\n if not stanza_errors.has_key(xmlnode_or_cond):\n raise ValueErro...
[ "0.71514964", "0.6995184", "0.67318547", "0.6395666", "0.6299641", "0.6046157", "0.60218483", "0.60218483", "0.60218483", "0.59919393", "0.59288156", "0.5885075", "0.58716553", "0.5833256", "0.5825548", "0.5782933", "0.5762098", "0.57318366", "0.57283765", "0.5712078", "0.569...
0.75455344
0
Open the XML file and read its contents into a tree of XmlNode objects. XML errors raise an XmlError exception.
def readDoc(self, filename): try: doc = ET.parse( filename, parser=LineNumberingParser() ) except self.ET_exc_class: raise XmlError( str(sys.exc_info()[1]) ) rootnode = recurse_construct_ET_to_XmlNode( None, doc.getroot() ) return rootnode
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_xml_file(filename):\n###############################################################################\n with __FILE_OPEN(filename) as file_:\n tree = ET.parse(file_)\n root = tree.getroot()\n # End with\n return tree, root", "def read_xml(file_dir):\n tree = ElementTree()\n t...
[ "0.7217277", "0.6876924", "0.6835852", "0.6671871", "0.6551055", "0.6519831", "0.64808804", "0.64725703", "0.63675314", "0.63521695", "0.634969", "0.63359207", "0.6323065", "0.6228589", "0.6217454", "0.61495256", "0.6140192", "0.61397547", "0.6138288", "0.61241144", "0.611509...
0.7357698
0