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
Maps a L{CODE} constant to a HTTP code.
def _mapErrorCodeToStatus(code): if code == 103: return http.NOT_FOUND return http.INTERNAL_SERVER_ERROR
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_code():\n return jsonify({\"status\": \"0\", \"code\": code_status})", "def setResponseCode(code, message=None):", "def send_code(self, code: str) -> Dict:\n raise NotImplementedError", "async def with_code_header():\n return jsonify(language=request.headers.get(\"Lang\")), 203, {\"X\": ...
[ "0.6723069", "0.6591856", "0.65714204", "0.6495424", "0.6402399", "0.63924485", "0.6334081", "0.6325058", "0.6201443", "0.6191107", "0.616254", "0.616247", "0.6142737", "0.61202556", "0.6110832", "0.6099238", "0.6080944", "0.6080944", "0.6080944", "0.6080944", "0.60740554", ...
0.77379066
0
Verify PayPal IPN data.
def verify(self, request): paypalURL = 'https://www.sandbox.paypal.com/cgi-bin/webscr' if not self.SANDBOX: paypalURL = 'https://www.paypal.com/cgi-bin/webscr' def _cb(response): if response == 'INVALID': raise PaypalError( 'IPN data i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_ipn(data):\n data = dict(data)\n data['cmd'] = '_notify-validate'\n resp = requests.post(app.config['PAYPAL']['endpoint'], data=data)\n if resp.text == 'VERIFIED':\n return True\n return False", "def validate_with_paypal(request, validate_type):\n if validate_type == 'PDT':\n ...
[ "0.8481473", "0.6472825", "0.5787242", "0.5769118", "0.5757081", "0.5683456", "0.5683456", "0.5624004", "0.5467733", "0.54500043", "0.544273", "0.5417485", "0.54154587", "0.5396169", "0.5375768", "0.53615075", "0.5322293", "0.53124595", "0.52979654", "0.5271814", "0.5205165",...
0.75808173
1
Retrieve a list of recent donations.
def recent(self, limit): def _cb(players, donations): donators = [] for donation in donations: player = players[donation.donator.steamID].copy() player['date'] = donation.date.asPOSIXTimestamp() player['amount'] = str(donation.amount) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_of_donations():\n try:\n logger.info('opening get_list_of_donations database call')\n database.connect()\n database.execute_sql('PRAGMA foreign_keys = ON;')\n query_results = (Donations.select(Donations.id, Donations.donation_date,\n ...
[ "0.65837014", "0.65390664", "0.64193267", "0.5857776", "0.5843226", "0.56542754", "0.565169", "0.56222814", "0.56117177", "0.55442196", "0.55310655", "0.5512683", "0.5447088", "0.54198706", "0.53970146", "0.5342934", "0.5318437", "0.5283673", "0.52812785", "0.52525187", "0.52...
0.668418
0
Checks that certain pipeline files are not modified from template output. Iterates through the pipeline's directory content and compares specified files against output from the template using the pipeline's metadata. File content should not be modified / missing.
def files_unchanged(self): passed = [] failed = [] ignored = [] fixed = [] could_fix = False # Check that we have the minimum required config required_pipeline_config = {"manifest.name", "manifest.description", "manifest.author"} missing_pipeline_config = required_pipeline_config.diffe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def files_exist(self):\n\n passed = []\n warned = []\n failed = []\n ignored = []\n\n # NB: Should all be files, not directories\n # List of lists. Passes if any of the files in the sublist are found.\n #: test autodoc\n try:\n _, short_name = self.nf_config[\"manifest.name\"].strip(...
[ "0.6298096", "0.5958212", "0.5917722", "0.5899919", "0.5821627", "0.58071446", "0.57569844", "0.5753009", "0.5753009", "0.5753009", "0.57331693", "0.5726181", "0.56889504", "0.5665329", "0.5652075", "0.56505686", "0.5650157", "0.561327", "0.56093055", "0.5601862", "0.5555765"...
0.68884873
0
generates initial hidden states for each agent
def generate_initial_hidden_states(self, batch_size, test_mode=False, caller=None): # Set up hidden states for all levels - and propagate through the runner! hidden_dict = {} hidden_dict["level1"] = th.stack([Variable(th.zeros(batch_size, 1, self.args.agents_hidden_state_size)) for _ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_state(self):\n # Network details elided.\n return self.agent.initial_state()", "def initial_state(self):\n # Network details elided.\n return self.agent.initial_state()", "def initial_state(self):\n # Network details elided.\n return self.agent.initial_state()", "def registerIni...
[ "0.6404829", "0.6404829", "0.6404829", "0.6275053", "0.62659883", "0.62305397", "0.6203651", "0.6194984", "0.61897767", "0.6183285", "0.60839427", "0.6075158", "0.6037105", "0.6035622", "0.60091317", "0.59804654", "0.59778255", "0.59626013", "0.5937987", "0.5926602", "0.59236...
0.73379165
0
Initializes and returns an LSL outlet
def initializeOutlet(interface): info = StreamInfo('OpenBCI_EEG', 'EEG', 4, 256, 'float32', 'openbci12345') outlet = StreamOutlet(info) return outlet
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_lamp_outlet(self, model):\r\n\r\n # Create a new CameraItem and set the model\r\n item = LampOutletItem()\r\n item.setModel(model)\r\n\r\n # Create a new CameraInfoWidget and set the model\r\n widget = LampOutletInfoWidget()\r\n widget.setModel(model)\r\n\r\n ...
[ "0.5946556", "0.5688111", "0.55620337", "0.55175424", "0.53838944", "0.5277127", "0.52567214", "0.52559364", "0.5208461", "0.5208461", "0.51927763", "0.51246226", "0.50718874", "0.5064975", "0.5049424", "0.5043597", "0.50424546", "0.50129515", "0.5001687", "0.49760997", "0.49...
0.58739966
1
This function recursively builds a string of manager to employee relationships starting from the managers that do not have managers.
def findHierarchy(self): def __recursiveHelper(key_name, output, indent): if key_name in self.relations: for employee in self.relations[key_name].employees: output += " " * indent + str(employee) +"\n" # return __recursiveHelper(employee, out...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildHierarchy(self, test_input):\n for entry in test_input:\n if entry['manager']not in self.relations:\n self.relations[entry['manager']] = Node(entry['manager'], entry['name'])\n else:\n self.relations[entry['manager']].employees.append(entry['name'...
[ "0.5634923", "0.53542036", "0.5284192", "0.5087596", "0.49705473", "0.4939793", "0.49350137", "0.48989594", "0.48973182", "0.48740613", "0.485191", "0.48157832", "0.47859207", "0.47704506", "0.47661456", "0.4745172", "0.47298232", "0.47289705", "0.4718572", "0.46928048", "0.4...
0.6343025
0
Extract zipfile to a directory if password is correct.
def extractfile(file, passwd): try: zipf = zipfile.ZipFile(file) zipf.extractall(path=os.path.join(file[:-4]), pwd=str.encode(passwd)) print('Password: {}'.format(passwd)) except: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unzipArchives(zip_file, password):\n with ZipFile(zip_file) as archive:\n archive.extractall(pwd=bytes(password, \"utf8\"))", "def unzip_item(source_path, destination_path, password):\n\n if not destination_path:\n destination_path = source_path.replace(\".zip\", \"\")\n if not os.path...
[ "0.73367697", "0.68281114", "0.6682046", "0.66589713", "0.6608535", "0.65792376", "0.65135366", "0.65102696", "0.6478845", "0.64773226", "0.64197737", "0.6360199", "0.6358647", "0.6311184", "0.62914145", "0.6283126", "0.6278718", "0.62752926", "0.62581104", "0.62555015", "0.6...
0.7807078
0
Calculate Profit of Order
def calculate_profit(self):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profit(self):\n retail_value = 0\n wholesale_value = 0\n for bike in self.sold:\n retail_value += bike.total_cost() + (\n self.retail_margin * bike.total_cost())\n wholesale_value += bike.total_cost()\n return retail_value - wholesale_value", "...
[ "0.73407346", "0.70521134", "0.69925046", "0.66937786", "0.664156", "0.6609153", "0.660143", "0.64814395", "0.63270825", "0.62858367", "0.62036735", "0.6141628", "0.6069652", "0.6067097", "0.6044266", "0.60409504", "0.602659", "0.6025829", "0.6020886", "0.6019667", "0.6008011...
0.79486245
0
Removes a service from a list of existing services.
def RemoveServiceFromEndpoints(service_name, services): new_services = [] if not isinstance(services, list): return new_services # TODO(user): Consider throwing an exception if the service is not # already configured in the list of endpoints. for service in services: if not isinstance(service, dict) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteServices(self):\n for service in self.services.values():\n service.Delete()", "def delete_service(self, service):\n # type: (LoadBalancerService) -> List[BoundAction]\n return self._client.delete_service(self, service)", "def remove(self, service):\n os.remove(os.path.joi...
[ "0.7037286", "0.675924", "0.6610748", "0.6590831", "0.62848717", "0.6255595", "0.61463314", "0.6130574", "0.611379", "0.6080032", "0.6072836", "0.6069888", "0.60036", "0.5951796", "0.5946897", "0.59276074", "0.59024787", "0.58957607", "0.58896816", "0.5826269", "0.57981753", ...
0.7142464
0
Return distance of two keys in qwerty keyboard based on manhattan or euclidean distance.
def key_distance(self, x, y, type="manhattan"): if type == "manhattan": return self.manhattan_dist_matrix[self.keys.index(x), self.keys.index(y)] elif type == "euclidean": return self.euclidean_dist_matrix[self.keys.index(x), self.keys.index(y)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(self, keyOne, keyTwo):", "def qwerty_distance():\n from collections import defaultdict\n import math\n R = defaultdict(dict)\n R['-']['-'] = 0\n zones = [\"dfghjk\", \"ertyuislcvbnm\", \"qwazxpo\"]\n keyboard = [\"qwertyuiop\", \"asdfghjkl\", \"zxcvbnm\"]\n for num, content in e...
[ "0.75387555", "0.69056517", "0.6859236", "0.67510206", "0.6659005", "0.66116893", "0.6603836", "0.65740633", "0.6566495", "0.65459806", "0.6529574", "0.6490348", "0.6489842", "0.64859676", "0.6471863", "0.6434619", "0.6432744", "0.6414012", "0.6411454", "0.63999486", "0.63896...
0.71139956
1
Return a dataframe of distance matrix of x and y. Indexes are letters of x and columns are letters of y.
def distance_dataframe(self, x, y, keyboard_weight=None): dist_matrix = self.distance_matrix(x, y, keyboard_weight) dist_df = pd.DataFrame(dist_matrix, index=["", *list(x)], columns=["", *list(y)]) return dist_df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_dist_matrix(self):\n\n self.dist_matrix = spatial.distance.squareform(spatial.distance.pdist(self.data_vector,metric=\"hamming\"))\n\n self.dist_frame = pd.DataFrame(self.dist_matrix,\n index = self.seq_strings,\n co...
[ "0.69271284", "0.67564255", "0.6533258", "0.6516786", "0.6428106", "0.63869244", "0.6351963", "0.6319464", "0.63100487", "0.62420344", "0.62378067", "0.62373847", "0.62171084", "0.62104243", "0.62080455", "0.6201593", "0.61032706", "0.6101561", "0.60353494", "0.6023481", "0.5...
0.8356927
0
Returns the token and dsn from a key Generate a simple SHA1 hash of the key key is a 64bits integer Token is a 32bits integer, dsn is a 64bits integer
def key2tokenAndDSN(self, key): import binascii import struct import hashlib self.keystr = struct.pack("!Q", key) self.h = hashlib.sha1(self.keystr.rjust(8,'\00')) self.shastr=self.h.digest() # binary #shastr = struct.pack("!IIIII", *struct.unpack("@IIIII",shastr)) #to net self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fnv1(self, key):\n # hash = 0xff\n hash = 0xcbf29ce484222325\n for n in key.encode():\n # print(n)\n hash = hash ^ n\n hash = hash * 0x100000001b3\n\n # print(hash)\n return hash", "def _hash(self, key):\n\n return long(hashlib.md5(ke...
[ "0.59551054", "0.59115833", "0.59115833", "0.58881515", "0.5808499", "0.5731819", "0.5719893", "0.57018846", "0.569349", "0.5679318", "0.5663129", "0.5659303", "0.561188", "0.5586423", "0.5538995", "0.55299336", "0.54740316", "0.5471576", "0.5457066", "0.5430525", "0.54092103...
0.8006403
0
Identify distinct MPTCP Connections that reached Successful handshake Look for Ack packets with MPTCP option Header For each MPTCP connection report Receiver's token value which acts as the connectionID
def mptcp_connections(self, pkts): count = 0 #MPTCP_Capable = 0x0 #MPTCP_CapableACK ---> successful handshake print "======================================================================" print "Successful Handshake --- Look for Ack packets with MPTCP option Header" print """Token = connectionID = SHA1(key...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_mptcp_pkt_from_client(ts_delta, acks, conn_acks, mptcp_connections, tcp, ip, saddr, daddr, sport, dport):\n dss, dack, dss_is_8_bytes = get_dss_and_data_ack(tcp)\n conn_id = acks[saddr, sport, daddr, dport][co.CONN_ID]\n flow_id = acks[saddr, sport, daddr, dport][co.FLOW_ID]\n if conn_acks[...
[ "0.5511609", "0.5456236", "0.5397558", "0.53674424", "0.5341668", "0.5300616", "0.52610534", "0.5249031", "0.5168756", "0.5108904", "0.5044106", "0.5025528", "0.50196034", "0.49723715", "0.4895106", "0.48823294", "0.4870531", "0.48611027", "0.4818591", "0.4818538", "0.4802288...
0.7726427
0
return the current schema_org schema version
def get_schema_org_version(): return _get_schemaorg_version()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_schemaorg_version():\n try:\n version = get_latest_schemaorg_version()\n except ValueError:\n version = SCHEMAORG_DEFAULT_VERSION\n return version", "def schema_version(self):\n # return self._parsed[\"schemaVersion\"]\n # does not exist in manifest reference\n ...
[ "0.84921485", "0.82677555", "0.8089187", "0.7736187", "0.74551374", "0.7435045", "0.73047084", "0.6960835", "0.68983686", "0.68766624", "0.68467546", "0.68244046", "0.6751349", "0.67256296", "0.6715355", "0.6658414", "0.6645252", "0.6636151", "0.6614081", "0.66119516", "0.658...
0.89709204
0
get all classes and label them if they are referenced if include_ref is False, only "defined" classes are included.
def get_classes(self, include_ref=True): defs = self._get_class_defs() ans = {} ans.update(defs) if include_ref: refs = self._get_class_refs() ans.update(refs) return list(ans.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_class_refs(self):\n return list(self._get_class_refs().values())", "def process_class_list(self, module, classes):", "def _load_classes(self):\n classdocs = self._docset.get_classes()\n for classdoc in classdocs:\n files = [self._docmap[filedoc] for filedoc in classdoc.g...
[ "0.6035254", "0.58814853", "0.5880051", "0.5856091", "0.57512456", "0.5681698", "0.5672593", "0.5591788", "0.5589396", "0.55738693", "0.55246097", "0.55189526", "0.5512281", "0.5482113", "0.54583037", "0.5448857", "0.54194885", "0.5409159", "0.53911316", "0.5388025", "0.53866...
0.7381208
0
return validation errors as a list of dictionaries
def get_validation_errors(self): return [err.to_dict() for err in self._schema.validator.validation_errors]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_wrapper(x):\n errors = list()\n for error_key, error_list in list(x.items()):\n for error in error_list:\n if error_key == 'non_field_errors':\n errors.append(error)\n else:\n errors.append(\"%s: %s\" % (error_key, error))\n return error...
[ "0.7443273", "0.7419965", "0.7331665", "0.7269884", "0.7269884", "0.7269884", "0.7269884", "0.7269884", "0.72689366", "0.72655326", "0.7202294", "0.7177334", "0.7172576", "0.7163961", "0.7127716", "0.6941691", "0.6911603", "0.6893204", "0.6834352", "0.6751597", "0.6711623", ...
0.84701467
0
Faster Wavelenght selector If passed lists it will return lists. If passed np arrays it will return arrays Fastest is using np.ndarrays fast_wav_selector ~10002000 quicker than wav_selector
def fast_wav_selector(wav, flux, wav_min, wav_max): if isinstance(wav, list): # if passed lists wav_sel = [value for value in wav if(wav_min < value < wav_max)] flux_sel = [value[1] for value in zip(wav,flux) if(wav_min < value[0] < wav_max)] elif isinstance(wav, np.ndarray): # Super...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wav_selector(wav, flux, wav_min, wav_max, verbose=False):\n if isinstance(wav, list): # if passed lists\n wav_sel = [wav_val for wav_val in wav if (wav_min < wav_val < wav_max)]\n flux_sel = [flux_val for wav_val, flux_val in zip(wav,flux) if (wav_min < wav_val < wav_max)]\n elif isinst...
[ "0.7074208", "0.54926926", "0.543694", "0.5338126", "0.5282017", "0.5270855", "0.51453614", "0.5138771", "0.5112849", "0.5108346", "0.5105792", "0.5059946", "0.5033493", "0.5002626", "0.49823514", "0.49728918", "0.4955809", "0.4946704", "0.49403378", "0.49394882", "0.48933354...
0.70528
1
Downloads a FASTA file for the proteome by organism ID
def get_fasta_by_id(proteome_id, output_file): taxid_pattern = re.compile('^\d{1,7}$') # if not taxid_pattern.match(proteome_id): # fetch file from Uniprot # raise ValueError(str(proteome_id) + ' is not a valid proteome identifier') url = UNIPROT_BASE_URL + proteome_id attempts = 0 while at...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seq_download(name, organism=\"Homo sapiens\", gaba=False):\n\n subunits = {\n \"Alpha-1\": \"Gabra1\",\n \"Alpha-2\": \"Gabra2\",\n \"Alpha-3\": \"Gabra3\",\n \"Alpha-4\": \"Gabra4\",\n \"Alpha-5\": \"Gabra5\",\n \"Alpha-6\": \"Gabra6\",\n \"Beta-1\": \"Gabrb...
[ "0.72803736", "0.64713925", "0.622999", "0.6218201", "0.6060453", "0.59448034", "0.57914644", "0.5711981", "0.5588932", "0.5571663", "0.556189", "0.5560884", "0.55341786", "0.553164", "0.55225044", "0.5511088", "0.5500932", "0.54671043", "0.54671043", "0.54506993", "0.5367374...
0.71304876
1
Gapfill a model using probabilistic weights
def probabilistic_gapfill(model, universal_model, reaction_probabilities, clean_exchange_rxns=True, default_penalties=None, dm_rxns=False, ex_rxns=False, **solver_parameters): universal_model = universal_model.copy() model = clean_exchange_reactions(model) if clean_exchange_rxns else model.copy() if default...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(model):\n ...", "def gap2d(_w_in):\n return nn.AdaptiveAvgPool2d((1, 1))", "def weightGenerate(self):\n\t\tfor i in range(0, self.numberOfInput):\n\t\t\tself.weight.append(random.random()-0.5)", "def update_weights(self):\n\n self.weights -= self.loss_grads\n self.los...
[ "0.59936357", "0.5899231", "0.5710139", "0.5680814", "0.5665641", "0.565304", "0.56094337", "0.56018", "0.55877113", "0.55586326", "0.5552374", "0.5551015", "0.5542684", "0.5506722", "0.5504694", "0.5479312", "0.54784465", "0.5458892", "0.54003364", "0.5388704", "0.5387438", ...
0.5979327
1
Exports the given reaction probabilities into a JSON formatted file, saved at filename
def export_json(rxn_probs, filename): with open(filename, 'w') as f: f.write(json.dumps(rxn_probs)) return filename
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_json(self, filename):\n with open(filename, 'a+') as f:\n f.write(json.dumps(self.weights))\n f.write(\"\\n\")", "def save(statistic_entries):\n with open('learn.json', 'w') as file:\n json.dump(statistic_entries, file, indent=2)", "def dump(pred_out_path, xyz_p...
[ "0.6705845", "0.641551", "0.6144338", "0.6136017", "0.6124605", "0.612017", "0.61101353", "0.60968125", "0.60849845", "0.5977744", "0.59029186", "0.587066", "0.5857155", "0.5841988", "0.5835876", "0.5835178", "0.5819759", "0.5813063", "0.5810192", "0.57985073", "0.5744357", ...
0.8034322
0
return the probability of a given reaction
def get_probability(self, reaction): return self.__getitem__(reaction)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probability(self, item):\n count = self.counter.get(item, 0)\n if self.smoothing_dict:\n smooth_count = self.smoothing_dict.get(count, count)\n assert smooth_count > 0\n return smooth_count / self.smooth_total\n else:\n return count / self.total"...
[ "0.6590192", "0.6571907", "0.647744", "0.64491594", "0.6418756", "0.63888365", "0.63714635", "0.6371433", "0.6367964", "0.63313365", "0.6296423", "0.62912256", "0.62699294", "0.62629133", "0.62573755", "0.6252374", "0.62146765", "0.6207749", "0.62025577", "0.6187049", "0.6182...
0.8662731
0
Deserialize a ReactionProbabilities from a JSON file
def from_json_file(path): with open(path, 'r') as f: return ReactionProbabilities.from_json(f.read())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_priors(file_name):\n with open(file_name, \"r\") as fp:\n priors = json.load(fp)\n return priors", "def read_classification_json(fn):\n with open(fn) as f:\n classification_data = json.load(f)\n f.close()\n \n return classification_data", "def load_priors(self, ...
[ "0.6095132", "0.60795057", "0.5984798", "0.59495234", "0.57160014", "0.56639713", "0.5619954", "0.5497838", "0.5492578", "0.53609985", "0.5356933", "0.53483236", "0.5318638", "0.53132015", "0.52867985", "0.52783847", "0.5249616", "0.52431166", "0.5227828", "0.5201468", "0.519...
0.85232556
0
Takes a big limit as an integer and get all the prime numbers in that range, including the limit itself. Returns a numpy array of the primes. Fragmentation is an int that multiplies the sqrt of the limit to increase the fragment size. Bigger fragmentation consumes more memory and less time. Fragmentation limit = sqrt o...
def get_primes_in_big_limit(limit, fragmentation=1): print("Getting primes...") print("Fragmentation set to", fragmentation) fragment_limit = int(np.sqrt(limit)) fragment_lowest = 0 fragment_highest = fragment_lowest + fragment_limit primes_in_limit = np.array([], dtype=int) while fragment_h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_primes_in(limit):\n range_limit = np.arange(limit)\n prime_mask = np.ones(limit, dtype=bool)\n prime_mask[0:2] = False\n for i in range_limit[:int(np.sqrt(limit))+1]:\n if prime_mask[i]:\n prime_mask[2*i::i] = False\n return range_limit[prime_mask]", "def eratosthenes(lim...
[ "0.7772032", "0.75551635", "0.754886", "0.71958756", "0.7041358", "0.6890954", "0.6870041", "0.67170656", "0.66442776", "0.6626837", "0.65599114", "0.63915014", "0.6374505", "0.63370544", "0.6328696", "0.6316949", "0.6307289", "0.62010443", "0.6167947", "0.61109275", "0.61072...
0.8527422
0
Takes a limit as an integer and get all the prime numbers in that range, NOT including the limit itself. Returns a numpy array of the primes.
def get_primes_in(limit): range_limit = np.arange(limit) prime_mask = np.ones(limit, dtype=bool) prime_mask[0:2] = False for i in range_limit[:int(np.sqrt(limit))+1]: if prime_mask[i]: prime_mask[2*i::i] = False return range_limit[prime_mask]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eratosthenes(limit):\n if isinstance(limit, (int, float)) and limit == int(limit):\n limit = int(limit)\n else:\n raise ValueError\n primes = []\n mask = [1]*(limit+1)\n for i in range(2, limit+1):\n if mask[i]:\n primes.append(i)\n for j in range(i*i, ...
[ "0.80535877", "0.7970838", "0.7566367", "0.75646406", "0.74854904", "0.7452761", "0.73869497", "0.7217808", "0.72028553", "0.7137117", "0.69901395", "0.69098914", "0.6839922", "0.66989404", "0.6691934", "0.6605368", "0.65635985", "0.64167565", "0.6413339", "0.6396981", "0.637...
0.846045
0
Takes fragment lowest and highest limits as an integers and get all the prime numbers in that range, NOT including the limit itself. Returns a numpy array of the primes. Needs the primes from the first fragment of the program as input.
def get_primes_in_fragment(fragment_lowest, fragment_highest, primes_in_first_fragment): fragment_range = np.arange(fragment_lowest, fragment_highest) prime_mask = np.ones(len(fragment_range), dtype=bool) for p in primes_in_first_fragment: if fragment_lowest % p == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_primes_in_big_limit(limit, fragmentation=1):\n print(\"Getting primes...\")\n print(\"Fragmentation set to\", fragmentation)\n fragment_limit = int(np.sqrt(limit))\n fragment_lowest = 0\n fragment_highest = fragment_lowest + fragment_limit\n primes_in_limit = np.array([], dtype=int)\n ...
[ "0.7555909", "0.745268", "0.72320384", "0.6928359", "0.6911003", "0.6905713", "0.67729235", "0.6719026", "0.6628001", "0.66014606", "0.65840936", "0.6533467", "0.6412444", "0.64070624", "0.64064884", "0.63762397", "0.63470197", "0.6316131", "0.6301665", "0.6293129", "0.629164...
0.80316025
0
Takes a tuple where the first element is the dividend and the second element is the divisor. Both element sould be int. Performs a long division
def long_division(dividend_divisor_tuple, decimal_limit=5): natural, decimal = [], [] dividend, divisor = dividend_divisor_tuple[0], dividend_divisor_tuple[1] assert isinstance(dividend, int), "Dividend not int" assert isinstance(divisor, int), "Divisor not int" floor_div = dividend // divisor ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def div_numbers(a: int, b: int) -> int:\n return a / b", "def test_div():\n l = [1, 2, 3, 4]\n assert s7.div(*l) == 1 / 2 / 3 / 4\n assert s7.div(100, 20) == 5\n assert s7.div(100.0, 20) == 5.0\n assert s7.div(100, 20.0) == 5.0", "def div(seq):\n for (i, n) in enumerate(seq):\n # tr...
[ "0.65800995", "0.6371114", "0.63462335", "0.6256875", "0.6244074", "0.62214583", "0.6192333", "0.61851525", "0.6185146", "0.61841047", "0.6174636", "0.6085751", "0.6082528", "0.603412", "0.6029013", "0.6028425", "0.6017244", "0.6011632", "0.60035694", "0.59994143", "0.5984466...
0.6508378
1
Get length of number in digits.
def get_number_length(number): return len(str(number))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ndigits(n):\n return len(str(abs(n)))", "def count_digits(n):\n return len(str(n))", "def _number_of_digits(number: int) -> int:\n return int(log10(number)) + 1", "def get_int_width(integer):\n return len(str(integer))", "def get_length(x):\n\n try:\n return int(x)\n ex...
[ "0.7974036", "0.78436166", "0.75876623", "0.72771937", "0.68577904", "0.68538064", "0.677399", "0.6735333", "0.6720063", "0.6719415", "0.6715743", "0.6707653", "0.6707653", "0.6627682", "0.6612727", "0.65931964", "0.6514543", "0.64946806", "0.6464933", "0.6453461", "0.6445275...
0.8823181
0
opens the chosen exceldocument and returns it as sheet
def get_excel(exceldocument): sheet = xlrd.open_workbook(exceldocument).sheet_by_index(0) return sheet
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def openExcelSheet(outputFileName):\n workbook = Workbook()\n worksheet = workbook.add_sheet(\"Sheet 1\")\n return workbook, worksheet", "def _get_spreadsheet(i):\n path = io_mgr.get_parties_spreadsheet(i)\n if not os.path.exists(path):\n raise IOError()\n\n return openpyxl.load_workbook(path,...
[ "0.69280106", "0.6738904", "0.6419168", "0.6310797", "0.605773", "0.6051629", "0.6044591", "0.6008777", "0.5982114", "0.5974647", "0.59715974", "0.5966216", "0.59524924", "0.59430736", "0.5873261", "0.5856575", "0.57233405", "0.5704794", "0.569487", "0.5689535", "0.5683357", ...
0.77836186
0
creates an xml structure with root and motherelements
def createxmlmall(): root = ET.Element("state") model = ET.SubElement(root, "model") model.text = r"" dataid = ET.SubElement(root, "dataids") application = ET.SubElement(root, "application") application.text = "SIBS Configurator" safecookie = ET.SubElement(root, "safecookie") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_xml(self, root_name):\n\n self.tree = ET.ElementTree(ET.fromstring('<?xml version=\"1.0\" encoding=\"UTF-8\"?><%s></%s>'%(\n root_name, root_name)))\n return self.tree.getroot()", "def create_roots(self):\n self.root ...
[ "0.6970181", "0.63764966", "0.6287799", "0.6225016", "0.6220165", "0.6217637", "0.6206258", "0.619495", "0.6160407", "0.6134908", "0.61195517", "0.6091069", "0.6088098", "0.60488194", "0.59819216", "0.59459764", "0.59355354", "0.5920509", "0.5884173", "0.5878814", "0.5870564"...
0.75603426
0
Creates a folder and saves xml tree in a specific path
def save_xml(tree, file_name, folder_name): import os # ändrar plats för filer os.chdir(folder_name) tree.write(file_name) # Namnet på ny fil
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mkdir(path):", "def create_folder(path):\n command = ['mkdir', TEST_DIR]\n file_operation(path, command)", "def create_folder(path):\n if not os.path.exists(path):\n os.makedirs(path)", "def create_folder(self):\n Path(self.root_name).mkdir(parents=True, exist_ok=True)\n Pat...
[ "0.7024828", "0.700881", "0.6860256", "0.68011755", "0.6756072", "0.6738238", "0.66949385", "0.66890776", "0.6670779", "0.6649409", "0.6647468", "0.66387165", "0.66373086", "0.66274315", "0.66152924", "0.66047573", "0.6588086", "0.6582058", "0.656134", "0.65589786", "0.651623...
0.7450946
0
Calculate the approximation of a contour shape to another shape with less number of vertices depending upon the precision we specify.
def __CalculateApproximation(self, contour): epsilon = 0.1 * cv2.arcLength(contour, True) return cv2.approxPolyDP(contour, epsilon, True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contourApprox(cnt, epsilon = 0.005):\n\tepsilon = epsilon*cv2.arcLength(cnt, True)\n\tapprox = cv2.approxPolyDP(cnt, epsilon, True)\n\treturn approx", "def approx_poly(self, mask):\n\n mask_expand = mask.copy()\n contours, _ = cv2.findContours(mask_expand, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NO...
[ "0.6073888", "0.5673097", "0.5591408", "0.5486369", "0.5361581", "0.53499943", "0.5272163", "0.52631676", "0.5168495", "0.51550204", "0.5142952", "0.51347584", "0.51139116", "0.5096012", "0.5069017", "0.50188994", "0.5007644", "0.5004071", "0.50028485", "0.49921945", "0.49831...
0.6092272
0
Calculate the contour area by the function cv2.contourArea() or from moments, M["m00"].
def __CalculateArea(self, contour): return cv2.contourArea(contour)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(cnt):\n\treturn cv2.contourArea(cnt)", "def get_contour_area(contour):\n assert isinstance(contour, np.ndarray), 'contour should be a numpy array'\n return cv2.contourArea(contour)", "def __CalculateMoments(self, contour):\r\n return cv2.moments(contour)", "def get_max_area(contours):\n...
[ "0.7210734", "0.66500163", "0.6628211", "0.6365675", "0.614254", "0.61276436", "0.6062467", "0.5952984", "0.5937475", "0.59279317", "0.58706164", "0.57940084", "0.5752224", "0.5744717", "0.5743859", "0.5743859", "0.5719784", "0.5644189", "0.56355894", "0.5590524", "0.5581619"...
0.7479222
0
Calculate the bouding rectangle. It is a straight rectangle, it doesn't consider the rotation of the object. So area of the bounding rectangle won't be minimum. It is found by the function cv2.boundingRect().
def __CalculateBoundingBox(self, contour): return cv2.boundingRect(contour)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boundingRect(self):\n return self.rect().adjusted(-2, -2, 2, 2)", "def boundingRect(cnt):\n\tx, y, w, h = cv2.boundingRect(cnt)\n\treturn {\"x\":x, \"y\": y, \"w\": w, \"h\": h}", "def boundingBox(self):\n minx, miny, maxx, maxy = self.substrates.bounds\n return pcbnew.BOX2I(\n ...
[ "0.7676917", "0.72490233", "0.71938384", "0.7107463", "0.70778424", "0.7075241", "0.6987138", "0.698335", "0.69716114", "0.691494", "0.6906388", "0.6903976", "0.68773127", "0.685709", "0.6815819", "0.68036884", "0.6765353", "0.6762905", "0.6715452", "0.66673505", "0.66570497"...
0.74042195
1
Calculates the centroid of the contour. Moments up to the third order of a polygon or rasterized shape.
def __CalculateCentroid(self, contour): moments = cv2.moments(contour) centroid = (-1, -1) if moments["m00"] != 0: centroid = (int(round(moments["m10"] / moments["m00"])), int(round(moments["m01"] / moments["m00"]))) return centroid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def centroid(self):\n return self.contours_to_matrix().mean(axis=0)", "def calculateCentroid(self,image):\n\t\tim=cv2.imread(image,0) #reads it in greyscale\n\t\tret,thresh = cv2.threshold(img_copy,128,255,cv2.THRESH_OTSU)\n\t\tim2,contours,hierarchy = cv2.findContours(thresh, 1, 2)\n\t\tcnt = contours[0]...
[ "0.7549272", "0.7480494", "0.74477065", "0.72905296", "0.72855806", "0.7277071", "0.72547257", "0.7159602", "0.71536976", "0.70305306", "0.7029446", "0.7029446", "0.7026189", "0.6984927", "0.69735426", "0.6927554", "0.69200563", "0.69048506", "0.69047856", "0.6894379", "0.688...
0.80175775
0
Calculate the circumcircle of an object using the function cv2.minEnclosingCircle(). It is a circle which completely covers the object with minimum area.
def __CalculateCircle(self, contour): return cv2.minEnclosingCircle(contour)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boundingCircle(self):\n\n try:\n import cv2\n except:\n logger.warning(\"Unable to import cv2\")\n return None\n\n # contour of the blob in image\n contour = self.contour()\n\n points = []\n # list of contour points converted to suitabl...
[ "0.74524856", "0.72214043", "0.6968209", "0.655094", "0.637335", "0.62411404", "0.61780167", "0.61020416", "0.6038088", "0.6018948", "0.6009186", "0.59972024", "0.5996103", "0.5971567", "0.5965567", "0.5927634", "0.5920173", "0.5918442", "0.59156424", "0.5889828", "0.58796084...
0.80844194
0
Calculate the countour extend.
def __CalculateExtend(self, contour): area = self.__CalculateArea(contour) boundingBox = self.__CalculateBoundingBox(contour) return area / (boundingBox[2] * boundingBox[3])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def life_insurance_to_recive_total(self):\n pass", "def extendability(self):\n self._extendability = 0.50 * self.ANA - 0.50 * self.DCC + 0.50 * self.MFA + 0.50 * self.NOP\n return round(self._extendability, 5)", "def calculate(self):", "def calculate(self):\n pass", "def update_...
[ "0.56703246", "0.5525739", "0.5475888", "0.5367172", "0.5338628", "0.53284657", "0.53263986", "0.53008175", "0.529843", "0.5273235", "0.52313775", "0.5210509", "0.5181706", "0.51630366", "0.5138338", "0.51348615", "0.50815606", "0.50513184", "0.504204", "0.50351846", "0.50212...
0.6228183
0
Check if a curve is convex or not.
def __IsConvex(self, contour): return cv2.isContourConvex(contour)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convex(self):\n # Convex has positive curvature (2nd derivative)\n # f\"(x) = 2a, so a > 0 corresponds to convex\n return (self.a > 0)", "def _check_curve(layer: ogr.Layer) -> None:\n # Check if the feature geometry is polygonal:\n feature_defn = layer.GetLayerDefn()\n ...
[ "0.7643623", "0.6757536", "0.67146444", "0.65801567", "0.6464188", "0.6454179", "0.635574", "0.62782335", "0.61885536", "0.61603767", "0.6148129", "0.6033672", "0.60245943", "0.590163", "0.580078", "0.5784255", "0.57838607", "0.5783847", "0.5773544", "0.57301515", "0.5673152"...
0.73451805
1
Calculate the contour moments to help you to calculate some features like center of mass of the object, area of the object etc.
def __CalculateMoments(self, contour): return cv2.moments(contour)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moments(cnt):\n\treturn cv2.moments(cnt)", "def moments(cnt):\n\treturn cv2.moments(cnt)", "def moments(self):", "def moments(data):\n# =============================================================================\n# total = data.sum()\n# X, Y = np.indices(data.shape)\n# x = (X*da...
[ "0.6727947", "0.6727947", "0.66949683", "0.65000355", "0.6481608", "0.63708127", "0.6356746", "0.6351715", "0.6243697", "0.61840034", "0.6168322", "0.6164202", "0.6142851", "0.6103647", "0.60443234", "0.6014186", "0.6013817", "0.5995825", "0.59587353", "0.59543926", "0.595082...
0.77274
0
Calculates a contour perimeter or a curve length.
def __CalculatePerimeter(self, curve): return cv2.arcLength(curve, True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perimeter(cnt):\n\treturn cv2.arcLength(cnt, True)", "def perimeter(self):\n return self.sidelength1 + self.sidelength2 + self.baselength1 + self.baselength2", "def perimeter(self):\n return sum([s.length for s in self.segments])", "def perimeter(self):", "def __CalculateLength(self, curve):\...
[ "0.721825", "0.69289505", "0.6759035", "0.6589213", "0.6564522", "0.65498984", "0.6483492", "0.6478432", "0.6431225", "0.6417622", "0.6385283", "0.6373984", "0.63636816", "0.636077", "0.6348714", "0.6287157", "0.62746215", "0.6269028", "0.6236131", "0.6204229", "0.6204229", ...
0.7875777
0
Update the ElasticSearch index every hour.
def update_es_index(): for job in scheduler.get_jobs(): if 'task_type' in job.meta and job.meta['task_type'] == "update_index": scheduler.cancel(job) scheduler.schedule( scheduled_time=datetime.now(), func='haystack.management.commands.update_index.Command().handle()', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_later(self):\n return", "def update_time(cls, key):\n key.put()", "def every_hour(self, time, function, args=None, kwargs=None, name=None):\n if args is None:\n args = list()\n if kwargs is None:\n kwargs = dict()\n if name is None:\n ...
[ "0.59411937", "0.57995015", "0.56473935", "0.5602451", "0.558092", "0.551876", "0.5453459", "0.5422525", "0.54206413", "0.54206413", "0.5394929", "0.5394929", "0.53662395", "0.53635", "0.53479695", "0.53402996", "0.532217", "0.53142494", "0.5309737", "0.5285711", "0.52673167"...
0.6486948
0
JavaProcess.__init__(self, class_loc, args=[]) Initializes an external Java process.
def __init__(self, config, class_loc, args=[]): JavaProcess.config = JavaProcessConfig.configFrom_dict(config) self._cp = self._construct_classpath_str() self.class_loc = class_loc self.args = args self._process = None self._stdout = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, paths):\n Process.__init__(self)\n self.paths = paths", "def __init__(self, host=\"\", port=8432):\n Process.__init__(self)\n self.host, self.port = host, port\n self._Handler.annotator = self", "def __init__(self):\n self._recording = None\n ...
[ "0.6975941", "0.6958235", "0.67394876", "0.6490618", "0.6321262", "0.6161817", "0.612476", "0.6118696", "0.6096931", "0.6078772", "0.60693926", "0.60651165", "0.60423166", "0.60343724", "0.6023563", "0.600156", "0.5997967", "0.5996555", "0.5996109", "0.5992397", "0.59232205",...
0.8258955
0
slick solution in python ONLY zeros = [0 for i in range(zeros_and_ones.count(0))] ones = [1 for j in range(zeros_and_ones.count(1))] return zeros + ones
def zeros_before_ones(zeros_and_ones): index_i = 0 last_index = len(zeros_and_ones) - 1 while index_i < last_index: if zeros_and_ones[index_i] == 1 and zeros_and_ones[last_index] == 0: zeros_and_ones[index_i], zeros_and_ones[last_index] = zeros_and_ones[last_index], zeros_and_ones[index...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution2(n):\n ones = 0\n while n > 0:\n if n & 1:\n ones += 1\n n = n >> 1\n\n return 0 if ones % 2 == 0 else 1", "def c(ixs):\n return sum(range(1, sum((i > 0 for i in ixs)) + 1))", "def _iter_restrict(self, zeros, ones):\n inputs = list(self.inputs)\n ...
[ "0.6483679", "0.624784", "0.61705774", "0.610907", "0.6090902", "0.6031265", "0.59823155", "0.59540856", "0.59308344", "0.59170455", "0.5842495", "0.5830201", "0.5826083", "0.5814207", "0.578468", "0.57763344", "0.5771295", "0.57675946", "0.5759372", "0.5745411", "0.5724746",...
0.6798596
0
Registers all the JRPC overloaders in the jrpc server
def register_overloaders(jrpc_server: JRPCServer, receiver) -> None: jrpc_server.register_overloader( 'Application.GetProperties', lambda server: GetPropertiesOverloader(server, receiver)) jrpc_server.register_overloader( 'Application.SetMute', lambda server: SetMuteOverloader(receiver)) jrp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def register_rpc_proxies(self):\n for rpc_name in self.rpc_proxy_list:\n logger.debug('Registering RPC to Proxy: {}'.format(rpc_name))\n\n class RPCProxy:\n\n def __init__(self, local_session, rpc_name):\n self._local_session = local_session\n ...
[ "0.5887183", "0.53439647", "0.5303127", "0.5229928", "0.5181709", "0.51379925", "0.5042705", "0.5018712", "0.50179935", "0.5007511", "0.50063205", "0.50051254", "0.49503332", "0.4928616", "0.4922325", "0.4869519", "0.4867418", "0.48619875", "0.4855552", "0.4855092", "0.484246...
0.78924644
0
Accumulate observed stars on the same dates.
def accumulate_dates(dates, stars): start = min(dates) stop = max(dates) t_range = (stop - start).days a_dates = [start + timedelta(days = n) for n in range(t_range + 1)] a_stars = [0 for n in range(t_range + 1)] for i in range(len(dates)): idx = (dates[i] - start).days a_stars[i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_rating_history(self, rating: float, date: Union[str, float]):\n self.rating_history.append((date, rating))", "def _increment_num_user_stars(user_id, match, now):\n\tassert match.is_streamed\n\n\tmissing = session.query(CalendarEntry)\\\n\t\t\t.filter(\n\t\t\t\tCalendarEntry.user_id == user_id,...
[ "0.5819865", "0.562832", "0.5501563", "0.5379064", "0.52238375", "0.5169488", "0.5166707", "0.5135347", "0.50705355", "0.50331134", "0.50316", "0.50230944", "0.5007228", "0.4953354", "0.49355468", "0.4928901", "0.49267507", "0.49242172", "0.49139744", "0.49059406", "0.4899571...
0.7347785
0
Calculate estimated number of stars observed during VLASS observation Assume 4.2 sec per pointing as estimated by Paul.
def vlass_stars(duration, n_beams): n_pointings = duration//4.2 n_observed = n_pointings*n_beams return n_observed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ventilation_rate(self):\n # TODO: calculate based on MERV ratings/efficiency/power/etc.\n return (\n sum(v.calculate_ach(self.volume) for v in self.air_quality_measures)\n + self.outdoor_air_ventilation\n )", "def getStarRating(waveHeight, windDir, avgWind, tideHeig...
[ "0.61229646", "0.6093639", "0.59843814", "0.59413254", "0.5775997", "0.5775997", "0.5775997", "0.5775997", "0.57482773", "0.57340753", "0.5731418", "0.57153237", "0.5698593", "0.56730896", "0.5668431", "0.5663986", "0.5649949", "0.5639038", "0.5635766", "0.5622494", "0.561866...
0.73987895
0
Queries a nearby weather underground station for temp data and rain data
def get_weather_data(weather_station): now = datetime.datetime.now() then = now - datetime.timedelta(days=7) query_date_start = ("%d%02d%02d" % (then.year, then.month, then.day)) query_date_end = ("%d%02d%02d" % (now.year, now.month, now.day)) api_key = '/api/%s' % WUNDERGROUND_KEY history_key...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTodaysWeather(self, keyword, temp):\n\n\t\t# Variables\n\t\tweather = {} \n\t\tfio = self.helper.getFio(keyword, temp) # Getting fio object\n\t\t\n\t\t# Getting todays weather data and populating the dictionary\n\t\tif fio.has_daily() is True and fio.has_hourly() is True:\n\t\t daily = FIODaily.FIOD...
[ "0.6910243", "0.66520226", "0.6608227", "0.6573686", "0.63866216", "0.6343781", "0.631178", "0.6305189", "0.6281451", "0.62793523", "0.62376016", "0.6201287", "0.6198531", "0.6157297", "0.61510736", "0.6086177", "0.6076465", "0.6055122", "0.60240924", "0.5990383", "0.598555",...
0.71451485
0
Return all zip streams and their positions in file.
def zipstreams(filename): with open(filename, 'rb') as fh: data = fh.read() i = 0 while i < len(data): try: zo = zlib.decompressobj() yield i, zo.decompress(data[i:]) i += len(data[i:]) - len(zo.unused_data) except zlib.error: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_stream_readers_for_zip(fh, tmp_dir):\n fasta_zip = zipfile.ZipFile(fh, 'r')\n rval = []\n for member in fasta_zip.namelist():\n fasta_zip.extract(member, tmp_dir)\n rval.append(open(os.path.join(tmp_dir, member), 'rb'))\n return rval", "def _GetStreamNames(self):\n if self._...
[ "0.7123306", "0.654805", "0.64884543", "0.6211099", "0.6143137", "0.60887825", "0.60620993", "0.6023242", "0.591442", "0.58101535", "0.57589924", "0.5750186", "0.57359564", "0.5727873", "0.57115054", "0.57092226", "0.56497854", "0.5616687", "0.561402", "0.5552648", "0.5543412...
0.6771445
1
Returns an enumeration member with a value matching `value`.
def get_member( cls, value: str, ): if not value: return None members = [ (member, member.value) for member in cls.__members__.values() ] for member, member_value in members: if member_value == value: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Enum(enum, value, default=None):\n if value is None:\n return default\n\n for pair in enum:\n if pair.value == value:\n return pair\n\n raise KeyError(\"Value '{}' not contained in enum type\".format(value))", "def from_value(cls, value: str):\n return cls._value2memb...
[ "0.67772806", "0.66527843", "0.64541763", "0.6362393", "0.611267", "0.6082106", "0.5995382", "0.59891886", "0.5980627", "0.5902926", "0.5802926", "0.57012653", "0.560989", "0.5605811", "0.5560168", "0.55101895", "0.55054975", "0.5468104", "0.5463636", "0.5452052", "0.5404608"...
0.7054582
0
Decorator that can be used to return the first item of a callable's `list` return.
def return_first_item(func): # Define the wrapper function. def wrapper(self, *args, **kwargs): # Execute the decorated method with the provided arguments. result = func(self, *args, **kwargs) # If the function returned a result and that result is a list then # return the firs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first(items):\n return next(iter(items or []), None)", "def first(items):\r\n return items[0]", "def first(l):\n return next(iter(l), None)", "def _get_first(details: CallableDetails) -> CallableArg:\n return details.args[0]", "def first(sequence, default=Ellipsis):\n if default is E...
[ "0.65695965", "0.65369004", "0.6376428", "0.6358152", "0.6354889", "0.6343154", "0.6285985", "0.62713856", "0.6234703", "0.6234703", "0.61748505", "0.61029243", "0.6100002", "0.6100002", "0.60022485", "0.5952739", "0.5899202", "0.5892642", "0.58904845", "0.58807445", "0.58740...
0.8338826
0
Decorator that ensures all ``list`` objects in a method's arguments have the same length
def lists_equal_length(func): # Define the wrapper function. def wrapper(self, *args, **kwargs): # Collect all `list` objects from `args`. lists_args = [arg for arg in args if isinstance(arg, list)] # Collecgt all `list` object from `kwargs`. lists_kwargs = [arg for arg in kwarg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_of_equal_len():\n\n @type_checked\n def _run_test(something:[str, int, bool]):\n assert isinstance(something[0], str)\n assert isinstance(something[1], int)\n assert isinstance(something[2], bool)\n\n _run_test(something=[None, \"12\", 1])", "def __size_restriction_cor...
[ "0.6833578", "0.6415181", "0.63303596", "0.61641717", "0.6103861", "0.6006148", "0.59215814", "0.59204984", "0.5868942", "0.57566774", "0.57490146", "0.5735287", "0.572292", "0.5700607", "0.56883466", "0.56657", "0.5599322", "0.5599322", "0.55968153", "0.5568369", "0.5561684"...
0.8060742
0
Clear the screen and draw the alien.
def draw(): screen.fill((0, 0, 0)) alien.draw()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\n pygame.draw.rect(self.screen,BLACK,(0,0,WINDOWWIDTH,\n WINDOWHEIGHT))\n pygame.display.update()", "def clear(self) -> None:\n\n self.screen.fill(self.bg)", "def draw(self):\n self.screen.fill(BACKGROUND_COLOR)\n se...
[ "0.7505039", "0.7242356", "0.7230753", "0.7131363", "0.7115127", "0.7101928", "0.70682305", "0.70466423", "0.7031619", "0.6995481", "0.6974922", "0.6921669", "0.69176", "0.69122386", "0.6896714", "0.6883864", "0.6875905", "0.6849436", "0.6818272", "0.6815119", "0.6790672", ...
0.8509718
0
Move the alien around using the keyboard.
def update(): if keyboard.left: alien.x -= 2 elif keyboard.right: alien.x += 2 if keyboard.space: alien.y = GROUND - 50 animate(alien, y=GROUND, tween='bounce_end', duration=.5) # If the alien is off the screen, # move it back on screen if alien.right > WIDTH: alien.rig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(event):\r\n\t\tif event.char == \"a\":\r\n\t\t\tcanvas.move(z[a], -10, 0)\r\n\t\telif event.char == \"d\":\r\n\t\t\tcanvas.move(z[a], 10, 0)\r\n\t\telif event.char == \"w\":\r\n\t\t\tcanvas.move(z[a], 0, -10)\r\n\t\telif event.char == \"s\":\r\n\t\t\tcanvas.move(z[a], 0, 10)", "def joystick_move(self, e...
[ "0.70149887", "0.699595", "0.681032", "0.6801341", "0.66253835", "0.65040016", "0.64911735", "0.6442173", "0.6367084", "0.632558", "0.62957025", "0.6282375", "0.62190115", "0.6184205", "0.61793596", "0.6166848", "0.61651015", "0.61622244", "0.6133459", "0.61307865", "0.612061...
0.71201307
0
basic preprocessing on the raw variatons returns a single histogram for each systematic with bin content represting the symmterised uncertainty Preprocessing top mass variations are scaled by 1/3
def processSystematic(observable, xsecType, xsecLevel, systematic, histNominal): varHists = [] linkStr = "" singlePointSystematics = ["ERDON", "ERDONRETUNE", "GLUONMOVETUNE", "BFRAG_PETERSON"] sPS = 0 if any(singlePointSystematic in systematic for singlePointSystematic in singlePointSystematics): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processSystematic(observable, xsecType, xsecLevel, systematic, histNominal):\n varHists = []\n\n linkStr = \"_\"\n variations = [\"\"]\n\n for variation in variations:\n if xsecType == \"normalised\":\n xsecType = \"normalized\"\n if xsecLevel == \"particle\":\n ...
[ "0.64501214", "0.5601664", "0.5529052", "0.55120814", "0.54677695", "0.5449569", "0.5407651", "0.53764164", "0.5360028", "0.5337787", "0.53310555", "0.5325349", "0.5292115", "0.529134", "0.5287892", "0.5283185", "0.5263711", "0.5261005", "0.5248296", "0.52357006", "0.52268076...
0.59027475
1
Test the Categorical feature class.
def test_categorical_feature(): feature = Categorical("abc") for element in "abc": feature.set(element) feature.set("ignore this") feature.push() for element in "abc": getattr(feature, "set_" + element)() feature.push() array = feature.array() assert array...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_categorical():\n # assert the distribution of the samples is close to the distribution of the data\n # using cstest:\n # - uniform (assert p-value > 0.05)\n # - very skewed / biased? (assert p-value > 0.05)\n # - inversely correlated (assert correlation < 0)", "def test_get_cat_scor...
[ "0.73366314", "0.7113809", "0.71037066", "0.6780652", "0.66445255", "0.66398925", "0.6559521", "0.6554185", "0.6519982", "0.6498263", "0.6448205", "0.64314634", "0.64148504", "0.64140356", "0.63725084", "0.6347099", "0.6345432", "0.62697804", "0.62644917", "0.62623185", "0.62...
0.7951883
0
Test the Hashed feature class.
def test_hashed_feature(): def mock(c): return ord(c) - ord('a') group = Group({"a": Hashed(buckets=3, hash=mock), "b": Hashed(buckets=5, hash=mock), }) for i in range(10): group.set_a("abcde" [i % 3]) group.set_b("abcde" [i % 5]) group.push() array = group.array() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_hashing():\n X = Vectorizer(strategy=\"Hashing\", n_features=10).fit_transform(X_text)\n assert X.shape == (10, 10)\n assert \"hash1\" in X", "def test_all_features_with_data(self):\n feature1 = Feature('looktest1')\n feature1.set_percentage(5)\n\n feature2 = Feature('lookt...
[ "0.65287024", "0.62354875", "0.6188721", "0.60676974", "0.59955835", "0.5943524", "0.59145314", "0.5907544", "0.59006155", "0.5855149", "0.5854101", "0.5758078", "0.5741417", "0.5683079", "0.5673396", "0.5668186", "0.5665878", "0.56312555", "0.5623874", "0.5621978", "0.558776...
0.70252043
0
Test if array concatenation works.
def test_array_concat(): array = Array(columns="abc") for i in range(10): array.append([1, 2, 3]) # Any 2-dimensional array witht the same number of rows should work. other = [[4, 5, 6]] * len(array) array.concat(other) assert array.shape == (10, 6) assert len(array.columns) == 6 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test01(self):\n a = np.arange(1000)\n b = bcolz.carray(a, chunklen=1, rootdir=self.rootdir)\n b.append(a)\n # print \"b->\", `b`\n c = np.concatenate((a, a))\n assert_array_equal(c, b[:], \"Arrays are not equal\")", "def test03(self):\n a = np.arange(1e4)\n ...
[ "0.71296877", "0.7055316", "0.69996417", "0.67035186", "0.6662046", "0.64107263", "0.6404458", "0.6371694", "0.6330895", "0.63107747", "0.6218703", "0.6131409", "0.6072472", "0.60144913", "0.5992456", "0.597871", "0.5963048", "0.5954356", "0.59503627", "0.5942833", "0.5925160...
0.7229425
0
KNearest Neighbors classifier. Return the most frequent class among the k nearest points
def knn(p, k, x, t): # Number of instances in data set N = x.shape[0] Euclidean_Distance = numpy.square(x - p) #Euclidean distance dis = numpy.sum(Euclidean_Distance, axis=1) #sum of the euclidean distance inds = numpy.argsort(dis)[:k] #sort the indices of the distance array tgt_cat = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def knn_classify_point(point, data, k, distance_metric):\n k_closest_points = get_k_closest_points(point, data, k, distance_metric)\n classification_counts = {}\n for item in k_closest_points:\n classification_type = item.classification\n if classification_type not in classification_counts:\...
[ "0.7780232", "0.77610284", "0.7689671", "0.7591956", "0.75637233", "0.7306566", "0.7278552", "0.72072935", "0.71550226", "0.71461403", "0.71255", "0.71031046", "0.70180625", "0.69530344", "0.6946558", "0.6925374", "0.6919172", "0.6916706", "0.6903651", "0.6782697", "0.6778249...
0.83432674
0
Given data (observed x and labels t) and choice k of nearest neighbors, plots the decision boundary based on a grid of classifications over the feature space.
def plot_decision_boundary(k, x, t, granularity=100, figures_root='../figures', data_name=None): print(f'KNN for K={k}') # Initialize meshgrid to be used to store the class prediction values # this is used for computing and plotting the decision boundary contour pointsX = numpy.linspace(numpy.mi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_knn_boundaries(knn, h=0.02): # h = Step size in the mesh\n ax = plt.gca()\n [xmin, xmax] = ax.get_xlim()\n [ymin, ymax] = ax.get_ylim()\n # Generate the axis associated to the first feature: \n x_axis = np.arange(xmin, xmax, h)\n # Generate the axis associated to the 2nd feature: \n y...
[ "0.7444855", "0.6746422", "0.66787404", "0.64081985", "0.6387924", "0.63505673", "0.62327814", "0.62229425", "0.61925626", "0.6169651", "0.61491215", "0.61412793", "0.6130474", "0.61028457", "0.60486627", "0.6044063", "0.6039184", "0.60355693", "0.599889", "0.5996375", "0.593...
0.7342933
1
Get a nova client instance.
def get_nova(self, version='2.1'): if self.nova is None: self.nova = novaclient.Client(version, session=self.get_session()) return self.nova
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_nova_client(self):\n region_name = CONF.region_name\n session = self._get_keystone_session()\n return novaclient.client.Client(2, session=session, region_name=region_name)", "def get_novaclient(self):\n # TODO: We ought to be able to derive this from the keystone client,\n ...
[ "0.8543932", "0.7357674", "0.73333573", "0.72716653", "0.7151151", "0.6966708", "0.69495815", "0.6702617", "0.667086", "0.6567023", "0.6537803", "0.6491878", "0.64906466", "0.64767176", "0.6461029", "0.64514875", "0.63861746", "0.63556963", "0.63503575", "0.63300276", "0.6299...
0.76938033
1
Get a glance client instance.
def get_glance(self, version='2'): if self.glance is None: self.glance = glanceclient(version, session=self.get_session()) return self.glance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_glance_client(self):\n session = self._get_keystone_session()\n return glanceclient.client.Client(2, session=session)", "def client(self):\n\n if self._client is None:\n self._client = self._get_client()\n return self._client", "def client():\n\n client = Clie...
[ "0.8825718", "0.7007617", "0.69371164", "0.6927475", "0.6900914", "0.68201137", "0.6812655", "0.6797418", "0.6797418", "0.6663279", "0.6625562", "0.6587854", "0.65376866", "0.6535913", "0.65322053", "0.6514193", "0.64772695", "0.64697844", "0.6460001", "0.64531165", "0.640168...
0.7610261
1
Get a swift client.Connection instance.
def get_swift(self): if self.swift is None: self.swift = swiftclient.Connection( auth_version='3', authurl=self.auth_kwargs["auth_url"], user=self.auth_kwargs["username"], key=self.auth_kwargs["password"], tenant_name=se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_connection(self):\n c = httplib.HTTPConnection(self.server)\n return c", "def get_swiftclient():\n swift_conn = swiftclient.client.Connection(\n authurl=os.environ.get(\"OS_AUTH_URL\"),\n user=os.environ.get(\"OS_USERNAME\"),\n key=os.environ.get(\"OS_PASSWORD\"),\n ...
[ "0.72027934", "0.7086128", "0.6808257", "0.67928064", "0.6765041", "0.6715244", "0.66940707", "0.66649985", "0.6593805", "0.6565049", "0.65543133", "0.6501697", "0.64977556", "0.64977556", "0.6481265", "0.6448724", "0.6448724", "0.64482147", "0.6444177", "0.643537", "0.642600...
0.7363057
0
'voltage' should be a dict of numpy arrays of floatingpoint numbers. The keys of 'voltage' are integers, 03. Each element of 'voltage' should start and end near zero. 'repetitions' and 'rate' should be integers.
def __init__( self, voltage={0:(0, 0)}, rate=500, repetitions=1, board_name='cDAQ1Mod1', voltage_limits=None, num_channels=7): self.board_name = board_name #Check Measurement and Automation Explorer self._taskHandle = ctypes.c_void_p(0) self.num_channels = num_channels DA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_voltage_data(self):\n self.voltage_record = {}\n self.threshold_value = {}\n for l in self.network.layers:\n if 'v' in self.network.layers[l].__dict__:\n self.voltage_record[l] = self.network.monitors['{:}_voltages'.format(l)].get('v')\n if 'thresh'...
[ "0.5384202", "0.53538734", "0.5352361", "0.529449", "0.5280764", "0.5153001", "0.51174885", "0.5016881", "0.4978907", "0.494465", "0.49282992", "0.48579437", "0.48414347", "0.48238522", "0.48228803", "0.4811493", "0.48023042", "0.47906768", "0.4784123", "0.47702235", "0.47668...
0.55513275
0
Given rows of normal vectors to line L, return points (rows) that are somewhere on each line Just find intersection with some basis line.
def points_on_lines(hyperplanes): intersections = [] for row in hyperplanes: intersections.append(an_intersection(row[:-1], -row[-1])) return np.array(intersections)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_intersect_points(line1, line2):\n intersect_points = matrix.matrix_sol([line1, line2])\n return intersect_points", "def intersection(line1, line2):\n p0, p1, p2, p3 = map(\n lambda tup : np.array(tup[:2]),\n [line1[0], line1[1], line2[0], line2[1]]\n )\n p1, p2, p3 = map(lamb...
[ "0.68824154", "0.6712293", "0.654148", "0.64509463", "0.64332", "0.6398922", "0.6371681", "0.6350881", "0.6311801", "0.6303512", "0.62909174", "0.6267723", "0.62216777", "0.6182562", "0.61743903", "0.6087039", "0.6078734", "0.6011505", "0.60104203", "0.5943569", "0.5912073", ...
0.6902687
0
Initializes the scheduler to poll every five minutes and start it
def _init_scheduler(self): self._sched = BackgroundScheduler() self._sched.add_job(self._check_rain, trigger='cron', minute='*/5') self._sched.start()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_scheduler(self):\n scheduler = BackgroundScheduler()\n scheduler.add_job(self.do, 'interval', minutes=1)\n scheduler.start()\n self.do()", "def initialize_scheduler(self):\n scheduler = BackgroundScheduler()\n scheduler.add_job(self.do, 'interval', minutes...
[ "0.7595585", "0.7595585", "0.7579649", "0.749416", "0.7138583", "0.7092702", "0.67534935", "0.6750422", "0.67337924", "0.6687412", "0.65673363", "0.65599716", "0.6548511", "0.652253", "0.6520828", "0.64790255", "0.6437538", "0.6316568", "0.631423", "0.6258985", "0.62449056", ...
0.775051
0
Calculate the maximum amount of rain between now and now+minute Remote procedure to be called by the core of Domos
def rain_max(self, key=None, name=None, lat=None, lon=None, minute=0): self.logger.info("added sensor for rain max %s : %s for %s minutes" % (lat, lon, minute)) if key and lat and lon and minute: try: minute = int(minute) except: return False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def rain_rate(self, value):\n if not value:\n return 0\n return await self.rain(value * 60)", "def max_humidity(self):\n return 60", "def find_tim(self):\n start_max = 0\n finish_max = 0\n op_mode = self.op_number + ',' + self.mode_number\n for ...
[ "0.59764725", "0.5706513", "0.5661375", "0.5645471", "0.5608999", "0.56051016", "0.55437905", "0.55279684", "0.5525821", "0.5406212", "0.53948325", "0.5393251", "0.5372555", "0.5347693", "0.5315714", "0.5262582", "0.5261224", "0.5259729", "0.52450776", "0.524259", "0.52310866...
0.5800529
1
Returns all the session names for a participant
def filter_by_participant (self, participant): sparql_results = self.query (""" select distinct ?rs ?session ?name ?number ?pid ?sitename where { BIND (<%s> AS ?participant) ?rs rdf:type austalk:RecordedSession . ?rs o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtered_session_names(self):\n return list(self.stage.filtered_sessions.keys())", "def search_sessions(name: str, provider: Optional[str] = None) -> List[str]:\n sessions = session_list(provider=provider).sessions\n name = name.lower()\n return [s.id for s in sessions if s.id.lower().startsw...
[ "0.6723869", "0.63031816", "0.62869734", "0.62178284", "0.6213438", "0.6011497", "0.60053223", "0.59663093", "0.5954626", "0.5935582", "0.5870372", "0.5859776", "0.5857662", "0.5844726", "0.57861197", "0.57147163", "0.5673998", "0.56739765", "0.56506336", "0.5621848", "0.5617...
0.67719805
0
Returns all the session names for a site identified by site label
def filter_by_site (self, label): sparql_results = self.query (""" select distinct ?rs ?session ?name ?number ?pid WHERE { ?rs rdf:type austalk:RecordedSession . ?rs olac:speaker ?participant . ?participant austalk...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtered_session_names(self):\n return list(self.stage.filtered_sessions.keys())", "def search_sessions(name: str, provider: Optional[str] = None) -> List[str]:\n sessions = session_list(provider=provider).sessions\n name = name.lower()\n return [s.id for s in sessions if s.id.lower().startsw...
[ "0.6083844", "0.5573907", "0.5564926", "0.54466736", "0.5325585", "0.53207505", "0.5316571", "0.527415", "0.5223453", "0.5201878", "0.5165152", "0.514091", "0.5095732", "0.50864303", "0.5076436", "0.50540745", "0.50449497", "0.5036865", "0.50282997", "0.50101763", "0.49757937...
0.71040463
0
Delete one or more keys specified by ``keys``
async def delete(self, *keys, **kwargs): def gen_keys(keys): all_keys = [] for key in keys: if isinstance(key, list): all_keys += gen_keys(keys=key) else: all_keys.append(key) return all_keys al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_many(self, keys):\n raise NotImplementedError()", "def delete_many(self, keys):\n try:\n if keys:\n self._cache.delete(*map(self.prepare_key, keys))\n except Exception as err:\n return self.warn_or_error(err)", "def delete(cls, *keys):\n ...
[ "0.8140219", "0.8091643", "0.80413496", "0.8027012", "0.7771675", "0.7751918", "0.7727257", "0.7682047", "0.7680383", "0.7599218", "0.7451378", "0.7443246", "0.73895985", "0.7378481", "0.7349482", "0.7295384", "0.72044706", "0.7172078", "0.71646804", "0.711923", "0.7093819", ...
0.8353874
0
It should create color shapes in the given data directory.
def test_create_shapes(data_dir): dataset.create_shapes(10, 10, 1, data_dir=data_dir) img_path = os.path.join(data_dir, "ellipse/0.png") assert os.path.exists(img_path) img = imageio.imread(img_path) assert img.shape == (10, 10, 4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_shapes_grayscale(data_dir):\n dataset.create_shapes(10, 10, 1, channels=1, data_dir=data_dir)\n img_path = os.path.join(data_dir, \"ellipse/0.png\")\n assert os.path.exists(img_path)\n img = imageio.imread(img_path)\n assert img.shape == (10, 10)", "def load_shapes(self,count,img_f...
[ "0.6856443", "0.618052", "0.60780936", "0.60242367", "0.5808405", "0.57668114", "0.5690427", "0.56130856", "0.5600461", "0.55399936", "0.54958624", "0.5479186", "0.5459529", "0.5456665", "0.5448621", "0.54074323", "0.5362034", "0.53619134", "0.5324682", "0.53203875", "0.53083...
0.70245886
0
It should create grayscale shapes in the given data directory.
def test_create_shapes_grayscale(data_dir): dataset.create_shapes(10, 10, 1, channels=1, data_dir=data_dir) img_path = os.path.join(data_dir, "ellipse/0.png") assert os.path.exists(img_path) img = imageio.imread(img_path) assert img.shape == (10, 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_shapes(data_dir):\n dataset.create_shapes(10, 10, 1, data_dir=data_dir)\n img_path = os.path.join(data_dir, \"ellipse/0.png\")\n assert os.path.exists(img_path)\n img = imageio.imread(img_path)\n assert img.shape == (10, 10, 4)", "def makeDataset(numberOfTrials, data_type):\n\n\tda...
[ "0.66889775", "0.6415231", "0.6367699", "0.63560754", "0.6261791", "0.6167243", "0.61289775", "0.60442597", "0.6023371", "0.5907351", "0.5826012", "0.57797915", "0.5760415", "0.57251453", "0.57180756", "0.57146996", "0.57077223", "0.56844974", "0.5684313", "0.56831986", "0.56...
0.78713274
0
Calculate by how many cells the moving window should be moved. If this is nonzero, shift the fields on the interpolation grid, and add new particles.
def move_grids(self, fld, comm, time): # To avoid discrepancies between processors, only the first proc # decides whether to send the data, and broadcasts the information. dz = comm.dz if comm.rank==0: # Move the continuous position of the moving window object sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swipeBase (self) :\n grid = self.grid\n\n #we start by putting every tile up\n for columnNbr in range(4) :\n nbrZeros = 4 - np.count_nonzero(grid[:,columnNbr])\n\n for lineNbr in range(4) :\n counter = 0\n while (grid[lineNbr, columnNbr] ...
[ "0.59834635", "0.5809151", "0.57765406", "0.56846297", "0.55949116", "0.5528766", "0.5480749", "0.54742026", "0.54698974", "0.54524153", "0.54521763", "0.54496145", "0.5448103", "0.5435209", "0.54142", "0.5403219", "0.53876007", "0.5387515", "0.5371499", "0.5368437", "0.53605...
0.67525464
0
Generate new particles at the right end of the plasma (i.e. between z_end_plasma nz_injectdz and z_end_plasma) Return them in the form of a particle buffer of shape (8, Nptcl)
def generate_particles( self, species, dz, time ) : # Shortcut for the number of integer quantities n_int = species.n_integer_quantities n_float = species.n_float_quantities # Create new particle cells if (self.nz_inject > 0) and (species.continuous_injection == True): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_particles(self):\n # xf, yf = create_fluid_with_solid_cube()\n xf, yf = create_fluid()\n uf = np.zeros_like(xf)\n vf = np.zeros_like(xf)\n m = initialize_mass(xf, yf)\n rho = initialize_density_fluid(xf, yf)\n h = np.ones_like(xf) * self.hdx * self.dx\n ...
[ "0.612357", "0.6045421", "0.58844817", "0.5861245", "0.5850004", "0.57011443", "0.5697617", "0.56546646", "0.56274694", "0.5621595", "0.558431", "0.5581051", "0.5563471", "0.55546993", "0.5529091", "0.5474343", "0.5459851", "0.5450769", "0.54444504", "0.5442273", "0.54061013"...
0.69258934
0
Shift the spectral fields by n_move cells (with respect to the spatial grid). Shifting is done either on the CPU or the GPU, if use_cuda is True. (Typically n_move is positive, and the fields are shifted backwards)
def shift_spect_grid( self, grid, n_move, shift_rho=True, shift_currents=True ): if grid.use_cuda: shift = grid.d_field_shift # Get a 2D CUDA grid of the size of the grid tpb, bpg = cuda_tpb_bpg_2d( grid.Ep.shape[0], grid.Ep.shape[1] ) # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_spect_array_gpu( field_array, shift_factor, n_move ):\n # Get a 2D CUDA grid\n iz, ir = cuda.grid(2)\n\n # Only access values that are actually in the array\n if ir < field_array.shape[1] and iz < field_array.shape[0]:\n power_shift = 1. + 0.j\n # Calcula...
[ "0.68111503", "0.654992", "0.6478761", "0.5682042", "0.55264264", "0.5491822", "0.5434507", "0.54266405", "0.54103285", "0.53249466", "0.52720374", "0.52512574", "0.5243212", "0.51999307", "0.51817954", "0.5173916", "0.5150899", "0.51255804", "0.5119478", "0.51185614", "0.510...
0.7541371
0
Shift the field 'field_array' by n_move cells on CPU. This is done in spectral space and corresponds to multiplying the fields with the factor exp(ikz_truedz)n_move .
def shift_spect_array_cpu( field_array, shift_factor, n_move ): Nz, Nr = field_array.shape # Loop over the 2D array (in parallel over z if threading is enabled) for iz in prange( Nz ): power_shift = 1. + 0.j # Calculate the shift factor (raising to the power n_move ; # for negative ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_spect_array_gpu( field_array, shift_factor, n_move ):\n # Get a 2D CUDA grid\n iz, ir = cuda.grid(2)\n\n # Only access values that are actually in the array\n if ir < field_array.shape[1] and iz < field_array.shape[0]:\n power_shift = 1. + 0.j\n # Calcula...
[ "0.7170832", "0.6100913", "0.5694191", "0.562633", "0.5549602", "0.5426374", "0.54186237", "0.5341644", "0.5283791", "0.5212293", "0.49859214", "0.4963954", "0.49574816", "0.4957023", "0.4904727", "0.4896321", "0.48726845", "0.4868087", "0.48667774", "0.4864888", "0.4824995",...
0.77101654
0
Shift the field 'field_array' by n_move cells on the GPU. This is done in spectral space and corresponds to multiplying the fields with the factor exp(ikz_truedz)n_move .
def shift_spect_array_gpu( field_array, shift_factor, n_move ): # Get a 2D CUDA grid iz, ir = cuda.grid(2) # Only access values that are actually in the array if ir < field_array.shape[1] and iz < field_array.shape[0]: power_shift = 1. + 0.j # Calculate the shift...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_spect_array_cpu( field_array, shift_factor, n_move ):\n Nz, Nr = field_array.shape\n\n # Loop over the 2D array (in parallel over z if threading is enabled)\n for iz in prange( Nz ):\n power_shift = 1. + 0.j\n # Calculate the shift factor (raising to the power n_move ;\n # f...
[ "0.73844004", "0.6082966", "0.58029294", "0.5760416", "0.5458749", "0.5457597", "0.54504377", "0.5396676", "0.5381811", "0.53601795", "0.51622343", "0.508853", "0.50696003", "0.5024297", "0.5003249", "0.49621084", "0.49588436", "0.49356058", "0.4930291", "0.49255875", "0.4920...
0.72734666
1
Note the camelcase name and unused variable. Bad bad bad.
def camelCaseFunc(): unused = 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_unused_names(self):\n for s in self.unused_names:\n self.warning(\"'%s' is unused.\"%s)\n\n# warns for param that specified with -c (but also if name gets defined in __main__,\n# e.g. by default_density=global_params.default_density in a script file\n## for name in self.para...
[ "0.6454768", "0.63859814", "0.61285913", "0.6127803", "0.5935644", "0.59143764", "0.58966666", "0.58966666", "0.58946407", "0.58621436", "0.5839409", "0.5818854", "0.5737015", "0.5730995", "0.57293755", "0.57293755", "0.57293755", "0.57293755", "0.57196563", "0.57148516", "0....
0.6955739
0
Whether or not the Window supports user resizing
def resizable(self): return self._frame._root.resizable() == '1 1'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsResizeable(self):\r\n \r\n return self.HasFlag(self.optionResizable)", "def ev_windowsizechanged(self, event: WindowResized) -> None:", "def isSelectionResizing(self):\n return self.resizing", "def ev_windowsizechanged(self, event: tcod.event.WindowResized) -> T | None:", "def ev...
[ "0.7450744", "0.67073464", "0.6607859", "0.65714055", "0.6563378", "0.6560024", "0.64793974", "0.6461006", "0.63823223", "0.63217413", "0.624592", "0.62382627", "0.6228985", "0.61842704", "0.6160696", "0.6158254", "0.61509866", "0.61256456", "0.610373", "0.60751265", "0.60684...
0.7568574
0
The list of all turtles attached to this Window This attribute may not be altered directly
def turtles(self): return self._turtles[:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turtles(self):\n return self._turtles", "def turbines(self):\n return self.turbine_map.turbines", "def getturtle(self):\n return self", "def thermostats(self):\n\n return self._thermostats", "def lights(self):\n return list(self.GetLights())", "def get_light_list(se...
[ "0.8411543", "0.6130211", "0.5962633", "0.59047854", "0.5882312", "0.5679309", "0.56639826", "0.5651566", "0.5635582", "0.5587322", "0.5562676", "0.5513544", "0.5510087", "0.5497294", "0.54633754", "0.54598933", "0.5458061", "0.5453143", "0.5407893", "0.53814805", "0.53572404...
0.8240958
1
The list of all pens attached to this Window This attribute may not be altered directly
def pens(self): return self._pencils[:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawables(self):\n\treturn self._Widget__w['drawables']", "def getPixels(self):\n\t\treturn self.strip.ledsColorBuffer", "def swing_list(self):\n return self._swing_list", "def getPixelsBuffer(self):\n\t\treturn self.leds", "def get_list_powers(self):\r\n return self.ps", "def getMenuIt...
[ "0.6194239", "0.5969787", "0.59447014", "0.58146423", "0.58107215", "0.5731491", "0.5615673", "0.557614", "0.5560097", "0.55471444", "0.5541459", "0.5525621", "0.54055196", "0.53989977", "0.5346334", "0.53336155", "0.53113025", "0.5300297", "0.52949387", "0.52927554", "0.5269...
0.7543301
0
Add a turtle to this window.
def _addTurtle(self,turt): assert (type(turt) == Turtle), "Parameter %s is not a valid Turtle object" % `turt` self._turtles.append(turt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new(event):\n t = turtle.Turtle()\n screen_w, screen_h = t.screen._window_size()\n t.goto(event.x - screen_w//2, screen_h //2 - event.y)", "def add_body(self):\r\n new_turtle = generate_turtle()\r\n new_turtle.goto(self.all_turtles[-1].position())\r\n self.all_turtles.append...
[ "0.68280035", "0.6453635", "0.6225176", "0.6220096", "0.5967827", "0.59463257", "0.5936159", "0.59193295", "0.5886304", "0.58368546", "0.5714807", "0.5633327", "0.5586595", "0.55554694", "0.552829", "0.5502977", "0.5502977", "0.5468977", "0.5448978", "0.5388961", "0.5375666",...
0.7149174
0
Add a pen to this window.
def _addPen(self,pen): assert (type(pen) == Pen), "Parameter %s is not a valid graphics pen" % `turt` self._pencils.append(pen)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pen(self, width=None, rgb=None, alpha=None):\n self.call('pen', width, rgb, alpha)", "def pen(self, pen=None, **pendict):\n _pd = {\"shown\" : self._shown,\n \"pendown\" : self._drawing,\n \"pencolor\" : self._pencolor,\n \"fillco...
[ "0.6879283", "0.6544037", "0.6461168", "0.63628376", "0.629559", "0.62903273", "0.6202111", "0.61660004", "0.61124593", "0.5987985", "0.5954313", "0.59414625", "0.58582664", "0.5821973", "0.57936865", "0.5761476", "0.5666378", "0.55963165", "0.55450845", "0.54638934", "0.5450...
0.7343928
0
Remove a pen from this window.
def _removePen(self,pen): if pen in self._pencils: self._pencils.remove(pen)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __del__(self):\n self._screen._removePen(self)\n del self._turtle", "def remove(self) -> None:\n self.map.remove_brush(self)", "def removePick(self):\n self.pnt = None\n vtkRenWin.delMarker(self.renWin)", "def remove_brush(self, brush: 'Solid') -> None:\n try:\n ...
[ "0.6923281", "0.6495933", "0.62122864", "0.616254", "0.60080194", "0.590251", "0.56725013", "0.56136733", "0.5546344", "0.55072165", "0.5487803", "0.54865557", "0.5449742", "0.5432165", "0.5357028", "0.53393936", "0.53330404", "0.52942204", "0.52776873", "0.5274253", "0.52715...
0.74714136
0
Sets the maximum size for this window Any attempt to resize a dimension beyond the maximum size will fail.
def setMaxSize(self,width,height): assert (type(width) == int), "width %s is not an int" % `width` assert (width > 0), "width %s is negative" % `width` assert (type(height) == int), "height %s is not an int" % `height` assert (height > 0), "height %s is negative" % `height` self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_max_size(self, size):\n # The hard Qt limit is 16777215 (which is 2**24 - 1) and will\n # print warnings to the shell if we attemp to set a max size\n # over that amount. This can be attempted when a QtMainWindow\n # has a central widget size equal to max size, and it also has\n...
[ "0.8343203", "0.808209", "0.7743762", "0.7440697", "0.7391813", "0.71794146", "0.7152232", "0.70025915", "0.6995238", "0.69787806", "0.6910393", "0.6805439", "0.67991096", "0.6738618", "0.67204857", "0.66982836", "0.667508", "0.66253215", "0.6608448", "0.6564544", "0.65028757...
0.81691533
1
Sets the minimum size for this window Any attempt to resize a dimension below the minimum size will fail.
def setMinSize(self,width,height): assert (type(width) == int), "width %s is not an int" % `width` assert (width > 0), "width %s is negative" % `width` assert (type(height) == int), "height %s is not an int" % `height` assert (height > 0), "height %s is negative" % `height` self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetMinimumPaneSize(self, minSize):\n self._minimumPaneSize = minSize", "def set_min_size(self, size):\n self.widget.setMinimumSize(*size)", "def set_min_size(self, width: int, height: int):\n self.tk_ref.minsize(width=width, height=height)", "def SetMinSize(self, s):\r\n\r\n s...
[ "0.82620406", "0.8125616", "0.7964996", "0.7790341", "0.7647176", "0.7619907", "0.74496925", "0.7417188", "0.73141354", "0.72229654", "0.70047134", "0.6895434", "0.68838006", "0.6880474", "0.67831236", "0.6776431", "0.67747736", "0.6735547", "0.66872287", "0.66674685", "0.659...
0.81438893
1
The heading of this turtle in degrees. Heading is measured counter clockwise from due east.
def heading(self): return float(self._turtle.heading())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heading(self):\n x, y = self._orient\n result = round(math.atan2(y, x)*180.0/math.pi, 10) % 360.0\n result /= self._degreesPerAU\n return (self._angleOffset + self._angleOrient*result) % self._fullcircle", "def raw_heading(self):\n\n self._heading = math.atan2(self._mag[X],...
[ "0.85323304", "0.7825337", "0.77631426", "0.7465228", "0.7281472", "0.7165995", "0.70578945", "0.6940017", "0.6924136", "0.6804612", "0.6803771", "0.677972", "0.6762503", "0.6762503", "0.67530805", "0.6701139", "0.66272557", "0.65986854", "0.6573453", "0.6512578", "0.65064764...
0.87159824
0
Indicates whether the turtle's icon is visible. Drawing commands will still work while the turtle icon is hidden. There will just be no indication of the turtle's current location on the screen.
def visible(self): return self._turtle.isvisible()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_visible(self):", "def is_visible(self):\n return self._visible", "def isVisible( self ):\n layer = self.layer()\n if ( layer and not layer.isVisible() ):\n return False\n# \n# if ( self.isIsolateHidden() ):\n# return False\n# \n retu...
[ "0.71561986", "0.6992037", "0.69445086", "0.6929709", "0.689857", "0.6858378", "0.67312574", "0.6723745", "0.6712027", "0.66735023", "0.6668584", "0.66361713", "0.66052437", "0.6484988", "0.648333", "0.648333", "0.64757276", "0.6454804", "0.631289", "0.6297589", "0.62900037",...
0.7854587
1
Indicates whether the turtle is in draw mode. All drawing calls are active if an only if this mode is True
def drawmode(self): return self._turtle.isdown()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isdrawn(self):\n return hasattr(self, 'drawn')", "def setDrawingMode(self):\n pass", "def get_drawing_mode(self) -> int:\n return self._drawing_mode", "def draw(self, canvas) -> bool:\n return False", "def _set_draw_mode(draw_mode):\n#########################################...
[ "0.7248577", "0.6596341", "0.6579881", "0.6529058", "0.65262514", "0.64363253", "0.6411703", "0.6403673", "0.6296374", "0.62232405", "0.6160772", "0.60842884", "0.5986026", "0.5977863", "0.59161794", "0.5741559", "0.5738247", "0.56827796", "0.5679077", "0.56439203", "0.563513...
0.8096658
0
Deletes this turtle object.
def __del__(self): self.clear() self._screen._removeTurtle(self) del self._turtle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __del__(self):\n self._screen._removePen(self)\n del self._turtle", "def delete(self):\n self.graph._del(handle=self.handle)", "def remove(self):\n self.node.destroy()", "def delete(self):\n\t\tself.canvas.delete('node_'+self.identifier)\n\t\tself.canvas.tag_unbind('node_'+sel...
[ "0.72901684", "0.69489294", "0.6906722", "0.68213683", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.68130356", "0.6793991", "0.6787353", ...
0.79840356
0
Moves the turtle forward by the given amount.
def forward(self,distance): assert (type(distance) in [int, float]), "parameter distance:%s is not a valid number" % `distance` self._turtle.forward(distance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, amount):\n newX = self._x + round(amount * math.sin(math.radians(self._rotation)), 2)\n newY = self._y - round(amount * math.cos(math.radians(self._rotation)), 2)\n self.goto(newX, newY)", "def advance(self, amount=1):\n self._current += amount\n self.redraw()...
[ "0.805098", "0.7168281", "0.71475154", "0.7083541", "0.6969918", "0.6827667", "0.682601", "0.6692048", "0.66343707", "0.66327345", "0.6570666", "0.64380103", "0.6395247", "0.6392661", "0.6286539", "0.6284747", "0.6278547", "0.6266692", "0.6242889", "0.6207868", "0.6171793", ...
0.7646355
1
Moves the turtle backward by the given amount.
def backward(self,distance): assert (type(distance) in [int, float]), "parameter distance:%s is not a valid number" % `distance` self._turtle.backward(distance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward(self, amount):\n newX = self._x - round(amount * math.sin(math.radians(self._rotation)), 2)\n newY = self._y + round(amount * math.cos(math.radians(self._rotation)), 2)\n self.goto(newX, newY)", "def move_backward(self, distance):\r\n return self.move('back', distance)", ...
[ "0.82581335", "0.73676413", "0.6859591", "0.6773016", "0.67576206", "0.6722952", "0.67022717", "0.6687509", "0.66345984", "0.6610055", "0.65762097", "0.6467502", "0.6444055", "0.6443134", "0.6412966", "0.6340994", "0.63096267", "0.6303683", "0.62736183", "0.62425214", "0.6214...
0.78231084
1
The fill status of this pen. If the fill status is True, then the pen will fill the insides of any polygon or circle subsequently traced by its drawLine or drawCircle method. If the attribute changes, it only affects future draw commands, not past ones. Switching this attribute between True and False allows the pen to ...
def fill(self): return self._turtle.fill()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setFilled(self, fill):\n isFilled = fill\n repaint()", "def GetFillAlpha(self):\n return self._attalpha[\"fill\"]", "def fillcolor(self):\n return self._fillcolor", "def setFill(self, fill):\n self.area_show = fill", "def fill(self):\n return self[\"fill\"]", ...
[ "0.68982977", "0.6480413", "0.64142907", "0.61500674", "0.60670793", "0.60670793", "0.60242504", "0.5965748", "0.593573", "0.59075147", "0.5873632", "0.57370543", "0.57370543", "0.5725248", "0.5699221", "0.553684", "0.55129635", "0.549395", "0.5492293", "0.54508805", "0.54495...
0.6480622
1
The pen color of this pen. The pen color is used for drawing lines and circles. All subsequent draw commands draw using this color. If the color changes, it only affects future draw commands, not past ones. This color is only used for lines and the border of circles. It is not the color used for filling in solid areas ...
def pencolor(self): return self._pencolor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def penColor( self ):\n return self._penColor", "def color(self):\n assert False, 'Pen does not have a color; use pencolor or fillcolor'", "def pencolor(self, *args):\n if args:\n color = self._colorstr(args)\n if color == self._pencolor:\n return\n ...
[ "0.81438965", "0.7675859", "0.7551927", "0.6896309", "0.67128396", "0.6509215", "0.64415", "0.64415", "0.64305776", "0.6405034", "0.6389262", "0.6373281", "0.6373281", "0.6361102", "0.6361102", "0.6361102", "0.6358667", "0.63095975", "0.62246627", "0.62037814", "0.6115269", ...
0.7982437
1
The fill color of this turtle. The fill color is used for filling in solid shapes. If the ``fill`` attribute is True, all subsequent draw commands fill their insides using this color. If the color changes, it only affects future draw commands, not past ones. This color is only used for filling in the insides of solid s...
def fillcolor(self): return self._fillcolor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_color(self, fill_color=None):\n\n if fill_color is None:\n return self._fill_color\n else:\n self._fill_color = process_color(fill_color)", "def fillcolor(self, *args):\n if args:\n color = self._colorstr(args)\n if color == self._fillcolo...
[ "0.8201772", "0.7598433", "0.7313783", "0.67560655", "0.6748844", "0.6730906", "0.6724899", "0.67112285", "0.6703533", "0.6412003", "0.63272303", "0.6276365", "0.6182439", "0.6151799", "0.6137227", "0.61257184", "0.59977", "0.59752995", "0.59577733", "0.5939774", "0.58236915"...
0.76650685
1
Indicates whether the pen's icon is visible. Drawing commands will still work while the pen icon is hidden. There will just be no indication of the pen's current location on the screen.
def visible(self): return self._turtle.isvisible()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_visible(self):\n return self._visible", "def is_visible(self):\n return self.proto.display_type == DISPLAY_TYPE.Visible.value", "def is_visible(self):\n return self.container['is_visible']", "def is_visible(self):\n return self.rect.x < self.screen_rect.width", "def is_vi...
[ "0.70938164", "0.7088974", "0.7023082", "0.6997821", "0.68921804", "0.6873909", "0.68134916", "0.67763966", "0.66723704", "0.6664352", "0.6607723", "0.660474", "0.660474", "0.6599054", "0.6597098", "0.6593233", "0.6585666", "0.65637505", "0.65612817", "0.65610343", "0.6546338...
0.72434735
0
Deletes this pen object.
def __del__(self): self._screen._removePen(self) del self._turtle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self):\n # exit contains our clean up code\n self.exit()\n GenericAnimatedProp.GenericAnimatedProp.delete(self)", "def delete(self):\n self.graph._del(handle=self.handle)", "def delete(self):\n del self.shx.atoms[self.index]", "def __del__(self):\n\n # Del...
[ "0.6839339", "0.6739376", "0.66108614", "0.65926075", "0.6585168", "0.6571784", "0.65023196", "0.64651775", "0.6461599", "0.6461599", "0.63839555", "0.63446337", "0.63371813", "0.63204235", "0.63204235", "0.63204235", "0.63204235", "0.63204235", "0.63204235", "0.63204235", "0...
0.71101624
0
Draws a line segment (dx,dy) from the current pen position
def drawLine(self, dx, dy): assert (type(dx) in [int, float]), "parameter x:%s is not a valid number" % `dx` assert (type(dy) in [int, float]), "parameter y:%s is not a valid number" % `dy` x = self._turtle.xcor() y = self._turtle.ycor() self._turtle.setposition(x+dx, y+dy)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __draw_line(display, color, ball_pos, dx, dy):\n pygame.draw.line(display, color, ball_pos, (ball_pos[0] + dx, ball_pos[1] + dy), 2)", "def draw_line():\n global y1, y2\n canvas.create_line(x1, y1, x2, y2, width=2, fill=color)\n y1 -= 10\n y2 += 10", "def draw_line(self, x):\n sel...
[ "0.74554735", "0.68954694", "0.6881306", "0.68413955", "0.68105817", "0.67588437", "0.6756782", "0.67204547", "0.6719156", "0.67131805", "0.66987574", "0.6690832", "0.6682115", "0.6653802", "0.66391045", "0.6631516", "0.6622917", "0.6610148", "0.65972066", "0.65874225", "0.65...
0.7574059
0
Draw a circle of radius r centered on the pen.
def drawCircle(self, r): assert (type(r) in [int, float]), "parameter r:%s is not a valid number" % `r` x = self._turtle.xcor() y = self._turtle.ycor() # Move the pen into position fstate = self._turtle.pendown() if fstate: self._turtle.penup(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawCircle(x, y, r):\n pen1.up()\n pen1.goto(x,y)\n pen1.down()\n pen1.circle(r)", "def circle(draw, centrex, centrey, radius, color=\"#AAAAAAFF\") -> None:\n # convert cartesian centre to pixel centre\n cx, cy = pixelcoord(centrex, centrey)\n # top left and bottom right coordinates\n ...
[ "0.8421582", "0.78745735", "0.78179467", "0.78179467", "0.7747963", "0.7729969", "0.77170885", "0.76944184", "0.7692904", "0.7636455", "0.7619516", "0.7604409", "0.74545527", "0.7423694", "0.7403186", "0.7349896", "0.73346525", "0.732114", "0.7312092", "0.7307844", "0.729076"...
0.8723447
0
Fills in the current drawing, but retains state. Normally, an object is not filled until you set the state to False. Calling this method executes this fill, without setting the state to False. If fill is False, this method does nothing.
def flush(self): if self.fill: self._turtle.fill(False) self._turtle.fill(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setFilled(self, fill):\n isFilled = fill\n repaint()", "def fill(self):\n return self._turtle.fill()", "def update_fill(self, event):\r\n\r\n if event.type == 'FILL':\r\n self.update_positions_from_fill(event)\r\n self.update_holdings_from_fill(...
[ "0.76267654", "0.7002292", "0.6535505", "0.6509827", "0.6509827", "0.6482051", "0.64610213", "0.63605654", "0.6331894", "0.6112397", "0.6048987", "0.59302145", "0.58996844", "0.5897555", "0.5853862", "0.57472944", "0.5747061", "0.5738132", "0.5734731", "0.5734146", "0.5732249...
0.70235515
1
hgtStartData is the source data from the NASA JPL topological data
def __init__(self, hgtStartData): self.data = [] for row in hgtStartData: toAdd = [] for height in row: toAdd.append([height, 0]) self.data.append(toAdd) self.maxX = len(hgtStartData[0]) - 1 self.maxY = len(hgtStartData) - 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_single_source_data(self, start, end):\n single_source_data = {}\n dijkstra = Dijkstra(self.graph_provider)\n single_source_data['start'] = dijkstra.single_source(start)\n single_source_data['end'] = dijkstra.single_source(end)\n\n self._single_source_data = single_so...
[ "0.55448586", "0.54904854", "0.5319753", "0.5157752", "0.515219", "0.5077915", "0.5074858", "0.50618047", "0.49980226", "0.4995144", "0.4934863", "0.4929119", "0.49235275", "0.49122941", "0.49056458", "0.489825", "0.48901126", "0.4874309", "0.4871687", "0.48503634", "0.483276...
0.580808
0