query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
List biomaterials in the database
def get_biomaterials(self, provider_id="", biomaterial_id="", organism_id="", biomaterial_name="", analysis_id=""): if analysis_id: res = self.session.query(self.model.biomaterial) \ .join(self.model.assay_biomaterial, self.model.biomaterial.biomaterial_id == self.model.assay_biomat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_all():\n # Query the database for all the materials\n materials = Material.query.order_by(Material.family_id, Material.material_name).all()\n\n # Serialize the list of materials from our data\n material_schema = MaterialSchema(many=True, exclude=[\"family.materials\"])\n data = material_sch...
[ "0.6192026", "0.5818213", "0.5779101", "0.573469", "0.5720166", "0.57175946", "0.5591781", "0.55482215", "0.5547385", "0.55463684", "0.550716", "0.5473016", "0.54531604", "0.54050344", "0.53478765", "0.53468406", "0.5337566", "0.5332766", "0.5332766", "0.5331456", "0.53309757...
0.67629975
0
Add a new biomaterial to the database
def add_biomaterial(self, biomaterial_name, organism_id, description="", biomaterial_provider="", biosample_accession="", sra_accession="", bioproject_accession="", attributes={}): biosourceprovider_id = None dbxref_id = None json_attributes = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(family_id, material):\n # get the parent family\n family = Family.query.filter(Family.family_id == family_id).one_or_none()\n\n # Was a family found?\n if family is None:\n abort(404, f\"Family not found for Id: {family_id}\")\n\n # Create a material schema instance\n schema = M...
[ "0.6104013", "0.59276325", "0.58953744", "0.5852806", "0.57792354", "0.5767689", "0.5638966", "0.56181353", "0.5565754", "0.55483663", "0.5510554", "0.55060214", "0.5496138", "0.5464313", "0.54458904", "0.54380393", "0.54369015", "0.543286", "0.54315674", "0.5424799", "0.5424...
0.71632284
0
Add an expression matrix file to the database
def add_expression(self, organism_id, analysis_id, file_path, separator="\t", unit=None, query_type="mRNA", match_on_name=False, re_name=None, skip_missing=False): self._reset_cache() seqterm = self.ci.get_cvterm_id(query_type, 'sequence') self._init_feature_cache(organism_id, seqterm, match_on_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_expression(self, file=None):\n if file is None:\n file = self.expression_matrix_file\n self.expression_matrix = self.input_dataframe(file)", "def matrix_add():", "def update_database(path=None, **kwargs):\n mindf = pd.read_csv(pyrolite_datafolder(subfolder=\"mineral\") / \"...
[ "0.65442574", "0.5761759", "0.57435507", "0.5676048", "0.56291777", "0.55924577", "0.55134535", "0.5449855", "0.54015595", "0.5384719", "0.5367799", "0.53263426", "0.5313683", "0.53110474", "0.529037", "0.52516246", "0.52149713", "0.5205778", "0.5196536", "0.51934355", "0.517...
0.6046183
1
In most cases, extracts a chapter number purely from case metadata.
def get_chapter(self): for entry in self.get_entries(): descr = entry.get_description() if descr is not None and "petition" in descr.lower(): if "chapter 7" in descr.lower(): return 7 elif "chapter 11" in descr.lower(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_chapter(filename):\n print_info('Extracting chapter from {0}'.format(filename))\n for regex in MANGA_CHAPTER_REGEX:\n m = re.search(regex, filename)\n\n if m is None:\n continue\n\n extracted_ep = m.group('Chapter')\n print_info('Extracted chapter: {0}'.format...
[ "0.7382389", "0.6293787", "0.58360165", "0.5642993", "0.56024945", "0.5541697", "0.5512064", "0.5504295", "0.5411718", "0.5395109", "0.53763074", "0.532322", "0.53189486", "0.52233315", "0.5186911", "0.51648057", "0.51372993", "0.51303697", "0.5098762", "0.5090737", "0.507563...
0.6519007
1
Monitera all redis servers use ping CMD
def run(self): redis_servers = settings.get_redis_servers() for redis_server in redis_servers: redis_password = redis_server.get("password") self.ping(redis_server["server"], redis_server["port"], redis_password) if len(self.failedList) > 0: self.sendMail()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __run_redis_cmd(self, func, dbs=[0]):\n path_inventory = u'%s/inventories/%s' % (self.ansible_path, self.environment)\n path_lib = u'%s/library/beehive/' % (self.ansible_path)\n runner = Runner(inventory=path_inventory, verbosity=self.verbosity, \n module=path_lib)\n...
[ "0.656995", "0.6293971", "0.61813736", "0.61754954", "0.61522084", "0.6096701", "0.60724664", "0.6004757", "0.5999045", "0.5999045", "0.5999045", "0.5999045", "0.59759855", "0.59577334", "0.5947313", "0.5940952", "0.5923098", "0.58934075", "0.5847425", "0.5837494", "0.5808732...
0.6858563
0
Send alter mail when ping failed.
def sendMail(self): content = '<table><thead><tr><th>IP</th><th>DOWN</th></tr></thead><tbody>' for f in self.failedList: content += '<tr><td style="padding: 8px;line-height: 20px;vertical-align: top;border-top: 1px solid #ddd;">' content += f + '</td>' content += '<td...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_email():\n send_mail(\"You've got some problem.\", 'REPAIR IT', 'dimazarj2009@rambler.ru',\n ['dimazarj2009@rambler.ru'], fail_silently=False,)", "def send_mail_when_failed(self, body):\r\n pass", "def postprocess():\n if ERRORS:\n address = 'tamakoshihiroki@gmail.com'...
[ "0.68517286", "0.6475788", "0.6388135", "0.6191314", "0.6181701", "0.6104263", "0.6091504", "0.6058453", "0.60377526", "0.5965995", "0.5862683", "0.58388364", "0.58358526", "0.5814859", "0.5771006", "0.572634", "0.5684545", "0.5673943", "0.5671044", "0.56564945", "0.56476027"...
0.6611076
1
Function that detects the centroid and the head position of the fly by applying image processing techniques.
def findCentroid(img, file): print(file) # convert the image to grayscale img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # find the number of rows and columns of the image img_lin = img.shape[0] img_col = img.shape[1] # to find the average of half of the image img_mean...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_laser_center(self):\n image = np.copy(self.camera_fiber.temp_image)\n brightest = np.unravel_index(image.argmax(), image.shape)\n self.laser_center = self.calculate_gaussian_centroid(image, brightest[0], brightest[1], crop_size=25)", "def calculateCentroid(self,image):\n\t\tim=...
[ "0.6594911", "0.6537249", "0.6412693", "0.62661266", "0.62444144", "0.6241331", "0.6184108", "0.61685765", "0.61163884", "0.60879034", "0.59796005", "0.5943774", "0.5918731", "0.59134793", "0.5874495", "0.5856376", "0.5851561", "0.57743436", "0.57465404", "0.5699831", "0.5695...
0.7285966
0
Function that performs the images' analysis, for which centroids and head positions are found. It stores all the points in csv files and creates videos with indicated the position of the centroid and head on the fly's body.
def analyzeImages(path, name_type, box1_size, box2_size, box3_size, box4_size, box5_size): folders = [f for f in sorted(glob.glob(path + "/**"))] for folder in folders: # to save this data frame in a csv file files = [f for f in sorted(glob.glob(folder + "/**" + ".jp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n\n for file_cnt, file_path in enumerate(self.files_found):\n video_timer = SimbaTimer()\n video_timer.start_timer()\n _, self.video_name, _ = get_fn_ext(file_path)\n self.video_info, self.px_per_mm, self.fps = self.read_video_info(\n ...
[ "0.6021955", "0.58431005", "0.5828736", "0.5771666", "0.5755231", "0.5723388", "0.56979716", "0.5687868", "0.5659278", "0.56284493", "0.55977225", "0.55924666", "0.5589234", "0.5587735", "0.5551524", "0.55502254", "0.5510623", "0.5502854", "0.55000526", "0.54837716", "0.54425...
0.6888863
0
Validate that a duplicate registration id raises a validation error.
def test_registration_id_unique(self): # add a device serializer = GCMDeviceSerializer(data={ "registration_id": "foobar", "name": "Galaxy Note 3", "device_id": "0x1031af3b", }) serializer.is_valid(raise_exception=True) obj = serializer.save() # ensure updating the same object works serializer ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_duplicate_phone_number(self):\n params = {\n 'first_name': \"David\",\n 'last_name': \"Smith\",\n 'password': '******',\n 'email': \"david.smith@mom.com\",\n 'phone_number': \"012-345-6789\"\n }\n self.register...
[ "0.6787921", "0.6662471", "0.6644035", "0.6569105", "0.6504624", "0.64808995", "0.6457066", "0.6399243", "0.6359509", "0.63045204", "0.6294434", "0.6168324", "0.61681813", "0.6164117", "0.6139796", "0.6101939", "0.6068482", "0.60664546", "0.6058098", "0.60533565", "0.605298",...
0.682746
0
Draw all fit results Draw all results/subresults (i.e fit functions) spectras on a single canvas for every combination of Centrality/Cut/Leaf cut from the config.
def DrawFitResults(self, particle_name="JPsi", spectra_name="", root='', subresults=None): print(" ================================================================ ") print( " DrawFitResults for particle {} and spectra {}" .format(particle_name, spectra_name)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_figures(self):\n cls = self.__class__\n plotted_canvas = []\n\n for result in self._get_output_objects_info():\n result_objects_list = self._get_results_from_all_files(result)\n\n canvas = cls.plotting_function(\n result_objects_list,\n ...
[ "0.6134238", "0.5917096", "0.57943696", "0.5789722", "0.57474655", "0.57226086", "0.57202303", "0.5697805", "0.5688302", "0.5620569", "0.5609399", "0.559524", "0.55868196", "0.55811167", "0.54948586", "0.54847336", "0.54786724", "0.54730266", "0.5472856", "0.54694784", "0.545...
0.6165423
0
Calculate the average time it took to run 10k given a number of times that have been entered by the user.
def run_timings(): running_times = [] while recorded_time := input(f"Enter your 10k time: "): if not recorded_time: break running_times.append(float(recorded_time)) average_pace = sum(running_times) / len(running_times) return average_pace
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_timing():\n time_log = []\n while True:\n one_run = input(\"Enter your time for this 10 km: \")\n if not one_run:\n break\n try:\n time_log.append(float(one_run))\n except ValueError:\n print(\n \"Hey, you enter something str...
[ "0.7461477", "0.66444635", "0.64398354", "0.6438213", "0.63275254", "0.617399", "0.61123073", "0.6100023", "0.5930153", "0.5821478", "0.5818379", "0.5801521", "0.5801521", "0.5801521", "0.5798419", "0.5792471", "0.5792471", "0.5788704", "0.5771724", "0.5740964", "0.5740964", ...
0.8558169
0
This builder creates an awscrt.mqtt.Connection, configured for an MQTT connection over websockets, with a custom function to transform the websocket handshake request before it is sent to the server.
def websockets_with_custom_handshake(websocket_handshake_transform, websocket_proxy_options=None, **kwargs): _check_required_kwargs(**kwargs) tls_ctx_options = awscrt.io.TlsContextOptions() return _builder(tls_ctx_options=tls_ctx_options, use_websockets=True, websocke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_connection(args):\n\n event_loop_group = io.EventLoopGroup(1)\n host_resolver = io.DefaultHostResolver(event_loop_group)\n client_bootstrap = io.ClientBootstrap(event_loop_group, host_resolver)\n\n if args.use_websocket is True:\n proxy_options = None\n if args.proxy_host:\n ...
[ "0.6632762", "0.60665554", "0.591086", "0.5720019", "0.5720019", "0.57116175", "0.56660247", "0.5663434", "0.5659203", "0.5575382", "0.5563101", "0.5560351", "0.55342054", "0.5531516", "0.5531333", "0.5528467", "0.5472187", "0.54146594", "0.5405244", "0.5367679", "0.53484726"...
0.6505662
1
Output the temperature and Kinetic energy into log file.
def output_temp(self, energy, temp): logger.info_cycle(' Temperature : {:>8.2f} (K) '.format(temp)) logger.info_cycle(' Kinetic energy : {:>8.5f} (K) '.format(energy))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_KDE(xp_path, kernel, bandwidth):\n\n log_file = \"{}/log.txt\".format(xp_path)\n log = open(log_file, \"a\")\n\n log.write(\"KDE configuration\\n\")\n log.write(\"Kernel: {}\\n\".format(kernel))\n log.write(\"Bandwidth: {}\\n\".format(bandwidth))\n log.write(\"GridSearchCV for hyperparame...
[ "0.6767776", "0.6728519", "0.6450265", "0.6221996", "0.5992597", "0.5970399", "0.59626496", "0.59127957", "0.58939147", "0.5892889", "0.5860207", "0.5842943", "0.5763868", "0.57622576", "0.5668243", "0.5657112", "0.5655535", "0.56482416", "0.56338096", "0.5619914", "0.5617078...
0.7092127
0
Plot and export loss history.
def plot_loss_history(data=None, title=None, name=None, path=None): # TODO: add labels to loss history plt.figure(random.randint(a=1, b=100)) plt.title(title) plt.plot(data) plt.savefig('{}/{}.png'.format(path, name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_loss(history, name):\n\n plt.plot(history.history['loss'])\n plt.plot(history.history['val_loss'])\n plt.title('model loss')\n plt.ylabel('loss')\n plt.xlabel('epoch')\n plt.legend(['train', 'val'], loc='upper left')\n # plt.show()\n plt.savefig(name, format=\"png\")", "def plot_...
[ "0.7981323", "0.7624024", "0.7433869", "0.7406804", "0.7398628", "0.72234327", "0.71911234", "0.71801317", "0.71626985", "0.7115393", "0.71093327", "0.7078133", "0.70390433", "0.7034216", "0.70000875", "0.69829816", "0.69766355", "0.6951487", "0.6897597", "0.68970644", "0.689...
0.7839726
1
Return color from rgb hex text and alpha (0~255) eg. A040AB, 150
def RGB_hex_to_color(text: str, a: int=255): num = int(text, 16) r = num // 65536 g = (num - r * 65536) // 256 b = num - r * 65536 - g * 256 return np.clip(np.array([r, g, b, a], dtype='u1'), 0, 255)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hex_to_rgba(h, alpha):\n return tuple([int(h.lstrip('#')[i:i + 2], 16) for i in (0, 2, 4)] + [alpha])", "def color_text(txt, foreground=PALETTE['white'], background=PALETTE['black']):\n if isinstance(foreground, str) and foreground.startswith('#'):\n foreground = hex_to_rgb(foreground)\n if i...
[ "0.70719475", "0.70300883", "0.69317526", "0.6809849", "0.6768211", "0.6693766", "0.666003", "0.66281646", "0.66170335", "0.6565935", "0.65209496", "0.6519439", "0.6493239", "0.64585334", "0.6431689", "0.6419089", "0.6414779", "0.6409961", "0.6378768", "0.6378768", "0.6378768...
0.8030135
0
Mix two colors with alpha. Use Canvas.mix for mixing layers. Mainly for internal use. Source is on top of destination.
def mix(src_color, src_f, dst_color, dst_f): src_a = src_color[:, 3] / 255 dst_a = dst_color[:, 3] / 255 out_a = src_a * src_f + dst_a * dst_f outafilter = out_a > 0 out_rgb = np.zeros((src_color.shape[0], 3), dtype='u1') out_rgb[outafilter] = np.clip(np.round((src_color[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mix(self, other, coef=0.5):\n def m(a, b):\n return a * (1 - coef) + b * coef\n\n return Color(from_rgba=(c(m(self.r, other.r)),\n c(m(self.g, other.g)),\n c(m(self.b, other.b)),\n c(m(self.a, ...
[ "0.6729011", "0.6545124", "0.6463948", "0.64474237", "0.6229019", "0.6201977", "0.60925937", "0.60870343", "0.6085781", "0.6065723", "0.603785", "0.59199095", "0.58499014", "0.57697445", "0.5742824", "0.5742431", "0.567278", "0.5585841", "0.5570075", "0.5530295", "0.55078554"...
0.6591176
1
Given single file, looks for text, stores in global dict for record
def find_string_in_files(file, magictext): global found_text file_base = os.path.basename(file) with open(file) as f: all_lines = f.readlines() for line_number, line in enumerate(all_lines): if magictext in line: if file_base not in found_text.keys(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_text():\n known = collections.OrderedDict()\n match = collections.OrderedDict()\n\n f = open(DIR_LOCATION, 'rU')\n reader = csv.DictReader(f)\n\n #read in csv, assumes there is a col = known and one = match\n for row in reader:\n if row['known'] != '':\n known[row['kn...
[ "0.63602626", "0.6208794", "0.61997074", "0.6170095", "0.6080474", "0.6079804", "0.6056504", "0.59300506", "0.5921899", "0.5861323", "0.5814221", "0.5763088", "0.5752362", "0.57522905", "0.57475674", "0.57364583", "0.57070917", "0.5686806", "0.5638759", "0.56220734", "0.56052...
0.62313044
1
Create Parser that accepts {optional extension} {optional polling interval} {directory to search} {magic text}
def create_parser(): parser = argparse.ArgumentParser(description='Watching for files containing magictext') parser.add_argument('--ext', help='File extensions to filter on, default=.txt', default='.txt') parser.add_argument('--poll', help="Polling interval in seconds, default=1.0", type=float, default=1.0)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_parser():\n pass", "def parser_bnf():\n at = Literal(\"@\").suppress()\n caret = Literal(\"^\")\n colon = Literal(\":\").suppress()\n left_bracket = Literal(\"[\").suppress()\n period = Literal(\".\").suppress()\n right_bracket = Literal(\"]\").suppress()\n\n # zero_index ::= [...
[ "0.5587801", "0.5553152", "0.55283254", "0.54329205", "0.5420904", "0.54206115", "0.54077756", "0.5390306", "0.53838545", "0.53826636", "0.5356356", "0.53528345", "0.5336885", "0.5314255", "0.5294684", "0.5292399", "0.52714336", "0.5252597", "0.5237357", "0.5232189", "0.52247...
0.7230714
0
Given an input LR IDL save file, generate an hdf5 IDs arc lines too
def generate_hdf(sav_file, instr, lamps, outfil, dtoler=0.6): from pypit import pyputils msgs = pyputils.get_dummy_logger() from pypit import arwave from pypit import arutils arutils.dummy_settings() # from arclines.pypit_utils import find_peaks from arclines.io import load_line_lists ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ref_icrs_fk5(fnout=\"icrs_fk5.csv\"):\n import starlink.Ast as Ast\n\n np.random.seed(12345)\n\n N = 200\n\n # Sample uniformly on the unit sphere. These will be either the ICRS\n # coordinates for the transformation to FK5, or the FK5 coordinates for the\n # transformation to ICRS.\n ra =...
[ "0.5673385", "0.5630045", "0.5573348", "0.5560431", "0.54908866", "0.54738414", "0.5467117", "0.5367792", "0.5366663", "0.5323172", "0.5323082", "0.5317692", "0.52930754", "0.5292662", "0.52732944", "0.5267559", "0.52626765", "0.5232525", "0.52206075", "0.51712877", "0.516832...
0.63682866
0
Assemble the code and return the segment data for the 'code' segment, to serve as a simple executable image.
def assemble_code(self, codestr, segment='code'): asm = Assembler() codeobj = asm.assemble(str=codestr) return codeobj.seg_data[segment]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assemble(self, code):\n try:\n return bytes(self.ks.asm(code)[0])\n except KsError as e:\n print(f\"keystone-error: {e}\")", "def Build_code_segment(self):\r\n\r\n if self.Build_code_segment_Lables() is False:\r\n return False\r\n\r\n\r\n i = 0\r\n...
[ "0.6811429", "0.65692025", "0.6413987", "0.63077104", "0.6244509", "0.62281615", "0.60771173", "0.6068979", "0.6052015", "0.59482956", "0.5944371", "0.58760136", "0.58614343", "0.584893", "0.58337396", "0.5795114", "0.5776901", "0.5773051", "0.57482433", "0.5710207", "0.56900...
0.7421136
0
constructor for the DistributedDoor
def __init__(self, cr): DistributedDoor.DistributedDoor.__init__(self, cr) # We have our own sfx self.openSfx = base.loadSfx("phase_9/audio/sfx/CHQ_door_open.mp3") self.closeSfx = base.loadSfx("phase_9/audio/sfx/CHQ_door_close.mp3")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\r\n door_closed=None,\r\n id=None,\r\n name=None):\r\n\r\n # Initialize members of the class\r\n self.door_closed = door_closed\r\n self.id = id\r\n self.name = name", "def _create_example_door():\n return Door(...
[ "0.69182634", "0.6542418", "0.65244293", "0.64297575", "0.6422218", "0.63829505", "0.6286304", "0.62585914", "0.6233055", "0.6229643", "0.6174574", "0.61619484", "0.61601406", "0.6149267", "0.61352557", "0.6108577", "0.6096215", "0.6085243", "0.6083935", "0.60690933", "0.6051...
0.6989759
0
Class encapsulating all the routines to handle FewShot Dataset.
def __init__(self, ops: Callable, batch_size: int = 4, num_workers: int = 8, path_to_data: str = './project/dataset/few_shot/'): super(FewShotDataModule, self).__init__() self.ops = ops self.path_to_data = path_to_data self.batch_size = batch_size self.num_worke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.__dataset = None", "def __init__(self, dataset: Dataset):\n self.dataset = dataset", "def makeData(datasetNum=0,windowSize=30,rawImages=False,delOuts='No',\r\n timesOut=0,savePath=saveDataPath,jobPathPrint=os.path.join(homeDic,'Tesis','results'),\r\n ...
[ "0.6223255", "0.6154573", "0.61371", "0.61010706", "0.5983094", "0.59646016", "0.59390026", "0.59385157", "0.59247744", "0.5860601", "0.5837316", "0.580573", "0.57949984", "0.57637227", "0.5728933", "0.57239956", "0.5700445", "0.5693204", "0.5690767", "0.5690767", "0.5684317"...
0.6332677
0
Function used to encode the text label to a class index.
def encode_label(self, label: str) -> int: return self.class_map[label]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_label(label: np.array, nb_classes: int):\n encoded = np.zeros(nb_classes)\n encoded[int(label)] = 1.\n return encoded", "def encode(text_tensor, label_tensor):\n # encode text\n encoded_text = encoder.encode(text_tensor.numpy())\n label = tf.where(label_tensor > 3, 1, 0)\n return ...
[ "0.72506154", "0.65827936", "0.649353", "0.6481954", "0.64131033", "0.6369102", "0.6334141", "0.628174", "0.6245085", "0.61747646", "0.61204606", "0.6103294", "0.607614", "0.60226077", "0.59910053", "0.5986428", "0.59480536", "0.5914082", "0.58786565", "0.5870821", "0.5851447...
0.7017993
1
Join to the cluster
def join_cluster(self, *args, **kwargs): return execute(self._join_cluster, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_join(self):\n cluster_id = self.inputs.get('cluster_id')\n result = self.entity.do_join(self.context, cluster_id)\n if result:\n return self.RES_OK, 'Node successfully joined cluster.'\n else:\n return self.RES_ERROR, 'Node failed in joining cluster.'", "d...
[ "0.81979483", "0.7156339", "0.67317516", "0.6681403", "0.66426826", "0.6400989", "0.62271816", "0.61651146", "0.6142238", "0.594846", "0.5935316", "0.59124607", "0.5818141", "0.5703927", "0.56824756", "0.566194", "0.5575374", "0.5538319", "0.55233884", "0.55057085", "0.550234...
0.7931643
1
Formats input to 2dimensional matrix.
def format_input_to_matrix(self, input_field): list_of_lists = [[1 if char == "#" else 0 for char in row] for row in input_field.splitlines()] matrix = np.array(list_of_lists) if len(matrix.shape) != 2: raise ValueError("Input cannot be transformed into matri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_matrix(self) -> types.Matrix:", "def matrixstr(inputstr, converter=proper):\n ys = basicformat(inputstr).split(\"\\n\")\n for x in xrange(0,len(ys)):\n ys[x] = basicformat(ys[x])[1:-1].split(\",\")\n for z in xrange(0, len(ys[x])):\n ys[x][z] = converter(ys[x][z])\n retur...
[ "0.68090653", "0.6681613", "0.66448396", "0.65419585", "0.65297127", "0.6378852", "0.62771195", "0.61594224", "0.61594224", "0.61302036", "0.61130255", "0.6025351", "0.6011699", "0.59965754", "0.5976587", "0.5971092", "0.59704167", "0.5962136", "0.5949896", "0.59397346", "0.5...
0.75995874
0
Generates the perspective of all asteroids.
def generate_asteroid_perspectives(self) -> list: for asteroid in self.asteroids: asteroid.generate_perspective()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asteroidCreator(numCorner,win):\n\n xCoor = []\n yCoor = []\n\n # Creating coordinates of the points\n coorRange = [i for i in range(-10,10) if i not in [0]] # to avoid 0\n\n for i in range(numCorner):\n xCoor.append(round(random.choice(coorRange)*random.uniform(0.01,1),2))\n yCoor...
[ "0.5469995", "0.53294814", "0.53046775", "0.5297338", "0.5267723", "0.5224409", "0.5210212", "0.51551557", "0.51015073", "0.50445867", "0.5043542", "0.5037798", "0.49970928", "0.4990413", "0.4982956", "0.49297538", "0.49115887", "0.49081054", "0.4889357", "0.48541924", "0.485...
0.7725427
0
Finds out whether we already have a blast db with our sequences.
def have_blast_db(self): files = glob.glob(self.db + '.*') if files: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_blast_db_up_to_date(self):\n if not self.have_blast_db():\n return False\n\n # get time creation blast database files\n modification_times = []\n files = glob.glob(self.path)\n for i in files:\n mod_time_in_secs = os.stat(i).st_ctime\n modi...
[ "0.73469496", "0.6673648", "0.6477677", "0.64455414", "0.6319607", "0.6143129", "0.60618526", "0.6050688", "0.6050334", "0.60065585", "0.600043", "0.5947269", "0.59318876", "0.59123963", "0.5893167", "0.5852152", "0.58285624", "0.57546806", "0.574218", "0.57375765", "0.571582...
0.7622861
0
Finds out whether our blast db contains all our sequences. In other words, it finds out whether there are sequences in our postgres db with time_created or time_edited more recent than our blast db files.
def is_blast_db_up_to_date(self): if not self.have_blast_db(): return False # get time creation blast database files modification_times = [] files = glob.glob(self.path) for i in files: mod_time_in_secs = os.stat(i).st_ctime modification_times...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def have_blast_db(self):\n files = glob.glob(self.db + '.*')\n if files:\n return True\n else:\n return False", "def test_build_blast_db_from_seqs(self):\n blast_db, db_files = build_blast_db_from_seqs(self.in_seqs1,output_dir='/tmp')\n self.assertTrue(bla...
[ "0.67333114", "0.61943567", "0.5670304", "0.5529697", "0.55214286", "0.5514977", "0.55013454", "0.5496804", "0.54622734", "0.53780216", "0.53506595", "0.532508", "0.5317816", "0.5289782", "0.52627254", "0.52563477", "0.51983184", "0.5194709", "0.51919824", "0.5167572", "0.511...
0.76628816
0
Query sequences for each gene from database and save them to local disk. Sets attribute `self.seq_file` containing necessary sequences from our database.
def save_seqs_to_file(self): if self.blast_type == 'local': self.seq_file = os.path.join(self.cwd, 'db', "{0}_seqs.fas".format(self.gene_code)) queryset = Sequences.objects.all().filter(gene_code=self.gene_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSequencesFullDatabase(self):\n try:\n con = self.getMetadataDatabaseConnection()\n results = con.cursor()\n con.cursor().callproc('qiime_assets.get_sequences_for_fasta_fulldb', [results])\n for row in results:\n # sequence_name, sequence_stri...
[ "0.62558407", "0.5994861", "0.5742714", "0.573697", "0.5722779", "0.57097745", "0.5703934", "0.5654467", "0.5632036", "0.56149876", "0.5556132", "0.54903823", "0.54600054", "0.5459595", "0.5389197", "0.53569627", "0.53468233", "0.5333283", "0.5323213", "0.5304145", "0.5299089...
0.7641646
0
Creates a BLAST database from our sequences file in FASTA format. Optionally eliminates lowcomplexity regions from the sequences.
def create_blast_db(self): print("Creating blast db") if self.mask: command = 'dustmasker -in ' + self.seq_file + ' -infmt fasta ' command += '-outfmt maskinfo_asn1_bin -out ' + self.seq_file + '_dust.asnb' subprocess.check_output(command, shell=True) # identifying l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(inputFile, databaseFile, blastOperationID, SEG=False, cores=2, minAlignLength=20, maxEValue=1.0, verboseOutput=False):\n \n # Get the location of the BLAST executables.\n srcLocation = os.path.abspath(__file__)\n srcLocation = '\\\\'.join(srcLocation.split('\\\\')[:-1])\n BLASTExecutables =...
[ "0.61570084", "0.60348094", "0.57149684", "0.56990534", "0.56955373", "0.55773324", "0.5558558", "0.55122566", "0.5494971", "0.54733145", "0.5458511", "0.54378974", "0.54134166", "0.5409872", "0.5378593", "0.53140885", "0.52955323", "0.5290472", "0.5282608", "0.52726966", "0....
0.67333204
0
Construct a argparse parser for the command.
def build_parser(self, parser: ArgumentParser) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_parser ():\n\n parser = argparse.ArgumentParser (description = __doc__)\n\n parser.add_argument (\n '-v', '--verbose', dest='verbose', action='count',\n help='increase output verbosity', default=0\n )\n parser.add_argument (\n '-l', '--live', dest='get_live_data', action=...
[ "0.79401547", "0.77520806", "0.77479243", "0.7689581", "0.7674191", "0.76102686", "0.75918", "0.75620496", "0.7557529", "0.7556538", "0.75558466", "0.7550169", "0.7515288", "0.75055146", "0.7492699", "0.74916464", "0.7482083", "0.74781966", "0.74756736", "0.7466516", "0.74664...
0.7889482
1
Calculate the inner product between circuits. Calculates out[i][j] = \langle \psi_{\text{programs[i]}} \\ (\text{symvol_values[i]}) | \psi_{\text{other_programs[j]}} \rangle
def inner_product(programs, symbol_names, symbol_values, other_programs): return MATH_OP_MODULE.tfq_inner_product(programs, symbol_names, tf.cast(symbol_values, tf.float32), other_programs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rhs(t, conc, S_matrix, educt_matrix, kin_par):\n fluxes = calculate_fluxes(conc, S_matrix, educt_matrix, kin_par)\n return np.dot(S_matrix, fluxes)", "def dot_product(v, w):\n return sum(v_i * w_i for v_i, w_i in zip(v, w))", "def solve(self):\n\n # Assign variables to each quantity being s...
[ "0.5440799", "0.53681266", "0.5312834", "0.53000796", "0.5291151", "0.5206172", "0.5203914", "0.5197548", "0.51974136", "0.51925147", "0.51788104", "0.5149962", "0.51408166", "0.51304775", "0.50983024", "0.5098189", "0.5062443", "0.50595677", "0.50455207", "0.50045013", "0.50...
0.6157865
0
p Particle object dt timestep fluid_v carrier gas velocity fvolpp Volume allocated to the droplet mu_g carrier gas viscosity rfluid carrier gas density
def integrateMomentum(p, dt, fluid_v, fvolpp, mu_g, rfluid): #integration constants beta = 2.0/3.0 alpha1 = -4.0/3.0 alpha2 = 1.0/3.0 dtbeta = dt * beta vel1 = p.vel[0] pos1 = dtbeta * vel1 - alpha1 * p.pos[0] - alpha2 * p.pos[1] rp = p.get_density() D = p.get_diameter() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_flux_vector_pms_gr(self):\n soma_prod = 0\n soma_inj = 0\n lim4 = 1e-4\n store_velocity = {}\n store_flux = {}\n for primal in self.primals:\n #1\n primal_id = self.mb.tag_get_data(self.primal_id_tag, primal, flat=True)[0]\n prim...
[ "0.6174772", "0.6172801", "0.6141685", "0.6040374", "0.5988086", "0.5942568", "0.5930524", "0.5926936", "0.5890698", "0.5848722", "0.584072", "0.5839806", "0.5812505", "0.5810274", "0.5797398", "0.5793254", "0.5779884", "0.57735604", "0.57578236", "0.57379186", "0.5727778", ...
0.6747254
0
Get a reference to the Player object that is stored at this node.
def getPlayer(self): return self.__player__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player(self):\n return self._node._player", "def get_player(self):\n return self.player", "def get_player(self):\n return self.player", "def get_player(self):\n\n return self._player", "def get_player(self):\r\n return self.player_control.get_player()", "def get...
[ "0.8167049", "0.8137024", "0.8137024", "0.80869734", "0.8013026", "0.7934076", "0.788203", "0.7812071", "0.7750096", "0.7732342", "0.7633459", "0.7576358", "0.7490069", "0.74441004", "0.7410997", "0.7358482", "0.73308706", "0.7313096", "0.72900695", "0.7235823", "0.7220934", ...
0.81638724
1
Change the node that this node links to in the forward direction.
def connectForward(self, node): if type(node) not in (__rotationnode__, None): raise TypeError("__rotationnode__ must be connected to another __rotationnode__ " + "or to None.") else: self.__next__ = node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward( self ):\n self._has_change = True\n print( \"Forward\" )", "def forward(self):\n self.position += 1", "def forward(self, forward):\n\n self._forward = forward", "def move_to_node(self,node):\n path=self.get_path(self.current_node,node)\n self.move_to(pat...
[ "0.71087116", "0.688736", "0.66664606", "0.6570974", "0.65664065", "0.6552965", "0.65295786", "0.6506856", "0.63835764", "0.6363023", "0.63495225", "0.63280034", "0.62785906", "0.62717354", "0.62289053", "0.62144595", "0.62144595", "0.62088424", "0.6204952", "0.6197944", "0.6...
0.71541446
0
Remove the player of a given color from the list
def removePlayer(self, color): if type(color) not in (player.Player, int): raise TypeError("Input to removePlayer must be of type int or Player.") if type(color) is player.Player: color = color.getColor() if color not in self.__colordict__: raise IndexError("T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __remove_player(self, color):\n self.state.remove_player(color)\n self.violators.append(self.players[color])", "def remove_player(lst,player):\n print(\"Removing\",player)\n cursor=lst.head\n while cursor.data!=player:\n cursor=cursor.next\n if cursor==lst.head:\n curs...
[ "0.84898686", "0.6699175", "0.6558694", "0.6425332", "0.64223915", "0.64222664", "0.6279642", "0.6198242", "0.61895674", "0.61306727", "0.6009862", "0.6002178", "0.5934314", "0.59315556", "0.5924762", "0.58613116", "0.5817343", "0.57990026", "0.57957995", "0.5780872", "0.5773...
0.7908844
1
Inserts a player at a given index of the linked list. Index based on the current node in the rotator.
def insertPlayer(self, player_to_insert, index): if type(player_to_insert) is not player.Player: raise TypeError("The first input to insertPlayer must be of type Player.") elif player_to_insert.getColor() in self.__colordict__: raise ValueError("The player to insert has color " +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, index, item):\n \n # Create a new node\n new_code = Node(item)\n \n # Go to node (index - 1)\n curr = self.first\n for i in range(index - 1):\n curr = curr.next\n \n old_next_node = curr.next \n # Update curr's next attribute\n curr.next = new_node\n \...
[ "0.6746756", "0.66824883", "0.6655358", "0.6649492", "0.65597695", "0.646736", "0.64672905", "0.6439435", "0.64367497", "0.6404763", "0.63344413", "0.63304937", "0.63191634", "0.63115674", "0.6285811", "0.62856776", "0.6224067", "0.6201135", "0.62010837", "0.6174868", "0.6150...
0.8299688
0
Return the color of the current player.
def getCurrentColor(self): if self.__currentnode__ is None: return None else: return self.__currentnode__.getPlayer().getColor()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player(self):\n return self._color", "def get_color(self):\n return self.color", "def get_color(self):\n\n return self.color", "def get_color(self):\r\n if self.color:\r\n return \"RED\"\r\n else:\r\n return \"BLACK\"", "def getTurn(self):\r\n ...
[ "0.887242", "0.7769796", "0.773395", "0.7628914", "0.76187915", "0.75915945", "0.7585518", "0.7585495", "0.7585495", "0.7580637", "0.7549666", "0.74911374", "0.7473557", "0.7471987", "0.74684536", "0.74063176", "0.74026126", "0.7393071", "0.7393071", "0.7372746", "0.7335303",...
0.8330503
1
Sets the current node to be the next node in the rotator; returns a reference to the next player in the game.
def rotate(self): self.__currentnode__ = self.__currentnode__.getNext() return self.__currentnode__.getPlayer()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_player(self) -> None:\n self.player = (self.player + 1) % len(self.players)", "def nextPlayer(self):\n self.turn += 1\n if self.turn >= len(self.players):\n self.turn = 0\n return self.players[self.turn]", "def choose_next_player(self):\n player_index = se...
[ "0.70429957", "0.6682148", "0.6675831", "0.6530354", "0.64803374", "0.64803374", "0.64188594", "0.6399888", "0.63995004", "0.63221467", "0.62983274", "0.62983274", "0.62983274", "0.6298032", "0.62013406", "0.6124866", "0.60894156", "0.5984055", "0.59822726", "0.597296", "0.59...
0.7356293
0
Determines whether or not the rotation contains the input color.
def hasColor(self, color): if type(color) is not int: raise TypeError( "Color must be of type int." ) else: return color in self.__colordict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isColor(self,color):\n return self.color==color", "def is_color(self, color: ColorLike) -> bool:\n\n if isinstance(color, Color):\n return self.color == color\n elif isinstance(color, str):\n return str(self.color) == color\n elif isinstance(color, int):\n ...
[ "0.7632322", "0.6853061", "0.68446946", "0.6713104", "0.66789967", "0.6584735", "0.654394", "0.65426993", "0.64411867", "0.6439629", "0.6418472", "0.63832796", "0.6372706", "0.63362575", "0.62745297", "0.6258238", "0.6251041", "0.6243719", "0.6134679", "0.61269027", "0.607104...
0.70988774
1
Get the initial player in the rotation.
def getInitialPlayer(self): return self.__colordict__[self.__initial_color__]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_player(self):\r\n return self.player_control.get_player()", "def get_current_player(self) :\n return self.current_player", "def get_player(self):\n return self.player", "def get_player(self):\n return self.player", "def get_current_player(self):\n return self.curr...
[ "0.67792255", "0.6683321", "0.6679362", "0.6679362", "0.6641321", "0.6535531", "0.65134996", "0.64985627", "0.64315325", "0.6425736", "0.64020354", "0.6384658", "0.6335347", "0.63072383", "0.6306392", "0.6306392", "0.62981606", "0.62846535", "0.62834686", "0.62833756", "0.628...
0.71134573
0
The function takes the original Q tensors from the global QR calculation and sets them to the keys which corresponds with their tile coordinates in Q. this returns a separate dictionary, it does NOT set the values of Q
def __split0_global_q_dict_set( q_dict_col: Dict, col: Union[int, torch.Tensor], r_tiles: SquareDiagTiles, q_tiles: SquareDiagTiles, global_merge_dict: Dict = None, ) -> None: # q is already created, the job of this function is to create the group the merging q's together # it takes the merg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def q_mapping(obs,ctr,scn,nq):\n \n # Calculate quantile locations to be used in the next step\n q_intrvl = 100/float(nq); qtl_locs = np.arange(0,100+q_intrvl,q_intrvl) \n\n # Calculate quantiles\n q_obs = np.percentile(obs, list(qtl_locs), axis=0)\n q_ctr = np.percentile(ctr, list(qtl_locs), axi...
[ "0.5927652", "0.5902974", "0.5806253", "0.57689476", "0.5717509", "0.57167417", "0.5679408", "0.56786275", "0.5521916", "0.5502122", "0.5482626", "0.54714596", "0.54682165", "0.54096085", "0.5397939", "0.53241926", "0.53108263", "0.5304668", "0.52999914", "0.52928716", "0.528...
0.62476426
0
Sets the values of ``q_dict_waits`` with the with waits for the values of Q, ``upper.shape``, and ``lower.shape`` This function sends the merged Q to the diagonal process. Buffered send it used for sending Q. This is needed for the Q calculation when two processes are merged and neither is the diagonal process.
def __split0_send_q_to_diag_pr( col: int, pr0: int, pr1: int, diag_process: int, comm: MPICommunication, q_dict: Dict, key: str, q_dict_waits: Dict, q_dtype: Type[datatype], q_device: torch.device, ) -> None: if comm.rank not in [pr0, pr1, diag_process]: return # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __split0_q_loop(\n col: int,\n r_tiles: SquareDiagTiles,\n proc_tile_start: torch.Tensor,\n active_procs: torch.Tensor,\n q0_tiles: SquareDiagTiles,\n q_dict: Dict,\n q_dict_waits: Dict,\n) -> None:\n tile_columns = r_tiles.tile_columns\n diag_process = (\n torch.nonzero(input...
[ "0.56719124", "0.5636975", "0.55691105", "0.52988166", "0.5298728", "0.50245374", "0.48964167", "0.48948377", "0.48767176", "0.48708045", "0.48692414", "0.48371303", "0.47913766", "0.47867444", "0.47623754", "0.4744241", "0.4692244", "0.4692244", "0.466798", "0.4640844", "0.4...
0.62920827
0
Helper function to do the QR factorization of the column ``dcol``. This function assumes that the target tile is at ``(dcol, dcol)``. This is the standard case at it assumes that the diagonal tile holds the diagonal entries of the matrix.
def __split1_qr_loop( dcol: int, r_tiles: SquareDiagTiles, q0_tiles: SquareDiagTiles, calc_q: bool ) -> None: r_torch_device = r_tiles.arr.larray.device q0_torch_device = q0_tiles.arr.larray.device if calc_q else None # ==================================== R Calculation - single tile ===================...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qr_step_factorization(q, r, iter, n):\n v = column_convertor(r[iter:, iter])\n Hbar, reflect = householder_transformation(v)\n H = np.identity(n)\n H[iter:, iter:] = Hbar\n r = np.matmul(H, r)\n q = np.matmul(q, H)\n return q, r,reflect", "def local_orthonormalize_right_qr(A: np.ndarray,...
[ "0.56187713", "0.5293593", "0.52804154", "0.5169652", "0.51525825", "0.5132492", "0.5120392", "0.5117227", "0.509458", "0.5033757", "0.5033165", "0.5020063", "0.5002957", "0.49987388", "0.4971418", "0.49628642", "0.4934973", "0.49291345", "0.49189776", "0.48818493", "0.487487...
0.69911176
0
Test that manager is run for spawned processes and permissions are copied.
def test_spawned_process(self): DescriptorSchema.objects.create( name="Test schema", slug="test-schema", contributor=self.contributor ) spawned_process = Process.objects.filter(slug="test-save-file").latest() # Patch the process to create Entity, so its bahaviour can be teste...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_clone_system(self):\n pass", "def test_addProcess(self):\r\n self.pm.addProcess(\"foo\", [\"arg1\", \"arg2\"],\r\n uid=1, gid=2, env={})\r\n self.assertEqual(self.pm.protocols, {})\r\n self.assertEqual(self.pm.processes,\r\n ...
[ "0.65644", "0.6003337", "0.59661263", "0.58780044", "0.58577317", "0.5805636", "0.57970107", "0.57848763", "0.5778172", "0.57535994", "0.57349616", "0.57299143", "0.57228744", "0.57185805", "0.5704733", "0.5685217", "0.5681939", "0.5675538", "0.56648135", "0.55828786", "0.556...
0.6611427
0
Test that manager handles dependencies correctly.
def test_dependencies(self): process_parent = Process.objects.filter(slug="test-dependency-parent").latest() process_child = Process.objects.filter(slug="test-dependency-child").latest() data_parent = Data.objects.create( name="Test parent", contributor=self.contributor, process=proc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_manager(self):\n manager = ISubscriptionManager(self.root.document, None)\n self.assertNotEqual(manager, None)\n self.assertTrue(verifyObject(ISubscriptionManager, manager),)\n\n manager = ISubscriptionManager(self.root, None)\n self.assertNotEqual(manager, None)\n ...
[ "0.67114073", "0.6550478", "0.650485", "0.6488792", "0.64762217", "0.6382587", "0.6376858", "0.62933004", "0.62411", "0.6233791", "0.6221906", "0.6188809", "0.61576146", "0.61123097", "0.61094993", "0.60978365", "0.6092088", "0.6081467", "0.60474753", "0.60340434", "0.600903"...
0.7210767
0
Create QuantizableMultiheadAttention using existing torch.nn.MultiheadAttention module
def create_quantizable_multihead_attention(module: torch.nn.MultiheadAttention) -> QuantizableMultiheadAttention: # inspect MHA if bias is required. bias = module.in_proj_bias is not None # if bias k/v parameter exist set quantizable MHA to create 3 separate bias tensors as expected. add_bias_kv = modu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, nheads, d_model):\n super(MultiheadAttention, self).__init__()\n assert d_model % nheads == 0\n self.d_head = d_model // nheads\n self.nheads = nheads\n self.Q_fc = nn.Linear(d_model, d_model, bias=False)\n self.K_fc = nn.Linear(d_model, d_model, bias=Fa...
[ "0.7359756", "0.68123704", "0.67885345", "0.6468373", "0.6447356", "0.6433596", "0.6429627", "0.63708127", "0.63569427", "0.6331215", "0.6149882", "0.61356103", "0.6109166", "0.5999494", "0.592633", "0.589276", "0.58799094", "0.587137", "0.58697736", "0.58150625", "0.58126575...
0.7555401
0
Copy params in torch enc/dec modules to equivalent quantizable enc/dec modules
def copy_params_helper(src_module: Union[torch.nn.TransformerEncoderLayer, torch.nn.TransformerDecoderLayer], dest_module: Union[QuantizableTransformerEncoderLayer, QuantizableTransformerDecoderLayer]): if isinstance(src_module, torch.nn.TransformerEncoderLayer): assert isinstance(des...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _quantize_dequantize_params(self, inputs=None) -> Dict[str, torch.Tensor]:\n quantized_params = dict()\n shadow_params = {name: param.detach().clone() for name, param in self.named_parameters(recurse=False)}\n\n if self._mode != QcQuantizeOpMode.LEARN_ENCODINGS:\n quantizer_par...
[ "0.5870018", "0.5863496", "0.5846493", "0.57170206", "0.5648641", "0.5619291", "0.5612991", "0.5595354", "0.5577201", "0.5541977", "0.551577", "0.55136937", "0.54773694", "0.5475649", "0.54494977", "0.5401601", "0.5396617", "0.53936434", "0.5381224", "0.53808457", "0.5379783"...
0.70530415
0
Create QuantizableTransformerEncoderLayer using existing torch.nn.TransformerEncoderLayer module
def create_quantizable_transformer_encoder_layer( transformerEncoderLayer: torch.nn.TransformerEncoderLayer) -> QuantizableTransformerEncoderLayer: if isinstance(transformerEncoderLayer.activation, (torch.nn.modules.activation.ReLU, torch.nn.functional.relu)): activation = 'relu' elif isinstance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_quantizable_transformer_decoder_layer(\n transformerDecoderLayer: torch.nn.TransformerDecoderLayer) -> QuantizableTransformerDecoderLayer:\n if isinstance(transformerDecoderLayer.activation, (torch.nn.modules.activation.ReLU, torch.nn.functional.relu)):\n activation = 'relu'\n elif i...
[ "0.70781934", "0.70162743", "0.6731187", "0.66876096", "0.6673275", "0.66444963", "0.6559612", "0.64045185", "0.64026624", "0.6397527", "0.639162", "0.6375698", "0.6288753", "0.6215724", "0.6215724", "0.6181808", "0.6100169", "0.6073622", "0.6068329", "0.6037959", "0.5962546"...
0.7957517
0
Create QuantizableTransformerDecoderLayer using existing torch.nn.TransformerDecoderLayer module
def create_quantizable_transformer_decoder_layer( transformerDecoderLayer: torch.nn.TransformerDecoderLayer) -> QuantizableTransformerDecoderLayer: if isinstance(transformerDecoderLayer.activation, (torch.nn.modules.activation.ReLU, torch.nn.functional.relu)): activation = 'relu' elif isinstance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\n input_dim,\n dec_seq_len,\n out_seq_len,\n d_model=512,\n nhead=8,\n num_encoder_layers=6,\n num_decoder_layers=6,\n dim_feedforward=2048,\n dropout=0...
[ "0.702472", "0.70195657", "0.6886643", "0.6745618", "0.6719266", "0.67005277", "0.6604023", "0.6594004", "0.6535458", "0.65032774", "0.64818937", "0.6135744", "0.6094426", "0.6070778", "0.60691684", "0.6042012", "0.603544", "0.5981115", "0.5966625", "0.59493333", "0.5927086",...
0.7868481
0
Searches for the given project and interactively add an alias for it.
def alias(ctx, search, backend): projects = ctx.obj['projects_db'].search(search, active_only=True) projects = sorted(projects, key=lambda project: project.name) if len(projects) == 0: ctx.obj['view'].msg( "No active project matches your search string '%s'." % ''.join(search...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_alias(conn, alias, directory):\n with conn:\n c = conn.cursor()\n c.execute(\"\"\"INSERT OR REPLACE \n INTO projects (project, alias, called) \n VALUES \n (?, ?,\n (SELECT called FROM projects WHERE project=?)...
[ "0.71199477", "0.6699527", "0.66228354", "0.6371681", "0.63583446", "0.6141792", "0.61209464", "0.6013089", "0.5956264", "0.5955764", "0.5920077", "0.58468515", "0.57715166", "0.5761591", "0.5758843", "0.5730115", "0.5653726", "0.5653726", "0.5653726", "0.5621284", "0.5600018...
0.78292143
0
Shows the details of the given project id.
def show(ctx, project_id, backend): try: project = ctx.obj['projects_db'].get(project_id, backend) except IOError: raise Exception("Error: the projects database file doesn't exist. " "Please run `taxi update` to create it") if project is None: ctx.obj['view']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def projectdetails(http_request, project_id=0):\n\tp = get_object_or_404(Project, pk=project_id)\n\treturn render_to_response('project_detail.html', {'project': p})", "def show_keystone_v3_project(self, project_id):\n LOG_OBJ.debug(\"Details of a project.\")\n\n _url = \"http://\" + self.host_ip + ...
[ "0.82351893", "0.8109695", "0.8044118", "0.77386487", "0.7733019", "0.7623847", "0.7187142", "0.7156952", "0.70766926", "0.70337224", "0.7005428", "0.69749594", "0.68737483", "0.6820321", "0.6795565", "0.67338365", "0.6699682", "0.6687962", "0.6685984", "0.66857177", "0.66841...
0.8210428
1
Creates and returns an instance of the model given its class name. The created model has a single placeholder node for feeding images.
def load_model(name, input_node): # Find the model class from its name all_models = models.get_models() net_class = [model for model in all_models if model.__name__ == name][0] # Construct and return the model return net_class({'data': input_node})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __create_model(self, classes):\r\n # self._model = model_zoo.get_model(model_name, classes=classes, pretrained_base=True)\r\n # self._model = model_zoo.get_model(model_name, classes=classes, pretrained=True)\r\n # self._model.reset_class(classes, reuse_weights=[cname for cname in classes i...
[ "0.6866208", "0.68503696", "0.68454343", "0.6812417", "0.66727096", "0.65915483", "0.6528973", "0.64644384", "0.645776", "0.64537036", "0.6433563", "0.64170647", "0.6410114", "0.64038175", "0.6396867", "0.63915294", "0.6362359", "0.6344983", "0.63364524", "0.6318251", "0.6311...
0.6971661
0
Transitions to GameState by calling const.toGameState with inputfile based on the map selected by the user
def toGameState(self): level = self.mapselector.selectedmap const.toGameState(self,level)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_map(self, filename):\n with open(filename, 'rb') as file:\n self.current_obstacles = pickle.load(file)\n self.current_goal = pickle.load(file)\n try:\n setstate(pickle.load(file))\n except EOFError:\n print(\"No random state ...
[ "0.6479027", "0.5731882", "0.56963575", "0.5675572", "0.5618316", "0.55608374", "0.5555802", "0.54880124", "0.5480844", "0.5461325", "0.538295", "0.5382765", "0.5353739", "0.5349232", "0.5346233", "0.53402114", "0.5322603", "0.52913374", "0.52791333", "0.5279067", "0.52697134...
0.7049295
0
Pick a map and set it as the new selected map.
def pickMap(self, selectedmap): for lvl in self.maplevels: lvl.style.border_color = (255,255,255) self.selectedmap = selectedmap; self.maplevels[selectedmap].style.border_color = (0,0,0) self.repaint() self.slevel.mapimage.value = pygame.image.load("../media/map...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setMap(self, map):\n maputils.detachMapStats(self.map)\n\n activeTool = self._activeTool\n self.__base.setMap(self, map)\n if activeTool:\n self.setTool(activeTool)\n\n self._updateLevelSlider()", "def include(self, map):\n self.map.update(map)", "def af...
[ "0.58437437", "0.57824117", "0.5533699", "0.5533699", "0.54047614", "0.540364", "0.53759736", "0.53739995", "0.53449905", "0.53392667", "0.53183043", "0.52626765", "0.523756", "0.5232637", "0.523137", "0.51654667", "0.5155839", "0.51373845", "0.5114232", "0.5095387", "0.50911...
0.6736006
0
Goes to the next level range. Do nothing if there is no next range
def nextRange(self): if (self.selectedmap < len(self.maplevels)-1): self.pickMap(self.selectedmap+1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next(self):\n if self.current_level > self.bottomlevel:\n self.current_level = self.toplevel\n raise StopIteration\n\n else:\n self.current_level += 1\n return self.levels[self.current_level - 1]", "def goto_next_level(self, *args):\n self.mana...
[ "0.68458486", "0.67493486", "0.63121545", "0.6078789", "0.5931842", "0.59241134", "0.58290625", "0.5774616", "0.57327336", "0.57327336", "0.565613", "0.5642292", "0.5625453", "0.559918", "0.55771357", "0.55751896", "0.55737096", "0.5536728", "0.54708314", "0.54238325", "0.541...
0.7650967
0
Goes to the previous level range. Do nothing if there is no previous range
def previousRange(self): if (self.selectedmap > 0): self.pickMap(self.selectedmap-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def previous_level(self, level):\n\n if level is None:\n return None\n\n index = list(self._levels).index(str(level))\n if index == 0:\n return None\n else:\n return self.levels[index - 1]", "def previous(self,dec=-1):\n for i in range(-dec):\n ...
[ "0.6885862", "0.67986095", "0.6496811", "0.64732254", "0.63872933", "0.6317938", "0.63080925", "0.63047415", "0.62651557", "0.6241353", "0.6158455", "0.61581993", "0.60941464", "0.6070453", "0.6059404", "0.5994253", "0.59840447", "0.5951923", "0.59492105", "0.59173983", "0.58...
0.78019625
0
As the url in the db is saved for the french site lachambre.be, I change the language argument of the url from fr to nl if needed
def change_url_to_nl(voters): cur_language = translation.get_language() if cur_language == 'nl': for voter in voters: if voter.voter_url is not None: voter.voter_url = (voter.voter_url).replace('fr', 'nl') return voters
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_language_of_horizon_url(self) -> str:\n if 'horizons-mag' in self.url_h:\n self.language = 'en'\n elif 'horizonte-magazin' in self.url_h:\n self.language = 'de'\n elif 'revue-horizons' in self.url_h:\n self.language = 'fr'", "def barbican_url(self):",...
[ "0.58890593", "0.5854874", "0.5818221", "0.5788316", "0.57766867", "0.57766867", "0.5716042", "0.5701955", "0.5622571", "0.56120205", "0.5609952", "0.55715686", "0.5571492", "0.5571441", "0.5548061", "0.55407554", "0.54799944", "0.5475426", "0.54615086", "0.54409945", "0.5414...
0.58944994
0
Gets a single fortune at random
def get_fortune(): data_file = get_data_file() fortunes=get_fortunes(data_file) return random.choice(fortunes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pick_one(self):\n index = 0\n r = random.random()\n while r >= 0:\n r = r - self.normalised_fitness[index]\n index += 1\n index -= 1\n return self.population[index]", "def __call__(self):\n return random.choice(self.fakers)", "def female_first...
[ "0.6898278", "0.65897125", "0.6519186", "0.6473314", "0.6413659", "0.6365125", "0.6336889", "0.63045985", "0.6272564", "0.6268574", "0.6263803", "0.62386346", "0.6227292", "0.62231725", "0.6203827", "0.6183958", "0.6183958", "0.6183958", "0.6183958", "0.6183232", "0.61782", ...
0.7927623
0
Gets a summoner's match history summoner Summoner the summoner to get match history for begin_index int the game index to start from (default 1) begin_time int | datetime the begin time to use for fetching games (default 0) end_time int | datetime the end time to use for fetching games (default 0) champions Champion | ...
def get_match_list(summoner, begin_index=-1, begin_time=0, end_time=0, champions=None, ranked_queues=None, seasons=None): if(ranked_queues and isinstance(ranked_queues, list)): for queue in ranked_queues: if queue not in cassiopeia.type.core.common.ranked_queues: raise ValueError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMatchHistory(self, **kwargs):\n return self.makeRequest('GetMatchHistory', **kwargs)", "async def get_match_history(self, player: model.Player):\n return await self._get_match_history(\n player.server, player.realm, player.player_id)", "def get_match_history(self, account_id=Non...
[ "0.69713193", "0.65468955", "0.63326955", "0.61249787", "0.5986786", "0.58622706", "0.58153903", "0.5749948", "0.56971943", "0.56679434", "0.5644218", "0.5627797", "0.5587484", "0.5540032", "0.55340147", "0.5503995", "0.54861253", "0.54635966", "0.54457664", "0.5436802", "0.5...
0.7535839
0
Add plugin from GitHub. This function adds a plugin hosted on GitHub and returns a Plugin object.
def add_plugin_from_gh( user: str, branch: str, plugin: str, repo: str = "polus-plugins", manifest_name: str = "plugin.json", ): l = [user, repo, branch, plugin, manifest_name] u = "/".join(l) url = urljoin("https://raw.githubusercontent.com", u) logger.info("Adding %s" % url) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addPlugin(self, *args):\n return _libsbml.ASTNode_addPlugin(self, *args)", "def add(name, url):\n click.echo(\"registered repo {} at url {}\".format(name, url))", "def download_plugin(name):\n uri = 'https://github.com/drupdates/' + name + '.git'\n plugins_dir = Utils.check_dir(os.p...
[ "0.60405266", "0.6007814", "0.5963083", "0.5788674", "0.57062566", "0.56668466", "0.5545024", "0.54045683", "0.54018205", "0.5361744", "0.5267307", "0.52585196", "0.5200405", "0.5200405", "0.51859343", "0.51733756", "0.5154143", "0.5127987", "0.5118342", "0.5106902", "0.51030...
0.7669405
0
Register a duplicate user.
def test_register_duplicate(self): self._storage.register_user("user1", "code1") with self.assertRaises(DuplicateUserException): self._storage.register_user("user1", "code1")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_duplicate_user(self, mapp, existing_user_id):\n\n mapp.create_user(user=existing_user_id, password=1234,\n email=existing_user_id + \"@example.com\", code=409)", "def register(self):\n try:\n sha = sha1(self.email).hexdigest()\n except TypeError:\n...
[ "0.7274285", "0.71714056", "0.7146575", "0.70193654", "0.69966704", "0.6946811", "0.6935643", "0.6895192", "0.6807693", "0.67858785", "0.66933405", "0.6621294", "0.6596975", "0.6591064", "0.65543205", "0.65396696", "0.6526063", "0.6518824", "0.6502562", "0.64926463", "0.64918...
0.76736176
0
Register a group with a missing user.
def test_register_group_missing_user(self): with self.assertRaises(UserNotFoundException): self._storage.register_group("group1", "user1")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_new_user_group(self, token, userGroup):\n requestUser = self.get_username_from_token(token)\n dataBase = self.read_database()\n userGroups = dataBase['userGroups']\n if userGroup not in userGroups:\n newGroup = dict()\n newGroup['owners'] = [requestUser]...
[ "0.6906637", "0.6822164", "0.67328525", "0.66948164", "0.6683261", "0.66260225", "0.6606365", "0.6603444", "0.6590585", "0.65744084", "0.6480749", "0.64576936", "0.63995737", "0.630923", "0.62902427", "0.62659585", "0.625644", "0.62553716", "0.625332", "0.6244452", "0.6216296...
0.84940636
0
Register a duplicate group.
def test_register_duplicate_group(self): self._storage.register_group("group1", []) with self.assertRaises(DuplicateGroupException): self._storage.register_group("group1", [])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_group(self, group):\n if group.name in self._groups:\n return\n\n self._groups[group.name] = copy.copy(group)", "def test_duplicate_groups(self):\n\n auag = UsersAndGroups()\n\n # create a duplicate with default flag to raise an error.\n auag.add_group(G...
[ "0.73439246", "0.6608098", "0.6573205", "0.64657897", "0.64264894", "0.61659867", "0.6136936", "0.6077662", "0.6000547", "0.5942126", "0.58833224", "0.5822592", "0.5764002", "0.5744866", "0.57005095", "0.5676727", "0.5670951", "0.56391466", "0.5634035", "0.56179327", "0.56149...
0.78382325
0
Get a list of registered platforms from Volttron Central.
def list_platforms(self): return self.do_rpc('list_platforms')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platforms(self):\n logger.debug(\"Get platforms\")\n return self._raw_api.platforms.get()", "def platforms(self) -> Any:\n\n return search_api(\"platforms\")", "def get_platforms(self):\n _log.debug(\"Passing platforms back: {}\".format(\n self._registered_platforms.k...
[ "0.79559594", "0.78949493", "0.78682095", "0.77720857", "0.7327511", "0.72999084", "0.718141", "0.7091689", "0.7069216", "0.6976398", "0.68963903", "0.6848046", "0.6713361", "0.6490465", "0.63321245", "0.6299962", "0.62283295", "0.6188314", "0.6154324", "0.61413777", "0.60337...
0.8353335
0
Install an agent on a platform
def install_agent(self, platform_uuid, fileargs): rpc = 'platforms.uuid.{}.install'.format(platform_uuid) return self.do_rpc(rpc, files=[fileargs])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _Install(vm):\n if vm.OS_TYPE not in MOFED_OS_MAPPING:\n raise ValueError('OS type {} not in {}'.format(vm.OS_TYPE,\n sorted(MOFED_OS_MAPPING)))\n driver = MOFED_DRIVER.format(version=FLAGS.mofed_version,\n os=MOFED_OS_MAPPING...
[ "0.6512521", "0.63495594", "0.62828934", "0.6178489", "0.61170703", "0.5913376", "0.59123486", "0.5907192", "0.5869629", "0.5869629", "0.5779979", "0.5777191", "0.5748195", "0.5734884", "0.5715492", "0.5690907", "0.5638299", "0.5633946", "0.5613986", "0.5607763", "0.55736023"...
0.77948576
0
List agents installed on a platform
def list_agents(self, platform_uuid): return self.do_rpc('platforms.uuid.' + platform_uuid + '.list_agents')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_agents(self):\n path = '/os-agents'\n res = self.compute.call(path, 'GET', data='', \n token=self.manager.identity.token)\n self.logger.debug('Get openstack compute agents: %s' % truncate(res))\n return res[0]['agents']", "def list_platforms(...
[ "0.6422807", "0.63202703", "0.63177466", "0.62113905", "0.61999303", "0.6108037", "0.606727", "0.6026851", "0.58505917", "0.5766783", "0.5763186", "0.5744758", "0.5741226", "0.5725286", "0.5718311", "0.56926", "0.56372213", "0.5620264", "0.5602373", "0.55926174", "0.5589764",...
0.7177959
0
Unregister a platform with Volttron Central
def unregister_platform(self, platform_uuid): return self.do_rpc('unregister_platform', platform_uuid=platform_uuid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unregister_platform(self, name, recursive=False):\r\n if name in dict(self._platforms):\r\n self.unregister_platform_instance(self._platforms[name], recursive)", "def uninstall_platform(self):\n if self.status: self.status.Warning(\"Uninstall Function Not Implemented Yet!\")", "def...
[ "0.698062", "0.6740588", "0.6413033", "0.6359782", "0.6159912", "0.61261886", "0.6108958", "0.61039925", "0.6029002", "0.6007926", "0.59983724", "0.58956426", "0.5880987", "0.5870724", "0.5862029", "0.58457565", "0.58429253", "0.58267224", "0.5824174", "0.58096266", "0.575297...
0.68936825
1
Get the value of a setting in Volttron Central
def get_setting(self, setting): return self.do_rpc("get_setting", key=key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_setting_value(self, title, setting):\r\n return self.parser.get(title, setting)", "def get_setting(self, id):\n return __settings__.getSetting(id)", "def getValue(self, valueName):\n\t\treturn self.settings[valueName][0]", "def settings():\n return _get_settings()[1]", "def get_value...
[ "0.7787212", "0.7248956", "0.72202295", "0.70369846", "0.6987221", "0.68563503", "0.6849892", "0.6812482", "0.67753273", "0.6677042", "0.6615332", "0.66040915", "0.6596144", "0.6589712", "0.6572019", "0.6562295", "0.65515554", "0.6486597", "0.64617866", "0.64070135", "0.63320...
0.7537998
1
Validate that the message is a jsonrpc response.
def validate_response(response): assert response.ok rpcdict = response.json() assert rpcdict['jsonrpc'] == '2.0' assert rpcdict['id'] assert 'error' in rpcdict.keys() or 'result' in rpcdict.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_response(self, response):\n # Check for unexpected response - all should be JSON dicts that have\n # already been deserialised\n if not isinstance(response, types.DictionaryType):\n self.message(\n \"\\t\\t[!] ERROR - Unexpected value returned from the A...
[ "0.68757004", "0.68732953", "0.6858949", "0.684949", "0.67442304", "0.6635756", "0.6615446", "0.6575764", "0.64618057", "0.63298357", "0.6306663", "0.6277476", "0.6220209", "0.6206446", "0.6165737", "0.61612725", "0.6149373", "0.61491615", "0.6148954", "0.6147801", "0.6126649...
0.75467145
0
decorator to log execution time during feature calculation
def log_execution_time(f): @wraps(f) def wrap(self, *args, **kw): self.logger.info('id %i: start task.' %self._idx) start = time() result = f(self, *args, **kw) end = time() self.logger.info('id %i: finished task.' %self._idx) # self.logger.info('%r args:[%r] took...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_time(func):\n\n @wraps(func)\n def wrapper(*args, **kwargs):\n start = time.time()\n result = func(*args, **kwargs)\n end = time.time()\n f = open(\"log_dev.txt\",'a',encoding=\"utf8\")\n time_res = end - start\n f.write(\"\\n\"+func.__name__+ \" time = \" + ...
[ "0.70393986", "0.7010503", "0.6937647", "0.6859472", "0.68527126", "0.68271136", "0.68165493", "0.6796273", "0.67023146", "0.66617054", "0.6657132", "0.66361135", "0.6630322", "0.6555471", "0.65313274", "0.6521834", "0.6521601", "0.6508513", "0.64661336", "0.6465001", "0.6454...
0.72618866
0
updates seeds and running index of associated with the current data sample of the dataset
def _update_meta_features(self, seed_iter=None): self._idx += 1 if self.random_seeds: self._seeds = list(map(next,seed_iter)) self._set_new_seed()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_update(self):\n sample = np.random.choice(self._seeds, 1, replace=False, p=self._seed_weights)[0]\n index = self._seeds.index(sample)\n new_seed = random.choice([neb for neb in self._graph.neighbors(sample)])\n self._edges.add((sample, new_seed))\n self._nodes.add(sample)...
[ "0.72880256", "0.6262154", "0.620765", "0.6171646", "0.6171646", "0.6164777", "0.6146473", "0.60583705", "0.60544515", "0.60421824", "0.6037721", "0.6037721", "0.6037721", "0.6011894", "0.5972331", "0.59604025", "0.59604025", "0.5936932", "0.593096", "0.59270763", "0.5916012"...
0.6609627
1
provides the extracted features, sampler seeds and indices. Yields dict a sample of the dataset containing the extracted feature data, seeds, and index
def get_data(self): if self.random_seeds: self._validate_random_seeds() seed_iter = list(map(iter,self.random_seeds)) nsamples = len(self.random_seeds[0]) else: seed_iter = None nsamples = self.numsamples self._set_meta_features() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(self):\n if self.random_seeds: \n self._validate_random_seeds()\n seed_iter = list(map(iter,self.random_seeds))\n nsamples = len(self.random_seeds[0])\n else:\n seed_iter = None\n nsamples = self.numsamples\n progress_bar = tq...
[ "0.6341462", "0.6323813", "0.6315713", "0.6274175", "0.61742675", "0.6166477", "0.61653024", "0.6025387", "0.6022512", "0.5987382", "0.5963382", "0.5939139", "0.5932677", "0.5921914", "0.59174365", "0.5895711", "0.58870596", "0.5873478", "0.5846503", "0.5781728", "0.5766555",...
0.795271
0
schedules the calculation of a new data sample and adds the sample index and start time to a task dictionary
def _schedule(self,task_dict): times = [time(), None, None, None] # (schedule timestamp, execution timestamp, stop timestamp, get timestamp) result_id = self._extract_features.remote(self, times) # calculation is started in new remote task task_dict[result_id] = self._idx # add sample index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(self):\n if self.random_seeds: \n self._validate_random_seeds()\n seed_iter = list(map(iter,self.random_seeds))\n nsamples = len(self.random_seeds[0])\n else:\n seed_iter = None\n nsamples = self.numsamples\n progress_bar = tq...
[ "0.6486454", "0.62081647", "0.59493905", "0.5862", "0.57385164", "0.5715011", "0.56693166", "0.5653303", "0.5627138", "0.5610653", "0.5441194", "0.5423571", "0.5413709", "0.538299", "0.53532475", "0.53512204", "0.53012866", "0.5299215", "0.52941316", "0.52799594", "0.5279017"...
0.79128414
0
provides the extracted features, sampler seeds and indices. The calculation of all data samples is performed in parallel and asynchronously.
def get_data(self): if self.random_seeds: self._validate_random_seeds() seed_iter = list(map(iter,self.random_seeds)) nsamples = len(self.random_seeds[0]) else: seed_iter = None nsamples = self.numsamples progress_bar = tqdm(range(nsam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(self):\n if self.random_seeds: \n self._validate_random_seeds()\n seed_iter = list(map(iter,self.random_seeds))\n nsamples = len(self.random_seeds[0])\n else:\n seed_iter = None\n nsamples = self.numsamples\n self._set_meta_fe...
[ "0.7351609", "0.6300087", "0.6236659", "0.6185316", "0.6151368", "0.6082172", "0.60764116", "0.5954009", "0.5931846", "0.5917077", "0.5900085", "0.5897292", "0.588079", "0.5879187", "0.5858166", "0.5816949", "0.5761137", "0.5754771", "0.57473797", "0.5735645", "0.5724053", ...
0.70604247
1
Moves the given actor to its next position according to its velocity. Will wrap the position from one side of the screen to the other when it reaches the edge in either direction.
def _move_actor(self, actor): actor.center_x = actor.center_x + actor.change_x actor.center_y = actor.center_y + actor.change_y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self):\r\n\r\n self.velocity = 1\r\n new_pos = self.pos\r\n self.model.space.move_agent(self, new_pos)", "def move(self, vel: float) -> None:\n self.first_x -= vel\n self.second_x -= vel\n\n if self.first_x <= -Base.Width:\n self.first_x = self.second...
[ "0.66695637", "0.651844", "0.6495226", "0.6482961", "0.6469203", "0.6419651", "0.6325121", "0.62894017", "0.62786466", "0.6251047", "0.62427455", "0.6236597", "0.61745286", "0.61707705", "0.6135275", "0.61269504", "0.61254746", "0.61162204", "0.608211", "0.60815346", "0.60711...
0.67571145
0
Implements a 2d valid convolution of kernels with the image
def my1_conv2d(image, kernels, strides=(1, 1)): raise NotImplementedError('Write me!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _valid_convolve(images: th.Tensor, kernels: th.Tensor) -> th.Tensor:\n ret = F.conv2d(images.view((images.shape[0], *images.shape[-3:])).transpose(1, 0),\n th.flip(kernels.view((kernels.shape[0], *kernels.shape[-3:])), dims=(-1, -2)),\n groups=kernels.shape[0]...
[ "0.80044043", "0.7787643", "0.77004385", "0.766842", "0.76463753", "0.7617373", "0.7556324", "0.7545405", "0.7523131", "0.7506778", "0.74894965", "0.7466991", "0.74484366", "0.7444745", "0.7427518", "0.7415974", "0.7384295", "0.73517126", "0.7347071", "0.73341054", "0.7320351...
0.7843681
1
hyperbolic decay function. Output looks like [mul/1^pow, mul/2^pow, ..., mul/n^pow].
def hyperbolic_decay(mul, pow, n, min=0.1): return np.vstack([mul * np.power(1 / np.arange(1, n + 1), pow), [min] * n]).max(0).tolist()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _decay_rate_pow(i: int, exponent: float = 0.8) -> float:\n t = jnp.array(i, jnp.float32) + 1.0\n return 1.0 - t**(-exponent)", "def exponential_decay(mul, base, n, min=0.1):\n return np.vstack([mul * np.power(base, np.arange(n)), [min] * n]).max(0).tolist()", "def decay(t1, t2, lamb):\n\n retur...
[ "0.6568696", "0.6460038", "0.64123225", "0.5884633", "0.58793783", "0.5843362", "0.58166456", "0.5812869", "0.58070505", "0.57365793", "0.56906784", "0.5681047", "0.5651915", "0.5623429", "0.56078815", "0.56029963", "0.55934", "0.5559349", "0.5547638", "0.55465025", "0.553926...
0.79012483
0
Returns list of strings from text documents Looks at all files in current working directory. All files in cwd must be .docx or .txt format.
def get_corpus(): corpus_raw = [] files = os.listdir() for name in files: if ".txt" in name: try: file = open(name, "rt", encoding='utf8') data_org = file.read() corpus_raw.append(data_org) except: print("ERROR:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_files(directory):\n documents = []\n for fl in (os.listdir(directory)):\n if fl.endswith('.txt'):\n fl_path = os.path.join(directory, fl)\n with open(fl_path, 'r') as f:\n full_text = f.read()\n documents.append(full_text)\n return docume...
[ "0.7320482", "0.72015715", "0.717769", "0.67947596", "0.67669386", "0.67493397", "0.6713778", "0.66824514", "0.6597116", "0.6557836", "0.65155166", "0.6475316", "0.64592993", "0.6398053", "0.6397737", "0.63450557", "0.63076454", "0.62954843", "0.62924737", "0.62678766", "0.62...
0.7481747
0
Returns dataframe of cosine similarity output.
def cossim(corpus): files = os.listdir() vectorizer = TfidfVectorizer() trsfm = vectorizer.fit_transform(corpus) columns = vectorizer.get_feature_names() df_tfidf = pd.DataFrame(trsfm.toarray(), columns = columns, index = corpus) out = cosine_similarity(trsfm) df_result = pd.DataFrame(out, c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cosine_similarity_df(word2vec: Word2Vec) -> pd.DataFrame:\n sim = get_cosine_similarity(word2vec)\n return pd.DataFrame(sim, index=word2vec.wv.index2word, columns=word2vec.wv.index2word)", "def get_similarity(df):\n count = CountVectorizer()\n count_matrix = count.fit_transform(df[\"bag_of_wo...
[ "0.80600446", "0.7143063", "0.70001644", "0.6911596", "0.6899146", "0.68266064", "0.67503536", "0.6716778", "0.65700823", "0.63791716", "0.6329568", "0.62595916", "0.62574124", "0.6225536", "0.6116262", "0.60972244", "0.6093053", "0.60886896", "0.6063798", "0.6061584", "0.604...
0.77310884
1
flesch kincaid grade calculation. returns float.
def fkg(word, sent, syll): flesch_kincaid_grade = (0.39* (word / sent)) + (11.8 * (syll / word)) - 15.59 return flesch_kincaid_grade
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fk_grade(self, doc):\n num_sentences = _get_num_sentences(doc)\n num_words = _get_num_words(doc)\n num_syllables = _get_num_syllables(doc)\n if num_sentences == 0 or num_words == 0 or num_syllables == 0:\n return 0\n return (\n (11.8 * num_syllables / nu...
[ "0.6360825", "0.6110347", "0.6074148", "0.6042048", "0.6023745", "0.6013583", "0.59987545", "0.5960476", "0.5941223", "0.5935258", "0.5934711", "0.5878904", "0.58393055", "0.5804422", "0.5745744", "0.5717111", "0.5707204", "0.5691983", "0.5690494", "0.5689245", "0.56642234", ...
0.71324104
0
Finds long multisyllable words and outputs a dataframe with values.
def most_verbose(data_word): verbose_words = [] synonyms = [] #looping through words to find complex words and their synonyms for word in data_word: #finding complex words and recording word & lemma if textstat.syllable_count(word) > 3: word_syn = wordnet.synsets(word) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_words(df, size = 1000):\n top_words = df.sort_values(by = 'Median_Frequency', ascending = False).head(size)\n # w1 is low tau (uniform words), w2 is high tau words\n w1 = top_words.sort_values(by = 'Tau', ascending = True).head(int(.2 * size)).word.values \n w2 = top_words.sort_values(by = 'Tau...
[ "0.626304", "0.6194262", "0.6123111", "0.6111072", "0.6097256", "0.5877393", "0.5847896", "0.58196574", "0.581044", "0.58065546", "0.58062464", "0.5762308", "0.5756017", "0.57454395", "0.5706446", "0.56577814", "0.56348705", "0.56150097", "0.5603672", "0.5582262", "0.5567136"...
0.62330633
1
Finds strings of three nouns or more. Returns DataFrame
def noun_string(data_org): chains = [] tokens = word_tokenize(data_org) #tokenize to prepare for tagging w_tag = dict(nltk.pos_tag(tokens)) chain = [] for w, tag in w_tag.items(): #find all nouns based on treebank format if tag.startswith('N'): chain.append(w) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_categories(searched_nouns, keywords, n_categories=5):\n\n matches = []\n\n for keyword in keywords.itertuples():\n if len(matches) == n_categories:\n break\n\n try:\n if keyword.Index in searched_nouns:\n matches.append(keyword.Index)\n except...
[ "0.59160656", "0.5803987", "0.5641517", "0.559162", "0.54173523", "0.52960414", "0.52590513", "0.52531403", "0.5253092", "0.523447", "0.5233632", "0.523099", "0.52094245", "0.51938635", "0.5163584", "0.51317215", "0.5131165", "0.5112171", "0.5103058", "0.5084181", "0.5083913"...
0.6238775
0
Returns BytesIO() object for matplotlib graph based on lex_disp.
def img_lex_disp(data_word,search): x_vals, y_vals = lex_disp(data_word,search) imgdata = BytesIO() fig, ax = plt.subplots() ax.plot(x_vals,y_vals,"rx") plt.ioff() plt.yticks(range(len(search)), search) plt.ylim(-1, len(search)) plt.xlim(-1, len(data_word)) plt.title("Lexical Dispe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_graph_binary(self):\n with open(os.path.join(self.network_dir,\"graph\"), mode='rb') as file:\n graph = file.read()\n return graph", "def _plt_to_png(self):\n import matplotlib.pyplot as plt\n from io import BytesIO\n\n with BytesIO() as file_obj:\n plt.savefig(...
[ "0.5582165", "0.53163403", "0.52495587", "0.51727575", "0.51012796", "0.4978568", "0.4918863", "0.48660883", "0.48566997", "0.48443657", "0.48247695", "0.47835562", "0.47749838", "0.4772843", "0.47496942", "0.4739946", "0.47336307", "0.47336307", "0.47321883", "0.47193173", "...
0.6062436
0
Returns BytesIO() object for matplotlib graph based on fkg_over_text.
def img_fkg_over_text(data_sent): step = 40 x,y = fkg_over_text(data_sent) imgdata = BytesIO() fig, ax = plt.subplots() ax.plot(x,y) plt.ioff() plt.yticks(range(0,int(max(y))+1,int(max(y)/10))) plt.ylim(int(min(y)) - 1, int(max(y))+1) plt.xlim(0, len(x)+step) plt.title("Flesch ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_png_to_str(plt, plotwidth=400):\n from StringIO import StringIO\n figfile = StringIO()\n plt.savefig(figfile, format='png')\n figfile.seek(0) # rewind to beginning of file\n figdata_png = figfile.buf # extract string\n import base64\n figdata_png = base64.b64encode(figdata_png)\n ...
[ "0.5992973", "0.59750515", "0.5948499", "0.55978835", "0.55960286", "0.55930346", "0.5582866", "0.5471341", "0.53344965", "0.5330486", "0.53158176", "0.5299572", "0.52963424", "0.52656806", "0.5209809", "0.51724875", "0.51456416", "0.5122251", "0.51145196", "0.50821996", "0.5...
0.65806675
0
Returns two lists of x and y points for a syllable per word graph
def syll_over_text(data_word): step = 200 y = [] temp_syll = [] for count, word in enumerate(data_word, 1): temp_syll.append(textstat.syllable_count(word)) if count >= step: y.append(sum(temp_syll)/len(temp_syll)) temp_syll = temp_syll[1:] x = range(step,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def labels(self):\n return self.label(self.p_y_given_x)", "def img_syll_over_text(data_word):\n\n step = 200\n\n x,y = syll_over_text(data_word)\n\n imgdata = BytesIO()\n fig, ax = plt.subplots()\n ax.plot(x,y)\n plt.ioff()\n plt.yticks(range(0,int(max(y) + 2),1))\n plt.ylim(1, 4)\...
[ "0.61984605", "0.6093665", "0.60675544", "0.60601413", "0.5985724", "0.5921199", "0.5834125", "0.57708466", "0.57227457", "0.5667648", "0.56440115", "0.5612504", "0.5522734", "0.5447983", "0.5439784", "0.54330903", "0.543288", "0.54286504", "0.5426372", "0.5425954", "0.539379...
0.7215974
0
Returns BytesIO() object for matplotlib graph based on syll_over_text.
def img_syll_over_text(data_word): step = 200 x,y = syll_over_text(data_word) imgdata = BytesIO() fig, ax = plt.subplots() ax.plot(x,y) plt.ioff() plt.yticks(range(0,int(max(y) + 2),1)) plt.ylim(1, 4) plt.xlim(step, len(x)+step) plt.title("Syllables per Word (" + str(step) + "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_png_to_str(plt, plotwidth=400):\n from StringIO import StringIO\n figfile = StringIO()\n plt.savefig(figfile, format='png')\n figfile.seek(0) # rewind to beginning of file\n figdata_png = figfile.buf # extract string\n import base64\n figdata_png = base64.b64encode(figdata_png)\n ...
[ "0.61337274", "0.59295833", "0.5874438", "0.5433183", "0.53777325", "0.53590506", "0.5355473", "0.5352455", "0.5310466", "0.5281453", "0.5259402", "0.5258532", "0.5255194", "0.5228789", "0.5224137", "0.521896", "0.51629233", "0.5138993", "0.50906837", "0.5088246", "0.50834525...
0.60447866
1
Repeatedly tries to convert user input to a list until succeded.
def enterList(CustomMessage="Please enter a list: ", CustomErrorMessage="The input is not a valid list, please try again...", ExplicitType=type): isList = False while isList == False: try: ls = [] # we map 'ls' into 'ldict' to be used for exec() ldict = lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_list():\n input_list = []\n input_from_user = input()\n while input_from_user != STOPPER_STRING:\n input_list.append(input_from_user)\n input_from_user = input()\n return input_list", "def get_list_of(name_of_thing = \"thing\"):\n\n result_list = []\n\n item = input(\"E...
[ "0.70015097", "0.65747786", "0.64885736", "0.64365035", "0.64258546", "0.6315271", "0.62857646", "0.6279439", "0.6269533", "0.6219827", "0.61705965", "0.6131492", "0.6119284", "0.60811734", "0.607458", "0.60481036", "0.60220313", "0.60159606", "0.59922487", "0.5959857", "0.59...
0.6768633
1
Checks if a module is installed/available on the current system.
def ModuleAvailability(module_name): try: imp.find_module(module_name) return True except ImportError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_module_installed(name):\n\n return pm.is_module_installed(name)", "def is_installed(cls):\n return find_spec_or_loader(cls.module) is not None", "def is_installed(module):\n try:\n __import__(module)\n return True\n except ImportError as e:\n return False", "def is...
[ "0.7868599", "0.7798507", "0.77787346", "0.7700129", "0.7563068", "0.7425481", "0.742171", "0.73802054", "0.73741937", "0.7310834", "0.7306472", "0.72942656", "0.72892606", "0.721798", "0.7192863", "0.7183146", "0.718308", "0.71778744", "0.7164145", "0.70727545", "0.7059331",...
0.8070012
0
Get output string of PrintVisitor class for node tree.
def get_node_tree_print_string(node: Node) -> str: node_io = io.StringIO() pre_order_travel(node, PrintVisitor( node_io, show_trigger=True, show_event=True, show_limit=True, show_meter=True, show_repeat=True, show_parameter=True, )) node_text = nod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_tree(self):\n return \"\"", "def pprint(self):\n def pprintStr(node):\n s = \"(\" + str(node.value) \n for action in node.children:\n s = s + \", \" + pprintStr(node.children[action])\n s = s + \")\"\n return s\n\n print pp...
[ "0.784381", "0.75079083", "0.74859965", "0.7472435", "0.7455913", "0.74289346", "0.74289346", "0.7386531", "0.7348337", "0.7332728", "0.7257182", "0.7186047", "0.7177099", "0.71612954", "0.71594465", "0.7141226", "0.7112053", "0.7036687", "0.7033101", "0.702962", "0.7008909",...
0.8028919
0
Creating lists of top bands and songs. Based on idea that relevant bands have much higer score rate than others, so we can detect the score gap by derivative and cut unrelevant items. Experimental function.
def top(artists, songs, class_results, cut_unrelevant=True): min_artists = 3 # FIXME: put to config relevancy_bound = 0.4 top_songs = sorted([[artists[i], songs[i], round3(class_results[i][1])] for i in range(len(class_results))], key=lambda x: x[2], reverse=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bands(self):\n\t\treturn zip((self.primary_threshold, self.upper_earning_limit),\n\t\t\t\t self.rates)", "def addHigherPiks(self, PiksList):\n position1,High1=PiksList[0]\n position2,High2=PiksList[len(PiksList)-1]\n for kol in range(position1, position2): ##for each column checking al...
[ "0.58266556", "0.5487997", "0.54770356", "0.54705834", "0.5447406", "0.54438156", "0.5433822", "0.54065675", "0.539114", "0.5387537", "0.53857666", "0.53537434", "0.53439474", "0.5333476", "0.53308576", "0.5320531", "0.5314272", "0.53082347", "0.5275688", "0.526045", "0.52345...
0.7294141
0
Menu can be deleted if no active OrderedFood use them. Otherwise soft delete it and the food it's related to.
def _safedelete_policy(self): from customers.models import OrderedFood active_order = OrderedFood.objects.active_with( menu=self ).exists() if active_order: return SOFT_DELETE_CASCADE return HARD_DELETE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_menu():", "def delete_food(self): # TODO test\n try:\n meal = self.food.meal\n meal.foods.remove(self.food)\n self.parent_node.parent_node.update_text(True)\n print(\"delete food\")\n except AttributeError:\n recipe = self.food.reci...
[ "0.63372177", "0.5896833", "0.5773924", "0.56116575", "0.5582191", "0.5563995", "0.5523998", "0.5474588", "0.54445106", "0.5415671", "0.53733", "0.5359315", "0.5355081", "0.5338274", "0.5329494", "0.5303992", "0.52936566", "0.5284731", "0.52635217", "0.52512413", "0.5231592",...
0.7570085
0
Init 1D convolutional layers.
def __init__(self, in_channels, out_channels): super(CNN, self).__init__() self.conv1 = nn.Conv1d(in_channels=in_channels, out_channels=out_channels, kernel_size=5, padding=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_layers(self) -> None:\n super()._init_layers()\n self.controller = nn.Conv2d(\n self.feat_channels, self.num_params, 3, padding=1)", "def __init__(self, filter1x1):\n super(poolproj, self).__init__()\n self.max = layers.MaxPooling2D(pool_size=3, strides=1, padding...
[ "0.6697274", "0.66876936", "0.6670523", "0.6644046", "0.6633409", "0.6612442", "0.6595791", "0.6580549", "0.6558407", "0.64472824", "0.64386624", "0.643735", "0.64194596", "0.64124745", "0.6393912", "0.6388642", "0.637937", "0.6372041", "0.6363927", "0.6363335", "0.6323399", ...
0.6967559
0
Falback method if node passed to visit does not have a custom visit method
def generic_visit(self, node): raise Exception('No visit_{} method'.format(type(node).__name__))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit(self, node):\n method_name = 'visit_' + type(node).__name__\n visit_method = getattr(self, method_name, self.generic_visit)\n return visit_method(node)", "def unknown_visit(self, node):\n pass", "def generic_visit(self, node):\n\n visit_method_name = 'visit_...
[ "0.7690578", "0.76387763", "0.75839645", "0.7541761", "0.7487369", "0.7484545", "0.7484545", "0.74587554", "0.74587554", "0.717316", "0.7039525", "0.695059", "0.68619275", "0.6857089", "0.6857089", "0.6771881", "0.67639476", "0.6727372", "0.66030043", "0.66030043", "0.658593"...
0.785527
0
Interprets the passed AST
def interpret(self): tree = self.parser.parse() if tree is None: return '' self.visit(tree)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_01():\n text = \"a = 2 + 3 * (4 + 5)\"\n\n c = _ast.parse(text)\n print(_ast.dump(c))", "def interpret(self):\n tree = self.parser.parse()\n if tree is None:\n return ''\n return self.visit(tree)", "def __init__(self, the_ast):\n self._ast = the_ast", ...
[ "0.64431417", "0.63316363", "0.63241464", "0.62835693", "0.62797326", "0.62406003", "0.6093359", "0.6073914", "0.6054868", "0.6035625", "0.6029365", "0.60136026", "0.59642404", "0.59470546", "0.5944725", "0.5855613", "0.58374965", "0.5825481", "0.5823495", "0.5772398", "0.574...
0.66470087
0
Custom visitor method for Assign Node. Defines or updates an identifier in GLOBAL_SCOPE when assignment node is encountered
def visit_Assign(self, node): var_name = node.left.token.value self.GLOBAL_SCOPE[var_name] = self.visit(node.right)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_Assign(self, node):\n var_name = node.left.value\n self.VARIABLES[var_name] = self.visit(node.right)", "def visit_Assign(self, node):\n self.generic_visit(node)\n target = get_single_target(node)\n if isinstance(target, ast.Attribute):\n args = [ target.val...
[ "0.75710845", "0.7225914", "0.71555275", "0.70932674", "0.70658773", "0.7062191", "0.7022214", "0.68391275", "0.6802824", "0.67725766", "0.6699354", "0.6693462", "0.665793", "0.66550535", "0.6616596", "0.6545648", "0.6396013", "0.6366825", "0.63529116", "0.63529116", "0.63484...
0.7486862
1
Creates a participant and returns the created participant.
def create_participant(name='Not Brian', email='test@email.com') ->\ Participant: participant = Participant(name=name, email=email) return participant
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def participant_create(request):\n if request.method == 'POST':\n serializer = ParticipantSerializer(data=request.data)\n if serializer.is_valid():\n serializer.save()\n return Response(serializer.data, status=status.HTTP_201_CREATED)\n else:\n participant =...
[ "0.69617784", "0.6233637", "0.6076538", "0.59754336", "0.5940422", "0.5924096", "0.5923167", "0.58424944", "0.58173156", "0.5806007", "0.57126147", "0.5659691", "0.5656874", "0.5630372", "0.556023", "0.55539155", "0.55219054", "0.5493698", "0.5486969", "0.54681516", "0.540034...
0.81778824
0
Planck energy density distribution WRT lambda arguments
def distribution_planck_lambda(wavelength=1,temperature=1, units=SI,printA=False): var = sy.var('pi h c l k t') par = np.pi, units['h'], units['c'], wavelength, units['k'], temperature y = ( 8 * pi * h * c ) / l**5 / ( sy.exp(h*c/l/k/t) - 1 ) return dic_result(var,par,y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def energy_to_lambda(energy_ev=[]):\n energy_mev = energy_ev * 1000\n lambda_array = np.sqrt(81.787 / energy_mev)\n return lambda_array", "def gaussian_ensemble_density(lambdas, beta):\n n = len(lambdas)\n constant = (2*np.pi)**(n/2) * np.prod([gamma(1+k*beta/2)/gamma(1+beta/2) for k in range(1,n+...
[ "0.61962384", "0.61883026", "0.616073", "0.61373127", "0.59998125", "0.5938059", "0.58816546", "0.58769053", "0.58698195", "0.58583254", "0.5834831", "0.58141136", "0.58033407", "0.58013916", "0.5800713", "0.5746333", "0.57297736", "0.5724834", "0.57109314", "0.5707284", "0.5...
0.6244381
0
threshold frequency of material arguments
def frequency_threshold(workFunction=1, units=eV): var = sy.var('W h') par = workFunction, units['h'] y = W / h return dic_result(var,par,y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mask(self):\n\n mask = self.freqs >= self.minimum_threshold\n mask = mask.astype(int)\n self.freqs = self.freqs * mask\n self.sums = self.sums * mask", "def getThreshold(self): # real signature unknown; restored from __doc__\n pass", "def perform_thresholding(f,M,type):\n if type == \...
[ "0.62175554", "0.6020825", "0.6001902", "0.59605694", "0.5953717", "0.59165674", "0.59111774", "0.58975786", "0.58940154", "0.5855708", "0.5812214", "0.57792926", "0.5752244", "0.57447916", "0.5742675", "0.5731093", "0.5651468", "0.55894667", "0.5565147", "0.5551327", "0.5545...
0.62567973
0
stopping potential WRT frequency arguments
def potential_stopping(frequency=1,workFunction=1, units=eV): var = sy.var('h e nu W') par = units['h'], units['e'], frequency, workFunction y = (h/e) * nu - (W/e) return dic_result(var,par,y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noise(self, freq: int, /) -> None:", "def getStopFrequency(self) -> int:\n if not self.debug:\n self.myFieldFox.write(\"SENS:FREQ:STOP?\")\n ret = int(self.myFieldFox.read())\n else:\n ret = 1000000\n return ret", "def stop():\n set_power(0)", "def...
[ "0.61376727", "0.6099442", "0.60813415", "0.5852191", "0.57946014", "0.5782623", "0.57420737", "0.572593", "0.572593", "0.572593", "0.572593", "0.5725601", "0.57196414", "0.57003534", "0.5639812", "0.563123", "0.5630265", "0.5629621", "0.5628715", "0.55816966", "0.5578681", ...
0.616706
0