query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Test concatenating different lines
def test_line_concat(): for _x in range(100): strings = [random_str(30, 50) for _x in range(10)] l_file = random_str(10, 20) l_num = randint(1, 10000) lines = [Line(x, l_file, l_num) for x in strings] # Concatenate the lines l_full = lines[0] for line in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_with_2_lines():\n line = \"n\" * 15 + \"\\n\" + \"n\" * 60 + \" \" + \"n\" * 10\n assert wrap_line(line) == \"n\" * 15 + \" \" + \"n\" * 60 + \"\\n\" + \"n\" * 10", "def test_writer_linebreak():\n GCMT(write=\"on\")\n write_message(100 * \"test\")\n write_message(100 * \" \")", "def tes...
[ "0.67595047", "0.6424525", "0.6362578", "0.6216905", "0.61788297", "0.61623013", "0.61015594", "0.60790586", "0.6044751", "0.60344905", "0.6002795", "0.5997416", "0.5959322", "0.59512234", "0.5943323", "0.5936905", "0.5928723", "0.5908358", "0.5903566", "0.58914983", "0.58786...
0.7924718
0
Run code quality check
def codeqa(): try: sh('flake8 h5_validator') except BuildFailure: pep8_fail = True else: pep8_fail = False try: sh("pydocstyle h5_validator") except BuildFailure: docstring_fail = True else: docstring_fail = False if pep8_fail or docstring_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n coverage = calculate_code_coverage()\n platform = os.uname()[0]\n if coverage < CODE_COVERAGE_GOAL[platform]:\n data = {\n 'expected': CODE_COVERAGE_GOAL[platform],\n 'observed': coverage,\n }\n print '\\033[91mFAIL: %(observed).2f%% does not meet g...
[ "0.690629", "0.68706906", "0.6722863", "0.65503937", "0.65005994", "0.6477863", "0.63772184", "0.634831", "0.6311739", "0.62938887", "0.62822163", "0.6276711", "0.622485", "0.6216071", "0.61776257", "0.61024976", "0.6045385", "0.6026006", "0.60110664", "0.6001104", "0.5978099...
0.7629032
0
Build the Sphinx documentation
def docs(): sh('sphinx-build -W -b html docs docs/_build/html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildDocumentation():\n helptext = 'usage: build_doc.py <output format> <type of documentation>' \\\n '\\n - html: for html output' \\\n '\\n - pdf: for pdf output' \\\n '\\n\\n - all: complete documentation' \\\n '\\n - dev: only developer documentati...
[ "0.82856005", "0.8182243", "0.8095304", "0.7946425", "0.7832293", "0.7674444", "0.7616823", "0.75381774", "0.75381774", "0.740071", "0.73747015", "0.73051", "0.71761566", "0.71276677", "0.70834404", "0.7048519", "0.7046627", "0.7035853", "0.70308214", "0.7026935", "0.7019487"...
0.8379351
0
Renders a dictionary representation of the object that could easily be convered to JSON with ``json.loads()``.
def render_dictionary(self): asset_json = { 'name': self.name, 'product_name': self.product_name, 'product_vendor': self.product_vendor, 'configuration': self.configuration, 'description': self.description, 'primary_users': self.prima...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_dict(dict):\n\t\treturn str.encode(str(dict))", "def render_json(object):\r\n return HttpResponse(jsonify(object), content_type='application/json')", "def render_json(self, obj):\n self.response.content_type = \"application/json\"\n self.response.out.write(json.encode(obj))", "def render(...
[ "0.7367407", "0.67492175", "0.67358476", "0.6567576", "0.6529286", "0.6519356", "0.64581686", "0.6429288", "0.64208597", "0.64208597", "0.6399629", "0.6350041", "0.62529594", "0.6232581", "0.6198037", "0.61974883", "0.61591154", "0.6099933", "0.60915303", "0.6014563", "0.6005...
0.6583367
3
Update an existing asset.
def update_asset(cls, id, asset_data): return ph_base._update_record('asset', id, asset_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self) -> requests.request:\n # Check if id is set\n if self.args.id is None:\n raise Exception('Provide id of asset you want to update')\n\n # Check URL validity\n if self.args.url is not None and self.check_url_invalidity():\n raise Exception('Provided ...
[ "0.69374233", "0.68586016", "0.67037857", "0.67037857", "0.6641486", "0.65909207", "0.653334", "0.63545084", "0.6239145", "0.61992556", "0.6113949", "0.60676587", "0.60544235", "0.6035436", "0.59977174", "0.59583884", "0.593529", "0.5906767", "0.5901882", "0.58826965", "0.579...
0.81140244
0
Constructor for the class. Validates the path to ICDAR 2015 data.
def __init__(self, data_dir, cfg): self.data_dir="" self.core_config = cfg if not self._validate_path(data_dir): raise ValueError("The path is invalid. Either of the following" " could be wrong:\n" "- Path does not exist.\n" "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, path) :\n self.is_calibfile = True\n self.path = path\n self.basename = os.path.basename(path)\n fname, ext = os.path.splitext(self.basename)\n if ext != '.data' :\n self.is_calibfile = False\n logger.debug('File %s extension is not \".da...
[ "0.6948322", "0.65592974", "0.6556877", "0.65249354", "0.65028626", "0.63390756", "0.63309854", "0.63290566", "0.6289687", "0.62791497", "0.626014", "0.6205983", "0.61928284", "0.6183253", "0.61661", "0.61225474", "0.6120086", "0.6120086", "0.6120086", "0.6120086", "0.6115477...
0.5805932
70
Returns a list of file names of train data and test data in a dictionary format
def get_image_ids(self): train_ids = os.listdir(self.tr_img_dir) test_ids = os.listdir(self.te_img_dir) ids = { 'train':train_ids, 'test':test_ids } return ids
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_file_names():\n file_names = {}\n file_names['train'] = ['data_batch_%d' % i for i in xrange(1, 6)]\n file_names['test'] = ['test_batch']\n\n return file_names", "def get_filenames(is_training, data_dir):\n if is_training:\n return [os.path.join(data_dir, 'LIP_train5.record')]\n else:\n...
[ "0.8035756", "0.751047", "0.75051916", "0.7226942", "0.7225778", "0.70814013", "0.70226556", "0.6896401", "0.6858565", "0.68039775", "0.672976", "0.6715424", "0.66022927", "0.66019654", "0.66019654", "0.65624", "0.65359175", "0.65274036", "0.6469011", "0.64363533", "0.6424005...
0.6030486
41
Checks if the number of images is equal to the number of labels in the path. Input
def _check_images_and_labels(self, image_dir, label_dir): return len(os.listdir(image_dir))==len(os.listdir(label_dir))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_images_a_valid():\r\n counter = 0\r\n with os.scandir(os.path.join(dir_path, \"inputs\", \"type_a\")) as filepaths:\r\n for path in filepaths:\r\n extension = os.path.splitext(path)[1].lower()\r\n if extension == \".png\" or extension == \".jpg\":\r\n ...
[ "0.6857187", "0.6778049", "0.6608997", "0.6470868", "0.6470868", "0.6470868", "0.64671683", "0.63645536", "0.6209617", "0.6172412", "0.6172412", "0.6160495", "0.61398166", "0.6118098", "0.60889083", "0.6088829", "0.60738635", "0.6062706", "0.60482156", "0.60111576", "0.601115...
0.7553603
0
Checks path for validity. Returns
def _validate_path(self, data_dir): if (os.path.exists(data_dir) and os.path.isdir(data_dir) and os.listdir(data_dir)): self.tr_img_dir = data_dir + self.TRAIN_IMAGES self.tr_lbl_dir = data_dir + self.TRAIN_LABELS self.te_img_dir = data_dir + self.TE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_validate(path):\n # functionality to be added later\n return path", "def validate_path(validation_context, path):\n\n return _validate_path(validation_context, path)", "def is_valid_path(path):\n if not os.path.exists(path):\n raise IOError(\"{path} is not a valid path\".format(path...
[ "0.8291762", "0.75080806", "0.73476386", "0.73190963", "0.72471076", "0.721788", "0.71793664", "0.71665084", "0.71513087", "0.71494526", "0.7101816", "0.7056333", "0.7036894", "0.7016152", "0.6981587", "0.69524163", "0.69424284", "0.6774768", "0.6774768", "0.67223656", "0.669...
0.0
-1
Given the image and label directories, returns a structured list. Input
def _load_data_worker(self,img_dir,lbl_dir): data = [] for img,lbl in zip(glob(img_dir+"/*.jpg"),glob(lbl_dir+"/*.txt")): im = np.array(Image.open(img)) im = make_square_image_with_padding(im, self.core_config.num_colors) lbl_fh = open(lbl,encoding='utf-8') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_of_data_and_labels():\n list_of_imgs = []\n list_of_img_labels = []\n for root, dirs, files in os.walk(config[\"PathToData\"], topdown=False):\n for f in files:\n ext = os.path.splitext(f)[-1].lower()\n\n if ext in config[\"ValidImageFileExtensions\"]:\n ...
[ "0.7479282", "0.7249914", "0.7160709", "0.714454", "0.71018004", "0.7090322", "0.70697165", "0.70690686", "0.70348674", "0.7027988", "0.6997225", "0.697528", "0.69314796", "0.69178325", "0.6863838", "0.6839108", "0.68099934", "0.68062544", "0.679291", "0.6754475", "0.6735565"...
0.61880404
58
Given the file handle of the file containing image data, it returns a list of the objects contained in the image. Returns objects (list(object)), where object is a dict. Currently, object has only one key, namely 'polygon' which is a list of points in clockwise order.
def _get_objects(self,label_fh): objects = [] for line in label_fh.readlines(): try: object = {} line = line.replace(u'\ufeff', '') if line != '': x1, y1, x2, y2, x3, y3, x4, y4= [int(i) for i in line.split(',')[:-1]] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocessing_objects(img_data, hierarchy_mapping, object_file_name='objects.p'):\n\n object_path_token = \"{0}.{1}.{2}\".format(DATA, VISUAL_GENOME, get_name_from_file(object_file_name))\n\n # Check if pickles are already created\n objects_path = FilesManager().get_file_path(object_path_token)\n\n ...
[ "0.62237", "0.61571246", "0.5929641", "0.59224886", "0.58840525", "0.5877584", "0.5760753", "0.57414246", "0.56997913", "0.56704485", "0.5646486", "0.5590826", "0.55823386", "0.5573562", "0.5562786", "0.5545621", "0.55408007", "0.5518088", "0.5517315", "0.5512284", "0.5482167...
0.69687027
0
Given the list of objects, it returns an array mapping object ids to their respective classes. Background has class 0 and text has class 1.
def _get_object_classes(self,objects): object_class = [1 for object in objects] object_class.insert(0, 0) return object_class
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_class_list(self):\n t = []\n for cls in self.classes:\n if not self.is_opaque(cls.classobj):\n t.append(cls)\n elif cls.parents or cls.childs:\n t.append(cls)\n \n return t", "def process_class_list(self, module, classes)...
[ "0.6236715", "0.6033983", "0.60268164", "0.6010577", "0.59391886", "0.59230375", "0.58449787", "0.5836437", "0.5769628", "0.5737785", "0.5726809", "0.567599", "0.5665862", "0.56647223", "0.56467086", "0.55916905", "0.55804026", "0.55234677", "0.55206275", "0.5503181", "0.5483...
0.64411694
0
Request all pages for an Orders API method call and collect the orders.
def __init__(self, *, deal_id, from_date=None, start_date=None, end_date=None): if from_date is None: from_date = datetime.datetime.now() - datetime.timedelta(days=1) if start_date is None: start_date = datetime.datetime.now() - datetime.timedelta(days=1) if end_date is N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_orders(self):\r\n if self.use_http():\r\n self.enqueue_http_request(\"money/orders\", {}, \"orders\")\r\n else:\r\n self.send_signed_call(\"private/orders\", {}, \"orders\")", "def make_order_request(self, page):\n return api_methods.Orders(\n pag...
[ "0.72840065", "0.7195573", "0.6970942", "0.691573", "0.6880937", "0.6772143", "0.6619889", "0.6590117", "0.6522631", "0.65023965", "0.63879865", "0.6365639", "0.6360118", "0.6322961", "0.6295804", "0.6285402", "0.6189769", "0.61444646", "0.61400586", "0.6137821", "0.61184365"...
0.0
-1
Make an Orders request, store the page count and process the response data.
def first_request(self): response_data = self.make_order_request(1) self.page_count = response_data[self.DATA][self.LAST_PAGE] self.add_orders(response_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_orders(self):\r\n if self.use_http():\r\n self.enqueue_http_request(\"money/orders\", {}, \"orders\")\r\n else:\r\n self.send_signed_call(\"private/orders\", {}, \"orders\")", "def make_order_request(self, page):\n return api_methods.Orders(\n pag...
[ "0.68570167", "0.6552971", "0.61255354", "0.60908", "0.60400605", "0.5982922", "0.584163", "0.58357054", "0.5809135", "0.56956005", "0.56678724", "0.565327", "0.5648753", "0.5642741", "0.56354815", "0.5604037", "0.556626", "0.5559942", "0.5542466", "0.5541483", "0.55298144", ...
0.68449026
1
Add the orders from a the response to an Orders request to self.orders.
def add_orders(self, response_data): orders = response_data[self.DATA][self.DATA] for order in orders: self.orders.append(self.process_order_data(order))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _handle_orders(self, response):\n response_type = response['type']\n state_updated = False\n if response_type == \"subscription_ack\":\n # Insure the subscription details are expected. Don't do anything.\n account_id = response['accountId']\n # TODO: should...
[ "0.69409347", "0.6667287", "0.6545564", "0.6545564", "0.6460046", "0.63917613", "0.6235419", "0.61754966", "0.6097969", "0.60590065", "0.6050112", "0.6049591", "0.60148126", "0.5854137", "0.5701919", "0.5696883", "0.5695405", "0.56953824", "0.56910616", "0.56895924", "0.56578...
0.8209479
0
Return the response to an Orders request for a page of orders.
def make_order_request(self, page): return api_methods.Orders( page=page, per_page=self.PER_PAGE, from_date=self.from_date, start_date=self.start_date, end_date=self.end_date, deal_id=self.deal_id, ).call()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_orders(self, **kwargs) -> ApiResponse:\n return self._request(kwargs.pop('path'), params={**kwargs})", "def request_orders(self):\r\n if self.use_http():\r\n self.enqueue_http_request(\"money/orders\", {}, \"orders\")\r\n else:\r\n self.send_signed_call(\"privat...
[ "0.6947997", "0.65630955", "0.6448705", "0.63800734", "0.63783544", "0.6324955", "0.6280075", "0.6280075", "0.6201901", "0.6172101", "0.6155729", "0.61465985", "0.60682786", "0.6010717", "0.59935415", "0.5976142", "0.5967135", "0.5932509", "0.59092224", "0.58723015", "0.58581...
0.72716135
0
Return a list of customer orders for a Wowcher deal.
def get_orders(*, deal_id, from_date=None, start_date=None, end_date=None): return GetOrders( deal_id=deal_id, from_date=from_date, start_date=start_date, end_date=end_date ).orders
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orders(self):\n big = BigCommerceAPI()\n response = big.get('orders')\n return response.text", "def get_all_orders():", "def get_customer_orders(customerId):\n data = user_obj.get_customer_orders(customerId)\n return data", "def get_orders(self):\n return self.order_lst"...
[ "0.6746684", "0.67401546", "0.6714025", "0.6684619", "0.66433245", "0.64267564", "0.6377362", "0.63373774", "0.63139147", "0.6247727", "0.6187585", "0.6153473", "0.6024592", "0.60072875", "0.5989922", "0.59546804", "0.5934321", "0.58705926", "0.5858453", "0.5852376", "0.58483...
0.6437149
5
Parses command line input.
def parse_input(command_input=None): parser = argparse.ArgumentParser( prog='python3 ok', description=__doc__, usage='%(prog)s [--help] [options]', formatter_class=argparse.RawDescriptionHelpFormatter) testing = parser.add_argument_group('running tests') testing.add_argument...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_and_validate_cmd_line():\n if len(sys.argv) != 4:\n print USAGE_STR.format(sys.argv[0])\n sys.exit()\n # attempt to parse the parameters tell the user and exit if we can't\n num_segments = parse_and_validate_num_segs(sys.argv[1])\n # try to parse numThreads\n num_threads = pa...
[ "0.73941815", "0.72758305", "0.727258", "0.72657984", "0.71461636", "0.7136013", "0.7062772", "0.7039165", "0.70382667", "0.70112026", "0.69986916", "0.69779557", "0.69760764", "0.69672513", "0.6964016", "0.6948586", "0.69387764", "0.6928827", "0.6917919", "0.6890521", "0.687...
0.64560276
83
Run all relevant aspects of ok.py.
def main(): args = parse_input() log.setLevel(logging.DEBUG if args.debug else logging.ERROR) log.debug(args) # Checking user's Python bit version bit_v = (8 * struct.calcsize("P")) log.debug("Python {} ({}bit)".format(sys.version, bit_v)) if args.version: print("okpy=={}".format(c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n # check param and env\n self.sanity_check()\n\n # only-check mode\n if self.module.check_mode:\n self.module.exit_json(**self.result)\n\n self.init_session()\n\n action = self.select_action()\n action()", "def main():\n print(\"Everyth...
[ "0.63339317", "0.6315259", "0.6206181", "0.61156017", "0.60597885", "0.6019551", "0.6006469", "0.5961438", "0.5944583", "0.59101206", "0.5834496", "0.58279663", "0.58071715", "0.5773759", "0.57643145", "0.57619554", "0.57616234", "0.5757995", "0.5738466", "0.57352954", "0.571...
0.6310457
2
Load platform specific file and initialize the environment.
def __init__(self, evaluation_only=False, seed=0): os = platform.system() if os == 'Darwin': file_name = 'Soccer.app' elif os == 'Linux': file_name = 'Soccer_Linux/Soccer.x86_64' self.env = UnityEnvironment(file_name='unity_envs/' + file_name, seed=seed) s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self, name):\n resolvedName = envString.resolve(name)\n configuration = CondorConfig()\n configuration.load(resolvedName)\n self.defaults = {}\n\n if configuration.platform.nodeSetRequired and self.opts.nodeSet is None:\n print(\"error: nodeset parameter requi...
[ "0.68608356", "0.6802685", "0.62055475", "0.6119984", "0.59415346", "0.5895969", "0.5886355", "0.5836531", "0.5830827", "0.5801951", "0.57891726", "0.5788384", "0.5775604", "0.575578", "0.57470727", "0.5726602", "0.572247", "0.57197964", "0.5701453", "0.5701453", "0.5701453",...
0.0
-1
Take a step in the environment.
def step(self, action): actions = action.reshape(2, 2) action = {'GoalieBrain': actions[0], 'StrikerBrain': actions[1]} #action = {'GoalieBrain': [5, 5], 'StrikerBrain': [2, 2]} #print(action) info = self.env.step(action) state0 = info[self.brain_names[0]].vector_observa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self, step=None):\n pass", "def step_env(self, action):\n return self.env.step(action)", "def do_step(self) -> None:", "def step(self, **kwargs):\n pass", "def step(self):\n\n pass", "def step(self, action):\n return self.env.step(action)", "def _step(self) -...
[ "0.7685745", "0.7629445", "0.7529464", "0.7296054", "0.72169346", "0.721042", "0.7190503", "0.71764034", "0.7140125", "0.71323305", "0.7083545", "0.7065156", "0.7063541", "0.7041813", "0.6989212", "0.6989212", "0.69877505", "0.69877505", "0.69284815", "0.69284815", "0.6928481...
0.0
-1
Test case for tarfile bundling and unbundling
def testTarBundling(self): try: tP = os.path.join(self.__workPath, "t0.tar.gz") dirPath = os.path.join(self.__inpDirPath, "topdir") ok = self.__fileU.bundleTarfile(tP, [dirPath], mode="w:gz", recursive=True) self.assertTrue(ok) numBytes = self.__file...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unpack(self):\n if not os.path.isfile(akrr_tar_gz):\n raise Exception(\"Should do test_packager first\")\n \n if os.path.exists(cfg.akrr_home):\n shutil.rmtree(cfg.akrr_home)\n \n if verbosity>=3: print \"\\n\"+\"~\"*80\n \n #start...
[ "0.70526093", "0.6616482", "0.6440095", "0.6328305", "0.6312369", "0.62404823", "0.6202618", "0.6194006", "0.6173202", "0.61719835", "0.6164269", "0.6147481", "0.6141193", "0.6137979", "0.61363333", "0.6133573", "0.60993564", "0.60972047", "0.6089963", "0.6070059", "0.6045629...
0.81422436
0
Test case for a local files and directories
def testGetFile(self): try: remoteLocator = self.__pathPdbxDictionaryFile fn = self.__fileU.getFileName(remoteLocator) # _, fn = os.path.split(remoteLocator) lPath = os.path.join(self.__workPath, fn) ok = self.__fileU.get(remoteLocator, lPath) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_local_path():\n URL_PATH = \"http://www.google.com\"\n URL_PATH1 = \"www.google.com\"\n LOCAL_PATH = \"tests/index.html\"\n\n assert URL_PATH == is_local(URL_PATH)\n assert \"file\" in is_local(os.path.abspath(LOCAL_PATH))\n assert URL_PATH1 == is_local(URL_PATH1)", "def test_localstat...
[ "0.73313636", "0.7188159", "0.695825", "0.6787143", "0.6771463", "0.6653245", "0.6616465", "0.6587311", "0.6548366", "0.65312576", "0.65173066", "0.6496842", "0.6439982", "0.63979846", "0.63523936", "0.63423216", "0.63198483", "0.63086605", "0.626411", "0.625454", "0.6237668"...
0.5888744
71
Test case for a local files and directories
def testGetFileTimeout(self): try: # Test to make sure get request times out fU = FileUtil(timeout=0.00001) remoteLocator = self.__largeHttpsFileUrl fn = fU.getFileName(remoteLocator) lPath = os.path.join(self.__workPath, fn) ok = fU.get(re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_local_path():\n URL_PATH = \"http://www.google.com\"\n URL_PATH1 = \"www.google.com\"\n LOCAL_PATH = \"tests/index.html\"\n\n assert URL_PATH == is_local(URL_PATH)\n assert \"file\" in is_local(os.path.abspath(LOCAL_PATH))\n assert URL_PATH1 == is_local(URL_PATH1)", "def test_localstat...
[ "0.73316145", "0.71883434", "0.6958369", "0.67872584", "0.6771535", "0.6653358", "0.6616581", "0.6587471", "0.65485203", "0.653139", "0.65174043", "0.6497001", "0.6440058", "0.63982666", "0.6352628", "0.6342502", "0.6320098", "0.6308713", "0.62642854", "0.6254613", "0.6237784...
0.0
-1
Test case for copying ("put") and moving ("replace") local files
def testMoveAndCopyFile(self): try: remoteLocator = self.__pathPdbxDictionaryFile fn = self.__fileU.getFileName(remoteLocator) # _, fn = os.path.split(remoteLocator) lPath = os.path.join(self.__workPath, fn) ok = self.__fileU.get(remoteLocator, lPath) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self, src_path: str, tgt_path: str) -> None:", "def _test_upload_dir_contents(self, filenames):\n local_src_dir = self._local_tempdir\n remote_dest_dir = 'remote_dest_dir'\n for filename in filenames:\n self._expected_commands.append('%s cp -a public %s %s' % (\n GSUTIL_LOCATION,\...
[ "0.704788", "0.69124776", "0.68739474", "0.668043", "0.6659431", "0.6645383", "0.6571377", "0.65401155", "0.6499919", "0.64861435", "0.6444862", "0.643904", "0.6436059", "0.6417866", "0.6415396", "0.6408028", "0.6362181", "0.6331619", "0.63206327", "0.63206327", "0.6296442", ...
0.76052755
0
Test case for downloading remote zip file and extracting contents.
def testZipUrl(self): try: remoteLocator = self.__zipFileUrl # fn = self.__fileU.getFileName(remoteLocator) ok = self.__fileU.isLocal(remoteLocator) self.assertFalse(ok) # lPath = os.path.join(self.__workPath, self.__fileU.getFileName(self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(file_url, file_path):\n\n # extract file from the link\n\n if not os.path.exists(file_path):\n os.makedirs(file_path, exist_ok=True)\n \n r = requests.get(str(file_url))\n\n #unzip the zip file\n z = zipfile.ZipFile(io.BytesIO(r.content))\n z.extractall(path = file_path)", "d...
[ "0.7220446", "0.67840797", "0.6767943", "0.67551804", "0.6672871", "0.6658233", "0.6643665", "0.66261744", "0.6577798", "0.65612066", "0.6509779", "0.6480301", "0.6463164", "0.64614177", "0.6453328", "0.6448785", "0.64273727", "0.63947684", "0.6382506", "0.6374403", "0.635807...
0.7367263
0
Test case for downloading remote file ftp protocol and extracting contents.
def testFtpUrl(self): try: remoteLocator = self.__ftpFileUrl # fn = self.__fileU.getFileName(remoteLocator) ok = self.__fileU.isLocal(remoteLocator) self.assertFalse(ok) # dirPath = os.path.join(self.__workPath, "chem_comp_models") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_download(ftp):\n # Active (PORT), Passive (PASV), ExtActive (EPRT), or ExtPassive (EPSV)?\n output, sock, transfer_type = get_transfer_output_and_socket(ftp)\n print_debug(output + \"\\n\")\n\n # What file to download?\n path = raw_input(\"What file do you want to download?\\n> \")\n while...
[ "0.6999721", "0.67185104", "0.66923946", "0.66601884", "0.65115726", "0.64415693", "0.63941395", "0.6366749", "0.63455987", "0.630195", "0.62936544", "0.6291365", "0.62748814", "0.62570983", "0.6231759", "0.62223476", "0.619586", "0.61891216", "0.61566657", "0.6152847", "0.61...
0.70737445
0
Test case remote status
def testRemote(self): try: remoteLocator = self.__httpsFileUrl ok = self.__fileU.isLocal(remoteLocator) self.assertFalse(ok) # ok = self.__fileU.exists(remoteLocator) self.assertTrue(ok) size = self.__fileU.size(remoteLocator) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remote_status():", "def test_get_status(self):\n pass", "def test_get_status(self):\n pass", "def _status(self, host):\n pass", "def test_get_status(self):\n response = self.client.open(\n '/v1/status',\n method='GET')\n self.assert200(response,\...
[ "0.8467461", "0.7772433", "0.7772433", "0.72114366", "0.71598965", "0.7120218", "0.7004518", "0.6897871", "0.6891126", "0.6861016", "0.6772336", "0.6759655", "0.66441166", "0.66350967", "0.6631471", "0.66133004", "0.6611073", "0.6606531", "0.6559803", "0.65338486", "0.6510591...
0.0
-1
Test case for downloading drugbank master xml file
def testGetDrugBankUrl(self): try: remoteLocator = "https://www.drugbank.ca/releases/latest/downloads/all-full-database" un = "username" pw = "password" # fn = self.__fileU.getFileName(remoteLocator) ok = self.__fileU.isLocal(remoteLocator) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_download(self):\n pass", "def test_download1(self):\n pass", "def test_download(self):\n\n # Test for all correct data\n self.assertEqual(\n download(TestSteelEye.url, self.xmlfilepath, \"sourcefile.xml\"),\n self.xmlfilepath + os.sep + \"sourcefile.xm...
[ "0.6421347", "0.64212596", "0.6311387", "0.63003016", "0.6242886", "0.6049877", "0.6037869", "0.6006181", "0.6005711", "0.60036844", "0.5942587", "0.5923996", "0.5913558", "0.5885065", "0.5875526", "0.5875526", "0.58610934", "0.58610934", "0.58446985", "0.5804673", "0.5800375...
0.63819224
2
Test case for extracting contents from xz file
def testXzFile(self): try: remoteLocator = self.__xzFile fn = self.__fileU.getFileName(remoteLocator) lPath = os.path.join(self.__workPath, fn) ok = self.__fileU.get(remoteLocator, lPath) self.assertTrue(ok) ok = self.__fileU.exists(lPath) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unzip_file(self):\n\n # Path to the compressed file\n zipped_file = os.path.join(self.xmlfilepath, \"DLTINS_20210117_01of01.zip\")\n # Test for correct data\n # NOTE : For this test case to pass the source xml zipped file\n # should be present in the download path\n ...
[ "0.62932056", "0.62829584", "0.6257688", "0.6187469", "0.61508626", "0.5973567", "0.5958874", "0.5951237", "0.5783568", "0.56802505", "0.5677763", "0.56722355", "0.56672055", "0.56611294", "0.56451595", "0.5629609", "0.5598541", "0.5586034", "0.5574584", "0.55610496", "0.5551...
0.7376655
0
Activation function of hidden layers.
def forward_hidden_activation(self, X): return np.tanh(X)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_layer_activation(x):\n return x", "def compute_activation(self):\r\n\r\n x=0\r\n edges=self.in_edges\r\n for edge in edges:\r\n x+= edge.source.activation*edge.weight\r\n self.activation=1/(1+exp(-x))", "def __call__(self, inputs):\n return self._hidd...
[ "0.7260774", "0.7122866", "0.7001082", "0.6929951", "0.69202", "0.68869704", "0.68860483", "0.6844513", "0.66774213", "0.66773957", "0.6666057", "0.6664862", "0.66458833", "0.6635408", "0.6609628", "0.6577476", "0.6565831", "0.6560835", "0.65351784", "0.6441285", "0.6438028",...
0.71660954
1
Derivative of the activation function of hidden layers.
def backward_hidden_activation(self, Y, d): # y = tanh(x) ==> dy/dx = (1 - tanh(x)^2) = (1 - y^2) return d * (1 - Y ** 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derivative_activation(z):\n return activation(z) * (1 - activation(z))", "def gradient_hidden(self, h):\n if self.relu:\n return 1.0*(h > 0)\n else:\n return 1 - h * h", "def sigmoid_gradient(z):\n #derivative of sigmoid\n return z * (1 - z)", "def cost_deriva...
[ "0.7980077", "0.6814162", "0.6745424", "0.67276245", "0.6709438", "0.6657668", "0.66385204", "0.66385204", "0.66385204", "0.66385204", "0.66360676", "0.6593483", "0.6587966", "0.65865093", "0.65624034", "0.6561811", "0.6504623", "0.6504623", "0.6497736", "0.6481813", "0.64783...
0.72875506
1
Test the gradient of the activation function.
def test_activation_gradient(): np.random.seed(7477) cnn = CNNTanh([1, 1]) X = np.random.randn(10, 1) Y = cnn.forward_hidden_activation(X) eps = 1e-7 Y1 = cnn.forward_hidden_activation(X + eps) D = cnn.backward_hidden_activation(Y, np.ones_like(Y)) D1 = (Y1 - Y) / eps error = np.abs(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_gradient_convergence(self):\n pass", "def check_layer_gradient(layer, x, delta=1e-5, tol=1e-4):\n output = layer.forward(x)\n np.random.seed(10)\n #output_weight = np.random.randn(*output.shape)\n output_weight = np.ones_like(output)\n #print('output_weight',output_weight)\n\n d...
[ "0.71142787", "0.70332646", "0.6905601", "0.6849363", "0.6837006", "0.68183017", "0.6813721", "0.676131", "0.6752075", "0.6721996", "0.66837656", "0.66234875", "0.6619323", "0.6608141", "0.6590701", "0.6554544", "0.65324926", "0.6527291", "0.648666", "0.6469905", "0.6446868",...
0.78597736
0
Test the gradient of the loss wrt the input.
def test_backward(net, X, Y, grad, loss, index): eps = 1e-7 backup = X[index] X[index] += eps A1 = net.forward(X) loss1 = net.loss(Y, A1[-1]) ratio = (loss1 - loss) / eps assert np.isclose(grad[index], ratio) X[index] = backup
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_layer_gradient(layer, x, delta=1e-5, tol=1e-4):\n output = layer.forward(x)\n np.random.seed(10)\n #output_weight = np.random.randn(*output.shape)\n output_weight = np.ones_like(output)\n #print('output_weight',output_weight)\n\n def helper_func(x):\n output = layer.forward(x)\n ...
[ "0.785574", "0.75234103", "0.7436694", "0.73491436", "0.7223439", "0.7155309", "0.7033458", "0.69945234", "0.69764864", "0.6966695", "0.6894925", "0.688786", "0.68799424", "0.68705493", "0.68545514", "0.683015", "0.68294716", "0.68211085", "0.6799425", "0.67948186", "0.678242...
0.66791236
26
Test the gradient of the loss wrt the parameters.
def test_parameter_gradients(net, X, Y, name, p, grad_p, loss, index): eps = 1e-7 backup = p[index] p[index] += eps A1 = net.forward(X) loss1 = net.loss(Y, A1[-1]) ratio = (loss1 - loss) / eps assert np.isclose(grad_p[index], ratio) p[index] = backup
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_layer_gradient(layer, x, delta=1e-5, tol=1e-4):\n output = layer.forward(x)\n np.random.seed(10)\n #output_weight = np.random.randn(*output.shape)\n output_weight = np.ones_like(output)\n #print('output_weight',output_weight)\n\n def helper_func(x):\n output = layer.forward(x)\n ...
[ "0.74941343", "0.7425341", "0.7355039", "0.7324828", "0.7287194", "0.72620076", "0.7215311", "0.71104115", "0.71081114", "0.7087239", "0.7085801", "0.70754427", "0.697028", "0.6940578", "0.69372624", "0.68951434", "0.68781227", "0.68604034", "0.68522644", "0.6837919", "0.6836...
0.7573967
0
Swaps elements A and B in a list.
def listSwapElement(lst, indexa, indexb): temp = lst[indexa] lst[indexa] = lst[indexb] lst[indexb] = temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _swap(mylist, a, b):\n temp = mylist[a]\n mylist[a] = mylist[b]\n mylist[b] = temp", "def swap(lst, a, b):\r\n temp = lst[a]\r\n lst[a] = lst[b]\r\n lst[b] = temp", "def swap(self, index_a:int, index_b:int):\n if not index_a == index_b:\n self.list[index_a], self.list[in...
[ "0.74426883", "0.72412217", "0.7158518", "0.70567393", "0.67977434", "0.6741206", "0.67259157", "0.6641364", "0.653265", "0.6483142", "0.6444933", "0.64251614", "0.64234024", "0.6352456", "0.632575", "0.6301343", "0.6298016", "0.6295743", "0.6288338", "0.62535304", "0.6230418...
0.73260695
1
Execute a list of plans, this list is returned when solving a task.
def execute_plans(robot, plans): # make sure the robot is actually in the home position # before executing a plan robot.mg.set_joint_value_target( plans[0].joint_trajectory.points[0].positions) robot.mg.go(wait=True) print("Moved to home, start executing task.") # TODO quick fix, add fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def executePlans(update):\n out.header('Executing plans %r\\n' % (update))\n # Finding the functions to call is actually done by a 'iterator' like function in the plangraph module\n while(True):\n # This function either returns None or a tuple just like generate added to it\n p = update.plan...
[ "0.671764", "0.6583761", "0.6341465", "0.6332959", "0.6236808", "0.6156332", "0.6097737", "0.608058", "0.59968126", "0.59372807", "0.5844701", "0.58349496", "0.58101356", "0.5794742", "0.5718878", "0.5680914", "0.5639629", "0.5627402", "0.5588373", "0.55457616", "0.55041856",...
0.7731418
1
read files from fpath with files with globar_year read last
def __init__(self, fpath, prefix, suffix, globar_year=None): self.fpath = fpath prefix_len = len(prefix) suffix_len = len(suffix) self.year = globar_year self.year_str = str(globar_year) # filename example : good_2005_0.pgz files = [f for f in listdir(fpath) if i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files_time_period(prefix, yr_s, yr_e):\n\n # Get path and folder\n path = directories.CLIMATE_DATA + '/'\n folder = os.listdir(path)\n\n # Files should be automatically ordered by year assuming that the format of files is what we expect\n files = []\n\n # List of years to extract\n yea...
[ "0.6266578", "0.60505956", "0.59165275", "0.5740574", "0.56493515", "0.56460744", "0.5643905", "0.5590021", "0.5538595", "0.5510412", "0.54822373", "0.54347944", "0.5395531", "0.53940207", "0.538987", "0.5333563", "0.5311095", "0.5308257", "0.5286535", "0.5268226", "0.5266765...
0.57484096
3
pop the current item
def pop(self): collect() if self.files: f = self.files.pop() logging.info(' in ChunkReader.pop() : trying to open file {0}'.format(f)) with gzip.open(join(self.fpath, f)) as fp: item = pickle.load(fp) logging.info(' in ChunkReader.pop()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def popitem(self):\n pass", "def popitem(self): # real signature unknown; restored from __doc__\n pass", "def popitem(self):\n pass", "def pop(self):", "def pop(self):", "def pop(self):\n pass", "def pop(self):\n pass", "def pop():", "def popitem(self):\n retur...
[ "0.9044336", "0.88296866", "0.8691756", "0.85633534", "0.85633534", "0.82775635", "0.82775635", "0.8271342", "0.820928", "0.8169643", "0.80058616", "0.7982072", "0.7964118", "0.7950116", "0.7908609", "0.7842456", "0.7799259", "0.77935463", "0.7721841", "0.770991", "0.7670644"...
0.0
-1
histories of every run, could be a dictionary, which maps to the according feature?
def __init__(self, report): # number of runs per feature to test self.runs = report.run_num self.histories = report.histories # self.features is a list of features that are tested, e.g. the batch sizes [32, 64, 128, 256] self.features = _get_features()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __generate_all_features_indices__(self):\n features = self.features_dict\n histories = self.histories_dict\n for k in range(self.data.getSentencesSize()):\n sentence = self.data.getSentenceByIndex(k)\n tags = self.data.getTagsByIndex(k)\n for i in range(len...
[ "0.6056517", "0.59034246", "0.5857591", "0.58292913", "0.5825531", "0.5752541", "0.5596086", "0.5571072", "0.5571056", "0.5552829", "0.5549057", "0.5480377", "0.5478585", "0.5469665", "0.5469132", "0.5469132", "0.5469132", "0.5469132", "0.5469132", "0.54583836", "0.5452429", ...
0.0
-1
Given the arguments to the function, we get the correct URL
def test_url_is_constructed_as_expected(self): t = ConfigurableDatasetRequest('SomeCoolSet', dataset_format="json", params=dict(subjectid='45838', locale='eng', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_url(self, *args):\n try:\n url = '/'.join((self.base_url, ) + args)\n except TypeError:\n url = '/'.join((self.base_url, ) + args[0])\n return url.rstrip('/')", "def _get_url(self, *args):\n if self._baseUrl not in args:\n args.insert(0, self._...
[ "0.7645797", "0.7638909", "0.7577513", "0.7393373", "0.73722494", "0.7327712", "0.7027908", "0.70260286", "0.69267625", "0.6849048", "0.6797678", "0.6795056", "0.6784497", "0.67437726", "0.6741606", "0.65788484", "0.6575922", "0.6575922", "0.6574037", "0.65385723", "0.6471492...
0.0
-1
catch the dataset_format if supplied
def test_specify_format(self): t = ConfigurableDatasetRequest('SomeCoolSet', params=dict(subjectid='45838', locale='eng', app_instance_uuid='1234')) self.assertEq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_dataset_format(ds_format):\n if ds_format.lower() not in DATASET_FORMATS.keys():\n raise ValueError(\"dataset_format is expected to be one of %s. '%s' is not valid\" % (\n ', '.join(DATASET_FORMATS.keys()), ds_format,))", "def test_validate_format(self):\n\n class WidgetConfigur...
[ "0.75373226", "0.6840265", "0.639974", "0.63161653", "0.624702", "0.61561465", "0.61417526", "0.6064103", "0.6050765", "0.60221684", "0.59668285", "0.5932532", "0.5918836", "0.590117", "0.58883315", "0.5846453", "0.5828478", "0.5821084", "0.57972646", "0.5792157", "0.5772584"...
0.6831133
2
validate the dataset_format if required
def test_validate_format(self): class WidgetConfigurableDataset(ConfigurableDatasetRequest): VALID_DATASET_FORMATS = ('json', 'xml') t = WidgetConfigurableDataset('SomeCoolSet', params=dict(subjectid='45838', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_dataset_format(ds_format):\n if ds_format.lower() not in DATASET_FORMATS.keys():\n raise ValueError(\"dataset_format is expected to be one of %s. '%s' is not valid\" % (\n ', '.join(DATASET_FORMATS.keys()), ds_format,))", "def validate_dataset(self):\n pass", "def test_with_va...
[ "0.80888414", "0.8075711", "0.74244356", "0.73059523", "0.723934", "0.67029786", "0.66930526", "0.6669346", "0.6654235", "0.656121", "0.65552527", "0.65540296", "0.6495454", "0.63933486", "0.6388005", "0.63615865", "0.63136697", "0.624699", "0.62398094", "0.62203443", "0.6201...
0.741941
3
Deletes a business_report from the table with the specified id
def delete_by_id(id: int) -> List: business_report = BusinessNotificationService.get_by_id(id) if not business_report: return [] db.session.delete(business_report) db.session.commit() return [id]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_incident(self, id):\n sql = f\"DELETE FROM incidences WHERE incidences.id ={id}\"\n conn = Db().con\n curr = conn.cursor()\n curr.execute(sql)\n conn.commit()", "def storage_delete_report(self, report_id):\n self._get_queryset(report_id=report_id).delete()", ...
[ "0.6651148", "0.6608701", "0.64136994", "0.63094574", "0.6274263", "0.61082935", "0.60701895", "0.60681254", "0.6067816", "0.6066621", "0.60407543", "0.6026496", "0.6005154", "0.59901506", "0.59645677", "0.5961449", "0.5950091", "0.5949197", "0.59486943", "0.5945033", "0.5929...
0.69790393
0
Creates a business_report object from the dict TypedDict
def create(new_attrs: dict) -> BusinessNotification: new_business_report = BusinessNotification() db.session.add(new_business_report) db.session.commit() return new_business_report
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, odic):\n return dacite.from_dict(data_class=cls, data=odic)", "def from_dictionary(cls,\r\n dictionary):\r\n if dictionary is None:\r\n return None\r\n\r\n # Extract variables from the dictionary\r\n id = dictionary.get('id')\r\n ...
[ "0.6308779", "0.6164453", "0.60887873", "0.60887873", "0.60887873", "0.60887873", "0.60887873", "0.60887873", "0.60887873", "0.60887873", "0.60887873", "0.60887873", "0.60887873", "0.60887873", "0.60887873", "0.60887873", "0.60887873", "0.60887873", "0.60887873", "0.60887873", ...
0.0
-1
Transforms the dict input for the object. Puts the information in a form that the model can use.
def transform(attrs: dict) -> dict: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _from_dict_transform(cls: Type[TElementSubclass], data: Dict[str, Any]) -> Dict[str, Any]:\n if 'application' in data:\n data['created_by'] = data.pop('application')\n\n if 'added_timestamp' in data:\n data['created_ts'] = data.pop('added_timestamp')\n\n if 'created_t...
[ "0.59881914", "0.5939356", "0.5853741", "0.5765246", "0.5671295", "0.56686765", "0.56684476", "0.5664484", "0.56525975", "0.5598724", "0.5588473", "0.5579739", "0.55714846", "0.5530831", "0.55258596", "0.5515329", "0.55125105", "0.5495728", "0.54936546", "0.5492859", "0.54800...
0.57139474
4
Create an ADF representation for given user's opinion in the given discussion.
def import_adf(dbas_graph, opinion, opinion_strict): adf = ADF() # Get accepted/rejected statements from opinion user_accepted_statements = opinion.get_accepted_statements().intersection(dbas_graph.statements)\ if opinion else set() user_rejected_statements = opinion.get_rejected_statements().i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discussion(cls, user, discussion):\n pass", "def discussion(cls, user, discussion):\r\n pass", "def summarize_review(self, data: pd.DataFrame) -> pd.DataFrame:\n\n data[\"review_polarity\"] = data.groupby(\n [\"reviewnumber\", \"aspect\"], as_index=False\n )[\"polarit...
[ "0.53328925", "0.5284932", "0.47673303", "0.469638", "0.46287048", "0.46044785", "0.45294085", "0.45186085", "0.4518519", "0.45057932", "0.44950068", "0.44802105", "0.44694683", "0.4467516", "0.44637924", "0.44321582", "0.43945608", "0.4392172", "0.43746698", "0.43677405", "0...
0.51528203
2
Sends a status updates to subscribed channels.
def send_status_update(self): command = { "light_id": self.id, "status": self.status, "created": self.created.strftime("%a %d %b %Y %H:%M"), } Group('lights').send({ # WebSocket text frame, with JSON content "text": json.dumps(command),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _request_status_update(self) -> None:\n for channel_id, channel in self.channels.items():\n send_packet = Packet(\n packet_type=PACKET_TYPE_REQUEST_STATUSES,\n subject_id=SYSTEM_CHANNEL_ID,\n data={},\n )\n channel.enqueue_sen...
[ "0.71787006", "0.715905", "0.65043336", "0.6476668", "0.6306759", "0.6270909", "0.6253173", "0.62090385", "0.61616457", "0.6145896", "0.60748124", "0.6050745", "0.6048338", "0.60081804", "0.599667", "0.59857184", "0.5975747", "0.59437823", "0.5943294", "0.59381455", "0.589469...
0.65476143
2
Hooking send_notification into the save of the object as I'm not the biggest fan of signals.
def save(self, *args, **kwargs): result = super().save(*args, **kwargs) self.send_status_update() return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, **kwargs):\n # Clean up any notifications which might have already been associated with this object\n self.notifications.all().delete()\n super(Behavior, self).save(**kwargs)\n\n my_student = self.enrollment.student\n grades = Grade.objects.filter(student=my_studen...
[ "0.6855219", "0.6719134", "0.654273", "0.65206695", "0.6456309", "0.6353262", "0.6317309", "0.622905", "0.6199742", "0.6108938", "0.6108938", "0.61040115", "0.60953885", "0.60953885", "0.6091363", "0.6085296", "0.6076809", "0.60698247", "0.60410655", "0.6021677", "0.6021677",...
0.6230209
7
uses list1 as the reference, returns list of items not in list2
def list_difference(list1, list2): diff_list = [] for item in list1: if not item in list2: diff_list.append(item) return diff_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_l2_from_l1(l1, l2):\r\n return [element for element in l1 if element not in l2]", "def list_difference(l1: List[Any], l2: List[Any]) -> List[Any]:\n return [item for item in l1 if item not in l2]", "def list_difference(list1, list2):\r\n diff_list = []\r\n for item in list1:\r\n i...
[ "0.79822516", "0.7981959", "0.77709067", "0.7688654", "0.7456978", "0.74536794", "0.73608845", "0.7324599", "0.72618556", "0.7249769", "0.7235629", "0.7190773", "0.71434844", "0.70034856", "0.6966538", "0.6920006", "0.69053674", "0.6897035", "0.6892836", "0.68181765", "0.6813...
0.8260505
0
Make a user and generate required data for fields not in sample data.
def create_user(entry): # only works for first + last name currently full_name = entry[5].split() email = '{first_name}-{client_id}@{domain}'.format( first_name=full_name[0].lower(), client_id=str(entry[4]).strip(), # unique email for clients with same name domain='example.com') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def example_data():\n\n User.create_user(\"Kate\", \"longpass\", None)\n User.create_user(\"Long\", \"regularpass\", None)\n User.create_user(\"Critter\", \"shortpass\", None)", "def create_fake_data():\n User.create_fake_users()", "def setUp(self):\n gen = UsersGenerator({})\n ge...
[ "0.7133376", "0.67675513", "0.6580091", "0.6558436", "0.65492886", "0.6425854", "0.6292788", "0.6153666", "0.6117256", "0.6091036", "0.6063631", "0.6045092", "0.6017932", "0.6017932", "0.6017932", "0.59964573", "0.59585464", "0.5929342", "0.5918853", "0.5916584", "0.5892091",...
0.0
-1
Cause models.Model.objects.get_or_create() can be finicky
def get_or_create_obj(class_, data): try: obj = class_.objects.get(**data) except class_.DoesNotExist: obj = class_.objects.create(**data) return obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_or_create(model, **kwargs):\n session = db.session()\n instance = session.query(model).filter_by(**kwargs).first()\n if instance:\n return instance\n else:\n instance = model(**kwargs)\n session.add(instance)\n session.commit()\n return instance", "def get_o...
[ "0.737829", "0.7357076", "0.71458536", "0.7123804", "0.70834476", "0.6919737", "0.69118327", "0.6908213", "0.68998563", "0.68850374", "0.67731994", "0.6747713", "0.67019033", "0.6614326", "0.65938777", "0.6575222", "0.64693063", "0.6422638", "0.6400169", "0.6367059", "0.62717...
0.70306915
5
loads .pts file. returns distance limit and points.
def load_instance(filename): with open(filename, "r") as instance_file: lines = iter(instance_file) distance = float(next(lines)) points = [Point([float(f) for f in l.split(",")]) for l in lines] return distance, points
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadpts(skip=40, filt=None, ref_frame=None):\n pts = []\n for i in range(42):\n print('loading file: ', i)\n if filt is not None:\n traj = md.load(DCD_PROT(i), top=PDB_PROT, atom_indices=filt, stride=skip)\n else:\n traj = md.load(DCD_PROT(i), top=PDB_PROT, stride=skip)\n traj.center_co...
[ "0.63770086", "0.62813634", "0.62594", "0.6205341", "0.61554825", "0.6104237", "0.603394", "0.586632", "0.5806564", "0.5749277", "0.5730519", "0.57189125", "0.570616", "0.57052755", "0.57035863", "0.5673723", "0.56684834", "0.5652884", "0.5648004", "0.5634426", "0.5613215", ...
0.6247683
3
affichage des tailles triees de chaque composante
def print_components_sizes(distance, points): SortedX = sorted([point for point in points], key = abscisse) result = prochesX(SortedX, distance) dernier_pointX_1 = result[len(result)-1] dernier_indice = SortedX.index(dernier_pointX_1) origine = Point([0.0, 0.0]) segment_1 = Segment([Poin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trios(self):\n return self._trios", "def trip_chain(self):\n pass", "def letra_tiempo(self):\n return self.letra, self.tiempo", "def tris(self):\n return self.nlegomena(3)", "def tetrakis(self):\n return self.nlegomena(4)", "def reemplaza_tildes(palabra):", "def n...
[ "0.64167345", "0.5916298", "0.57619786", "0.5703327", "0.55658895", "0.556537", "0.5533595", "0.5500719", "0.5463123", "0.5455813", "0.5449393", "0.53889877", "0.53738594", "0.53580177", "0.53153276", "0.5312782", "0.5261283", "0.518219", "0.5172014", "0.51718485", "0.5132599...
0.49811023
41
Create a new SDGraphObjectFrame instance in the specified graph
def sNew(sdGraph): outSDGraphObjectFrame = ctypes.c_void_p() _res = sd.getContext().SDGraphObjectFrame_sNew(sdGraph.mHandle, ctypes.byref(outSDGraphObjectFrame)) if _res != SDApiError.NoError.value: if _res == SDApiError.NoErrorOutputParamNotSet.value: return None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graph_with_graph(cls, graph):\n new = cls()\n new.nx_graph = graph.nx_graph.copy()\n new.max_date = graph.max_date\n new.min_date = graph.min_date\n return new", "def __init__(self, graph=None): # noqa: E501\n self.openapi_types = {\n 'graph': Neo4jGraphG...
[ "0.6099084", "0.595656", "0.5864762", "0.5828153", "0.5798196", "0.57338095", "0.5618525", "0.5582457", "0.5571058", "0.5561344", "0.5512142", "0.54885", "0.5407223", "0.53947866", "0.53532344", "0.5335441", "0.52873886", "0.52579653", "0.52570146", "0.5252456", "0.52443326",...
0.70377195
0
Get the SDGraphObjectFrame title
def getTitle(self): outValue = ctypes.c_char_p() _res = self.mAPIContext.SDGraphObjectFrame_getTitle(self.mHandle, ctypes.byref(outValue)) if _res != SDApiError.NoError.value: if _res == SDApiError.NoErrorOutputParamNotSet.value: return None raise APIExcep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title(self):\n return self._frame._title", "def get_title(self):\n return self.metadata['title']", "def get_title():", "def title(self):\n return self.container['title']", "async def title(self):\n if not hasattr(self, \"_title\"):\n self._title = await Stack.fetc...
[ "0.7783941", "0.7328815", "0.726359", "0.72170377", "0.7165904", "0.71523243", "0.7066919", "0.70472175", "0.7046419", "0.7003007", "0.7003007", "0.7003007", "0.70027757", "0.70027757", "0.70027757", "0.69826674", "0.69338393", "0.69271576", "0.68917066", "0.68917066", "0.689...
0.80401707
0
Set the SDGraphObjectFrame title
def setTitle(self, value): _res = self.mAPIContext.SDGraphObjectFrame_setTitle(self.mHandle, ctypes.create_string_buffer(value.encode('utf-8'))) if _res != SDApiError.NoError.value: if _res == SDApiError.NoErrorOutputParamNotSet.value: return None raise APIExcepti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_title(self, title):\n self.title = title\n self.opf.title = title\n self.ncx.title = title", "def setTitle(self, title):\n self.__title = title\n self.drawBorder()", "def set_title(self, title):\n self.axplot.set_title(title)", "def set_title(self, title):\n\...
[ "0.78293157", "0.7774035", "0.77729225", "0.77391976", "0.76976717", "0.7654627", "0.76462835", "0.7625787", "0.76203233", "0.76101947", "0.75986356", "0.75969416", "0.75969416", "0.75873375", "0.75825727", "0.7513374", "0.7506553", "0.7492228", "0.74701583", "0.7368801", "0....
0.7617024
9
Get the SDGraphObjectFrame color
def getColor(self): outValue = ColorRGBA() _res = self.mAPIContext.SDGraphObjectFrame_getColor(self.mHandle, ctypes.byref(outValue)) if _res != SDApiError.NoError.value: if _res == SDApiError.NoErrorOutputParamNotSet.value: return None raise APIException(S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_graph_color ( self, object ):\n return self.graph_color_", "def _get_color(self):\n return self.__color", "def _get_color(self):\n return self.__color", "def _get_color(self):\n return self.__color", "def _get_color(self):\n return self.__color", "def getColor(self):\r\n ...
[ "0.76436764", "0.713944", "0.713944", "0.713944", "0.713944", "0.7060627", "0.7057942", "0.70264846", "0.7010687", "0.6968809", "0.6927457", "0.69249076", "0.68727857", "0.6870275", "0.6870275", "0.68354243", "0.68354243", "0.68354243", "0.6835348", "0.6824584", "0.6767909", ...
0.765588
0
Set the SDGraphObjectFrame color
def setColor(self, value): _res = self.mAPIContext.SDGraphObjectFrame_setColor(self.mHandle, ctypes.byref(value)) if _res != SDApiError.NoError.value: if _res == SDApiError.NoErrorOutputParamNotSet.value: return None raise APIException(SDApiError(_res)) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_color(self, color):\n\t\tpass", "def set_color(self, color):\n pass", "def set_color(self, new_color):\n self.color = new_color", "def colorFrame(self, _color):\n\t\tif self.frame:\n\t\t\tfor nr, i in enumerate(self.frame):\n\t\t\t\tself.frame[nr][1] = _color", "def colorFrame(sel...
[ "0.70018196", "0.6966884", "0.68272316", "0.6800456", "0.6800456", "0.6735271", "0.6730594", "0.67269", "0.6688919", "0.6627748", "0.6626664", "0.6562067", "0.65328383", "0.64631224", "0.6437765", "0.6426548", "0.6391508", "0.6391476", "0.6377652", "0.62837225", "0.6264317", ...
0.785959
0
Get the SDGraphObjectFrame size
def getSize(self): outSize = float2() _res = self.mAPIContext.SDGraphObjectFrame_getSize(self.mHandle, ctypes.byref(outSize)) if _res != SDApiError.NoError.value: if _res == SDApiError.NoErrorOutputParamNotSet.value: return None raise APIException(SDApiErr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSize(self):\n\n return self.size", "def getSize(self):\n return GDimension(frameWidth, frameHeight)", "def getSize(self):\r\n return self.size", "def getFrameSize(self):\n \n return self.frame_size", "def getSize(self):\n return self.size", "def fl_get_objec...
[ "0.7424616", "0.74093646", "0.7397733", "0.73387116", "0.7282922", "0.7269103", "0.7247958", "0.7237671", "0.72307", "0.72290355", "0.7214162", "0.72126585", "0.72106576", "0.71800494", "0.7156522", "0.7156451", "0.715393", "0.715393", "0.715393", "0.7151215", "0.71424764", ...
0.82977587
0
Set the SDGraphObjectFrame size
def setSize(self, value): _res = self.mAPIContext.SDGraphObjectFrame_setSize(self.mHandle, ctypes.byref(value)) if _res != SDApiError.NoError.value: if _res == SDApiError.NoErrorOutputParamNotSet.value: return None raise APIException(SDApiError(_res)) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setFrameSize(self, frame_size):\n \n self.frame_size = frame_size", "def set_size(self, size):\n self.dtSize = size", "def set_size(self, size):\n \n self.width = size[0]\n self.height = size[1]", "def setDescriptorSize(self, dsize): # real signature unknown; res...
[ "0.7229462", "0.71947026", "0.7075671", "0.70734507", "0.7000243", "0.6931248", "0.6931248", "0.6877675", "0.6803384", "0.6802796", "0.6758983", "0.67472947", "0.656778", "0.6560254", "0.6538937", "0.64847857", "0.64384997", "0.6386987", "0.63508207", "0.63508207", "0.6350820...
0.7277744
0
Test working ssdp flow.
async def test_flow_ssdp(hass): result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=SSDP_DATA, ) assert result["type"] == "form" assert result["step_id"] == "init" assert result["description_placeholders"] == { CONF_NAME: FRIENDLY_NAME, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_flow_ssdp_discovery(opp, aioclient_mock):\n result = await opp.config_entries.flow.async_init(\n DECONZ_DOMAIN,\n data={\n ATTR_SSDP_LOCATION: \"http://1.2.3.4:80/\",\n ATTR_UPNP_MANUFACTURER_URL: DECONZ_MANUFACTURERURL,\n ATTR_UPNP_SERIAL: BRIDGEID,...
[ "0.69209915", "0.6228882", "0.6222382", "0.62218183", "0.6128936", "0.6066502", "0.6031052", "0.5905359", "0.58518237", "0.5829707", "0.5796335", "0.5789207", "0.5749608", "0.5732316", "0.5731994", "0.57290465", "0.57289624", "0.57172656", "0.5697027", "0.56848615", "0.568139...
0.7182019
0
Test working user initialized flow.
async def test_flow_user(hass): mocked_device = _create_mocked_device() with _patch_config_flow_device(mocked_device): result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, ) assert result["type"] == RESULT_TYPE_FORM assert resu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_init(self):\n pass", "def test_01_Init(self):\n pass", "def testInit(self):\n self.globalInit()\n self.test.start()", "def setUp(self):\n self.user = {\n INPUT: \"12345\",\n }", "def test_init_default(self):\n self._test_init_default()", ...
[ "0.73653656", "0.7332855", "0.7077193", "0.70567644", "0.69249004", "0.68726844", "0.68498707", "0.6839166", "0.6835117", "0.68049407", "0.67969245", "0.677014", "0.67178595", "0.67178595", "0.6714913", "0.6694993", "0.6682952", "0.6670851", "0.66663605", "0.6664267", "0.6663...
0.64557886
52
Test working import flow.
async def test_flow_import(hass): mocked_device = _create_mocked_device() with _patch_config_flow_device(mocked_device): result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data=CONF_DATA ) assert result["type"] == RESULT_TYPE_CREAT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_imports(self):\n pass", "def test_import_process(self):\r\n good_file = self._get_file()\r\n imp = Importer(good_file, username=u\"admin\")\r\n imp.process()\r\n\r\n # now let's do some db sanity checks\r\n self._chrome_data_test()", "def test_import_proce...
[ "0.78771234", "0.78650427", "0.7782481", "0.7677216", "0.7568483", "0.7540616", "0.75354254", "0.74209636", "0.74094564", "0.73653024", "0.7278029", "0.7269745", "0.72625476", "0.7192543", "0.71554697", "0.71018344", "0.7055579", "0.70468646", "0.701568", "0.7003332", "0.6980...
0.70443755
18
Test discovering a bravia TV.
async def test_ssdp_bravia(hass): ssdp_data = copy.deepcopy(SSDP_DATA) ssdp_data["X_ScalarWebAPI_DeviceInfo"]["X_ScalarWebAPI_ServiceList"][ "X_ScalarWebAPI_ServiceType" ].append("videoScreen") result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_torrent(self):\n episode = self._get_episode()\n search_results = self.fetcher.jackett.search(episode.indexed_name)\n best_result = self.fetcher.best_search_result(search_results)\n self.assertEqual(best_result.get(\"id\"), 2)", "def test_search_torrent(self):\n ...
[ "0.6433441", "0.6433441", "0.62345594", "0.60060513", "0.58146226", "0.5717933", "0.5691686", "0.566858", "0.5553015", "0.551953", "0.55140924", "0.549905", "0.54884434", "0.5483752", "0.54509974", "0.5423719", "0.54206115", "0.5402356", "0.53763074", "0.5372368", "0.53702116...
0.57368356
5
Test discovering existed device.
async def test_sddp_exist(hass): _create_mock_config_entry(hass) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data=SSDP_DATA, ) assert result["type"] == RESULT_TYPE_ABORT assert result["reason"] == "already_configured"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_device(self):\n pass", "def test_get_device(self):\n pass", "def test_get_devices(self):\n pass", "def test_get_devices(self):\n pass", "def test_get_device_by_id(self):\n pass", "def test_add_device(self):\n\n pass", "def test_get_device_by_id1(se...
[ "0.78240085", "0.78240085", "0.7655598", "0.7655598", "0.7457219", "0.73228633", "0.72878426", "0.72651374", "0.72633016", "0.72633016", "0.71126646", "0.7091642", "0.70570797", "0.70163995", "0.69184566", "0.6913932", "0.678239", "0.6708392", "0.6708392", "0.67016804", "0.66...
0.0
-1
Test user adding existed device.
async def test_user_exist(hass): mocked_device = _create_mocked_device() _create_mock_config_entry(hass) with _patch_config_flow_device(mocked_device): result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA ) assert re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_device(self):\n\n pass", "def test_add_device_users(self):\n pass", "def test_create_device(self):\n pass", "def test_create_device(self):\n pass", "def test_create_device1(self):\n pass", "def test_delete_device_user(self):\n pass", "def test_crea...
[ "0.84047234", "0.8178282", "0.75562227", "0.75562227", "0.73162496", "0.715653", "0.7111771", "0.69529796", "0.6865959", "0.68253654", "0.6806261", "0.6806261", "0.67700934", "0.67700934", "0.67680633", "0.6591468", "0.65907466", "0.65907466", "0.6580167", "0.6504015", "0.650...
0.6105068
51
Test importing existed device.
async def test_import_exist(hass): mocked_device = _create_mocked_device() _create_mock_config_entry(hass) with _patch_config_flow_device(mocked_device): result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data=CONF_DATA ) asser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_device(self):\n\n pass", "def test_create_device(self):\n pass", "def test_create_device(self):\n pass", "def test_get_device(self):\n pass", "def test_get_device(self):\n pass", "def test_create_device1(self):\n pass", "def test_device_add_from_fi...
[ "0.72161", "0.71769345", "0.71769345", "0.7010547", "0.7010547", "0.6967875", "0.6817738", "0.67643243", "0.67457944", "0.6723486", "0.671353", "0.671353", "0.6640824", "0.6640824", "0.66200197", "0.66200197", "0.6524334", "0.6501196", "0.6500083", "0.646648", "0.6448424", ...
0.71282125
3
Test using adding invalid config.
async def test_user_invalid(hass): mocked_device = _create_mocked_device(True) _create_mock_config_entry(hass) with _patch_config_flow_device(mocked_device): result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=CONF_DATA ) ass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_adding_config_keys():\n\n with pytest.raises(ValueError) as error:\n Config.config()[\"something_fake\"] = True\n\n assert \"something_fake is not a valid config key.\" in error.value.args", "def test_invalid_config() -> None:\n config = {\"statsd\": {\"host1\": \"host1\"}}\n\n with p...
[ "0.7435238", "0.7262504", "0.7159769", "0.7148692", "0.7142662", "0.7094126", "0.70918053", "0.7087219", "0.70676965", "0.7067179", "0.7035518", "0.702889", "0.70191586", "0.6983132", "0.6983132", "0.6899366", "0.68779594", "0.6854525", "0.68487525", "0.68445134", "0.6841743"...
0.0
-1
Test importing invalid config.
async def test_import_invalid(hass): mocked_device = _create_mocked_device(True) _create_mock_config_entry(hass) with _patch_config_flow_device(mocked_device): result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data=CONF_DATA ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_import(self):\n with self.assertRaises(ImproperlyConfigured):\n import_from_setting('TEST_SETTING')", "def test_error_importing(self):\n with self.assertRaises(ImproperlyConfigured):\n import_from_setting('TEST_SETTING')", "def test_broken_config(broken_conf...
[ "0.8125269", "0.7789621", "0.7702107", "0.7402622", "0.7298733", "0.7276576", "0.72535616", "0.72371185", "0.7185777", "0.71790737", "0.71636087", "0.7097692", "0.7054157", "0.7015094", "0.7012981", "0.70097905", "0.6971956", "0.6935524", "0.69273", "0.6926781", "0.68988734",...
0.71278507
11
Compile a model of URI's and Curies and then test the various types
def test_uri_and_curie(self): self.single_file_generator('py', PythonGenerator, filtr=metadata_filter, comparator=lambda exp, act: compare_python(exp, act, self.env.expected_path('foo.py'))) # Check that the interpretations are correct self.single_file_generat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_resnet18():\n model = RestNet18()\n assert type(model) == RestNet18", "def __init__(self, model_uri: str = None, method: str = \"predict\", modelUri: str = None, type: str = None):\n super().__init__()\n print(model_uri, modelUri, type)\n self.model_uri = model_uri\n self.method = met...
[ "0.57247853", "0.56253564", "0.54596573", "0.535612", "0.53386253", "0.52941513", "0.5280008", "0.5215472", "0.509851", "0.5070356", "0.50533646", "0.49833405", "0.49626672", "0.49501526", "0.49251255", "0.49251255", "0.49180833", "0.49138975", "0.4904311", "0.49033374", "0.4...
0.67043126
0
Load SESAME result from an HDF5 file.
def read_h5(fpath): _check_h5_installed() import h5py as h5 f = h5.File(fpath, 'r') res = dict() if 'est_n_dips' in f.keys(): res['est_n_dips'] = list(f['est_n_dips'][:]) else: res['est_n_dips'] = 'Not available.' if 'exponents' in f.keys(): res['exponents'] = f['e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _loadHDF5File(self, filename):\n matfile = h5py.File(filename)\n\n self.StokesI = np.transpose(matfile['StokesI'][:,:])\n self.StokesQ = np.transpose(matfile['StokesQ'][:,:])\n self.StokesU = np.transpose(matfile['StokesU'][:,:])\n self.StokesV = np.transpose(matfile['StokesV...
[ "0.6725235", "0.6422298", "0.6385051", "0.636623", "0.63051444", "0.62792367", "0.6249013", "0.62046814", "0.6142441", "0.6099467", "0.6099467", "0.6084178", "0.60741514", "0.60638094", "0.60293067", "0.6011528", "0.59573895", "0.5955679", "0.5951386", "0.5904472", "0.5886311...
0.5747399
32
Splits document text into a list of sentences, given some model.
def get_sentences_list(text: str, model_type: str) -> t.List[str]: sentences = [] sent_offsets = [] stok = SentenceTokenizer.from_type(model_type) if isinstance(text, list): sentences, sent_offsets = list(zip(*map(stok.tokenize, text))) elif isinstance(text, str): sentences, sent_off...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(text):\n doc = nlp(text)\n sentences = [x.text_with_ws for x in doc.sents]\n return sentences", "def get_sentences(text):\n \n return text.split('.')", "def sentence_split(self, text):\n return split_into_sentences(text)", "def split_sentences(self, text):\n ...
[ "0.7736216", "0.7252213", "0.7082826", "0.70524997", "0.6805155", "0.67981815", "0.6738876", "0.6737422", "0.67177343", "0.6689931", "0.666789", "0.66164446", "0.65894055", "0.6582415", "0.6578306", "0.655155", "0.65042615", "0.6432492", "0.641784", "0.638252", "0.638045", ...
0.75723946
1
calculate metrics for comaprism
def calc_metrics(self, data, output): L1NormITAE = self.calcL1NormITAE(data) L1NormAbs = self.calcL1NormAbs(data) # # print 'ITAE score: ', errorIntegral print 'L1NormITAE: ', L1NormITAE print 'L1NormAbs: ', L1NormAbs print '\n' output.update({'L1N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_metrics(self):\n pass", "def compute_statistics(self):", "def compute_metrics(self, results: list) -> dict:", "def calculate_dataset_metrics(self):\n pass", "def _calculate_metrics(self):\n metrics = {}\n precision, recall = self.calc_precision_recall()\n metr...
[ "0.7391663", "0.7257466", "0.68897486", "0.67079896", "0.67074776", "0.66314316", "0.6516569", "0.6500262", "0.642219", "0.642219", "0.6376187", "0.63422066", "0.63416755", "0.6289754", "0.62062347", "0.61897427", "0.615441", "0.61517215", "0.61161274", "0.6095814", "0.607058...
0.5698741
75
creates a vertical line in the diagram, reaching from the xaxis to the plot at a given time t
def create_time_line(self, axes, t, y, time_value, label): # don't create lines on the very left if time_value == t[-1]: return # create timeLine time_line = Line2D([time_value, time_value], [np.min(y), y[t.index(time_value)]], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertical_line(t, n):\n lt(t)\n fd(t,n)\n rt(t)", "def plotvertlines(self, ax, time, color='k', label=None):\n if isinstance(time, list):\n t = time.pop()\n ax = self.plotvertlines(ax, t, color=color)\n\n # plot vertical lines of 'predicted' onset/offset\n a...
[ "0.68938607", "0.6757993", "0.64868546", "0.6453914", "0.6393406", "0.63680446", "0.6361839", "0.6274058", "0.62633324", "0.61774045", "0.6162524", "0.61366385", "0.61149967", "0.604295", "0.5982257", "0.59538084", "0.5947142", "0.59383583", "0.5909579", "0.5906619", "0.58933...
0.7260301
0
Compare x,y pairs for equality. Tuple comparison is supported, assuming tuple is of the form (x,y)
def __eq__(self, other: Union[Coordinate, Tuple]) -> bool: if isinstance(other, Coordinate): return self.x == other.x and self.y == other.y elif isinstance(other, Tuple): return self.x == other[0] and self.y == other[1] else: return NotImplemented
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_coordinates(a: tuple, b: tuple) -> bool:\n return all(np.array(a) < np.array(b))", "def assertTupleEqual(self, tuple1, tuple2, msg=None):\r\n self.assertSequenceEqual(tuple1, tuple2, msg, seq_type=tuple)", "def _is_equal(x, y):\n return x[0] == y", "def check_tuples(tuple_big, tu...
[ "0.7062187", "0.666103", "0.65644103", "0.6551453", "0.64000696", "0.6372646", "0.6335033", "0.62874585", "0.62637985", "0.626346", "0.6203353", "0.6176241", "0.61711556", "0.6137727", "0.6136285", "0.6112596", "0.60680556", "0.60548806", "0.6024749", "0.600069", "0.59930307"...
0.6638659
2
Calculate the Manhattan distance between x,y pairs.
def dist(self, other: Coordinate) -> int: return abs(other.x - self.x) + abs(other.y - self.y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manhattan_distance(x, y):\n return abs(x) + abs(y)", "def manhattan_distance(x, y):\n return sum(abs(a - b) for a, b in zip(x, y))", "def manhattan_distance(self):\n x, y = self.start\n other_x, other_y = self.x, self.y\n print(abs(x - other_x) + abs(y - other_y))", "def manhat...
[ "0.8693536", "0.86083174", "0.8195543", "0.8077915", "0.80485517", "0.79357517", "0.79270506", "0.78597945", "0.7859046", "0.78304857", "0.7774855", "0.77541363", "0.77432084", "0.7738337", "0.7737821", "0.76935554", "0.7652436", "0.75738454", "0.755815", "0.7537368", "0.7522...
0.0
-1
Generate a coordinate moved by the provided `shift` parameters from the current Coordinate.
def move_to(self, shift: Move) -> Coordinate: if shift.direction == "U": new_coordinate = Coordinate(x=self.x, y=self.y + shift.dist) elif shift.direction == "D": new_coordinate = Coordinate(x=self.x, y=self.y - shift.dist) elif shift.direction == "L": new_coo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shifted(self, shift):\n new_location = None if self.location is None else self.location + shift\n reference = None if self.reference is None else self.reference + shift\n return self.copy_with_changes(\n location=new_location, reference=reference, derived_from=self,\n )",...
[ "0.70026237", "0.6079565", "0.59989953", "0.5997494", "0.59189904", "0.58717406", "0.5802957", "0.57956624", "0.5785818", "0.5776062", "0.573016", "0.5704016", "0.5698707", "0.56430995", "0.56295216", "0.5617708", "0.5577262", "0.5573564", "0.553183", "0.54844093", "0.5453127...
0.7632833
0
The discrete coordinate steps the wire takes.
def build_steps(self) -> List[Coordinate]: if self.orientation == Orientation.HORIZONTAL: fill = self.start.y else: fill = self.start.x if self.end.x < self.start.x: x_range = range(self.start.x, self.end.x - 1, -1) else: x_range = range(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSteps():", "def total_steps(self) -> global___Expression:", "def _get_steps(self):\n return self.steps", "def get_steps_num():\n return 0", "def get_steps(self):\n return self.steps", "def get_steps(self):\n return len(self.trajectory)", "def final_coord(steps):\n ...
[ "0.68157905", "0.6451372", "0.64327866", "0.6414599", "0.6402869", "0.63812494", "0.6344675", "0.63396406", "0.63378906", "0.6239716", "0.6239716", "0.62263906", "0.6156408", "0.610278", "0.5905519", "0.58553165", "0.58501023", "0.5849367", "0.5811569", "0.57869685", "0.57652...
0.60935116
14
Overload len to provide the length of the segment.
def __len__(self): return self.start.dist(self.end)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n return len(self.segments)", "def segment_n(self):\n return len(self.segment_lengths)", "def __len__(self) -> int:\n return len(self.length)", "def __len__(self) -> int:\n return self.length", "def __len__(self) -> int:\n return self._length", "def _...
[ "0.7250847", "0.6984505", "0.69445705", "0.69188136", "0.6887917", "0.68347347", "0.6719621", "0.6719621", "0.6719621", "0.6719621", "0.6719621", "0.6719621", "0.6713415", "0.6712106", "0.6707964", "0.6680678", "0.6680678", "0.66683173", "0.66676885", "0.6666927", "0.66578484...
0.0
-1
Return True if segments share start & end points, accounting for flipping.
def __eq__(self, other: Segment) -> bool: return any( ( self.start == other.start and self.end == other.end, self.start == other.end and self.end == other.start, ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def does_overlap(self, start, stop):\n\n ranges = [list(range(key, self.map[key] + 1)) for key in self.map]\n all_coords = [item for sublist in ranges for item in sublist]\n # removing all_coords implementation until we write some tests\n for i in range(start, stop + 1):\n if...
[ "0.6702536", "0.6660691", "0.65623313", "0.65462446", "0.6517798", "0.6488373", "0.64770776", "0.6293366", "0.62791336", "0.62655747", "0.62616754", "0.62436944", "0.6191759", "0.6159941", "0.6140473", "0.6125066", "0.6124695", "0.60969627", "0.60839266", "0.607093", "0.60593...
0.6908634
0
Wire a segment from the end of the current Segment using the provides `shift`.
def wire_to(self, shift: Move) -> Segment: return Segment(self.end, self.end.move_to(shift))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift(self, shift_vec: np.ndarray) -> None:\n if len(shift_vec) != 3:\n raise ValueError(\"`shift_vec` must be a three dimensional vector\")\n shift = np.argmax(shift_vec) - 1\n self._head += shift\n if self._head < 0:\n new_buffer = np.zeros_like(self._buffer)...
[ "0.59277046", "0.5857198", "0.5500183", "0.5026484", "0.50250506", "0.49946907", "0.49946907", "0.49397922", "0.49365884", "0.49150783", "0.4914794", "0.49120414", "0.49022216", "0.48939252", "0.48647368", "0.48530436", "0.48466676", "0.48441014", "0.48221606", "0.4820676", "...
0.7589725
0
Transform the Segment into a walk of cordinate pairs.
def to_set(self) -> Set[Tuple[int, int]]: return set(self.steps)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self):\n for index in range(len(self.segments)-1):\n segment = self.segments[index].instance\n x1, y1, x2, y2 = c.coords(self.segments[index+1].instance)\n c.coords(segment, x1, y1, x2, y2)\n\n x1, y1, x2, y2 = c.coords(self.segments[-2].instance)\n c....
[ "0.6142883", "0.6132059", "0.56742054", "0.5584256", "0.55319", "0.5323601", "0.5319999", "0.52667624", "0.52560616", "0.52326137", "0.51815397", "0.51665795", "0.5152955", "0.5149939", "0.5131526", "0.5102715", "0.5085073", "0.5083595", "0.5046166", "0.5044343", "0.5028643",...
0.0
-1
Check for an intersection between two segments. Since all segments are either horizontal or vertical, we can assume that there will be at most one intersection between two segments, and parallel segments will not intersect. Thanks Euclid! The case where segments overlap is ignored.
def intersect(self, other: Segment) -> Optional[Intersection]: # Short-circuit for parallel segments if self.orientation == other.orientation: return # Deconstruct segments into a series of Coordinates & find the set intersection intersection = self.to_set().intersection(oth...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersects_segment(\n self, a: Tuple[float, float], b: Tuple[float, float]\n ) -> bool:\n assert len(a) == 2\n assert len(b) == 2\n return bool(lib.cpBBIntersectsSegment(self, a, b))", "def segmentsIntersect(self, seg1, seg2):\n\t\ts1_x = seg1[1][0] - seg1[0][0]\n\t\ts1_y = seg...
[ "0.77669907", "0.7720853", "0.7607043", "0.74896234", "0.7254465", "0.7216294", "0.7161938", "0.71436524", "0.7132309", "0.7068115", "0.6982785", "0.6963614", "0.69598895", "0.690559", "0.68737173", "0.68257594", "0.6813828", "0.6808007", "0.67285836", "0.66983247", "0.669735...
0.6920748
13
Build wire segments from the internal wiring diagram.
def build_wires(self) -> List[Segment]: segments = [Segment(self.ORIGIN, self.ORIGIN.move_to(self._diagram[0]))] for step in self._diagram[1:]: segments.append(segments[-1].wire_to(step)) return segments
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_segments(self):\n for strand in self.strand_list:\n strand.construct_segment()", "def generate(self, diagram):", "def build_microtrips(self, segment_lenght):\n seg_count = 0\n for data in self.clean_data:\n seg_count = data.segment_all(segment_lenght, se...
[ "0.627155", "0.5714515", "0.5531439", "0.53391623", "0.5144474", "0.5128602", "0.5128105", "0.5107117", "0.5049788", "0.50365037", "0.50336444", "0.50184613", "0.500898", "0.49955854", "0.4993949", "0.49708354", "0.4966822", "0.49333", "0.49315196", "0.49184826", "0.4903525",...
0.7345104
0
Determine the intersections between two Wires.
def intersect(self, other: Wire) -> List[Intersection]: intersections = [] for segment_a, segment_b in product(self.wire_segments, other.wire_segments): intersection = segment_a.intersect(segment_b) if intersection and intersection.location != self.ORIGIN: interse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_intersections(wire1, wire2):\n pass", "def get_closest_intersection(wire1, wire2):\n pass", "def find_intersection(wire_one_map, wire_two_map):\n return set(wire_one_map.keys()) & set(wire_two_map.keys())", "def intersection(a, b):\n x = max(a[0],b[0])\n y = max(a[1],b[1])\n w = min...
[ "0.81596965", "0.7286957", "0.70149076", "0.68853784", "0.6851062", "0.6744263", "0.6626625", "0.64926517", "0.6439222", "0.6427089", "0.6418711", "0.64120907", "0.6411731", "0.6411731", "0.6411731", "0.6411731", "0.6382612", "0.63665724", "0.6347462", "0.6343752", "0.6331495...
0.68036246
5
Find the closest intersection to the origin, by Manahattan distance, of two Wires.
def closest_intersect_manhattan(self, other: Wire) -> Tuple[Coordinate, int]: intersection = sorted(self.intersect(other), key=lambda x: self.ORIGIN.dist(x.location))[0] return intersection, self.ORIGIN.dist(intersection.location)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findIntersect(wires):\n allSets = list(map(lambda w: coordsFor(w), wires))\n baseSet = allSets[0]\n for s in allSets[1:]:\n baseSet.intersection_update(s)\n central = (0, 0)\n distances = list(map(lambda c: manhattan(central, c), baseSet))\n return min(distances)", "def get_closest_i...
[ "0.73668647", "0.71624225", "0.6995059", "0.688957", "0.6259799", "0.6222615", "0.6161806", "0.6148054", "0.5992006", "0.5981919", "0.5977006", "0.59560627", "0.59306633", "0.59270483", "0.59255", "0.5852488", "0.58326423", "0.5826113", "0.58249897", "0.5812551", "0.5808463",...
0.78951204
0
Find the closest intersection to the origin, by step distance, of two Wires.
def closest_intersect_steps(self, other: Wire) -> Tuple[Intersection, int]: intersections = self.intersect(other) # For each intersection, iterate along each wire's path until the intersection is # encountered, keeping track of the number of steps taken distances = [] for inters...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_closest_intersection(wire1, wire2):\n pass", "def findIntersect(wires):\n allSets = list(map(lambda w: coordsFor(w), wires))\n baseSet = allSets[0]\n for s in allSets[1:]:\n baseSet.intersection_update(s)\n central = (0, 0)\n distances = list(map(lambda c: manhattan(central, c), ...
[ "0.7209214", "0.63660127", "0.62385994", "0.6171734", "0.59056085", "0.5888943", "0.5881519", "0.586255", "0.5790623", "0.5756521", "0.57293314", "0.57029945", "0.5671344", "0.5662922", "0.56311053", "0.56151825", "0.5565326", "0.55585504", "0.5547729", "0.55357975", "0.55354...
0.7036371
1
Parse the input wiring diagram into a list of Move named tuples. Wiring diagrams are assumed to be of the form "R8,U15,L5,D23"
def _parse_diagram(wiring_diagram: str) -> List[Move]: return [ Move(direction=shift[0], dist=int(shift[1:])) for shift in wiring_diagram.split(",") ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __parse_move_line(self, line):\n parts = re.sub('\\(.*?\\)', '', line).split()\n x, y = None, None\n for part in parts[:0:-1]:\n axis = part.upper()[0]\n value = float(part[1:])\n if axis in ['Z', 'F']:\n parts.remove(part)\n elif ...
[ "0.62569845", "0.6113737", "0.60215795", "0.6006309", "0.5862436", "0.5765197", "0.5751924", "0.5724444", "0.5700855", "0.5651036", "0.562076", "0.5336469", "0.52793014", "0.5259579", "0.5231833", "0.51468825", "0.5125433", "0.5125381", "0.5124578", "0.5118541", "0.51147455",...
0.7860054
0
Check if file is there and quit if it isn't
def filecheck(filename): if not os.path.isfile(filename): print("Can't find %s" % filename) exit(1) else: return filename
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fileCheck(file):\n if not os.path.isfile(file):\n print('File : ',file)\n print('E... '+'no file')\n sys.exit()", "def fileCheck(filename):\n if not os.path.isfile(filename):\n print('File: ' + filename + ' not found. Exiting...', file=sys.stderr)\n sys.exit(1)", "d...
[ "0.78740466", "0.76880825", "0.72935724", "0.7283903", "0.7271871", "0.7251227", "0.724417", "0.7224975", "0.71998245", "0.71346956", "0.69801754", "0.6942541", "0.69106835", "0.68559337", "0.6833958", "0.6821703", "0.6818373", "0.6803222", "0.68000525", "0.6797061", "0.67907...
0.7087157
10
Return True if file does not exist
def nofile(filename): if not os.path.isfile(filename): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_exist() -> bool:\n pass", "def check_file_exist(self):\n return False", "def is_file_exists(self):\n pass", "def file_exists(self):\r\n if os.path.exists(self.file_path):\r\n return True\r\n else:\r\n return False", "def does_file_exist(self...
[ "0.86832106", "0.8600895", "0.8531777", "0.84618753", "0.82855195", "0.8220109", "0.8152527", "0.80644566", "0.8035585", "0.8014052", "0.79800504", "0.79616517", "0.7943959", "0.7933118", "0.7933118", "0.7931492", "0.7927343", "0.788119", "0.7870391", "0.7859676", "0.7842929"...
0.8074569
7
Indexing a bam file
def index_vcf(vcf_file, threads=4, overwrite=False): cmd = "bcftools index --threads %s -f %s" % (threads, vcf_file) if filecheck(vcf_file): if nofile(vcf_file+".csi"): run_cmd(cmd) elif (os.path.getmtime(vcf_file+".csi") < os.path.getmtime(vcf_file)) or overwrite: run_cm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_bam(bam):\n run_cmd(samtools, \"index %s\" % bam, dockerize=dockerize)", "def create_bam_file_index(infile, outfile):\n statement = 'samtools index %(infile)s %(outfile)s'\n P.run(statement,\n job_queue = P.PARAMS['queue'],\n job_memory = P.PARAMS['memory'])", "def indexFa...
[ "0.784063", "0.7218745", "0.69943625", "0.6962452", "0.66993093", "0.6576394", "0.6558792", "0.6554859", "0.6499257", "0.64831173", "0.6453296", "0.63656783", "0.6352732", "0.61827844", "0.61736137", "0.5998907", "0.5973611", "0.5939125", "0.5887846", "0.5775068", "0.57524455...
0.0
-1
Wrapper to run a command using subprocess with 3 levels of verbosity and automatic exiting if command failed
def run_cmd(cmd, verbose=1, target=None): cmd = "set -u pipefail; " + cmd if verbose == 2: sys.stderr.write("\nRunning command:\n%s\n" % cmd) stdout = open("/dev/stdout", "w") stderr = open("/dev/stderr", "w") elif verbose == 1: sys.stderr.write("\nRunning command:\n%s\n" % c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _call_command(wrapper, command, no_out=False):\n\n child = subprocess.Popen(command.split(),\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE)\n (out, err) = child.communicate()\n ret = child.returncode\n\n if not (no_out and ret == 0):\n ...
[ "0.7233986", "0.7111593", "0.7103582", "0.70816857", "0.690531", "0.68335044", "0.68170345", "0.68123716", "0.6702475", "0.6693243", "0.6678768", "0.6656096", "0.6635362", "0.66319376", "0.6630331", "0.6626344", "0.6609211", "0.6608865", "0.6604691", "0.65932876", "0.65822476...
0.7105375
2
Function run at each API call
def makecalc(): modelfile = 'winequality-red.pickleRF.dat' model = pickle.load(open(os.path.join(APP_STATIC, modelfile), 'rb')) jsonfile = request.get_json() data = pd.read_json(json.dumps(jsonfile),orient='index') print(data) res = dict() # Headers of Data # "fixed acidity","vola...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __update_data(self):\r\n # loop = asyncio.get_event_loop()\r\n api_base_info_req = self.loop.run_in_executor(None, self.__get_base_info_api)\r\n api_status_req = self.loop.run_in_executor(None, self.__get_status_api)\r\n api_status_res = yield from api_status_req\r\n api_base...
[ "0.6503972", "0.6439176", "0.6435586", "0.640312", "0.63690764", "0.62178326", "0.61824197", "0.6169044", "0.61261255", "0.60945857", "0.608737", "0.60709506", "0.6063016", "0.60455793", "0.60235363", "0.6012444", "0.5937891", "0.59307265", "0.59213686", "0.58983976", "0.5889...
0.0
-1
Simulates a smooth mouse drag
def drag(source, dest, speed=1000): m = PyMouse() m.press(*source) time.sleep(0.1) # number of intermediate movements to make for our given speed npoints = int(sqrt((dest[0]-source[0])**2 + (dest[1]-source[1])**2 ) / (speed/1000)) for i in range(npoints): x = int(source[0] + ((dest[0]-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mouseDragged():\n if mousePressed:\n mousePressed()", "def mouseDragged(self, point, delta):\n pass", "def _on_mouse(self, event):\n x, y = event.GetPosition()\n if self._drag_mode == DepthCanvas.SASH_DRAG_NONE: \n self._canvas_hit_test(x, y) \n ...
[ "0.6801119", "0.664212", "0.6326401", "0.6171946", "0.6171946", "0.6129287", "0.6114349", "0.5991088", "0.5924613", "0.58440715", "0.58440715", "0.58381003", "0.58319557", "0.58042", "0.5794935", "0.57604647", "0.57600874", "0.5743456", "0.57369435", "0.572792", "0.5670328", ...
0.6645221
1
Simulates a mouse click
def click(point): m = PyMouse() m.move(*point) m.press(*point) m.release(*point)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_click(coord):\n mouseclick(coord[0], coord[1])\n time.sleep(0.5)", "def mouse_click(self,x,y,button,double_click):\n raise NotImplementedError(\"ERROR: Unimplemented function.\")", "def doubleclick(point):\n m = PyMouse()\n m.press(*point)\n m.release(*point)\n m.press(*point)...
[ "0.82254434", "0.7856492", "0.7327572", "0.7295747", "0.7203698", "0.71242344", "0.7030504", "0.70165205", "0.7001474", "0.69815814", "0.69717795", "0.6933503", "0.68793523", "0.6869223", "0.6850616", "0.68479997", "0.68032527", "0.67715305", "0.6744112", "0.6707583", "0.6687...
0.77364874
2
Simulates a mouse double click
def doubleclick(point): m = PyMouse() m.press(*point) m.release(*point) m.press(*point) m.release(*point)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mouse_click(self,x,y,button,double_click):\n raise NotImplementedError(\"ERROR: Unimplemented function.\")", "def double_click(self, *args):\n return _ida_hexrays.Hexrays_Hooks_double_click(self, *args)", "def double_clicked(mouse):\n global state, current_action\n\n smallest_el...
[ "0.7985254", "0.7950458", "0.7732801", "0.759767", "0.7337703", "0.723603", "0.7195858", "0.69655806", "0.6576329", "0.64840645", "0.6409206", "0.63825154", "0.62824076", "0.6248159", "0.6243938", "0.6222214", "0.62110955", "0.61339504", "0.61338806", "0.6060498", "0.6041223"...
0.81779
0
Moves the mouse cursor to the provided location
def move(point): # wrapper just so we don't have to import pymouse separately m = PyMouse() m.move(*point)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to(xy):\n (x,y) = xy\n win32api.SetCursorPos((x,y))", "def set_cursor_position(self, x: int, y: int) -> None:\n self.screen.move(y, x)", "def moveCursor(self):\n\n\t\tself._before = self.rect.center\n\t\tself.rect.center = self._pos", "def move_to(self, ypos, xpos):\n # the scree...
[ "0.82098645", "0.77616096", "0.7572768", "0.7469796", "0.7371649", "0.7300285", "0.7232395", "0.7158363", "0.7085708", "0.6993495", "0.6982841", "0.6841422", "0.67760557", "0.67202425", "0.6669891", "0.6653091", "0.66360533", "0.66272753", "0.6612618", "0.65883505", "0.657568...
0.7366336
5
Simulates a key press
def keypress(key): k = PyKeyboard() if key == 'enter': key = k.return_key k.tap_key(key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keypress(self, key, state=None):\n\n\t\tself._interface.keypress(key, state)", "def k_press(self, key: KKey):\n pass", "def presskey(self, key):\n \"\"\"Method to press any key\n Need to add further code for other keys based on requirements\"\"\"\n action = ActionChains(self....
[ "0.77938867", "0.7720014", "0.76895285", "0.7619073", "0.7487932", "0.744391", "0.7355317", "0.73529863", "0.7326132", "0.7269268", "0.72614694", "0.7260456", "0.72459763", "0.720586", "0.71467555", "0.7134491", "0.71250796", "0.7118363", "0.7103", "0.7081553", "0.7069522", ...
0.7449855
5
Stimulates typing a string of characters
def type_msg(string): k = PyKeyboard() k.type_string(string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def characters(self, data):\n pass", "def type_out(text):\n disable_typing.start()\n text = text + \"\\n\"\n for c in text:\n sys.stdout.write(c)\n sys.stdout.flush()\n time.sleep(0.01)\n disable_typing.stop()", "def _type_text(text):\n FlaUIKeyboard.Type(str(text...
[ "0.57233626", "0.57059294", "0.5684674", "0.5682626", "0.5663008", "0.564662", "0.5634049", "0.56116927", "0.55977404", "0.5592762", "0.55882055", "0.5541043", "0.547264", "0.5471724", "0.5471444", "0.54415923", "0.53935754", "0.53798544", "0.53640604", "0.53581715", "0.53409...
0.5819586
0