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
Returns how many four byte data points UDLR are ready for read over I2C. One fourbyte dataset is equivalent to a single count.
def get_number_of_datasets_in_fifo(self): return self.read_byte_data(APDS_9960.GESTURE_FIFO_LEVEL_REG_ADDRESS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_data_length(self):\n return self.unpack_dword(0x4)", "def data_count(self):\n return(len(self.data))", "def getDataSetCount(self):\n\t\treturn int(self.numberOfImages / self.slicesPerTimepoint)", "def data_length(self):\n size = self.unpack_dword(0x4)\n if size >= 0x800000...
[ "0.6965965", "0.6805894", "0.677659", "0.6650018", "0.6626462", "0.660655", "0.6508911", "0.6501165", "0.6457129", "0.63789034", "0.6369483", "0.63651574", "0.6353523", "0.634668", "0.63127184", "0.6292377", "0.6277734", "0.626514", "0.62461203", "0.62191695", "0.6219098", ...
0.6746333
3
Returns a dictionary containing data about the gesture engine status.
def get_gesture_status(self): status_dict = dict() status = self.read_byte_data(APDS_9960.GESTURE_STATUS_REG_ADDRESS) status_dict["Gesture FIFO Overflow"] = bool(status & 0x02) status_dict["Gesture FIFO Data"] = bool(status & 0x01) return status_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status() -> Dict[str, Any]:", "def get_status(self):\n try:\n status = {\n 'camexptime': self.opt.getParameter(\"ExposureTime\"),\n 'camtemp': self.opt.getParameter(\"SensorTemperatureReading\"),\n 'camspeed': self.opt.getParameter(\"...
[ "0.67118496", "0.6359854", "0.63554245", "0.63188607", "0.63046604", "0.63020104", "0.6280393", "0.62538207", "0.6187765", "0.6148763", "0.6148763", "0.60787195", "0.6050782", "0.6022429", "0.5923977", "0.59058446", "0.5827834", "0.5772614", "0.57632864", "0.5760877", "0.5758...
0.78221256
0
Returns a dataset (list) containing one integration cycle of UP, DOWN, LEFT & RIGHT gesture data. The amount of valid data can be retrieved with the get_number_of_datasets_in_fifo method.
def get_gesture_data(self): return self.read_byte_data(APDS_9960.GESTURE_FIFO_UP_REG_ADDRESS, 4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_number_of_datasets_in_fifo(self):\n return self.read_byte_data(APDS_9960.GESTURE_FIFO_LEVEL_REG_ADDRESS)", "def dataset(self, timestep, data):\n dataX, dataY = [], []\n for i in range(len(data) - timestep):\n a = data[i:i+timestep]\n dataX.append(a)\n ...
[ "0.5852155", "0.5746589", "0.5575211", "0.52337414", "0.521903", "0.5214273", "0.5177917", "0.51684827", "0.5153699", "0.5144116", "0.51306015", "0.5125717", "0.50881463", "0.5033911", "0.4991926", "0.49757648", "0.49741545", "0.49630612", "0.4963001", "0.49560064", "0.494188...
0.5125201
12
Returns a list containing the gesture on the vertical and horizontal axis.
def parse_gesture(self, parse_millis, tolerance=12, der_tolerance=6, confidence=6): # Detecting method: # 1) identify instants where difference between values on same axis is greater than tolerance # 2) identify instants where both curves are raising or falling # 2.1) the curves must be ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def direction_list(self, direction):\n direction_indexes = []\n \n if direction == UP:\n for index in range(self.grid_width):\n direction_indexes.append((0, index))\n elif direction == DOWN:\n for index in range(self.grid_width):\n dir...
[ "0.6198005", "0.5994915", "0.58802724", "0.580129", "0.566136", "0.5641522", "0.55955166", "0.5565415", "0.5562642", "0.5554385", "0.55116755", "0.55086863", "0.5496624", "0.544342", "0.54133064", "0.5302831", "0.5293964", "0.52856165", "0.5262742", "0.5256534", "0.5256534", ...
0.0
-1
Returns a list containing the gesture on the vertical and horizontal axis.
def parse_gesture_in_fifo(self, tolerance=12, der_tolerance=6, confidence=6): # Detecting method: # 1) identify instants where difference between values on same axis is greater than tolerance # 2) identify instants where both curves are raising or falling # 2.1) the curves must be both r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def direction_list(self, direction):\n direction_indexes = []\n \n if direction == UP:\n for index in range(self.grid_width):\n direction_indexes.append((0, index))\n elif direction == DOWN:\n for index in range(self.grid_width):\n dir...
[ "0.619709", "0.5993052", "0.5878882", "0.5800106", "0.56582206", "0.56405044", "0.55922693", "0.55626017", "0.5559752", "0.5553044", "0.55093575", "0.55067503", "0.5494705", "0.5442488", "0.5411216", "0.5298546", "0.529164", "0.5283711", "0.5259643", "0.52564645", "0.52564645...
0.0
-1
Sets the wait time in WTIME register. This is the time that will pass between two cycles.The wait time should be configured before the proximity and the als engines get enabled.\n
def set_wait_time(self, wtime, long_wait=False): if not (2.78 <= wtime <= 712): raise ValueError("The wait time must be between 2.78 ms and 712 ms") # long_wait self.write_flag_data([long_wait], APDS_9960.CONFIG_1_REG_ADDRESS, 1) # wtime reg_value = 256 - int(wtime /...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_wait_time(self, wait_time):\n\n self.wait_time = wait_time", "def set_wait_time(self, wait_time: float) -> float:\n old_value = self.ctx.wait_time\n self.logger.info(\"Previous wait time: %f\", old_value)\n self.ctx.wait_time = wait_time\n self.logger.info(\"Current wai...
[ "0.71683836", "0.704844", "0.6420835", "0.63204366", "0.6306031", "0.6263331", "0.6172487", "0.6112949", "0.6088477", "0.6068016", "0.6060896", "0.6039526", "0.59966606", "0.59099597", "0.58910114", "0.5890448", "0.58388716", "0.58361197", "0.58211887", "0.580388", "0.5752", ...
0.7931268
0
Encodes source as represented by 'inputs' and 'paddings'.
def FProp(self, theta, batch, state0=None): p = self.params if len(batch) == 0: if state0 is None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encoder(self, inputs):\n pass", "def _encode(self, src_token_ids, padding_mask, training=False):\n src_seq_len = tf.shape(src_token_ids)[1]\n\n # [batch_size, src_seq_len, hidden_size]\n src_token_embeddings = self._embedding_logits_layer(\n src_token_ids, 'embedding')\n\n # [src_se...
[ "0.6393677", "0.6236149", "0.57813305", "0.5744998", "0.5713711", "0.56830484", "0.5675328", "0.56591916", "0.56508505", "0.5594174", "0.54860765", "0.54719675", "0.54162896", "0.53920615", "0.5389944", "0.5383457", "0.53790414", "0.53164047", "0.5311453", "0.52892953", "0.52...
0.0
-1
Extend command line options
def setDefaultOpts(self): self.getopt.s = ['h'] self.getopt.l = ['help'] self.getopt.s.extend([('x:', 'screen')]) self.getopt.l.extend([('xml=', 'screen')]) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_command_line_arguments(self, parser):\n # parser.add_option(...)\n pass", "def cli(*args, **kwargs):\n logger.debug('Global options: %s %s', args, kwargs)", "def add_options(self, parser):\n parser.add_argument(\n '--name',\n required=True,\n hel...
[ "0.74154645", "0.7267616", "0.7154342", "0.71127856", "0.70718324", "0.70689887", "0.7049017", "0.6919293", "0.69133335", "0.6854206", "0.6841104", "0.67878425", "0.6746448", "0.6739454", "0.6734259", "0.6728693", "0.6719667", "0.67006016", "0.66956085", "0.6658744", "0.66575...
0.62483907
65
Print usage and exit
def help(self): self.usage() print "\tscreen - XML screen file" print "\troll - roll name" sys.exit(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def usage():", "def usage():", "def print_usage():\n print(helptxt)\n sys.exit(2)", "def usage():\n pass", "def usage():\n print(\"\"\"Usage:\n\\t%s storer - initialize storer machine\n\\t%s tester - initialize tester machine\n\\t%s --help - print this message\"\"\"% (sys.argv[0], sys.a...
[ "0.8540473", "0.8540473", "0.84919333", "0.84653074", "0.83982116", "0.8360569", "0.82764083", "0.82639", "0.8240902", "0.8234153", "0.8213808", "0.8195849", "0.8182492", "0.8163278", "0.8128129", "0.8127764", "0.8102956", "0.8102907", "0.81016296", "0.8100547", "0.8091029", ...
0.0
-1
Parse the command line arguments
def parseArg(self, c): if rocks.app.Application.parseArg(self,c): return 1 elif c[0] in ('-h', '--help'): self.help() elif c[0] in ('-x', '--xml'): self.xmlname = c[1] else: return 0 return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def parse_args():\n parser = argparse.ArgumentParser(\n description=\"Reads datapacket pcds, interpolates quaternions and generates scans from dataset in config file\")\n parser.add_argument(\"--visualization\", \"-v\", action=\"store_true\", help=\"if generated clouds ...
[ "0.8463088", "0.7762483", "0.7595797", "0.75803727", "0.75363654", "0.74865943", "0.74373615", "0.74205333", "0.74059993", "0.73710746", "0.7360746", "0.7359222", "0.7348543", "0.7336221", "0.7312769", "0.7304517", "0.7295875", "0.72851336", "0.72816515", "0.72586316", "0.725...
0.0
-1
Read file, make substitution in the text and write it back
def update(self, namein, nameout): text = self.dict.sub(self.readFile(namein)) self.writeFile(nameout, text) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace(file,original_text,replacement_text):\n with open(file, \"rt\") as fin:\n with open(str(file+\"temp\"), \"wt\") as fout:\n for line in fin:\n fout.write(line.replace(original_text,replacement_text))\n os.rename(str(file+\"temp\"),file)\n return", ...
[ "0.7470895", "0.6829948", "0.6775293", "0.6699112", "0.667148", "0.66163397", "0.6611953", "0.6509472", "0.64926404", "0.64180636", "0.63990706", "0.6394162", "0.6386282", "0.63454515", "0.6338757", "0.6270957", "0.62171835", "0.6172117", "0.61372066", "0.6131056", "0.6099545...
0.58629847
39
Read text file, return a string
def readFile(self, name): try: f = open(name, 'r') lines = f.readlines() f.close() except IOError: return None return join(lines, "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_text_file(str_name_file: str):\n content: str = ''\n with open(str_name_file, mode=\"r\", encoding='utf-8') as file:\n print(\"file being read: \" + str_name_file + \"\\n\")\n content = file.read()\n return content", "def get_file_text(file_name):\n\tf = open(file_name, 'r')\n\tte...
[ "0.8200656", "0.8098248", "0.80859804", "0.79805297", "0.7968974", "0.79433477", "0.7905611", "0.78909206", "0.78878796", "0.78673226", "0.7852728", "0.78510374", "0.7840793", "0.783514", "0.7832882", "0.78026927", "0.7782426", "0.77806133", "0.77787197", "0.7776085", "0.7753...
0.7493206
34
write text as file
def writeFile(self, name, text): try: f = open(name, 'w') f.write (text) f.close() except IOError: print "Error writing file %s" % name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(file, text):\n with open(file, 'w') as f:\n f.write(text)", "def write_text(file, text):\n\n with open(file, \"w\") as fin:\n fin.write(text)", "def save_file(path, text):\n with path.open(mode='w') as f_stream:\n f_stream.write(text)", "def write_text_tofile(t...
[ "0.838334", "0.8327239", "0.81742823", "0.8125175", "0.8107922", "0.8024563", "0.8004334", "0.796951", "0.796936", "0.7963415", "0.79439694", "0.79439694", "0.7943704", "0.7914818", "0.7914607", "0.7904219", "0.789913", "0.78785634", "0.7777966", "0.77551347", "0.77389354", ...
0.82115006
2
Create directory structure for the screen validatinon
def createValDir(self): self.setDirNames() self.setScreenXmlFile() self.rollValDir = self.roll + "/screenval" cmd = 'mkdir -p %s' % (self.rollValDir) os.system(cmd) self.createValDirFiles() return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dir_structure():\n LOG.info('In create_dir_structure')\n OutputWrite.change_to_script_directory(__file__)\n path = os.path.abspath(os.path.join('..', 'results',\n global_constants.TEXT_BOARD,\n glo...
[ "0.7517085", "0.7262001", "0.7171064", "0.71349293", "0.71348125", "0.71185154", "0.7061228", "0.7005415", "0.7003764", "0.69985324", "0.69676894", "0.694342", "0.6940834", "0.6938961", "0.69190633", "0.68955886", "0.6895335", "0.6864591", "0.6863628", "0.683907", "0.6799886"...
0.6422778
52
Converts the class into an actual view function that can be used with the routing system.
def as_view(cls, *class_args, **class_kwargs): def view(*args, **kwargs): self = view.view_class(*class_args, **class_kwargs) return self.dispatch_request(*args, **kwargs) if cls.decorators: view.__module__ = cls.__module__ for decorator in cls.decorators...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_based_view(class_obj):\n def _instantiate_view_class(request, *args, **kwargs):\n return class_obj()(request, *args, **kwargs)\n return _instantiate_view_class", "def view(*args, **kwargs):\n return mapped_method()", "def as_view(cls, action_map=None, **initkwargs):\n\n ...
[ "0.7130562", "0.6647537", "0.6336556", "0.6319192", "0.6234824", "0.6024823", "0.5994954", "0.5994746", "0.5961081", "0.5866267", "0.5750484", "0.5746268", "0.57084966", "0.5661729", "0.5657357", "0.56163543", "0.5614417", "0.5526965", "0.5523861", "0.5491312", "0.5483121", ...
0.6394721
2
Returns a dict of dbus interfaces.
def get_dbus_ifaces(self): return self._dbus_ifaces
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interfaces():\n network_interfaces = SCNetworkInterfaceCopyAll()\n interfaces = {}\n for interface in network_interfaces:\n interfaces[SCNetworkInterfaceGetLocalizedDisplayName(interface)] = (\n SCNetworkInterfaceGetBSDName(interface),\n SCNetworkInterfaceGetHardwareAddres...
[ "0.7358894", "0.7150124", "0.68616456", "0.6820615", "0.66954243", "0.66954243", "0.66954243", "0.6686356", "0.6671246", "0.6556159", "0.64973927", "0.6446753", "0.6399331", "0.62750125", "0.62499094", "0.6212139", "0.6208432", "0.6115565", "0.5980625", "0.59045655", "0.58903...
0.77575576
0
Returns the loaded SystemBus.
def get_bus(self): return self._bus
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bus_dict(self):\n return self.__bus_dict", "def get_smbus():\n i2c__bus = 1\n # detect the device that is being used\n device = platform.uname()[1]\n\n if device == \"orangepione\": # running on orange pi one\n i2c__bus = 0\n\n elif device == \"orangepipl...
[ "0.6234107", "0.5998028", "0.59519386", "0.5855848", "0.5798353", "0.570983", "0.5569113", "0.55527186", "0.5532193", "0.55319244", "0.54964405", "0.53938514", "0.53630793", "0.53336924", "0.52561456", "0.52470714", "0.52383316", "0.5221863", "0.5217714", "0.5209887", "0.5207...
0.71137506
0
Connects to wicd's dbus interfaces and loads them into a dict.
def connect_to_dbus(self): if not self._connected_to_dbus: self._connected_to_dbus = True proxy_obj = self._bus.get_object("org.wicd.daemon", '/org/wicd/daemon') self.proxy_obj = proxy_obj daemon = dbus.Interface(proxy...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dbus_ifaces(self):\n return self._dbus_ifaces", "def get_dbus_iface(self):\n bus = dbus.SessionBus()\n proxy = bus.get_object('org.gnome.OnlineAccounts',\n '/org/gnome/OnlineAccounts')\n #create an interface\n iface=dbus.Interface(proxy, dbus_i...
[ "0.63243794", "0.61948055", "0.6133798", "0.6085817", "0.6025295", "0.5993055", "0.598986", "0.5967712", "0.5866993", "0.57578254", "0.570974", "0.570974", "0.570974", "0.56391793", "0.562033", "0.5609738", "0.5578401", "0.5575785", "0.549144", "0.5474739", "0.5416814", "0....
0.72666514
0
Instanciates the network service identified by nsi_id, according to the infomation contained in the body and placement info.
def instantiate_ns(self, nsi_id, ns_descriptor, vnfds_descriptor, body, placement_info, resources, nestedInfo): # def instantiate_ns(self, nsi_id, ns_descriptor, body, placement_info): instantiationLevel = body.ns_instantiation_level_id # for composition/federation if nestedInfo: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_nat(self, **attrs):\n return self._create(_gw.Service, tenant_id=self.get_project_id(), **attrs)", "def instantiate_ns(self, nsi_id, ns_descriptor, vnfds_descriptor, body, placement_info, resources, nestedInfo):\n # def instantiate_ns(self, nsi_id, ns_descriptor, body, placement_info):\n\n ...
[ "0.6335052", "0.6247537", "0.55753195", "0.5547516", "0.5483825", "0.5348924", "0.5348753", "0.5343674", "0.53388757", "0.52977514", "0.52889186", "0.5284363", "0.5252318", "0.5211557", "0.52037406", "0.51928276", "0.5176395", "0.51586324", "0.51461804", "0.5130979", "0.51220...
0.6352651
0
Scales the network service identified by nsi_id, according to the infomation contained in the body and current instantiation level.
def scale_ns(self, nsi_id, ns_descriptor, vnfds_descriptor, body, current_df, current_il, placement_info): scale_ns_instantiation_level_id = self.extract_target_il(body) blueprint_name = nsi_id + "_" +ns_descriptor['nsd']['nsdIdentifier'] + "_" + scale_ns_instantiation_level_id blueprints = self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale_ns(self, nsi_id, ns_descriptor, vnfds_descriptor, body, current_df, current_il, placement_info):\n scale_ns_instantiation_level_id = self.extract_target_il(body)\n blueprint_name = nsi_id + \"_\" +ns_descriptor['nsd']['nsdIdentifier'] + \"_\" + scale_ns_instantiation_level_id\n bluep...
[ "0.6663936", "0.53656894", "0.5346644", "0.529986", "0.5265903", "0.51705396", "0.51446146", "0.50951284", "0.49811757", "0.49804008", "0.4920104", "0.49189124", "0.4805336", "0.4800882", "0.47781575", "0.4775109", "0.47595185", "0.47415102", "0.47363317", "0.47081032", "0.46...
0.67621905
0
Terminates the network service identified by nsi_id.
def terminate_ns(self, nsi_id): # undeploying ns_descriptor = ns_db.get_ns_description(nsi_id) rvm_agents_execute_scripts = RvmAgentsExecuteScripts(ns_descriptor) vnfds_json = {} # for each vnf in the NSD, get its json descriptor vnfdIds = ns_descriptor["nsd"]["vnfdId"]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def terminate_ns(self, nsi_id):\n\n # undeploying\n try:\n self.__cloudify_client.executions.start(nsi_id, \"uninstall\")\n log_queue.put([\"DEBUG\", \"CLOUDIFY_WRAPPER: Deployment %s uninstalling started\" % (nsi_id)])\n except Exception as e:\n log_queue.put...
[ "0.71575254", "0.62177163", "0.5835222", "0.56933314", "0.5600671", "0.5458452", "0.5437729", "0.5433288", "0.5391267", "0.5322592", "0.5261191", "0.5252593", "0.5244304", "0.5236414", "0.52300787", "0.52211785", "0.5210781", "0.5204278", "0.5184484", "0.517949", "0.5172703",...
0.71344113
1
Retrieves the execution information from cloudify
def get_execution(self, execution): url = 'http://%s/api/v3.1/executions/%s' % (self.__nfvo_ip, execution) log_queue.put(["DEBUG", "CLOUDIFY_WRAPPER: get_execution:%s" % url]) headers = {'Tenant': self.__tenant} response = requests.get( url, auth=HTTPBasicAuth(se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_info(self):\n return self._execute_info", "def info(self):\n return self.current_run.info", "def getting_info(self, cloud_path):\n\t\telog(\"getting info on {}\".format(cloud_path))", "def get_details():\r\n return run_operations.get_run_details(experiment_name, job_name).as_...
[ "0.6248778", "0.60198", "0.5965757", "0.57979256", "0.56930804", "0.5690845", "0.5673515", "0.5569008", "0.5524897", "0.5520824", "0.5476594", "0.54516757", "0.5397282", "0.5385398", "0.53722733", "0.5347192", "0.53452855", "0.5344031", "0.5329491", "0.5324772", "0.5282701", ...
0.6215288
2
Contact with the monitoring manager to stop the requested exporter
def __mp_excute_script(self, agent_id, args=[], env={}, type_message="bash_script", cwd="/tmp", body=[], sync=False): timeout = 600 header = {'Content-Type': 'application/json', 'Accept': 'application/json'} # create the exporter for the job monitoring_uri = "http:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_monitoring(self):\n pass", "def stop (self):\n super(InfofileCollector, self).stop()\n self.log.info (\"stopping\")\n self.maint_timer.cancel()", "def stop_continuous_export(exportId=None):\n pass", "def stop_monitor(self):\n self._logger.info(\"Stopping mon...
[ "0.74387664", "0.6733714", "0.66355914", "0.6526584", "0.64729476", "0.64426816", "0.6436118", "0.6276116", "0.6193412", "0.61771905", "0.6173543", "0.6160969", "0.6133341", "0.612488", "0.6113697", "0.6107243", "0.6094971", "0.60902697", "0.6082868", "0.6082694", "0.60697716...
0.0
-1
Create a conformer set from files
def read_conformers (mol, pathname, method='RDKit') : dcdfilename = os.path.join(pathname,'%s.dcd'%(method)) dcd = DCDTrajectoryFile(dcdfilename) nsteps = dcd.get_length() # Read in the corresponding energies enfilename = os.path.join(pathname,'energies%s.dat'%(method)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_valids(self):\n\n new_valids = set()\n\n # Loop over files\n for present_file in self.files:\n match = re.match(self.regex_pattern, present_file)\n if match:\n valids = []\n matchdict = match.groupdict()\n for cons...
[ "0.646122", "0.59838766", "0.59384596", "0.59053177", "0.58477366", "0.57572323", "0.5716452", "0.57056653", "0.5694463", "0.5687077", "0.5685289", "0.5673574", "0.56705767", "0.5602477", "0.55930436", "0.5551193", "0.55377233", "0.55347", "0.55212134", "0.55127597", "0.55119...
0.0
-1
Check the validity of the placement of the last card on the board
def is_valid_placement(self,deck): placement_location = len(self) - 1 # Check top/bottom abutment if not a top row placement if placement_location >= self.x: (match1,pair1) = deck.get_image(self[placement_location-self.x],'bottom') (match2,pair2) = deck.get_image(self[pl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_placement(self, other_pile):\n card = other_pile.get_bottommost_card()\n if self.get_length() == 0:\n return card.get_rank_value() == 13\n else:\n return (self.get_topmost_card().get_color() != card.get_color() and\n self.get_topmost_card()...
[ "0.7401868", "0.6956469", "0.6436466", "0.636768", "0.62613374", "0.62467", "0.62132215", "0.620385", "0.61512715", "0.61375725", "0.611994", "0.61042553", "0.608963", "0.6071223", "0.60494775", "0.6039633", "0.603626", "0.6031059", "0.6020853", "0.599914", "0.5975413", "0....
0.68988156
2
Return image description, given card number, orientation, and side
def get_image(self, card_placement, side): transform = dict() for orient in ['left','bottom','right','top']: transform[orient] = dict() transform['left'][0] = 'left' transform['left'][90] = 'top' transform['left'][180] = 'right' transform['left'][270...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getImage(cardTitle, size=\"normal\"):\n page = requests.get(\"https://api.scryfall.com/cards/named?exact=\"+name)\n page_json = json.loads(page.content)\n image_link = page_json[\"image_uris\"][size]\n image_response = requests.get(image_link)\n img = Image.open(BytesIO(image_response.content))\...
[ "0.5829418", "0.5798083", "0.579327", "0.579327", "0.579327", "0.5719987", "0.5631038", "0.5527739", "0.547468", "0.54480004", "0.5408572", "0.5397182", "0.53926843", "0.53478795", "0.5347723", "0.530061", "0.5299182", "0.52908343", "0.52543336", "0.52498025", "0.52470237", ...
0.6755359
0
Return a list of potential include directories The directories are looked for in $ROS_WORKSPACE.
def GetRosIncludePaths(): try: from rospkg import RosPack except ImportError: return [] rospack = RosPack() includes = [] includes.append(os.path.expandvars('$ROS_WORKSPACE') + '/devel/include') for p in rospack.list(): if os.path.exists(rospack.get_path(p) + '/include'):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include_dirs(self):", "def include_directories(self):\n\n status, stdout, stderr = self.__xcall__(['--cflags-only-I'])\n\n if status != 0:\n raise RuntimeError(\"error querying --cflags-only-I for package `%s': %s\" % (self.name, stderr))\n\n retval = []\n for token in stdout.split():\n ...
[ "0.7431349", "0.7071893", "0.6695784", "0.6391757", "0.62534636", "0.6206104", "0.61698794", "0.6164818", "0.6162465", "0.61130905", "0.59863424", "0.59671843", "0.595017", "0.5910829", "0.5864319", "0.5818589", "0.5818256", "0.5804679", "0.57835627", "0.57746977", "0.5763365...
0.7856859
0
add new text to database
def post(self): schema = TextSchema() text = schema.load(request.json) if not self.is_english(text.content): return {'msg': 'Please provide text in english language'}, 403 db.session.add(text) try: db.session.commit() except exc.IntegrityError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_in_db(self):\n self.sql_database.table_name = self.table_db\n self.sql_database.db_name = self.db\n if self.sql_database.insert_item(text_path=self.path, word_first=self.word_1.get(),\n word_second=self.word_2.get(),\n ...
[ "0.7414767", "0.723477", "0.7126999", "0.69205123", "0.69079596", "0.6881423", "0.6823626", "0.67970353", "0.66661847", "0.66294885", "0.6619974", "0.6582118", "0.65800226", "0.6576574", "0.6467404", "0.64535683", "0.64525855", "0.6434225", "0.64124787", "0.63918847", "0.6381...
0.6728411
8
checks if text is english
def is_english(s): return s.isascii()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_english(text):\n\n lang = langid.classify(text)\n if lang and 'en' in lang[0]:\n return True\n return False", "def is_english (self, testing_string): \n try:\n self.testing_string.encode(encoding='utf-8').decode('ascii')\n except UnicodeDecodeError:\n ...
[ "0.83676195", "0.7401827", "0.7362285", "0.73488593", "0.7216915", "0.6941378", "0.67869246", "0.67321897", "0.6659703", "0.64074117", "0.63667846", "0.6357376", "0.6318342", "0.63002014", "0.6296254", "0.6283613", "0.6254338", "0.61328095", "0.61248124", "0.6075229", "0.6049...
0.7584006
1
for communication results with frontend
def post(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results(self):\r\n pass", "def main_response(self, data):", "def main_response(self, data):", "def results(self):\n pass", "def getResults():", "def result(self):", "def result(self):", "def execute():\n # print('Wow')\n result = gui.controller.main('execute')\n print(resul...
[ "0.71658444", "0.6976407", "0.6976407", "0.69247645", "0.66770613", "0.66602904", "0.66602904", "0.6562153", "0.6558969", "0.6538561", "0.6538561", "0.6438467", "0.6370705", "0.6352068", "0.6308177", "0.62997526", "0.62918615", "0.6279244", "0.6279244", "0.6279244", "0.627811...
0.0
-1
Yield samples that match the sizes given in test_set_sizes
def generate_bootstrap_samples(num_samples, test_universe, test_set_sizes): for sample_idx, sample_size in zip(range(num_samples), cycle(test_set_sizes)): yield random.sample(test_universe, sample_size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_testset_by_size(detections_test, size_of_test):\n np.random.shuffle(detections_test)\n detections_test = detections_test[:size_of_test]\n return detections_test", "def generate_all_sizes():\n dimension = 4\n h = 1\n while h <= dimension:\n w = 1\n while w <= dimension:\n ...
[ "0.7003292", "0.6358629", "0.6354436", "0.63406867", "0.6215302", "0.61314887", "0.61234194", "0.61158", "0.5919841", "0.59143543", "0.5912967", "0.5894723", "0.5880695", "0.58752054", "0.58684736", "0.58575505", "0.58524823", "0.5847237", "0.5845906", "0.5837592", "0.5824021...
0.7094605
0
Calculate the pvalue for the statistic's value given the bootstrap values.
def bootstrap_p_value(bootstrap_stats, stat_value): return 1. - bisect.bisect_left(bootstrap_stats, stat_value) / float(len(bootstrap_stats))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_pvalue(self):\n # Run permutation test\n self.PermutationTest()\n # TS obtained from the original B,T samples\n self.compute_obs_TS()\n \n # Mean and std of the TS distribution\n self.mu = np.mean(self.TS_tilde)\n self.sigma = np.std(s...
[ "0.7119551", "0.6831631", "0.6723791", "0.6578932", "0.63636523", "0.6330244", "0.6273115", "0.61739874", "0.61700726", "0.60664284", "0.6063051", "0.60404253", "0.5994923", "0.59388614", "0.58792776", "0.5878404", "0.58015406", "0.57798564", "0.5777446", "0.5767656", "0.5734...
0.81658536
0
V.InsertUniquePoint((float, float, float), int) > int
def InsertUniquePoint(self, , p_int): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def InsertUniquePoint(self, p_int, p_int_1, p_float=..., p_float=..., p_float=..., *args, **kwargs):\n ...", "def InsertPoint(self, p_int, ):\n ...", "def IsInsertedPoint(self, p_float, p_float_1, p_float_2):\n ...", "def insert_point(mutated_genome,index):\n Xval = random.randint(-int...
[ "0.8360211", "0.70485127", "0.6657257", "0.6240049", "0.6117624", "0.61017", "0.6094638", "0.60448194", "0.6002602", "0.5940192", "0.5917521", "0.590941", "0.5883831", "0.5880281", "0.58686423", "0.58084434", "0.5799359", "0.57562137", "0.5697369", "0.5687507", "0.56654364", ...
0.8587277
1
V.IsInsertedPoint((float, float, float)) > int
def IsInsertedPoint(self, ): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsInsertedPoint(self, p_float, p_float_1, p_float_2):\n ...", "def ok(self, point):\n return True", "def ok(self, point):\n return True", "def ispoint(x):\n if isvect(x) and x[3] > 0.0:\n return True\n return False", "def HasPoint(self, vtkAMRBox, , , p_float_6, p_float_7, p_f...
[ "0.8541304", "0.6527406", "0.6527406", "0.6503304", "0.64666", "0.62288606", "0.61674756", "0.5932806", "0.58874726", "0.58293164", "0.58153427", "0.5787648", "0.5787648", "0.5770268", "0.57607293", "0.5741381", "0.5737718", "0.5704304", "0.5689921", "0.5685091", "0.5650125",...
0.8298714
1
Create and return a new object. See help(type) for accurate signature.
def __new__(*args, **kwargs): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_object():\n return object()", "def create(cls, _):\n return cls", "def __newobj__(cls, *args):\n return cls.__new__(cls, *args)", "def create(cls):\n pass\n return cls()", "def __new__(cls):\n return object.__new__(cls)", "def __new__(cls):\n return objec...
[ "0.75212413", "0.74254465", "0.7227017", "0.7224189", "0.7096888", "0.7096888", "0.7059055", "0.70071834", "0.69155335", "0.68690395", "0.6814675", "0.6812803", "0.6802038", "0.66921675", "0.6628809", "0.6586155", "0.6570953", "0.6558287", "0.6547422", "0.65455115", "0.654116...
0.0
-1
Implement setattr(self, name, value).
def __setattr__(self, *args, **kwargs): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setattr__(self, name, value):\n self.set(**{name: value})", "def set_attr(self, name, value):\n setattr(self, name, value)", "def __setattr__(self, name, value):\n if not hasattr(self, name):\n raise AttributeError(\"'%s' object has no attribute '%s'\" % (type(self).__name...
[ "0.8688524", "0.83607846", "0.8291882", "0.8287424", "0.8225149", "0.82061905", "0.81031984", "0.81031984", "0.8070646", "0.8040505", "0.80245644", "0.79996955", "0.79918104", "0.7987297", "0.79513794", "0.7941162", "0.7936318", "0.7892863", "0.7890697", "0.77999353", "0.7755...
0.0
-1
Construct a new order
def __init__(self, order_number, product_id, item_type, name, product_details, factory, quantity, holiday): self._order_number = order_number self._product_id = product_id self._item_type = item_type self._name = name self._product_details = product_details self._factory ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_order():", "def create_order(order_type, quantity, action):\n order = Order()\n order.m_orderType = order_type\n order.m_totalQuantity = quantity\n order.m_action = action\n return order", "def make_order(self) -> Order:\n return Order.objects.create(self.user, customer=self)",...
[ "0.833395", "0.7203582", "0.7114992", "0.7071667", "0.6883862", "0.68780416", "0.6715334", "0.66734713", "0.66705173", "0.66563535", "0.6593862", "0.65741944", "0.65111375", "0.6505858", "0.6492425", "0.6471029", "0.64655256", "0.6406762", "0.6404874", "0.64038455", "0.638409...
0.0
-1
Return quantity of the order.
def quantity(self): return self._quantity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantity(self) -> int:\n return self._quantity", "def qty(self):\n return self._qty", "def qty(self):\n return self._qty", "def qty(self):\n return self._qty", "def total_quantity(self) -> int:\n total = 0\n for i in self.order_items:\n total += i.qu...
[ "0.8015016", "0.7847789", "0.7847789", "0.7847789", "0.78415835", "0.7685493", "0.76751775", "0.7309251", "0.715508", "0.707938", "0.7042906", "0.6954872", "0.69489163", "0.6915853", "0.6905254", "0.6826707", "0.6753263", "0.6720973", "0.66257733", "0.6593004", "0.65346134", ...
0.80501735
0
Return order num of the order.
def order_num(self): return self._order_number
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_order_number(self):\n return self.__order_number", "def order(self):\n return self.n", "def Order(self) -> int:\n return self.m_order", "def get_last_order_number_used():\n return Order.__last_order_number_used", "def order(self):\n return self._order + 1", "def...
[ "0.79488564", "0.70072585", "0.6980242", "0.6847151", "0.68226755", "0.6744299", "0.6601344", "0.6524124", "0.6422934", "0.64189935", "0.6404078", "0.6331946", "0.62859553", "0.62710696", "0.62633264", "0.62296635", "0.6177362", "0.61700857", "0.61622244", "0.61126214", "0.61...
0.8370637
0
Return product id of the order.
def product_id(self): return self._product_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"product_id\")", "def order_id(self) -> str:\n return pulumi.get(self, \"order_id\")", "def product_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"product_id\")", "def product_id(self) -> Optional[pulumi.I...
[ "0.75733906", "0.74336404", "0.73466593", "0.7327513", "0.69790107", "0.69345057", "0.6861878", "0.6836638", "0.6635784", "0.6635784", "0.6571606", "0.65395075", "0.64812005", "0.63588506", "0.62382644", "0.6232359", "0.62090987", "0.6192391", "0.6189691", "0.61673254", "0.60...
0.7661305
2
Return item type of the order.
def item_type(self): return self._item_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_type(self) -> str:\n return self.__item_type", "def GetItemType(self, item):\r\n\r\n return item.GetType()", "def item_type(self):\n pass", "def _type(self, item):\n return self.cv.type(item)", "def _get_item_type(item_dict):\n\n if 'object' in item_dict:\n ...
[ "0.7878613", "0.7632085", "0.76022285", "0.72713494", "0.7140311", "0.65833795", "0.65375483", "0.653278", "0.64914745", "0.64649284", "0.6431173", "0.6399569", "0.6393856", "0.6391988", "0.63863796", "0.6381702", "0.63592213", "0.6328614", "0.6316727", "0.631637", "0.6296000...
0.78946465
0
Return item name of the order.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item_name(self):\n return self.__item_name", "def getName(self,item):\n return item.s", "def get_item_name(self, i):\n for item in self.items:\n if item['id'] == i:\n return item['localized_name']\n return 'Unknown Item'", "def format_item(self, o...
[ "0.7870671", "0.7556543", "0.71382755", "0.6934038", "0.69025004", "0.68930954", "0.6725883", "0.6696614", "0.66641533", "0.65920144", "0.65798575", "0.65130144", "0.64259017", "0.6419284", "0.63608354", "0.635453", "0.6233386", "0.6228149", "0.6177948", "0.61624074", "0.6156...
0.0
-1
Return other details of the item of the order.
def product_details(self): return self._product_details
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_item_details(self) -> 'outputs.OrderItemDetailsResponse':\n return pulumi.get(self, \"order_item_details\")", "def GetDetailsItem(self):\r\n if self.details: return self.details.GetDetailsItem()\r\n return None", "def get_order_detail(orderid): \n data = order_obj.get_order_de...
[ "0.790016", "0.67859536", "0.673189", "0.6688021", "0.66561913", "0.6649791", "0.6510081", "0.6510081", "0.6510081", "0.6438063", "0.6334065", "0.6308645", "0.6308396", "0.63060457", "0.6236824", "0.619267", "0.61863947", "0.61863947", "0.61025476", "0.60810715", "0.6045182",...
0.61255914
18
Return the factory that can generate the item.
def factory(self): return self._factory
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_factory():", "def get_factory(self):\n\n return Factory(type(self), self.kwargs)", "def factory(self):\n raise NotImplementedError()", "def factory_method(self):\n pass", "def factory_method(self):\n pass", "def _get_factory(self):\n if self._factory_ref is None...
[ "0.7887471", "0.75268686", "0.697487", "0.65337443", "0.65337443", "0.6531187", "0.63111997", "0.62964106", "0.6270321", "0.62666076", "0.6263436", "0.6226908", "0.6197814", "0.6036466", "0.60276216", "0.60200506", "0.597823", "0.59461373", "0.59301263", "0.59115803", "0.5893...
0.75969225
1
Return the holiday that the item for.
def holiday(self): return self._holiday
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _holiday_parser(item):\n\n return item['summary'], item.get('start',{}).get('date'), item.get('end',{}).get('date')", "def holiday_type() -> Holiday:\n return Holiday.EASTER", "def holiday_type() -> Holiday:\n return Holiday.CHRISTMAS", "def get_holiday(self, date):\n if date....
[ "0.72972995", "0.67561626", "0.6577892", "0.6061763", "0.6009833", "0.5928844", "0.5921662", "0.5920972", "0.5895366", "0.5789303", "0.576882", "0.57558805", "0.57488185", "0.5738588", "0.5726189", "0.56056666", "0.5596636", "0.5571406", "0.554734", "0.554123", "0.5535749", ...
0.81748694
0
Return the invalid notes if the item is invalid.
def invalid_notes(self): return self._invalid_notes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invalid_items(self) -> ItemLog:\n if self._invalid_items is None:\n self._invalid_items = ItemLog(self.dir / 'dropped-invalid.log.csv', DROPPED_INVALID_FIELDNAMES, 'id')\n return self._invalid_items", "def validate(self, item):\n attempt, pkg_analyzer, journal_and_issue_data =...
[ "0.6333943", "0.6028125", "0.58779836", "0.56173664", "0.55850476", "0.5572299", "0.5564198", "0.5547777", "0.5545694", "0.54040706", "0.5341804", "0.53410447", "0.5324947", "0.5315656", "0.5315656", "0.5273683", "0.52681017", "0.5253155", "0.52450603", "0.52310336", "0.51989...
0.77436805
0
Return the valid status.
def is_valid(self): return self._is_valid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_status(self):\n return self.status", "def check_status(self):\n return self.status", "def checkStatus(self):\n return None", "def check_status(self):", "def status_check():\n return {\"status\": \"OK\"}", "def status(self):\n assert(self.__complete)\n retur...
[ "0.7983254", "0.7983254", "0.75442773", "0.7530948", "0.75023925", "0.7170593", "0.715925", "0.71215916", "0.710212", "0.70715076", "0.7069145", "0.70029503", "0.69986117", "0.69932646", "0.6959133", "0.6959133", "0.69536346", "0.6944623", "0.6944623", "0.6920503", "0.6912095...
0.0
-1
Set the status to invalid.
def is_invalid(self): self._is_valid = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_error(self):\r\n self.status = ERROR", "def invalid(self):\n return (self.status == self.STATUS_INVALID)", "def status(self, status):\n allowed_values = [\"I\", \"A\", \"S\", \"T\", \"D\"]\n if status not in allowed_values:\n raise ValueError(\n \"...
[ "0.67097574", "0.6690293", "0.665468", "0.64974946", "0.6438207", "0.63692117", "0.6282161", "0.6252383", "0.6192", "0.6186325", "0.61751336", "0.617271", "0.61149913", "0.6073517", "0.59190804", "0.58979946", "0.58979946", "0.58979946", "0.58765507", "0.58672804", "0.5861923...
0.69518065
0
Set the invalid notes.
def set_invalid_notes(self, error): self._invalid_notes = error
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invalid_notes(self):\n return self._invalid_notes", "def notes(self, notes: str):\n self._notes = notes", "def notes(self, notes):\n\n self._notes = notes", "def notes(self, notes):\n\n self._notes = notes", "def notes(self, notes):\n\n self._notes = notes", "def no...
[ "0.730826", "0.67267275", "0.66282713", "0.66282713", "0.66282713", "0.66282713", "0.66282713", "0.6261393", "0.6240077", "0.6159089", "0.6155227", "0.60829383", "0.599079", "0.5827429", "0.5736566", "0.5701913", "0.5699494", "0.5683367", "0.5591186", "0.5569768", "0.547599",...
0.84916085
0
String method of the class.
def __str__(self): return f"Order Number: {self._order_number} " \ f"Product ID: {self._product_id} " \ f"Item: {self._item_type} " \ f"Name: {self._name} " \ f"Quantity: {self._quantity} " \ f"Product details: {self._product_details} "
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simple_str(self):\n pass", "def __str__(self):\n return self.string", "def __str__(self):\n return str(self.GetString())", "def __str__(self) -> str:", "def __str__(self) -> str:", "def __str__(self) -> str:", "def __str__(self) -> str:", "def __str__(self):\n # print(...
[ "0.8139098", "0.8096094", "0.7906804", "0.7842437", "0.7842437", "0.7842437", "0.7842437", "0.78400224", "0.78400224", "0.78276724", "0.77887225", "0.77835816", "0.7734488", "0.7728038", "0.7676437", "0.7668474", "0.7632587", "0.76232356", "0.7588975", "0.7577886", "0.7557432...
0.0
-1
Returns the volume for tetrahedras volume specified by the indexes A to D.
def volume_tetrahedron(xyz, A, B, C, D): AD = xyz[A, :] - xyz[D, :] BD = xyz[B, :] - xyz[D, :] CD = xyz[C, :] - xyz[D, :] V = ( (BD[:, 0] * CD[:, 1] - BD[:, 1] * CD[:, 0]) * AD[:, 2] - (BD[:, 0] * CD[:, 2] - BD[:, 2] * CD[:, 0]) * AD[:, 1] + (BD[:, 1] * CD[:, 2] - BD[:, 2] * CD...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def axisDist2angledTubeVol(x, r, D, A):\n # return nan if nan provided\n if np.isnan(x):\n return x\n\n\n a = np.deg2rad(A)\n p1 = r-(r*np.cos(a))\n p2 = r+(r*np.cos(a))\n R12 = p2-p1\n d = D-x\n D1 = D-p1\n D2 = D-p2 \n\n \n if x < D2:\n if a == 0:\n ...
[ "0.6061158", "0.59955364", "0.5901134", "0.58852816", "0.58514327", "0.56547886", "0.5585238", "0.5480292", "0.54227465", "0.5333869", "0.52877015", "0.5269688", "0.52646565", "0.5262885", "0.5262885", "0.5262885", "0.52567464", "0.5251512", "0.5222472", "0.5217979", "0.52089...
0.656877
0
Returns the index of nodes on the mesh.
def index_cube(nodes, grid_size, n=None): if not isinstance(nodes, str): raise TypeError("Nodes must be a str variable: e.g. 'ABCD'") nodes = nodes.upper() try: dim = len(grid_size) if n is None: n = tuple(x - 1 for x in grid_size) except TypeError: return Ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _num_nodes(self):\n return int(self._node_map[-1])", "def getNodalIndex(self, iVertex):\n node = self.gr.getMeshPoint(iVertex)\n no = node.getNo()\n \n return no", "def num_nodes(self):\n return self._grid", "def reference_nodes_idx(self) -> Dict[str, torch.Tensor]:\...
[ "0.68362814", "0.6816596", "0.6763356", "0.6697334", "0.66444874", "0.65755546", "0.6556872", "0.65423447", "0.6497657", "0.6487981", "0.6486196", "0.64679587", "0.6441361", "0.6401889", "0.63999826", "0.63983184", "0.6387389", "0.6373512", "0.63693637", "0.633084", "0.632620...
0.0
-1
function [N] = face_info(y,A,B,C,D) Returns the averaged normal, area, and edge lengths for a given set of faces. If average option is FALSE then N is a cell array {nA,nB,nC,nD}
def face_info(xyz, A, B, C, D, average=True, normalize_normals=True, **kwargs): if "normalizeNormals" in kwargs: warnings.warn( "The normalizeNormals keyword argument has been deprecated, please use normalize_normals. " "This will be removed in discretize 1.0.0", Deprecat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_face_dimensions(face):\n vertical = filter_vertical_edges(face.edges, face.normal).pop()\n horizontal = filter_horizontal_edges(face.edges, face.normal).pop()\n return horizontal.calc_length(), vertical.calc_length()", "def calcFaceAreas(x,y,z):\n (nLonP1, nLatP1) = x.shape\n (nLon, nLat) = (...
[ "0.6128122", "0.5623433", "0.5455483", "0.53822756", "0.5266499", "0.52573895", "0.52217734", "0.5124519", "0.5121855", "0.51065016", "0.50514275", "0.49905944", "0.49698538", "0.49379957", "0.49335214", "0.49335214", "0.49173236", "0.49082252", "0.490456", "0.48455828", "0.4...
0.69601613
0
Get primary key properties for a SQLAlchemy cls. Taken from marshmallow_sqlalchemy
def primary_keys_full(cls): mapper = cls.__mapper__ return [ mapper.get_property_by_column(column) for column in mapper.primary_key ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primary_keys(class_):\n for column in class_.__table__.c:\n if column.primary_key:\n yield column", "def primary_key(cls):\n\n if cls.__from_class__:\n cls = cls.__from_class__\n return cls.__table__.primary_key.columns.values()[0].name", "def _primary_key_colu...
[ "0.7557158", "0.7452393", "0.7449692", "0.7295135", "0.7236151", "0.7213286", "0.7042953", "0.69382024", "0.672828", "0.6678589", "0.65871394", "0.6561727", "0.655543", "0.6518527", "0.6504148", "0.6438176", "0.6398784", "0.6381392", "0.62994057", "0.62984675", "0.62917686", ...
0.72779506
4
Return a `list` of relationship names or the given model
def relations(cls): return [c.key for c in cls.__mapper__.iterate_properties if isinstance(c, RelationshipProperty)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getrelations(self):\n return self.getfieldnames('ONE')", "def inspect_model_relations(self, model: ModelRepresentation) -> None:\n subtitle(\"Relations\")\n for field in model.fields.values():\n if field.is_relation is True:\n try:\n relfield ...
[ "0.6687166", "0.61749834", "0.61124563", "0.600863", "0.59983855", "0.579197", "0.5757365", "0.5734134", "0.5711484", "0.5672122", "0.5672122", "0.5642324", "0.5622827", "0.56145585", "0.55919904", "0.5551367", "0.552647", "0.54888463", "0.5438537", "0.5395563", "0.5387755", ...
0.53104585
25
Return a `list` of relationship names or the given model
def settable_relations(cls): return [r for r in cls.relations if getattr(cls, r).property.viewonly is False]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getrelations(self):\n return self.getfieldnames('ONE')", "def inspect_model_relations(self, model: ModelRepresentation) -> None:\n subtitle(\"Relations\")\n for field in model.fields.values():\n if field.is_relation is True:\n try:\n relfield ...
[ "0.66870177", "0.6174171", "0.6112145", "0.6009208", "0.5997527", "0.57924473", "0.5756192", "0.57342297", "0.57119155", "0.56727093", "0.56727093", "0.56427324", "0.5622894", "0.56137514", "0.559233", "0.5550773", "0.5525893", "0.5487475", "0.5437538", "0.53957653", "0.53881...
0.0
-1
Private method for preparing query in method `all`, `load_by_params`, `count`
def _prepare_parametrized_queue(cls, initial_query=None, **_params): ops = { '>': operator.gt, '<': operator.lt, '>=': operator.ge, '<=': operator.le, '=': operator.eq } if not initial_query: query = cls.q else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n query = self.query\n\n # count before filtering\n # self.cardinality = query.add_columns(self.columns[0].sqla_expr).count()\n\n self._set_column_filter_expressions()\n self._set_global_filter_expression()\n self._set_sort_expressions()\n self._set_y...
[ "0.68364394", "0.6580813", "0.6483896", "0.6305449", "0.6242472", "0.6186475", "0.6100359", "0.6060795", "0.5964102", "0.58796304", "0.58513296", "0.5814686", "0.5793139", "0.5793139", "0.5793139", "0.5793139", "0.5758466", "0.56946445", "0.5661901", "0.56526875", "0.5608913"...
0.56812847
18
Updates instance and permanently saves changes to DB
def set_and_save(self, **_params): self.set(**_params) return self.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n db.session.commit()", "def update(self):\n db.session.commit()", "def model_update(self, db):\n db.session.commit()", "def save(self):\n if self.id:\n self.update()\n else:\n self.create()", "def _write_to_db(self, instance: DBMod...
[ "0.7763834", "0.7763834", "0.76813203", "0.7494928", "0.7443022", "0.74245715", "0.7416603", "0.73864913", "0.7326291", "0.7221527", "0.7217618", "0.719868", "0.7174145", "0.7173065", "0.715932", "0.7153753", "0.7131702", "0.7112224", "0.70756525", "0.70546097", "0.70234156",...
0.0
-1
Sets fields in instance without saving
def set(self, **_params): try: for name in _params.keys(): if name in self.settable_attributes: setattr(self, name, _params[name]) else: raise M2Error('Error while trying to set non-existent property `%s`' % name) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _replace_fields(self):\n for name, value in self._cleaned_data.items():\n setattr(self, name, value)", "def _set_attributes(self):", "def set_additional_fields(cls, model, data):\n for k, v in data.items():\n if not hasattr(model, k):\n setattr(model, k, v...
[ "0.6984201", "0.6958659", "0.6922216", "0.6831762", "0.6808245", "0.6784394", "0.676871", "0.67266273", "0.67213887", "0.66335744", "0.6562024", "0.65428525", "0.64802754", "0.64802325", "0.6464915", "0.64020574", "0.6347568", "0.63401353", "0.63156015", "0.6302331", "0.62994...
0.0
-1
Universal getter of attributes from sqlalchemy model instance
def get(self, item): try: data = copy.deepcopy(getattr(self, item)) except AttributeError: raise M2Error('Error while trying to get non-existent property `%s`' % item, False) except SQLAlchemyError: self.s.rollback() raise return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getattr__(self, name):\n return getattr(self.model, name)", "def __getattr__(self, key):\n try:\n return self._dict[key]\n except KeyError:\n raise AttributeError(\"'Model' object not has attribute {}\".format(key))", "def _analyze_db_model(cls):\n attributes...
[ "0.6532339", "0.6169711", "0.61223394", "0.60813785", "0.60813785", "0.6026523", "0.6026523", "0.6026523", "0.6026523", "0.6026523", "0.6026523", "0.6026523", "0.6026523", "0.60257596", "0.600453", "0.59926355", "0.5992529", "0.5973254", "0.59655386", "0.5961543", "0.59560347...
0.53988177
95
Loads model by primary key
def load_by_pk(cls, _pk): try: return cls.q.get(_pk) except SQLAlchemyError: cls.s.rollback() raise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_by_id(self, model, key_name):\n return model.get_by_id(key_name)", "def load_model(self) -> Any:", "def get_by_id(self, pkId: int):\n if not self.model:\n raise NameError('database model has not been set.')\n if not pkId:\n raise ValueError('invalid primary key va...
[ "0.70651364", "0.6780844", "0.6774344", "0.6482686", "0.646522", "0.64646775", "0.6379586", "0.6347097", "0.6278477", "0.62661743", "0.6229536", "0.61591846", "0.61561114", "0.6148742", "0.61474085", "0.6110309", "0.6107565", "0.60854894", "0.6079037", "0.60689956", "0.606445...
0.6947319
1
Loads model with filtering by params
def load_by_params(cls, **_params): try: return cls._prepare_parametrized_queue(**_params).first() except SQLAlchemyError: cls.s.rollback() raise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(self) -> Any:", "def _load_filter(self, *args, **kwargs):\n raise NotImplementedError", "def _filter(self, _model, **kwargs):\n return _model.objects.filter(**kwargs)", "def __init__(self, **kwargs):\n super(Model, self).__init__(**kwargs)\n self._params = self.find...
[ "0.6577442", "0.64647454", "0.6462724", "0.6325852", "0.62619525", "0.62535644", "0.61020404", "0.60887814", "0.6038194", "0.5789095", "0.5720965", "0.56664914", "0.5664591", "0.5595112", "0.5584993", "0.5531549", "0.5531411", "0.5478115", "0.547545", "0.5468434", "0.54652506...
0.0
-1
Loads existing model or creates new with specified params
def load_or_create(cls, **_params): result = cls.load_by_params(**_params) try: if not result: result = cls.create(**_params) return result except SQLAlchemyError: cls.s.rollback() raise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(self) -> Any:", "def get_or_initialize_model(self, payload):\n try:\n model = self.get_model(payload)\n except DoesNotExistException:\n model = self.initialize_model()\n\n model.id = payload.get('local_id', model.id)\n return model", "def create_...
[ "0.65934944", "0.65590775", "0.6513674", "0.6513674", "0.6363146", "0.63582635", "0.6342739", "0.63159627", "0.63078123", "0.6289935", "0.6281164", "0.6264362", "0.62459695", "0.61406463", "0.61226374", "0.610249", "0.6092199", "0.6066695", "0.606548", "0.605637", "0.60524654...
0.6859225
0
Universal method for creation new empty model for further attribute settings and saving it to DB
def create(cls, **_params): cls_inst = cls() cls_inst = cls_inst.set(**_params) cls_inst.save() return cls_inst
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model(self):\n pass", "def create_model(self):\n pass", "def create_model(self):\n self.model = None\n pass", "def create(self, **kwargs):\n obj = self.model(**kwargs)\n self._for_write = True\n obj.save(force_insert=True, using=self.db, skip_modera...
[ "0.75962776", "0.75962776", "0.7345745", "0.7105157", "0.70808834", "0.69941825", "0.698388", "0.69787025", "0.69190496", "0.6765159", "0.67403257", "0.6717142", "0.66224295", "0.66037554", "0.6536006", "0.650141", "0.650141", "0.650141", "0.64904594", "0.6476778", "0.6467024...
0.0
-1
Saves changes to DB. If there is `updated` field in model sets it's value to current time
def save(self, flush_only=False): try: # set `updated` field with current datetime if 'updated' in self.columns and self.get('updated') is not None: self.set(updated=text('now()')) self.s.add(self) if flush_only: self.s.flush() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n self.updated_at = datetime.now()", "def save(self, *args, **kwargs):\n self.modify_ts = datetime.now()\n super(ModelBase, self).save(*args, **kwargs)", "def save(self):\n from models import storage\n self.updated_at = datetime.now()\n storage.save...
[ "0.7989006", "0.7342806", "0.73408216", "0.7330617", "0.7323052", "0.7323052", "0.7223719", "0.72018397", "0.7156861", "0.6995323", "0.6935213", "0.6935213", "0.6843707", "0.6843707", "0.6829831", "0.680846", "0.680846", "0.680846", "0.6770967", "0.6770967", "0.67044", "0.6...
0.5886115
64
Removes the model from the current entity session and mark for deletion.
def delete(self): try: self.s.delete(self) self.s.commit() except SQLAlchemyError: self.s.rollback() raise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, model):\n self._isinstance(model)\n db.session.delete(model)\n db.session.commit()", "def model_delete(self, db):\n db.session.delete(self)\n db.session.commit()", "def remove(self):\n with managed_session() as session:\n session.delete(self...
[ "0.7562336", "0.73674154", "0.72539794", "0.724739", "0.709403", "0.7086364", "0.69579095", "0.69503564", "0.68845206", "0.68819755", "0.68596834", "0.68596834", "0.68596834", "0.68596834", "0.68596834", "0.68596834", "0.68596834", "0.68596834", "0.68596834", "0.68455106", "0...
0.616645
51
Dumps model to JSON. Also dumps all it's relations. Useful in handlers, where we want to return model in JSON to client. In `_except_fields` you can specify fields, which you don't want to see in an output JSON (i.e. `password`).
def data(self, *_except_fields, **kwargs): _max_level = kwargs.get('max_level', 2) def model_to_dict(obj, ignore_fields=list(), back_relationships=set(), max_level=2, current_level=0): current_level += 1 ignore_in_cur_iteration = list() for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_model(self):", "def serialize(cls, model, *fields):\n\n if fields:\n raw_model = {field: model.get(field) for field in fields}\n\n else:\n raw_model = {field: model.get(field) for field in cls.fields}\n\n if 'posted_at' in raw_model:\n raw_model['pos...
[ "0.67281026", "0.61066914", "0.607794", "0.603821", "0.6022249", "0.6012465", "0.5979109", "0.59433246", "0.59128547", "0.5836147", "0.57523715", "0.56892914", "0.5668894", "0.5653489", "0.5605367", "0.5582743", "0.5582743", "0.5582743", "0.55505604", "0.55456686", "0.5518192...
0.634077
1
Counts all rows in query with specified params via SQL
def count(cls, **_params): try: query = cls.s.query(func.count()) query = cls._prepare_parametrized_queue(query, **_params) return query.scalar() except SQLAlchemyError: cls.s.rollback() raise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self, query):", "def query_count(query, params=None):\n count_query = 'SELECT COUNT(*) FROM (' + query + ') AS a;'\n response = database.get_engine().execute(count_query, params)\n count = response.fetchone()\n response.close()\n return count[0]", "def rpc_database_count_rows(self, *ar...
[ "0.7772164", "0.7291359", "0.71688855", "0.70965797", "0.70861316", "0.70229584", "0.69322574", "0.6876999", "0.6681888", "0.6610659", "0.6577253", "0.6542718", "0.65084743", "0.64364314", "0.64209414", "0.6377356", "0.6367675", "0.63574195", "0.63402534", "0.6301617", "0.629...
0.62707317
22
Simply returns all objects from DB, without initializing self._data and possible filtering by params and pagination
def all(cls, page: int=0, per_page: int=0, **_params): try: query = cls._prepare_parametrized_queue(**_params) if page != 0 and per_page != 0: query = query.limit(per_page) query = query.offset((page - 1) * per_page) return query.all() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_all_records(self) -> List[DBModelInstance]:\n return self.model.query.all()", "def all(self):\n rs = DbResultSet(self.model, self.spec, self.query.clone())\n rs._has_limit = self._has_limit\n rs._has_skip = self._has_skip\n rs._only_fields = self._only_fields\n return rs", "def q...
[ "0.7534185", "0.7108787", "0.7097263", "0.70175385", "0.6971961", "0.6942425", "0.6881691", "0.68202984", "0.681616", "0.6804731", "0.6802941", "0.678375", "0.6736436", "0.6735908", "0.67019176", "0.66949844", "0.6686238", "0.6677795", "0.66564894", "0.6651296", "0.6650843", ...
0.0
-1
Returns JSONscheme of all tables from current DB. If you pass `only_self=True`, it returns only scheme for current table of model, which is taken from `cls`
def schema(cls, only_self: bool=False): try: md_tbls = cls.metadata.tables insp = reflection.Inspector.from_engine(cls.s.bind.engine) tbls = dict() for tbl in insp.get_table_names(): if not only_self or (only_self and tbl == cls.__tablename__): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tables(self):\n return Table.objects.filter(schema__database=self)", "def getTable(self):\n return self.db.table(self.entity)", "def db_table(self):", "def meta_db_tables(self) -> list:\r\n def _passer(**kwargs):\r\n data = self.engine.execute(\"\"\"\r\n SEL...
[ "0.58558553", "0.5649703", "0.5498926", "0.5450927", "0.54185534", "0.5340448", "0.52658796", "0.5190706", "0.5184151", "0.51694363", "0.51438534", "0.5143179", "0.5114235", "0.50626093", "0.50591", "0.50570554", "0.5045505", "0.50410146", "0.5040687", "0.50340265", "0.502784...
0.7112505
0
Create a persistent memory.
def __init__(self, memory_path): self.memory_path = memory_path self.facts = self._load() memory_directory = os.path.dirname(memory_path) os.makedirs(memory_directory, exist_ok=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_db(self):\n self.db = easydms.dbcore.Database(\":memory:\")\n self.db.create_db()", "def create_persistent(self, prev_handle=0):\n handle = self.channel.create(\n self.tree,\n \"persistent.txt\",\n access=smb2.FILE_READ_DATA | smb2.FILE_WRITE_DATA...
[ "0.6327579", "0.6253208", "0.60377413", "0.59141266", "0.58744127", "0.5866942", "0.58601433", "0.58601433", "0.5819055", "0.57507807", "0.5657224", "0.5604179", "0.5593738", "0.5553107", "0.55042064", "0.5483521", "0.5466527", "0.54614705", "0.5458485", "0.54577583", "0.5438...
0.56555396
11
Test import of nashville half off coupons from feed xml
def test_nash_half_off_feed(self): feed_provider_name = "Nashville Half Off Deals" advertiser = Advertiser.objects.get(id=114) advertiser.is_emailable = False advertiser.unemailablereason = 2 # do not email this advertiser advertiser.save() coupon_count = 2 feed_u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_incentrev_scrape_coupons(self):\n feed_provider_name = \"IncentRev Coupon Scrape\"\n advertiser = Advertiser.objects.get(id=114)\n feed_url = \"http://bmlnm.incentrev.com/\"\n FeedProvider.objects.create(name=feed_provider_name,\n advertiser=advertiser, feed_url=feed...
[ "0.62421864", "0.6081836", "0.57239056", "0.5553608", "0.5408395", "0.5300064", "0.52758473", "0.5225514", "0.51674193", "0.5122483", "0.50906634", "0.50708205", "0.5040356", "0.4978729", "0.49634647", "0.4955896", "0.49540544", "0.48912942", "0.48896828", "0.48893234", "0.48...
0.609456
1
Test scrape of IncentRev website
def test_incentrev_scrape_coupons(self): feed_provider_name = "IncentRev Coupon Scrape" advertiser = Advertiser.objects.get(id=114) feed_url = "http://bmlnm.incentrev.com/" FeedProvider.objects.create(name=feed_provider_name, advertiser=advertiser, feed_url=feed_url) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _scrape(self):", "def scrape(self):\n pass", "def test_extract_recipe_from_website(self):\n pass", "def i_am_on_the_zoo_website():\n driver.get(\"http://www.thetestroom.com/webapp/\")", "def test_get_page_source() -> None:\n url = \"https://www.airbnb.com/s/Norway/homes?tab_id=home_...
[ "0.67288464", "0.6690601", "0.61967266", "0.6178635", "0.61032933", "0.6093868", "0.60937685", "0.60189867", "0.60130733", "0.5937047", "0.5930214", "0.5873887", "0.584793", "0.58008313", "0.5795131", "0.57931745", "0.57906187", "0.5776651", "0.5764502", "0.5755536", "0.57552...
0.0
-1
test sugar sync in TEST_MODE
def test_fake_sync_biz_to_sugar(self): LOG.debug('config.TEST_MODE: %s' % str(config.TEST_MODE)) if config.TEST_MODE: coupon = Coupon.objects.get(id=300) sync_business_to_sugar(coupon=coupon) self.assertTrue(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sync_all_to_sugar(self):\n self.assertEqual(sync_all_to_sugar(sugar=MockSugar()), None)", "async def test2(self):\n return True", "async def test1(self):\n return True", "def sync() -> None:", "def test_sync_project_again(self):\n support.run_remote_comm...
[ "0.69575614", "0.693653", "0.68463534", "0.68207216", "0.67862225", "0.67686677", "0.6616046", "0.6611846", "0.65801084", "0.6579473", "0.6477436", "0.64392394", "0.6437968", "0.64355886", "0.6426679", "0.63869756", "0.63869685", "0.63869685", "0.63869685", "0.63866174", "0.6...
0.691543
2
Assert sync of coupon business to SugarCRM
def test_sync_biz_to_sugar_coupon(self): LOG.debug('test_sync_biz_to_sugar_coupon') consumer = Consumer.objects.get(id=300) consumer.first_name = 'Danielle' consumer.last_name = 'Dongo' consumer.save() coupon = Coupon.objects.get(id=300) location = Location.object...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fake_sync_biz_to_sugar(self):\n LOG.debug('config.TEST_MODE: %s' % str(config.TEST_MODE))\n if config.TEST_MODE:\n coupon = Coupon.objects.get(id=300)\n sync_business_to_sugar(coupon=coupon)\n self.assertTrue(True)", "def test_update_coupon_definition(self):\n ...
[ "0.7443322", "0.7388754", "0.71110976", "0.71038574", "0.6866979", "0.679285", "0.66437405", "0.65857124", "0.6511695", "0.6365888", "0.6344713", "0.63403803", "0.61000824", "0.6031989", "0.6018751", "0.5987457", "0.58690345", "0.5826196", "0.58079934", "0.5797071", "0.576107...
0.8059085
0
Assert sync of offer business to SugarCRM
def test_sync_biz_to_sugar_offer(self): LOG.debug('test_sync_biz_to_sugar_offer') #business = Business.objects.get(id=114) consumer = Consumer.objects.get(id=300) consumer.first_name = 'Danielle' consumer.last_name = 'Dongo' consumer.save() offer = Offer.objects.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sync_biz_to_sugar(self):\n LOG.debug('test_sync_biz_to_sugar')\n consumer = Consumer.objects.get(id=300)\n consumer.first_name = 'Danielle'\n consumer.last_name = 'Dongo'\n consumer.save()\n business = Business.objects.get(id=114)\n business.business_name =...
[ "0.7203027", "0.6902418", "0.6616441", "0.6555277", "0.6442863", "0.624157", "0.6141938", "0.6139024", "0.61344576", "0.6126873", "0.6095541", "0.60492224", "0.60330796", "0.60225266", "0.6018561", "0.6014029", "0.59683883", "0.59544384", "0.59514916", "0.5950562", "0.5947972...
0.79798996
0
Assert business synched to SugarCRM and get_sugar_relationship.
def test_sync_biz_to_sugar(self): LOG.debug('test_sync_biz_to_sugar') consumer = Consumer.objects.get(id=300) consumer.first_name = 'Danielle' consumer.last_name = 'Dongo' consumer.save() business = Business.objects.get(id=114) business.business_name = 'test14 biz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sync_modify_biz_from_sugar(self):\n LOG.debug('test_sync_modify_biz_from_sugar')\n sync_business_from_sugar(get_modified=True, sugar=self.sugar)\n self.assertTrue(True)", "def test_sync_from_sugar_contact(self):\n LOG.debug('test_sync_from_sugar_contact')\n business = ...
[ "0.7130112", "0.7045469", "0.68213195", "0.66852915", "0.6457075", "0.6441253", "0.63051504", "0.5865568", "0.57541513", "0.56637245", "0.5626019", "0.558659", "0.5575909", "0.5566339", "0.55663025", "0.5534019", "0.55004907", "0.5476099", "0.5469382", "0.5463141", "0.5458386...
0.75713044
0
Assert create of coupon business from SugarCRM account.
def test_sync_biz_from_sugar_acct(self): LOG.debug('test_sync_biz_from_sugar_acct') business = Business.objects.get(id=114) advertiser = business.advertiser module = "Accounts" query = build_recent_entry_query(module=module, test_mode=True, get_modified=False, start=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_coupon_definition(self):\n pass", "def test_update_coupon_definition(self):\n pass", "def test_client_bank_account_create(self):\n pass", "def test_get_active_coupon(self):\n coupon = COUPON_FACTORY.create_coupon()\n slot = SLOT_FACTORY.create_slot(coupon=co...
[ "0.7462063", "0.6744753", "0.6724438", "0.6466636", "0.64611053", "0.643641", "0.6409974", "0.6333359", "0.62230194", "0.6154744", "0.5997458", "0.5916436", "0.58945185", "0.58517826", "0.5819267", "0.58043146", "0.57985806", "0.5796583", "0.5761732", "0.5751245", "0.57463956...
0.6122855
10
Assert create of coupon business from SugarCRM contact.
def test_sync_from_sugar_contact(self): LOG.debug('test_sync_from_sugar_contact') business = Business.objects.get(id=114) advertiser = Advertiser.objects.get(id=114) email = advertiser.email module = "Contacts" query = build_recent_entry_query(module=module, test_mode=Tru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_coupon_definition(self):\n pass", "def test_website_companies_create(self):\n pass", "def test_update_coupon_definition(self):\n pass", "def test_create_account_campaign(self, create):\n \"\"\"Campaigns should be created\"\"\"\n row = {'PROJ_NAME1': 'Argenti...
[ "0.70949316", "0.6541851", "0.6399019", "0.63015497", "0.62419224", "0.60687506", "0.6056447", "0.6038391", "0.60067683", "0.59705", "0.59677804", "0.59333086", "0.589922", "0.58825874", "0.5880873", "0.5877111", "0.58503705", "0.58325475", "0.58100945", "0.58008313", "0.5798...
0.60524577
7
Test task that will sync recently modified and created SugarCRM accounts and contacts data to coupon website.
def test_sync_modify_biz_from_sugar(self): LOG.debug('test_sync_modify_biz_from_sugar') sync_business_from_sugar(get_modified=True, sugar=self.sugar) self.assertTrue(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sync_biz_to_sugar_coupon(self):\n LOG.debug('test_sync_biz_to_sugar_coupon')\n consumer = Consumer.objects.get(id=300)\n consumer.first_name = 'Danielle'\n consumer.last_name = 'Dongo'\n consumer.save()\n coupon = Coupon.objects.get(id=300)\n location = Loc...
[ "0.7445045", "0.71122766", "0.6862755", "0.682964", "0.6565033", "0.6416634", "0.63961476", "0.6234564", "0.60413563", "0.6014782", "0.59478164", "0.589701", "0.5895136", "0.5886317", "0.5852639", "0.58312035", "0.58291084", "0.5824226", "0.57904667", "0.57891405", "0.5734122...
0.61891896
8
Assert that a SugarCRM task will be created for this business.
def test_create_sugar_reminder_task(self): LOG.debug('test_create_sugar_reminder_task') business = Business.objects.get(id=114) subject = 'Test task' offset_days = 120 create_sugar_reminder_task(self.sugar, business, subject, offset_days) # get parent_id from get_entry_li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create(self):\n Todo = self.env[\"todo.task\"]\n task = Todo.create({'name': 'Test Task'})\n self.assertItemsEqual(task.is_done, False)", "def test_user_01_newtask(self):\r\n # Del previous TaskRuns\r\n self.create()\r\n self.del_task_runs()\r\n\r\n # Reg...
[ "0.7182495", "0.69349855", "0.6839725", "0.6669995", "0.6632623", "0.65959543", "0.65847784", "0.6427798", "0.6418475", "0.64059", "0.6247542", "0.622359", "0.6222988", "0.6190438", "0.6183464", "0.61740184", "0.61312586", "0.61312586", "0.61285764", "0.61160403", "0.6107462"...
0.761346
0
Assert that sugar create coupon expires task completes
def test_create_sugar_cpn_exp_task(self): offset_days = 2 coupon = Coupon.objects.get(id=416) coupon.expiration_date = (datetime.date.today() + datetime.timedelta(days=offset_days)) coupon.save() self.assertEqual(create_sugar_coupon_expire_task(MockSugar(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_sugar_cc_exp_task(self):\n current_date = datetime.datetime.now()\n order = Order.objects.create(billing_record_id=114)\n credit_card = CreditCard.objects.get(id=500)\n credit_card.exp_month = int(current_date.strftime(\"%m\"))\n credit_card.exp_year = int(current...
[ "0.68798816", "0.6572687", "0.6529624", "0.6429473", "0.641452", "0.6319681", "0.63013834", "0.6182696", "0.61526746", "0.6136876", "0.6083815", "0.6065378", "0.6035142", "0.60144424", "0.60144424", "0.60060614", "0.5955513", "0.59325475", "0.59280187", "0.5923616", "0.591271...
0.77054924
0
Assert that sugar create cc expire task completes.
def test_create_sugar_cc_exp_task(self): current_date = datetime.datetime.now() order = Order.objects.create(billing_record_id=114) credit_card = CreditCard.objects.get(id=500) credit_card.exp_month = int(current_date.strftime("%m")) credit_card.exp_year = int(current_date.strfti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_sugar_cpn_exp_task(self):\n offset_days = 2\n coupon = Coupon.objects.get(id=416)\n coupon.expiration_date = (datetime.date.today() + \n datetime.timedelta(days=offset_days))\n coupon.save()\n self.assertEqual(create_sugar_coupon_expire_task(MockSugar()...
[ "0.73353577", "0.7269789", "0.6586084", "0.64264536", "0.6367853", "0.631532", "0.6197102", "0.607421", "0.6005354", "0.6001555", "0.5989575", "0.59839094", "0.58908397", "0.583277", "0.5800318", "0.57816434", "0.575709", "0.57498825", "0.571332", "0.57026815", "0.5695674", ...
0.7577372
0
Assert that sugar sync all businesses task completes.
def test_sync_all_to_sugar(self): self.assertEqual(sync_all_to_sugar(sugar=MockSugar()), None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_all_parts_completed(self, syn):\n\n upload = self._init_upload_attempt(syn)\n\n upload_id = \"1234\"\n parts_state = \"11\"\n\n create_status_response = {\n \"uploadId\": upload_id,\n \"partsState\": parts_state,\n \"state\": \"UPLOADING\",\n ...
[ "0.62963516", "0.6295621", "0.621548", "0.62080395", "0.6192989", "0.6173972", "0.6164685", "0.6074397", "0.60276186", "0.60241795", "0.59956443", "0.5966392", "0.5952906", "0.5945244", "0.5940101", "0.5938747", "0.592649", "0.59052604", "0.5902428", "0.5901853", "0.5889295",...
0.6495739
0
Interpolate all the columns of a matrix `fp` based on new values `x`
def multiInterp(x, xp, fp, extrap='bounded'): # Sanity x = np.asarray(x) xp = np.asarray(xp) assert fp.shape[1]==len(xp), 'Second dimension of fp should have the same length as xp' j = np.searchsorted(xp, x) - 1 dd = np.zeros(len(x)) bOK = np.logical_and(j>=0, j< len(xp)-1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpArray(x, xp, fp, extrap='bounded'):\r\n # Sanity\r\n xp = np.asarray(xp)\r\n assert fp.shape[1]==len(xp), 'Second dimension of fp should have the same length as xp'\r\n\r\n j = np.searchsorted(xp, x) - 1\r\n if j<0:\r\n # Before bounds\r\n if extrap=='bounded':\r\n ...
[ "0.6965829", "0.6590167", "0.64857244", "0.64553636", "0.64214194", "0.6270792", "0.61107546", "0.59749234", "0.5958125", "0.59576446", "0.5905598", "0.58379525", "0.5791142", "0.5704261", "0.5675316", "0.5542017", "0.5498557", "0.54851395", "0.5475216", "0.5469916", "0.54636...
0.7065358
0
Interpolate all the columns of a matrix `fp` based on one new value `x`
def interpArray(x, xp, fp, extrap='bounded'): # Sanity xp = np.asarray(xp) assert fp.shape[1]==len(xp), 'Second dimension of fp should have the same length as xp' j = np.searchsorted(xp, x) - 1 if j<0: # Before bounds if extrap=='bounded': return fp[:,0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiInterp(x, xp, fp, extrap='bounded'):\r\n # Sanity\r\n x = np.asarray(x)\r\n xp = np.asarray(xp)\r\n assert fp.shape[1]==len(xp), 'Second dimension of fp should have the same length as xp'\r\n\r\n j = np.searchsorted(xp, x) - 1\r\n dd = np.zeros(len(x))\r\n bOK = np.logical_and(j...
[ "0.705838", "0.6619287", "0.6555274", "0.6444966", "0.6392715", "0.6249282", "0.6101598", "0.6089653", "0.5984777", "0.59563166", "0.58954734", "0.57981503", "0.57871944", "0.5667313", "0.5612767", "0.5533479", "0.5526936", "0.54846734", "0.5482374", "0.54413885", "0.5436352"...
0.69804823
1
perform moving average, return a vector of same length as input
def moving_average(a, n=3) : a = a.ravel() a = np.concatenate(([a[0]]*(n-1),a)) # repeating first values ret = np.cumsum(a, dtype = float) ret[n:] = ret[n:] - ret[:-n] ret=ret[n - 1:] / n return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moving_average(a, n=3) :\n ret = np.cumsum(a, dtype=float)\n ret[n:] = ret[n:] - ret[:-n]\n return ret[n - 1:] / n", "def moving_average(a, n: int = 3) -> np.array:\n ret = np.cumsum(a, dtype=float)\n ret[n:] = ret[n:] - ret[:-n]\n return ret[n - 1:] / n", "def moving_average(x, window_le...
[ "0.79918337", "0.78378034", "0.77865", "0.77451956", "0.77135897", "0.7707732", "0.76973605", "0.76384586", "0.7505987", "0.7344585", "0.72903943", "0.7257432", "0.7257154", "0.72182316", "0.71912247", "0.71746314", "0.71555084", "0.7142735", "0.712167", "0.70992136", "0.7036...
0.7769753
3
1st order low pass filter
def lowpass1(y, dt, fc=3) : tau=1/(2*np.pi*fc) alpha=dt/(tau+dt) y_filt=np.zeros(y.shape) y_filt[0]=y[0] for i in np.arange(1,len(y)): y_filt[i]=alpha*y[i] + (1-alpha)*y_filt[i-1] return y_filt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_low_pass(x, filt_data, cutoff, fs, order=1, rows=[0,-1]):\n\n from scipy.signal import butter, filtfilt\n import numpy as np\n import matplotlib.pyplot as plt \n\n def butter_lowpass(cutoff, fs, order=5):\n nyq = 0.5 * fs\n normal_cutoff = cutoff / nyq\n b, a = butter(or...
[ "0.71313614", "0.70275563", "0.69224167", "0.68453467", "0.6807482", "0.6783777", "0.67287827", "0.6629645", "0.6614578", "0.65434146", "0.6522392", "0.6470765", "0.6469156", "0.6450254", "0.6424356", "0.6410205", "0.6375127", "0.6330572", "0.6251508", "0.6209557", "0.6194551...
0.7241261
0
1st order high pass filter
def highpass1(y, dt, fc=3) : tau=1/(2*np.pi*fc) alpha=tau/(tau+dt) y_filt=np.zeros(y.shape) y_filt[0]=0 for i in np.arange(1,len(y)): y_filt[i]=alpha*y_filt[i-1] + alpha*(y[i]-y[i-1]) m0=np.mean(y) m1=np.mean(y_filt) y_filt+=m0-m1 return y_filt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def butter_highpass_filter(data, cutoff, fs, order=1):\n b, a = butter_highpass(cutoff, fs, order=order)\n y = filtfilt(b, a, data)\n return y", "def lowpass1(y, dt, fc=3) :\r\n tau=1/(2*np.pi*fc)\r\n alpha=dt/(tau+dt)\r\n y_filt=np.zeros(y.shape)\r\n y_filt[0]=y[0]\r\n for i in np.arange...
[ "0.6740725", "0.6653167", "0.6633017", "0.6436991", "0.6383848", "0.629565", "0.62608844", "0.6234676", "0.61076397", "0.6095083", "0.6085736", "0.6056559", "0.60563815", "0.6035713", "0.60116965", "0.5978692", "0.59777987", "0.5958039", "0.594976", "0.5948143", "0.5947825", ...
0.710744
0
apply filter on a dataframe
def applyFilterDF(df_old, x_col, options): # Brute force loop df_new = df_old.copy() x = df_new[x_col] for (colName, colData) in df_new.iteritems(): if colName != x_col: df_new[colName] = applyFilter(x, colData, options) return df_new
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(df, predicate):\n if not df:\n return []\n\n return [row for row in df if predicate(row)]", "def filter_df(df):\n filtered_df = df[df['rtt_author_ids'].notnull()]\n filtered_df = filtered_df[filtered_df['user_country'] == 'FR']\n filtered_df = filtered_df[filtered_df['retweet_cou...
[ "0.7407638", "0.724852", "0.704661", "0.7027564", "0.7023182", "0.6907279", "0.66587406", "0.659837", "0.6529601", "0.65274286", "0.65156597", "0.6502992", "0.63980293", "0.6372149", "0.6241662", "0.62319803", "0.62082523", "0.6191966", "0.6185082", "0.61699754", "0.6151905",...
0.67664623
6
Find zerocrossing points in a discrete vector, using linear interpolation.
def zero_crossings(y,x=None,direction=None): if x is None: x=np.arange(len(y)) if np.any((x[1:] - x[0:-1]) <= 0.0): raise Exception('x values need to be in ascending order') # Indices before zero-crossing iBef = np.where(y[1:]*y[0:-1] < 0.0)[0] # Find the zero crossi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interp_lookup(x: NDArrayFloat, values: NDArrayFloat) -> NDArrayFloat:\n # - Map x from [0, 1] onto [0, 255] i.e. the color channel\n # breaks (continuous)\n # - Find where x would be mapped onto the grid (discretizing)\n # - Find the distance between the discrete breaks and the\n # continuou...
[ "0.61564785", "0.6144386", "0.61141384", "0.6106354", "0.6084969", "0.6051719", "0.5989732", "0.5978199", "0.5974089", "0.59410775", "0.5892506", "0.5865554", "0.5835971", "0.58187604", "0.5804415", "0.57787144", "0.5775342", "0.57558095", "0.57353354", "0.57255906", "0.57218...
0.5222858
97
Compute auto correlation of a signal
def correlation(x, nMax=80, dt=1, method='manual'): nvec = np.arange(0,nMax) sigma2 = np.var(x) R = np.zeros(nMax) R[0] =1 for i,nDelay in enumerate(nvec[1:]): R[i+1] = np.mean( x[0:-nDelay] * x[nDelay:] ) / sigma2 tau = nvec*dt return R, tau
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autocorr(x):\n result = np.correlate(x, x, mode='full')/np.sum(x**2)\n return result[result.size//2:]", "def autocorr(sig):\n return float(np.correlate(sig, sig))", "def auto_correlation(arr):\n return cross_correlation(arr, arr)", "def autocorrelation(x):\n x = (x - np.mean(x)) / (np.std(...
[ "0.78440106", "0.7839139", "0.7818094", "0.73183256", "0.73183256", "0.7294256", "0.724523", "0.7240855", "0.7177536", "0.71621394", "0.71389467", "0.7134856", "0.7039315", "0.7009267", "0.69940567", "0.6991675", "0.6954582", "0.6765807", "0.6740423", "0.67296267", "0.6728909...
0.6138898
69
Create a correlated random signal of length `n` based on the correlation coefficient `coeff` value[t] = coeff value[t1] + (1coeff) random
def correlated_signal(coeff, n=1000, seed=None): if coeff<0 or coeff>1: raise Exception('Correlation coefficient should be between 0 and 1') if seed is not None: np.random.seed(seed) x = np.zeros(n) rvec = rand(n) x[0] = rvec[0] for m in np.arange(1,n): x[m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_normal_correlated_data(\n N,\n r=0.5,\n mu_a=0,\n mu_b=0,\n sig_a=1,\n sig_b=1,\n lim_a=None,\n lim_b=None,\n tolerance=0.05,\n seed=None,\n verbose=False,\n):\n np.random.seed(seed)\n\n # Construct mean vector\n mu = np.array([mu_a, mu_b])\n\n # Construct ...
[ "0.6543086", "0.63841903", "0.6228304", "0.6159539", "0.61279804", "0.60582393", "0.59953517", "0.5940001", "0.5919091", "0.58453345", "0.5834957", "0.58325607", "0.5791859", "0.5704279", "0.5678215", "0.5678087", "0.5651459", "0.56434083", "0.56399286", "0.5638942", "0.56245...
0.8384586
0
Find time offset between two signals (may be negative) t_offset = find_time_offset(t, f, g) f(t+t_offset) ~= g(t)
def find_time_offset(t, f, g, outputAll=False): import scipy from scipy.signal import correlate # Remove mean and normalize by std f = f.copy() g = g.copy() f -= f.mean() g -= g.mean() f /= f.std() g /= g.std() # Find cross-correlation xcorr = correlate(f, g) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_time_offset(source, target, search_range=200):\r\n assert source.shape[1] == target.shape[1]\r\n best_offset = 688\r\n time_offset = 0\r\n if best_offset >= 0:\r\n time_offset = target[best_offset, 0] - source[0, 0]\r\n elif best_offset < 0:\r\n time_offset = target[0, 0] -...
[ "0.5972519", "0.5830573", "0.58109057", "0.57050276", "0.56272084", "0.5602879", "0.5560157", "0.5410567", "0.5351085", "0.5277255", "0.52644086", "0.52525896", "0.52351123", "0.5225274", "0.52198476", "0.5204406", "0.5141116", "0.51281154", "0.5116382", "0.5086718", "0.50661...
0.6923712
0
Sinusoidal approximation of input signal x
def sine_approx(t, x, method='least_square'): if method=='least_square': from welib.tools.curve_fitting import fit_sinusoid y_fit, pfit, fitter = fit_sinusoid(t, x) omega = fitter.model['coeffs']['omega'] A = fitter.model['coeffs']['A'] phi = fitter.model['coeffs'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sin(x):\n raise NotImplementedError", "def sin(x):\n return 0.0", "def sinh(x):\n raise NotImplementedError", "def sinh(x):\n return 0.0", "def sin(x):\n\tgetcontext().prec += 2\n\t#if abs(x) > 2 * pi:\n\t\t#x = x % (2 * pi)\n\ti, lasts, s, fact, num, sign = 1, 0, x, 1, x, 1\n\twhil...
[ "0.7904429", "0.77732176", "0.77485776", "0.7619197", "0.74488825", "0.74039143", "0.7256555", "0.7244491", "0.72000605", "0.7156726", "0.7096575", "0.7069837", "0.7069837", "0.7069837", "0.7069837", "0.7057795", "0.69788826", "0.6957409", "0.69141835", "0.6866592", "0.673010...
0.7026233
16
Describe intervals from a boolean vector where intervals are indicated by True
def intervals(b, min_length=1, forgivingJump=True, removeSmallRel=True, removeSmallFact=0.1, mergeCloseRel=False, mergeCloseFact=0.2): b = np.asarray(b) total = np.sum(b) min_length=max(min_length,1) if forgivingJump: min_jump=min_length else: min_jump=1 if total==0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enumerate_bool(bool_array, nstart=0):\n ind = bool_2_indices(bool_array)\n ns = np.full(bool_array.size, nstart, dtype=int)\n for n, lims in enumerate(ind):\n ns[lims[0]:lims[-1]] = nstart + n + 1\n return ns", "def masktoregions(in_mask):\n regions = []\n for i in [0,1]: # do the th...
[ "0.5807116", "0.56695867", "0.5668119", "0.5662468", "0.5501248", "0.5373047", "0.5335888", "0.5283006", "0.5214154", "0.5200806", "0.5185108", "0.5182758", "0.5155722", "0.5117036", "0.5102781", "0.5086988", "0.50779855", "0.5037429", "0.5030881", "0.5025144", "0.5024235", ...
0.49009746
28
Find peaks in a signal, above a given threshold
def peaks(x, threshold=0.3, threshold_abs=True, method='intervals', min_length=3, mergeCloseRel=True, returnIntervals=False): if not threshold_abs: threshold = threshold * (np.max(y) - np.min(y)) + np.min(y) if method =='intervals': IStart, IEnd, Lengths = intervals(x>threshold, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _detect_peaks(x, mph=None, mpd=1, threshold=0, edge='rising', kpsh=False, valley=False):\n\n x = np.atleast_1d(x).astype('float64')\n if x.size < 3:\n return np.array([], dtype=int)\n if valley:\n x = -x\n # find indices of all peaks\n dx = x[1:] - x[:-1]\n # handle NaN's\n i...
[ "0.7402499", "0.7276066", "0.7275141", "0.72460145", "0.7229513", "0.7229513", "0.72261554", "0.7199505", "0.7193658", "0.7155259", "0.71253824", "0.7093342", "0.70886797", "0.7087927", "0.70508415", "0.69726866", "0.6947404", "0.69307315", "0.6930226", "0.6874048", "0.686530...
0.6450717
34
Encodes a list of strings to a single string.
def encode(self, strs):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_as_str(list_to_encode, sep = \"|\"):\n return sep.join([str(x) for x in list_to_encode])", "def _encode_list(source: list) -> bytes:\n result_data = b\"l\"\n\n for item in source:\n result_data += encode(item)\n\n return result_data + b\"e\"", "def encode (self, strs):\n if...
[ "0.7459969", "0.74273384", "0.7258633", "0.7255417", "0.6790711", "0.67658377", "0.66986156", "0.6680612", "0.65740526", "0.6573746", "0.6484516", "0.6398631", "0.6318684", "0.63106364", "0.628163", "0.62610334", "0.62113565", "0.62003165", "0.6199526", "0.6192243", "0.616536...
0.6643305
8
Decodes a single string to a list of strings.
def decode(self, s):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(self, s):\n lststr = s.split(',')\n if s=='': return []\n rst = []\n for i in range(len(lststr)):\n rst.append(lststr[i])\n return rst", "def decode (self, s):\n if s == \"null\": return []\n return s.split(chr(257))", "def parse_string_lis...
[ "0.7429849", "0.7317169", "0.67665714", "0.6603133", "0.6484686", "0.64099807", "0.63982195", "0.63764083", "0.63426924", "0.63409954", "0.6335773", "0.62704915", "0.62629604", "0.6239383", "0.6189524", "0.6171236", "0.6159162", "0.6110307", "0.6100137", "0.6022035", "0.60078...
0.5704728
42
returns a pandas dataframe network like object ie C A T D O Y Z X V G R P N J U S L E I Q C 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 A 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 T 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 D 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 O 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Y 1 0 0 0 0 0 1 0 0 ...
def compile_links(cls, board): # compute 1 row width width = len(board[0]) # flatten board to a 1d list flat_board = list(itertools.chain(*board)) # compute total board length board_width = len(flat_board) # allocate a frame of 0s with proper columns and index...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graph_node_table(G):\n rows = []\n for node, w in get_node_weights(G).items():\n ((seq, coord), (original, changed)) = node\n rows.append({\n 'seq': seq,\n 'coord': coord,\n 'original': original,\n 'changed': changed,\n 'weight': w\n ...
[ "0.5420094", "0.5379166", "0.53271145", "0.52464855", "0.52200973", "0.5206724", "0.5164668", "0.5119359", "0.5092361", "0.5048056", "0.5027625", "0.5005142", "0.4967404", "0.49626625", "0.4945909", "0.49448714", "0.4932868", "0.4930066", "0.4908773", "0.4906127", "0.48895586...
0.5109281
8