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
Callback when user is logged in.
def OnRspUserLogin(self, data: dict, error: dict, reqid: int) -> None: if not error["ErrorID"]: self.login_status = True self.gateway.write_log("行情服务器登录成功") else: self.gateway.write_error("行情服务器登录失败", error)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_logged_in_callback(sender, request, user, **kwargs):\n logger.info(f'User {user.username} logged in from {get_client_ip(request)}')", "def user_logged_in(self, sender, request, user, **kwargs):", "def login_handler(self, callback):\n self.login_callback = callback", "def on_login(self, use...
[ "0.789974", "0.7703393", "0.7245435", "0.7236388", "0.7236388", "0.70610535", "0.70293653", "0.695483", "0.6927883", "0.68283254", "0.6776559", "0.67763287", "0.67668027", "0.6766721", "0.66924137", "0.658599", "0.6539081", "0.64897805", "0.64482677", "0.6437369", "0.6432834"...
0.0
-1
Callback when error occured.
def OnRspError(self, error: dict, reqid: int, last: bool) -> None: self.gateway.write_error("行情接口报错", error)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_error(self, callback):\n self.error_callback = callback", "def error(self, error):\n pass", "def handle_err(self):\n pass", "def on_error(self, status_code, data):\n\t\tprint(\"error_code: \",status_code)", "def error(self, handler):\n pass", "def error(self):\n ...
[ "0.85879654", "0.7715628", "0.7679042", "0.7646983", "0.7572662", "0.75094223", "0.7407471", "0.73268825", "0.7325381", "0.7301533", "0.726713", "0.7255212", "0.7183879", "0.71608186", "0.7125598", "0.71248835", "0.7107659", "0.7065004", "0.7035008", "0.70276827", "0.70155627...
0.6388604
66
Callback of tick data update.
def OnRtnDepthMarketData(self, data: dict) -> None: current_date = data["TradingDay"] current_time = data["UpdateTime"] dt = datetime.strptime( f'{current_date}-{current_time}', "%Y%m%d-%H:%M:%S" ) dt = CHINA_TZ.localize(dt) tick = TickData( symbo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_job_tick(self, tick):", "def update(self, ticks):\n pass", "def update_tick(self, tick: InstigatorTick):", "def on_tick(self, tick: TickData):\n self.tick = tick", "def on_tick(self, tick: TickData):\n self.bg.update_tick(tick)\n print(tick)\n # self.trading = ...
[ "0.7463311", "0.7442837", "0.7347183", "0.7238007", "0.71351826", "0.71069616", "0.70744145", "0.6964057", "0.69078505", "0.68956757", "0.68956757", "0.687171", "0.6827966", "0.67373866", "0.6635167", "0.6617738", "0.6617738", "0.6608783", "0.6513095", "0.64243895", "0.639442...
0.0
-1
Start connection to server.
def connect( self, userid: str, password: str, address: str, account_type: str, address_type: str ) -> None: self.userid = userid self.password = password self.address = address self.account_type = account_type self.address_type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n self.conn.start()", "def start(self):\n # create socket\n try:\n self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n # 10 minutes for timeout\n self._socket.settimeout(600)\n except socket.error as msg:\n lo...
[ "0.82934177", "0.7824189", "0.7737643", "0.7737643", "0.7612089", "0.757878", "0.75057286", "0.7497898", "0.7447365", "0.7411365", "0.74090743", "0.7395181", "0.7393807", "0.7377273", "0.7344493", "0.73364323", "0.73364323", "0.72697157", "0.72300607", "0.7222807", "0.7183704...
0.0
-1
Subscribe to tick data update.
def subscribe(self, req: SubscribeRequest) -> None: if self.login_status: exchange = EXCHANGE_VT2TORA[req.exchange] self.api.SubscribeMarketData([str.encode(req.symbol)], exchange)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe_ticker(self, symbol, update_handler=None):\n pass", "def on_tick(self, tick: TickData):\n self.tick = tick", "def subscribe(self, req: SubscribeRequest):\n tick = TickData(\n symbol=req.symbol,\n exchange=req.exchange,\n name=req.symbol,\n ...
[ "0.69724196", "0.69078016", "0.66735667", "0.6626216", "0.6624965", "0.6597413", "0.6534558", "0.6439006", "0.6439006", "0.63466096", "0.63453573", "0.6293573", "0.6279039", "0.6268057", "0.61558324", "0.6137555", "0.6033202", "0.60168976", "0.60114104", "0.5989403", "0.59863...
0.0
-1
Callback of order status update.
def OnRtnOrder(self, data: dict) -> None: symbol = data["SecurityID"] exchange = EXCHANGE_TORA2VT[bytes.decode(data["ExchangeID"])] frontid = data["FrontID"] sessionid = data["SessionID"] order_ref = data["OrderRef"] order_id = f"{frontid}_{sessionid}_{order_ref}" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def update_order_status():\n symbol = App.config[\"symbol\"]\n\n # Get currently active order and id (if any)\n order = App.order\n order_id = order.get(\"orderId\", 0) if order else 0\n if not order_id:\n log.error(f\"Wrong state or use: check order status cannot find the order id.\")\...
[ "0.7749015", "0.7728731", "0.6911425", "0.6906238", "0.67833894", "0.6753864", "0.67357075", "0.66341084", "0.65383065", "0.6533396", "0.65114367", "0.6507055", "0.64955324", "0.6472817", "0.64492893", "0.6402538", "0.6388845", "0.6340959", "0.63233924", "0.6302051", "0.62727...
0.0
-1
Callback of trade status update.
def OnRtnTrade(self, data: dict) -> None: symbol = data["SecurityID"] exchange = EXCHANGE_TORA2VT[bytes.decode(data["ExchangeID"])] orderid = self.sysid_orderid_map[data["OrderSysID"]] timestamp = f"{data['TradeDate']} {data['TradeTime']}" dt = datetime.strptime(timestamp, "%Y%...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def update_trade_status():\n # GET /api/v3/openOrders - get current open orders\n # GET /api/v3/allOrders - get all orders: active, canceled, or filled\n\n symbol = App.config[\"symbol\"]\n\n # -----\n try:\n open_orders = App.client.get_open_orders(symbol=symbol) # By \"open\" orders ...
[ "0.7169281", "0.6498282", "0.6427896", "0.6379953", "0.6349944", "0.63152", "0.63101655", "0.6266528", "0.6243253", "0.6225849", "0.61614215", "0.6132186", "0.60759616", "0.60623944", "0.60568434", "0.5980201", "0.5978488", "0.59761935", "0.59761935", "0.5975587", "0.5947008"...
0.0
-1
Callback of instrument query.
def OnRspQrySecurity( self, data: dict, error: dict, reqid: int, last: bool ) -> None: if last: self.gateway.write_log("合约信息查询成功") if not data: return contract = ContractData( gateway_name=self.gateway.gateway_name,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_query(self):", "def query(self, query):", "async def query(self, metric):\n raise NotImplementedError()", "def query(self):", "def query(self):\n pass", "def do(self, callback_name, *args):\n logger.info(\"Monitoring on auxiliary data started\")\n value_dict = self._e...
[ "0.6340802", "0.6000926", "0.57745737", "0.5768567", "0.5700282", "0.56895113", "0.5620076", "0.5598061", "0.55726093", "0.55297154", "0.55225503", "0.5518425", "0.5518425", "0.54621327", "0.54131967", "0.53976476", "0.53892046", "0.53803647", "0.5348278", "0.5331391", "0.533...
0.0
-1
Start connection to server.
def connect( self, userid: str, password: str, address: str, account_type: str, address_type: str ) -> None: self.userid = userid self.password = password self.address = address self.account_type = account_type self.address_type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n self.conn.start()", "def start(self):\n # create socket\n try:\n self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n # 10 minutes for timeout\n self._socket.settimeout(600)\n except socket.error as msg:\n lo...
[ "0.82934177", "0.7824189", "0.7737643", "0.7737643", "0.7612089", "0.757878", "0.75057286", "0.7497898", "0.7447365", "0.7411365", "0.74090743", "0.7395181", "0.7393807", "0.7377273", "0.7344493", "0.73364323", "0.73364323", "0.72697157", "0.72300607", "0.7222807", "0.7183704...
0.0
-1
Factory to make list of HeadingProduct objects from a list of Product objs. Works the same way as award.awards_list.make_list()
def make_list(products): heading_products = [] genres = set([p.genre for p in products]) for genre in genres: this_heading_product = HeadingProduct(genre, products) if len(this_heading_product.products): heading_products.append(this_heading_product) return heading_products
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_list(cls, *args):\n return _create_list(cls, *args)", "def create_list(cls, *args):\n return _create_list(cls, *args)", "def test_createGlossaryByList(self):\n li = []\n li.append(['term', 'tags', 'value'])\n li.append(['foo', 'a', '1'])\n li.append(['bar', ...
[ "0.56937706", "0.56937706", "0.561895", "0.5307927", "0.52138203", "0.5196834", "0.51320314", "0.5119527", "0.50780755", "0.5066703", "0.50650996", "0.5048959", "0.5017417", "0.49839976", "0.49739638", "0.49701428", "0.4967386", "0.49507985", "0.48988718", "0.4894856", "0.489...
0.7035925
0
same approach as the to_markup_dict() method on Product
def to_markup_dict(self, markup): ret = self.to_dict() ret["markup"] = markup.make(self.to_dict()) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _format_product(self, product):\n formatted = {}\n variants = []\n formatted['id'] = product.get('id')\n formatted['name'] = product.get('name')\n formatted['in_stock'] = True if product.get('stock_status') == 'instock' else False\n # Variants (Includes prices here sin...
[ "0.64752793", "0.605072", "0.60264534", "0.6015541", "0.5958979", "0.5930521", "0.59252644", "0.591506", "0.5822085", "0.5803746", "0.58024323", "0.5743002", "0.57425123", "0.57264364", "0.57172954", "0.5709384", "0.5706299", "0.5706014", "0.5695772", "0.5667667", "0.5665223"...
0.63571995
1
Gets the meshes we need to start the script running
def get_meshes(scene): # all the instances we want to duplicate and change the source instances = [] # the mesh we want to use as the new source replacement_mesh = None # the original mesh original_mesh = None for item in scene.selected: if item.isAnInstance: i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_meshes(self):\n for meta_mesh in self.gltf.meshes:\n # Returns a list of meshes\n meshes = meta_mesh.load(self.materials)\n self.meshes.append(meshes)\n\n for mesh in meshes:\n self.scene.meshes.append(mesh)", "def getMeshes():\n nodes...
[ "0.63373065", "0.61222684", "0.60875696", "0.5780625", "0.5610957", "0.5601388", "0.5586091", "0.55387825", "0.5537301", "0.55358857", "0.5527687", "0.54873574", "0.54691595", "0.5454848", "0.54036236", "0.53925985", "0.53647876", "0.5352783", "0.53096044", "0.53068966", "0.5...
0.53674656
16
Parses the arguments provided through the command line. Run the program with option "h" to see a humanreadable description of the arguments
def parse_command_line_arguments(): description, epilog = __doc__.split("\n\n", 1) parser = argparse.ArgumentParser( formatter_class=argparse.RawDescriptionHelpFormatter, description=description, epilog=epilog) parser.add_argument('-s', '--s', dest='s', action='store', type=float,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def parse_command_line(self, argv):\n from optparse import OptionParser\n usage = \"usage: %prog [options]\"\n parser = OptionParser(usage)\n\n (options, args) = parser.parse_args(argv)", "def _parse_command_line_arguments():\n parser = ArgumentParse...
[ "0.759162", "0.7564268", "0.7409217", "0.73762953", "0.7314469", "0.73079437", "0.73056304", "0.7302154", "0.7300697", "0.7277389", "0.7264116", "0.72568136", "0.72564495", "0.7254421", "0.7247843", "0.7229367", "0.72214586", "0.72115606", "0.72052646", "0.71983063", "0.71907...
0.7351256
4
Initializes all the needed resources for the YUV decoder
def __init__(self, input_file_path, convert_to_bgr=False): Thread.__init__(self) self.__logger = logging.getLogger(__name__) # self.__logger.setLevel(logging.DEBUG) self.__input_file_path = input_file_path self.__convert_to_bgr = convert_to_bgr self.__file_object = open(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, input_file_path, convert_to_bgr=False):\n self.__yuv_video = YuvDecoder(input_file_path, convert_to_bgr=True)\n print('After INSTANTIATION')\n self.__yuv_video.start()", "def initialize(self):\n self.conv1.reset_parameters()\n self.conv2.reset_parameters()", ...
[ "0.68046194", "0.62969315", "0.6167498", "0.61130714", "0.5984008", "0.5953548", "0.5937117", "0.58982736", "0.5884753", "0.58662254", "0.5835936", "0.58020806", "0.57903916", "0.5711412", "0.5692242", "0.56784385", "0.564403", "0.563651", "0.56304187", "0.56178665", "0.56097...
0.0
-1
Calculates the number of frames o file
def __calculate_number_of_frames(self): # Save current position current_pos = self.__file_object.tell() # Go to start of first frame self.__file_object.seek(self.__first_frame_raw_data_position) self.number_of_frames = 0 while True: if not self.__file_object...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFileCount(self) -> int:\n ...", "def fileCount(self):\n pass", "def num_frames(length, fsize, fshift):\n pad = (fsize - fshift)\n if length % fshift == 0:\n M = (length + pad * 2 - fsize) // fshift + 1\n else:\n M = (length + pad * 2 - fsize) // fshift + 2\n retur...
[ "0.74542373", "0.7406315", "0.7370555", "0.72805226", "0.7188262", "0.7104647", "0.7006017", "0.69780296", "0.6961714", "0.69169277", "0.6900665", "0.68425745", "0.68258554", "0.6812102", "0.678976", "0.6787598", "0.67869854", "0.6778575", "0.6771477", "0.67232835", "0.670670...
0.81756157
0
Interprets the header of the YUV file
def __read_header(self): header = self.__file_object.readline() header_string = header.decode('utf-8') print(header_string) # Ignore first letter self.frame_width = int(re.findall('W\d+', header_string)[0][1:]) self.frame_height = int(re.findall('H\d+', header_string)[0][...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _decode_header(self):\n #header = self.file_content[0:6]\n log_screen_descr = self.file_content[6:13]\n self.canvas_width = log_screen_descr[0] + (log_screen_descr[1]<<8)\n self.canvas_height = log_screen_descr[2] + (log_screen_descr[3]<<8)\n # is there a global color table? ...
[ "0.7273211", "0.6998706", "0.6676672", "0.66659373", "0.66317815", "0.6631482", "0.65219945", "0.65159136", "0.64302945", "0.6422038", "0.6355497", "0.6351281", "0.6338665", "0.63145584", "0.6309015", "0.6292449", "0.629189", "0.62856424", "0.62795275", "0.62275565", "0.61913...
0.74078685
0
Tries to extrapolate the subsampling method by the frame size
def determine_color_space_by_frame_size(self): possible_sub_sampling_methods = {} # Calculate 4:2:0 frame size possible_sub_sampling_methods['4:2:0'] = int( self.frame_width * self.frame_height * 3 / 2) # Calculate 4:2:2 frame size possible_sub_sampling_methods['4:2:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downsample_sam(self, factor):", "def _compute_quantized_subsamples(self):\n self._down_sample()\n self._quantize()", "def _down_sample(self):\n self._subsamples = self._raw_data.samples[::self._down_sample_factor]\n # Neglects the redundant subsamples in the tails.\n if len(self._subsamples)...
[ "0.68432665", "0.6632987", "0.6390778", "0.63845605", "0.6257276", "0.6140709", "0.6111693", "0.6003684", "0.5990974", "0.5911649", "0.5829483", "0.58266044", "0.580334", "0.5798149", "0.57649136", "0.57622963", "0.574139", "0.5720655", "0.5622281", "0.5589497", "0.55634445",...
0.5070363
86
Returns a buffer containing the next frame in the file
def __get_next_yuv_frame(self): raw_frame_buffer = self.__file_object.read(self.__frame_raw_data_size) # Ignore FRAME header self.__file_object.readline() return raw_frame_buffer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_frame(self):\n try:\n return self.framegen.next()\n except StopIteration:\n return None", "def __readNext(self, f) -> bytes:\n try:\n fBuffer = f.read(Rudp.Packet.payloadMax)\n except Exception as e:\n print(\"Exception when rea...
[ "0.658763", "0.6512409", "0.64798796", "0.63112426", "0.6304167", "0.6280922", "0.62393665", "0.6209724", "0.6112247", "0.6055701", "0.5982976", "0.5950312", "0.5921946", "0.59020406", "0.5859815", "0.58452123", "0.5819238", "0.5807083", "0.57893544", "0.5751586", "0.5741709"...
0.7203122
0
Builds a YUV frame from the 3 planes
def __concatenate_planes_to_444yuv_frame(self, y_plane, u_plane, v_plane): np.set_printoptions(formatter={'int': hex}) y_plane.shape = (self.frame_height, self.frame_width, 1) u_plane.shape = (self.frame_height, self.frame_width, 1) v_plane.shape = (self.frame_height, self.frame_width, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bytes_to_yuv(data, resolution):\n width, height = resolution\n fwidth, fheight = raw_resolution(resolution)\n y_len = fwidth * fheight\n uv_len = (fwidth // 2) * (fheight // 2)\n if len(data) != (y_len + 2 * uv_len):\n raise PiCameraValueError(\n 'Incorrect buffer length for re...
[ "0.6178987", "0.6112994", "0.60437536", "0.60061175", "0.5818813", "0.5782524", "0.5594121", "0.5592523", "0.55896294", "0.5515905", "0.54654443", "0.54456806", "0.5360084", "0.5344593", "0.5332781", "0.5281292", "0.52807987", "0.5253911", "0.5192978", "0.51899076", "0.517477...
0.70961094
0
Gets the next frame from the stream as RGB. Returns (False, None) if EOF.
def next_frame(self): while True: if self.grabbed: buffer = self.__get_next_yuv_frame() if len(buffer) != self.__frame_raw_data_size: self.frame = False, False self.stopped = True break y, u,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __next__(self):\n while True:\n self.stream_bytes += self.stream_conn.read(1024)\n first = bytearray(self.stream_bytes).find(b'\\xff\\xd8')\n last = bytearray(self.stream_bytes).find(b'\\xff\\xd9')\n if first != -1 and last != -1:\n jpg = self.s...
[ "0.6480714", "0.63872474", "0.6296677", "0.6196712", "0.5917676", "0.587839", "0.579213", "0.5756493", "0.56737775", "0.56716037", "0.5643117", "0.5601835", "0.5566194", "0.5565655", "0.5558515", "0.55306965", "0.5480496", "0.5423163", "0.5407114", "0.5400058", "0.53833944", ...
0.54139644
18
Gracefully closes the resources
def close(self): self.__file_object.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close():", "def do_close(self):\n self.cleanup(True)\n self.close()", "def cleanup(self):\n self.io.close()", "def close(self):\n for lrms in self.resources.itervalues():\n lrms.close()", "def close(self) -> None:", "def close(self) -> None:", "def close(self)...
[ "0.7931051", "0.7838053", "0.761006", "0.7568386", "0.75207824", "0.75207824", "0.75207824", "0.75207824", "0.75207824", "0.75207824", "0.75207824", "0.75207824", "0.7486898", "0.74619836", "0.74619836", "0.7451234", "0.74416775", "0.74416775", "0.7441357", "0.7432075", "0.74...
0.0
-1
Creates a video player object with the specified input file path
def __init__(self, input_file_path, convert_to_bgr=False): self.__yuv_video = YuvDecoder(input_file_path, convert_to_bgr=True) print('After INSTANTIATION') self.__yuv_video.start()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_video_from_path(path: Union[Path, str]) -> videoType:\n\n if isinstance(path, str):\n path = Path(path)\n video_path = path.resolve()\n if video_path.exists():\n print(f\"Video loaded from {video_path}\")\n vid: videoType = cv2.VideoCapture(str(video_path))\n else:\n ...
[ "0.6658787", "0.6298418", "0.62545097", "0.61926234", "0.6146118", "0.60982794", "0.60793835", "0.6035831", "0.6027104", "0.6026964", "0.598783", "0.59465235", "0.5931537", "0.58999956", "0.58965343", "0.58954424", "0.58553547", "0.58519715", "0.5841672", "0.5807772", "0.5807...
0.61915356
4
Plays the specified stream
def play_video(self): cv.namedWindow('Planes', cv.WINDOW_NORMAL) cv.resizeWindow('Planes', self.__yuv_video.frame_width, self.__yuv_video.frame_height) inter_frame_delay = int(1000 / self.__yuv_video.frame_rate) while True: (ret, frame) = self.__yuv_video.get_frame() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play(self, stream_url):\n print(\"Ready to play \" + stream_url)\n self.close()\n\n opts = [\"mplayer\", \"-quiet\", \n \"-slave\",\n \"-softvol\",\n \"-cache\", str(self.config.get('cache-kb')),\n \"-cache-min\", str(self.config.get('cache-min')...
[ "0.7143811", "0.7028232", "0.69565", "0.6894225", "0.6752168", "0.6553306", "0.64828676", "0.6470522", "0.6458766", "0.644849", "0.6426984", "0.6425514", "0.63402015", "0.63358396", "0.6331446", "0.63015044", "0.6297024", "0.6294525", "0.6294525", "0.6217255", "0.6208271", ...
0.0
-1
Do not return anything, modify matrix inplace instead.
def setZeroes(self, matrix: List[List[int]]) -> None: m, n = len(matrix), len(matrix[0]) if matrix else 0 row = [False for _ in range(m)] col = [False for _ in range(n)] for i in range(m): for j in range(n): if matrix[i][j] == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __update_matrix(self, old_matrix_view):\n # if we've cleaned dirt - we will see it on our next move, so we substitute only unseen cells\n # which are marked with \"o\"\n new_matrix_view = []\n for row in range(self.matrix_rows):\n new_matrix_view.append([char for char in ...
[ "0.70664227", "0.684492", "0.6359314", "0.6214309", "0.61908424", "0.6126168", "0.6038709", "0.5992883", "0.5966755", "0.5938156", "0.5928229", "0.5917942", "0.5897078", "0.5853082", "0.58382195", "0.580802", "0.5800106", "0.57914895", "0.57380044", "0.57230836", "0.57099885"...
0.0
-1
Do not return anything, modify matrix inplace instead.
def setZeroes(self, matrix: List[List[int]]) -> None: m, n = len(matrix), len(matrix[0]) if matrix else 0 # Use first row to store zero-info for each col # Use first col to store zero-info for each row # matrix[0][0] will store col info is_first_row = any(x == 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __update_matrix(self, old_matrix_view):\n # if we've cleaned dirt - we will see it on our next move, so we substitute only unseen cells\n # which are marked with \"o\"\n new_matrix_view = []\n for row in range(self.matrix_rows):\n new_matrix_view.append([char for char in ...
[ "0.70664227", "0.684492", "0.6359314", "0.6214309", "0.61908424", "0.6126168", "0.6038709", "0.5992883", "0.5966755", "0.5938156", "0.5928229", "0.5917942", "0.5897078", "0.5853082", "0.58382195", "0.580802", "0.5800106", "0.57914895", "0.57380044", "0.57230836", "0.57099885"...
0.0
-1
Class to train and evaluate a Base Cluster Class with Number of Clusters Specified evaluate_by = column name to use to compare across the clusters eventually
def __init__(self, X, n_clusters=2, evaluate_by=None, scaled=True, random_state=101, space=None, const_params=None, loss_fun=None): self.evaluate_by = evaluate_by if (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self):\n results = dict()\n for metric in self.metrics:\n print('Evaluating clustering with metric %s' % metric)\n if metric in LABEL_METRICS.keys():\n results[metric] = LABEL_METRICS[metric](self.X, self.model.labels_)\n results['adjusted_rand...
[ "0.6347601", "0.6259447", "0.6242199", "0.619887", "0.6134004", "0.6122757", "0.6117709", "0.6106118", "0.61054987", "0.6089926", "0.60873955", "0.6071255", "0.60541445", "0.6051448", "0.60498863", "0.6030983", "0.60236627", "0.60101587", "0.5973187", "0.5970434", "0.5955364"...
0.7258767
0
Train the clustering method
def train(self, n_clusters=None, merge=True): if (n_clusters is not None): self.n_clusters = n_clusters setattr(self.cluster_obj, 'n_clusters', self.n_clusters) if (self.scaled): self.cluster_obj.fit(self.X_scaled) else: self.cluster_obj.fit(self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n\n print \"==> Running Kmeans on data set of shape: {}\".format(self.data.shape)\n km = KMeans(n_clusters = self.n_clusters)\n km.fit(self.data.values)\n self.labels = km.labels_\n self.inertia = km.inertia_", "def train(x_train, y_train, x_test, y_test):\n\n ...
[ "0.7712707", "0.72494555", "0.7233073", "0.71406126", "0.7139295", "0.69487053", "0.6906541", "0.6893633", "0.6839416", "0.6824507", "0.6815389", "0.67691666", "0.67483765", "0.674466", "0.67176473", "0.67146057", "0.668835", "0.668835", "0.668835", "0.668835", "0.668835", ...
0.6333595
70
Provides the Goodness of Fit Statistics for the clustering algorithm
def evaluate_fit(self, metric="silhoutte"): if (metric == "silhoutte"): if (self.scaled): self.silhoutte_score = ( metrics.silhouette_score( self.X_scaled, self.labels, ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self):\n self.cluseter_agglomerative(n_clusters=20, linkage='average', iterate=5)\n self.sub_clustering(n_clusters=3, index_cluster=[79], linkage='complete')\n self.merge_clusters([[0,9,53],[1,83],[46,35,67],[88,23],[6,68]])\n self.merge_clusters([[6,33,52],[17,14]])\n se...
[ "0.63789237", "0.6352993", "0.6279656", "0.62341934", "0.6150818", "0.61435586", "0.61145175", "0.6083344", "0.6083169", "0.6061328", "0.60520655", "0.60070646", "0.5999566", "0.59873974", "0.59863216", "0.59418356", "0.59418356", "0.588487", "0.5862444", "0.5856919", "0.5843...
0.541007
87
Gives the number of observations in each cluster
def cluster_obs_count(self): return(self.merged_data.groupby( 'labels').count().transpose().iloc[0, :])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cluster_count(self) -> int:\n return len(self.get_all_cluster_ids())", "def cluster_count(self) -> int:\n cluster_count = max(1, round(16**3 * (self.vein.purity / 100.0) / self.cluster_size))\n return self.distribution.scale_cluster_count(cluster_count)", "def analysis_function_num...
[ "0.7697342", "0.7521841", "0.74846464", "0.745221", "0.73620665", "0.7293663", "0.7275436", "0.7197757", "0.7003787", "0.6995928", "0.6992263", "0.69813204", "0.68972546", "0.67149794", "0.6631092", "0.66106117", "0.6603212", "0.65768135", "0.65458935", "0.65229785", "0.64970...
0.8255985
0
Provides the means of the cluster features for each cluster If evaluate_by is set, then clusters will be sorted by the mean value of the "evaluate_by" column
def cluster_means(self): if self.evaluate_by is not None: return(self.merged_data.groupby( 'labels').mean().sort_values(self.evaluate_by).transpose()) else: return(self.merged_data.groupby('labels').mean().transpose())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_means_scaled(self):\n if self.evaluate_by is not None:\n return(self.merged_scaled_data.groupby(\n 'labels').mean().sort_values(self.evaluate_by).transpose())\n else:\n return(self.merged_scaled_data.groupby(\n 'labels').mean().transpose...
[ "0.74477243", "0.64676", "0.630643", "0.61944944", "0.6128539", "0.6070738", "0.604014", "0.58796227", "0.58664966", "0.5865818", "0.584644", "0.5843564", "0.57876366", "0.5773927", "0.5773633", "0.5760417", "0.57511604", "0.57441485", "0.57324463", "0.5730679", "0.5674215", ...
0.8206238
0
Provides the means (scaled) of the cluster features for each cluster If evaluate_by is set, then clusters will be sorted by the mean value of the "evaluate_by" column
def cluster_means_scaled(self): if self.evaluate_by is not None: return(self.merged_scaled_data.groupby( 'labels').mean().sort_values(self.evaluate_by).transpose()) else: return(self.merged_scaled_data.groupby( 'labels').mean().transpose())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_means(self):\n if self.evaluate_by is not None:\n return(self.merged_data.groupby(\n 'labels').mean().sort_values(self.evaluate_by).transpose())\n else:\n return(self.merged_data.groupby('labels').mean().transpose())", "def _compute_cluster_averages(...
[ "0.8101285", "0.63563937", "0.6221742", "0.6118103", "0.6082124", "0.60302347", "0.5986253", "0.59648865", "0.5944979", "0.58651084", "0.5829008", "0.582223", "0.58143276", "0.5798003", "0.5790433", "0.57677114", "0.5756863", "0.5707412", "0.5699087", "0.56949383", "0.5688631...
0.8028111
1
Plot the parallel coordinate plots for the features in each cluster
def plot_parallel_coordinates(self, scaled=True, frac=0.05, figsize=(12, 6), xrot=0): if (scaled): vh.plot_parallel_coordinates(data=self.merged_scaled_data, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotClusters(self):\n fig = plt.figure()\n ax = fig.add_subplot(111, projection='3d')\n fig.set_size_inches(18.5, 9.5)\n ax.set_title('Identification of Cluster Particles with Voronoi Volumes', fontsize=22)\n ax.set_xlabel('x [m]', fontsize=18)\n ax.set_ylabel('y [m]',...
[ "0.76316774", "0.7617254", "0.75599796", "0.72110313", "0.7137577", "0.6990033", "0.6882812", "0.68758214", "0.68178517", "0.67636615", "0.67213136", "0.6671495", "0.6667161", "0.66629606", "0.6654885", "0.66313726", "0.66146934", "0.6613701", "0.66068953", "0.6563773", "0.65...
0.6238072
44
Always plots the with unscaled data irrespecive of what was used for training. This ensures, we maintain the original context.
def plot_means_heatmap(self, scale_rows=True, cmap='viridis', figsize=(6, 6), annot=False, valfmt="{x:.1f}", fontsize=12, fontweigh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_original(self):\n #check if it is in color or grayscale\n if self.scaled.shape[-1] == 3:\n plt.imshow(self.scaled)\n plt.axis(\"off\")\n plt.show()\n else:\n plt.imshow(self.scaled, cmap=\"gray\")\n plt.axis(\"off\")\n ...
[ "0.66189766", "0.6493985", "0.644305", "0.63004386", "0.6300371", "0.6198771", "0.61908394", "0.6128892", "0.61004347", "0.60623384", "0.60620713", "0.6049097", "0.60434496", "0.60070294", "0.5978044", "0.59771746", "0.592588", "0.5924549", "0.5912928", "0.5877057", "0.586584...
0.0
-1
Convert the datapoint into a pandas DataFrame.
def to_pandas(self, camel_case: bool = False) -> pandas.DataFrame: # type: ignore[override] pd = cast(Any, local_import("pandas")) dumped = self.dump(camel_case=camel_case) timestamp = dumped.pop("timestamp") return pd.DataFrame(dumped, index=[pd.Timestamp(timestamp, unit="ms")])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_pandas_df(self):\n data = self._get_data(pd=True)\n return data", "def _to_dataframe(self, dataset_name):\n values = self[dataset_name][:]\n columns = self.get_columns(dataset_name)\n timestamps = self.get_timestamps(dataset_name)[...]\n if len(columns) < values.s...
[ "0.7275672", "0.7162703", "0.70742196", "0.7039702", "0.6986552", "0.6943344", "0.6943344", "0.69128364", "0.69108045", "0.6888451", "0.6863301", "0.6789416", "0.67679477", "0.6743493", "0.6637931", "0.6491211", "0.6372196", "0.63680935", "0.6360144", "0.6356569", "0.6350265"...
0.6223477
39
Dump the DatapointsArray into a json serializable Python data type.
def dump(self, camel_case: bool = False, convert_timestamps: bool = False) -> Dict[str, Any]: attrs, arrays = self._data_fields() if not convert_timestamps: # Eh.. so.. we still have to convert... arrays[0] = arrays[0].astype("datetime64[ms]").astype(np.int64) else: # No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_serialize_numpy_array(array):\n return json.dumps(json_ready_numpy_array(array))", "def json_serialize_numpy_array(array):\n return json.dumps(json_ready_numpy_array(array))", "def serialize(self, data):\n if isinstance(data, dict):\n return json.dumps(\n {\n ...
[ "0.6917405", "0.6917405", "0.66256297", "0.6568424", "0.65429455", "0.62955934", "0.6242224", "0.6130758", "0.6124644", "0.61071646", "0.6085675", "0.60757726", "0.6034072", "0.6031695", "0.5964728", "0.5943574", "0.59400827", "0.5803232", "0.57991076", "0.5782903", "0.578060...
0.57586277
22
Convert the DatapointsArray into a pandas DataFrame.
def to_pandas( # type: ignore [override] self, column_names: Literal["id", "external_id"] = "external_id", include_aggregate_name: bool = True, include_granularity_name: bool = False, ) -> pandas.DataFrame: pd = cast(Any, local_import("pandas")) if column_names == "i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_dataframe(self, dataset_name):\n values = self[dataset_name][:]\n columns = self.get_columns(dataset_name)\n timestamps = self.get_timestamps(dataset_name)[...]\n if len(columns) < values.shape[1]:\n columns.resize(values.shape[1])\n\n # transform missing data ...
[ "0.70953417", "0.70682985", "0.690592", "0.6754507", "0.67391706", "0.66165286", "0.6560893", "0.6546581", "0.6533122", "0.6470177", "0.6456739", "0.64290935", "0.64260834", "0.63697124", "0.6347784", "0.6347784", "0.6338845", "0.6321473", "0.6319904", "0.63081855", "0.618971...
0.5750251
66
Dump the datapoints into a json serializable Python data type.
def dump(self, camel_case: bool = False) -> Dict[str, Any]: dumped = { "id": self.id, "external_id": self.external_id, "is_string": self.is_string, "is_step": self.is_step, "unit": self.unit, "datapoints": [dp.dump(camel_case=camel_case) fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump(self, data_points):\n print(data_points)", "def serialize(self, data):\n if isinstance(data, dict):\n return json.dumps(\n {\n key: value.tolist() if isinstance(value, np.ndarray) else value\n for key, value in data.items()\n ...
[ "0.69947106", "0.6595288", "0.64354455", "0.64343506", "0.63421845", "0.63324994", "0.63205224", "0.63117635", "0.6263104", "0.62422466", "0.6237221", "0.6157662", "0.61288905", "0.6121606", "0.6094647", "0.60797375", "0.6019733", "0.59913826", "0.595882", "0.595867", "0.5938...
0.0
-1
Convert the datapoints into a pandas DataFrame.
def to_pandas( # type: ignore [override] self, column_names: str = "external_id", include_aggregate_name: bool = True, include_granularity_name: bool = False, include_errors: bool = False, ) -> pandas.DataFrame: pd = cast(Any, local_import("pandas")) if colum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_dataframe(self, dataset_name):\n values = self[dataset_name][:]\n columns = self.get_columns(dataset_name)\n timestamps = self.get_timestamps(dataset_name)[...]\n if len(columns) < values.shape[1]:\n columns.resize(values.shape[1])\n\n # transform missing data ...
[ "0.76260304", "0.7595923", "0.74861777", "0.7397173", "0.7382126", "0.71352553", "0.7028942", "0.6888257", "0.6883333", "0.68173844", "0.68173844", "0.6742965", "0.6644486", "0.66278166", "0.66209453", "0.6607725", "0.66036254", "0.66008824", "0.6582569", "0.65765226", "0.656...
0.0
-1
Concatenates all arrays with duplicated IDs. Arrays with the same ids are stacked in chronological order. Caveat This method is not guaranteed to preserve the order of the list.
def concat_duplicate_ids(self) -> None: # Rebuilt list instead of removing duplicated one at a time at the cost of O(n). self.data.clear() # This implementation takes advantage of the ordering of the duplicated in the __init__ method has_external_ids = set() for ext_id, items i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_ids(ids):\r\n return hash_all(sorted(ids)) # We sort so that the id isn't sensitive to order.\r", "def flat_unique(ls):\n return list(unique(chain.from_iterable(ls), key=id))", "def remove_duplicates_array(self, array: List) -> List:\n seen = set()\n seen_add = seen.add\n ...
[ "0.6108058", "0.6034065", "0.56852865", "0.5684234", "0.5662172", "0.5658944", "0.5629316", "0.5507034", "0.5439302", "0.54389274", "0.5396021", "0.53948885", "0.53855747", "0.538059", "0.53791827", "0.53729856", "0.5346434", "0.53187525", "0.52948135", "0.5288018", "0.527519...
0.7894388
0
Get a specific DatapointsArray from this list by id or exernal_id.
def get( # type: ignore [override] self, id: Optional[int] = None, external_id: Optional[str] = None, ) -> Union[None, DatapointsArray, List[DatapointsArray]]: # TODO: Question, can we type annotate without specifying the function? return super().get(id, external_id) # type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get( # type: ignore [override]\n self,\n id: Optional[int] = None,\n external_id: Optional[str] = None,\n ) -> Union[None, Datapoints, List[Datapoints]]:\n # TODO: Question, can we type annotate without specifying the function?\n return super().get(id, external_id) # typ...
[ "0.6054171", "0.5667537", "0.54831964", "0.54567707", "0.53983647", "0.5365511", "0.5321282", "0.51933724", "0.5130589", "0.5129982", "0.5032065", "0.50203216", "0.5008644", "0.49614123", "0.4957775", "0.49143854", "0.48843566", "0.48525918", "0.4837254", "0.48273316", "0.482...
0.6824546
0
Convert the DatapointsArrayList into a pandas DataFrame.
def to_pandas( # type: ignore [override] self, column_names: Literal["id", "external_id"] = "external_id", include_aggregate_name: bool = True, include_granularity_name: bool = False, ) -> pandas.DataFrame: pd = cast(Any, local_import("pandas")) dfs = [dps.to_pandas(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_dataframe(self) -> \"pd.DataFrame\":\n import pandas as pd\n\n df = pd.DataFrame([row.as_series() for row in self.rows])\n return df", "def to_dataframe(dslist):\n from pytraj.utils import _import_pandas\n has_pandas, pd = _import_pandas()\n \n if not has_pandas:\n ...
[ "0.70076054", "0.68862015", "0.680678", "0.67758507", "0.6767373", "0.67039317", "0.66800386", "0.6670868", "0.66436577", "0.66392887", "0.6600126", "0.65596896", "0.65596896", "0.65123266", "0.6492922", "0.64803016", "0.6430784", "0.63652426", "0.6329354", "0.6299667", "0.62...
0.56777686
84
Dump the instance into a json serializable Python data type.
def dump(self, camel_case: bool = False, convert_timestamps: bool = False) -> List[Dict[str, Any]]: return [dps.dump(camel_case, convert_timestamps) for dps in self]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump(self):\n return json.dumps(self.__data)", "def json (self):\n\n return jsonpickle.encode(self, unpicklable=False)", "def json (self):\n\n return jsonpickle.encode(self, unpicklable=False)", "def cls2json(self):\n return json.dumps(self.__dict__)", "def cls2json(self):\n...
[ "0.7410046", "0.7390639", "0.7390639", "0.7369746", "0.7369746", "0.734897", "0.73247975", "0.73004895", "0.72948474", "0.72887063", "0.7257161", "0.7257161", "0.7257161", "0.71929294", "0.71359366", "0.7125709", "0.70946866", "0.70464027", "0.70386195", "0.70275664", "0.7023...
0.0
-1
Get a specific Datapoints from this list by id or exernal_id.
def get( # type: ignore [override] self, id: Optional[int] = None, external_id: Optional[str] = None, ) -> Union[None, Datapoints, List[Datapoints]]: # TODO: Question, can we type annotate without specifying the function? return super().get(id, external_id) # type: ignore [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get( # type: ignore [override]\n self,\n id: Optional[int] = None,\n external_id: Optional[str] = None,\n ) -> Union[None, DatapointsArray, List[DatapointsArray]]:\n # TODO: Question, can we type annotate without specifying the function?\n return super().get(id, external_...
[ "0.61743337", "0.59749645", "0.5939584", "0.58991456", "0.57974106", "0.5651259", "0.55687577", "0.55102324", "0.54533166", "0.5403147", "0.53751576", "0.53591925", "0.53410923", "0.53159577", "0.52451044", "0.5237156", "0.5236404", "0.52126646", "0.516919", "0.5158489", "0.5...
0.6380494
0
Convert the datapoints list into a pandas DataFrame.
def to_pandas( # type: ignore [override] self, column_names: Literal["id", "external_id"] = "external_id", include_aggregate_name: bool = True, include_granularity_name: bool = False, ) -> pandas.DataFrame: pd = cast(Any, local_import("pandas")) dfs = [dps.to_pandas(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _list_to_df(self, data):\n indices = pd.tseries.index.DatetimeIndex(\n [data[x]['time'] for x in range(0, len(data))])\n outData = pd.DataFrame(data, index=indices)\n outData.columns = ['Ask_close', 'Bid_close', 'complete',\n 'Ask_high', 'Bid_high', 'As...
[ "0.7257707", "0.7187801", "0.70569354", "0.69478846", "0.682004", "0.6778485", "0.66762257", "0.66401494", "0.6633746", "0.65886825", "0.650772", "0.64041877", "0.638807", "0.6384034", "0.6351428", "0.63409454", "0.6307943", "0.6295035", "0.6282479", "0.6234472", "0.62033075"...
0.0
-1
Get filename for simulated community produced by mete.sim_spatial_whole()
def comm_filename(S, N, ncomm, bisec, transect=False, abu=None, comm_name=None): if not comm_name: comm_name = 'S%s_N%s' % (S, N) if abu: empir = '_empirSAD' else: empir = '' if transect: runtype = 'transect' else: runtype = 'grid' return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filename(self):\n return os.path.basename(self._spatial_filename)", "def get_sim_file(cls, root_dir, constants):\n return os.path.join(root_dir, '%s.hdf5' % constants['mos_type'])", "def get_sim_file(cls, root_dir, constants):\n return os.path.join(root_dir, '%s.hdf5' % constants['mos_...
[ "0.65646577", "0.6268533", "0.6268533", "0.6141475", "0.6039565", "0.59756315", "0.5955562", "0.5923402", "0.5783788", "0.572006", "0.5696253", "0.5686741", "0.56813705", "0.5656483", "0.56059337", "0.557937", "0.5579157", "0.5563723", "0.552336", "0.5519685", "0.55115503", ...
0.5922241
8
execute_call rtype [stdout, stderr]
def __init__(self, execute_call): self._exe = execute_call
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shell_call(cmd):\n try:\n x = subprocess.run(\n cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True\n )\n ret = (x.returncode, str(x.stdout, \"utf-8\"), str(x.stderr, \"utf-8\"))\n return ret\n except subprocess.SubprocessError as e:\n ...
[ "0.6699401", "0.6614548", "0.65856606", "0.6457852", "0.63748205", "0.63311875", "0.62365687", "0.6107923", "0.60889196", "0.6088098", "0.60574377", "0.6047747", "0.5997989", "0.59733754", "0.597151", "0.59694576", "0.5967142", "0.5951768", "0.5942475", "0.5924821", "0.590206...
0.0
-1
Intialize Paillier object with seed.
def __init__(self, seed=None, g=None, n=None, Lambda=None, mu=None): if seed is None: # initialization of these values directly is useful for testing purposes. if not (g and n and Lambda and mu): raise ValueError('If seed is set to none then g, n, Lambda and mu' ' need t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(self, seed=None):\r\n self.seed(seed)", "def seed():", "def setUp(self) -> None:\n self.random = np.random.RandomState(seed=42)", "def setup_method(cls):\n seed()", "def __init__(self, user_ctor, seed=0):\n self._user_ctor = user_ctor\n self._seed = seed\n self....
[ "0.7124703", "0.6873926", "0.66557026", "0.6635872", "0.66220367", "0.66217875", "0.6620926", "0.6619582", "0.6579991", "0.6579991", "0.65695995", "0.6544197", "0.6544197", "0.6466076", "0.64453214", "0.63837", "0.63440156", "0.6340025", "0.6286774", "0.6257284", "0.6195322",...
0.0
-1
Paillier encryption of plaintext.
def Encrypt(self, plaintext, r_value=None): if not isinstance(plaintext, int) and not isinstance(plaintext, long): raise ValueError('Expected int or long type plaintext but got: %s' % type(plaintext)) r = r_value or self._GetRandomFromZNStar(N_LENGTH, self.n) return (ModExp(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt(key, plaintext):\n data = fk(keyGen(key)[0], ip(plaintext))\n return fp(fk(keyGen(key)[1], swapNibbles(data)))", "def encrypt(self, plaintext):\n return self._transform(plaintext, self._forward)", "def encrypt(self, plaintext: str) -> str:\n\n return self.run(plaintext, Cryptogr...
[ "0.74186486", "0.7412809", "0.7190593", "0.71807045", "0.717247", "0.71419", "0.7132922", "0.7085513", "0.7065311", "0.7059154", "0.7038782", "0.6996194", "0.69921005", "0.69722354", "0.69490004", "0.6947714", "0.69423634", "0.690892", "0.6870051", "0.6833222", "0.68193686", ...
0.0
-1
Paillier decryption of ciphertext.
def Decrypt(self, ciphertext): if not isinstance(ciphertext, int) and not isinstance(ciphertext, long): raise ValueError('Expected int or long type ciphertext but got: %s' % type(ciphertext)) u = ModExp(ciphertext, self.__lambda, self.nsquare) l_of_u = (u - 1) // self.n retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt(self, data):", "def decrypt(self, ciphertext):\n return self._transform(ciphertext, self._backward)", "def decrypt(self, ciphertext: bytes,\n padding: AsymmetricPadding) -> bytes:\n pass", "def decrypt(key, ciphertext):\n data = fk(keyGen(key)[1], ip(ciphertext))\n...
[ "0.7848477", "0.75641656", "0.7524535", "0.73206985", "0.7286307", "0.72835225", "0.72690964", "0.72618794", "0.7212608", "0.7205247", "0.7195099", "0.7137887", "0.71262866", "0.7091146", "0.7087095", "0.70816773", "0.70771307", "0.7038318", "0.7032224", "0.70132124", "0.7003...
0.6916724
26
returns E(m1 + m2) given E(m1) and E(m2).
def Add(self, ciphertext1, ciphertext2): for c in (ciphertext1, ciphertext2): if not isinstance(c, int) and not isinstance(c, long): raise ValueError('Expected int or long type for %s but got %s' % (c, type(c))) return ciphertext1 * ciphertext2 % self.nsquare
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_energies(e1, m1, e2, m2):\n e = sorted(list(set(e1) | set(e2)))\n return extend_energies(e, e1, m1), extend_energies(e, e2, m2)", "def add_evaluations(e1, e2):\n true_positive = e1[0] + e2[0]\n false_positive = e1[1] + e2[1]\n distance = e1[2] + e2[2]\n ...
[ "0.6536726", "0.65350455", "0.6385849", "0.6172982", "0.6172982", "0.61607146", "0.60881215", "0.6072571", "0.6053043", "0.59517604", "0.5910559", "0.5869283", "0.586799", "0.585753", "0.5848492", "0.581566", "0.5808591", "0.5779007", "0.57597685", "0.5756444", "0.57328486", ...
0.0
-1
Returns E(am + b) given E(m), a and b.
def Affine(self, ciphertext, a=1, b=0): # This works for raw paillier payload but may not for int64/float payload. # First multiply ciphertext with a a_mult_ciphertext = pow(ciphertext, a, self.nsquare) # Add b to it. return a_mult_ciphertext * pow(self.g, b, self.nsquare) % self.nsquare
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f(m, x, b):\n return m*x + b", "def e_add(pub, a, b):\n return a * b % pub.n_sq", "def expFromAdd(a,b):\n\tif (b == 0):\n\t\treturn 1\n\tresult = 1\n\tfor c1 in range(0, b):\n\t\ttemp = 0\n\t\tfor c2 in range(0, a):\n\t\t\ttemp += result\n\t\tresult = temp\n\treturn result", "def compute_e(f_mat, m_m...
[ "0.67376345", "0.6200308", "0.59969324", "0.5870638", "0.5860816", "0.58210766", "0.5788327", "0.5785067", "0.5766659", "0.5740566", "0.57211226", "0.57102543", "0.5681401", "0.5625148", "0.56201667", "0.5617707", "0.561648", "0.5609634", "0.5599497", "0.5594552", "0.5576395"...
0.0
-1
Paillier encryption of an Int64 plaintext. Paillier homomorphic addition only directly adds positive values, however, we would like to add both positive and negative values (i.e. int64 is signed). To achieve this, we will represent negative values with twos complement representation. Also, in order to detect overflow a...
def EncryptInt64(self, plaintext, r_value=None): if not isinstance(plaintext, int) and not isinstance(plaintext, long): raise ValueError('Expected int or long plaintext but got: %s' % type(plaintext)) if plaintext < MIN_INT64 or plaintext > MAX_INT64: raise ValueError('Int64 v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _raw_mul(self, plaintext):\n if not isinstance(plaintext, int) and not isinstance(plaintext, type(mpz(1))) and not isinstance(plaintext, numpy.int64):\n raise TypeError('Expected ciphertext to be int, not %s' %\n type(plaintext))\n\n if plaintext < 0 or plaintext >= self...
[ "0.5790192", "0.576911", "0.56213176", "0.54513925", "0.5386436", "0.53785866", "0.5376329", "0.5372119", "0.5359393", "0.53206307", "0.5317017", "0.53136617", "0.5303635", "0.5297727", "0.52348304", "0.52161306", "0.51484716", "0.51110023", "0.508157", "0.50726026", "0.50640...
0.652218
0
Paillier encryption of multiple 64 bit integers into a single payload.
def EncryptMultipleInt64s(self, numberlist, r_value=None): plaintext = 0 number_counter = 0 if len(numberlist) > PACKING_LIMIT: raise ValueError('The number of entries in the input list cannot be' + ' more than %d' % (PACKING_LIMIT)) for entry in numberlist: if not isi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pack_uint64s(data: List[int]) -> bytes:\n result = b\"\"\n for i in data:\n result += pack_uint64(i)\n return result", "def rop64(*args):\n\tpacked = \"\"\n\tfor x in args:\n\t\tif type(x) == int or type(x) == long:\n\t\t\tpacked += pack64(x)\n\t\telse:\n\t\t\tpacked += x\n\treturn packed", ...
[ "0.6469461", "0.62068796", "0.61395895", "0.5897477", "0.5856876", "0.5820442", "0.57950085", "0.5781007", "0.57714444", "0.57406914", "0.57406914", "0.57341266", "0.5697893", "0.5689338", "0.5596759", "0.5524", "0.5515085", "0.5504577", "0.5504514", "0.5503515", "0.54212505"...
0.7172408
0
Paillier decryption of ciphertext into multiple int64 values.
def DecryptMultipleInt64s(self, ciphertext): if not isinstance(ciphertext, int) and not isinstance(ciphertext, long): raise ValueError('Expected int or long type ciphertext but got: %s' % type(ciphertext)) plaintext = self.Decrypt(ciphertext) decrypted_numbers = [] for unuse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DecryptInt64(self, ciphertext):\n if not isinstance(ciphertext, int) and not isinstance(ciphertext, long):\n raise ValueError('Expected int or long type ciphertext but got: %s' %\n type(ciphertext))\n plaintext = self.Decrypt(ciphertext)\n return self._Unwrap96bitTo64bit(pla...
[ "0.6999377", "0.68856674", "0.67466295", "0.67262083", "0.6428826", "0.6360104", "0.6349768", "0.6308733", "0.6303354", "0.6211624", "0.61085457", "0.60960937", "0.60612965", "0.60026455", "0.5953625", "0.5937819", "0.59188956", "0.5888119", "0.58588505", "0.5841659", "0.5826...
0.7780901
0
Paillier decryption of ciphertext into a int64 value.
def DecryptInt64(self, ciphertext): if not isinstance(ciphertext, int) and not isinstance(ciphertext, long): raise ValueError('Expected int or long type ciphertext but got: %s' % type(ciphertext)) plaintext = self.Decrypt(ciphertext) return self._Unwrap96bitTo64bit(plaintext)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Decrypt(self, ciphertext):\n if not isinstance(ciphertext, int) and not isinstance(ciphertext, long):\n raise ValueError('Expected int or long type ciphertext but got: %s' %\n type(ciphertext))\n u = ModExp(ciphertext, self.__lambda, self.nsquare)\n l_of_u = (u - 1) // self....
[ "0.76950616", "0.751412", "0.7208298", "0.6586208", "0.6520382", "0.6476167", "0.6406717", "0.6404868", "0.63836175", "0.6361718", "0.6336824", "0.6297889", "0.6279345", "0.6242041", "0.62175155", "0.6204211", "0.6166816", "0.61604214", "0.61572933", "0.61452925", "0.6128287"...
0.7853171
0
Encrypt float (IEEE754 binary64bit) values with limited exponents. Paillier homomorphic addition only directly adds positive binary values, however, we would like to add both positive and negative float values
def EncryptFloat(self, plaintext, r_value=None): if not isinstance(plaintext, float): raise ValueError('Expected float plaintext but got: %s' % type(plaintext)) input_as_long = struct.unpack('Q', struct.pack('d', plaintext))[0] mantissa = (input_as_long & 0xfffffffffffff) | 0x10000000000000 expon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _enc(x: int) -> float:\n return 2 + x + (29 / (x ** 2 + (1 - x) ** 2))", "def _raw_add(self, e_a, e_b):\n return e_a * e_b % self.public_key.nsquare", "async def test_floating_point_encoding(self, r):\n await r.flushdb()\n timestamp = 1349673917.939762\n await r.zadd('a', tim...
[ "0.5811039", "0.57055616", "0.5681594", "0.5667057", "0.55601025", "0.5532706", "0.5469459", "0.5463289", "0.54342914", "0.5426036", "0.53601795", "0.5341179", "0.5299423", "0.52942103", "0.52717775", "0.5256707", "0.52175176", "0.5214884", "0.5214496", "0.51952034", "0.51585...
0.73143375
0
Paillier decryption of ciphertext into a IEEE754 binary64 float value.
def DecryptFloat(self, ciphertext): original_plaintext = self.Decrypt(ciphertext) plaintext = original_plaintext mantissa_and_exponent = plaintext & _ONES_FLOAT_SIGN_LOW_LSB plaintext >>= FLOAT_SIGN_LOW_LSB # >>= 831 sign_low32 = plaintext & 0xffffffff plaintext >>= 32 sign_high32 = plainte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def EncryptFloat(self, plaintext, r_value=None):\n if not isinstance(plaintext, float):\n raise ValueError('Expected float plaintext but got: %s' % type(plaintext))\n\n input_as_long = struct.unpack('Q', struct.pack('d', plaintext))[0]\n mantissa = (input_as_long & 0xfffffffffffff) | 0x10000000000000...
[ "0.6348259", "0.6295682", "0.6129", "0.60495037", "0.6032528", "0.6025274", "0.5985032", "0.5756852", "0.5723989", "0.5710238", "0.5611292", "0.5578155", "0.55487376", "0.55423474", "0.5519347", "0.5498408", "0.54967207", "0.5486184", "0.54766923", "0.5475583", "0.54647607", ...
0.7470246
0
Returns the number of bytes in the Bignum.
def _NumBytesBn(bn): if not _FOUND_SSL: raise RuntimeError('Cannot evaluate _NumBytesBn because ssl library was ' 'not found') size_in_bits = ssl.BN_num_bits(bn) return int(math.ceil(size_in_bits / 8.0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_bytes(self) -> str:\n return pulumi.get(self, \"num_bytes\")", "def size_bytes(self) -> int:\n return pulumi.get(self, \"size_bytes\")", "def _get_nr_of_bits(self):\n return sum(self._size_var)", "def lenb(self) -> int:\n return self._core.lenb()", "def size_bytes(self):...
[ "0.76290935", "0.7256088", "0.7226742", "0.7202238", "0.69278276", "0.69196373", "0.684339", "0.6731235", "0.6718147", "0.6697299", "0.66349", "0.6583386", "0.65817887", "0.65500563", "0.65500563", "0.6529792", "0.6513275", "0.6505297", "0.64666075", "0.64448845", "0.64410853...
0.7820821
0
Uses openssl, if available, to do a^b mod c where a,b,c are longs.
def ModExp(a, b, c): if not _FOUND_SSL: return pow(a, b, c) # convert arbitrary long args to bytes bytes_a = number.LongToBytes(a) bytes_b = number.LongToBytes(b) bytes_c = number.LongToBytes(c) # convert bytes to (pointer to) Bignums. bn_a = ssl.BN_bin2bn(bytes_a, len(bytes_a), 0) bn_b = ssl.BN_bi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def powMod(a,b,c):\n if GMPY:\n return(gmpy2.powmod(a,b,c))\n else:\n return pow(a,b,c)", "def TestSslRegression():\n if not _FOUND_SSL:\n return\n a = 13237154333272387305 # random\n b = 14222796656191241573 # random\n c = 14335739297692523692 # random\n expect_m = 106592315454997...
[ "0.6681694", "0.64587593", "0.6410224", "0.6405954", "0.62579936", "0.62428784", "0.6195865", "0.61904657", "0.6125475", "0.6122947", "0.6103147", "0.6046036", "0.6010627", "0.60101646", "0.5995779", "0.5965606", "0.5963928", "0.5952755", "0.59174013", "0.5871228", "0.5864174...
0.7635855
0
Test openssl BN functions ctypes setup for regressions.
def TestSslRegression(): if not _FOUND_SSL: return a = 13237154333272387305 # random b = 14222796656191241573 # random c = 14335739297692523692 # random expect_m = 10659231545499717801 # pow(a, b, c) m = ModExp(a, b, c) assert m == expect_m, 'TestSslRegression: unexpected ModExp result'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ssl_default(self):\n e = ErrataConnector()\n assert e.ssl_verify", "def test_ssl_default(self):\n assert security.security_settings.ssl_verify()", "def test_alpn_call_failure(self):\n context = Context(SSLv23_METHOD)\n with pytest.raises(ValueError):\n con...
[ "0.58895886", "0.54251087", "0.5340569", "0.52410597", "0.51989615", "0.5001536", "0.4908221", "0.48994425", "0.4890942", "0.4880682", "0.48786157", "0.48503911", "0.4837446", "0.4806173", "0.48055226", "0.47952127", "0.479222", "0.47784704", "0.47668955", "0.47659346", "0.47...
0.5731037
1
Add an API document
async def post(self): if SmartAPI.find(self.args.url, "url"): raise HTTPError(409) try: file = await download_async(self.args.url) except DownloadError as err: raise HTTPError(400, reason=str(err)) from err try: smartapi = SmartAPI(self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_document(self, doc):\n assert isinstance(doc, pylastica.document.Document), \"doc must be of type Document: %r\" % doc\n path = urllib.quote_plus(str(doc.doc_id))\n request_type = pylastica.request.Request.PUT\n if path is None or path == '':\n #no doc id has been giv...
[ "0.73654747", "0.6919095", "0.68352044", "0.67469156", "0.66946566", "0.66113096", "0.65432954", "0.652964", "0.6526783", "0.64139986", "0.62950844", "0.6260293", "0.6199671", "0.6193585", "0.61837125", "0.6173589", "0.613345", "0.6122149", "0.610493", "0.6092834", "0.6081412...
0.0
-1
/api/suggestion?field= Returns aggregations for any field provided
def get(self): res = SmartAPI.get_tags(self.args.field) self.finish(res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def searchkit_aggs(aggs):\n return [\n {\"title\": k.capitalize(), \"aggName\": k, \"field\": v[\"terms\"][\"field\"]}\n for k, v in aggs.items()\n ]", "def get_aggs(es, query, args):\n return es.search(index=args.index,\n body=query,\n timeout=float...
[ "0.60265315", "0.5873109", "0.58511466", "0.5806916", "0.58002204", "0.5789221", "0.5758926", "0.56962925", "0.5630357", "0.56241834", "0.55668694", "0.55170536", "0.54953665", "0.549357", "0.54658186", "0.54531634", "0.54515153", "0.54498994", "0.5301895", "0.5282511", "0.52...
0.0
-1
return exapnded value list for a given biolink class name
def get_expanded_values(self, value: Union[str, List[str]]) -> List[str]: if isinstance(value, str): value = [value] _out = [] for v in value: try: v = self.biolink_model_toolkit.get_descendants(v, reflexive=True, formatted=True) v = [x.spl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_values_for_class(self, class_name) -> list:\n class_items = self.soup.find_all(attrs={'class': class_name})\n class_items_values = []\n for class_item in class_items:\n class_item_value = class_item.text.strip()\n class_items_values.append(class_item_value)\n ...
[ "0.6817521", "0.6197597", "0.5983348", "0.5813055", "0.57524914", "0.56284046", "0.555421", "0.555421", "0.5522398", "0.5507856", "0.5482042", "0.5441845", "0.53842086", "0.53817147", "0.537343", "0.5366936", "0.53596956", "0.53590965", "0.5354571", "0.5346339", "0.5314848", ...
0.5465229
11
Overwrite the biothings query handler to add graphml format (&format=graphml) added &download=True to download .graphml file automatically, can disable (&download=False)
def write(self, chunk): try: if self.format == "graphml": chunk = edges2graphml(chunk, self.request.uri, self.request.protocol, self.request.host, edge_default="directed") self.set_header("Content-Type", "text/graphml; charset=utf-8") if self.args.down...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(self, outputfile:str, **format_options) -> str:\n return self.connection.download(self.graph, outputfile, format_options)", "def download(self, outputfile:str, **format_options) -> str:\n return self.session.download(self.graph, outputfile, format_options)", "def ExportMetaGraph(pref...
[ "0.5644568", "0.5576068", "0.52066654", "0.5030416", "0.49787995", "0.4950677", "0.4896912", "0.48899424", "0.48656175", "0.48630908", "0.48574403", "0.48385876", "0.47709388", "0.47572508", "0.47426155", "0.47091573", "0.46963683", "0.46870074", "0.46818873", "0.46762022", "...
0.62148756
0
Tests if NAPI can allocate automatically an IPv4 Address in a Network with available addresses.
def test_try_create_auto_ip(self): name_file = 'api_ip/tests/sanity/ipv4/json/post/ipv4_auto_net_free.json' # Does get request response = self.client.post( '/api/v3/ipv4/', data=json.dumps(self.load_json_file(name_file)), content_type='application/json') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SupportsIPv4(self) -> bool:", "def OSSupportsIPv4(self) -> bool:", "def test_ipv4_in_net(self):\n test_ip = ip_address.IPAddress(\"192.168.178.4\", force_v4=True)\n assert test_ip.in_network(\"192.168.178.0/24\")\n assert test_ip.in_network(\"192.168.178.0/29\")\n \n test...
[ "0.7272328", "0.7198159", "0.67391574", "0.67383194", "0.6654193", "0.6471453", "0.63947624", "0.6319289", "0.6268624", "0.6263439", "0.6223236", "0.61894363", "0.6161831", "0.61440897", "0.6140726", "0.61142963", "0.61017936", "0.6090846", "0.60064334", "0.5994998", "0.59949...
0.6010965
18
Tests if NAPI deny manually creation of invalid IPv4 Address
def test_try_create_invalid_ip(self): name_file = 'api_ip/tests/sanity/ipv4/json/post/ipv4_10_0_0_430_net_5.json' response = self.client.post( '/api/v3/ipv4/', data=json.dumps(self.load_json_file(name_file)), content_type='application/json') self.compare_sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ipv4_validation_failure():\n with pytest.raises(socket.error):\n is_ipv4('256.8.8.8')", "def OSSupportsIPv4(self) -> bool:", "def is_valid_ipv4_address(address):\n invalid_list = ['0.0.0.0','255.255.255.255']\n try:\n ip = ipaddress.IPv4Address(address)\n if (ip.is_reserv...
[ "0.72859496", "0.70323485", "0.68951535", "0.6847824", "0.6812048", "0.6801668", "0.6789916", "0.67470616", "0.6685381", "0.66446495", "0.6567437", "0.6566745", "0.6563316", "0.64939386", "0.6490158", "0.64708686", "0.645474", "0.6440327", "0.6436727", "0.6431015", "0.6426202...
0.70039326
2
Tests if NAPI can allocate an IPv4 Address manually and associate it to an equipment in a Network with available addresses.
def test_try_create_ip_associating_to_equipment(self): name_file = 'api_ip/tests/sanity/ipv4/json/post/ipv4_10_0_0_99_net_5_eqpt_1.json' response = self.client.post( '/api/v3/ipv4/', data=json.dumps(self.load_json_file(name_file)), content_type='application/json') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def OSSupportsIPv4(self) -> bool:", "def SupportsIPv4(self) -> bool:", "def is_valid_ipv4_address(address):\n invalid_list = ['0.0.0.0','255.255.255.255']\n try:\n ip = ipaddress.IPv4Address(address)\n if (ip.is_reserved) or (ip.is_multicast) or (ip.is_loopback) or (address in invalid_list)...
[ "0.71589625", "0.7132811", "0.6699066", "0.667038", "0.66682065", "0.6354351", "0.6350155", "0.6333899", "0.6307554", "0.62972105", "0.6198987", "0.6176109", "0.61498463", "0.61370105", "0.61114895", "0.6062955", "0.60503006", "0.60055053", "0.59972554", "0.5990023", "0.59806...
0.6774612
2
Tests if NAPI deny an IPv4 manually creation in a full network. Refactor to allow create the ip.
def test_try_create_ip_in_full_network(self): name_file = 'api_ip/tests/sanity/ipv4/json/post/ipv4_10_0_4_1_net_8.json' response = self.client.post( '/api/v3/ipv4/', data=json.dumps(self.load_json_file(name_file)), content_type='application/json') self.compa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_try_create_auto_ip(self):\n\n name_file = 'api_ip/tests/sanity/ipv4/json/post/ipv4_auto_net_free.json'\n\n # Does get request\n response = self.client.post(\n '/api/v3/ipv4/',\n data=json.dumps(self.load_json_file(name_file)),\n content_type='applicati...
[ "0.72138643", "0.7143597", "0.7103163", "0.69434977", "0.6816763", "0.6809881", "0.6664153", "0.65963924", "0.6582416", "0.6578206", "0.65741384", "0.6565793", "0.65070087", "0.64682233", "0.6466719", "0.6372231", "0.6264613", "0.62450415", "0.6238998", "0.61737835", "0.61651...
0.7489132
0
Tests if NAPI deny out of range network IPv4 manually creation.
def test_try_create_out_of_range_ip_in_network(self): name_file = 'api_ip/tests/sanity/ipv4/json/post/out_of_range_ipv4_172_0_0_5_net_5.json' response = self.client.post( '/api/v3/ipv4/', data=json.dumps(self.load_json_file(name_file)), content_type='application/json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ipv4_in_range(self):\n\n test_ip = ip_address.IPAddress(\"192.168.178.4\", force_v4=True)\n \n assert test_ip.in_range(\"191.167.0.0\",\"193.169.0.0\")\n assert test_ip.in_range(\"192.167.0.0\",\"192.169.0.0\")\n assert test_ip.in_range(\"192.168.0.0\",\"192.168.255.0\")...
[ "0.73434836", "0.6952464", "0.6907861", "0.67323136", "0.67003703", "0.65595746", "0.65477157", "0.6545432", "0.64953184", "0.6441315", "0.6403229", "0.6263367", "0.62485737", "0.6163018", "0.6136902", "0.6079953", "0.5962481", "0.5961101", "0.5927232", "0.5911758", "0.590265...
0.76985526
0
returns the coords in terms of degree of visual angle converts Euclidean to Polar coordinates based on a fixation point, viewing distance, and a window size
def get_correct_coords(start_x=0,viewing_distance=12.0,field_height=10,field_width=10,pixel_width=0.282,pixel_height=0.282,**config): x = (start_x + np.arange(np.ceil(-field_width/2.0),np.ceil(field_width/2.0),1))*pixel_width y = np.arange(np.ceil(-field_height/2.0),np.ceil(field_height/2.0),1)*pixel_heigh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_wing_coord(self):\n frac = 0.1\n r = 0.5\n sin45 = np.sin(np.pi / 4.)\n\n if self.out == True:\n d = r - frac * sin45\n elif self.out == False:\n d = r + frac * sin45\n else:\n raise TypeError(\"arg: out must be True or False\")\n...
[ "0.5799795", "0.56280833", "0.5603186", "0.5591351", "0.5571056", "0.54761297", "0.54758763", "0.5474499", "0.5455909", "0.5451462", "0.5448108", "0.54459554", "0.5430218", "0.5429687", "0.5427534", "0.5413009", "0.5412867", "0.54114604", "0.5395979", "0.53953", "0.53925055",...
0.508621
71
degrees is viewing angle of the entire image image_width is size of entire in pixels
def get_viewing_distance_to_span_image(image_width=20,degree_span=1.0,screen_pixel_size=0.282): image_width_mm = image_width * screen_pixel_size inch_per_mm = 1.0/25.4 # 1 inch / 25.4 mm image_width_inches = image_width_mm * inch_per_mm distance_inches = (0.5*image_width_inches)/np.tan(np.radians(deg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_width_in_degrees(image_width=100,viewing_distance=24.0,screen_pixel_size=0.282):\n \n mm_per_inch = 25.4\n degrees_per_image = np.degrees(np.arctan(((image_width*0.5)*screen_pixel_size)/(viewing_distance*mm_per_inch))*2.0)\n return degrees_per_image", "def get_degrees_at_pixels(pixels=1...
[ "0.7489394", "0.6826391", "0.6754941", "0.66690886", "0.66166484", "0.65727824", "0.65432596", "0.64801717", "0.63533795", "0.6318814", "0.6151516", "0.6134267", "0.61262107", "0.61192167", "0.6071068", "0.6059474", "0.60218817", "0.60012805", "0.5956256", "0.5939335", "0.593...
0.55289996
61
image_width is size of entire in pixels
def get_image_width_in_degrees(image_width=100,viewing_distance=24.0,screen_pixel_size=0.282): mm_per_inch = 25.4 degrees_per_image = np.degrees(np.arctan(((image_width*0.5)*screen_pixel_size)/(viewing_distance*mm_per_inch))*2.0) return degrees_per_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def width(self) -> int:\n return self._image_data.width", "def get_image_size(self):", "def size(img):\n\treturn img.size", "def getWidth(self):\n return self._image.width()", "def get_num_of_images(self):", "def getWidth(self):\n return _tkCall(self.image.width)", "def get_size(image)...
[ "0.8215068", "0.80310565", "0.7730426", "0.7420991", "0.72717816", "0.7238899", "0.70968026", "0.70014775", "0.69751096", "0.6955615", "0.6931812", "0.69124746", "0.68738365", "0.6867451", "0.68297815", "0.68035495", "0.6801516", "0.6789067", "0.6769961", "0.6754286", "0.6748...
0.0
-1
degrees is viewing angle of the entire image
def get_image_width_in_pixels(degrees=1.0,viewing_distance=24.0,screen_pixel_size=0.282): mm_per_inch = 25.4 pixels = ((viewing_distance*mm_per_inch) * np.tan(np.radians(degrees*0.5))*2.0)/screen_pixel_size return pixels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle(self) -> float:\n ...", "def angle(self) -> int:", "def angle(self):\n return 0", "def radians(image):\n\n return ee.Image(image).toFloat().multiply(3.1415927).divide(180)", "def get_rotation_angle(self, image):\n \n # TODO: Make real functionality\n return 0...
[ "0.7453366", "0.7291728", "0.7175526", "0.69610626", "0.6937594", "0.6864348", "0.6816392", "0.68125284", "0.67985547", "0.66943544", "0.6686886", "0.66842663", "0.66842663", "0.66842663", "0.66715056", "0.6663147", "0.6585255", "0.65779006", "0.6576634", "0.6564779", "0.6543...
0.0
-1
pixels if fovea is centered on an image, pixels is half the image width in pixels returns half the viewing_angle
def get_degrees_at_pixels(pixels=10,viewing_distance=24.0,screen_pixel_size=0.282): return 0.5*get_image_width_in_degrees(image_width=2.0*pixels,viewing_distance=viewing_distance,screen_pixel_size=screen_pixel_size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle_from_point( x, img_width=640, fov_angle=44 ):\r\n return( -( ( img_width / 2 ) - x ) * fov_angle )", "def check_angle(self):\n self.find_pixels()\n alpha_theta=np.deg2rad(70)\n alpha_phi=np.deg2rad(70)\n extreme_values=self.compute_extreme_values(alpha_phi, alpha_theta)\n...
[ "0.6824647", "0.6658534", "0.6381927", "0.6312453", "0.63035583", "0.61653453", "0.61300296", "0.60928273", "0.60626274", "0.59572023", "0.5940662", "0.5912819", "0.58653146", "0.5843251", "0.5800258", "0.5789099", "0.5782187", "0.572229", "0.57170427", "0.57151014", "0.57143...
0.605287
9
degrees if fovea is centered on an image, degrees is half the viewing angle
def get_pixels_at_degrees(degrees=1.0,viewing_distance=24.0,screen_pixel_size=0.282): return 0.5*get_image_width_in_pixels(degrees=2.0*degrees,viewing_distance=viewing_distance,screen_pixel_size=screen_pixel_size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle_from_point( x, img_width=640, fov_angle=44 ):\r\n return( -( ( img_width / 2 ) - x ) * fov_angle )", "def angle(self) -> int:", "def angle(self) -> float:\n ...", "def check_angle(self):\n self.find_pixels()\n alpha_theta=np.deg2rad(70)\n alpha_phi=np.deg2rad(70)\n ...
[ "0.6839408", "0.65049446", "0.65028924", "0.64734244", "0.6420284", "0.6358528", "0.635704", "0.626297", "0.6253376", "0.6234422", "0.62234956", "0.61913675", "0.6079786", "0.604909", "0.6048486", "0.6022565", "0.6022565", "0.601494", "0.6008876", "0.5976437", "0.5971544", ...
0.0
-1
For each point on the image (image_height x image_width) returns the sigma associated with each point due to the offset from the fovea of the image. The average of all the sigmas may be used as an approximation to the full set of all sigmas. Each sigma is used as the basis for creating the J operator which is the weigh...
def get_sigma_map(start_x = 0,field_height=100,field_width=100,viewing_distance=12.0,screen_pixel_size=0.282,debug=False): start_x_pixels = np.round(get_pixels_at_degrees(degrees=start_x,viewing_distance=viewing_distance,screen_pixel_size=screen_pixel_size)) optical_nodal_distance = 17.0 # mm from lens to fovea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def EST_NOISE(images):\n num = images.shape[0]\n m_e_bar = sum(images)/num\n m_sigma = np.sqrt(sum((images - m_e_bar)**2)/(num - 1))\n \n return m_sigma", "def differenceOfGausssians(image,sigma0, sigma1,window_size, roi, out = None):\n return (vigra.filters.gaussianSmoothing(im...
[ "0.6426034", "0.618826", "0.6164799", "0.6043242", "0.6033193", "0.5991623", "0.59840286", "0.5953327", "0.59327376", "0.5929004", "0.5924567", "0.5899973", "0.58948284", "0.5870835", "0.5813454", "0.57735664", "0.56811696", "0.5678987", "0.5676586", "0.56728524", "0.56640273...
0.57426494
16
Function implements sieve of Eratosthenes (for all numbers uptil N). Returns array erat_sieve If erat_sieve[i] is True, then 2i + 3 is a prime.
def sieve_of_erat(N): erat_sieve = [True]*int(N/2) prime_list = [] prime_list.append(2) for i in range(int((math.sqrt(N)-3)/2)+1): # Only need to run till sqrt(n) if erat_sieve[i] == True: j = i + (2*i+3) while j < int(N/2): erat_sieve[j] = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primeSieve(n):\n result = []\n sieve = array.array('i', (True for i in range(0, n+1)))\n for k in range(2, n+1):\n if sieve[k]:\n result.append(k)\n i = k * k\n while i <= n:\n sieve[i] = False\n i += k\n return result", "def e...
[ "0.7732913", "0.7636703", "0.7548963", "0.7507189", "0.7439305", "0.7436849", "0.7405845", "0.73973405", "0.73973405", "0.7349964", "0.73457396", "0.7325795", "0.7229576", "0.72279704", "0.7197789", "0.7099972", "0.7085385", "0.70812255", "0.7055499", "0.70475835", "0.7027430...
0.77103347
1
Handle file(s) arguments from command line This method takes the string(s) which were passed to the cli which indicate the files on which to operate. It expands the path arguments and creates a list of `pathlib.Path` objects which unambiguously point to the files indicated by the cli arguments.
def handle_files_args(*paths_args): paths = [] for paths_arg in paths_args: # Handle paths implicitly rooted at user home dir paths_arg = os.path.expanduser(paths_arg) # Expand wildcards paths_arg = glob.glob(paths_arg) # Create list of pathlib.Path objects pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parser():\n \n \n parser = ap.ArgumentParser(description='Parsing some file names in various forms')\n group = parser.add_mutually_exclusive_group()\n group.add_argument('-f','--filepaths',dest='filepaths',metavar='PATH1,PATH2,...',type=str,\n help='Input a string or list ...
[ "0.6453815", "0.6248218", "0.6234054", "0.6233103", "0.6151754", "0.60948", "0.59932786", "0.59910625", "0.594788", "0.5934068", "0.5930487", "0.5909474", "0.58889955", "0.587302", "0.585867", "0.58419037", "0.58233815", "0.5807165", "0.57825506", "0.5780803", "0.5777409", ...
0.6813794
0
Factory method to return child of RefFile This method returns either a BibFile or NonbibFile object depending on which is appropriate based on if the `path` arg points to a file containing valid BibTeX or invalid BibTeX, respectively.
def reffile_factory(path): try: b = BibFile(path) except UnparseableBibtexError: b = NonbibFile(path) return b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fileobj(path_or_file, mode='r'):\n if isinstance(path_or_file, basestring):\n try:\n return open(path_or_file, mode)\n except:\n return closing(StringIO())\n else:\n return closing(path_or_file)", "def get(self, path, content=True, type=None, format=None):\n ...
[ "0.5633376", "0.5386271", "0.5277653", "0.5108195", "0.5107922", "0.50593334", "0.5048385", "0.49720398", "0.49453267", "0.49376675", "0.49356878", "0.49261934", "0.49225807", "0.49225807", "0.48910007", "0.48887247", "0.48831517", "0.4878487", "0.4875914", "0.4871508", "0.48...
0.79184014
0
List of data corresponding to individual bib files
def construct_bibfile_data(*paths): bibs = [reffile_factory(path) for path in paths] return bibs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _FindBibEntries(self):\n bibs = \" \".join(glob.glob(\"*.bib\"))\n cat_process = subprocess.Popen(shlex.split(\"cat %s\" % bibs),\n stdout=subprocess.PIPE)\n grep_process = subprocess.Popen(shlex.split(\"grep ^@\"),\n ...
[ "0.7137384", "0.6268261", "0.6240238", "0.6198332", "0.61708087", "0.61559683", "0.61306244", "0.60698205", "0.6049318", "0.5935787", "0.5895451", "0.5891294", "0.58823615", "0.58217996", "0.58115286", "0.57741606", "0.5756594", "0.57499486", "0.5724294", "0.57221454", "0.572...
0.71239555
1
Sublist of bibfile_data whos elements are val_type This method examines each bib_dict element of a bibfile_data list and returns the subset which can be classified according to val_type.
def bib_sublist(bibfile_data, val_type): sublist = [bibfile for bibfile in bibfile_data if isinstance(bibfile.bib, val_type)] return sublist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getvartypelist(self,subj,vartype): # 3\n num_ = None\n if num_ is None:\n num_ = len(subj)\n elif num_ != len(subj):\n raise IndexError(\"Inconsistent length of array subj\")\n if num_ is None: num_ = 0\n if subj is None: raise TypeError(\"Invalid type for argument subj\"...
[ "0.5007208", "0.49767375", "0.49480826", "0.46832088", "0.46792015", "0.4644492", "0.46313435", "0.46113947", "0.45949426", "0.45826903", "0.45621505", "0.45417857", "0.4523038", "0.45103496", "0.4509286", "0.4508049", "0.4495507", "0.4486568", "0.44805893", "0.44530094", "0....
0.82294893
0
Generate appropriate message for STDOUT This method creates the string to be printed to STDOUT from the items of the `bibfile_data` list argument. It generates either a terse or verbose message based on the state of the `verbose` argument.
def gen_stdout_test_msg(bibfile_data, verbose=False): msg_list = [bibfile.test_msg(verbose) for bibfile in bibfile_data] msg = "\n".join(msg_list) return msg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_verbose(message:str):\n if params['verbose']:\n print(message)\n return", "def print_verbose(args, msg):\n if args.verbose:\n print(msg)", "def print_info(message: str):\n global verbose\n if verbose:\n print(\"%s%s%s\" % (KYEL, message, KNRM))", "def print_warni...
[ "0.55090094", "0.5451742", "0.5423902", "0.5419448", "0.5378487", "0.53770965", "0.5367469", "0.53551465", "0.53439623", "0.53236914", "0.53030246", "0.52971905", "0.52728134", "0.52330023", "0.5109582", "0.5108932", "0.5082648", "0.50546724", "0.5050566", "0.50337845", "0.50...
0.7657903
0
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self,*args): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.72756827", "0.7249146", "0.7249146", "0.7249146", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", ...
0.0
-1
This function determines if the user input is a valid player. If input is 'Q', exits program.
def is_valid_player(user_input): i = user_input.upper() if i in Board.player_decoder: return True elif i == 'Q': exit("\nExiting program. Thanks for using Clue Detective!\n") else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_input(self):\n inp = input()\n if inp.upper() == \"Q\":\n return False\n if inp == \"\" \\\n \"\":\n return True\n return self.end_input", "def validate_input(user_input: str) -> bool:\n\n if not user_input.islower():\n return F...
[ "0.7061746", "0.7001091", "0.6993307", "0.685947", "0.679399", "0.6632149", "0.6587232", "0.6581674", "0.6562173", "0.65193605", "0.65072095", "0.6485321", "0.6314308", "0.6312182", "0.6304966", "0.63033706", "0.62971884", "0.62611985", "0.62489146", "0.6245538", "0.6236307",...
0.8541527
0
This function determines if the user input is a valid card. If skip = True, also allows 'X' as a valid input. If input is 'Q', exits program.
def is_valid(user_input, card_type=None, skip=False): i = user_input.upper() if i == 'Q': exit("\nExiting program. Thanks for using Clue Detective!\n") if skip: if i == 'X': return True if card_type: key_list = [key for key in Board.input_decoder ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_player(user_input):\n \n i = user_input.upper()\n if i in Board.player_decoder:\n return True\n elif i == 'Q':\n exit(\"\\nExiting program. Thanks for using Clue Detective!\\n\")\n else:\n return False", "def player_discard(self, inpt):\n \n if inpt....
[ "0.6342533", "0.59396064", "0.58468616", "0.58279556", "0.5803147", "0.5801814", "0.5795636", "0.5759419", "0.57581276", "0.5757214", "0.57171595", "0.5706514", "0.5694613", "0.5655004", "0.5642363", "0.5630517", "0.5617309", "0.5616001", "0.55874807", "0.55715656", "0.556892...
0.8009378
0
This function collects a list user inputs for players and suspects and decodes them.
def collect_players_and_suspects_list(): players_list = [] while (players_input := input("Enter player: ")) != '#': i = players_input.upper() if not is_valid_player(i): print("Please enter a valid Suspect.") continue if i not in players_list: play...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_players_list():\n \n players_list = []\n while (players_input := input(\"Enter player: \")) != '#':\n i = players_input.upper()\n if not is_valid_player(i):\n print(\"Please enter a valid Suspect.\")\n continue\n if i not in players_list:\n ...
[ "0.7785427", "0.5724351", "0.5629555", "0.5615475", "0.5556688", "0.54903173", "0.53061044", "0.5302518", "0.5204586", "0.51927483", "0.5189104", "0.515343", "0.51155186", "0.5102323", "0.50311154", "0.50235236", "0.5017103", "0.49988022", "0.49984848", "0.4991658", "0.499021...
0.8002285
0
This function collects a list user inputs for players and decodes them.
def collect_players_list(): players_list = [] while (players_input := input("Enter player: ")) != '#': i = players_input.upper() if not is_valid_player(i): print("Please enter a valid Suspect.") continue if i not in players_list: players_list.appe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_players_and_suspects_list():\n \n players_list = []\n while (players_input := input(\"Enter player: \")) != '#':\n i = players_input.upper()\n if not is_valid_player(i):\n print(\"Please enter a valid Suspect.\")\n continue\n if i not in players_list:...
[ "0.7349576", "0.5860871", "0.5805779", "0.57845634", "0.5769686", "0.57296795", "0.56243366", "0.5612682", "0.5509435", "0.5483779", "0.54824257", "0.54214525", "0.54100615", "0.54100615", "0.5393822", "0.5390574", "0.53871775", "0.5355974", "0.5330425", "0.531194", "0.530722...
0.7726118
0
This function collects a list user inputs for cards and decodes them.
def collect_cards(): cards_list = [] while (cards_input := input("Enter card: ")) != '#': i = cards_input.upper() if not is_valid(i): print(f"Please enter a valid card.") continue cards_list.append(i) cards_decoded = [Board.translate(card) for card in car...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_players_list():\n \n players_list = []\n while (players_input := input(\"Enter player: \")) != '#':\n i = players_input.upper()\n if not is_valid_player(i):\n print(\"Please enter a valid Suspect.\")\n continue\n if i not in players_list:\n ...
[ "0.6567946", "0.63332915", "0.5622721", "0.5523507", "0.5515353", "0.5509751", "0.54955375", "0.54447144", "0.53823245", "0.53788084", "0.5369966", "0.5357542", "0.5334989", "0.5311229", "0.5299947", "0.52394986", "0.52083004", "0.52079797", "0.5192435", "0.5192203", "0.51900...
0.7617722
0
Count the approximate number of words in a file.
def count_words(filename): try: with open(filename) as file_object: contents = file_object.read() except FileNotFoundError: message = "Sorry, the file " + filename + " does not exist." print(message) else: # Count approximate number of words in the file. w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_words(filename):", "def count_words_in_file(file_name):\n\n\treturn len(get_words_in_file(file_name))", "def count_words(filename):\n\ttry:\n\t\twith open(filename, encoding='utf-8') as f_obj:\n\t\t\tcontents = f_obj.read()\n\texcept FileNotFoundError:\n\t\tmsg = \"Sorry, the file \" + filename + \" ...
[ "0.89932305", "0.87853706", "0.8404579", "0.82420474", "0.82162976", "0.814177", "0.81379974", "0.80925703", "0.8089069", "0.8040269", "0.7950105", "0.79354155", "0.7916694", "0.7770902", "0.7747514", "0.7704495", "0.763296", "0.7585351", "0.7514763", "0.748077", "0.74705595"...
0.82336766
4
Return dataset with various zonal terms. Preserve a dimensionless
def compute_terms(file_full, file_mean, file_out, file_global='means.nc'): # Load datasets # TODO: Rename 'plev' to 'lev' # NOTE: GFDL doesn't use CF conventions right now. # See: https://github.com/xgcm/xgcm/issues/91 timer() if os.path.exists(file_out): os.remove(file_out) data_ful...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateDesignMatrix_X(z, x, y, n ):\n if len(x.shape) > 1:\n x = np.ravel(x)\n y = np.ravel(y)\n\n N = len(x)\n l = int((n+1)*(n+2)/2) \n X = np.ones((N,l))\n\n for i in range(1,n+1):\n q = int((i)*(i+1)/2)\n for k in range(i+1):\n X[:,q+k] = x**(i-k) *...
[ "0.6005747", "0.5714818", "0.5702035", "0.5689056", "0.5609547", "0.5551824", "0.55210054", "0.55030423", "0.5433913", "0.5422668", "0.5372532", "0.5342346", "0.53412604", "0.5335583", "0.5334253", "0.53181136", "0.53163016", "0.531613", "0.5307196", "0.5300388", "0.5294038",...
0.0
-1
Return tuple with name and symbol order of symbol table node gdbval
def get_symbol_name_order(gdbval): return (symtab_node_name (gdbval), int(gdbval["order"]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_gdb_symbol_table():\n\n tab = Symtab()\n n = gdb.parse_and_eval (\"symtab->nodes\")\n while (long(n)):\n if symtab_node_is_function (n):\n current_symbol = GdbFunction(tab, n)\n tab.all_functions.append (current_symbol)\n elif symtab_node_is_variable (n):\n ...
[ "0.63522923", "0.5892707", "0.5717121", "0.5676088", "0.5654664", "0.5606972", "0.55600977", "0.55475837", "0.5519339", "0.5508528", "0.54735756", "0.54546064", "0.5445889", "0.5444502", "0.53737164", "0.53344953", "0.531329", "0.53073454", "0.52950823", "0.52532065", "0.5196...
0.802892
0
Return pruned candidates containing only flags that are set in gdbval
def bool_attr_list(gdbval, candidates): r = [] for i in candidates: if long (gdbval[i]) != 0: r.append(i) pass pass return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bool_attr_list_1(gdbval, candidates):\n\n r = []\n for i in candidates:\n if long (gdbval[i[0]]) != 0:\n r.append(i[1])\n pass\n pass\n return r", "def flags(self):\n flags = self.Flags\n return [x for x in self.FLAGS_VALUES if flags & x]", "def ch...
[ "0.62069196", "0.58500195", "0.5761298", "0.56516194", "0.54694813", "0.54386127", "0.5421935", "0.5417712", "0.54035455", "0.53730446", "0.53225636", "0.53167844", "0.5297252", "0.529056", "0.528956", "0.5206268", "0.5202388", "0.5171703", "0.51404", "0.51187575", "0.5093403...
0.62399405
0
Like above but now candidates are tuples of real flag and user visible name
def bool_attr_list_1(gdbval, candidates): r = [] for i in candidates: if long (gdbval[i[0]]) != 0: r.append(i[1]) pass pass return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_candidates(self):\n items = ['id', self.filter, 'half_light', 'separation', 'P_c']\n for add_on in ['P_O', 'P_Ox']:\n if add_on in self.candidates.keys():\n items += [add_on]\n print(self.candidates[items])", "def flags(self) -> UserFlag:", "def candidate...
[ "0.62182224", "0.608126", "0.60353684", "0.5863966", "0.5694711", "0.5597789", "0.5595839", "0.55818534", "0.55225366", "0.55154634", "0.5509682", "0.5467662", "0.5419843", "0.5375041", "0.53720033", "0.5312513", "0.5310887", "0.5301905", "0.5269061", "0.5194035", "0.5187451"...
0.5899639
3
To be made method. Loads common attributes from symbol base
def load_symtab_base_attrs(self): sym = self.gdbval vis = bool_attr_list (sym, ["in_other_partition", "used_from_other_partition", "force_output", "forced_by_abi", "externally_visible"]) vis.extend(bool_attr_list_1(sym["decl"]["base"], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _base_attrs(self, service):\n keys = ['name', 'desc', 'url']\n return {name:getattr(service, name, None) for name in keys}", "def __extract_common_attrs(self, raw_data: Dict) -> None:\n for attr in self.COMMON_ATTRS:\n if attr not in self.ATTRS and attr in raw_data:\n ...
[ "0.61585546", "0.6084663", "0.6044661", "0.5943379", "0.5886491", "0.5802792", "0.57020926", "0.5637599", "0.56372637", "0.56197745", "0.56000906", "0.55648845", "0.5503462", "0.5496226", "0.5459958", "0.5452533", "0.54436445", "0.5441584", "0.54250926", "0.540444", "0.539474...
0.6953629
0
Return orders of nodes ipa_ref_list references
def gather_references_orders (gdbval): # TODO: Somehow also note speculative references and attributes in # general vec = gdbval["references"] return [int(i["referred"]["order"]) for i in vec_iter(vec)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_referring_orders (gdbval):\n# TODO: Somehow also note speculative references and attributes in\n# general\n vec = gdbval[\"referring\"]\n return [int(i[\"referring\"][\"order\"]) for i in vec_iter(vec)]", "def angle_sort_adjacent_nodes(self,n,ref_nbr=None):\n nbrs=self.node_to_nodes(n)\n ...
[ "0.731949", "0.6546845", "0.6098026", "0.6095413", "0.6079038", "0.5992602", "0.5936781", "0.59094507", "0.58531016", "0.58507776", "0.58364546", "0.58358586", "0.58252954", "0.58145785", "0.5806854", "0.5802949", "0.5786999", "0.5780388", "0.5758174", "0.5740272", "0.5738646...
0.79086727
0
Return orders of nodes referring node associated with ipa_ref_list
def gather_referring_orders (gdbval): # TODO: Somehow also note speculative references and attributes in # general vec = gdbval["referring"] return [int(i["referring"]["order"]) for i in vec_iter(vec)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_references_orders (gdbval):\n# TODO: Somehow also note speculative references and attributes in\n# general\n vec = gdbval[\"references\"]\n return [int(i[\"referred\"][\"order\"]) for i in vec_iter(vec)]", "def angle_sort_adjacent_nodes(self,n,ref_nbr=None):\n nbrs=self.node_to_nodes(n)\n...
[ "0.7483979", "0.6498939", "0.60103464", "0.59589404", "0.592434", "0.58175755", "0.57886195", "0.57791865", "0.5778693", "0.5724725", "0.5648295", "0.56302035", "0.56052834", "0.56052834", "0.55912304", "0.55762887", "0.55696046", "0.55564326", "0.5543322", "0.55140626", "0.5...
0.70957726
1
Build and return our representation of the symbol table
def build_gdb_symbol_table(): tab = Symtab() n = gdb.parse_and_eval ("symtab->nodes") while (long(n)): if symtab_node_is_function (n): current_symbol = GdbFunction(tab, n) tab.all_functions.append (current_symbol) elif symtab_node_is_variable (n): current...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n dictt = self.getFullDict()\n return \"SymbolTable(\\n{}\\n)\".format(pprint.pformat(dictt))", "def symbol_table(self) -> str:\n return self._symbol_table", "def getSymbolTable(self) -> ghidra.app.util.bin.format.pe.debug.DebugCodeViewSymbolTable:\n ...", "def ...
[ "0.7142161", "0.7140003", "0.7079655", "0.67236257", "0.66320723", "0.65642846", "0.65429175", "0.65292776", "0.64784485", "0.6340965", "0.6260409", "0.62448263", "0.62234396", "0.61231375", "0.60608643", "0.6057268", "0.5934887", "0.58612394", "0.5844101", "0.5835696", "0.57...
0.7709988
0
Return text describing important edge flags or empty string
def flags(self, f): if f.is_inlined: return " (inlined)" return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def human_readable(self):\n if self.no_flags_set():\n return \"no flags set\"\n else:\n flag_desc = []\n for name in (\"bookmarked\", \"for_validation\", \"candidate\", \"final causative\"):\n if getattr(self, \"flag_%s\" % name.replace(\" \", \"_\")):\...
[ "0.6562656", "0.612036", "0.56815875", "0.5583346", "0.55517215", "0.55415154", "0.5524572", "0.548128", "0.54642874", "0.5456155", "0.541521", "0.5414519", "0.54008186", "0.5340721", "0.5325096", "0.5318845", "0.5292452", "0.5237705", "0.52254677", "0.52168465", "0.51546", ...
0.584295
2
Output the model predictions for the test set
def output_predictions(predictions_file, relations, predictions, test_set_keys, test_labels): with codecs.open(predictions_file, 'w', 'utf-8') as f_out: for i, (w1, w2) in enumerate(test_set_keys): f_out.write('\t'.join([w1, w2, relations[test_labels[i]], relations[predictions[i]]]) + '\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test():\n # load dataset and model\n X, observed_y = load_data('../data/dev.txt')\n\n model = pickle.load(open('test.model', 'rb'))\n model.traverse()\n\n # predict labels for dataset\n preds = model.predict(X)\n\n # print(preds)\n # output model predictions\n np.savetxt('test.predict...
[ "0.7996614", "0.7647699", "0.75771004", "0.7555528", "0.7431584", "0.73849654", "0.7349671", "0.7293962", "0.721062", "0.71926904", "0.71917266", "0.7171003", "0.7115817", "0.71051496", "0.7090768", "0.70273274", "0.70217824", "0.70038015", "0.69980234", "0.6995777", "0.69682...
0.6510511
93
Evaluate performance of the model on the test set
def evaluate(test_set, predictions): full_report = metrics.classification_report(test_set.labels, predictions, labels=range(len(test_set.index2label)), target_names=test_set.index2label, digits=3) pre, rec, f1, suppo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_evaluate():\n X_train, X_test, y_train, y_test = src.load()\n clf, score = src.train(X_train, y_train)\n test_score = src.evaluate(clf, X_test, y_test)\n assert isinstance(test_score, float)", "def evaluate(self, test_x, test_y):\n score = self._model.evaluate(test_x, test_y, verbose=...
[ "0.78246766", "0.76479584", "0.7578219", "0.75720495", "0.7560957", "0.75514156", "0.75444853", "0.75016856", "0.747195", "0.7463784", "0.745974", "0.7456538", "0.74170643", "0.7399785", "0.73661226", "0.73332477", "0.73242176", "0.7319569", "0.7294839", "0.7294839", "0.72948...
0.0
-1