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
View for listing departments with average salaries.
def home(): departments = queries.get_departments_with_avg_salary() return render_template('department/departments.html', departments=departments)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_all_departments():\n\n logger.debug('Function show_all_departments(). Routed to /departments')\n titles = ['Name', 'Average Salary', 'Employees']\n departments = ds.get_all()\n logger.info('Get list of departments, length is %i', len(departments))\n return render_template('departments.html'...
[ "0.63815594", "0.56987286", "0.5657244", "0.5627778", "0.5415666", "0.5373455", "0.5359433", "0.5358897", "0.5321156", "0.5304067", "0.52862185", "0.5284978", "0.5254422", "0.50969964", "0.50021446", "0.4988606", "0.4948121", "0.49417597", "0.4933756", "0.49115306", "0.491021...
0.7049495
0
View for a certain department with a list of employees in it.
def department(department_id): department_obj = Department.query.get_or_404(department_id) employees = Employee.query.filter_by(department_id=department_id) return render_template('department/department.html', department=department_obj, employees=employees)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def department(department_id):\n # gather data from db about all employees\n return render_template(\"department.html\",\n department_id=department_id)", "def show_department(id_: int):\n\n logger.debug('Routed to /departments/%i', id_)\n titles = ['Name', 'Average Salary', ...
[ "0.7576344", "0.70143574", "0.6591376", "0.64385015", "0.64236253", "0.63885105", "0.60730034", "0.60585153", "0.58779407", "0.5863287", "0.58585185", "0.5825439", "0.5820291", "0.5739643", "0.5706192", "0.56987846", "0.56693375", "0.5644137", "0.5627382", "0.5620395", "0.560...
0.7384445
1
Get license from eml
def get_license(self): etree = self.get_eml() project_license_dict = etree.find('.//intellectualRights/para/ulink') project_license = project_license_dict.get('url') return project_license
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_license():\n repo_fs()\n return LICENSE", "async def get_license(self) -> APIReturn:\n return await self._request(\"GET\", \"/getLicense\")", "def license(self): # noqa: A003\n logger.debug(\"Get license\")\n return self._raw_api.license.get()", "def custom_licenses(self):...
[ "0.7386609", "0.73330295", "0.73282117", "0.71193576", "0.691203", "0.67768687", "0.6748933", "0.6728743", "0.65510696", "0.65053207", "0.6437338", "0.6420653", "0.6367772", "0.63147664", "0.6252392", "0.6217855", "0.6188795", "0.6176891", "0.6151416", "0.6130407", "0.6106784...
0.78986037
0
Get citation from eml
def get_citation(self): etree = self.get_eml() try: citation_ipt = etree.find('./additionalMetadata/metadata/gbif/citation').text except AttributeError: citation_ipt = None if citation_ipt: now = datetime.datetime.now().date() pola3r = "(Av...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bibtex(self):\n url=\"http://www.biomedcentral.com/download/citation\"\n parameters={'citation':'on', \n 'result-selection':'THIS_PAGE',\n 'suplements': 'false',\n 'citationType':'BIBTEX_WITH_ABSTRACT',\n 'articleIdThisPage':self.article_ids\n }\n data=urllib.urlencode(par...
[ "0.62762064", "0.6031594", "0.5947958", "0.5947479", "0.5891026", "0.5833271", "0.5796522", "0.5740599", "0.57403207", "0.57223916", "0.5653079", "0.5640696", "0.56328344", "0.5567911", "0.55576617", "0.55415183", "0.5529817", "0.55012965", "0.5496393", "0.54900914", "0.54532...
0.6930459
0
A wrapper to image encoders. Chooses between an encoder that uses precomputed image features, `EncoderImagePrecomp`, or an encoder that computes image features on the fly `EncoderImageFull`.
def EncoderImage(data_name, img_dim, embed_size, finetune=False, cnn_type='resnet', use_abs=False, no_imgnorm=False): if data_name.endswith('precomp'): img_enc = EncoderImagePrecomp( img_dim, embed_size, use_abs, no_imgnorm) else: img_enc = EncoderImageFull( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_image_encoder(tparams, options):\n opt_ret = dict()\n\n trng = RandomStreams(1234)\n\n # image features\n im = tensor.matrix('im', dtype='float32')\n\n # Encode images\n images_mm = get_layer('ff')[1](tparams, im, options, prefix='ff_image_mm', activ='linear')\n if not 'attention_typ...
[ "0.6181753", "0.6138979", "0.6047027", "0.5969525", "0.5927129", "0.5924614", "0.5919706", "0.5876688", "0.58539444", "0.5809323", "0.58085144", "0.5798188", "0.5784924", "0.5770865", "0.5759323", "0.57563215", "0.5678224", "0.56261605", "0.56106097", "0.5601939", "0.5598123"...
0.61549133
1
Cosine similarity between all the image and sentence pairs
def cosine_sim(im, s): return im.mm(s.t()) #image.mm(sentence.t()) & mm() Performs a matrix multiplication of the matrices
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_similarity(df):\n count = CountVectorizer()\n count_matrix = count.fit_transform(df[\"bag_of_words\"])\n cosine_sim = cosine_similarity(count_matrix, count_matrix)\n return cosine_sim", "def calculate_cosine_similarity(self):\n tfidf_matrix = self.calculate_tfidf()\n\n cosine_si...
[ "0.7296852", "0.7289232", "0.72697127", "0.7252161", "0.72349703", "0.72282225", "0.7205568", "0.72027826", "0.71672535", "0.71595657", "0.7138452", "0.71332073", "0.71226215", "0.7110526", "0.70553356", "0.70458865", "0.70345986", "0.70169246", "0.7001696", "0.6989079", "0.6...
0.77524126
0
Convert an image from PNG to JPEG, encoded in Base64. (Semi)transparent pixels are replaced with (semi)white pixels in the output JPEG image.
def convert_image( png_image: str, jpeg_image_quality: int = IMAGE_QUALITY_JPEG ) -> str: img_rgb: Image.Image = Image.open( BytesIO(base64.b64decode(png_image)) ).convert("RGB") buffered: BytesIO = BytesIO() img_rgb.save(buffered, format="JPEG", quality=jpeg_image_quality) jpeg_image_ba...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jpeg_to_png(img: bytes) -> bytes:\n im = Image.open(BytesIO(img))\n width = 240\n height = int(im.size[1] * (240 / im.size[0]))\n im = im.convert(\"RGB\").resize((width, height))\n stream = BytesIO()\n im.save(stream, format=\"PNG\")\n return stream.getvalue()", "def convert_to_jpeg(imag...
[ "0.70558953", "0.6484698", "0.6325528", "0.6288252", "0.60400474", "0.59714824", "0.5958023", "0.595695", "0.59469", "0.5909585", "0.5888917", "0.5880272", "0.5868774", "0.5824544", "0.57522017", "0.5750232", "0.5696751", "0.56862456", "0.5593072", "0.55234104", "0.5519764", ...
0.71976304
0
generate array for texture3d based on numpy array
def bind_array_to_texture3d(np_array, tex_ref): # get shape # caution: (d, h, w) C manner # : (w, h, d) Fortran manner # d, h, w = np_array.shape # generate descriptor descr = drv.ArrayDescriptor3D() descr.width = w descr.height = h descr.depth = d descr.format = drv.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform3D(x: float, y: float, z: float, R: np.array) -> np.array:\n T = np.zeros((4, 4))\n T[:3, :3] = R\n T[:, 3] = [x, y, z, 1.0]\n\n return T", "def create_reference_array(self):\r\n self.active = True\r\n self.pxarray = pygame.surfarray.pixels3d(self.surface)\r\n pygame...
[ "0.62978226", "0.617259", "0.6141545", "0.6081576", "0.6076077", "0.5952899", "0.5931084", "0.5925661", "0.5843394", "0.5810113", "0.5764794", "0.5746466", "0.573636", "0.57174665", "0.57057434", "0.57055336", "0.567286", "0.5656588", "0.5572808", "0.55724746", "0.55465865", ...
0.6558746
0
Save architecture before first epoch
def on_epoch_begin(self, epoch, logs={}): if epoch > 0: return architecture = self.log_dir + '/architecture.yml' model = self.get_model(self.model) yaml_string = model.to_yaml() with open(architecture, 'w') as fp: fp.write(yaml_string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, checkpoint_dir, step):\n model_name = \"CNN.model\"\n model_dir = \"%s\" % (\"cnn\")\n checkpoint_dir = os.path.join(checkpoint_dir, model_dir)\n \n if not os.path.exists(checkpoint_dir):\n os.makedirs(checkpoint_dir)\n \n self.saver.save(self.sess,\n ...
[ "0.6628256", "0.66059166", "0.65924174", "0.6572752", "0.6502848", "0.6478726", "0.64242435", "0.64006734", "0.6372602", "0.63437426", "0.6334327", "0.6317073", "0.6310673", "0.6307861", "0.6290157", "0.6274451", "0.6267318", "0.6266805", "0.6263506", "0.6242907", "0.623144",...
0.6943416
0
GET => return true/false if event exists
def event_exists(req): event_id = req.match_dict['event_id'] try: db_conn.event_exists(event_id) json = {'exists': True} except Exception as e: json = {'errors': [str(e)]} return req.Response(json=json)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_event_status(self):\n pass", "def event_in_database(event: event_models.Event) -> bool:\n id_dict = async_to_sync(event_utils.generate_event_id_dict)(event)\n var = event_utils.events_collection().find_one(id_dict)\n return bool(var)", "def has_event(self):\n return self.ser.in...
[ "0.69816977", "0.6611518", "0.6578091", "0.65265614", "0.6472735", "0.6412919", "0.6402456", "0.63813007", "0.63706386", "0.6259286", "0.61737615", "0.6166939", "0.61511993", "0.6149624", "0.61005944", "0.60942775", "0.6090363", "0.6085699", "0.6068438", "0.6006954", "0.59817...
0.749537
0
DELETE => delete an event or error
def event_delete(req): event_id = req.match_dict['event_id'] try: db_conn.event_delete(event_id) json = {'deleted': True} except Exception as e: json = {'errors': [str(e)]} return req.Response(json=json)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_IN_DELETE(self, event):", "def delete(self):\n\t\tself.eventStatus = 0\n\t\tself.save()\n\n\t\t# DEBUG\n\t\tcontext = {\n\t\t\t'call_stack': ''.join(traceback.format_stack()),\n\t\t\t'event': self,\n\t\t\t'server_addr': settings.SERVER_ADDRESS,\n\t\t}\n\t\tbody = render_to_string('MHLCallGroups/Sched...
[ "0.76231986", "0.7530073", "0.7491945", "0.7491945", "0.7313001", "0.72296304", "0.72110486", "0.70975524", "0.7043815", "0.6969473", "0.6961278", "0.69397306", "0.69390017", "0.6920461", "0.6898963", "0.68918484", "0.68862814", "0.6830158", "0.6828067", "0.6828067", "0.68045...
0.7577618
1
GET => collect summary of event or error
def event_summary(req): event_id = req.match_dict['event_id'] try: json = db_conn.event_summary(event_id) json = {k.lower():str(v) for k,v in json.items()} except Exception as e: json = {'errors': [str(e)]} return req.Response(json=json)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary(self):\r\n request = http.Request('GET', self.get_url())\r\n\r\n return request, parsers.parse_json", "def summary(self):\r\n request = http.Request('GET', self.get_url())\r\n\r\n return request, parsers.parse_json", "def summary(self):\r\n request = http.Request(...
[ "0.6456593", "0.6456593", "0.6456593", "0.642607", "0.6215228", "0.6202277", "0.6146908", "0.6139106", "0.6125971", "0.6099241", "0.6043483", "0.6012481", "0.5983452", "0.589395", "0.5878607", "0.5834545", "0.58089644", "0.5802988", "0.57887876", "0.57440555", "0.5731316", ...
0.7630018
0
Gets next restrictedgrowth sequence with values in {0..k}
def next_rgs(seq, n, k): # b[i] = max(seq[i - 1], b[0], ..., b[i - 1]) = max(seq[i - 1], b[i - 1]) # All restricted growth sequences start with 0 b = [0] result = seq[:] for i in range(1, n): b.append(max(seq[i - 1], b[i - 1])) # Find the earliest index when previous and next sequence ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restricted_growth_sequences(n):\n # k - biggest value that should be contained in subsequence\n for k in range(n):\n # initially seq = [0, 0, ... 0, 1, 2, ..., k-1, k]\n seq = [0] * (n - k) + list(range(1, k+1))\n # final = [0, 1, 2, ..., k-1, k, ..., k]\n final = list(range(k...
[ "0.7462815", "0.61552924", "0.60061765", "0.5945106", "0.59341526", "0.5891941", "0.5887151", "0.5883342", "0.58792937", "0.58648854", "0.58377", "0.58087903", "0.5791206", "0.57511485", "0.57416815", "0.57404494", "0.57288957", "0.57246435", "0.57246435", "0.56997555", "0.56...
0.7836988
0
Generates all restrictedgrowth sequences of size n
def restricted_growth_sequences(n): # k - biggest value that should be contained in subsequence for k in range(n): # initially seq = [0, 0, ... 0, 1, 2, ..., k-1, k] seq = [0] * (n - k) + list(range(1, k+1)) # final = [0, 1, 2, ..., k-1, k, ..., k] final = list(range(k)) + [k] * ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_rgs(seq, n, k):\n # b[i] = max(seq[i - 1], b[0], ..., b[i - 1]) = max(seq[i - 1], b[i - 1])\n # All restricted growth sequences start with 0\n b = [0]\n result = seq[:]\n for i in range(1, n):\n b.append(max(seq[i - 1], b[i - 1]))\n # Find the earliest index when previous and next...
[ "0.7154524", "0.65657276", "0.6564149", "0.65640694", "0.6500985", "0.6429808", "0.6218551", "0.61994994", "0.61589265", "0.61427176", "0.61198515", "0.61111957", "0.61111957", "0.60927916", "0.60779697", "0.6065212", "0.6064698", "0.606462", "0.60300297", "0.6019435", "0.600...
0.8527859
0
Find the number of cars in a circular train only by turning train car lights on or off.
def two_ways_approach(train: List[bool]) -> int: starting_car_state: int = train[0] num_cars: int = 0 # Accumulate number of cars in the train # Initialize at 1 since we're not counting the first move between the starting car and the second num_moves: int = 1 num_cars_from_start: int = 1 # a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_way_approach(train: List[bool]) -> int:\n starting_car_state: int = train[0]\n num_cars: int = 0 # Accumulate number of cars in the train\n\n # Initialize at 1 since we're not counting the first move between the starting car and the second\n num_moves: int = 1\n num_cars_from_start: int = 1...
[ "0.6679412", "0.6307232", "0.63021976", "0.5981241", "0.5828923", "0.57992804", "0.5588377", "0.5571177", "0.54818964", "0.54591703", "0.5456123", "0.54394", "0.5406366", "0.53927976", "0.5329144", "0.5300057", "0.528645", "0.52652085", "0.52374774", "0.52333456", "0.5232255"...
0.6633393
1
Find the number of cars in a circular train only by turning train car lights on or off.
def one_way_approach(train: List[bool]) -> int: starting_car_state: int = train[0] num_cars: int = 0 # Accumulate number of cars in the train # Initialize at 1 since we're not counting the first move between the starting car and the second num_moves: int = 1 num_cars_from_start: int = 1 while...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_ways_approach(train: List[bool]) -> int:\n starting_car_state: int = train[0]\n num_cars: int = 0 # Accumulate number of cars in the train\n\n # Initialize at 1 since we're not counting the first move between the starting car and the second\n\n num_moves: int = 1\n num_cars_from_start: int ...
[ "0.66363734", "0.6307823", "0.6299765", "0.59804416", "0.5828939", "0.57978857", "0.55882317", "0.5570409", "0.5481004", "0.5458314", "0.5456666", "0.5437196", "0.5405393", "0.53918916", "0.53309035", "0.5299488", "0.5287018", "0.52637583", "0.52357614", "0.5234455", "0.52317...
0.6681762
0
Create a train represented by a list of bool values based on a train case True > Light on, False > Light off
def generate_train(n: int, case: Case) -> List[bool]: if case is Case.Random: return [bool(randint(0, 1)) for _ in range(n)] elif case is Case.AllOn: return [True for _ in range(n)] elif case is Case.AllOffButStart: return [True] + [False for _ in range(n - 1)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_target(trainSamples):\n feature_names = [\"click_bool\", \"booking_bool\",\"position\"]\n samples = trainSamples[feature_names].values\n def f(vec):\n x, y, z = vec\n return y + 0.2 * x\n return [f(vec) for vec in samples]", "def onehot(isTrue):\n if isTrue:\n re...
[ "0.5921629", "0.5856643", "0.58294535", "0.5552175", "0.55331826", "0.5514921", "0.54477173", "0.54287124", "0.5416825", "0.5416819", "0.5405929", "0.53973347", "0.53698206", "0.53577095", "0.53481865", "0.5343881", "0.5340405", "0.53395146", "0.531695", "0.5313736", "0.53033...
0.6405106
0
Run multiple iterations to get an average (for random) num of steps to solve an n sized train.
def simulate(n: int, iterations: int, strategy: Callable[[List[bool]], int], case: Case) -> float: if case is Case.random: steps = [] for _ in range(iterations): train = generate_train(n, case) steps.append(strategy(train)) return sum(steps) / iterations else: #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_several_iterations(iterations, means, horizon):\n\n # Initializing the results vector.\n results = [0]*horizon\n\n for iteration in range(iterations):\n\n # The current cumulative regret.\n results = np.add(results, run_sparring_algorithm(means[:, iteration], horizon))\n\n # Retur...
[ "0.6872567", "0.6478989", "0.6449429", "0.6428292", "0.6411787", "0.63848245", "0.6359613", "0.635177", "0.6341936", "0.63377756", "0.63224", "0.6303323", "0.6251876", "0.6179154", "0.61652344", "0.6121429", "0.60852045", "0.6081249", "0.6073426", "0.6066236", "0.6041289", ...
0.65983486
1
Command to invoke action
def command(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_command(self, args):\n pass", "def call_action(self, action):\n pass", "def perform ( self, action, action_event = None ):\r\n getattr( self.editor, action.action )()", "def run(self):\n\n self._action.execute()", "def _command(self, *cmd, handler=None):", "def cmd(self...
[ "0.7422591", "0.7246465", "0.7105488", "0.7063541", "0.7034798", "0.7034607", "0.699779", "0.6962138", "0.6921741", "0.68963987", "0.688974", "0.6873392", "0.6873392", "0.68258065", "0.68252987", "0.6810865", "0.6804983", "0.678378", "0.67473334", "0.67444074", "0.67200506", ...
0.74541897
0
Command description that is written when calling help
def help_description(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help_help(self):\n print(\"List commands or print details about a command\")", "def cmd_help(args):", "def help():", "def help(self) -> str:\n\t\treturn None", "def help(self):\n res = \"\"", "def help(self) -> str:\n raise NotImplementedError", "def help():\n \n pass...
[ "0.8596167", "0.84042567", "0.83424544", "0.8231979", "0.8231433", "0.82134867", "0.8204513", "0.81856096", "0.81540036", "0.8146767", "0.8052207", "0.8052207", "0.8041581", "0.8015385", "0.8009065", "0.8009065", "0.8007859", "0.79113066", "0.7876874", "0.7875317", "0.7847318...
0.86322474
0
Arguments that the command can take for display when calling !help
def help_args(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_help(args):", "def help():", "def help():\n \n pass", "def command_help(args):\n\tprint_usage()\n\treturn 0", "def help(self):", "def help(self):", "def help_help(self):\n print(\"List commands or print details about a command\")", "def help(self):\r\n self._short_help(Non...
[ "0.8441303", "0.7788451", "0.770093", "0.7570277", "0.74810445", "0.74810445", "0.746632", "0.7439244", "0.7432395", "0.74161357", "0.73601675", "0.73601675", "0.7354735", "0.73255694", "0.73190814", "0.72708803", "0.726418", "0.7212647", "0.72031015", "0.719842", "0.7182373"...
0.86482817
0
The constructor recieves a file reader as a parameter
def __init__(self,file_reader): self.file_reader = file_reader
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, file_path: str):\n\n super().__init__(file_path)\n self.reader = None", "def __init__(self, file_format, location):\n Reader.__init__(self, file_format, location)", "def __init__(self, filename=None, **kwargs):\n self.filename = filename\n if filename:\n ...
[ "0.804758", "0.76431406", "0.757506", "0.7466411", "0.74529696", "0.7290955", "0.72775996", "0.7252937", "0.72369134", "0.7202889", "0.71787804", "0.7177659", "0.7151424", "0.7106192", "0.7086836", "0.7064564", "0.70636016", "0.7056612", "0.7051588", "0.70443034", "0.70443034...
0.86837536
0
To check the [app_spec.yml] file
def test_yml_file(self): self.assertTrue(os.path.exists( "{}/app_spec.yml".format(self.APP_PATH)), msg="[app_spec.yml] file does not exist")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_config(app):\n assert app.testing", "def test_all_configs_available():\n\n app_configs = application_services.get_configs()\n assert all(name in app_configs for name in ['TITLE', 'ENCODING', 'FLASK_LOG_LEVEL',\n 'SERVER_NAME', 'SERVER_HOST', 'SERVE...
[ "0.7055021", "0.6980431", "0.69095963", "0.68210423", "0.67571163", "0.6694255", "0.6670684", "0.66696185", "0.66696185", "0.66068614", "0.66015244", "0.6556085", "0.6553034", "0.64685637", "0.64581585", "0.63349384", "0.6252496", "0.62287134", "0.6157798", "0.61020434", "0.6...
0.78608257
0
To check the handle() function in target py file.
def test_signature(self): with open("{}/{}".format(self.APP_PATH, self.TARGET_PY_FILE), 'r', encoding="utf-8", errors='ignore') as f: read_data = f.read() # Check [def predict()] section with self.subTest(name="[def handle()] in main.py"): se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self) -> None:", "def handle(self):", "def test_handle(self):\n with pytest.raises(NotImplementedError):\n self.behaviour.act()", "def test_handle(self):\n with pytest.raises(NotImplementedError):\n self.handler.handle(MagicMock())", "def can_handle(file_io):\...
[ "0.66301197", "0.6265526", "0.60250926", "0.591698", "0.5857054", "0.5830921", "0.5746907", "0.5727226", "0.57181555", "0.5710975", "0.57099104", "0.56737465", "0.5569293", "0.5519453", "0.549496", "0.5453356", "0.54106706", "0.53682965", "0.5319153", "0.5304536", "0.52944297...
0.65754604
1
To check the content of app_spec yml file
def test_yaml(self): # Check yml file can be loaded correctly with open("{}/app_spec.yml".format(self.APP_PATH), mode='r', encoding="utf-8", errors='ignore') as stream: # Load yaml file try: yaml_obj = yaml.load(stream) or {} except ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_yml_file(self):\n self.assertTrue(os.path.exists(\n \"{}/app_spec.yml\".format(self.APP_PATH)),\n msg=\"[app_spec.yml] file does not exist\")", "def test_all_configs_values():\n\n app_configs = application_services.get_configs()\n\n assert app_configs['TITLE'] == 'pyri...
[ "0.7540724", "0.6788227", "0.67328674", "0.65523636", "0.6526139", "0.63310313", "0.63207847", "0.6301031", "0.62732947", "0.6242715", "0.61136854", "0.61089844", "0.6103603", "0.60729873", "0.6055942", "0.60303736", "0.6007551", "0.598182", "0.5974556", "0.5971673", "0.59346...
0.69836795
1
registrate two point clouds using global registration + local icp the correspondence checker for icp is point to point
def registration_ptpt(src, tgt, downsampling_voxelsize=.003, toggledebug = False): src_o3d = pda.nparray_to_o3dpcd(src) tgt_o3d = pda.nparray_to_o3dpcd(tgt) if toggledebug: __draw_registration_result(src_o3d, tgt_o3d, np.identity(4)) source_down, source_fpfh = __preprocess_point_cloud(src_o3d, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_registration_np(source_np, target_np, init_trans=None):\n start_time = time.time()\n source_pcd = open3d.geometry.PointCloud()\n target_pcd = open3d.geometry.PointCloud()\n source_pcd.points = open3d.utility.Vector3dVector(source_np)\n target_pcd.points = open3d.utility.Vector3dVector(targe...
[ "0.5915178", "0.57224786", "0.55198866", "0.5475356", "0.5395827", "0.53637755", "0.5278861", "0.52763593", "0.52666354", "0.5253355", "0.52480525", "0.52086514", "0.5196089", "0.5193255", "0.5188967", "0.5140418", "0.51155037", "0.51120853", "0.5073974", "0.5073974", "0.5044...
0.6222439
0
segment pcd into clusters using the DBSCAN method
def cluster_pcd(pcd_nparray, pcd_nparray_nrmls = None): db = skc.DBSCAN(eps=10, min_samples=50, n_jobs=-1).fit(pcd_nparray) core_samples_mask = np.zeros_like(db.labels_, dtype=bool) core_samples_mask[db.core_sample_indices_] = True labels = db.labels_ n_clusters_ = len(set(labels)) - (1 if -1 in lab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DBscan_clustering(self,d,s):\r\n print(colored(\"Performing agglomerative clustering\",color = 'yellow', attrs=['bold']))\r\n self.clustering = DBSCAN(eps=d,min_samples=s,metric = 'euclidean').fit(self.X)\r\n self.labels = self.clustering.labels_\r\n self.davies_bouldin_score()\r\n ...
[ "0.6765987", "0.6542201", "0.65293044", "0.6509669", "0.641171", "0.63141483", "0.6297655", "0.6267518", "0.6246303", "0.61985743", "0.6113146", "0.6010988", "0.59941626", "0.5959197", "0.58831084", "0.5810937", "0.5773978", "0.57537913", "0.5740683", "0.5703168", "0.56980145...
0.6934534
0
merge nppcd2 and nppcd1 by rotating and moving nppcd2 using rotmat2 and posmat2
def merge_pcd(pnppcd1, pnppcd2, rotmat2, posmat2): transformednppcd2 = np.dot(rotmat2, pnppcd2.T).T+posmat2 mergednppcd = np.zeros((len(transformednppcd2)+len(pnppcd1),3)) mergednppcd[:len(pnppcd1), :] = pnppcd1 mergednppcd[len(pnppcd1):, :] = transformednppcd2 return mergednppcd
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alignmolecules(ccdata1, ccdata2):\n\n rotationmatrix = _findrotationmatrix(ccdata1, ccdata2)\n\n for i in range(ccdata2.natom):\n ccdata2.atomcoords[0][i] = np.transpose(\n np.dot(rotationmatrix, np.transpose(ccdata2.atomcoords[0][i])))", "def rotate_pattern(self, st2):\n\t\t# dx = st...
[ "0.5619084", "0.561183", "0.5563653", "0.54526323", "0.53827935", "0.535291", "0.5345134", "0.5333509", "0.5286605", "0.52550685", "0.51833993", "0.5161325", "0.5149795", "0.5144496", "0.51018333", "0.5093167", "0.5086331", "0.50745517", "0.50642204", "0.50530154", "0.5046055...
0.78316736
0
Uses the lar_gen object and a TS row to create a LAR row that passes syntax and validity edits according to the FIG.
def make_clean_lar_row(self, ts_row): #Stores the stop condition and the initial number of iterations. #stop = False iters = 1 #Makes a new row using the lar generator. row = self.lar_gen.make_row(lei=self.clean_config["lei"]["value"]) #Begins a loop that creates the LAR row. The loop generates the r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_custom_row(self, dictionary, clean_filepath, clean_filename):\n\t\t#Creates a TS and LAR dataframe from the clean filepath and name\n\t\t#specified. \n\t\tts_df, lar_df = utils.read_data_file(\n\t\t\t\t\tpath=clean_filepath,\n\t\t\t\t\tdata_file=clean_filename)\n\n\t\t#Changes each column (key in the di...
[ "0.6787065", "0.58248913", "0.5739571", "0.54135615", "0.54003346", "0.5387304", "0.5264666", "0.52554774", "0.52544534", "0.5210778", "0.51923925", "0.51433605", "0.51176804", "0.50872564", "0.5082819", "0.5059166", "0.5036582", "0.50033706", "0.4974943", "0.49394202", "0.49...
0.72548693
0
This function takes in a filepath and name, producing a report on whether any rows of the data failed syntax, validity or quality edits. The report contains among its fields the edit name, the status of the edit, the number of rows failed by the edit, if any, and the ULI's or NULIs (loan ID) of the rows that fail the e...
def edit_report(self): #Instantiates the rules engine class as a checker object with a #LAR schema, a TS schema, and geographic geographic data. checker = rules_engine(lar_schema=self.lar_schema_df, ts_schema=self.ts_schema_df, geographic_data=self.geographic_data) #Seperates data from the filepath and f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_pytest_report(dirpath, log):\n\n status, reason = conf.read_status(dirpath)\n\n log.debug(\"In parse_pytest_report, dirpath=%s\" % dirpath)\n log.debug(\"DD status=%s\" % status)\n log.debug(\"DD reason=%s\" % reason)\n\n tests = []\n path = os.path.join(dirpath,conf.pytest_log)\n f ...
[ "0.6076135", "0.5716234", "0.5547684", "0.5538576", "0.55284023", "0.5473937", "0.543028", "0.54183865", "0.53627235", "0.53151035", "0.5311384", "0.52984524", "0.5269419", "0.5207831", "0.5199972", "0.5196265", "0.5196254", "0.51849324", "0.51627773", "0.51507986", "0.514450...
0.5995755
1
Creates a custom clean LAR row by passing in a dictionary of columns and new values to modify all the rows of an existing clean file, filters the modified file for clean rows, and then pulls the first row from the file. Pulls rows from the clean file last generated. Suggestion that the file pulled should be 1000 origin...
def create_custom_row(self, dictionary, clean_filepath, clean_filename): #Creates a TS and LAR dataframe from the clean filepath and name #specified. ts_df, lar_df = utils.read_data_file( path=clean_filepath, data_file=clean_filename) #Changes each column (key in the dictionary) to the new value in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_clean_lar_row(self, ts_row):\n\n\t\t#Stores the stop condition and the initial number of iterations. \n\t\t#stop = False\n\t\titers = 1\n\n\t\t#Makes a new row using the lar generator. \n\t\trow = self.lar_gen.make_row(lei=self.clean_config[\"lei\"][\"value\"])\n\t\t\n\t\t#Begins a loop that creates the L...
[ "0.5875423", "0.58468115", "0.5561555", "0.52249265", "0.52093863", "0.5169878", "0.5150891", "0.5093749", "0.5023769", "0.4988928", "0.49547845", "0.49460533", "0.4936191", "0.4910085", "0.48953867", "0.4890257", "0.488633", "0.48791775", "0.48575604", "0.48564965", "0.48480...
0.6772873
0
Stores the numbers generated by the iterable to a new vtkDoubleArray and returns this array. The parameter `number_of_values` is used to preallocate the correct size.
def iterable_to_vtk_array( data: typing.Iterable[float], number_of_values: int, default_value: float = 0.0 ) -> vtk.vtkDoubleArray: result = vtk.vtkDoubleArray() result.SetNumberOfValues(number_of_values) for index, value in enumerate( islice(chain(data, repeat(default_value)), number_of_values...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def values(self):\n arr = self.view(np.ndarray).copy()\n return arr", "def create(cls, vals: npt.NDArray[np.float64]) -> DataVector:\n return vals.view(cls)", "def copy(self):\n copy_arr = DynamicArray(self._growth_factor) # Create new array to store values\n for i in range(...
[ "0.59181714", "0.55544114", "0.55440915", "0.55246353", "0.54436195", "0.5394002", "0.53783375", "0.5308205", "0.5258129", "0.5251879", "0.52273315", "0.5224779", "0.5208602", "0.5188198", "0.5175874", "0.516562", "0.5160743", "0.5142797", "0.51314837", "0.5081514", "0.507407...
0.76760906
0
Connect to Oracle DB user .setup.conf file, execute provided query, return as cursor object
def oracle_cursor(query): conf_file_dir = os.path.dirname(os.path.realpath(__file__)) conf_file = conf_file_dir + os.sep + '.setup.conf' (username, password, host, port, sid) = credential_setup(conf_file) dsn_tns = cx_Oracle.makedsn(host, port, sid) connection = cx_Oracle.connect(username, password,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect():\n\n dbpath = globs.props['TargetServer'] + \":\" + globs.props['Port'] + \"/\" + globs.props['Service']\n \n print(\"Checking Connection with SYSTEM USER\")\n username, password = globs.SYSTEM_USER_KEYS\n try:\n # Try connection with SYSTEM User\n con = cx_Oracle.connect...
[ "0.6783848", "0.64070356", "0.62990195", "0.6297732", "0.6279014", "0.6184889", "0.59913576", "0.59271914", "0.59271914", "0.5906598", "0.58368015", "0.58233154", "0.5787576", "0.5785669", "0.5784833", "0.57820535", "0.57727164", "0.57329684", "0.5717016", "0.57037735", "0.57...
0.77675796
0
Returns a JSON response containing 'context' as payload
def render_to_response(self, context): return self.get_json_response(self.convert_context_to_json(context))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_to_response(self, context):\n return self.get_json_response(self.convert_context_to_json(context))", "def convert_context_to_json(self, context):\n return json.dumps(context, indent=4)", "def convert_context_to_json(self, context):\n\t\t# Note: This is *EXTREMELY* naive; in reality, yo...
[ "0.7979857", "0.76156807", "0.7464314", "0.74261236", "0.74261236", "0.741949", "0.74038345", "0.7394559", "0.738246", "0.715568", "0.715568", "0.715568", "0.715568", "0.715568", "0.7155645", "0.7060124", "0.7060124", "0.7060124", "0.7060124", "0.70428693", "0.7030681", "0....
0.7954872
1
Convert the context dictionary into a JSON object
def convert_context_to_json(self, context): # Note: This is *EXTREMELY* naive; in reality, you'll need # to do much more complex handling to ensure that arbitrary # objects -- such as Django model instances or querysets # -- can be serialized as JSON. return json.dumps(context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_context_to_json(self, context):\n return json.dumps(context, indent=4)", "def convert_context_to_json(self, context):\n # Note: This is *EXTREMELY* naive; in reality, you'll need\n # to do much more complex handling to ensure that arbitrary\n # objects -- such as Django mo...
[ "0.8702103", "0.8608106", "0.84402055", "0.74707264", "0.7341737", "0.7341737", "0.7341737", "0.7341737", "0.7135267", "0.711399", "0.7106374", "0.6971391", "0.6894682", "0.6828401", "0.6754215", "0.67350495", "0.6669339", "0.6669339", "0.6632604", "0.6625772", "0.66110015", ...
0.86628616
1
i is an array of row indices j is an array of column indices m is a matrix where we want to slice out rows i and cols j
def slice_matrix(m,i,j): return np.take(np.take(m,i,0),j,1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slice(self, i, j, n, m):\n return Table(rows=[list.__getitem__(self, i)[j:j+m] for i in range(i, i+n)])", "def __getslice__(self,i,j):\n nv=_Matr()\n nv.__c_elem().recup_rel(self.__c_elem(),i,j)\n nv.__maj()\n return nv", "def _slice(tensor, size, i):\n return tensor[:...
[ "0.6856894", "0.64775616", "0.64234143", "0.635025", "0.6283782", "0.6228726", "0.61785865", "0.61732614", "0.6074258", "0.60334617", "0.60052776", "0.59897095", "0.59718907", "0.5949998", "0.5939215", "0.5877006", "0.57286596", "0.5682539", "0.56776327", "0.5674451", "0.5672...
0.8412889
0
Compute isomap instead of mds. Currently neighborhoods of type k are supported.
def isomap(d, fnc = 'k', size = 7, dimensions = 2): if not len(d.shape) == 2: raise ValueError, "d must be a square matrix" # the put operation is destructive to d ld = cluster_graph(d, fnc = fnc, size = size, graph = 'distance') adj = cluster_graph(d, fnc = fnc, size = size, graph = 'adjacency...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateNeighborMap(self):\n A=[]\n for key,value in self._ts_dict.iteritems():\n A.append(np.array([i.replace(\"#\",\" \")\n .split()[0:4] for i in value.index])\n .astype(float))\n\n B=np.array(A[0]).reshape(len(A[0]),4)\n ...
[ "0.5831626", "0.5611978", "0.55905706", "0.55837834", "0.55837834", "0.5547469", "0.54468495", "0.5320889", "0.5316736", "0.5313513", "0.52878547", "0.5283516", "0.5239893", "0.5230505", "0.52268296", "0.5211891", "0.51887494", "0.51161015", "0.5094323", "0.50883526", "0.5074...
0.5929024
0
Actually does the work of loading the binint, collision, and se_merger files into the pythonic classes we've developed. Takes the file prefix as an input and returns (units,[list of binints],[list of collisions],[list of mergers])
def load_ineraction_files(file_prefix): binintfile=file_prefix+'.binint.log' collfile=file_prefix+'.collision.log' mergefile=file_prefix+'.semergedisrupt.log' unitsfile=file_prefix+'.conv.sh' with open(binintfile, 'r') as f: num_int = sum([1 for line in f if '****' in line]) f.seek(0) #need to count the encou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(filename):\n units[:] = []\n pools[:] = []\n for line in open(filename):\n relatedunits = line.split()\n if not len(relatedunits): continue\n key = len(units)\n for poolnum, name in enumerate(relatedunits):\n if poolnum >= len(pools):\n pools....
[ "0.5932969", "0.5818487", "0.57769066", "0.5735663", "0.5723668", "0.56974", "0.55990654", "0.55556005", "0.55510145", "0.5382647", "0.53749084", "0.53503877", "0.53487355", "0.53437847", "0.53415585", "0.5321286", "0.52940685", "0.5284413", "0.52817786", "0.52420276", "0.523...
0.75009626
0
Returns a list of frames from a video specified by FILEPATH
def videoFrames(filename, framerate=1): vid_file = os.path.join(os.path.dirname(os.getcwd()), "Database", "Video", filename) print(vid_file) assert os.path.isfile(vid_file), "Given path is not a valid file" tmpdir = os.path.join(os.getcwd(), "tmp") subprocess.run( [ "ffmpeg", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_frame_from_video(path: str, frame_index: int) -> np.ndarray:\n vid = load_video(path)\n img = vid[frame_index]\n return img", "def getVideoFrames(videoFilePath, startFrameNumber=-1, endFrameNumber=-1):\n frames=[]\n vidcap = cv2.VideoCapture(videoFilePath)\n fps=vidcap.get(cv2.CAP_PROP...
[ "0.69661224", "0.6752166", "0.6726444", "0.6688479", "0.6677896", "0.66362226", "0.6586516", "0.65092146", "0.6500804", "0.6472495", "0.64576924", "0.64510345", "0.64421624", "0.6415022", "0.63532615", "0.63070565", "0.6265548", "0.62490445", "0.6201519", "0.6144284", "0.6106...
0.75800073
0
Returns the top K frequent words from a list of words
def getTopKCounter(a, K): # r = [] # for i in a: # r.extend(i) c = Counter(a) words = [i[0] for i in c.most_common(K)] return words
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_k_frequent(top_k, words, list_of_texts):\n dict_top_freq = {}\n for word in words:\n dict_top_freq[word.lower()] = 0\n for string in list_of_texts:\n if word.lower() in string.lower():\n counter = string.lower().count(word.lower())\n dict_top_fre...
[ "0.8781979", "0.78165096", "0.7748845", "0.770827", "0.76980144", "0.76744246", "0.7649595", "0.76402617", "0.7396833", "0.7388765", "0.7342151", "0.7325604", "0.731073", "0.7301274", "0.7285774", "0.72816604", "0.7247418", "0.7235698", "0.7150857", "0.7096033", "0.7050999", ...
0.8042737
1
Take number of epochs, number of filters, filter length, and number of fully connected nodes as inputs. Compute the maximum validation accuracy for that network divided by wall clock time. Return the result for Bayesian optimization.
def target(total_epoch, filter_num, filter_len, num_dense_nodes): start = time.time() total_epoch = int(round(total_epoch)) filter_num = int(round(filter_num)) filter_len = int(round(filter_len)) num_dense_nodes = int(round(num_dense_nodes)) print("Epochs =", total_epoch, "| # Conv filters ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(args, net, val_data_loader, val_dataset, iteration_num, iou_thresh=0.5):\r\n print('Validating at ', iteration_num)\r\n num_images = len(val_dataset)\r\n num_classes = args.num_classes\r\n\r\n det_boxes = [[] for _ in range(len(CLASSES))]\r\n gt_boxes = []\r\n print_time = True\r\n ...
[ "0.6236845", "0.61619586", "0.61580217", "0.6120413", "0.6115973", "0.59946954", "0.5976394", "0.595934", "0.59504163", "0.59489274", "0.5924403", "0.5910308", "0.590816", "0.5895659", "0.5893738", "0.5869529", "0.58579844", "0.58462447", "0.5843433", "0.5813959", "0.5787306"...
0.6956495
0
Get the xdata out of an mtz file
def mtz_get_xdata(mtz_filename): # Get location of shell script __location__ = os.path.realpath( os.path.join(os.getcwd(), os.path.dirname(__file__)) ) mtzinfo_shell = os.path.join(__location__, "shell_scripts/mtzinfo.sh") # Run script and get the standard output or raise an exception ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mtz_get_cell(mtz_filename):\n\n xdata = mtz_get_xdata(mtz_filename)\n\n return xdata[0:6]", "def read_szx_fmv_12(eps_file):\n raw_data = eps_file.scaled_mdr\n raw_unscaled = eps_file.mdr\n mphr = eps_file.mphr\n\n n_node_per_line = raw_data[\"LONGITUDE\"].shape[1]\n n_lines = raw_data[\"...
[ "0.66720486", "0.5750768", "0.57445383", "0.57337654", "0.56477934", "0.5640171", "0.5621128", "0.5600484", "0.5567509", "0.5535108", "0.5455651", "0.54455626", "0.5432626", "0.53993064", "0.53821415", "0.53538567", "0.53390706", "0.53171635", "0.53004247", "0.528501", "0.527...
0.78016484
0
Gets the cell information out of the xdata from the mtz file
def mtz_get_cell(mtz_filename): xdata = mtz_get_xdata(mtz_filename) return xdata[0:6]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mtz_get_xdata(mtz_filename):\n\n # Get location of shell script\n __location__ = os.path.realpath(\n os.path.join(os.getcwd(), os.path.dirname(__file__))\n )\n mtzinfo_shell = os.path.join(__location__, \"shell_scripts/mtzinfo.sh\")\n\n # Run script and get the standard output or raise an...
[ "0.69709194", "0.5999852", "0.5726509", "0.5669607", "0.5617734", "0.545353", "0.54360014", "0.5428443", "0.54281694", "0.5421467", "0.5393752", "0.5367735", "0.5343559", "0.5328893", "0.530765", "0.5291727", "0.52610016", "0.5257506", "0.52259904", "0.52257717", "0.52161837"...
0.78436416
0
Get the group information out of the xdata from the mtz file
def mtz_get_group(mtz_filename): xdata = mtz_get_xdata(mtz_filename) try: group = int(xdata[-2]) except Exception: raise Exception("Could not extract group number from xdata") try: assert group == xdata[-2] except Exception: # print("Exception") raise Excep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_grp(fname):\n global DAYS\n uint_types = [DAYS,\n 'Current crop type', \n 'Current residue on ground type', \n 'Previous residue on ground type', \n 'Old residue on ground type', ...
[ "0.6145753", "0.5992458", "0.58756703", "0.57995105", "0.57201415", "0.56633025", "0.5648198", "0.55892634", "0.5449189", "0.54433423", "0.5431574", "0.542928", "0.5421185", "0.54094905", "0.5408034", "0.5389374", "0.53867406", "0.53775334", "0.5365881", "0.53416073", "0.5302...
0.69810057
0
Merges the selected `nodes` of the graph G into one `new_node`, meaning that all the edges that pointed to or from one of these `nodes` will point to or from the `new_node`. attr_dict and attr are defined as in `G.add_node`.
def merge_nodes(G,nodes, new_node, attr_dict=None, **attr): G.add_node(new_node, distToCancer=0, classCell="cancerCluster") # Add the 'merged' node for n1,n2,data in G.edges(data=True): # For all edges related to one of the nodes to merge, # make an edge going to or coming from the `ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_nodes_from(self, nodes_for_adding, **attr):\n for n in nodes_for_adding:\n if isinstance(n, tuple):\n nn, ndict = n\n self.add_node(nn, **{**attr, **ndict})\n else:\n self.add_node(n, **attr)", "def create_graph_with_nodes(src_node...
[ "0.64541876", "0.60823506", "0.60355204", "0.58803207", "0.58203006", "0.5770827", "0.57537264", "0.57122225", "0.570549", "0.5704582", "0.57033736", "0.567602", "0.5673675", "0.56697714", "0.56439775", "0.5601792", "0.5601573", "0.55993754", "0.55957854", "0.5579612", "0.557...
0.80335534
0
expect a profile, ie. a list of profile rows which are dicts. Write that profile to a temp csv and let pandas parse it into a frame.
def prof2frame(prof): import pandas as pd # create data frame from profile dicts frame = pd.DataFrame(prof) # -------------------------------------------------------------------------- # add a flag to indicate entity type def _entity (row): if not row['uid']: return 'sessi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _people_object_from_csv_row(row, header, distinct_id_index=None):\n distinct_id_index = (header.index(\"$distinct_id\") if distinct_id_index is None else distinct_id_index)\n props = Mixpanel._properties_from_csv_row(row, header, ['$distinct_id'])\n profile = {'$distinct_id': row[distinct_...
[ "0.5738499", "0.5729154", "0.5601597", "0.54205126", "0.5414195", "0.5287429", "0.5247495", "0.5245439", "0.5230592", "0.52022916", "0.5180271", "0.516576", "0.5142842", "0.5132142", "0.51119804", "0.5110215", "0.5102601", "0.50988036", "0.5073454", "0.5059942", "0.5035174", ...
0.6020282
0
read profiles for all sessions in the given 'experiments' dict. That dict
def get_experiment_frames(experiments, datadir=None): import pandas as pd exp_frames = dict() if not datadir: datadir = os.getcwd() print 'reading profiles in %s' % datadir for exp in experiments: print " - %s" % exp exp_frames[exp] = list() for sid, label in ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sessions_from_experiments(self, experiment_id):\n sessions = self.dbclient.find_by_col(\n Tables.SESSIONS, SessionAttr.EXPERIMENT_ID,\n self.dbclient.to_fk(experiment_id))\n\n return self.dbclient.to_pandas(sessions)", "def profiles(self):\n with concurrent.futures....
[ "0.5814575", "0.5644516", "0.5585663", "0.5539384", "0.5513362", "0.54596287", "0.5454998", "0.54506516", "0.5426515", "0.53740036", "0.5240945", "0.5158958", "0.5157056", "0.5139253", "0.5106071", "0.51049316", "0.50936997", "0.5086178", "0.5061926", "0.50452054", "0.5039265...
0.67777634
0
We first read all profiles as CSV files and parse them. For each profile, we backcalculate global time (epoch) from the synch timestamps. Then all profiles are merged (time sorted). This routine expectes all profiles to have a synchronization time stamp.
def combine_profiles(profiles): rd_abs = dict() # dict of absolute time refs rd_rel = dict() # dict of relative time refs pd_abs = dict() # profiles which have absolute time refs pd_rel = dict() # profiles which have relative time refs for prof in profiles: p = list() tref = No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_all_data(self):\n\n logging.info('***** Starting the merging process merge_all_data')\n\n \"\"\" All possible unique_dates to loop on \"\"\"\n date_times = self.merged_unique_dates\n date_times.sort()\n date_times = np.array(date_times) \n\n ...
[ "0.606202", "0.6044192", "0.5957986", "0.5923302", "0.5914378", "0.58323956", "0.5735591", "0.56982577", "0.5462068", "0.53328717", "0.52764535", "0.5267779", "0.52248824", "0.5182293", "0.51818633", "0.5158829", "0.515578", "0.51315916", "0.51190054", "0.5106485", "0.5073774...
0.7417598
0
For each unit in units, check if the queue is configured to drop units in the given mode ('in' or 'out'). If drop is set to 0, the units list is returned as is. If drop is set to one, all cloned units are removed from the list. If drop is set to two, an empty list is returned. For each dropped unit, we check if 'drop_c...
def drop_units(cfg, units, name, mode, drop_cb=None, prof=None, logger=None): # blowup is only enabled on profiling if 'RADICAL_PILOT_PROFILE' not in os.environ: if logger: logger.debug('no profiling - no dropping') return units if not units: # if logger: # logg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone_units(cfg, units, name, mode, prof=None, clone_cb=None, logger=None):\n\n if units == None:\n if logger:\n logger.debug('no units - no cloning')\n return list()\n\n if not isinstance(units, list):\n units = [units]\n\n # blowup is only enabled on profiling\n if...
[ "0.54065275", "0.51915365", "0.51451665", "0.5082117", "0.5062945", "0.50367284", "0.49326628", "0.48772532", "0.4844757", "0.48120534", "0.4772282", "0.4637267", "0.46316501", "0.4630709", "0.46159723", "0.45791128", "0.45788732", "0.45765013", "0.45620945", "0.4530692", "0....
0.787543
0
For each unit in units, add 'factor' clones just like it, just with a different ID (.clone_001). The factor depends on the context of this clone call (ie. the queue name), and on mode (which is 'input' or 'output'). This methid will always return a list. For each cloned unit, we check if 'clone_cb' is defined, and call
def clone_units(cfg, units, name, mode, prof=None, clone_cb=None, logger=None): if units == None: if logger: logger.debug('no units - no cloning') return list() if not isinstance(units, list): units = [units] # blowup is only enabled on profiling if 'RADICAL_PILOT_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clones(module, num_copies):\n return nn.ModuleList([copy.deepcopy(module) for _ in range(num_copies)])", "def clones(module: nn.Module, n: int) -> nn.ModuleList:\n return nn.ModuleList([copy.deepcopy(module) for _ in range(n)])", "def clone_worker_agent(agent, factor, environment, network, agent_config...
[ "0.5148318", "0.5052346", "0.4972443", "0.4907246", "0.4907246", "0.4907246", "0.4907246", "0.4868806", "0.4868806", "0.4868806", "0.47305453", "0.47177425", "0.47174838", "0.4715298", "0.4714065", "0.4702092", "0.46919554", "0.46841142", "0.46839648", "0.46823892", "0.467730...
0.7819102
0
test ReversibleBlock inversions and reproducibility of input after backward pass
def test_reversible_block(self): for implementation in [0, 1]: # same convolution test Gm = torch.nn.Conv2d(10 // 2, 10 // 2, (3,3), padding=1) dims = (2,10,8,8) Xdata = np.random.random(dims).astype(np.float32) X = Variable(torch.from_numpy(Xdata)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_inverse_transform(self):", "def test_14(self, test):\r\n globalConfig.test = test\r\n\r\n inputList = getInputList()\r\n if len(inputList) == 0:\r\n return test.UNCLEAR(\"Not tested. No resources found.\")\r\n\r\n constrainedInputs = []\r\n constraintSet = F...
[ "0.65164894", "0.62247777", "0.59500396", "0.58604527", "0.58270544", "0.58019567", "0.5792383", "0.5781358", "0.5743348", "0.57194984", "0.57088184", "0.56637496", "0.5663652", "0.56054986", "0.5594452", "0.5567649", "0.55622464", "0.5554631", "0.55240124", "0.55222255", "0....
0.7683231
0
Response list of files in zip file
def list_zip_files(zip_path): with zipfile.ZipFile(zip_path) as zf: data = ComixData(Directories=[], Files=[]) app.logger.info("Loaded the zip file: %s", zip_path) dirs = [name for name in zf.namelist() if name.endswith('/')] subdirs = set([name.split('/')[0] for name in dirs]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files_in_zip_path(zipname, path):\n data = ComixData(Directories=[], Files=[])\n with zipfile.ZipFile(zipname) as zf:\n for name in zf.namelist():\n name = name.decode('euc-kr').encode('utf-8')\n pardir, basename = os.path.split(name)\n if basename and path == ...
[ "0.75351995", "0.69806844", "0.6902116", "0.68938124", "0.6869245", "0.68668735", "0.6810621", "0.6757332", "0.6734621", "0.67041427", "0.6629345", "0.6623159", "0.66074663", "0.6582022", "0.6529669", "0.6430188", "0.64137745", "0.64033496", "0.638021", "0.63544273", "0.63321...
0.7945773
0
Get folder in zip file /folder1/folder2/file.zip/folder
def load_zip_folder(req_path, name, ext, zip_path): BASE_DIR = ROOT full_path = "%s/%s.%s" % (req_path, name, ext) full_real_path = get_real_path(BASE_DIR, full_path) try: zip_path = unquote(zip_path).encode('utf-8') except Exception as e: logger.info("Failed to encode: %s", zip_path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_zip(folder: Path, file_type: str) -> list[Path]:\n result = []\n for folder_item in folder.iterdir():\n # Is it a directory?\n if folder_item.is_dir():\n result.extend(search_zip(folder_item, file_type))\n # Is it a file?\n if folder_item.is_file():\n ...
[ "0.643485", "0.6346216", "0.6207173", "0.6172162", "0.61548764", "0.6083548", "0.60828155", "0.60654664", "0.603037", "0.6013012", "0.59908175", "0.58656776", "0.5828892", "0.58264667", "0.57948416", "0.5789767", "0.57335377", "0.57237303", "0.57165146", "0.5699568", "0.56935...
0.6471346
0
Optionally restricts the returned SocialNetwork to a given user, by filtering against a `username` query parameter in the URL. api/socialnetworks?username=tony
def get_queryset(self): queryset = SocialNetwork.objects.all() username = self.request.query_params.get('username', None) userqueryset = User.objects.all() users = userqueryset.filter(username=username) if users.count() != 0 and username is not None: queryset = querys...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cannot_retrieve_banned_users_of_public_community(self):\n user = make_user()\n headers = make_authentication_headers_for_user(user)\n\n other_user = make_user()\n community = make_community(creator=other_user, type='P')\n community_name = community.name\n\n user_t...
[ "0.55774045", "0.54007274", "0.53953147", "0.53808665", "0.5338036", "0.5326447", "0.53127855", "0.5261922", "0.5256456", "0.5253702", "0.52182436", "0.5187874", "0.5169508", "0.51277477", "0.5115091", "0.51017296", "0.5079685", "0.50503016", "0.50380844", "0.5025175", "0.501...
0.6501585
0
Optionally restricts the returned TShirt to a given code, by filtering against a `code` query parameter in the URL. api/tshirts?code=1234
def get_queryset(self): queryset = TShirt.objects.all() code = self.request.query_params.get('code', None) if code is not None: queryset = queryset.filter(code=code) return queryset return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_find_codes(session, client, jwt, app, code: Code):\n rv = client.get(f'/api/v1/codes/{code.value}', headers={})\n assert rv.status_code == 200", "def test_api_type_filtering(api_client, by_type, by_state):\n response = api_client.get(path='/breweries', params={'by_type': by_type, 'by_state': by...
[ "0.55092126", "0.54948014", "0.52612525", "0.50290036", "0.49936798", "0.49531978", "0.49245837", "0.48809955", "0.48648056", "0.4864027", "0.4823644", "0.48110995", "0.48033512", "0.4792318", "0.47824737", "0.47754154", "0.47744706", "0.4770514", "0.47647694", "0.47462177", ...
0.6633659
0
Optionally restricts the returned Snippet to a given user, by filtering against a `username` query parameter in the URL. api/snippets?username=tony
def get_queryset(self): queryset = Snippet.objects.all() username = self.request.query_params.get('username', None) userqueryset = User.objects.all() users = userqueryset.filter(username=username) if users.count() != 0 and username is not None: queryset = queryset.fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snippets_by_author(request, username):\n user = get_object_or_404(User, username__exact=username)\n return list_detail.object_list(request,\n queryset=Snippet.objects.get_by_author(user.username),\n extra_context={ 'object': user },\n ...
[ "0.722203", "0.5637196", "0.54735464", "0.5462925", "0.54108864", "0.53937244", "0.53556126", "0.5352024", "0.5266517", "0.5264749", "0.5261665", "0.5261552", "0.5258649", "0.5240273", "0.521561", "0.5203247", "0.52026564", "0.5198205", "0.51765716", "0.51717347", "0.5160868"...
0.65672255
1
Check if Gmail message is chat message, not email. Google/Hangout chats is shown in emails with label 'Chat'. Let's filter such messages.
def is_chat(message): labels = message.get('X-Gmail-Labels', "").split(',') return 'Chat' in labels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_has_message(data):\r\n return re.match(r'^:[a-zA-Z0-9_]+\\![a-zA-Z0-9_]+@[a-zA-Z0-9_]+'\r\n r'\\.tmi\\.twitch\\.tv '\r\n r'PRIVMSG #[a-zA-Z0-9_]+ :.+$', data)", "def callback_message(self, conn, mess):\n if (mess.getFrom().getStripped() == co...
[ "0.67888373", "0.6140791", "0.61278343", "0.60920715", "0.60803276", "0.599417", "0.597809", "0.5965592", "0.59293926", "0.5878504", "0.58337176", "0.5813041", "0.5761161", "0.5721317", "0.5680204", "0.56707656", "0.5664777", "0.56557304", "0.56548095", "0.56090826", "0.55557...
0.8312462
0
Returns the length of the overlap between word1 and word2. The number of letters from the end of word1 that match the beginning of word2.
def _get_overlap(word1, word2): max_overlap = min(len(word1), len(word2)) max_found = 0 for size in range(1, max_overlap+1): suffix = word1[-size:] prefix = word2[:size] if suffix == prefix: max_found = size return max_found
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_overlap2(sentence_a, sentence_b):\n a_set = set(word for word in sentence_a) - config.stop_list\n b_set = set(word for word in sentence_b) - config.stop_list\n score = len(a_set&b_set)/float(len(a_set|b_set))# len(s1&s2)/max(len(s1),len(s2))\n\n return score", "def num_mismatched_letters(sel...
[ "0.78098536", "0.7467102", "0.7415141", "0.73341984", "0.73180985", "0.72840905", "0.72431624", "0.72137946", "0.7133006", "0.7084717", "0.70651585", "0.7054916", "0.7016627", "0.6979334", "0.69409865", "0.68577796", "0.6840546", "0.68177986", "0.68087363", "0.67936695", "0.6...
0.8094271
0
Get all items based on media type
def find_things(server, media_type): dict_tt = {name: [] for name in media_type} print('Finding items from {}.'.format(server.friendlyName)) for section in server.library.sections(): if section.title not in IGNORE_LST and section.type in media_type: for item in server.library.section(se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_items_of_media_type(self, media_type):\n return (item for item in self.items if item.media_type == media_type)", "def _get_media(media_types):\n get_mapped_media = (lambda x: maps.VIRTUAL_MEDIA_TYPES_MAP[x]\n if x in maps.VIRTUAL_MEDIA_TYPES_MAP else None)\n return lis...
[ "0.78638035", "0.66573626", "0.6345513", "0.63355243", "0.62988263", "0.6166886", "0.6143174", "0.609578", "0.60231024", "0.5991302", "0.59788394", "0.59599847", "0.58828515", "0.58521086", "0.5793054", "0.57909", "0.5779716", "0.57716787", "0.5753249", "0.5713391", "0.570906...
0.7154253
1
Creates io zip file with scraped images.
def _create_zip_file(self) -> BytesIO: zip_file_io = BytesIO() with ZipFile(zip_file_io, 'w') as zip_file: for image_scraper_model in self._url_model.image_scraper.all(): image_absolute_path = self._get_image_absolute_path(image_scraper_model) zip_file_image_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zip_files():\n zipper = ZipFile(\"Moritz_Bunse_ML_project.zip\", \"w\")\n files_to_write = [\"poi_id.py\",\n \"my_classifier.pkl\",\n \"my_dataset.pkl\",\n \"my_feature_list.pkl\",\n \"tester.py\",\n ...
[ "0.6694377", "0.6516335", "0.6347022", "0.6331905", "0.62643796", "0.6210015", "0.6146977", "0.6134844", "0.60178965", "0.6003364", "0.5999783", "0.5947567", "0.5897145", "0.588528", "0.58266807", "0.5800564", "0.5788429", "0.5765761", "0.57410246", "0.57394004", "0.5739371",...
0.8136843
0
Creates image path in a zip file.
def _get_zip_file_image_path(self, image_absolute_path: str) -> str: folder_name = self._get_file_name() image_name = basename(image_absolute_path) return '{}/{}'.format(folder_name, image_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_zip_file(self) -> BytesIO:\n zip_file_io = BytesIO()\n with ZipFile(zip_file_io, 'w') as zip_file:\n for image_scraper_model in self._url_model.image_scraper.all():\n image_absolute_path = self._get_image_absolute_path(image_scraper_model)\n zip_fi...
[ "0.714511", "0.6468319", "0.64492923", "0.631679", "0.62917197", "0.62580407", "0.6191408", "0.6177641", "0.6092818", "0.6066979", "0.5942166", "0.59411055", "0.58931416", "0.58734655", "0.58665574", "0.5859411", "0.585262", "0.5850715", "0.58329004", "0.5823271", "0.5808835"...
0.6773341
1
Returns image absolute path.
def _get_image_absolute_path(image_scraper_model: ImageScraperModel) -> str: return image_scraper_model.image.path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_absolute_imgpath(image_path):\n if not os.path.isabs(image_path):\n # print(image_path, 'is not an absolute path...')\n absolute_image_path = os.path.join(IMAGE_DIR, image_path)\n else:\n # print(image_path, 'is an absolute path...')\n absolute_image_path = image_path\n\n ...
[ "0.8006086", "0.75700915", "0.7523443", "0.7448933", "0.74275225", "0.73922884", "0.7357873", "0.72093546", "0.71457636", "0.7135003", "0.7130953", "0.7120023", "0.7109832", "0.708776", "0.70787704", "0.7050235", "0.70461315", "0.69814885", "0.69764596", "0.6963723", "0.69537...
0.8138409
0
Create a corpus based off of lyrics in a whole genre. If the genre does not exist, return an empty string.
def create_corpus_for_genre(genre): corpus = "" if genre in os.listdir(DATA_DIR): #iterate through artists for artist in os.listdir(DATA_DIR + "/" + genre + "/"): for filename in os.listdir(DATA_DIR + "/" + genre + "/" + artist + "/"): with open(DATA_DIR + "/" + genre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_corpus_for_artist(artist):\n raise NotImplementedError", "def create_lyrics_corpus(artists, lang_model):\n complete_lyrics = []\n indices = []\n for i, artist in enumerate(artists):\n directory = f\"lyrics/{artist.lower().replace(' ', '-')}-lyrics\"\n allfiles = os.listdir(di...
[ "0.6270941", "0.6098548", "0.5865272", "0.55095875", "0.54754037", "0.5453078", "0.5393892", "0.5392192", "0.52884245", "0.5174107", "0.5096137", "0.5066921", "0.50520444", "0.50479984", "0.50383216", "0.5031781", "0.503141", "0.50143445", "0.50041974", "0.5003683", "0.492801...
0.7969428
0
Create a corpus based off of lyrics for a specific artist. If the artist does not exist, return an empty string.
def create_corpus_for_artist(artist): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_lyrics_corpus(artists, lang_model):\n complete_lyrics = []\n indices = []\n for i, artist in enumerate(artists):\n directory = f\"lyrics/{artist.lower().replace(' ', '-')}-lyrics\"\n allfiles = os.listdir(directory)\n all_lyrics = []\n for file in allfiles:\n ...
[ "0.6838442", "0.658768", "0.6230371", "0.6116328", "0.60323876", "0.59554255", "0.56488836", "0.5635698", "0.5613263", "0.55519605", "0.55463576", "0.5452849", "0.5438775", "0.5309835", "0.524863", "0.5225662", "0.5207424", "0.5199917", "0.51992524", "0.51818883", "0.5138604"...
0.7818209
0
Convert a list of images from BGR format to RGB format.
def bgr_to_rgb(ims): out = [] for im in ims: out.append(im[:,:,::-1]) return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_images_rgb(filelist):\n # pixel value range 0-255\n if not isinstance(filelist, list):\n im = Image.open(filelist)\n if len(im.size) < 3:\n im = np.expand_dims(im, axis=2)\n if im.shape[2] == 1:\n im = np.concatenate((im, im, im), axis=2)\n\n return ...
[ "0.71860135", "0.679495", "0.6775859", "0.67216146", "0.64142054", "0.6397395", "0.63815653", "0.6344914", "0.6232344", "0.6220194", "0.6210491", "0.61748475", "0.617009", "0.61695987", "0.6133918", "0.6126966", "0.61018753", "0.6088163", "0.6087222", "0.6081302", "0.60612565...
0.71645504
1
Configure this ACL to be the default ACL.
def default_acl(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "default_acl")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_acl(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"default_acl\")", "def set_default_configs(self):\n\n raise Exception(\"Child classes must override set_default_configs().\")", "def load_acl(self):\n macl_class = self.app.config.get('MACL_CLASS', None)\n ...
[ "0.60754454", "0.60204315", "0.59135896", "0.5883526", "0.57672423", "0.5477288", "0.5426143", "0.5396816", "0.5363357", "0.5362325", "0.5351311", "0.53115493", "0.5293302", "0.5281994", "0.52605575", "0.5205465", "0.5202139", "0.5182241", "0.5170495", "0.51658547", "0.515204...
0.6248286
1
Configure this ACL to be the default ACL.
def default_acl(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "default_acl")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_acl(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"default_acl\")", "def set_default_configs(self):\n\n raise Exception(\"Child classes must override set_default_configs().\")", "def load_acl(self):\n macl_class = self.app.config.get('MACL_CLASS', None)\n ...
[ "0.60754454", "0.60204315", "0.59135896", "0.5883526", "0.57672423", "0.5477288", "0.5426143", "0.5396816", "0.5363357", "0.5362325", "0.5351311", "0.53115493", "0.5293302", "0.5281994", "0.52605575", "0.5205465", "0.5202139", "0.5182241", "0.5170495", "0.51658547", "0.515204...
0.6248286
0
Get an existing BucketACL resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None, bucket: Optional[pulumi.Input[str]] = None, default_acl: Optional[pulumi.Input[str]] = None, predefined_acl: Optional[pulumi.Input[str]] = None, role_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n arn: Optional[pulumi.Input[str]] = None,\n minimum_engine_version: Optional[pulumi.Input[str]] = None,\n name: Optional[pulumi.Input[str]] = None,\n ...
[ "0.64577264", "0.5947939", "0.58915263", "0.5568761", "0.54618436", "0.5362307", "0.53181195", "0.52939457", "0.5157081", "0.50954044", "0.5064083", "0.5047853", "0.50335944", "0.50317466", "0.50276214", "0.4980495", "0.49696046", "0.49487582", "0.49316308", "0.4919981", "0.4...
0.7246119
0
Returns extents of cubic bezier curve given by three points.
def qbezier_bounds((x0, y0), (x1, y1), (x2, y2)): # cubic Bezier reprsented in polynomial base # f(t) = A*t^2 + B*t + C Ax = x0 - 2*x1 + x2 Bx = -2*x0 + 2*x1 Cx = x0 Ay = y0 - 2*y1 + y2 By = -2*y0 + 2*y1 Cy = y0 # find extremas: # 1) x(0) = x0 # 2) x(1) = x2 # 3) f(t_e), where f'(t_e)=0 and t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _estimateCubicCurveLength(pt0, pt1, pt2, pt3, precision=10):\n points = []\n length = 0\n step = 1.0 / precision\n factors = range(0, precision + 1)\n for i in factors:\n points.append(_getCubicPoint(i * step, pt0, pt1, pt2, pt3))\n for i in range(len(points) - 1):\n pta = point...
[ "0.5953909", "0.59034306", "0.5709127", "0.56072694", "0.5578115", "0.5508423", "0.5507892", "0.5463218", "0.54577154", "0.5454042", "0.5443512", "0.54411477", "0.539306", "0.5376491", "0.5314302", "0.5293941", "0.52894145", "0.52793455", "0.52573496", "0.52447194", "0.524054...
0.67851007
0
Create the smtp server configured with the given option.
def makeService(self, options): from smtpfixture.smtp import SmtpFactory maildir = os.path.expanduser(options['maildir']) return internet.TCPServer(int(options['port']), SmtpFactory(maildir=maildir), interface=options['interfac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_server(host, port, uid, pwd):\r\n s = smtplib.SMTP(host, port)\r\n s.starttls()\r\n s.login(\r\n uid,\r\n pwd\r\n )\r\n return s", "def test_smtp(self):\n self._endpointServerTest(\"smtp\", protocols.SMTPFactory)", "def setup_smtp():\n print(\"INFO: Setting up ...
[ "0.6579179", "0.6318303", "0.61443144", "0.5785545", "0.5768862", "0.57659024", "0.56296176", "0.5429438", "0.5381143", "0.5380574", "0.5350988", "0.5344081", "0.5322655", "0.52978647", "0.5282571", "0.5254363", "0.5245057", "0.5203205", "0.5199547", "0.5178867", "0.5167723",...
0.73199445
0
Report corpora loading statistics.
def _logging(self): msgs = [] # patch to log stdout spawned processes of dataloader logger = init_logger() for ds_name, ds_count in self._counts.items(): msgs.append(f"\t\t\t* {ds_name}: {ds_count}") logger.info("Weighted corpora loaded so far:\n" + "\n".join(msgs))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect():\n\n stats = {}\n for feed in Feed.objects:\n try:\n logger.info('Fetching from {0}...'.format(feed.ext_url))\n new_articles = fetch(feed)\n stats[feed.ext_url] = len(new_articles)\n\n except SAXException as e:\n if feed.errors is None:\...
[ "0.58135235", "0.5707024", "0.5621995", "0.55417943", "0.5437974", "0.54166335", "0.5407277", "0.53514147", "0.53432435", "0.5309933", "0.52931696", "0.52850664", "0.5197045", "0.5185169", "0.5179838", "0.51645637", "0.5132507", "0.51140255", "0.5113957", "0.51130736", "0.507...
0.62714434
0
Add up to bucket_size examples from the mixed corpora according to the above strategy. example tuple is converted to json and tokens numericalized.
def _bucketing(self): bucket = [] if self.bucket_size_init > 0: _bucket_size = self.bucket_size_init else: _bucket_size = self.bucket_size for ex in self.mixer: bucket.append(ex) if len(bucket) == _bucket_size: yield self._t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def packExamples(self, examples):\n es = []\n sizes = []\n for xs, y in examples:\n e = [self.startingIndex]\n for x in xs:\n for s in x:\n e.append(self.symbolToIndex[s])\n e.append(self.endOfInputIndex)\n e.app...
[ "0.49868333", "0.49561682", "0.48874953", "0.48426566", "0.48080277", "0.47808614", "0.47674313", "0.4755336", "0.47540802", "0.470395", "0.46990594", "0.4695006", "0.46944383", "0.46885863", "0.46764317", "0.4658", "0.4654584", "0.4639609", "0.46274695", "0.46045142", "0.460...
0.5046672
0
Build `DynamicDatasetIter` from opt. if src, tgt,align are passed then dataset is built from those lists instead of opt.[src, tgt, align] Typically this function is called for CorpusTask.[TRAIN,VALID,INFER] from the main tain / translate scripts We disable automatic batching in the DataLoader. The custom optimized batc...
def build_dynamic_dataset_iter( opt, transforms_cls, vocabs, copy=False, task=CorpusTask.TRAIN, stride=1, offset=0, src=None, tgt=None, align=None, ): transforms = make_transforms(opt, transforms_cls, vocabs) corpora = get_corpora(opt, task, src=src, tgt=tgt, align=align)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_dataset(self, xs: List[str], ys: List[str], batch_size: int = None):\n\n if batch_size is None:\n batch_size = self.cM.batch_size\n\n examples = [data.Example.fromlist([x, y], self.data_fields) for x, y in zip(xs, ys)]\n\n dataset = data.Dataset(examples, fields=self.dat...
[ "0.57599646", "0.5535295", "0.5487524", "0.5475826", "0.54694915", "0.54272276", "0.54174757", "0.5372582", "0.53669727", "0.5360361", "0.5352012", "0.53431654", "0.53277665", "0.5325421", "0.5316925", "0.5294645", "0.5278243", "0.52780193", "0.5273412", "0.5272485", "0.52719...
0.6599042
0
Converts the D.E.Shaw topology to Charmusable force field with TIP4P water molecules. THis resorts the atoms in the water solvent chains (C2,C3) to group all 4 atoms as one contiguous residue. It also aliases the ion charges 'pseu' atom to 'OM' for use with the standard tip4p.par parameter file. The set_backbone option...
def convert_topology(src_filename, set_backbone=True, in_place=False, split_dir=None): # Grab unit cell description (should be on first few lines: cryst = None with open(src_filename) as src: for line in src.readlines(): if line.startswith('CRYST1'): cryst = line break # Read in sour...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_from_t4_to_topology(self):\n Molecule.from_polymer_pdb(\n get_data_file_path(\"proteins/T4-protein.pdb\")\n ).to_topology()", "def format_molecule_for_cfour(self):\n self.update_geometry()\n factor = 1.0 if self.PYunits == 'Angstrom' else psi_bohr2angstroms\n ...
[ "0.5505951", "0.5073719", "0.4873922", "0.48472524", "0.48193264", "0.47608668", "0.47477433", "0.46833467", "0.46462268", "0.46436712", "0.464143", "0.46251634", "0.46242386", "0.46138078", "0.45830873", "0.4567597", "0.45633787", "0.4547202", "0.45241225", "0.44624433", "0....
0.68540984
0
Updates PDB file with crytalline unit cell data and backbone temp control to enable gradual heating
def reset_pdb(src_filename): # Standard unit cell description (first lines) cryst= 'CRYST1 51.263 51.263 51.263 90.00 90.00 90.00 P 1 1\n' # Read in source PDB (DEShaw original format) src_pdb = PdbStructure(open(src_filename)) atoms = list(src_pdb.iter_atoms()) topo = md.load(src_filen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_pdb(self):\n # **********************************\n # **********************************\n # pdb writer (start)\n # **********************************\n # **********************************\n date_time = datetime.datetime.today()\n print(\"****************...
[ "0.59033626", "0.5713099", "0.5587605", "0.54201645", "0.5375951", "0.53687596", "0.5342767", "0.53369355", "0.5302551", "0.52729297", "0.5262169", "0.52110904", "0.51914704", "0.5183864", "0.51817787", "0.51646435", "0.51639867", "0.51586205", "0.5152012", "0.51504076", "0.5...
0.6652216
0
Loads all DEShaw Points as one long NDarray. Skip value is used to load fewer frames
def loadpts(skip=40, filt=None, ref_frame=None): pts = [] for i in range(42): print('loading file: ', i) if filt is not None: traj = md.load(DCD_PROT(i), top=PDB_PROT, atom_indices=filt, stride=skip) else: traj = md.load(DCD_PROT(i), top=PDB_PROT, stride=skip) traj.center_coordinates() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DataLoader(data_place):\n # Nd = []\n # Np = []\n # Nz = []\n # channel_num = []\n # images = []\n # id_labels = []\n # pose_labels = []\n\n # mycase\n # Nz = 50\n # channel_num = 3\n # images = np.load('{}/images.npy'.format(data_place))\n # id_labels = np.load('{}/ids.npy'...
[ "0.61254203", "0.5966982", "0.5926961", "0.59151155", "0.5863508", "0.58308154", "0.5760657", "0.5730742", "0.5714258", "0.57130635", "0.5694007", "0.5683174", "0.56779337", "0.56532395", "0.5645316", "0.5619841", "0.5608969", "0.5604016", "0.5580373", "0.55554956", "0.555042...
0.6073463
1
Convert a single frame index to (fileno, frame) tuple
def refFromIndex(index): fileno = math.floor(index // 100000) frame = index % 100000 return fileno, frame
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frame_index(self):\n return self._findex", "def get_frame(frame):\n\n return int.from_bytes(frame, byteorder='big')", "def frame_idx(self) -> int:\n pass", "def frame_info( self ):\n return self.__frame_id, int(self.__frame_timestamp)", "def get_frame(self, i: int):\r\n ...
[ "0.6615041", "0.62602854", "0.62394834", "0.6152539", "0.61499137", "0.60830784", "0.6009717", "0.59861207", "0.5948604", "0.59361106", "0.5929318", "0.5916256", "0.58358395", "0.5809958", "0.5802465", "0.57434183", "0.568934", "0.5646993", "0.5627892", "0.56218296", "0.55818...
0.73210967
0
Calculate the centroids for a list of BPTI trajectories from DEShaw This is assumed to use the prelabeled set of trajectories for conform grouping (by state) and subsequent average centroid location calc Current implementation assumes distance space (with alphafilter)
def calc_bpti_centroid(traj_list): sums = np.zeros(shape=(5, 1653)) cnts = [0 for i in range(5)] label = getLabelList() for n, traj in enumerate(prdist): for i in range(0, len(traj), 40): try: idx = (n*400) + (i // 1000) state = label[idx] # Exclude any near transition frames ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def centroid_for_uncomputed_shapes(shape_list: List[List[Tuple[float, float]]]) -> Tuple[float, float]:\n centroids = []\n areas = []\n for s in shape_list:\n centroids.append(convex_centroid(s))\n areas.append(convex_area(s))\n return centroid_for_shapes(centroids, areas)", "def find_c...
[ "0.6826339", "0.6704955", "0.6630554", "0.6440048", "0.63866913", "0.62420666", "0.6181722", "0.614475", "0.61292166", "0.6115286", "0.6105305", "0.6075912", "0.60748005", "0.6068424", "0.6063974", "0.6061382", "0.6039612", "0.60240024", "0.60192114", "0.5993744", "0.593398",...
0.6937947
0
Get all entries with paging, in reverse order newest first. Returns a generator.
def get_paged_entries(start_page=0, pg_size=2): skip = pg_size * start_page start, end = 0 + skip, pg_size - 1 + skip while True: entries = r.zrevrange('entry_index', start, end) if not entries: break yield entries start, end = start + pg_size, end + pg_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_query(q):\n\toffset = 0\n\twhile True:\n\t\tr = False\n\t\tfor elem in q.limit(1000).offset(offset):\n\t\t r = True\n\t\t yield elem\n\t\toffset += 1000\n\t\tif not r:\n\t\t\tbreak", "def __iter__(self):\n return self.paged()", "def prefetch_all(self) -> PaginationIterator[T]:\n iter...
[ "0.66107035", "0.6581911", "0.64946574", "0.6367739", "0.62785316", "0.6259259", "0.62254614", "0.6187812", "0.6176328", "0.6165486", "0.61108124", "0.60789865", "0.6021347", "0.60139614", "0.60058284", "0.60020936", "0.5987933", "0.5986033", "0.59794927", "0.59724003", "0.59...
0.72349167
0
Get a day's boundaries A days_delta of 0 means today. A days_delta of 1 means yesterday. UTC is not okay. we should use the user's timezone.
def _get_day_boundaries(days_delta=0): base_date = datetime.utcnow() - timedelta(days=int(days_delta)) start_day = base_date.replace(hour=0, minute=0, second=0, microsecond=0) end_day = start_day + timedelta(days=1) log.debug('Day boundary start {} end {}'.format(start_day, end_day)) return (start_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_day_limits(self) -> Tuple[datetime, datetime]:\n day_start = min(self.dset.time.datetime)\n day_end = max(self.dset.time.datetime)\n \n return day_start, day_end", "def interval_days(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"interval_days\")", "def __dayRes...
[ "0.6196164", "0.61110103", "0.5903451", "0.5675002", "0.5569602", "0.5532423", "0.5498644", "0.5451669", "0.5409555", "0.5407719", "0.54027617", "0.5402526", "0.5379924", "0.53775245", "0.5366239", "0.53645635", "0.5356302", "0.5333312", "0.532359", "0.52390313", "0.52098286"...
0.8457112
0
Group entries by domain and then inside each domain, sort them by time, and then sort domains by the time of the first entry from each. Or alphabetically. Or better yet, do this on the frontend.
def group_by_domain(hash_entries): entries = (get_entry(h) for h in hash_entries) domains = {} for e in entries: domains[e['url_domain']] = domains.get(e['url_domain']) or [] domains[e['url_domain']].append(e) return [{'domain': name, 'entries': ent} for name, ent in domains.items()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FilterAndSort(entries, domain):\n result = filter(\n lambda x: ((domain is None or x.main_page_url == domain)\n and x.confidence > .7\n and x.number_of_hits >= 2), entries)\n return sorted(result, key=operator.attrgetter('score'), reverse=True)", "def domain_sort_key(do...
[ "0.6581615", "0.6242767", "0.5947618", "0.59220225", "0.5825727", "0.58238834", "0.5703193", "0.5679431", "0.5637685", "0.5457906", "0.54190165", "0.54028314", "0.538085", "0.5376219", "0.5374855", "0.53193206", "0.53144884", "0.52690583", "0.52013403", "0.51555824", "0.51330...
0.6294285
1
Creates a Networkx graph based on a file or a list of edges
def load_graph(input_file=None, input_list=None): G = nx.Graph() if input_file: with open(input_file, 'r') as file: for line in file.readlines(): line = line.strip().split(" ") G.add_edge(line[0], line[1]) elif input_list: G.add_edges_from(input_li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_graph(filename, directed=True):\n if not directed:\n G = nx.Graph()\n else:\n G = nx.DiGraph()\n with open(filename) as f:\n for line in f:\n d = line.split()\n G.add_edge(int(d[0]), int(d[1]))\n print('Read Graph')\n return G", "def get_graph(pa...
[ "0.7721282", "0.7715553", "0.7549744", "0.748304", "0.7481321", "0.74751616", "0.7315784", "0.72315", "0.7192441", "0.71883535", "0.7184511", "0.7077463", "0.70685726", "0.69662064", "0.69641125", "0.6930802", "0.69218314", "0.68984205", "0.6878771", "0.6854031", "0.68474376"...
0.78887475
0
Get the neighbors of each node from a NetworkX graph in a dictionary
def get_neighbors(graph): neighbor_dict = dict() for node in graph: neighbor_dict[node] = set(graph[node]) return neighbor_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbors(self, n):\n\n try:\n return self.dict[n].keys()\n except KeyError:\n raise KeyError('Node not in graph.')", "def get_neighbors(self):\n \n return self.adjacent.keys()", "def neighborhood(G,n,o):\n base = G[n]\n neighbors = {}\n neighbors[...
[ "0.7494643", "0.72141767", "0.69946605", "0.69806373", "0.69595605", "0.694073", "0.69284505", "0.6898482", "0.6887162", "0.67841864", "0.67640376", "0.67278284", "0.66748416", "0.6641142", "0.66320515", "0.6593622", "0.6572399", "0.65383476", "0.65369564", "0.6511455", "0.65...
0.795288
0
Calculate Adamic Adar index
def adamic_adar(G, edges): scores = dict() adamic_adar_index = nx.adamic_adar_index(G, edges) for author1, author2, index in adamic_adar_index: scores[author1 + ' ' + author2] = index return scores
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adstatistic(self, X):\n n = len(X)\n Y = X[:]\n ybar = mean(Y)\n yvar = var(Y)\n ysd = sqrt(yvar)\n Y = [(y- ybar)/ysd for y in Y]\n A2 = -n\n S =0.0 \n Y.sort() # don't forget this!!!\n for i, y in enumerate(Y):\n j = i+1\n ...
[ "0.58574724", "0.5635498", "0.5502414", "0.5483021", "0.5478628", "0.5465954", "0.54279584", "0.54216594", "0.5375163", "0.53616804", "0.5300975", "0.52779305", "0.5274707", "0.52535486", "0.5250897", "0.5250331", "0.5226273", "0.52192646", "0.52173513", "0.51788574", "0.5177...
0.6176747
0
Calculate scores using edge embeddings and a binary classifier
def classify_embeddings(model, training_set, test_set, training_labels): print("Embedding...") # Using Hadamard product for the embedding vectors edge_embeddings = HadamardEmbedder(keyed_vectors=model.wv) x_train_embedded = [edge_embeddings[pair] for pair in training_set] x_test = [edge_embeddings[p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(self, data):\n\n score_mappings = {\n \"0\": np.log(self.class_zero_doc_count / self.total_docs),\n \"1\": np.log(self.class_one_doc_count / self.total_docs)\n }\n\n features = self.featurize(data)\n\n for f in features:\n\n if(f[0] in self.class_zero):\n cond_prob_zero ...
[ "0.64855", "0.6262732", "0.61371243", "0.60793024", "0.60294664", "0.6021378", "0.5970949", "0.5945262", "0.59293294", "0.585186", "0.58397514", "0.5837417", "0.58198524", "0.5786084", "0.57755744", "0.57628983", "0.5754918", "0.57514757", "0.57350516", "0.5733743", "0.572568...
0.69708925
0
Create input file for packing program.
def create_input(npart, domain=1.0): txt = """Particles count: {0} Packing size: {1} {1} {1} Generation start: 1 Seed: 341 Steps to write: 1000 Boundaries mode: 1 Contraction rate: 1.328910e-005 1. boundaries mode: 1 - bulk; 2 - ellipse (inscribed in XYZ box, Z is length of an ellipse); 3 - rectangle 2. ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_input_file(self, polymer_identifier, format, outpath):\n\n\t\tsmiles = self.get_smiles_from_identifier(polymer_identifier)\n\t\t\n\t\tresult = generate_input_files(smiles, format)\n\t\twith open(outpath, 'w+') as f:\n\t\t\tf.write(result)", "def create_file(self):\n dir = os.path.join(str(Path....
[ "0.72987163", "0.65525985", "0.6314318", "0.62746745", "0.6257096", "0.6254702", "0.6199341", "0.6181303", "0.6167097", "0.61346006", "0.60540515", "0.60384506", "0.60145307", "0.60098094", "0.5997665", "0.5941019", "0.5939934", "0.5934579", "0.59180665", "0.59180665", "0.590...
0.65539014
1
Reads results of packing algorithm.
def read_results(): with open("packing.nfo", "r") as fin: fin.readline() fin.readline() por_theory = float(fin.readline().split()[2]) por_final = float(fin.readline().split()[2]) print('Theoretical porosity:', por_theory) print('Final porosity:', por_final) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read():\n # TODO", "def read(self):", "def _read_data(self):", "def read_results(self):\n\n with open(os.path.join(self.directory, 'results.tag'), 'r') as fd:\n self.lines = fd.readlines()\n\n self.atoms = self.atoms_input\n self.results['energy'] = float(self.lines[1])...
[ "0.6056428", "0.59564507", "0.5905305", "0.5838729", "0.582247", "0.5730985", "0.5727358", "0.56592846", "0.5633495", "0.55378485", "0.5510857", "0.54855675", "0.54454136", "0.5429854", "0.54078674", "0.5403432", "0.5391799", "0.5376222", "0.5322002", "0.53192383", "0.5286341...
0.7058981
0
Save picture of packed domain. Uses spack.
def render_packing(data, domain=1.0, pixels=1000): pack = spack.Packing(data[:, 0:3], data[:, 3], L=domain) print(pack.contacts()) scene = pack.scene(rot=pi / 4, camera_height=0.5, camera_dist=2.5e1, angle=4, cmap='autumn', floater_color=None) scene.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n\n self.image.save(\"./output/\" + self.name + \" pg\" + str(self._page) + \".png\")", "def write(filename, data):\r\n with open(filename, \"wb\") as f:\r\n pic.dump(data, f)", "def saveLayer_PSD(fileName: str, layeredImage: LayeredImage) -> None:\n\tdel fileName, layeredImage...
[ "0.58413607", "0.5708073", "0.5684943", "0.56792814", "0.56339043", "0.5620855", "0.55608416", "0.55176175", "0.55153835", "0.5507326", "0.54989994", "0.5486356", "0.54806376", "0.5423584", "0.5423351", "0.5407861", "0.53953516", "0.5361725", "0.5358692", "0.5356535", "0.5353...
0.6335143
0
Packs spheres into a periodic domain. Creates Project01.rco with sphere centers and radii. Simple model is implemented directly, other algorithms
def pack_spheres(shape, scale, number_of_cells, algorithm): if algorithm == 'simple': data = simple_packing(shape, scale, number_of_cells) else: create_input(number_of_cells) make_csd(shape, scale, number_of_cells) generate_structure(algorithm) data = read_results(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_sphere_full():\n \n num_voxels = 31\n c = (15.0, 15.0, 15.0)\n\n data_x = []\n data_y = []\n data_z = []\n data_intensity = []\n\n volume = numpy.zeros((num_voxels, num_voxels, num_voxels))\n\n for x in range(num_voxels):\n for y in range(num_voxels):\n for...
[ "0.67585826", "0.654794", "0.65101486", "0.64354426", "0.63629514", "0.62890136", "0.61674905", "0.61503315", "0.6133473", "0.6102071", "0.6075259", "0.60584694", "0.6002006", "0.59651905", "0.59412783", "0.5936832", "0.58914405", "0.58838385", "0.588103", "0.58671576", "0.58...
0.66897166
1
Wheel velocity calculator. Needs integration with class.
def wheel_vel(vx, vy, omega): a = np.array([ np.pi/4, 3*np.pi/4, 5*np.pi/4, 7*np.pi/4 ]) # Alpha b = np.array([ np.pi/4, -np.pi/4, -3*np.pi/4, 3*np.pi/4 ]) # Beta g = np.array([ np.pi/4, -np.pi/4, -np.pi/4, np.pi/4 ]) # Gamma L = np.array([ np.sqrt(2), np.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def v(self):\n\n # TODO This translation formula works, but needs simplified.\n\n # PWM duration can go from 0 to 4095 with 4095 representing max rpm\n# print(\"MuleBot.v MuleBot.dcMotorPWMDurationLeft:\", MuleBot.dcMotorPWMDurationLeft)\n speed_percentage = float(MuleBot.dcMotorPWMDurationLef...
[ "0.7017174", "0.70161724", "0.7004644", "0.6822399", "0.68207264", "0.678367", "0.6760787", "0.6736116", "0.6645647", "0.66123945", "0.66056883", "0.6594274", "0.65749615", "0.6541094", "0.6541094", "0.65362215", "0.6517517", "0.65121585", "0.64959246", "0.64959246", "0.64914...
0.7609329
0
Kinematic controller deals only with kinematic constraints. This controller acts as if the system is immediately responsive. Arguments 'pose_gains' and 'velocity_gains' should be given in lengthofthree tuples.
def __init__(self, translation_gains, rotation_gains): # Get PID gains. self.translation_pid = PIDController(translation_gains[0], translation_gains[1], translation_gains[2]) self.rotation_pid = PIDController(rotation_gains[0], rotation_gains[1], rotation_gains[2]) # Kinematic state var...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, robot_pose, robot_info):\n K3Supervisor.__init__(self, robot_pose, robot_info)\n\n # The maximal distance to an obstacle (inexact)\n self.distmax = robot_info.ir_sensors.rmax + robot_info.wheels.base_length/2\n\n # Fill in some parameters\n self.parameters.sens...
[ "0.5511537", "0.5400939", "0.5266515", "0.52548367", "0.51760983", "0.51383466", "0.50951993", "0.50671774", "0.5030521", "0.50057197", "0.4995571", "0.49738228", "0.49461508", "0.49417272", "0.49197614", "0.49191895", "0.49022603", "0.48938218", "0.48909506", "0.48630753", "...
0.5520822
0
Visit code, folding literals.
def visit_code(self, code): def build_tuple(tup): out = [] for e in tup: if isinstance(e, tuple): out.append(build_tuple(e)) else: out.append(('prim', type(e))) return ('tuple', tuple(out)) folds = _FoldedOps() for block in code.order: stack = _S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize(code):\n return pyc.visit(code, _FoldConstants())", "def do_constant_folding(self, node):\r\n return True", "def visit_Python(self, node):\n py_code = compile(node.py_ast, self.filename, mode='exec')\n bp_code = Code.from_code(py_code)\n # Skip the SetLineo and ReturnV...
[ "0.67017627", "0.62566394", "0.61303914", "0.6115457", "0.6061162", "0.5942264", "0.5915838", "0.58561444", "0.58267295", "0.56959057", "0.55190307", "0.5485093", "0.5454639", "0.5381752", "0.5358291", "0.53499115", "0.5333128", "0.5332335", "0.5305881", "0.52987605", "0.5268...
0.6829853
0
Fold all constant literals in the bytecode into LOAD_FOLDED_CONST ops.
def optimize(code): return pyc.visit(code, _FoldConstants())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constant_folding(self, *args):\n return self._executor.constant_folding(*args)", "def fold(vyper_module: vy_ast.Module) -> None:\n replace_builtin_constants(vyper_module)\n\n changed_nodes = 1\n while changed_nodes:\n changed_nodes = 0\n changed_nodes += replace_user_defined_con...
[ "0.6311756", "0.5843455", "0.57574695", "0.5723965", "0.5499945", "0.54568785", "0.5377244", "0.5364817", "0.5204856", "0.5092156", "0.5044473", "0.5035001", "0.5025549", "0.49824658", "0.4873027", "0.48575228", "0.48556387", "0.48476923", "0.4845908", "0.4829034", "0.4822984...
0.6064229
1
erases line trace showing automated 'Pick 2' guess
def onPick2EraseTimer(self, evt=None): self.pick2erase_timer.Stop() panel = self.pick2erase_panel ntrace = panel.conf.ntrace - 1 trace = panel.conf.get_mpl_line(ntrace) panel.conf.get_mpl_line(ntrace).set_data(np.array([]), np.array([])) panel.conf.ntrace = ntrace ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onPick2Timer(self, evt=None):\n try:\n plotframe = self.controller.get_display()\n curhist = plotframe.cursor_hist[:]\n plotframe.Raise()\n except:\n return\n\n if (time.time() - self.pick2_t0) > self.pick2_timeout:\n msg = self.pick2_...
[ "0.55624956", "0.55532885", "0.53334457", "0.5188731", "0.5188101", "0.5169295", "0.51134807", "0.51050544", "0.50230116", "0.50179946", "0.49942794", "0.4991569", "0.49856073", "0.49511108", "0.49469474", "0.49450237", "0.4934089", "0.49022993", "0.48990464", "0.48828", "0.4...
0.5923422
0
checks for 'Pick 2' events, and initiates 'Pick 2' guess for a model from the selected data range
def onPick2Timer(self, evt=None): try: plotframe = self.controller.get_display() curhist = plotframe.cursor_hist[:] plotframe.Raise() except: return if (time.time() - self.pick2_t0) > self.pick2_timeout: msg = self.pick2_group.pick2_ms...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_change(self):\n self.meas_selected_number = self.__input_meas.value()\n self.meas_selected_series = self.__input_series.value()\n self.selected_data = self.__input_select.value()\n self.noice_reduction_number = self.__input_noice.value()\n self.particle_size_number = s...
[ "0.54518455", "0.54151595", "0.5301533", "0.52407205", "0.52284944", "0.51838154", "0.51771367", "0.5135327", "0.51244766", "0.51102304", "0.50139976", "0.50093406", "0.4995558", "0.4994895", "0.49687958", "0.49362049", "0.48861358", "0.48818293", "0.48774004", "0.48728997", ...
0.63196856
0
get last selected point from a specified plot window and fill in the value for the widget defined by `opt`. by default it finds the latest cursor position from the cursor history of the first 20 plot windows.
def onSelPoint(self, evt=None, opt='__', relative_e0=False, win=None): if opt not in self.wids: return None _x, _y = last_cursor_pos(win=win, _larch=self.larch) if _x is not None: if relative_e0 and 'e0' in self.wids: _x -= self.wids['e0'].GetValue() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPlotFocus(pt): \n if pt not in [None]+plotFocusList:\n return None\n simuConfig[\"PLOT.FOCUS\"] = pt", "def select_points(fname,n=-1,prompt=\"\"):\n\t#def onclose(event):\n\t#\traise ValueError(\"Figure Closed by user. No input. Exiting.\")\n\tif type(fname) is type(plt.figure()):\n\t\tfig...
[ "0.55055445", "0.53653204", "0.5295553", "0.52767485", "0.50982815", "0.50829136", "0.5006429", "0.49662733", "0.49653208", "0.49432343", "0.49301663", "0.48866478", "0.48860523", "0.4880242", "0.48595127", "0.48503155", "0.48402044", "0.48282155", "0.48228115", "0.48039544", ...
0.630015
0
use fit components to build model
def build_fitmodel(self): dgroup = self.controller.get_group() fullmodel = None params = Parameters() self.summary = {'components': [], 'options': {}} peaks = [] for comp in self.fit_components.values(): _cen, _amp = None, None if comp.usebox is no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_model():", "def build_model_fn(self):", "def fit():\n pass", "def buildModel( self, transformer, classifier ):\n summitAIModel = make_pipeline ( transformer , classifier )\n summitAIModel.fit ( self.X , self.y )\n joblib.dump ( summitAIModel , self.modeldump )", "def d...
[ "0.7234737", "0.6934758", "0.6798958", "0.66368324", "0.655844", "0.65224653", "0.64669365", "0.6452456", "0.6452456", "0.6439187", "0.64385676", "0.6436807", "0.6426389", "0.64217436", "0.6416121", "0.64001125", "0.6399104", "0.6396366", "0.6384198", "0.6384198", "0.6378818"...
0.7303963
0
autosave model result to user larch folder
def autosave_modelresult(self, result, fname=None): xasguidir = os.path.join(site_config.usr_larchdir, 'xasgui') if not os.path.exists(xasguidir): try: os.makedirs(xasguidir) except OSError: print("Warning: cannot create XAS GUI user folder") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model(self, filename):\r\n pass", "def save(path_to_model):\n pass", "def save_model(self, path):\n pass", "def save_model(self, model_path: str):", "def save_model(model, model_filepath):", "def save():", "def save_model(model):\n model.to_disk(\"../model/custom_ner_model\...
[ "0.695464", "0.69506097", "0.6928393", "0.692527", "0.69136316", "0.6886709", "0.6573806", "0.65269095", "0.6515488", "0.6477844", "0.6467705", "0.6462864", "0.6457185", "0.6457185", "0.6440487", "0.64241046", "0.6388483", "0.63865566", "0.63725024", "0.63312775", "0.62909377...
0.7121868
0
Function to return a new type that is based on decimal.Decimal with an arbitrary restricted precision.
def RestrictedPrecisionDecimalType(*args, **kwargs): precision = kwargs.pop("precision", False) class RestrictedPrecisionDecimal(Decimal): """ Class extending decimal.Decimal to restrict the precision that is stored, supporting the fraction-digits argument of the YANG decimal64 type. """ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __new__(self, *args, **kwargs):\n if not self._precision is None:\n if len(args):\n value = Decimal(args[0]).quantize(Decimal(str(self._precision)))\n else:\n value = Decimal(0)\n elif len(args):\n value = Decimal(args[0])\n else:\n value = Decimal(0...
[ "0.69604206", "0.6876858", "0.66650754", "0.63468236", "0.6215096", "0.61870146", "0.60527605", "0.6020311", "0.60070854", "0.59531707", "0.5940841", "0.5829864", "0.5787228", "0.5775169", "0.5708055", "0.5703491", "0.56722915", "0.5657426", "0.5632463", "0.55985934", "0.5548...
0.7465871
0
Overloads the decimal __new__ function in order to round the input value to the new value.
def __new__(self, *args, **kwargs): if not self._precision is None: if len(args): value = Decimal(args[0]).quantize(Decimal(str(self._precision))) else: value = Decimal(0) elif len(args): value = Decimal(args[0]) else: value = Decimal(0) obj = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __round__(self, ???):", "def newRound():\r\n pass", "def __round__(self, *args, **kwargs): # real signature unknown\n pass", "def __round__(self, *args, **kwargs): # real signature unknown\n pass", "def __round__(self, *args, **kwargs): # real signature unknown\n pass", "def _...
[ "0.69277656", "0.6428298", "0.6306247", "0.6306247", "0.6306247", "0.6306247", "0.6306247", "0.6306247", "0.6306247", "0.6306247", "0.6306247", "0.6306247", "0.6306247", "0.6306247", "0.6306247", "0.6306247", "0.6306247", "0.6306247", "0.6193024", "0.60015714", "0.59260154", ...
0.69391257
0