query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Return an iterator that yields an L{Entity} for each result.
def iter_entities(self, clean=False): for d in self.iter_dicts(clean=clean): yield Entity(self.node, d)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n self._fetch_all()\n return iter(self._result_cache)", "def __iter__(self):\n items = self._fetch()\n for item in items:\n yield item", "def items(self) -> Iterator[Item]:\n yield from (entity for entity in self.entities if isinstance(entity, I...
[ "0.7325532", "0.72172976", "0.7055325", "0.69886374", "0.69535404", "0.6950489", "0.68347025", "0.662154", "0.66188854", "0.6596436", "0.65145653", "0.64498055", "0.6424147", "0.6390321", "0.6379237", "0.63631386", "0.63519233", "0.6318192", "0.6311604", "0.62979275", "0.6291...
0.6905427
6
Results as list of dicts.
def get_dicts(self, clean=False): return list(self.iter_dicts(clean=clean))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result_dict(result):\n result_dict = [row.__dict__ for row in result]\n\n return result_dict", "def get_sorted_results_by_dict(self):\n results = self.get_sorted_results()\n return [dict(r) for r in results]", "def resultsToArray(self):\n data = {}\n for item in se...
[ "0.78158045", "0.72667027", "0.711347", "0.69082314", "0.6812268", "0.6771889", "0.6743916", "0.67314744", "0.66373223", "0.6628844", "0.6570499", "0.6554217", "0.65486586", "0.6533597", "0.64898735", "0.6482282", "0.6475888", "0.64740914", "0.64723396", "0.64723396", "0.6452...
0.6687471
8
Results as list of entities.
def get_entities(self, clean=False): return list(self.iter_entities(clean=clean))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entities(self):\n return list(self._entities.values())", "def entities(self):\n return self._entities", "def fetch_all(self):\n return list(iter(self))", "def _ProcessQueryResult(self, result):\n self.__more_results = result.more_results()\n\n if self.__keys_only:\n re...
[ "0.7450944", "0.7289201", "0.71123934", "0.7064505", "0.6879179", "0.68518984", "0.67838556", "0.67776567", "0.67633843", "0.6654585", "0.6624513", "0.65606433", "0.65234804", "0.6501614", "0.64880025", "0.64698946", "0.6461406", "0.64253384", "0.64148086", "0.6390837", "0.63...
0.74944
0
Send an AMQP management query message and return the response. At least one of type, attribute_names must be specified.
def query(self, type=None, attribute_names=None, offset=None, count=None): # There is a bug in proton (PROTON-1846) wherein we cannot ask for # too many rows. So, as a safety we are going to ask only for # MAX_ALLOWED_COUNT_PER_REQUEST. Since this is used by both qdstat # and qdmanage, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exec_worker_query(self, endpoint, args, request):\n\n queue = self.iden\n args['endpoint'] = endpoint\n args['headers'] = dict(request.headers)\n client = Producer(queue_host=Config.get('queue', 'host'),\n queue_port=Config.getint('queue', 'port'),\n ...
[ "0.5666461", "0.5519574", "0.54946125", "0.54469186", "0.5337671", "0.52884877", "0.5221358", "0.5207394", "0.5201482", "0.5199975", "0.5172254", "0.5171461", "0.51697814", "0.5079349", "0.50026894", "0.49766466", "0.49718434", "0.49627665", "0.49605957", "0.49461535", "0.492...
0.5581281
1
Create an entity. type and name can be specified in the attributes.
def create(self, attributes=None, type=None, name=None): attributes = attributes or {} type = type or attributes.get('type') name = name or attributes.get('name') request = self.request(operation='CREATE', type=type, name=name, body=attributes) return Entity(self, self.call(reque...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_ent(self, classname: str, **kargs: ValidKVs) -> 'Entity':\n kargs['classname'] = classname\n ent = Entity(self, keys=kargs)\n self.add_ent(ent)\n return ent", "def new_entity_type(name, client=default):\n data = {\"name\": name}\n return raw.create(\"entity-types\", d...
[ "0.72611463", "0.69911486", "0.68685687", "0.67663044", "0.6730212", "0.6570471", "0.65568805", "0.65514016", "0.64008546", "0.6378404", "0.6324603", "0.6296172", "0.62146676", "0.6205613", "0.6160402", "0.6128596", "0.6092469", "0.6092469", "0.60874885", "0.6042646", "0.5993...
0.8365472
0
Read an AMQP entity. If both name and identity are specified, only identity is used.
def read(self, type=None, name=None, identity=None): if name and identity: name = None # Only specify one request = self.request(operation='READ', type=type, name=name, identity=identity) return Entity(self, self.call(request).body)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entity_by_name(self, entity_name):\n return Artifact.get_by_name(entity_name)", "def get(entity, name=None, version=None, lineage=None):", "def read(self, entity, content_type):\n return None", "def entity(self, rawbase_name, entity_id):\n url = \"%s/record/%s?id=%s\" % (self.api...
[ "0.62228894", "0.620416", "0.58133674", "0.5727325", "0.5724071", "0.5682123", "0.5652508", "0.5433038", "0.5282821", "0.5263503", "0.51750666", "0.51130986", "0.5110109", "0.50656855", "0.5023652", "0.500365", "0.50004137", "0.49858084", "0.49682954", "0.4962826", "0.4862536...
0.7346474
0
Update an entity with attributes. type, name and identity can be specified in the attributes. If both name and identity are specified, only identity is used.
def update(self, attributes, type=None, name=None, identity=None): attributes = attributes or {} type = type or attributes.get('type') name = name or attributes.get('name') identity = identity or attributes.get('identity') if name and identity: name = None # Only sen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, **values):\r\n if self.__abstract__:\r\n raise ThunderdomeException('cant update abstract elements')\r\n self.pre_update(**values)\r\n for key in values.keys():\r\n if key not in self._columns:\r\n raise TypeError(\"unrecognized attribute n...
[ "0.642415", "0.6374976", "0.6271963", "0.62489027", "0.6163514", "0.61539215", "0.6141256", "0.606471", "0.60338706", "0.59787714", "0.59568894", "0.592971", "0.5914256", "0.59075946", "0.5860035", "0.5827293", "0.5811051", "0.5775297", "0.57727534", "0.5761102", "0.57545567"...
0.85509366
0
Delete the remote entity. If both name and identity are specified, only identity is used.
def delete(self, type=None, name=None, identity=None): if name and identity: name = None # Only specify one request = self.request(operation='DELETE', type=type, name=name, identity=identity) self.call(request, expect=error.NO_CONTENT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_entity(self, owner_username, entity_relative_id):\n\t\treturn self._send_command_to_entity_server(us.SERVER_COMMAND_DELETE_ENTITY, owner_username + '|' + str(entity_relative_id))", "def delete(self, name):\n err = C.git_remote_delete(self._repo._repo, to_bytes(name))\n check_error(err)",...
[ "0.6528239", "0.62902176", "0.62646383", "0.6199844", "0.6184214", "0.60638714", "0.6012517", "0.6003652", "0.59530914", "0.5951121", "0.5893608", "0.5893519", "0.5859471", "0.5847694", "0.5823332", "0.58162194", "0.58157164", "0.5809494", "0.5784756", "0.5783919", "0.5783919...
0.68937683
0
return X(batch seq), Y(batch movie), output_mask(batch movie), flag
def get_batch_train(self, batch_size, sequence_len): if batch_size + self.used_train >= len(self.train_users): return None, None, None, False X, Y = self.construct_matrix(self.train_users[self.used_train: self.used_train+batch_size], sequence_len, batch_size) output_mask = Y > 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, inputs: tf.Tensor, outputs: tf.Tensor,\n out_mask: tf.Tensor,in_pad_mask: tf.Tensor=None,\n training: bool=False):\n encoder_outputs, enc_attention = self.encoder(\n inputs, in_pad_mask, training\n )\n # shape=(batch_size, inputs_seq_le...
[ "0.6020957", "0.59553456", "0.59321845", "0.5868298", "0.5866423", "0.5843722", "0.5833548", "0.5830086", "0.5730496", "0.5714638", "0.5714283", "0.56531316", "0.56482303", "0.5603201", "0.56025934", "0.560058", "0.55921173", "0.5590406", "0.5576543", "0.5560661", "0.55340785...
0.0
-1
return X(batch seq), Y(batch movie), output_mask(batch movie), flag
def get_batch_test(self, batch_size, sequence_len): if batch_size + self.used_test >= len(self.test_users): return None, None, None, False X, Y = self.construct_matrix(self.test_users[self.used_test: self.used_test+batch_size], sequence_len, batch_size) output_mask = Y > 0 se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, inputs: tf.Tensor, outputs: tf.Tensor,\n out_mask: tf.Tensor,in_pad_mask: tf.Tensor=None,\n training: bool=False):\n encoder_outputs, enc_attention = self.encoder(\n inputs, in_pad_mask, training\n )\n # shape=(batch_size, inputs_seq_le...
[ "0.6022614", "0.5955098", "0.5933073", "0.5866735", "0.5865059", "0.584288", "0.5832471", "0.58298546", "0.5731181", "0.571466", "0.5712977", "0.565135", "0.56468874", "0.56030554", "0.5600751", "0.55999565", "0.55905217", "0.55889964", "0.55770755", "0.5561843", "0.55337214"...
0.0
-1
The rating_list is already in time order return a 1 seq_len matrix
def rating_coding(self, rating_list, seq_len): output = np.ones((1, seq_len)) * (-1) if len(rating_list) > seq_len: rating_list = rating_list[len(rating_list) - seq_len:] for i in range(seq_len - len(rating_list), seq_len): output[0, i] = self.movie2ratingid(rating_list[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def left2vector(self, ratings):\n output = np.zeros((1, self.movieDim))\n for rating in ratings:\n output[0, self.movieID2index[rating[0]]] = rating[1]\n return output", "def get_score_matrix(self) -> int:", "def listening_count_to_rating(urm):\n for i in range(urm.shape[0]):...
[ "0.5722327", "0.5500496", "0.54548484", "0.5454357", "0.5429427", "0.5396892", "0.5340522", "0.5305781", "0.52911794", "0.52710074", "0.52710074", "0.5269098", "0.523033", "0.5229637", "0.52237904", "0.5157594", "0.5110092", "0.510619", "0.509394", "0.5069315", "0.5054868", ...
0.66449964
0
Return a 1 movie matrix
def left2vector(self, ratings): output = np.zeros((1, self.movieDim)) for rating in ratings: output[0, self.movieID2index[rating[0]]] = rating[1] return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_movie_tag_matrix(self):\n data_frame = genre_tag.get_genre_data()\n tag_df = data_frame.reset_index()\n unique_tags = tag_df.tag.unique()\n idf_data = tag_df.groupby(['movieid'])['tag'].apply(set)\n tf_df = tag_df.groupby(['movieid'])['tag'].apply(lambda x: ','.join(x)).r...
[ "0.64294225", "0.61970234", "0.61149323", "0.60074914", "0.58146065", "0.5795242", "0.5660991", "0.5642234", "0.5641521", "0.56268793", "0.5598223", "0.55440825", "0.5532156", "0.5523988", "0.5523926", "0.5513544", "0.55096763", "0.54997826", "0.5476137", "0.54599524", "0.544...
0.55278313
13
Launches the execution of the SCWRL binary.
def launch(self): out_log, err_log = fu.get_logs(path=self.path, mutation=self.mut, step=self.step) if self.mutation is not None: # Read structure with Biopython parser = PDBParser(PERMISSIVE=1) st = parser.get_structure('s', self.input_pdb_path) # s random id never ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def launch(self):\n \n # Get local loggers from launchlogger decorator\n out_log = getattr(self, 'out_log', None)\n err_log = getattr(self, 'err_log', None)\n\n # Check the properties\n fu.check_properties(self, self.properties)\n\n if self.restart:\n outp...
[ "0.6288887", "0.6187691", "0.6178403", "0.6166145", "0.61441433", "0.6122375", "0.61118597", "0.6027186", "0.60266626", "0.6024642", "0.6006521", "0.6000777", "0.5999002", "0.5987083", "0.59711224", "0.5959342", "0.59318763", "0.5894168", "0.5891979", "0.58831215", "0.5881502...
0.0
-1
Parse file extension and return format string to make other bits aware which format driver should be used
def parse_extension(filepath): extension = os.path.splitext(filepath)[1][1:] extensions_dict = {"netcdf": ['nc'], "mitiff": ['mitiff'], "geotiff": ['gtiff', 'tiff', 'tif']} driver = None for key in extensions_dict: if extension in extensions_dict[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extension_to_format(self, extension):", "def format_to_extension(self, format):", "def file_format(x):\n return FILE_EXT_FORMAT_MAP.get(genomic_file_ext(x))", "def make_file_format(filename, format_extension):\r\n \r\n if filename[len(filename)-len(format_extension):len(filename)] != format_exte...
[ "0.77844936", "0.75871134", "0.74644595", "0.7355027", "0.72258335", "0.71474856", "0.70689917", "0.7022275", "0.7020146", "0.69145", "0.6859921", "0.6853641", "0.68285227", "0.67731124", "0.6759339", "0.6745545", "0.6719645", "0.669987", "0.6653467", "0.6648035", "0.66419697...
0.6986291
9
Split a large 1D array into smaller nonoverlapping arrays
def window_blocks(large_array, window_size): y_size = large_array.shape[0]/window_size blocks_array = large_array.reshape(y_size, window_size) return blocks_array
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_array(array, size):\n arrays = []\n while len(array) > size:\n pice = array[:size]\n arrays.append(pice)\n array = array[size:]\n arrays.append(array)\n return arrays", "def split_into_subarrays_of_max_len(arr, max_len=44100):\n return np.split(arr, np.arange(max_len...
[ "0.71960866", "0.6999235", "0.69500226", "0.69150746", "0.68858933", "0.67999125", "0.67823654", "0.67116314", "0.66916007", "0.6638905", "0.6625901", "0.6571622", "0.65425587", "0.65102327", "0.649938", "0.64914256", "0.64729416", "0.6355834", "0.631842", "0.63149273", "0.62...
0.6572632
11
Create a GAC AVHRR array by averaging 4 consecutive LAC pixels Take only every forth scan line, omit the rest
def rescale_lac_array_to_gac(lac_array): window_size = 5 lac_array_with_omitted_lines = lac_array[::4] lac_array_2000px = lac_array_with_omitted_lines[:,:-1] flat_lac_array = lac_array_2000px.flatten() gac_array_flat = np.mean(window_blocks(flat_lac_array, window_size)[:,:-1], axis=1) gac_length...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculateAverage(self): \n if not self.lastTransferAverage: \n size=[0,0,0,0]\n for i in range(0,4):\n if self.lastTransferredChannel & (1 << i):\n size[i]=self.lastNbrSamplesPerSeg\n self.lastAverageArray = [zeros(size[0]),zeros(size[1]),zeros(size[2]),zeros(size[3])]\n ...
[ "0.66827494", "0.6605411", "0.6533453", "0.6506758", "0.6184953", "0.6178621", "0.60677236", "0.60255", "0.6015259", "0.59234273", "0.5903414", "0.5870899", "0.58375204", "0.58273125", "0.5818558", "0.5804327", "0.58040917", "0.5793793", "0.57705593", "0.5759124", "0.5714426"...
0.59247184
9
Parse proj4 string and create a dictionary out of it
def parse_proj_string(proj_string): regex_pattern = "(\+(\w+)=([A-Z\d+\w+\.]*))" regex = re.compile(regex_pattern) regex_results = regex.findall(proj_string) proj_dict = {} for proj_element in regex_results: proj_dict[proj_element[1]] = proj_element[2] return proj_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _proj4Proj(proj):\n if isinstance(proj, bytes):\n proj = proj.decode()\n if not isinstance(proj, str):\n return\n if proj.lower().startswith('proj4:'):\n proj = proj.split(':', 1)[1]\n if proj.lower().startswith('epsg:'):\n proj = NeededIn...
[ "0.6873182", "0.6064661", "0.6064661", "0.5855108", "0.582458", "0.57799417", "0.5713942", "0.5708816", "0.56618255", "0.5651791", "0.5435009", "0.54001766", "0.53807443", "0.5372783", "0.5320022", "0.53102314", "0.53064334", "0.53042746", "0.52941704", "0.5279955", "0.526814...
0.7964794
0
Transform (Rasterio) geotiff meta dictionary to pyresample area definition
def geotiff_meta_to_areadef(meta): area_id = "" name = "" proj_id = "Generated from GeoTIFF" proj_dict = meta['crs'] proj_dict_with_string_values = dict(zip([str(key) for key in proj_dict.keys()], [str(value) for value in proj_dict.values()])) x_size = meta['width'] x_res = meta['transform']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_meta_from_wrf( ds ):\n import pyproj, rasterio\n\n wgs84 = pyproj.Proj( '+units=m +proj=latlong +datum=WGS84' )\n pargs = dict()\n # get some metadata from the RAW WRF file we got from Peter.\n cen_lon = ds.CEN_LON\n cen_lat = ds.CEN_LAT\n dx = ds.DX\n dy = ds.DY\n pargs['lat_1']...
[ "0.56938297", "0.5444017", "0.5412894", "0.5374239", "0.5367224", "0.53590244", "0.5350049", "0.5344032", "0.53003776", "0.526953", "0.52409095", "0.5237224", "0.5235499", "0.52294", "0.5228723", "0.51985055", "0.51663595", "0.5160842", "0.5151635", "0.5138923", "0.5138923", ...
0.76776683
0
Save the record in a bulkbuffer. Also, flush the buffer by saving its content to Splunk when the buffer size exceeds configured self._buffer_size
def write(self, record): # Make Splunk ready payload data and append it to self._buffers list. self._buffer.append({ 'index': self._index, 'sourcetype': 'json', 'event': record }) # If the records count in self._buffer is more than allowed by ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _flush(self):\n buffer_len = len(self._buffer)\n\n if buffer_len == 0:\n _log.info('No pending records to index; URI: %s; index: %s',\n self._uri, self._index)\n return\n\n _log.info('Indexing %d records; URI: %s; index: %s ...',\n ...
[ "0.6441635", "0.60757685", "0.6013589", "0.6002337", "0.59962714", "0.5938248", "0.5889271", "0.5862441", "0.58550036", "0.5659928", "0.564264", "0.5625408", "0.5602134", "0.5580345", "0.5546973", "0.5546801", "0.5543745", "0.54664934", "0.5465568", "0.5460882", "0.5445714", ...
0.6554746
0
Perform bulk insert of buffered records into Splunk.
def _flush(self): buffer_len = len(self._buffer) if buffer_len == 0: _log.info('No pending records to index; URI: %s; index: %s', self._uri, self._index) return _log.info('Indexing %d records; URI: %s; index: %s ...', buffer_len, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunked_insert(model, items, chunk_size=150):\n # https://www.sqlite.org/limits.html#max_compound_select\n with db.atomic():\n for idx in range(0, len(items), chunk_size):\n model.insert_many(items[idx:idx+chunk_size]).execute()", "def _insert_bulk(self, iterable):\n self.curso...
[ "0.65587807", "0.6536186", "0.6472512", "0.6425702", "0.6369805", "0.63430935", "0.63252115", "0.6324399", "0.62911046", "0.62731296", "0.6272709", "0.6236594", "0.6205524", "0.61932945", "0.6188076", "0.6179584", "0.6151426", "0.60956556", "0.60686576", "0.6011911", "0.59643...
0.58401334
30
Flush any remaining records.
def done(self): self._flush()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _flush(self):\n tempbuf = self.databuffer\n self.databuffer = []\n self.database.runInteraction(self._executemany, tempbuf)", "def flush(self):\n pass", "def flush(self):\n pass", "def flush(self):\n pass", "def flush(self):\n pass", "def flush(self):\...
[ "0.76531416", "0.73989385", "0.73989385", "0.73989385", "0.73989385", "0.7394655", "0.7347146", "0.72808087", "0.726194", "0.72102517", "0.720445", "0.7151906", "0.7147627", "0.7079613", "0.70586705", "0.70532364", "0.70532364", "0.70532364", "0.70532364", "0.70532364", "0.70...
0.6460354
61
draw the bounding boxes for all detected hands with confidence greater than a set threshold
def PostProcessing(image, resultList, threshold=0.6): num_detections = resultList[0][0].astype(np.int) scores = resultList[2] boxes = resultList[3] bbox_num = 0 # loop through all the detections and get the confidence and bbox coordinates for i in range(num_detections): det_conf = scores[0, i] det_ymin = bo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_bounding_boxes(self, imgs, summed_viz, threshold_value=.7):\n self.viz = summed_viz # for debug\n viz = summed_viz\n n_batchs = viz.shape[ 0]\n n_classes = viz.shape[-1]\n \n # viz.shape (100,14,14,20) => (14,14,100,20)\n viz = viz.swapaxes(0,2); viz = viz.swapaxes(0,1)\n \n # No...
[ "0.66504616", "0.6596263", "0.6568496", "0.6553815", "0.64354724", "0.642784", "0.64145374", "0.64044255", "0.6315705", "0.62988925", "0.6291232", "0.62614757", "0.6250261", "0.62446094", "0.6233206", "0.6205863", "0.61741626", "0.6169788", "0.6164114", "0.6153489", "0.612675...
0.61964023
16
Preprocessing resize image to 300x300 RGB
def PreProcessing(image): image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) image = cv2.resize(image, (300, 300)) # type conversion to UINT8 image = image.astype(np.uint8).copy() return image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_image(image):\n image = resize(image)\n return image", "def resize_128(img): \n return cv2.resize(img,(128,128))", "def preprocessImage(img):\n shape = img.shape\n img = img[math.floor(shape[0]/4) : shape[0] - 25, 0:shape[1]]\n img = cv2.resize(img, (img_columns, img_rows), interp...
[ "0.75653034", "0.73177403", "0.72640413", "0.72331154", "0.7159523", "0.71543556", "0.7111782", "0.7074421", "0.7067297", "0.70329565", "0.7021435", "0.7020356", "0.6993711", "0.69357604", "0.6925325", "0.68780726", "0.68340766", "0.6830349", "0.6808554", "0.6788847", "0.6787...
0.63632196
100
Windows specific version of getch. Special keys like arrows actually post two key events. If you want to use these keys you can create a dictionary and return the result of looking up the appropriate second key within the if block.
def _getch_windows(prompt): print(prompt, end="") key = msvcrt.getch() if ord(key) == 224: key = msvcrt.getch() return key print(key.decode()) return key.decode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_key_press():\n return ord(getch.getch());", "def _getch_windows(prompt):\n\tprint(prompt, end=\"\")\n\tkey = msvcrt.getch()\n\tif ord(key) == 224:\n\t\tkey = msvcrt.getch()\n\t\treturn key\n\tprint(key.decode())\n\treturn key.decode()", "def get_input(self):\n try:\n char = self.sc...
[ "0.7330238", "0.72014165", "0.6819026", "0.6753253", "0.64544827", "0.6429468", "0.634012", "0.6334296", "0.6330903", "0.6315383", "0.62986517", "0.62607694", "0.6247113", "0.6173776", "0.61598206", "0.60886425", "0.60829335", "0.60615426", "0.60125107", "0.5976557", "0.59730...
0.7368495
0
Linux specific version of getch.
def _getch_linux(prompt): print(prompt, end="") sys.stdout.flush() fd = sys.stdin.fileno() old = termios.tcgetattr(fd) new = termios.tcgetattr(fd) new[3] = new[3] & ~termios.ICANON & ~termios.ECHO new[6][termios.VMIN] = 1 new[6][termios.VTIME] = 0 termios.tcsetattr(fd, termios.TCSANO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getch_linux(prompt):\n\tprint(prompt, end=\"\")\n\tsys.stdout.flush()\n\tfd = sys.stdin.fileno()\n\told = termios.tcgetattr(fd)\n\tnew = termios.tcgetattr(fd)\n\tnew[3] = new[3] & ~termios.ICANON & ~termios.ECHO\n\tnew[6][termios.VMIN] = 1\n\tnew[6][termios.VTIME] = 0\n\ttermios.tcsetattr(fd, termios.TCSANOW,...
[ "0.6580795", "0.600784", "0.5912592", "0.58335704", "0.57894963", "0.5648049", "0.56449205", "0.56109875", "0.55676854", "0.5544848", "0.54586834", "0.53401434", "0.53044146", "0.5304004", "0.5300996", "0.5259408", "0.5229581", "0.5158003", "0.49587855", "0.4835934", "0.47297...
0.63425136
1
Push all tiles in one row; like tiles will be merged together.
def push_row(row, left=True): r = 0 row = row[:] if left else row[::-1] new_row = [item for item in row if item] for i in range(len(new_row)-1): if new_row[i] and new_row[i] == new_row[i+1]: r += new_row[i] * 2 new_row[i], new_row[i+1:] = new_row[i]*2, new_row[i+2:]+[0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_all_rows(grid, left=True):\n\tfor i,row in enumerate(grid):\n\t\tgrid[i] = push_row(row, left)", "def tiles(self, nums, row = 1, spaces = 0):\r\n # We add the (\" \" * 5) to align the rows\r\n # with odd number of values\r\n separator = (\"+---+\" + (\" \" * 5)) * row\r\n spa...
[ "0.6691302", "0.64254564", "0.64083165", "0.63632536", "0.6187304", "0.6129666", "0.6080425", "0.6063838", "0.6040046", "0.6013889", "0.58922994", "0.58442473", "0.58442473", "0.5825047", "0.5775874", "0.57731456", "0.5716599", "0.57071084", "0.5703176", "0.56957954", "0.5645...
0.0
-1
Return the column from the grid at column_index as a list.
def get_column(grid, column_index): return [row[column_index] for row in grid]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_column(grid, column_index):\n\treturn [row[column_index] for row in grid]", "def column(self, index):\n result = []\n for col in self.data:\n result.append(col[index])\n return result", "def column(self, index: int) -> List[int]:\n return [x[index - 1] for x in se...
[ "0.89470553", "0.8450442", "0.81118757", "0.78952646", "0.75983846", "0.7451289", "0.73715085", "0.7209294", "0.71991056", "0.7171867", "0.7042811", "0.69441384", "0.6866465", "0.68610626", "0.6849367", "0.683718", "0.6781807", "0.6746657", "0.66863", "0.6637373", "0.6564681"...
0.8921025
1
Replace the values in the grid at column_index with the values in new. The grid is changed inplace.
def set_column(grid, column_index, new): for i,row in enumerate(grid): row[column_index] = new[i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_column(grid, column_index, new):\n\tfor i,row in enumerate(grid):\n\t\trow[column_index] = new[i]", "def update_positions(self, grid):\r\n self.grid = grid", "def map (a_data,a_column,a_old,a_new) :\n loc_new_data = a_data\n a_data[a_column].replace(a_old,a_new,inplace=True)", "def _swit...
[ "0.76025754", "0.60900813", "0.59735054", "0.59235686", "0.58712214", "0.569676", "0.5643494", "0.5593835", "0.55842495", "0.5554945", "0.55202717", "0.54953027", "0.54953027", "0.5490993", "0.54732704", "0.5437195", "0.54323137", "0.54323137", "0.54323137", "0.54083097", "0....
0.75669354
1
Perform a horizontal shift on all rows. Pass left=True for left and left=False for right. The grid will be changed inplace.
def push_all_rows(grid, left=True): r = 0 for i,row in enumerate(grid): grid[i], r_ = push_row(row, left) r += r_ return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_all_rows(grid, left=True):\n\tfor i,row in enumerate(grid):\n\t\tgrid[i] = push_row(row, left)", "def swipeLeft (self) :\n rotated = Grid(np.rot90(np.rot90(np.rot90(self.grid))))\n self.grid = np.rot90(rotated.swipeBase())", "def push_left (grid):\r\n \r\n for row in range (4):\r\n...
[ "0.6738422", "0.6710681", "0.6562622", "0.65071034", "0.64332944", "0.63762164", "0.62841797", "0.6200166", "0.617695", "0.6172406", "0.60970026", "0.6096321", "0.5997006", "0.5983838", "0.598277", "0.5941541", "0.59146863", "0.58851564", "0.58777547", "0.58430284", "0.583664...
0.6371835
6
Perform a vertical shift on all columns. Pass up=True for up and up=False for down. The grid will be changed inplace.
def push_all_columns(grid, up=True): r = 0 for i,val in enumerate(grid[0]): column = get_column(grid, i) new, r_ = push_row(column, up) r += r_ set_column(grid, i, new) return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_all_columns(grid, up=True):\n\tfor i,val in enumerate(grid[0]):\n\t\tcolumn = get_column(grid, i)\n\t\tnew = push_row(column, up)\n\t\tset_column(grid, i, new)", "def expand(self, right=0, down=0, left=0, up=0):\n self.min_col -= left\n self.min_row -= up\n self.max_col += right\n ...
[ "0.6787514", "0.63330275", "0.62566", "0.60964894", "0.59969014", "0.59673285", "0.59260863", "0.5910102", "0.58406526", "0.5828836", "0.578919", "0.57400197", "0.57400197", "0.56714576", "0.56558293", "0.56536555", "0.56502515", "0.5644719", "0.5620115", "0.56125003", "0.559...
0.6490686
1
Return a list of coordinate pairs corresponding to empty cells.
def get_empty_cells(grid): empty = [] for j,row in enumerate(grid): for i,val in enumerate(row): if not val: empty.append((j,i)) return empty
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_empty_cells(grid):\n\tempty = []\n\tfor j,row in enumerate(grid):\n\t\tfor i,val in enumerate(row):\n\t\t\tif not val:\n\t\t\t\tempty.append((j,i))\n\treturn empty", "def empty_cells(state):\r\n cells = []\r\n for x, row in enumerate(state):\r\n for y, cell in enumerate(row):\r\n ...
[ "0.82954764", "0.8106722", "0.7881721", "0.78399885", "0.7816201", "0.7774224", "0.76896685", "0.7566796", "0.75358933", "0.7367822", "0.7362139", "0.7313527", "0.72766584", "0.7221659", "0.7109574", "0.7071009", "0.7039268", "0.6926364", "0.6887955", "0.68496126", "0.6788944...
0.82016677
1
Return True if there are any legal moves, and False otherwise.
def any_possible_moves(grid): if get_empty_cells(grid): return True for row in grid: if any(row[i]==row[i+1] for i in range(len(row)-1)): return True for i,val in enumerate(grid[0]): column = get_column(grid, i) if any(column[i]==column[i+1] for i in range(len(col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_moves(self) -> bool:\n has_move = False\n for i in range(self.col):\n if self.valid_column(i):\n has_move = True\n return has_move", "def move_check(self):\r\n \r\n if not self.run:\r\n return False\r\n \r\n if se...
[ "0.8122529", "0.8110192", "0.8096249", "0.77616173", "0.7649458", "0.76147455", "0.7593725", "0.7536202", "0.7440056", "0.73899376", "0.7368411", "0.7345807", "0.7287204", "0.7261902", "0.7254304", "0.7252426", "0.72180545", "0.72180164", "0.71727824", "0.7166353", "0.7145243...
0.72813
13
Create the start grid and seed it with two numbers.
def get_start_grid(cols=4, rows=4): grid = [[0]*cols for i in range(rows)] for i in range(2): empties = get_empty_cells(grid) y,x = random.choice(empties) grid[y][x] = 2 if random.random() < 0.9 else 4 return grid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialise_grid(self, y, x, starting_value):\n # Create a grid of the specified size\n self.grid = np.zeros( (y, x), np.int8, 'C')\n \n # Record the sizes in the class variables\n self.x_len = x\n self.y_len = y\n \n # Set the initial values of the array\...
[ "0.6983808", "0.67746", "0.67650396", "0.67313075", "0.671295", "0.66989636", "0.66939414", "0.6584254", "0.65784186", "0.6501116", "0.65000474", "0.64921534", "0.6455021", "0.6447056", "0.6446712", "0.64312166", "0.6430318", "0.63990575", "0.6394991", "0.638411", "0.6352623"...
0.6732372
3
Spawn a new number on the grid; then return the result of any_possible_moves after this change has been made.
def prepare_next_turn(grid): empties = get_empty_cells(grid) y,x = random.choice(empties) grid[y][x] = 2 if random.random() < 0.9 else 4 return any_possible_moves(grid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_move(self, board: Board) -> int:\n return random.choice(board.get_valid_moves())", "def make_random_move(self):\n #raise NotImplementedError\n # Take out moves_made as well as mines detected\n self.available_cells = self.available_cells - self.moves_made - self.mines\n ...
[ "0.654521", "0.6313602", "0.61576533", "0.611579", "0.6070073", "0.6066896", "0.60657334", "0.6064535", "0.6063963", "0.6051181", "0.60117495", "0.6003177", "0.59357053", "0.5925953", "0.5923049", "0.5920323", "0.59143895", "0.58952975", "0.5845082", "0.5838226", "0.5835627",...
0.59611815
12
Print a pretty grid to the screen.
def print_grid(grid, score): print("") print(score) wall = "+------"*len(grid[0])+"+" print(wall) for row in grid: meat = "|".join("{:^6}".format(val) for val in row) print("|{}|".format(meat)) print(wall)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pprint_grid(grid):\n print(\"\\n\".join(\" \".join(str(r) for r in g) for g in grid))", "def pprint(self):\n pad = 4\n upper = [x/10 for x in range(GRID_SIZE)]\n lower = [x%10 for x in range(GRID_SIZE)]\n print(' ' * pad + ' '+' '.join(map(str,upper)))\n print(' ' * pad ...
[ "0.8028805", "0.7945838", "0.79075146", "0.78929245", "0.77925503", "0.7719303", "0.7642274", "0.7601472", "0.7596693", "0.7575378", "0.75460845", "0.74596643", "0.7437642", "0.74194914", "0.7346006", "0.7340486", "0.73038566", "0.72858113", "0.72404873", "0.7190595", "0.7171...
0.7343575
15
Get user input. Update game state. Display updates to user.
def main(**kwargs): print('Start') agent = initAgent(**kwargs) kwargs['agent'] = agent result = [] def mainsub(*args): game = Game(**kwargs) game.display(kwargs['noshow']) while True: # get_input = getch("Enter direction (w/a/s/d): ") get_input = game...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __update(self, input_):\n self.__process_input(input_)\n\n if not self.state.game_over:\n self.state.spawn_tail()\n self.state.try_move_player()\n if not self.state.game_over:\n self.state.cut_tail()\n self.state.eat_orbs()\n\n self.displa...
[ "0.69850993", "0.67855495", "0.65921575", "0.64569587", "0.6401348", "0.63877684", "0.62785655", "0.6236188", "0.62054324", "0.6199402", "0.6197533", "0.6182832", "0.6164093", "0.6140951", "0.6052755", "0.60166526", "0.600001", "0.5995582", "0.5991852", "0.59777373", "0.59767...
0.0
-1
Run the `MatdynBaseWorkChain` for a previously completed `Q2rCalculation`.
def launch_workflow( code, datum, kpoints_mesh, clean_workdir, max_num_machines, max_wallclock_seconds, with_mpi, daemon ): from aiida.orm import Bool from aiida.plugins import WorkflowFactory from aiida_quantumespresso.utils.resources import get_default_options inputs = { 'matdyn': { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_results(self):\n calculation_band = self.ctx.workchain_bands.get_outputs(link_type=LinkType.CALL)[0]\n\n self.report('workchain succesfully completed'.format())\n self.out('band_parameters', calculation_band.out.output_parameters)\n self.out('bandstructure', calculation_band.out...
[ "0.59128135", "0.5833753", "0.580722", "0.57799935", "0.56916016", "0.56724966", "0.5651713", "0.5503589", "0.5460664", "0.542434", "0.5414588", "0.54089665", "0.5379964", "0.5324118", "0.52958024", "0.52696687", "0.5269479", "0.52552825", "0.5249937", "0.52353233", "0.523010...
0.0
-1
Get the system user id of given `user`.
def _get_uid(self, user): if not isinstance(user, int): user = pwd.getpwnam(user).pw_uid return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_id(self, user):\n\n found_user = self.search(user)\n\n if found_user:\n return found_user[\"data\"][0][\"id\"]\n else:\n raise UserNotFound(\"User \" + user + \" not found.\")", "def get_user_id():\n return os.getuid()", "def _get_user_id(self, user: O...
[ "0.78394127", "0.72201926", "0.7206051", "0.71757543", "0.69904256", "0.69616765", "0.69289255", "0.6870075", "0.6840206", "0.67820036", "0.6742118", "0.6731155", "0.6718753", "0.671598", "0.6700523", "0.6700523", "0.6679785", "0.6679785", "0.663261", "0.66112316", "0.6611231...
0.72854525
1
Get the system user name of given `uid`.
def _get_uname(self, uid): try: return pwd.getpwuid(uid).pw_name except KeyError: return uid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_user_name():\n return pwd.getpwuid(os.getuid())[0]", "def get_user_name():\r\n if _user_name_override is not None:\r\n return _user_name_override\r\n elif platform.system() == \"Windows\":\r\n return os.getlogin()\r\n elif platform.system() == \"Linux\":\r\n try:\r\n ...
[ "0.77526003", "0.74957865", "0.72558403", "0.72035503", "0.7141105", "0.7099099", "0.7032858", "0.69628805", "0.6834799", "0.67754704", "0.6650063", "0.66139495", "0.66045195", "0.6583292", "0.6566232", "0.65561146", "0.6542888", "0.65071654", "0.6469562", "0.64543766", "0.64...
0.8196208
0
Check whether `path` is owned by `owner`, and it has the `mode`.
def _require_owner_mod(self, path, owner, mode, must_exist=False): if not os.path.exists(path): if must_exist: self.logger.warning('"%(path)s" is required but not exist.' % {'path': path}) return # get uid and file mode ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_same_owner(path):\n try:\n assert find_owner(path) == getuser(), f\"{path} must be owned by {getuser()}\"\n except AssertionError as error:\n raise click.UsageError(str(error))\n except FileNotFoundError:\n pass", "def check_perms(resource):\r\n stmode = os.stat(resour...
[ "0.665854", "0.6358101", "0.6358101", "0.6148049", "0.592861", "0.5894546", "0.5885529", "0.58449787", "0.582066", "0.5792091", "0.5770554", "0.57237005", "0.57046616", "0.5663423", "0.5608839", "0.5608839", "0.56082845", "0.560709", "0.55715185", "0.55554926", "0.5518401", ...
0.68992776
0
Creates the spaces on the board
def __init__(self): self.space1 = 0 self.space2 = 0 self.space3 = 0 self.space4 = 0 self.space5 = 0 self.space6 = 0 self.playerList = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_spaces():\n\n data.load('spaces')\n\n mc.refresh()\n spaces.build_all()", "def _create_spaces(self):\n raise NotImplementedError", "def prep_spaceships(self):\n self.spaceships = Group()\n for spaceship_number in range(self.stats.spaceships_left):\n spaceship...
[ "0.79622734", "0.77408296", "0.67985004", "0.6757565", "0.67566353", "0.66976947", "0.6674538", "0.6639435", "0.6610129", "0.6597271", "0.6523645", "0.65215886", "0.6497339", "0.648358", "0.6481085", "0.6469478", "0.6464682", "0.64284027", "0.6427209", "0.64159966", "0.639810...
0.0
-1
Sets space 1. Used for the player to take and place chips
def setS1(self, num): self.space1 = num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def give_space(self):\r\n pen.forward(20)", "def setS2(self, num):\n self.space2 = num", "def setS4(self, num):\n self.space4 = num", "def setupNewGame(self):\r\n self.level = 1\r\n self.num_cows = 2\r\n self.num_farmers = 1\r\n self.levelHeading = Text(self.gameDispl...
[ "0.648908", "0.6256856", "0.622479", "0.59005326", "0.5855918", "0.584492", "0.5798336", "0.5775155", "0.5761521", "0.5757626", "0.56840444", "0.567584", "0.5667802", "0.5648039", "0.56433135", "0.562361", "0.5606193", "0.55980283", "0.559422", "0.5589287", "0.5579349", "0....
0.69900984
0
Sets space 2. Used for the player to take and place chips
def setS2(self, num): self.space2 = num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPlayerTwo(self, boardSize):\n mid = int(boardSize / 2)\n for i in range(mid, boardSize):\n for j in range(mid, i + 1):\n temp = i - j\n x = i\n y = boardSize - 1 - temp\n self.addPion(Pion.Pion(self.noPlayer, Posisi.Posisi(...
[ "0.609539", "0.59154177", "0.5838363", "0.5738315", "0.55881906", "0.5528215", "0.5527765", "0.5523904", "0.54916984", "0.548473", "0.54332143", "0.54312956", "0.54301214", "0.5429926", "0.54089487", "0.539706", "0.5370935", "0.53638", "0.53439146", "0.53387654", "0.5334625",...
0.6854359
0
Sets space 3. Used for the player to take and place chips
def setS3(self, num): self.space3 = num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setSpace(*args):", "def give_space(self):\r\n pen.forward(20)", "def set_position(self, x, y, z):\n for sec in self.all:\n for i in range(int(nrn.n3d())):\n nrn.pt3dchange(i, \\\n x-self.x+nrn.x3d(i), \\\n y...
[ "0.5924214", "0.58395326", "0.574476", "0.5617801", "0.5536231", "0.5511567", "0.55061364", "0.5446015", "0.5417021", "0.5370311", "0.53616726", "0.5321982", "0.5320206", "0.53100693", "0.5288594", "0.52832794", "0.5230901", "0.52031595", "0.5191511", "0.5171889", "0.5143608"...
0.67878133
0
Sets space 4. Used for the player to take and place chips
def setS4(self, num): self.space4 = num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def give_space(self):\r\n pen.forward(20)", "def resetBoard(self):\n self.space1 = 0\n self.space2 = 0\n self.space3 = 0\n self.space4 = 0\n self.space5 = 0\n self.space6 = 0", "def setS5(self, num):\n self.space5 = num", "def setSpace(*args):", "def spacing(self, spacing):\n\n ...
[ "0.64468443", "0.6064833", "0.598866", "0.59127885", "0.576141", "0.57233346", "0.57063156", "0.5673211", "0.56223977", "0.55711496", "0.5570859", "0.5567136", "0.5544356", "0.55372965", "0.5534279", "0.55292845", "0.55286235", "0.54391205", "0.5392329", "0.5385134", "0.53777...
0.7290923
0
Sets space 5. Used for the player to take and place chips
def setS5(self, num): self.space5 = num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def give_space(self):\r\n pen.forward(20)", "def setS4(self, num):\n self.space4 = num", "def addS6(self):\n self.space6 += 1", "def resetBoard(self):\n self.space1 = 0\n self.space2 = 0\n self.space3 = 0\n self.space4 = 0\n self.space5 = 0\n self.space6 = 0", "def setS1(self...
[ "0.6360752", "0.6360656", "0.60956097", "0.6004102", "0.591427", "0.5885007", "0.5881092", "0.58527756", "0.5836404", "0.58263266", "0.57794124", "0.56868494", "0.5658177", "0.56414497", "0.5613952", "0.55858064", "0.55542696", "0.5495327", "0.5483208", "0.54149437", "0.54116...
0.7593468
0
Adds to space 6 since none can be taken from this space.
def addS6(self): self.space6 += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, num):\n self.__reserved_members = [Virus() for _ in range(num)]", "def part_6():\n\n raise NotImplementedError", "def add_objects_to_space(self):\n self.anti_spacecraft.add_to_space(self.space) # Anti-spacecraft Parts (represent the whole vehicle)\n self.space.add(self.sp...
[ "0.53742313", "0.5356937", "0.5167358", "0.515593", "0.5112406", "0.5082839", "0.5044318", "0.49988443", "0.49928892", "0.49881366", "0.4977138", "0.49732727", "0.49399695", "0.4932652", "0.4932652", "0.4932652", "0.4887998", "0.48813823", "0.48692477", "0.4863233", "0.485088...
0.79343045
0
Prints the board with formatting and prints the states of each space along with its space number
def printBoard(self): print(""" Space 1 Space 2 Space 3 Space 4 Space 5 Space 6 ------- ------- ------- ------- ------- -------""") print("{:>4}{:>10}{:>10}{:>10}{:>10}{:>10}".format(str(self.space1), str(self.space2), str(self.space3), str(self.space4), str(self.space5), str(self.space6))) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printBoard(self):\n\t\tkey = [' ', 'X', 'O']\n\t\tprint(' | |')\n\t\tprint(' ' + key[self.state[0][0]] + ' | ' + key[self.state[0][1]] + ' | ' + key[self.state[0][2]])\n\t\tprint(' | |')\n\t\tprint('-----------')\n\t\tprint(' | |')\n\t\tprint(' ' + key[self.state[1][0]] + ' | ' + key[self.state[1][...
[ "0.8112229", "0.79741305", "0.7885762", "0.78000104", "0.77455604", "0.774023", "0.7650805", "0.76314026", "0.75902826", "0.7519616", "0.7497293", "0.74494785", "0.7440594", "0.7433535", "0.7420083", "0.7405615", "0.7404652", "0.7397097", "0.7395251", "0.7395251", "0.739234",...
0.7848291
3
Adds the players to a list and sorts them by who had the lowest initial dice rolls and if there are people who had the same dice roll it returns a false which gets the main client code to prompt the player class to reroll its initial roll
def addPlayers(self, player): if len(self.playerList) == 0: self.playerList.append(player) else: i = 0 for item in self.playerList: if player.compareTo(item) == -1: self.playerList.insert(i,player) return(True) elif player.compareTo(item) == 0: pla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sixteen_is_dead(players):\n \n number = setup_number_of_dices()\n faces = setup_number_of_faces()\n result_list = []\n for player in range(1, players+1):\n total_points = 0\n while total_points < 16:\n user_input = user_interface(player)\n if user_input == \"\...
[ "0.6164179", "0.59093684", "0.58791447", "0.58399826", "0.5808645", "0.5789685", "0.5758518", "0.57551587", "0.574693", "0.57403266", "0.57224333", "0.5636663", "0.56151736", "0.5586196", "0.55676913", "0.5547949", "0.55419695", "0.5520167", "0.55043435", "0.5502129", "0.5489...
0.6229501
0
Gets the player list
def getPlayerList(self): return(self.playerList)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _player_list(self):\n game = self.ctrl.game\n return game.players[self.i_to_player_id(0)], game.players[self.i_to_player_id(1)]", "def get_players(self):\n\n # Append the current player to the list and return it\n players_list = list(self._players.queue)\n players_list.appe...
[ "0.84512764", "0.7847707", "0.7833121", "0.7736268", "0.7659726", "0.76551896", "0.7576859", "0.75621367", "0.74152815", "0.7401695", "0.7394392", "0.7308477", "0.73007417", "0.7262631", "0.72595024", "0.7234624", "0.72236747", "0.72043324", "0.71869403", "0.71733487", "0.715...
0.8480106
0
Resets the player list
def resetPlayerList(self): self.playerList = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clearList(self):\r\n self.players.clear()", "def reset(self):\n self.board_cards = []\n self.position = -1\n self._reset_players()", "def Reset(self): \r\n self.player_draws.clear()\r\n self.player_points.clear()\r\n self.num_players=0\r\n self.car...
[ "0.83051455", "0.7911027", "0.76908463", "0.7556388", "0.74714035", "0.7445043", "0.73784745", "0.7369854", "0.73216003", "0.71424335", "0.7129414", "0.7110906", "0.7039333", "0.7008726", "0.697688", "0.6962779", "0.69450843", "0.6891331", "0.6891331", "0.68692124", "0.683343...
0.9049031
0
Prints the player order in the order that they roll the dice during the game.
def printPlayerOrder(self): print("The order of players is ...") print() for i in range(len(self.playerList)): print("\t" + str(i+1) + ".", end = " ") print(self.playerList[i]) print()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_dice(self):\n\n stage_to_print = 3 if self.current_stage == 4 else self.current_stage\n print(\"You rolled:\\n a = [ {} ]\\n b = [ {} ]\\n\\nYou are in Stage {}\"\n .format(self.die_a, self.die_b, stage_to_print))", "def display_current_dice(self):\n print(\"You rolled:...
[ "0.7036044", "0.68171906", "0.64965594", "0.6425018", "0.62958133", "0.62821066", "0.62800306", "0.62373453", "0.6219937", "0.62110054", "0.61861604", "0.607185", "0.60702354", "0.6064018", "0.6057145", "0.6055642", "0.60338086", "0.59997267", "0.59900594", "0.59423006", "0.5...
0.81367517
0
Creates 6 seperate instances of player classes and then adds them to the list one at a time. Also querries the user for all the info needed about the number of players and what the name of each player is.
def createPlayers(self, board): tempVar = 0 while tempVar == 0: try: numPlayers = int(input("How many players do you want to have?\n")) if numPlayers >= 2 and numPlayers <= 6: tempVar = 1 else: print("Thats not the right amount of players please have 2-6 players...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, number_players=1000):\n self.player_list = []\n for i in range(number_players):\n self.player_list.append(Player())", "def create_players_list(self):\n for p in self.players_names:\n self._players_list.append(Player(p))", "def create_players(self):\...
[ "0.75591594", "0.72684765", "0.7247135", "0.68953395", "0.68925375", "0.6859129", "0.67438704", "0.6526592", "0.6520673", "0.64837843", "0.64440024", "0.6432066", "0.64035606", "0.6356224", "0.63258445", "0.6307039", "0.6303731", "0.6240516", "0.6229378", "0.62157303", "0.620...
0.6682038
7
Resets all values on the board to zero
def resetBoard(self): self.space1 = 0 self.space2 = 0 self.space3 = 0 self.space4 = 0 self.space5 = 0 self.space6 = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self, board):", "def resetBoard(self):\n\t\tself.board = np.zeros((self.boardSize,self.boardSize))", "def resetBoard(self):\n\t\tself.board = np.zeros((self.boardSize,self.boardSize))", "def resetBoard(self):\n pass", "def reset_board(self):\n\n self.board = np.array(self.initial_bo...
[ "0.8115818", "0.7757122", "0.7757122", "0.7633754", "0.7617267", "0.75734997", "0.7470113", "0.74428475", "0.7372754", "0.73664916", "0.7353308", "0.732944", "0.73151636", "0.7290008", "0.7249329", "0.72266376", "0.7198487", "0.71958363", "0.7183818", "0.7174716", "0.7174449"...
0.7828157
1
Prints the instructions for the game at the beginning of each game.
def printInstructions(self): print("""• Aim of the Game is to be the first to lose all of your chips • Players are put in order of the lowest to highest based on their first roll (This is done automatically when you enter your name) • You start out with 5 chips. • When it is your turn you roll the die. \t• If the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_start_game():\n print(HANGMAN_ASCII_ART)\n print(MAX_TRIES)", "def intro_instructions():\n print(\"The board will be updated after each move.\")\n print(\"Watch both the board and the python prompt after each move.\")\n print(\"Player 1 is white and player 2 is orange\")\n pri...
[ "0.75664604", "0.75576234", "0.7343397", "0.7205638", "0.7085444", "0.69434893", "0.68400097", "0.6774968", "0.6768967", "0.67581797", "0.66591454", "0.66450673", "0.65986973", "0.6578564", "0.6566048", "0.65402794", "0.6506335", "0.64566976", "0.645085", "0.642778", "0.64216...
0.7171125
4
Calculate the geometric weighted mean.
def calculate_average(precisions, weights): tmp_res = 1 for id, item in enumerate(precisions): tmp_res = tmp_res*np.power(item, weights[id]) tmp_res = np.power(tmp_res, np.sum(weights)) return tmp_res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geometric_mean(data):\n return pow(reduce(lambda v, mem: v * mem, data, 1.0), 1 / float(len(data)))", "def mean(self):\n return self.sum / self.sum_weights", "def geometric_mean(xs):\n p = 1.0\n for num in xs:\n p = p * num\n return (p)**(1.0/len(xs))", "def fgeometricmean(items...
[ "0.74644405", "0.7375847", "0.73467445", "0.6981383", "0.69608015", "0.69426095", "0.68657875", "0.68560356", "0.684343", "0.682892", "0.68230575", "0.68143964", "0.676093", "0.6732658", "0.6705487", "0.667591", "0.65917677", "0.6528733", "0.6524156", "0.6521296", "0.65120673...
0.61931413
71
Calculate the count of gram_list in candidate.
def calculate_candidate(gram_list, candidate): gram_sub_str = ' '.join(gram_list) return len(re.findall(gram_sub_str, candidate))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_candidate(gram_list, candidate):\n gram_sub_str = ' '.join(gram_list)\n return len(re.findall(gram_sub_str, candidate))", "def _count_ngram(ngram_input_list: Sequence[str], n_gram: int) ->Counter:\n ngram_counter: Counter = Counter()\n for i in range(1, n_gram + 1):\n for j in ra...
[ "0.7786504", "0.6955796", "0.6907873", "0.6830941", "0.6794327", "0.671934", "0.64967024", "0.6346814", "0.6268384", "0.62342256", "0.6189109", "0.6189109", "0.6109382", "0.5960297", "0.59168494", "0.588593", "0.5845502", "0.5845156", "0.5819503", "0.58000195", "0.57985204", ...
0.78204966
0
Calculate the count of gram_list in references
def calculate_reference(gram_list, references): gram_sub_str = ' '.join(gram_list) gram_count = [] for item in references: # calculate the count of the sub string gram_count.append(len(re.findall(gram_sub_str, item))) return gram_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_reference(gram_list, references):\n gram_sub_str = ' '.join(gram_list)\n gram_count = []\n for item in references:\n # calculate the count of the sub string\n gram_count.append(len(re.findall(gram_sub_str, item)))\n return gram_count", "def _calc_refs(counts):\n refs = ...
[ "0.8647627", "0.689659", "0.6763122", "0.6518512", "0.6485166", "0.6414057", "0.6387156", "0.6300615", "0.6289671", "0.6286565", "0.62701064", "0.6248385", "0.62226564", "0.6220881", "0.6185307", "0.6133009", "0.6123148", "0.61110526", "0.60962856", "0.6092867", "0.6092867", ...
0.86743796
0
PaymentTerm a model defined in OpenAPI
def __init__(self, bills=None, sales=None): # noqa: E501 # noqa: E501 self._bills = None self._sales = None self.discriminator = None if bills is not None: self.bills = bills if sales is not None: self.sales = sales
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPayment(self):\n pass", "def __init__(self, **kwargs):\n self.swagger_types = {\n 'key': 'str',\n 'display_name': 'str',\n 'description': 'str',\n 'glossary_key': 'str',\n 'parent_term_key': 'str',\n 'is_allowed_to_have_child_...
[ "0.56384003", "0.56051445", "0.5356209", "0.53400826", "0.53394", "0.5331051", "0.5324713", "0.5185442", "0.5158734", "0.5141055", "0.50998044", "0.509521", "0.50541997", "0.50512636", "0.50399333", "0.5034051", "0.4986181", "0.4943282", "0.49380204", "0.49260488", "0.4916444...
0.0
-1
Sets the bills of this PaymentTerm.
def bills(self, bills): self._bills = bills
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, bills=None, sales=None): # noqa: E501 # noqa: E501\n\n self._bills = None\n self._sales = None\n self.discriminator = None\n\n if bills is not None:\n self.bills = bills\n if sales is not None:\n self.sales = sales", "def bills():\n ...
[ "0.55518144", "0.5310862", "0.5198775", "0.5156278", "0.50817764", "0.5029538", "0.50045544", "0.5002613", "0.4951056", "0.49510494", "0.48997986", "0.47876436", "0.4785741", "0.47471455", "0.46833822", "0.4663396", "0.45678157", "0.45547917", "0.4549016", "0.45235193", "0.44...
0.8075642
0
Sets the sales of this PaymentTerm.
def sales(self, sales): self._sales = sales
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_sales_rep(self, sales_rep):\r\n self._sales_rep = sales_rep", "def sells(self, sells):\n\n self._sells = sells", "def sales(self):\n\n # Scalar to range (consider creating function for this)\n if np.isscalar(self.demand_decr):\n self.demand_decr = np.full((1, self...
[ "0.6126827", "0.602496", "0.56689394", "0.5279737", "0.5215819", "0.5194685", "0.51591015", "0.4797136", "0.47962275", "0.47865313", "0.47671393", "0.4763767", "0.4688577", "0.46609876", "0.46363702", "0.46235058", "0.46217558", "0.46022666", "0.45736754", "0.45663998", "0.45...
0.8079007
0
Create an empty Photons object. This is really just to show what the derived classes must define. If I ever see a need to be able to create Photons objects using arrays of data in the future, then I'll rewrite this.
def __init__(self, **kwargs): # metadata associated with the observations that recorded the photons, one list entry for each observation self.obs_metadata = kwargs.get('obs_metadata', [{}]) self.time_datum = kwargs.get('time_datum', _time.Time('2000-01-01T00:00:00')) if 'photons' in k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__ ( self , phenotypes ) :\n\t\tfor k , v in phenotypes.items():\n\t\t\tassert type( k ) is str , 'phenotype keys must be strings'\n\t\t\tassert v[1] > v[0] , 'upper bound of ' + k + ' must be greater than the lower bound'\n\t\t\tassert type( v[1] ) is int and type( v[0] ) is int, ' (!) recent change mea...
[ "0.60640657", "0.601847", "0.55676204", "0.55450207", "0.5437708", "0.541573", "0.5392707", "0.53442997", "0.53347486", "0.53196114", "0.53183806", "0.531801", "0.5295788", "0.52910954", "0.5272742", "0.5253814", "0.5213456", "0.51865983", "0.51763284", "0.5156536", "0.513638...
0.49558195
42
Merge observations that have the same exposure times in place.
def merge_like_observations(self, overlap_handling="adjust Aeff", min_rate_ratio=0.5): def get_signal(): if 'r' in self: signal = self['r'] > 0 else: signal = _np.ones(len(self), bool) return signal signal = get_signal() # make...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_orders(self, overlap_handling=\"adjust Aeff\"):\n\n # split into separate photons objects for each observation, and split the orders within that observation into\n # faux separate observations, then merge them\n if len(self.obs_times) > 1:\n separate = [self.get_obs(i) for...
[ "0.5370777", "0.53692865", "0.531485", "0.5142003", "0.5070778", "0.5064868", "0.505093", "0.5038538", "0.50028855", "0.49981388", "0.49660435", "0.49648497", "0.4962812", "0.49279064", "0.49048823", "0.48895195", "0.4877224", "0.48613888", "0.48542717", "0.48448008", "0.4829...
0.5507637
0
Merge the orders in each observation in place.
def merge_orders(self, overlap_handling="adjust Aeff"): # split into separate photons objects for each observation, and split the orders within that observation into # faux separate observations, then merge them if len(self.obs_times) > 1: separate = [self.get_obs(i) for i in range(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orders(self, orders):\n\n self._orders = orders", "def orders(self, orders):\n\n self._orders = orders", "def add_orders(self, response_data):\n orders = response_data[self.DATA][self.DATA]\n for order in orders:\n self.orders.append(self.process_order_data(order))", ...
[ "0.586836", "0.586836", "0.57435864", "0.55714554", "0.55012214", "0.5470867", "0.5441464", "0.5425784", "0.5357006", "0.5336386", "0.5326964", "0.52989537", "0.5288738", "0.52683765", "0.5259434", "0.5259434", "0.52486", "0.5215949", "0.5214064", "0.52139366", "0.52069664", ...
0.6861683
0
When adding, the photon recarrays will be added. The observation numbers will be adjusted or added as appropriate and times will be referenced to the first of the two objects.
def __add__(self, other): if not isinstance(other, Photons): raise ValueError('Can only add a Photons object to another Photons object.') # don't want to modify what is being added other = other.copy() # make column units consistent with self other.match_units(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__ ( self, other, resample_opts=None ):\n result = ObservationStorage (datadir=self.datadir, \\\n resample_opts=resample_opts )\n if self.date[0] > other.date[0]:\n start_date = other.date[0]\n else:\n start_date = self.date[0]\n if self.date[-1...
[ "0.61430186", "0.58678955", "0.5672647", "0.56705725", "0.56213546", "0.55732477", "0.55628985", "0.5520685", "0.551362", "0.54867333", "0.54829043", "0.5465281", "0.5434063", "0.54020816", "0.53678995", "0.53363043", "0.5323221", "0.53189373", "0.52950954", "0.5290331", "0.5...
0.657136
0
Modifies the Photons object inplace to have a new time datum. Default is to set to the time of the earliest photon.
def set_time_datum(self, new_datum=None): if new_datum is None: dt = _time.TimeDelta(self['t'].min(), format=self['t'].unit.to_string()) new_datum = self.time_datum + dt else: dt = new_datum - self.time_datum dt = dt.to(self['t'].unit).value # ensure ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_time(self):\n pass # Do nothing", "def setTimepoint(self, tp):\n\t\tpass", "def change_time(self, new_time):\r\n self.when = new_time", "def set_time(self, time):\n self._time = time", "def update_timestamp(self):\n self._timestamp = datetime.datetime.now()", "def ...
[ "0.6607164", "0.6334444", "0.6280729", "0.6252302", "0.62219167", "0.6194368", "0.61878926", "0.6179244", "0.61751014", "0.61751014", "0.61751014", "0.61751014", "0.61751014", "0.6143386", "0.61251175", "0.61251175", "0.6088479", "0.60619813", "0.59638584", "0.59400856", "0.5...
0.68505067
0
Converts the units of each column in self to the units of hte corresponding column in other, if mathcing columns are present.
def match_units(self, other): for key in self.photons.colnames: if key in other.photons.colnames: if other[key].unit: unit = other[key].unit if str(unit).lower() == 'none' and str(self[key].unit).lower() == 'none': conti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_units(self):\n for prod in (\"ier\", \"ier_inc_rain\"):\n self.data[prod].data[:] /= 1e6", "def unit_convert(df, coln1, coln2, unit, conversion_factor, coln3):\n df.loc[df[coln2] == unit, coln1] = conversion_factor * df[coln3]\n return df", "def table_standardise_units_inpla...
[ "0.6352647", "0.60670984", "0.60323286", "0.58100045", "0.57413846", "0.56471616", "0.564188", "0.5630694", "0.5610457", "0.5551951", "0.55241525", "0.5483095", "0.5481531", "0.5478554", "0.54472667", "0.5417077", "0.53583586", "0.5329351", "0.5301925", "0.5285195", "0.526069...
0.61165273
1
Adds a column for observation identifiers (to match the index of the observation metadata list item) to self, if such a column is not already present.
def add_observations_column(self): if 'n' not in self: if len(self.obs_metadata) > 1: raise ValueError('Photons cannot be assigned to multiple observations because who the F knows which ' 'obseration they belong to?') n_ary = _np.zeros(len...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addcolumn(self, column):\n if column not in self.headersindex:\n database = managers.database_manager.get_database(self.owner_id, self.database_id)\n cur = database.get_connection().cursor()\n cur.execute(\"ALTER TABLE \\'%s\\' ADD COLUMN %s\" % (self.name, column.to_dec...
[ "0.641421", "0.63847977", "0.6362498", "0.6128525", "0.6002409", "0.5793465", "0.5778264", "0.5743284", "0.57366264", "0.57016885", "0.56774724", "0.56123185", "0.5503181", "0.54618996", "0.5451175", "0.5437319", "0.54266304", "0.53758425", "0.530904", "0.5306818", "0.5290313...
0.62367916
3
Provides a simple means of divyying photons into signal and background regions (and adding/updating the associated 'r' column, by specifying limits of these regions in the y coordinate. Users can implement more complicated divvying schemes (such as changing signal and background region sizes) by simply creating their o...
def divvy(self, ysignal, yback=(), order=None): # groom the input ysignal, yback = [_np.reshape(a, [-1, 2]) for a in [ysignal, yback]] assert order is None or type(order) == int # join the edges into one list edges, isignal, iback, area_ratio = self._get_ribbon_edges(ysignal, y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtract_linear_bg(region, y_data='final', manual_bg=None, by_min=False, add_column=True, overwrite=True):\n\n def calculate_line(min_position):\n \"\"\"Helper function to calculate the line cross the whole\n spectrum given coordinates of two points and \"left\" or \"right\" value\n of ...
[ "0.5648867", "0.55523235", "0.54767585", "0.5412505", "0.5409024", "0.5406911", "0.53933746", "0.53664154", "0.52778184", "0.5276052", "0.5174173", "0.5171647", "0.5138326", "0.5116107", "0.51085496", "0.5107197", "0.50585103", "0.5057251", "0.5042395", "0.5042282", "0.502315...
0.5043511
18
Removes superfluous counts those that aren't in a signal region or background region.
def squish(self, keep='both'): if 'r' not in self: raise ValueError('Photon object must have an \'r\' column (specifying a region weight) before it can be ' 'squished.') valid_keeps = ['both'] + ['back', 'background', 'bg'] + ['signal'] if keep not in val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unoccupied(self):\n self.is_occupied = 0\n for hex in self.fon:\n hex.remove_neighbor()\n hex.set_quality()", "def clear(self):\n self.counts = [0] * len(self.values)\n if HAS_NUMPY:\n self.counts = numpy.array(self.counts)", "def _suppress_bg_dc...
[ "0.5698115", "0.5673671", "0.5658862", "0.558106", "0.55611473", "0.5521163", "0.550225", "0.54575974", "0.5427708", "0.5410391", "0.5393858", "0.5389864", "0.53846145", "0.537851", "0.5351912", "0.5340736", "0.5339591", "0.5332061", "0.5330627", "0.5299252", "0.52937067", ...
0.0
-1
Returns a bollean array where the first dimension corresponds to the bnadpass and the second to the observation where observations that fully include the bandpass are marked True.
def check_wavelength_coverage(self, bandpasses): covered_bands = [] for band in bandpasses: covering_obs = [] for obs_bands in self.obs_bandpasses: covering = _np.any((band[0] >= obs_bands[:,0]) & (band[1] <= obs_bands[:,1])) covering_obs.append(c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bw(self):\n return np.array([b2 - b1 for b1, b2 in self.bands])", "def get_bin_band_arr(self):\n\n fn = self._lib['cwtObj_getBinBandArr']\n fn.argtypes = [POINTER(OpaqueCWT)]\n fn.restype = c_void_p\n p = fn(self._obj)\n ret = np.frombuffer((c_int * self.num).fro...
[ "0.60271466", "0.59829885", "0.5586404", "0.55860716", "0.5573289", "0.5526672", "0.55128306", "0.5490628", "0.5452374", "0.545201", "0.5414951", "0.5401427", "0.5385222", "0.53792757", "0.5354108", "0.53100234", "0.5309801", "0.5302668", "0.5298991", "0.52877575", "0.5275696...
0.5343143
15
Compute the cumulative time of the observations. Returns
def total_time(self): obs_times = self.clean_obs_times() return _np.sum(obs_times[:, 1] - obs_times[:, 0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cumulate(self):\n name = self.getName() + '_Cumulated'\n c_names = self.getColumnNames()\n # create the new table an add the first column to it\n t_cumulate = DataTable(name)\n time = self.getColumn(0)\n t_cumulate.addColumn(c_names[0],time)\n # for each other c...
[ "0.661021", "0.6383181", "0.6265506", "0.62239486", "0.62239486", "0.62239486", "0.6206423", "0.60860175", "0.6071931", "0.60464954", "0.5963435", "0.59059876", "0.589834", "0.58912027", "0.58884025", "0.58699846", "0.5856842", "0.58202827", "0.58170724", "0.58063585", "0.579...
0.7168127
0
Computes energy per effective area, applying weights (if available). No distinction is made between background and signal counts. Returns epera
def _compute_epera(self, units='erg'): if 'a' not in self: raise ValueError('Photons must have effective area data to permit the computation of fluxes.') energy = _const.h * _const.c / self['w'] energy = energy.to(units).value epera = energy / self['a'] return epera
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_energy(self):\n temp_e = 0\n\n for i in range(0,self.neuron_count):\n for j in range(0, self.neuron_count):\n if i != j:\n temp_e += self.get_weight(i, j) * self.current_state[i] * \\\n self.current_state[j]\n re...
[ "0.67550355", "0.65011144", "0.6412281", "0.63132465", "0.6304825", "0.6157981", "0.61240315", "0.60584134", "0.60072523", "0.60027325", "0.59518224", "0.59330714", "0.59209657", "0.59109896", "0.58882797", "0.5882908", "0.5837159", "0.58316195", "0.5821723", "0.5786851", "0....
0.69066924
0
Compute an npoint moving sum of the data in vector x. Result will have a length of len(x) (n1). Using loop avoids the accumulated errors that can result from using numpy.cumsum, though cumsum is (probably) faster.
def _smooth_sum(x, n): m = len(x) result = _np.zeros(m - (n-1)) for i in range(n): result += x[i:(m-n+i+1)] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_mean(x, N):\n cumsum = np.cumsum(np.insert(x, 0, 0)) \n return (cumsum[N:] - cumsum[:-N]) / float(N)", "def running_mean(x, N):\n cumsum = np.cumsum(np.insert(x, 0, 0))\n return (cumsum[N:] - cumsum[:-N]) / float(N)", "def moving_sum(x, back, forward):\n bs, n_heads_mono, n_h...
[ "0.6777347", "0.66602695", "0.6657788", "0.6452437", "0.6445342", "0.64377373", "0.639484", "0.6387214", "0.6319946", "0.6303997", "0.62510145", "0.6246268", "0.6218636", "0.61660457", "0.6135385", "0.61169654", "0.61049765", "0.60991657", "0.60791415", "0.6040553", "0.597721...
0.65586084
3
integrate(wa, wb, gap_handling='error') integrate(ranges, gap_handling='error') Integrate a range or set of ranges in a spectrum.
def integrate(self, *args): wbin = Spectrum._groom_integration_ranges(*args) try: wbin.to(self.w.unit) except AttributeError as xxx_todo_changeme: _u.UnitConversionError = xxx_todo_changeme raise ValueError('Input must be astropy quantity with units ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integrate(self, *args, **kws):\n gap_handling = kws.get('gap_handling', 'error')\n wbin = Spectrum._groom_integration_ranges(*args)\n\n # check for gap overlap\n # sometimes small numerical errors cause trouble, so compare to size\n # of pixels\n if self.any_gap_overal...
[ "0.7561628", "0.629409", "0.6022133", "0.5990441", "0.5945802", "0.589766", "0.5800456", "0.57025635", "0.5670215", "0.5635362", "0.5605366", "0.550595", "0.5474466", "0.54456025", "0.54328984", "0.5427082", "0.53748286", "0.53633803", "0.53340495", "0.5246296", "0.5215325", ...
0.7197214
1
format keyword kept for back compatability
def read_muscles(cls, path, format=None): try: path = _tbl.Table.read(path, hdu=1) except: pass try: w0, w1, f, e = [path[s].quantity for s in ['w0', 'w1', 'flux', 'error']] except KeyError: w0, w1, f, e = [p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asformat(self, format):", "def format(self, *args, **kwargs) -> String:\n pass", "def format(self) -> str:", "def format(self):\n ...", "def __format__(self, *args, **kwargs): # real signature unknown\r\n pass", "def formatted(self) -> str:\r\n ...", "def format(self, messag...
[ "0.8529356", "0.80771524", "0.80636275", "0.8048893", "0.7962126", "0.7755595", "0.74167365", "0.737658", "0.7271285", "0.72292227", "0.71837986", "0.7181581", "0.7059595", "0.7056836", "0.7004883", "0.7004883", "0.69795346", "0.6936098", "0.6889068", "0.68648016", "0.6670813...
0.0
-1
Reads in a spectrum from the BTSETTL models from
def read_bt_settl(cls, path, DF=-8): w, f = [], [] with open(path) as file: for line in file: pieces = line.split() _w, logf = pieces[:2] _w = float(_w) logf = logf.replace('D', 'E') _f = 10**(float(logf) + DF) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spectrum(self):\r\n f, spectrum = tsa.get_spectra(self.input.data, method=self.method)\r\n return spectrum", "def model_spectrum(infile, txt=False, dataframe=False, alpha=None, temp=None,\n wmin=40., wmax=300., df_index=0):\n if txt:\n power_law = False\n blac...
[ "0.62477744", "0.5998323", "0.58866525", "0.588349", "0.57493764", "0.5725306", "0.56513405", "0.56495297", "0.56003684", "0.5593395", "0.5588688", "0.55714035", "0.5541813", "0.55410665", "0.54591894", "0.54219526", "0.54188335", "0.54152894", "0.5404291", "0.53843737", "0.5...
0.6723388
0
Read in a spectrum.
def read(cls, path_or_file_like): if type(path_or_file_like) is str and not path_or_file_like.endswith(cls.file_suffix): raise IOError('Can only read {} file.'.format(cls.file_suffix)) tbl = _table.Table.read(path_or_file_like, format='ascii.ecsv') w, dw, y = [tbl[s].quantity for s ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_data(self):\n self.data = reduce_spectrum(self.filename)", "def read_spectrum(self, row, col):\n\n if self.format == 'ASCII':\n return self.data\n else:\n frame = self.get_frame(row)\n return frame[col]", "def read_spectrum(specfile):\n hdu = py...
[ "0.7195971", "0.71561295", "0.6994208", "0.6935192", "0.6782869", "0.67344946", "0.6661186", "0.665087", "0.65387726", "0.6476322", "0.6459173", "0.6454447", "0.64233994", "0.6415026", "0.638372", "0.6346141", "0.6319661", "0.6290925", "0.6265304", "0.6263679", "0.6239793", ...
0.6091102
25
Can provide a list of spectra or lists of components (w, y, ...) to be fed to spectra.
def __init__(self, *args, **kws): if len(args) == 1 and isinstance(args[0][0], Spectrum): self.__dict__['spectra'] = args[0] else: # unpack lists of spectral data spectra = [] for i in range(len(args[0])): single_args = [val[i] for val in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coadd_spectra(spec_list_fits, out_name, scale_spectra=True,\r\n use_ratios=False, ratio_range=[4200, 4300], \r\n one_side=True):\r\n\r\n spec_list_txt = [f.replace('fits', 'txt') for f in spec_list_fits]\r\n\r\n # first spectrum in the list is always the reference spectrum\r\n hdr = pyfits.gethe...
[ "0.66295034", "0.6307131", "0.6216871", "0.620097", "0.607994", "0.6038671", "0.5967815", "0.5922687", "0.5902068", "0.5787933", "0.57562244", "0.5705096", "0.56951225", "0.5676886", "0.565541", "0.56542706", "0.5631957", "0.55930954", "0.55470324", "0.5541975", "0.551725", ...
0.54956204
22
integrate(wa, wb, gap_handling='error') integrate(ranges, gap_handling='error') Integrate a range or set of ranges in a spectrum.
def integrate(self, *args, **kws): gap_handling = kws.get('gap_handling', 'error') wbin = Spectrum._groom_integration_ranges(*args) # check for gap overlap # sometimes small numerical errors cause trouble, so compare to size # of pixels if self.any_gap_overalp(wbin): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integrate(self, *args):\n wbin = Spectrum._groom_integration_ranges(*args)\n try:\n wbin.to(self.w.unit)\n except AttributeError as xxx_todo_changeme:\n _u.UnitConversionError = xxx_todo_changeme\n raise ValueError('Input must be astropy quantity with units...
[ "0.7198446", "0.62951845", "0.60250896", "0.5992881", "0.5947427", "0.58993167", "0.58005035", "0.57049096", "0.56705976", "0.56361306", "0.56049377", "0.5507031", "0.54753643", "0.5445079", "0.5433137", "0.5429304", "0.53761375", "0.5365952", "0.533674", "0.5247461", "0.5218...
0.7562714
0
Set the passphrase used in TKIP and AES, and generate the PMK.
def setPassphrase( self , passphrase ): self.passphrase = passphrase # Generate and log the generated PMK. self.PMK = pbkdf2_bin( self.passphrase , self.ssid , 4096 , 32 ) self.logger.logKey( 'Pairwise Master Key' , self.PMK )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _derive_key(\n self, passphrase: str, otp: YubikeyOTP, *args : bytes\n ) -> bytes:\n return self._context_kdf.derive(\n combine_keys(\n passphrase.encode('utf-8'),\n otp.token.private_uid,\n *args\n )\n ...
[ "0.635851", "0.6265482", "0.60787463", "0.60269797", "0.59361345", "0.59193933", "0.5915363", "0.5894473", "0.5868643", "0.5863321", "0.5812229", "0.5701552", "0.5696947", "0.5637236", "0.56315845", "0.562272", "0.5610249", "0.5602456", "0.5577322", "0.5542072", "0.5514838", ...
0.7733064
0
Set the cryptographic handlers for encapsulation and decapsulation.
def setCryptographicHandlers( self , tkip = None , aes = None ): self.handleTKIP = tkip self.handleAES = aes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addHandlers(self, handlers):\n self._eventHandlers.update(handlers)\n keys = self._eventHandlers.keys()\n pygame.event.set_allowed(keys)", "def set_jwt_handlers(jwt):\n\n @jwt.authentication_handler\n def authenticate(username, password):\n pass\n\n @jwt.jwt_error_handler...
[ "0.5776411", "0.5599662", "0.5444123", "0.54365975", "0.53574115", "0.5248126", "0.521632", "0.51826847", "0.51620126", "0.5043949", "0.50299275", "0.5027302", "0.49723986", "0.49723986", "0.49191386", "0.49123454", "0.48952657", "0.48635775", "0.48069152", "0.48056138", "0.4...
0.6715883
0
Assert that the EAPoL WPA Key layer has a valid MIC.
def __assertWPAKeyMIC( self , packet , digest ): # Get the Key Information and assert that the MIC bit was set. keyinfo = packet.getlayer( EAPOL_WPAKey ).KeyInfo flaglist = self.__getFlaglist( keyinfo ) assert( 'mic' in flaglist ), \ 'The MIC flag in the EAPoL WPA Key layer was not set.' # Save the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkMIC(self, key):\n\n # Calculate the MIC for this message using key\n msg = self.mhdr.encode() + self.payload.encode()\n B0 = struct.pack('<BLBLLBB',\n int('0x49', 16), 0, 0, self.payload.fhdr.devaddr,\n self.payload.fhdr.fcnt, 0, len(msg...
[ "0.70442915", "0.6647134", "0.5537131", "0.54686534", "0.5328444", "0.5293856", "0.52469015", "0.5200082", "0.5188678", "0.51047045", "0.5049053", "0.49658602", "0.49283254", "0.4926165", "0.49239734", "0.48833504", "0.48811823", "0.48766124", "0.4874867", "0.48511982", "0.48...
0.77989507
0
Generates the integer for the Key Information field. Note that not all the bits defined in the specification are supported here. Ref. IEEE 802.11i specification; EAPOLKey frames.
def __getKeyInformation( self , flaglist ): keyinfo = 0 if 'HMAC_MD5_RC4' in flaglist: keyinfo = setBit( keyinfo , 0 ) if 'HMAC_SHA1_AES' in flaglist: keyinfo = setBit( keyinfo , 1 ) if 'group' in flaglist: pass if 'pairwise' in flaglist: keyinfo = setBit( keyinfo , 3 ) if 'idx0' in flaglist: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_bits(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"key_bits\")", "def calc_keyid(flags, protocol, algorithm, st):\n # Remove spaces and create the wire format\n st0=st.replace(' ', '')\n st2=struct.pack('!HBB', int(flags), int(protocol), int(algorithm))\n st2+=base64.b64de...
[ "0.6220905", "0.6191316", "0.6121069", "0.60238856", "0.60238856", "0.6003645", "0.5966623", "0.5899271", "0.58622986", "0.5769623", "0.5755905", "0.5741465", "0.5740746", "0.57384217", "0.56625897", "0.56585544", "0.5632151", "0.5576915", "0.55752677", "0.5569453", "0.556275...
0.6726099
0
Generates the flaglist from the Key Information field. Note that not all the bits defined in the specification are supported here. Ref. IEEE 802.11i specification; EAPOLKey frames.
def __getFlaglist( self , keyinfo ): flaglist = [] if( getBit( keyinfo , 0 ) == 1 ): flaglist.append( 'HMAC_MD5_RC4' ) if( getBit( keyinfo , 1 ) == 1 ): flaglist.append( 'HMAC_SHA1_AES' ) if( getBit( keyinfo , 3 ) == 0 ): flaglist.append( 'group' ) if( getBit( keyinfo , 3 ) == 1 ): flaglist.append...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getKeyInformation( self , flaglist ):\n\t\tkeyinfo = 0\n\t\tif 'HMAC_MD5_RC4' in flaglist:\n\t\t\tkeyinfo = setBit( keyinfo , 0 )\n\t\tif 'HMAC_SHA1_AES' in flaglist:\n\t\t\tkeyinfo = setBit( keyinfo , 1 )\n\t\tif 'group' in flaglist:\n\t\t\tpass\n\t\tif 'pairwise' in flaglist:\n\t\t\tkeyinfo = setBit( keyin...
[ "0.6743408", "0.5599987", "0.54831153", "0.54222727", "0.5411979", "0.530009", "0.52766114", "0.5181283", "0.51444834", "0.5068981", "0.50592893", "0.5043546", "0.50303626", "0.5005824", "0.49645144", "0.49421084", "0.49409097", "0.49077618", "0.48360735", "0.4824332", "0.478...
0.78312045
0
Set the key ID from the flaglist.
def __setKeyIDFromFlaglist( self , flaglist ): if 'idx0' in flaglist: self.keyID = 'idx0' if 'idx1' in flaglist: self.keyID = 'idx1' if 'idx2' in flaglist: self.keyID = 'idx2'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_key_id(self, key_id=''):\n self.key_id = key_id", "def key_id(self, key_id):\n\n self._key_id = key_id", "def get_key_id(self):", "def __init__(self, key):\n self.key = [int_mapping(k) for k in key]", "def _set_id(self, value):\n pass", "def set_key(self, key):\n\t\tif...
[ "0.6454805", "0.59250164", "0.5873637", "0.58335394", "0.5757778", "0.5733422", "0.56739056", "0.5673275", "0.5654884", "0.5590533", "0.5590533", "0.55903417", "0.55585337", "0.5539609", "0.5518129", "0.5518129", "0.5518129", "0.5518129", "0.5505997", "0.54609674", "0.5459089...
0.85215884
0
4Way Handshake 2/4 (TKIP).
def fw_handshake_2_4_tkip( self , vendor , eapolMIC = True , eapolMICFlag = True , customFlaglist = None , customRC = None ): parameterList = 'vendor=' + str(vendor) + ',eapolMIC=' + str(eapolMIC) + ',eapolMICFlag=' + str(eapolMICFlag) + ',customFlaglist=' + str(customFlaglist) + ',customRC=' + str(customRC) self.l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fw_handshake_4_4_tkip( self , eapolMIC = True , eapolMICFlag = True , customFlaglist = None , addNonce = None , customRC = None , addData = None ):\n\t\tparameterList = 'eapolMIC=' + str(eapolMIC) + ',eapolMICFlag=' + str(eapolMICFlag) + ',customFlaglist=' + str(customFlaglist) + ',addNonce=' + str(addNonce) +...
[ "0.6646956", "0.64540124", "0.6431143", "0.6407858", "0.6301635", "0.6258781", "0.58257896", "0.57159686", "0.5581246", "0.5543797", "0.5446876", "0.5438237", "0.5398689", "0.52769226", "0.52320427", "0.51876277", "0.504449", "0.4999626", "0.4977589", "0.49746817", "0.4970787...
0.68462443
0
4Way Handshake 2/4 (WPA).
def fw_handshake_2_4_aes( self , vendor , eapolMIC = True , eapolMICFlag = True , customFlaglist = None , customRC = None ): parameterList = 'vendor=' + str(vendor) + ',eapolMIC=' + str(eapolMIC) + ',eapolMICFlag=' + str(eapolMICFlag) + ',customFlaglist=' + str(customFlaglist) + ',customRC=' + str(customRC) self.lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fw_handshake_2_4_tkip( self , vendor , eapolMIC = True , eapolMICFlag = True , customFlaglist = None , customRC = None ):\n\t\tparameterList = 'vendor=' + str(vendor) + ',eapolMIC=' + str(eapolMIC) + ',eapolMICFlag=' + str(eapolMICFlag) + ',customFlaglist=' + str(customFlaglist) + ',customRC=' + str(customRC)\...
[ "0.72141707", "0.6909472", "0.67791027", "0.67253786", "0.65839", "0.6145828", "0.59239167", "0.587799", "0.5848811", "0.5828802", "0.5826303", "0.5691294", "0.56251633", "0.561689", "0.55402565", "0.54597586", "0.5445255", "0.53914714", "0.53840613", "0.52816135", "0.5246395...
0.67304224
3
4Way Handshake 3/4 (TKIP).
def fw_handshake_3_4_tkip( self , packet ): # Check if the Frame Check Sequence (FCS) flag is set in the Radiotap header, and # if so assert the correctness of the FCS. radiotapFCSFlag = hasFCS( packet ) if radiotapFCSFlag is True: assertDot11FCS( packet ) packet.getlayer( EAPOL_WPAKey ).remove_payload() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fw_handshake_4_4_tkip( self , eapolMIC = True , eapolMICFlag = True , customFlaglist = None , addNonce = None , customRC = None , addData = None ):\n\t\tparameterList = 'eapolMIC=' + str(eapolMIC) + ',eapolMICFlag=' + str(eapolMICFlag) + ',customFlaglist=' + str(customFlaglist) + ',addNonce=' + str(addNonce) +...
[ "0.67468935", "0.6737194", "0.6664823", "0.635603", "0.6308225", "0.62145877", "0.56858593", "0.54955584", "0.54889023", "0.5332052", "0.5225432", "0.50472337", "0.50272524", "0.50106573", "0.5003098", "0.50025594", "0.49503523", "0.49494582", "0.49482146", "0.48204303", "0.4...
0.6929152
0
4Way Handshake 3/4 (WPA).
def fw_handshake_3_4_aes( self , packet ): # Check if the Frame Check Sequence (FCS) flag is set in the Radiotap header, and # if so assert the correctness of the FCS. radiotapFCSFlag = hasFCS( packet ) if radiotapFCSFlag is True: assertDot11FCS( packet ) packet.getlayer( EAPOL_WPAKey ).remove_payload() #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fw_handshake_3_4_tkip( self , packet ):\n\t\t# Check if the Frame Check Sequence (FCS) flag is set in the Radiotap header, and\n\t\t# if so assert the correctness of the FCS.\n\t\tradiotapFCSFlag = hasFCS( packet )\n\t\tif radiotapFCSFlag is True:\n\t\t\tassertDot11FCS( packet )\n\t\t\tpacket.getlayer( EAPOL_W...
[ "0.7503889", "0.71692896", "0.7107094", "0.6600701", "0.6530017", "0.5932827", "0.5868875", "0.56008786", "0.5591584", "0.5503641", "0.5416842", "0.53957826", "0.53105396", "0.5301601", "0.52631265", "0.52446353", "0.5230233", "0.51974016", "0.51889485", "0.51476973", "0.5143...
0.7285889
1
4Way Handshake 4/4 (TKIP).
def fw_handshake_4_4_tkip( self , eapolMIC = True , eapolMICFlag = True , customFlaglist = None , addNonce = None , customRC = None , addData = None ): parameterList = 'eapolMIC=' + str(eapolMIC) + ',eapolMICFlag=' + str(eapolMICFlag) + ',customFlaglist=' + str(customFlaglist) + ',addNonce=' + str(addNonce) + ',custo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handshake4(self, r, w):\n s4r = socks4_recv_request(r)\n if s4r['version'] != 4:\n logger.warning(\"SOCKS4 rejecting invalid version %r\", s4r[\"version\"])\n return\n if s4r['cmd'] != CMD_CONNECT:\n logger.warning(\"SOCKS4 rejecting unsupported command %r\...
[ "0.6700548", "0.66541535", "0.66516834", "0.65175414", "0.6437206", "0.6193248", "0.5628278", "0.54505783", "0.5313436", "0.5230357", "0.5210843", "0.5048025", "0.49701482", "0.48996294", "0.4860243", "0.4858004", "0.48476747", "0.4838114", "0.48340616", "0.48327902", "0.4826...
0.6844773
0
4Way Handshake 4/4 (WPA).
def fw_handshake_4_4_aes( self , eapolMIC = True , eapolMICFlag = True , customFlaglist = None , addNonce = None , customRC = None , addData = None ): parameterList = 'eapolMIC=' + str(eapolMIC) + ',eapolMICFlag=' + str(eapolMICFlag) + ',customFlaglist=' + str(customFlaglist) + ',addNonce=' + str(addNonce) + ',custom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fw_handshake_4_4_tkip( self , eapolMIC = True , eapolMICFlag = True , customFlaglist = None , addNonce = None , customRC = None , addData = None ):\n\t\tparameterList = 'eapolMIC=' + str(eapolMIC) + ',eapolMICFlag=' + str(eapolMICFlag) + ',customFlaglist=' + str(customFlaglist) + ',addNonce=' + str(addNonce) +...
[ "0.70417726", "0.69756144", "0.6852201", "0.6804448", "0.63908243", "0.6308556", "0.5549122", "0.5522385", "0.54208374", "0.540672", "0.53771544", "0.5245256", "0.5191313", "0.5075674", "0.50321865", "0.5026503", "0.50145257", "0.4988787", "0.48992413", "0.48725376", "0.48619...
0.6630733
4
Group Key Handshake 1/2 (TKIP).
def gk_handshake_1_2_tkip( self , packet ): try: # Decapsulate the TKIP packet, and rebuild the plaintext packet. plaintext = self.handleTKIP.decapsulate( packet , self.TK , self.MMICTxK ) packet = LLC()/SNAP()/EAPOL()/EAPOL_Key()/EAPOL_WPAKey() new_packet = packet.__class__( plaintext ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gk_handshake_1_2_aes( self , packet ):\n\t\ttry:\n\n\t\t\t# Decapsulate the TKIP packet, and rebuild the plaintext packet.\n\t\t\tplaintext\t= self.handleAES.decapsulate( packet , self.TK )\n\t\t\tpacket \t\t= LLC()/SNAP()/EAPOL()/EAPOL_Key()/EAPOL_WPAKey()\n\t\t\tnew_packet \t= packet.__class__( plaintext )\n...
[ "0.6993158", "0.6710398", "0.61452496", "0.5839547", "0.55907094", "0.55886805", "0.5588011", "0.5540909", "0.54761565", "0.54022527", "0.5274508", "0.5211209", "0.52015334", "0.5186773", "0.5183748", "0.51658136", "0.51587534", "0.5151239", "0.51409864", "0.51297235", "0.509...
0.73095936
0
Group Key Handshake 1/2 (WPA). The packet is decrypted with AES under the CTR with CBCMAC Protocol (CCMP). CCM combines CTR for data confidentiality and CBCMAC for authentication and integrity.
def gk_handshake_1_2_aes( self , packet ): try: # Decapsulate the TKIP packet, and rebuild the plaintext packet. plaintext = self.handleAES.decapsulate( packet , self.TK ) packet = LLC()/SNAP()/EAPOL()/EAPOL_Key()/EAPOL_WPAKey() new_packet = packet.__class__( plaintext ) # Assert on the flags i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gk_handshake_1_2_tkip( self , packet ):\n\t\ttry:\n\t\t\t\n\t\t\t# Decapsulate the TKIP packet, and rebuild the plaintext packet.\n\t\t\tplaintext \t\t= self.handleTKIP.decapsulate( packet , self.TK , self.MMICTxK )\n\t\t\tpacket \t\t\t= LLC()/SNAP()/EAPOL()/EAPOL_Key()/EAPOL_WPAKey()\n\t\t\tnew_packet \t\t= p...
[ "0.7056146", "0.6873941", "0.65584064", "0.61416614", "0.608635", "0.59748024", "0.57996607", "0.5774626", "0.57702816", "0.5761186", "0.5711205", "0.56224453", "0.5621123", "0.5591313", "0.5571625", "0.55693746", "0.5557239", "0.55543816", "0.552348", "0.54867536", "0.545564...
0.75585914
0
Group Key Handshake 2/2 (TKIP).
def gk_handshake_2_2_tkip( self , eapolMIC = True , eapolMICFlag = True , wepMIC = True , customFlaglist = None , addNonce = None , customRC = None , addData = None ): parameterList = 'eapolMIC=' + str(eapolMIC) + ',eapolMICFlag=' + str(eapolMICFlag) + ',wepMIC=' + str(wepMIC) + ',customFlaglist=' + str(customFlaglis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gk_handshake_1_2_tkip( self , packet ):\n\t\ttry:\n\t\t\t\n\t\t\t# Decapsulate the TKIP packet, and rebuild the plaintext packet.\n\t\t\tplaintext \t\t= self.handleTKIP.decapsulate( packet , self.TK , self.MMICTxK )\n\t\t\tpacket \t\t\t= LLC()/SNAP()/EAPOL()/EAPOL_Key()/EAPOL_WPAKey()\n\t\t\tnew_packet \t\t= p...
[ "0.7534371", "0.7194376", "0.6582152", "0.6026049", "0.55972886", "0.55384976", "0.54394937", "0.5430179", "0.54287136", "0.5401058", "0.53394634", "0.5312509", "0.5302375", "0.5277057", "0.5228878", "0.5206048", "0.51412857", "0.5140892", "0.5121835", "0.50944394", "0.505940...
0.7090127
2
Group Key Handshake 2/2 (WPA).
def gk_handshake_2_2_aes( self , eapolMIC = True , eapolMICFlag = True , wepMIC = True , customFlaglist = None , addNonce = None , customRC = None , addData = None ): parameterList = 'eapolMIC=' + str(eapolMIC) + ',eapolMICFlag=' + str(eapolMICFlag) + ',wepMIC=' + str(wepMIC) + ',customFlaglist=' + str(customFlaglist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gk_handshake_1_2_tkip( self , packet ):\n\t\ttry:\n\t\t\t\n\t\t\t# Decapsulate the TKIP packet, and rebuild the plaintext packet.\n\t\t\tplaintext \t\t= self.handleTKIP.decapsulate( packet , self.TK , self.MMICTxK )\n\t\t\tpacket \t\t\t= LLC()/SNAP()/EAPOL()/EAPOL_Key()/EAPOL_WPAKey()\n\t\t\tnew_packet \t\t= p...
[ "0.7842406", "0.7705151", "0.74385005", "0.6272048", "0.57969064", "0.5708069", "0.5698981", "0.5594567", "0.5593995", "0.5526331", "0.5508234", "0.55068016", "0.547386", "0.5472892", "0.5407481", "0.5296239", "0.52738434", "0.5203133", "0.5198413", "0.51878667", "0.516658", ...
0.6862219
3
Execute a list of functions in parallel.
def execute_in_parallel(lambda_list, args, timeout_seconds = None, max_worker = 8): all_processes = [] for i, l in enumerate(lambda_list): p = Process(target=l, args = (args[i], )) all_processes.append(p) p.start() for p in all_processes: p.join()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_functions_parallel(*worker_defs):\n # TODO(amotoki): Needs to figure out what max_workers can be specified.\n # According to e0ne, the apache default configuration in devstack allows\n # only 10 threads. What happens if max_worker=11 is specified?\n max_workers = len(worker_defs)\n # Prepa...
[ "0.76855344", "0.73284537", "0.7089514", "0.70382154", "0.69688237", "0.69688237", "0.69688237", "0.69688237", "0.69688237", "0.69439596", "0.6912281", "0.6860164", "0.6749195", "0.66980326", "0.66664785", "0.6582476", "0.65725577", "0.64656585", "0.6456554", "0.64412606", "0...
0.7072
3
Calculating entropy of this node
def entropy_root(self): if self.size() == 0: return 0 counter = collections.Counter(self.y) return entropy([x[1] for x in counter.items()], self.size())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(self):\n raise NotImplementedError", "def entropy(self):\n return self._normal.entropy()", "def entropy(self):\n return self._entropy_func", "def entropy(self):\n return -np.sum(self.log_likelihoods * np.exp(self.log_likelihoods))", "def entropy(self):\n ent =...
[ "0.8319806", "0.80984604", "0.79973733", "0.78912413", "0.7888419", "0.7744511", "0.7744511", "0.76870364", "0.7586616", "0.7581531", "0.7570921", "0.75208336", "0.7487033", "0.74371296", "0.74237883", "0.7420426", "0.7380491", "0.73731285", "0.73620397", "0.73339015", "0.733...
0.78151935
5
Calculating weighted entropy of the children nodes.
def entropy_children(self): assert self.true assert self.false my_size = float(self.size()) return (self.true.size() / my_size) * self.true.entropy_root() + (self.false.size() / my_size) * self.false.entropy_root()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children_impurity(self):\n\n\t\tentropy_left = 0.0\n\t\tentropy_right = 0.0\n\n\t\tfor c in range(self.n_classes):\n\t\t\ttmp = self.label_count_left[c]\n\t\t\tif tmp > 0.0:\n\t\t\t\ttmp /= self.weighted_n_left\n\t\t\t\tentropy_left -= tmp * log(tmp)\n\n\t\t\ttmp = self.label_count_right[c]\n\t\t\tif tmp > 0.0...
[ "0.72342324", "0.65909487", "0.6433547", "0.63930863", "0.62466687", "0.62310815", "0.6181685", "0.6172098", "0.6165551", "0.6143705", "0.60962546", "0.6086807", "0.608194", "0.6074888", "0.6074888", "0.60482925", "0.60432416", "0.6004288", "0.5999693", "0.59879094", "0.59718...
0.74124616
0
Infers whether the target is in indices format or one_hot format.
def infer_target_type(input: torch.Tensor, targets: torch.Tensor) -> str: if input.shape == targets.shape: return 'one_hot' elif input.ndim == targets.ndim + 1: return 'indices' else: raise RuntimeError(f'Unable to infer indices or one_hot. Targets has shape {targets.shape}' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_targets_one_hot(input: torch.Tensor,\n targets: torch.Tensor,\n num_classes: Optional[int] = None) -> torch.Tensor:\n if infer_target_type(input, targets) == 'indices':\n # If the number of classes isn't specified, attempt to infer it from th...
[ "0.6951809", "0.68581086", "0.6681324", "0.66152394", "0.66152394", "0.66152394", "0.66152394", "0.6578733", "0.6549587", "0.65139776", "0.63884944", "0.63483554", "0.63066226", "0.6301925", "0.6278177", "0.6259506", "0.6223372", "0.61686593", "0.61447483", "0.61230075", "0.6...
0.7429881
0