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
Load an ARFF File from a file.
def load(filename): o = open(filename) s = o.read() a = ArffFile.parse(s) o.close() return a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self, filename=None):\n importer = aspecd.io.AdfImporter()\n importer.source = filename\n importer.import_into(self)", "def loadFile(self, filename):\n #TODO: do a contents based detection\n if filename[-4:].lower() == '.txt':\n self.loadTIText(open(filename...
[ "0.6952331", "0.6750146", "0.6709102", "0.67043614", "0.6499693", "0.6472072", "0.6260189", "0.6143849", "0.61354226", "0.61135525", "0.60728455", "0.6060615", "0.60431916", "0.60410386", "0.60397345", "0.59697336", "0.5964675", "0.59411573", "0.5907846", "0.5897713", "0.5881...
0.8042971
0
Parse an ARFF File already loaded into a string.
def parse(s): a = ArffFile() a.state = 'comment' a.lineno = 1 for l in s.splitlines(): a.__parseline(l) a.lineno += 1 return a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(filename):\n o = open(filename)\n s = o.read()\n a = ArffFile.parse(s)\n o.close()\n return a", "def parser(path):\n\t\n\tdata = Arff()\n\tdata.read_arff(path)\n\t\n\treturn data", "def parse(self, fstring):\n pass", "def readstring(self, fstring):\n ...
[ "0.7748348", "0.6941203", "0.65057826", "0.6344125", "0.6126974", "0.60245204", "0.5986282", "0.5867104", "0.58164245", "0.5803675", "0.5767087", "0.5750282", "0.5741847", "0.57395566", "0.5734487", "0.57319623", "0.5729989", "0.57124734", "0.57011807", "0.56908566", "0.56846...
0.59209055
7
Save an arff structure to a file.
def save(self, filename): o = open(filename, 'w') o.write(self.write()) o.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to(self, f: BinaryIO):\n raise NotImplementedError", "def save(self, fp):\n fp.write(self.dump())", "def arff_file(data,attributes,relation,description,output_dir=\"./\",filename=\"tmp\"):\n x = []\n for k in attributes:\n x.append(k[0])\n data_write = {}\n data_write[...
[ "0.69570386", "0.68969166", "0.6809577", "0.67342925", "0.66713744", "0.6558785", "0.65403384", "0.6525226", "0.65054166", "0.65036285", "0.6475159", "0.63836706", "0.6351954", "0.63122535", "0.62712467", "0.6262766", "0.62433875", "0.6220814", "0.6198543", "0.61779356", "0.6...
0.6042053
39
Write an arff structure to a string.
def write(self): o = [] print self.comment o.append('% ' + re.sub("\n", "\n% ", self.comment)) o.append("@relation " + self.esc(self.relation)) for a in self.attributes: at = self.attribute_types[a] if at == 'numeric': o.append("@attribute ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_string(fobj, strng):\n nchar = len(strng)\n fobj.write(struct.pack('i' + str(nchar) + 's',nchar, strng))", "def writeArff(file_name, relation, classes, attrs, data):\n\tprint 'writeArff:', file_name, len(data), len(data[0])\n\tf = file(file_name, 'w')\n\tf.write('%\\n')\n\tf.write('%% %s \\n' % o...
[ "0.6324499", "0.62119496", "0.6018703", "0.5856187", "0.5729599", "0.5729317", "0.5680122", "0.56663", "0.5607432", "0.55896235", "0.55244505", "0.55047196", "0.5478621", "0.54767764", "0.5470894", "0.5455972", "0.54425216", "0.54396397", "0.542664", "0.5419853", "0.5416848",...
0.53047353
36
Define a new attribute. atype has to be one of 'numeric', 'string', and 'nominal'. For nominal attributes, pass the possible values as data.
def define_attribute(self, name, atype, data=None): self.attributes.append(name) self.attribute_types[name] = atype self.attribute_data[name] = data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_attribute(self,\n identifier,\n idl_type,\n is_readonly=False,\n extended_attributes=None,\n node=None):\n if isinstance(idl_type, str):\n idl_type = self._crea...
[ "0.6832389", "0.6797418", "0.67368126", "0.6671336", "0.65930986", "0.6554519", "0.65519553", "0.650852", "0.6398499", "0.6318576", "0.6294345", "0.6168906", "0.6158302", "0.6157011", "0.61001563", "0.605466", "0.6050371", "0.6018214", "0.6016995", "0.60158825", "0.60112774",...
0.8044042
0
Print an overview of the ARFF file.
def dump(self): print "Relation " + self.relation print " With attributes" for n in self.attributes: if self.attribute_types[n] != 'nominal': print " %s of type %s" % (n, self.attribute_types[n]) else: print (" " + n + " of type nomi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display(self):\n art = \"\\n\".join([\"\".join(row) for row in self.text])\n if self.args.output:\n with open(self.args.output, \"w\") as f:\n f.write(art)\n\n if self.args.verbose:\n print(art)", "def do_overview(self):\n summaries = []\n ...
[ "0.62585604", "0.61102706", "0.59338325", "0.5928298", "0.5916814", "0.5912711", "0.58843017", "0.5880487", "0.5864036", "0.584445", "0.5838104", "0.5826809", "0.5805153", "0.5799806", "0.57934296", "0.57876754", "0.57797", "0.5754832", "0.5734082", "0.5728988", "0.5718277", ...
0.0
-1
Update the overall ignorance
def update_overall_ignorance(overall_ignorance, object_ignorance, rate=0.05): return (1-rate)*overall_ignorance + rate*object_ignorance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n # default implementation is to do nothing.", "def dummy_update( self ):\r\n pass", "def _update(self):\n pass", "def update(self):\n\n pass", "def update(self):\n pass", "def update(self):\n pass", "def update(self):\n pass", "def u...
[ "0.60763353", "0.60567635", "0.60499495", "0.59942096", "0.59925723", "0.59925723", "0.59925723", "0.59925723", "0.59925723", "0.59925723", "0.59925723", "0.59925723", "0.59925723", "0.59925723", "0.59925723", "0.59925723", "0.59925723", "0.59925723", "0.59925723", "0.5989389",...
0.62073374
0
Return focus image at target positon
def check_target_position(environment, target_xy, fovea): temp_fovea = Fovea(target_xy, fovea.size, [0, 0, 0], fovea.unit) temp_image = temp_fovea.get_focus_image(environment) return temp_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_img(self, target_img):\n pos = imagesearch_loop(target_img, timesample=0.5)\n if pos[0] == -1:\n print(\"No image found\")\n else:\n self.click(pos)", "def extract_target_pixel_location(self):\n #Respective Image location\n pixel_array = self.ima...
[ "0.6471832", "0.60620207", "0.60257924", "0.5962527", "0.5960928", "0.5843375", "0.5577541", "0.556946", "0.5547605", "0.55378973", "0.55275726", "0.54741293", "0.5447037", "0.543567", "0.5431909", "0.54052734", "0.5387265", "0.5387265", "0.5387265", "0.5387265", "0.534272", ...
0.64985406
0
Check if target area is free
def check_free_space(environment, target_xy, fovea): temp_image = check_target_position(environment, target_xy, fovea) if np.array_equal(temp_image, np.zeros(temp_image.shape)): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_free(self) -> bool:\n return self.places < self.total", "def is_free(self):\n return self._size > 0", "def guard_occupy_transition(self):\n if not self.get_free_positions:\n return True", "def _space_has_degrees_of_freedom(self) -> bool:\n return True", "def fr...
[ "0.69473505", "0.65693545", "0.65516436", "0.65503776", "0.65440136", "0.64887106", "0.63822377", "0.6373474", "0.6314653", "0.6287633", "0.62136126", "0.6197832", "0.6167743", "0.6130558", "0.60996246", "0.6068702", "0.6056441", "0.60131264", "0.6010799", "0.5976388", "0.597...
0.7472877
0
Generate random xy coordinates within limits
def get_random_position(limits): x = (limits[0][1]-limits[0][0])*np.random.random_sample() + limits[0][0] y = (limits[1][1]-limits[1][0])*np.random.random_sample() + limits[1][0] return np.array([x, y])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RandomCoordinate(): \r\n return ReturnRounded(np.random.uniform(-10,10))", "def random_coords(bounds):\n x_min, y_min, x_max, y_max = bounds\n x = np.random.randint(x_min, x_max)\n y = np.random.randint(y_min, y_max)\n return x, y", "def random_coordinates():\n return Coor...
[ "0.7965414", "0.784305", "0.75514454", "0.75506085", "0.7408047", "0.7375667", "0.73101634", "0.72578305", "0.72399473", "0.7202774", "0.70819545", "0.7014638", "0.6981883", "0.6853431", "0.68348783", "0.6809381", "0.6802051", "0.6801578", "0.67783827", "0.674277", "0.6731451...
0.7362432
6
Provisory function for plotting the graphics of the system.
def graphics(env, fovea, objects, unit): plt.clf() env = environment.redraw(env, unit, objects) fovea_im = fovea.get_focus_image(env) plt.subplot(121) plt.title('Training environment') plt.xlim(0, unit) plt.ylim(0, unit) plt.imshow(env) # PLOT DESK EDGES plt.plot([0.2*unit, 0....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot():\n pass", "def plot_graph(self) -> None:", "def plot(self):\n pass", "def plot(self, *args, **kwargs):\n pass", "def plot(self):\n\t\tself.plotOfHeatingCurrent().plot()", "def make_plot(x,y):", "def generate_plot(self):\r\n\t\tx, y = zip(*[p.p for p in self.universe])\r\n\t\...
[ "0.77779406", "0.75133127", "0.7475758", "0.71247405", "0.70805234", "0.70423293", "0.7034035", "0.7024165", "0.6948862", "0.69376713", "0.6886023", "0.68375045", "0.68164", "0.68092847", "0.6804923", "0.67728657", "0.676849", "0.6763229", "0.6728822", "0.67281336", "0.672028...
0.0
-1
Initialize a new network.
def __init__(self, input_dim=(3, 32, 32), hidden_dims_CNN = ((32, 5, 1, 1), (2, 2, 2)), hidden_dims_FC = ((1024), (0.5)), num_classes=10, weight_scale=1e-3, reg=0.0, dtype=np.float32): self.params = {} self.fix_params = {} self.reg = reg self.dtype = dtype C_input...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialise_network(self):\n raise NotImplementedError", "def initialize_network(self):\n self.sess = tf.InteractiveSession()\n sys.stderr.write(\"------\\n\")\n self.model.create_model()\n self._initialize_trainer()\n self.sess.run(tf.initialize_all_variables())\n ...
[ "0.82548803", "0.73180324", "0.7250326", "0.7208859", "0.7175182", "0.71721554", "0.7144906", "0.71397537", "0.7111056", "0.70892704", "0.7068604", "0.70275855", "0.7006372", "0.70048183", "0.6935608", "0.6931045", "0.68508935", "0.6778785", "0.6745369", "0.6730585", "0.67080...
0.0
-1
Evaluate loss and gradient for the threelayer convolutional network.
def loss(self, X, y=None): X = X.astype(self.dtype) mode = 'test' if y is None else 'train' num_FC = self.num_FC num_CNN = self.num_CNN total_layer = self.num_FC + self.num_CNN cache = {} pre_layer_output = X for i in range(0, num_CNN): W_name = "W" + str(i) b_name = "b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loss(self, X, y=None):\n W1, b1 = self.params['W1'], self.params['b1']\n W2, b2 = self.params['W2'], self.params['b2']\n W3, b3 = self.params['W3'], self.params['b3']\n \n # pass conv_param to the forward pass for the convolutional layer\n filter_size = W1.shape[2]\n conv_param = {'stride'...
[ "0.64657706", "0.6235286", "0.62264025", "0.61885417", "0.617772", "0.61766106", "0.6117092", "0.609945", "0.6043953", "0.60374737", "0.60298234", "0.6029765", "0.6028192", "0.6012463", "0.6012463", "0.59997284", "0.5982718", "0.590393", "0.58888876", "0.5880226", "0.5858676"...
0.0
-1
Initialize a new network.
def __init__(self, input_dim=(3, 32, 32), num_filters=32, filter_size=7, hidden_dim=100, num_classes=10, weight_scale=1e-3, reg=0.0, dtype=np.float32): self.params = {} self.reg = reg self.dtype = dtype ##################################################################...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialise_network(self):\n raise NotImplementedError", "def initialize_network(self):\n self.sess = tf.InteractiveSession()\n sys.stderr.write(\"------\\n\")\n self.model.create_model()\n self._initialize_trainer()\n self.sess.run(tf.initialize_all_variables())\n ...
[ "0.82548803", "0.73180324", "0.7250326", "0.7208859", "0.7175182", "0.71721554", "0.7144906", "0.71397537", "0.7111056", "0.70892704", "0.7068604", "0.70275855", "0.7006372", "0.70048183", "0.6935608", "0.6931045", "0.68508935", "0.6778785", "0.6745369", "0.6730585", "0.67080...
0.0
-1
Evaluate loss and gradient for the threelayer convolutional network.
def loss(self, X, y=None): W1, b1 = self.params['W1'], self.params['b1'] W2, b2 = self.params['W2'], self.params['b2'] W3, b3 = self.params['W3'], self.params['b3'] # pass conv_param to the forward pass for the convolutional layer filter_size = W1.shape[2] conv_param = {'stride': 1, 'pad': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loss(self, X, y=None):\n W1, b1 = self.params['W1'], self.params['b1']\n W2, b2 = self.params['W2'], self.params['b2']\n W3, b3 = self.params['W3'], self.params['b3']\n \n # pass conv_param to the forward pass for the convolutional layer\n filter_size = W1.shape[2]\n conv_param = {'stride'...
[ "0.64657706", "0.62264025", "0.61885417", "0.617772", "0.61766106", "0.6117092", "0.609945", "0.6043953", "0.60374737", "0.60298234", "0.6029765", "0.6028192", "0.6012463", "0.6012463", "0.59997284", "0.5982718", "0.590393", "0.58888876", "0.5880226", "0.5858676", "0.5853266"...
0.6235286
1
Set some default values. You may (and should) overwrite them for your Labourers in config of the Orchestrator.
def set_defaults(self): for k, v in self.DEFAULTS.items(): if not getattr(self, k, None): setattr(self, k, v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_defaults(self):\n self.plastic = False\n self.unset_output()\n self.reward = False\n self.patmod = config.impact_modulation_default", "def setdefaults(self):\n self.config = {\n 'dbuser': Infopage.DEFAULT_DBUSER,\n 'dbname': Infopage.DEFAULT_DBNAME...
[ "0.7093305", "0.70469713", "0.67849386", "0.67849386", "0.67849386", "0.67587817", "0.66523325", "0.6466132", "0.64581084", "0.645666", "0.64541894", "0.64196736", "0.6395543", "0.6373748", "0.63288397", "0.63198304", "0.63015604", "0.62990135", "0.62858754", "0.62858754", "0...
0.6111626
36
Set timestamp attributes with some validation. Normally TaskManager is supposed to call me.
def set_custom_attribute(self, name: str, value: int): if name not in self.CUSTOM_ATTRIBUTES: raise ValueError(f"Failed to set custom attribute {name} with value {value} for Labourer {self.id}. " f"Supported attributes are: {', '.join(self.CUSTOM_ATTRIBUTES)}.") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp(self, value):\n value = util.parse_valid_date(value)\n self._set_attr('timestamp', value)", "def __init__(self, timestamp):\n self.timestamp = timestamp", "def validate_timestamps(self, format, attr='timestamp'):\n for signal in self.last_notified[DEFAULT_TERMINAL]:\n ...
[ "0.6389384", "0.6352489", "0.625885", "0.6236824", "0.62339187", "0.6217164", "0.61725146", "0.6168362", "0.6143944", "0.60877424", "0.60449666", "0.60201776", "0.6011213", "0.5992953", "0.5985982", "0.59728694", "0.5938458", "0.5936693", "0.59341115", "0.5922366", "0.5922366...
0.0
-1
The Labourer must be first registered in TaskManager for this to work.
def get_attr(self, name: str): if name not in self.CUSTOM_ATTRIBUTES: raise ValueError(f"Supported values are: {', '.join(self.CUSTOM_ATTRIBUTES)}") try: return getattr(self, name) except AttributeError: raise AttributeError(f"The Labourer is not yet registe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task(self, name):\n pass", "def task(self):", "def task(self):", "def task1(self):\n \n pass", "def create_task():", "def _service_task(self):\n pass", "def setup_task(self, *args, **kwargs):\n pass", "def task():", "def task():\n pass", "def task():\n ...
[ "0.6471944", "0.6356887", "0.6356887", "0.6250948", "0.62168896", "0.6168737", "0.6166343", "0.61271644", "0.6126083", "0.6126083", "0.611737", "0.6075094", "0.6068572", "0.60475683", "0.60475683", "0.6020514", "0.59368414", "0.5921351", "0.5903134", "0.58914965", "0.5884872"...
0.0
-1
Transform individual access rules states to 'access_rules_status'.
def upgrade(): op.add_column( 'share_instances', Column('access_rules_status', String(length=255)) ) connection = op.get_bind() share_instances_table = utils.load_table('share_instances', connection) instance_access_table = utils.load_table('share_instance_access_map', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rights_status(self):\n return {uri: dict(name=name,\n open_access=(uri in RightsStatus.OPEN_ACCESS),\n allows_derivatives=(uri in RightsStatus.ALLOWS_DERIVATIVES))\n for uri, name in list(RightsStatus.NAMES.items())}", "def get_left_pane...
[ "0.5165392", "0.51448774", "0.5017657", "0.48824677", "0.47823787", "0.47806934", "0.47753397", "0.47299045", "0.47297558", "0.47259787", "0.46960357", "0.46546775", "0.46254045", "0.46073136", "0.45791447", "0.45639652", "0.45602906", "0.4543913", "0.45438454", "0.4541616", ...
0.0
-1
Inplace applies a one mode gate G into the process matrix T in mode i
def _apply_one_mode_gate(G, T, i): T[i] *= G return T
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _apply_two_mode_gate(G, T, i, j):\n (T[i], T[j]) = (G[0, 0] * T[i] + G[0, 1] * T[j], G[1, 0] * T[i] + G[1, 1] * T[j])\n return T", "def compile(self, seq, registers):\n\n # Check which modes are actually being used\n used_modes = []\n for operations in seq:\n modes = [mo...
[ "0.70139986", "0.5631263", "0.5538027", "0.5311544", "0.5232887", "0.5197726", "0.5164995", "0.5135691", "0.50920993", "0.50480705", "0.5039565", "0.50272524", "0.49950483", "0.49901596", "0.4963029", "0.49488658", "0.4937678", "0.49336824", "0.49291444", "0.49188215", "0.487...
0.79795337
0
Inplace applies a two mode gate G into the process matrix T in modes i and j
def _apply_two_mode_gate(G, T, i, j): (T[i], T[j]) = (G[0, 0] * T[i] + G[0, 1] * T[j], G[1, 0] * T[i] + G[1, 1] * T[j]) return T
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _apply_one_mode_gate(G, T, i):\n\n T[i] *= G\n return T", "def _assembler_baseV00(M2bass, Gi_, G_j, mode):\n Gi_ = Gi_.T\n G_j = G_j.T\n\n hmgeoiti_ = int(np.max(Gi_) + 1)\n hmgeoit_j = int(np.max(G_j) + 1)\n\n szGi_ = np.shape(Gi_)\n szG_j = np.shape(G_j)\n rowGi_ = szGi_[0]\n ...
[ "0.719273", "0.57634723", "0.5522466", "0.509846", "0.50796694", "0.49862283", "0.49686834", "0.49493116", "0.4947738", "0.493212", "0.48544836", "0.48431808", "0.48389664", "0.48374176", "0.4813507", "0.4800392", "0.47900787", "0.47492748", "0.47435454", "0.47330758", "0.472...
0.80511445
0
Try to arrange a passive circuit into a single multimode passive operation This method checks whether the circuit can be implemented as a sequence of passive gates. If the answer is yes it arranges them into a single operation.
def compile(self, seq, registers): # Check which modes are actually being used used_modes = [] for operations in seq: modes = [modes_label.ind for modes_label in operations.reg] used_modes.append(modes) used_modes = list(set(item for sublist in used_modes for it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subsumes(self, cl):\n #-------------------------------------------------------\n # DISCRETE PHENOTYPE\n #-------------------------------------------------------\n if cons.env.format_data.discrete_action:\n if cl.action == self.action:\n if self.isPossibleSu...
[ "0.5135323", "0.51068234", "0.50888085", "0.5013659", "0.50006473", "0.49939522", "0.49842253", "0.4959614", "0.4951084", "0.49505147", "0.49332213", "0.4926676", "0.49138048", "0.49060512", "0.48939487", "0.48903114", "0.48635298", "0.48454458", "0.48432", "0.48349684", "0.4...
0.0
-1
Returns a list of the columns that are in our features dataframe that should not be used in prediction. These are essentially either metadata columns (team name, for example), or potential target variables that include the outcome. We want to make sure not to use the latter, since we don't want to use information about...
def get_non_feature_columns(): return ['teamid', 'op_teamid', 'matchid', 'competitionid', 'seasonid', 'goals', 'op_goals', 'points', 'timestamp', 'team_name', 'op_team_name']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_columns(self):\n df = self.get_prep_data()\n col = [c for c in df.columns if c not in ['target', 'idd', 'ft_data_dt']]\n return col", "def missing_columns(self):\r\n _missing_columns = set(self.reqd_columns).difference(set(self.all_columns))\r\n return list(_missing...
[ "0.71959037", "0.68640786", "0.683394", "0.6806973", "0.67299575", "0.6661575", "0.6637758", "0.65448886", "0.65201235", "0.64434034", "0.6430318", "0.6406203", "0.63625467", "0.6347281", "0.6317178", "0.6239724", "0.621829", "0.6213187", "0.6197959", "0.6065288", "0.60188276...
0.80354255
0
Returns a list of all columns that should be used in prediction (i.e. all features that are in the dataframe but are not in the features.get_non_feature_column() list).
def get_feature_columns(all_cols): return [col for col in all_cols if col not in get_non_feature_columns()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_columns(self):\n df = self.get_prep_data()\n col = [c for c in df.columns if c not in ['target', 'idd', 'ft_data_dt']]\n return col", "def get_cols(df):\n meta = get_metafeatures(df)\n categorical_columns = meta.loc[meta['type'] == 'object', 'column'].tolist()\n cols_to_...
[ "0.7311638", "0.71005136", "0.7081749", "0.6978075", "0.6938612", "0.6809944", "0.67643905", "0.6764281", "0.67626035", "0.6757341", "0.67021", "0.6644742", "0.6602799", "0.64940643", "0.64777064", "0.6425499", "0.64037734", "0.6395039", "0.6363723", "0.6360488", "0.6316431",...
0.7818545
0
Setup cache object for wallet
def setup_cache(self): if self.walletname not in cache: cache[self.walletname] = { "raw_transactions": {}, "transactions": [], "tx_count": None, "tx_changed": True, "last_block": None, "raw_tx_block_upda...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_cache(self):\n if self.cacheable:\n self._instance._cache[self.name] = {}", "def __init__(self, *args, **kwargs):\n self._cachedict = {}", "def __init_cache__(self) -> None:\n try:\n self.cache = caches[CACHE_NAME]\n logging.info(\"GeoIP2 - success...
[ "0.70809096", "0.67123383", "0.66832745", "0.6391737", "0.6336041", "0.619476", "0.6180135", "0.6171709", "0.6163314", "0.6139369", "0.60808635", "0.6058581", "0.60361993", "0.60249174", "0.6023925", "0.5965481", "0.59415615", "0.5929574", "0.59244114", "0.59184754", "0.58754...
0.86449647
0
Cache `raw_transactions` (with full data on all the inputs and outputs of each tx)
def cache_raw_txs(self, cli_txs): # Get list of all tx ids txids = list(dict.fromkeys(cli_txs.keys())) tx_count = len(txids) # If there are new transactions (if the transations count changed) if tx_count != self.cache["tx_count"]: for txid in txids: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_txs(self, raw_txs):\n # Get the cached `raw_transactions` dict (txid -> tx) as a list of txs\n transactions = list(sorted(raw_txs.values(), key = lambda tx: tx['time'], reverse=True))\n result = []\n\n # If unconfirmed transactions were mined, assign them their block height\n ...
[ "0.7925975", "0.6223888", "0.61566186", "0.60971904", "0.5936462", "0.58497435", "0.58128", "0.57948434", "0.57376546", "0.5634292", "0.5595399", "0.5577145", "0.55244076", "0.54729325", "0.5469587", "0.54539764", "0.5448407", "0.5412813", "0.5397462", "0.53824824", "0.535970...
0.79335445
0
Caches the transactions list. Cache the inputs and outputs which belong to the user's wallet for each `raw_transaction`
def cache_txs(self, raw_txs): # Get the cached `raw_transactions` dict (txid -> tx) as a list of txs transactions = list(sorted(raw_txs.values(), key = lambda tx: tx['time'], reverse=True)) result = [] # If unconfirmed transactions were mined, assign them their block height if l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_raw_txs(self, cli_txs): \n # Get list of all tx ids\n txids = list(dict.fromkeys(cli_txs.keys()))\n tx_count = len(txids)\n\n # If there are new transactions (if the transations count changed)\n if tx_count != self.cache[\"tx_count\"]:\n for txid in tx...
[ "0.76756275", "0.6882982", "0.6274878", "0.61497986", "0.58140624", "0.57319975", "0.5679993", "0.5659589", "0.5585741", "0.55252254", "0.55109656", "0.5479615", "0.5473953", "0.546898", "0.5449675", "0.54464066", "0.542897", "0.54221237", "0.5411895", "0.5377797", "0.5366215...
0.7736577
0
Cache Bitcoin Core `listtransactions` result
def update_txs(self, txs): # For now avoid caching orphan transactions. We might want to show them somehow in the future. cli_txs = {tx["txid"]: tx for tx in txs if tx["category"] != "orphan"} raw_txs = self.cache_raw_txs(cli_txs) cached_txs = self.cache_txs(raw_txs) return cach...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_wallets_get_transaction_list(self):\n pass", "def load_transactions(self, address, update=True, verbose=False, **kwargs):\n if self.apikey is None:\n update = False\n if verbose:\n print('load_transactions', address)\n fn = os.path.join(self.cache_dir, a...
[ "0.7081673", "0.69549066", "0.6773823", "0.66765434", "0.66569877", "0.660985", "0.64810187", "0.6435633", "0.6424816", "0.64240026", "0.63761234", "0.63547444", "0.6330722", "0.6327416", "0.6321605", "0.6307761", "0.6297964", "0.6269112", "0.62622905", "0.62056416", "0.61879...
0.531083
95
This method hides fields that were added in newer API versions. Certain node fields were introduced at certain API versions. These fields are only made available when the request's API version matches or exceeds the versions when these fields were introduced.
def hide_fields_in_newer_versions(obj): if not api_utils.allow_start_end_audit_time(): obj.start_time = wtypes.Unset obj.end_time = wtypes.Unset if not api_utils.allow_force(): obj.force = wtypes.Unset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_api_fields(cls):\n return ['fqdn', 'ttl', 'description', 'views']", "def remove_read_only_fields(self):\n self.fields = XML_List(Elements.FIELDS, [field for field in self.fields if\n not field.read_only or not str_to_bool(field.read_only)])", ...
[ "0.63221574", "0.6136071", "0.60758066", "0.5660327", "0.560701", "0.5569673", "0.55660045", "0.55565786", "0.55165595", "0.54647285", "0.54489416", "0.54486406", "0.54375917", "0.5407587", "0.54063267", "0.5390326", "0.53891975", "0.53873795", "0.5364011", "0.5361968", "0.53...
0.6415202
0
Retrieve a list of audits.
def get_all(self, marker=None, limit=None, sort_key='id', sort_dir='asc', goal=None, strategy=None): context = pecan.request.context policy.enforce(context, 'audit:get_all', action='audit:get_all') return self._get_audits_collection(marker, limit, sort_ke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def audits(self, page=None, per_page=None):\r\n url = '{0}/{1}'.format(self.get_url(), 'audits')\r\n params = base.get_params(('page', 'per_page'), locals())\r\n\r\n return http.Request('GET', url, params), parsers.parse_json", "async def getAudits(self, userid) -> GetAuditsResponse:\n ...
[ "0.7242189", "0.6925415", "0.6629473", "0.6066214", "0.58930445", "0.57951593", "0.5622102", "0.55762124", "0.5560621", "0.5521924", "0.54882264", "0.54614747", "0.54085684", "0.5381083", "0.5341541", "0.53253835", "0.5291983", "0.52089226", "0.5208324", "0.519872", "0.519041...
0.5851862
5
Retrieve a list of audits with detail.
def detail(self, goal=None, marker=None, limit=None, sort_key='id', sort_dir='asc'): context = pecan.request.context policy.enforce(context, 'audit:detail', action='audit:detail') # NOTE(lucasagomes): /detail should only work agaist collections paren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def audits(self, page=None, per_page=None):\r\n url = '{0}/{1}'.format(self.get_url(), 'audits')\r\n params = base.get_params(('page', 'per_page'), locals())\r\n\r\n return http.Request('GET', url, params), parsers.parse_json", "async def getAudits(self, userid) -> GetAuditsResponse:\n ...
[ "0.69771624", "0.6871864", "0.60481256", "0.5685963", "0.5606537", "0.5578751", "0.53918356", "0.5386999", "0.53338796", "0.53298634", "0.52325433", "0.5227748", "0.52210885", "0.5202364", "0.52006584", "0.5193474", "0.51637083", "0.51625", "0.51477003", "0.51229453", "0.5108...
0.6283404
2
Retrieve information about the given audit.
def get_one(self, audit): if self.from_audits: raise exception.OperationNotPermitted context = pecan.request.context rpc_audit = api_utils.get_resource('Audit', audit) policy.enforce(context, 'audit:get', rpc_audit, action='audit:get') return Audit.convert_with_link...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, audit_uuid):\n audit = AuditResource.get_by_id(audit_uuid=audit_uuid, withContacts=True, withScans=True)\n return audit", "async def getAudit(self, auditid) -> GetAuditResponse:\n\n print(\"get audit 1\" + auditid)\n res = await self.stub.GetAudit(\n GetAuditR...
[ "0.7213119", "0.7043593", "0.66991794", "0.63289493", "0.6216085", "0.62059367", "0.6160432", "0.58675766", "0.5810578", "0.56947064", "0.5672697", "0.5560825", "0.55349076", "0.5424039", "0.541629", "0.53783417", "0.5374017", "0.53407764", "0.533264", "0.53322256", "0.526490...
0.7407178
0
Create a new audit.
def post(self, audit_p): context = pecan.request.context policy.enforce(context, 'audit:create', action='audit:create') audit = audit_p.as_audit(context) if self.from_audits: raise exception.OperationNotPermitted if not audit._goal_uuid: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_test_audit(context, **kw):\n audit = get_test_audit(context, **kw)\n audit.create()\n return audit", "async def addAudit(self, name, description, status, type, data, userid) -> CreateAuditResponse:\n return await self.stub.CreateAudit(\n CreateAuditRequest(name=name,\n ...
[ "0.7987387", "0.7321819", "0.6951538", "0.69068974", "0.67013234", "0.66529375", "0.6481425", "0.6336199", "0.62626696", "0.5870206", "0.5868347", "0.58341616", "0.5810241", "0.5751161", "0.57454205", "0.57079893", "0.56360126", "0.56107324", "0.5599522", "0.5566824", "0.5530...
0.67184925
4
Update an existing audit.
def patch(self, audit, patch): if self.from_audits: raise exception.OperationNotPermitted context = pecan.request.context audit_to_update = api_utils.get_resource( 'Audit', audit, eager=True) policy.enforce(context, 'audit:update', audit_to_update, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def updateAudit(self, auditid, name, description, status, type, data, userid) -> UpdateAuditResponse:\n return await self.stub.UpdateAudit(\n UpdateAuditRequest(_id=auditid, name=name,\n description=description, status=status, type=type, created_by=userid\n ...
[ "0.7857467", "0.6971718", "0.6661846", "0.5961999", "0.59222054", "0.58329576", "0.56239164", "0.55837953", "0.55521935", "0.5485416", "0.54786855", "0.5477399", "0.5475961", "0.5438302", "0.5419978", "0.5406263", "0.54028344", "0.5396701", "0.5393715", "0.5342789", "0.534213...
0.6875566
2
Format a Response object for an error_code.
def make_error_response(error_code: HTTP_STATUS_CODE, extra_details: Optional[ERROR_EXTRA_DETAILS] = None) -> Response: error_message = ERROR_MESSAGES[error_code] error_message['code'] = error_code.name error_message['status'] = error_code.value if extra_details is not None: error_message['extra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_from_error(error_code, error_message=None):\n\terror = Error(error_code, error_message).__dict__\n\terror_response_code = error['response_code']\n\treturn Response(json.dumps(error), status=error_response_code, mimetype='application/json')", "def error_response(http_response_code: Union[HTTPStatus, ...
[ "0.7530003", "0.74910027", "0.7406961", "0.73116034", "0.7230357", "0.7164394", "0.7131289", "0.712245", "0.7103296", "0.7102053", "0.7092803", "0.7023021", "0.692041", "0.6913709", "0.6907967", "0.68782103", "0.6853521", "0.6830134", "0.6802265", "0.67787784", "0.67218006", ...
0.70570326
11
Check request is authenticated. If API_AUTH_SECRET_HEADER_NAME is not in request headers then return 401. If API_AUTH_SECRET_HEADER_NAME is in request headers but incorrect then return 403. Else return none.
def is_authenticated_request(req: Request) -> Optional[Response]: if API_AUTH_SECRET_HEADER_NAME not in req.headers: return make_error_response(HTTP_STATUS_CODE.UNAUTHORIZED) if req.headers[API_AUTH_SECRET_HEADER_NAME] != API_AUTH_SECRET: return make_error_response(HTTP_STATUS_CODE.FORBIDDEN) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authorization_header_not_present(self, get_key_secret):\r\n request = Request(self.environ)\r\n request.body = self.get_request_body()\r\n response = self.xmodule.grade_handler(request, '')\r\n real_response = self.get_response_values(response)\r\n expected_response = {\...
[ "0.69187254", "0.68816525", "0.66055983", "0.654799", "0.6515225", "0.64065534", "0.63303685", "0.63240373", "0.63201493", "0.6309157", "0.6307791", "0.62788045", "0.6236683", "0.6223184", "0.6208542", "0.6197912", "0.6197359", "0.6196875", "0.61898404", "0.6124128", "0.61186...
0.81665546
0
Add the the number of minutes represented by min to the currentDate input and returns that new date timestamp
def addMinutes(self, currentDate:str, dateFormat:str, mins:int) -> str: inputDateTime = datetime.strptime(currentDate, dateFormat) nextTime = inputDateTime + timedelta(minutes=mins) return nextTime.strftime(dateFormat)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_datetime_before_given_minutes(minutes):\n from datetime import datetime\n import datetime as dt\n date_obj_before_3min = datetime.now()- dt.timedelta(minutes=minutes)\n return date_obj_before_3min", "def get_today_start():\n return datetime.combine(datetime.today(), time.min)", "def next...
[ "0.58505815", "0.5687333", "0.56670386", "0.56670386", "0.5537341", "0.5529319", "0.54898757", "0.54418087", "0.5429182", "0.5377847", "0.53345233", "0.53310037", "0.5325793", "0.5316861", "0.53041273", "0.52726483", "0.5251411", "0.5228076", "0.5211206", "0.5204495", "0.5169...
0.6531147
0
Performs comparisons between two dates.
def compareDates(self, date1:str, date1Format:str, date2:str, date2Format:str) -> int: try: date1DateTime = datetime.strptime(date1, date1Format) date2DateTime = datetime.strptime(date2, date2Format) #Is the station built? if date1DateTime...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_dates(dt1, dt2):\n return dt1.year == dt2.year and dt1.month == dt2.month and dt1.day == dt2.day", "def compareDates(date1, date2):\n if (date1 == date2):\n return 0\n elif (date1 > date2):\n return 1\n else:\n return -1", "def compareDates(date1, date2):\n i...
[ "0.7317144", "0.7154204", "0.7154204", "0.6905572", "0.67966783", "0.67367643", "0.67232627", "0.66853386", "0.64393324", "0.6373338", "0.6361559", "0.635992", "0.63262355", "0.62969035", "0.62136775", "0.6212751", "0.6211607", "0.620783", "0.61857396", "0.61663604", "0.61202...
0.6618818
8
Get a person, or a list of people.
def fetch(self, person=None): if not person: # get the list. self.endpoint = 'people.json' else: self.endpoint = 'people/{0}.json'.format(person) request = self.get(self.construct_url()) if request.status_code == 200: return json.loads(re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self,id):\r\n person = get_one_by_persons_id(id=id)\r\n if not person:\r\n api.abort(404)\r\n else:\r\n return person", "def get(self,id):\r\n person = get_one(id=id)\r\n if not person:\r\n api.abort(404)\r\n else:\r\n ...
[ "0.7088802", "0.68807226", "0.6546128", "0.64830804", "0.64762676", "0.64040786", "0.6379464", "0.63460207", "0.6253262", "0.6118746", "0.6103367", "0.5969387", "0.59533554", "0.59300435", "0.59290266", "0.5909684", "0.58746195", "0.58618706", "0.5822146", "0.579045", "0.5773...
0.6276311
8
Send the given message to the given recipient. Serialization breaks the command message into two parts. The first part is a header specifying only the version number of the protocol used to confirm compatability, as well as the size of the rest of the message. The body of the request follows of size specified in the he...
def send_to_server(client_socket, command): header, request = serialize_request(command) if header and request: try: client_socket.send(header) client_socket.send(request) except socket.error: print 'Server disconnected'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message(self, message, serializer):\n bin_data = StringIO()\n message_header = MessageHeader(self.coin)\n message_header_serial = MessageHeaderSerializer()\n\n bin_message = serializer.serialize(message)\n payload_checksum = \\\n MessageHeaderSerializer.calc_c...
[ "0.6849743", "0.64180076", "0.6201422", "0.6136934", "0.6136291", "0.6106256", "0.6055221", "0.6030019", "0.5930607", "0.59039015", "0.5883832", "0.58533734", "0.5786345", "0.57829654", "0.5740297", "0.5740297", "0.57401174", "0.57356936", "0.5687052", "0.56870025", "0.566408...
0.5532814
39
Prints out ">>" to make the prompt look nice.
def prompt(): sys.stdout.write('>> ') sys.stdout.flush()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showPrompt(self):\r\n self.terminal.nextLine()\r\n self.terminal.write(self.ps[self.pn])", "def do_prompt(self, line):\n self.prompt = line + ': '", "def prompt(self, question):\n self.output(' ')\n self.output(question)\n self.output(self.parse_response(str(self.u...
[ "0.7335863", "0.6978222", "0.6823395", "0.67102325", "0.6643498", "0.6569211", "0.649697", "0.64917946", "0.6482021", "0.6433004", "0.63896614", "0.63162845", "0.62998056", "0.6265454", "0.6237534", "0.6233695", "0.6232359", "0.618937", "0.6169687", "0.61388206", "0.6136785",...
0.7840775
0
Permet de lire les valeurs des constantes de couplage g_1, g_2 ET g_3 a partir du fichier g_file.
def set_interaction(self): dirInd = "/Users/asedeki/Drive/environement/Quasi1D/quasi1d/data/inddata" # My laptop N = self.N array = np.load(f"{dirInd}/array_index_n{N}.npy") Temps = np.loadtxt(self.g_file, usecols=[ 1], unpack=True, dtype=np.double) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_g(file_name):\n \n r,g = np.loadtxt(file_name, dtype = 'float', unpack = 'true')\n \n return r,g", "def read_gauss_coeff(file=None):\r\n\r\n if file is None:\r\n file = \"IGRF13.COF\"\r\n\r\n if file == \"IGRF13.COF\":\r\n (\r\n dic_dic_h,\r\n dic_dic...
[ "0.58956796", "0.57218397", "0.5694254", "0.5611321", "0.5530163", "0.5499675", "0.5396838", "0.5381348", "0.5357845", "0.530564", "0.5295147", "0.52859634", "0.528532", "0.5280277", "0.52575284", "0.52474356", "0.52196497", "0.5175378", "0.51711017", "0.5149379", "0.51163054...
0.0
-1
Takes video file path and a transcode profile, transcode the file, and returns the transcoded file in bytes, along with ffmpeg's stderr output.
def transcode_segment(self, in_path: str, profile: TranscodeProfile ) -> Tuple[bytes, str, str]: out_filepath = f"/tmp/{uuid4()}.ts" transcode_command = [ "ffmpeg", "-i", in_path, "-vf", f"s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transcode(path, outpath):\n\n needs_transcode = determine_transcode(path)\n logger.info(f\"Transcoding {path} to {outpath}...\")\n\n cmd = [\n \"ffmpeg\", \"-y\",\n \"-i\", path,\n \"-an\",\n \"-metadata:s\", \"handler_name=tator\",\n \"-vcodec\", \"libx264\",\n ...
[ "0.6997698", "0.6566929", "0.64950305", "0.6379619", "0.6161119", "0.61035687", "0.5958369", "0.58059055", "0.576237", "0.57498455", "0.57029223", "0.5672103", "0.5670517", "0.5635099", "0.5540602", "0.5490141", "0.541302", "0.5378603", "0.53590256", "0.5312127", "0.52753246"...
0.75541896
0
Takes a video file path and generates a png image of the first frame along with the stderr output.
def generate_still_from_video(self, in_path: str ) -> Tuple[bytes, float, str]: out_filepath = f"/tmp/{uuid4()}.jpg" command = [ "ffmpeg", "-i", in_path, "-vframes", "1", out_filepath ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_one_shot(path_to_images, name_image, video_source=\"/dev/video0\"):\n subprocess_cmd(\"ffmpeg -f video4linux2 -s 1280x720 -i {} -frames 1 ./{}/{} -loglevel error -nostats\".format(video_source, path_to_images, name_image))", "def make_video(data,\n xdim, ydim, sample_read_rows, sample_read_cols, i...
[ "0.72368175", "0.6741803", "0.6729747", "0.66759086", "0.6672142", "0.6609485", "0.65107006", "0.64243746", "0.63670754", "0.6340442", "0.6312494", "0.62720597", "0.6271513", "0.626696", "0.6263821", "0.6262629", "0.6260199", "0.6227164", "0.62193406", "0.620616", "0.61849064...
0.63672096
8
Get start from an stderr dump.
def parse_start_timecode_from_stderr(self, stderr: str) -> float: pattern = "start: ([0-9]+\.[0-9]+)" pattern = re.compile(pattern) result = pattern.search(stderr) if result is None: return None # Parse result timecode = float(result.group(1)) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stderr(self: \"ShellOutput\") -> Artefact[bytes]:\n self.__check_len()\n return self.stderrs[0]", "def find_traceback_start(self):\n ### FILL IN ###", "def _readline(stderr: IO) -> str:\n return stderr.readline().decode('utf-8').rstrip()", "def get_stderr(self):\n return self._...
[ "0.6187324", "0.615454", "0.6144744", "0.6122382", "0.6052839", "0.5921778", "0.5872651", "0.57856077", "0.5730318", "0.57201964", "0.5620374", "0.5603881", "0.5599026", "0.559445", "0.5582995", "0.55650765", "0.5544137", "0.552032", "0.545329", "0.54468346", "0.5399817", "...
0.61422455
3
Get duration from an ffmpeg stderr dump.
def parse_duration_from_stderr(self, stderr: str) -> float: pattern = "Duration: (\\d\\d):(\\d\\d):(\\d\\d\\.\\d\\d)" pattern = re.compile(pattern) result = pattern.search(stderr) if result is None: return None # Parse result hours = float(result.grou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_duration(filename):\n cmd = ('ffprobe -v 0 -of flat=s=_ -select_streams v:0 -show_entries '\n 'stream=duration -of default=nokey=1:noprint_wrappers=1 ' +\n filename).split()\n pid = subprocess.run(cmd, universal_newlines=True,\n stdout=subprocess.PIPE)\n ...
[ "0.7139366", "0.6637791", "0.6516288", "0.6415554", "0.6111052", "0.5992013", "0.59010184", "0.5797666", "0.5752247", "0.57105243", "0.5628981", "0.55969137", "0.555516", "0.5550522", "0.551304", "0.54656565", "0.5385895", "0.5377022", "0.5360331", "0.53306353", "0.5317654", ...
0.77763784
0
return new ones only
def save_parsed_results(results,save='current_bikes.pkl'): if os.path.exists(save): with open(save, 'rb') as f: past_results = pickle.load(f) past_results_ids = [bike['id'] for bike in past_results] # get new ones new_ones = [] for bike in results:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all(self):", "def all(self):", "def NewItems(self) -> _n_1_t_7:", "def all(self):\n return self[:]", "def OldItems(self) -> _n_1_t_7:", "def getChanges():", "def _remove_initial_objects_from_list(self, all):\n\n new_list = []\n for obj in all:\n if obj not in self.in...
[ "0.5644095", "0.5644095", "0.55209374", "0.54977685", "0.54559356", "0.5339211", "0.530434", "0.5261145", "0.52509654", "0.5248147", "0.52323604", "0.52179813", "0.5206026", "0.520254", "0.51867276", "0.51860404", "0.51658946", "0.51597655", "0.51427966", "0.50969976", "0.508...
0.0
-1
Represents a new or an existing entry.
def __init__(self, module): # Keep a reference to the parent module. self._module = module # Keep a mapping 'field_name' => value for every valid field retrieved. self._fields = {} self._dirty_fields = [] # Make sure that the 'id' field is always define...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entry(self):\n # Filter out any fields that are invalid for the type of a new entry.\n properties = {\n field: value\n for field, value in self.properties.items()\n if field in self.type_cls.entry_fields\n }\n\n return self.type_cls.from_proxy(se...
[ "0.67095965", "0.6477196", "0.6332539", "0.62504274", "0.61646706", "0.61252797", "0.600303", "0.59274566", "0.5883338", "0.5849355", "0.58424836", "0.583158", "0.5752123", "0.57427174", "0.5730141", "0.5707103", "0.5706845", "0.57047164", "0.56399536", "0.56265277", "0.56032...
0.0
-1
Return the value of the field 'field_name' of this SugarEntry.
def __getitem__(self, field_name): if field_name in self._module._fields.keys(): try: return self._fields[field_name] except KeyError: if self['id'] == '': # If this is a new entry, the 'id' field is yet undefined. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_field_value(self, field_name):\n if field_name in self.fields.keys():\n return self.fields[field_name]\n else:\n return \"No such field\"", "def get_field_value(self, name, raw=False):\n field = self.get_field(name)\n if field is None:\n return...
[ "0.78668076", "0.75023025", "0.7114381", "0.7114381", "0.7114381", "0.7114381", "0.7064504", "0.7064504", "0.70414263", "0.7009208", "0.69945055", "0.6993646", "0.69624376", "0.6957426", "0.6872905", "0.68179625", "0.6812655", "0.67997205", "0.67977375", "0.67850506", "0.6739...
0.7292334
2
Set the value of a field of this SugarEntry.
def __setitem__(self, field_name, value): if field_name in self._module._fields.keys(): self._fields[field_name] = value if field_name not in self._dirty_fields: self._dirty_fields.append(field_name) else: raise AttributeError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_value(self, field, value):\n field = self.find_first(field)\n if field is not None:\n field.value = value", "def _setValue(self, field, value):\n self._contents[field] = value", "def setfield(self, field, value):\n self.__setitem__(field, value)", "def set_entry...
[ "0.80276215", "0.7663564", "0.7361043", "0.698671", "0.67777884", "0.6728715", "0.6728715", "0.6699535", "0.6690918", "0.66474557", "0.65780324", "0.65772873", "0.65541035", "0.65541035", "0.65541035", "0.6483881", "0.64639485", "0.64538443", "0.6433936", "0.64043486", "0.637...
0.5998666
55
Save this entry in the SugarCRM server. If the 'id' field is blank, it creates a new entry and sets the 'id' value.
def save(self): # If 'id' wasn't blank, it's added to the list of dirty fields; this # way the entry will be updated in the SugarCRM connection. if self['id'] != '': self._dirty_fields.append('id') # nvl is the name_value_list, which has the list of attributes. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n if self.id is None:\n self._insert()\n else:\n self._update()", "def save(self):\n if self.id:\n self.update()\n else:\n self.create()", "def save(self)->None:\n item = database.cursor.fetchone()\n if item:\...
[ "0.7648956", "0.7361002", "0.6938848", "0.6878406", "0.66949844", "0.6614205", "0.6569775", "0.6563675", "0.6438659", "0.6280113", "0.62362057", "0.62102276", "0.61960924", "0.6164901", "0.6155119", "0.6127607", "0.61145216", "0.61145216", "0.61145216", "0.61145216", "0.61145...
0.7521411
1
Relate this SugarEntry with the one passed as a parameter.
def relate(self, related): self._module._connection.relate(self, related)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, entry):\n return self", "def add_item_entry(self, the_spec):\n debug(\"Adding entry {}\".format(the_spec))\n entry = tk.Entry(self.current_parent)\n self.entries[the_spec.value] = entry\n if not self.parent_is_grid:\n entry.pack()\n return e...
[ "0.5524577", "0.55080557", "0.53549623", "0.53450733", "0.53450733", "0.53450733", "0.53140515", "0.52883685", "0.5236298", "0.5210294", "0.51796716", "0.5022049", "0.4999028", "0.4980691", "0.49763468", "0.49634597", "0.49548715", "0.49441412", "0.49441412", "0.49118453", "0...
0.0
-1
Return the related entries in another module.
def get_related(self, module): connection = self._module._connection result = connection.get_relationships(self._module._name, self['id'], module._name.lower(), '', ['id']) entries = [] for elem in result['entry_list']: entry = Su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relationships(self):", "def get_related_objects(self):\n result = []\n if self['name'] != None:\n tmp = ObjectDefinition.objects.filter(use__has_field=self['name'], object_type=self['object_type'])\n for i in tmp: result.append(i)\n return result", "def associated...
[ "0.5929166", "0.5709051", "0.54539883", "0.54411966", "0.54079044", "0.54058117", "0.5341041", "0.53391445", "0.5284375", "0.5259152", "0.5229081", "0.52277374", "0.5226618", "0.52161896", "0.5207432", "0.5207311", "0.5198739", "0.5186677", "0.5138827", "0.5136619", "0.512700...
0.7334194
0
Wrap for pooling and launching processes Here try to monitor time taken since real tasks may take quite a long time to complete. Then they the longest test should be lauch first so as to avoid having to wait for them to complete a good thing would be to pickle results (in the future) for now i'll juste try to have them...
def do_thing(scr_obj = None): res = {} t1 = time() if not scr_obj: return "No task provided" ags = scr_obj.system_instr() son = subprocess.Popen(ags) print "spid %r pid %r "%(son.pid,os.getpid()) if os.waitpid(son.pid,0): res['duration'] = time()-t1 return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure_mp_speedup():\n modes = [\n # name, function\n ('dSMC', ana.d_smc),\n ('dAMC', ana.d_amc),\n ('EDF-VD', ana.d_edf_vd),\n ('pSMC', ana.p_smc),\n ('pAMC-BB', ana.p_amc_bb),\n ('pAMC-BB+', ft.partial(ana.p_amc_bb, ignore_hi_mode=True))\n ]\n times_...
[ "0.65764606", "0.6285376", "0.62616736", "0.62181664", "0.61683935", "0.6149992", "0.6098208", "0.60810643", "0.6076687", "0.599215", "0.59797597", "0.5963703", "0.59309655", "0.59253407", "0.5921455", "0.59198266", "0.5880402", "0.58707196", "0.58152556", "0.5761431", "0.575...
0.5890367
16
Make the table 'symmetric'. The lower left part of the matrix is the reverse probability.
def prepare_table(table): n = len(table) for i, row in enumerate(table): assert len(row) == n, f"len(row) = {len(row)} != {n} = n" for j, _ in enumerate(row): if i == j: table[i][i] = 0.0 elif i > j: table[i][j] = 1 - table[j][i] return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def symmetrize(self):\n if self.is_symmetric:\n return self\n else:\n return self.append(self.reverse()).squash().scale(0.5)", "def make_symmetric(prior):\n print \"making symmetric\"\n\n new_map = {}\n for key1 in prior.keys():\n for key2 in prior[key1].keys()...
[ "0.62731516", "0.61840785", "0.6064608", "0.58849204", "0.587738", "0.5790452", "0.5790171", "0.5788909", "0.5750154", "0.5694349", "0.56869864", "0.55907136", "0.5530144", "0.5499711", "0.5498957", "0.5494343", "0.5491656", "0.5470528", "0.54271704", "0.54172325", "0.5415249...
0.56995
9
Partition list ``l`` in ``K`` partitions. Examples >>> l = [0, 1, 2] >>> list(clusters(l, K=3)) [[[0], [1], [2]], [[], [0, 1], [2]], [[], [1], [0, 2]], [[0], [], [1, 2]], [[], [0], [1, 2]], [[], [], [0, 1, 2]]] >>> list(clusters(l, K=2)) [[[0, 1], [2]], [[1], [0, 2]], [[0], [1, 2]], [[], [0, 1, 2]]] >>> list(clusters(l...
def clusters(l, K): # noqa if l: prev = None for t in clusters(l[1:], K): tup = sorted(t) if tup != prev: prev = tup for i in range(K): yield tup[:i] + [ [l[0]] + tup[i], ] + tup[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_list(l, k):\n\n\tn = len(l)\n\tsublists = []\n\tnsubs = n / k\n\tnrems = n % k\n\n\t# little algo to split lists.\n\n\ti = int(0)\n\twhile i < n:\n\t\tsublists.append(l[i:i+k])\n\t\ti += k\n\n\treturn sublists", "def kmeans_clustering(cluster_list, num_clusters, num_iterations):\n # position initial...
[ "0.6442916", "0.6442183", "0.6315446", "0.6304946", "0.6237085", "0.617769", "0.6146027", "0.6125856", "0.60932726", "0.60206467", "0.5957113", "0.5909527", "0.59080315", "0.585992", "0.58364034", "0.58048147", "0.58022964", "0.57939726", "0.5760786", "0.5759672", "0.57513547...
0.7760409
0
Partition list ``l`` in ``K`` partitions, without empty parts. >>> l = [0, 1, 2] >>> list(neclusters(l, 2)) [[[0, 1], [2]], [[1], [0, 2]], [[0], [1, 2]]] >>> list(neclusters(l, 1)) [[[0, 1, 2]]]
def neclusters(l, K): # noqa for c in clusters(l, K): if all(x for x in c): yield c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clusters(l, K): # noqa\n if l:\n prev = None\n for t in clusters(l[1:], K):\n tup = sorted(t)\n if tup != prev:\n prev = tup\n for i in range(K):\n yield tup[:i] + [\n [l[0]] + tup[i],\n ...
[ "0.7217303", "0.63322186", "0.625333", "0.6235396", "0.6019988", "0.5918844", "0.5856138", "0.57952917", "0.57450014", "0.5674573", "0.5655689", "0.5525202", "0.5506933", "0.5506646", "0.5503834", "0.5496627", "0.5489272", "0.5465552", "0.5463998", "0.54601", "0.54010504", ...
0.74512917
0
Get all segmentations of a list ``l``.
def all_segmentations(l): for K in range(1, len(l) + 1): gen = neclusters(l, K) yield from gen
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getIntersectorList(self, l):\n return [self.getIntersector(v) for v in l]", "def getSegments(self):\n l = len(self.points)\n return [Segment(self.points[i % l], self.points[(i + 1) % l], \\\n color=self.side_color, width=self.side_width) for i in range(l)]", "def...
[ "0.7343008", "0.5786379", "0.5737136", "0.57333577", "0.56923693", "0.56832623", "0.5526333", "0.55071455", "0.54750925", "0.54672647", "0.5410251", "0.53292185", "0.5260688", "0.52098393", "0.5078696", "0.5060627", "0.50543034", "0.50465745", "0.50461197", "0.50444895", "0.5...
0.7035634
1
>>> find_index([[0, 1, 2], [3, 4], [5, 6, 7]], 0) 0 >>> find_index([[0, 1, 2], [3, 4], [5, 6, 7]], 1) 0 >>> find_index([[0, 1, 2], [3, 4], [5, 6, 7]], 5) 2 >>> find_index([[0, 1, 2], [3, 4], [5, 6, 7]], 6) 2
def find_index(segmentation, stroke_id): for i, symbol in enumerate(segmentation): for sid in symbol: if sid == stroke_id: return i return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_index(list_, element):\n pos = []\n for i in range(len(list_)):\n if list_[i] == element:\n pos.append(i)\n return pos", "def find_index(row):\n value = row[index]\n if value in seen:\n return seen[value]\n for row_ in merged.iter_...
[ "0.67435414", "0.6689435", "0.667055", "0.6616099", "0.65715", "0.65432054", "0.6515102", "0.65023714", "0.6496401", "0.6446747", "0.64422274", "0.6422349", "0.6420835", "0.64158803", "0.6405739", "0.6361784", "0.6354577", "0.6326094", "0.6324002", "0.63065636", "0.62885135",...
0.0
-1
Test if ``s1`` and ``s2`` are in the same symbol, given the ``segmentation``.
def q(segmentation, s1, s2): index1 = find_index(segmentation, s1) index2 = find_index(segmentation, s2) return index1 == index2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other: Segment) -> bool:\n return any(\n (\n self.start == other.start and self.end == other.end,\n self.start == other.end and self.end == other.start,\n )\n )", "def segment_segment(s1, s2):\n l1=s1.line()\n l2=s2.line()\n...
[ "0.641324", "0.6303756", "0.62990654", "0.6223713", "0.60034645", "0.59813756", "0.59780806", "0.5975479", "0.58711016", "0.5836675", "0.5813403", "0.5789767", "0.5778101", "0.57675564", "0.5753647", "0.5730708", "0.56924576", "0.5673696", "0.5646707", "0.5588982", "0.5555126...
0.7217469
0
Push an ``element`` into the datastrucutre together with its value and only save it if it currently is one of the top n elements. Drop elements if necessary.
def push(self, element, value): insert_pos = 0 for index, el in enumerate(self.tops): if not self.find_min and el[1] >= value: insert_pos = index + 1 elif self.find_min and el[1] <= value: insert_pos = index + 1 self.tops.insert(insert_pos,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, element):\n self._data.append(element)", "def push(self, element):\n self._data.append(element)", "def push(self,element):\n self.stack.append(element)\n \n if self.maxx == []:\n self.maxx.append(element)\n else:\n #LessThan or equa...
[ "0.6947502", "0.6947502", "0.68805766", "0.6826163", "0.66402876", "0.65689075", "0.6567906", "0.65321624", "0.64744484", "0.6363533", "0.6332254", "0.62661207", "0.6240742", "0.6183616", "0.61692774", "0.6107169", "0.6103542", "0.6082257", "0.6069212", "0.60639167", "0.60554...
0.6930433
2
Get the score of a segmentation.
def score_segmentation(segmentation, table): stroke_nr = sum(1 for symbol in segmentation for stroke in symbol) score = 1 for i in range(stroke_nr): for j in range(i + 1, stroke_nr): qval = q(segmentation, i, j) if qval: score *= table[i][j] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(self, segmentation, resolution):\n raise NotImplementedError", "def get_score(self):\n return self.score", "def get_score(self):\n return self.score", "def get_score(self):\n return self.score", "def score(self):\n return self.client.call('GET', self.name + 'sco...
[ "0.7821457", "0.68884724", "0.68884724", "0.68884724", "0.6864855", "0.68069875", "0.68069875", "0.68069875", "0.67806643", "0.67513376", "0.6750792", "0.6743802", "0.6731569", "0.67256904", "0.67151165", "0.6540891", "0.65062493", "0.6485259", "0.6454835", "0.64071995", "0.6...
0.6577604
15
This builds your guide. Use Keyword to update any options at build time.
def build_guide(self, **kwargs): # This builds your guide master and updates your options self.create_guide_master(**kwargs) prefix = self.prefix # Naming prefix. Use this for every new node you create and there should be no name clashes. options = self.options ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_guide(self, **kwargs):\n\n # This builds your guide master and updates your options\n self.create_guide_master(**kwargs)\n\n prefix = self.prefix\n options = self.options\n mirror_value = self.mirror_value\n\n num_joints = options.get('numberJoints')\n...
[ "0.6530746", "0.6263703", "0.61089903", "0.60497785", "0.5882108", "0.5788378", "0.5788378", "0.5754908", "0.56987226", "0.56863075", "0.56494266", "0.5625547", "0.561691", "0.5596764", "0.5596764", "0.55608445", "0.5489056", "0.5478003", "0.5478003", "0.5478003", "0.546438",...
0.63234144
1
This builds your anim rig.
def build_rig(self): # create rig part top nodes self.create_part_master() prefix = self.prefix # Naming prefix. Use this for every new node you create and there should be no name clashes. options = self.options # Build options ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_anim(self):\n pass", "def build_rig(self):\n\n # create rig part top nodes\n self.create_part_master()\n\n # Get all the relevant part info\n prefix = self.prefix\n options = self.options\n anim_ctrls = self.anim_ctrls\n ...
[ "0.68172234", "0.6249442", "0.6228986", "0.6166067", "0.6068071", "0.6007271", "0.59737676", "0.5947862", "0.5921581", "0.59017247", "0.5882105", "0.5882105", "0.5882105", "0.5882105", "0.5882105", "0.5882105", "0.5882105", "0.5882105", "0.5882105", "0.5882105", "0.5882105", ...
0.5954252
7
For use with midrotation treatments (affects product attribute generation)
def set_future(self, future): self._future = future
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product(self):\n return None", "def product(self):\n return None", "def product(self):\n raise NotImplementedError", "def arm(self):\n pass", "def metallicity(method, emsystem):\n if method == 'PG16':\n # Requires Hbeta, [OII], [OIII], [NII], [SII]\n R2 = (e...
[ "0.5675478", "0.5675478", "0.55882686", "0.50788105", "0.50288135", "0.49819022", "0.49562803", "0.49551016", "0.49269596", "0.49080822", "0.49069706", "0.48976865", "0.4886793", "0.48700985", "0.4859686", "0.48417854", "0.48343614", "0.48108852", "0.47970998", "0.47970998", ...
0.0
-1
Add fu code to list.
def add_fu(self, state): self._fu_set.add(state)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_code(self, code):\n self.code += code", "def add_code(self, id, code):\n self.codes[id] = code", "def set_function_list(self, L):\n\t\tself.function_list = L", "def add_hook(f, h):\n if f in hooks:\n hooks[f] += [h]\n else:\n hooks[f] = [h]", "def add_code(self, co...
[ "0.63861465", "0.5658855", "0.56266004", "0.55539155", "0.5490869", "0.5488156", "0.5473881", "0.54088527", "0.53393835", "0.5329551", "0.5329551", "0.53095835", "0.52636266", "0.5237091", "0.5221719", "0.5194192", "0.51796734", "0.5135299", "0.5118256", "0.5104795", "0.50775...
0.5944328
1
Asks user to specify a city, month, and day to analyze.
def get_filters(): print('Welcome! Let\'s explore some US bikeshare data!') # TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs while True: try: city = input("Enter the name of the city you want to explore the data of (c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)", "def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f...
[ "0.66714007", "0.65354675", "0.64593667", "0.6374057", "0.6348314", "0.63097656", "0.62868035", "0.6259136", "0.62316", "0.62130964", "0.62050414", "0.6181105", "0.6171822", "0.61686903", "0.6158568", "0.61582303", "0.61532456", "0.61444426", "0.6131269", "0.610484", "0.61025...
0.58922184
44
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): df = pd.read_csv(CITY_DATA[city]) df['Start Time'] = pd.to_datetime(df['Start Time']) df['hour'] = df['Start Time'].dt.hour df['month'] = df['Start Time'].dt.month df['day_of_week'] = df['Start Time'].dt.weekday_name #filter by month if needed and create a new fr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.81320685", "0.8108889", "0.8045821", "0.8042514", "0.80090284", "0.80071104", "0.79991937", "0.7998333", "0.7988789", "0.797905", "0.79737365", "0.79610896", "0.7956163", "0.7947432", "0.79463065", "0.7908287", "0.7908229", "0.7904569", "0.7900715", "0.78930074", "0.788921...
0.7787979
37
Displays statistics on the most frequent times of travel.
def time_stats(df, month, day): print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() # TO DO: display the most common month if month == 'all': most_common_month = df['month'].mode()[0] print ("The most frequent month of travel is: ", calendar.month_nam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80247396", "0.80233026", "0.7915788", "0.78266186", "0.7822246", "0.78143597", "0.77659196", "0.7740343", "0.773628", "0.77344066", "0.76867086", "0.7668633", "0.7651731", "0.7644636", "0.76399267", "0.76367253", "0.7625196", "0.7623158", "0.7612803", "0.76002145", "0.7583...
0.74564284
39
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # TO DO: display most commonly used start station most_common_start_station = df['Start Station'].mode()[0] print ("The most frequent start station is:\n ->", most_common_start_station) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.7815675", "0.7662213", "0.7553417", "0.74914914", "0.74748665", "0.7446617", "0.7428588", "0.74237514", "0.74177027", "0.7400495", "0.7387161", "0.7385634", "0.73647535", "0.735934", "0.73566747", "0.73548365", "0.7351854", "0.7351274", "0.735057", "0.73421645", "0.7340198...
0.7134921
58
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # TO DO: display total travel time total_travel_time = round(np.sum(df['Trip Duration'])/60/60,2) print ('Total travel time over the selected period (in hours) is: ', total_travel_time) # TO DO: di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.814274", "0.8025143", "0.80041367", "0.79496753", "0.7937415", "0.79312176", "0.7926815", "0.7915187", "0.79142886", "0.7908032", "0.79055744", "0.7900715", "0.7891682", "0.78894734", "0.7886722", "0.78851086", "0.7884266", "0.7882474", "0.78738385", "0.78686154", "0.78664...
0.784452
32
Displays statistics on bikeshare users.
def user_stats(df, city): print('\nCalculating User Stats...\n') start_time = time.time() # TO DO: Display counts of user types df['User Type'] = df['User Type'].fillna('Type Unknown') user_types = df['User Type'].unique() for user_type in user_types: count_user_type = (df['User Type']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_stats(request):\r\n user_count = UserMgr.count()\r\n pending_activations = ActivationMgr.count()\r\n users_with_bookmarks = BmarkMgr.count(distinct_users=True)\r\n return _api_response(request, {\r\n 'count': user_count,\r\n 'activations': pending_activations,\r\n 'with_bo...
[ "0.73559105", "0.73306274", "0.7287611", "0.72494894", "0.72382116", "0.71733415", "0.7168679", "0.7129041", "0.7076894", "0.7071431", "0.70602304", "0.7056935", "0.70490867", "0.7045232", "0.703642", "0.70238316", "0.7022488", "0.7022265", "0.7012312", "0.70086145", "0.69945...
0.0
-1
Allow to scroll through the raw data of the csv file selected
def see_raw_data(city): while True: try: see_raw_data_input = input('\nIn addition of the stats above, would you like to scroll through the raw data? (y/n)\n') if see_raw_data_input not in ('y', 'n'): raise Exception ('Invalid answer') if see_raw_data_inp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_loading_file(self):\n column_headers = []\n column_headers_all = []\n\n # Open the file once to get idea of the total rowcount to display progress\n with open(self.csv_file_path[0], newline='') as csv_file:\n self.progress_max.emit(len(csv_file.readlines()) - 2)\n...
[ "0.6083973", "0.6001787", "0.59245104", "0.58940566", "0.5861581", "0.581427", "0.5679473", "0.56790644", "0.5672839", "0.565956", "0.5653351", "0.5615062", "0.560097", "0.5599851", "0.5589927", "0.55863386", "0.5574873", "0.5549084", "0.55258", "0.55049545", "0.54869586", ...
0.62122077
0
Initialization function. Sets the model name and function, path to input data, and the output filename.
def __init__(self, sfs, model, popnames, output): self.sfs = self.load_sfs(sfs) self.modelname = model # Make an extrapolating version of the function self.modelfunc = dadi.Numerics.make_extrap_log_func( self.set_model_func(model)) self.params = self.set_parameters() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\n model_fn=cake_fn,\n model_dir: Optional[str] = \"model\",\n saved_path : Optional[str] = None,\n ):\n self.model_fn = model_fn \n self.model_dir = model_dir\n if saved_path == None:\n self.update_p...
[ "0.71706414", "0.69452214", "0.6822937", "0.66740066", "0.6421178", "0.63648045", "0.6306152", "0.62590146", "0.6255789", "0.62344706", "0.62207854", "0.62166464", "0.6183033", "0.61792994", "0.61410034", "0.61369526", "0.61364913", "0.61285555", "0.61272836", "0.6064312", "0...
0.69727397
1
Parse the dadi SFS file and return it as a Spectrum object. Dadi will do basic checking of the spectrum, but we will be more thorough.
def load_sfs(self, sfs): try: fs = dadi.Spectrum.from_file(sfs) except: print 'The spectrum file you provided is not valid!' exit(1) return fs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_file(self):\n file_time = ''\n num_dir = 0\n num_freq = 0\n freq_w_band = 0.0\n freq_0 = 0.0\n start_dir = 0.0\n\n dspec_matrix = []\n\n # Extract the file time from the file name\n input_file_name = self._stream_handle.name\n\n match ...
[ "0.69581074", "0.647524", "0.63855165", "0.63855165", "0.6374014", "0.63154924", "0.6295988", "0.61925375", "0.6125525", "0.6066723", "0.60588676", "0.6026092", "0.5996392", "0.5974746", "0.5853758", "0.5807754", "0.5777854", "0.57754326", "0.5728101", "0.57191104", "0.571364...
0.7699114
0
Given a model name, set the function that has to be called to run that model. This should be safe because we restrict the user input for the models at the argument parsing stage.
def set_model_func(self, model): if model == 'SI': import cavefish_dadi.Models.si return cavefish_dadi.Models.si.si elif model == 'SC': import cavefish_dadi.Models.sc return cavefish_dadi.Models.sc.sc elif model == 'IM': import cavefish...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model(model: str) -> Any:\n try:\n model_function = eval(model)\n except (NameError, AttributeError) as err:\n sys.exit(f'{err}. Accepted models from {tf}, {sm}, {tfa}, {tfc}')\n return model_function", "def get_function(model_or_function, preprocess_function=None):\n from diann...
[ "0.6543695", "0.6317053", "0.6138432", "0.6007846", "0.5799357", "0.5794181", "0.57566136", "0.56700885", "0.55889934", "0.5577638", "0.5568402", "0.5544729", "0.55088854", "0.55060846", "0.5459015", "0.5454922", "0.54414725", "0.53864926", "0.5364902", "0.5340603", "0.533630...
0.6588683
0
Set the parameters for the function, depending on the model being run. Also set the bounds for the optimization.
def set_parameters(self): params = {} if self.modelname == 'SI': # N1: Pop 1 size after split # N2: Pop 2 size after splot # Ts: Time from split to present, in 2*Na generation units names = ['N1', 'N2', 'Ts'] values = [1, 1, 1] uppe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_bounds(self, **kwargs):\n for name, bounds in kwargs.items():\n if name not in self._parameters:\n raise AttributeError('Unknown parameter %s for %s' % (name, self.__class__.__name__))\n param = self._parameters[name]\n # Set bounds\n lower_...
[ "0.6652114", "0.64041644", "0.6387559", "0.63850904", "0.6212778", "0.61772054", "0.6171171", "0.6166634", "0.6135607", "0.6128549", "0.6125473", "0.6125473", "0.6125473", "0.61149114", "0.60589886", "0.6044676", "0.604221", "0.6038992", "0.60294724", "0.60294724", "0.6024169...
0.6072073
14
Inference function. This borrows heavily from the callmodel() function in 'script_inference_anneal2_newton.py' from SEA lab.
def infer(self, niter, reps): # Start containers to hold the optimized parameters self.p_init = [] self.hot_params = [] self.cold_params = [] self.opt_params = [] self.theta = [] self.mod_like = [] self.opt_like = [] self.aic = [] # Get the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inference(model, data, diagnostics, seed, extra_fitting_args):\n pass", "def inference(self):\n raise NotImplementedError", "def infer(self, example, model):\n asp_input = model + '\\n\\n' + example + '\\n\\n' + inference_program_ec\n ctl = clingo.Control()\n ctl.add(\"base\"...
[ "0.7005118", "0.68879014", "0.6468674", "0.63714975", "0.63685554", "0.63409275", "0.62861687", "0.62818676", "0.6193505", "0.61855865", "0.6120753", "0.6109425", "0.6101459", "0.60623956", "0.6023192", "0.6022813", "0.6013857", "0.60059744", "0.59605026", "0.5955767", "0.595...
0.5622197
47
Summarize the replicate runs and convert the parameters estimates into meaningful numbers.
def summarize(self, locuslen): # First, calculate the mean of the parameter estimates from each # of the replicates hot_means = [] for r_t in zip(*self.hot_params): v = [x for x in r_t if not math.isnan(x)] hot_means.append(sum(v)/len(v)) cold_means = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_mcts(self, runs_per_round):\n for i in range(runs_per_round):\n self.select(self.env, 'r')\n self.env_reset()\n counts = [self.Nsa[('r', a)] for a in range(self.actions)]\n # print(\"counts \", counts)\n # print(\"Q-values\", [self.Qsa[('r', a)] for a in ra...
[ "0.596659", "0.5817768", "0.57848805", "0.5778032", "0.5736855", "0.5722777", "0.5721804", "0.56309265", "0.5599941", "0.5561327", "0.5554734", "0.5542044", "0.55361605", "0.55108637", "0.5486883", "0.5457525", "0.544647", "0.542683", "0.5396689", "0.53914917", "0.5365846", ...
0.58705
1
Write some output summaries for the dadi runs.
def write_out(self, niter, locuslen): try: handle = open(self.output, 'w') except OSError: print 'Error, you do not have permission to write files here.' extit(1) # First, write the pop names handle.write('#Pop 1: ' + self.popnames[0] + '\n') h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _output_summary(self, run_id):\n time = self._summary.get_time_taken()\n time_delta = None\n num_tests_run_delta = None\n num_failures_delta = None\n values = [(\"id\", run_id, None)]\n failures = self._summary.get_num_failures()\n previous_summary = self._get_p...
[ "0.706741", "0.6504042", "0.64469904", "0.6359", "0.6317233", "0.62217075", "0.62181455", "0.62145364", "0.6196254", "0.61518073", "0.61190933", "0.61190766", "0.61024827", "0.60801", "0.6074785", "0.6020409", "0.6015638", "0.6012356", "0.59702814", "0.59702814", "0.5955046",...
0.0
-1
Plot the comparison between the data and the chosen model. This is a copypaste with some modification from the dadi.Plotting.plot_2d_comp_Poisson function.
def plot(self, vmin, vmax, resid_range=None, pop_ids=None, residual='Anscombe'): # Scale the model SFS to the data SFS sc_mod = dadi.Inference.optimally_scaled_sfs(self.model_sfs, self.sfs) # Start a new figure, and clear it f = pylab.gcf() pylab.clf() ax = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_comparison(self, X_val, y_val):\n import matplotlib.pyplot as plt\n x = []\n y = []\n for model_tuple in self.model_list:\n x.append(model_tuple[1])\n y.append(model_tuple[0].score(X_val, y_val))\n plt.scatter(x, y)\n plt.show()", "def p...
[ "0.6889876", "0.6815983", "0.6491328", "0.6326441", "0.630209", "0.6259812", "0.62159556", "0.6189489", "0.60769445", "0.60425025", "0.6001705", "0.59992814", "0.59848875", "0.5948288", "0.592511", "0.589603", "0.5892012", "0.5887439", "0.58789676", "0.5858394", "0.5851891", ...
0.0
-1
Drive the combination process. This entails generating code for use in the casa interpreter and then running it. If the 'generate' commandline option is invoked, the code will be printed to a file instead of run in the interpreter.
def drive(param_dict, clargs): output_basename = _gen_basename(param_dict, clargs) if not clargs.overwrite: i = 1 while glob.glob('*{}*'.format(output_basename)): output_basename = '{}.{}'.format( _gen_basename(param_dict, clargs), i) i += 1 casa_ins...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n BASIC.run(PROGRAM)", "def generate(options):\n interactive = options['i']\n if interactive:\n generate_interactive(options)\n else:\n generate_rcfile(vars(options['c']), options['rcfile'])", "def run():\n names=[i.__name__ for i in modList]\n res,action=kcs_ui.st...
[ "0.6534681", "0.6394365", "0.6163484", "0.61047703", "0.60676014", "0.60312563", "0.60181093", "0.5815423", "0.57839054", "0.57279795", "0.57003903", "0.5678264", "0.5646332", "0.5634394", "0.56316435", "0.562979", "0.5626772", "0.5618201", "0.5612563", "0.5597489", "0.558429...
0.0
-1
Drive the UV plane combination. Functionally, this means Performing concatenation Cleaning the concatenated MS in the UV plane Imaging the concatenated MS
def _drive_uv(param_dict, clargs, output_basename, casa_instance): script = [] if glob.glob('{}.concat.ms'.format(output_basename)) and clargs.overwrite: os.system('rm -rf {}.concat.ms'.format(output_basename)) # casa_instance.run_script(script) # todo # write an extension of the drivecas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_uvs(mesh, bsp_verts):\n\n mesh.uv_textures.new(\"UVs\")\n bm = bmesh.new()\n bm.from_mesh(mesh)\n\n if hasattr(bm.faces, \"ensure_lookup_table\"): \n bm.faces.ensure_lookup_table()\n\n uv_layer = bm.loops.layers.uv[0]\n\n for face_idx, current_face in enumerate(bm.faces):\n ...
[ "0.5860706", "0.5756254", "0.558495", "0.55116755", "0.5500914", "0.54856575", "0.5411383", "0.53948486", "0.53849983", "0.5343461", "0.5337835", "0.5308709", "0.53073806", "0.53056586", "0.5296829", "0.5273831", "0.52715695", "0.5257271", "0.52373564", "0.5233863", "0.522525...
0.61613876
0
Drive the feather combination. Functionally, this means Cleaning the individual ms separately. Imaging the individual ms. Feathering the two together.
def _drive_feather(param_dict, clargs, output_basename, casa_instance): # todo later -> the imstat stuff script = [] thresh, seven_meter_clean_args = utils.param_dict_to_clean_input( param_dict, seven_meter=True) _, twelve_meter_clean_args = utils.param_dict_to_clean_input( param_dic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _removeFX(self):\r\n\t\tnodesToClean = [CONST.FOAM_FLUID_SHAPENODE, CONST.WAKE_FLUID_SHAPENODE, 'fluids_hrc']\r\n\t\tfor eachNode in nodesToClean:\r\n\t\t\ttry:\r\n\t\t\t\tcmds.delete(each)\r\n\t\t\texcept:\r\n\t\t\t\tpass\r\n\r\n\t\tfor eachCache in cmds.ls(type = 'cacheFile'):\r\n\t\t\tcmds.delete(eachCache)...
[ "0.53458524", "0.5341943", "0.5341767", "0.51823235", "0.51823235", "0.51713705", "0.51584935", "0.50687635", "0.50499785", "0.5038589", "0.50249314", "0.5024092", "0.5023892", "0.50143516", "0.49986392", "0.49689344", "0.49604985", "0.49398032", "0.49370384", "0.49188516", "...
0.72748023
0
Calculate weightings to use for the feather task
def _calc_feather_weighting(param_dict): weightings = param_dict['weightings'] if not isinstance(weightings, (list, tuple)): return 1.0 return float(weightings[1]) / float(weightings[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_weighted_results():\n pass", "def weight(self):", "def getWeight(self) -> float:\n ...", "def calculateWeights(self):\n return self.distances #En lo que encontramos una funcion que represente", "def get_weights(self):", "def calculate_weights():\n weights = {}\n...
[ "0.7639016", "0.75578135", "0.7499282", "0.73658234", "0.72466195", "0.7217344", "0.7214428", "0.7214428", "0.7117307", "0.7097232", "0.70433426", "0.6888601", "0.6846439", "0.68106675", "0.6809401", "0.6799938", "0.67643374", "0.6751411", "0.6691422", "0.6686457", "0.6686457...
0.7724041
0
Automatically generate a basename or else use the one provided.
def _gen_basename(param_dict, clargs): if param_dict['output_basename'] in ['', 'auto']: return clargs.input_fname.lower().split('.json')[0] else: return param_dict['output_basename']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_fullname(basename, _type=None):\n return '{}.{}'.format(basename, extensions.get(_type, None))", "def _gen_fname(self, basename, cwd=None, suffix=None, change_ext=True, ext=None):\n if not basename:\n msg = \"Unable to generate filename for command %s. \" % self.cmd\n msg...
[ "0.7162985", "0.71130204", "0.71064943", "0.70725805", "0.70725805", "0.6988176", "0.6869497", "0.6849551", "0.672568", "0.6704061", "0.66934615", "0.65571934", "0.6534404", "0.64742374", "0.6473847", "0.646789", "0.6352444", "0.6296653", "0.6274127", "0.62643063", "0.6244662...
0.77820414
0
fit gaussian to line
def womgau(hop): import numpy as np import logging import matplotlib.pyplot as plt from scipy.optimize import curve_fit from tmath.wombat.womwaverange import womwaverange from tmath.wombat.womget_element import womget_element from tmath.wombat.inputter import inputter from tmath.wombat.i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_fit(x,y):\n\t# clean\n\tx = np.squeeze(x)\n\ty = np.squeeze(y)\n\t# concatenate\n\txy = np.concatenate((x[:,np.newaxis],y[:,np.newaxis]),1)\n\t# sort by x values\n\txy = xy[xy[:,0].argsort()]\n\t#print(xy)\n\tf = lambda x,m,b : m*x+b\n\tpars,_ = opt.curve_fit(f,xy[:,0],xy[:,1])\n\tm = pars[0]\n\tb = pars[...
[ "0.7053034", "0.6899664", "0.66803604", "0.6613913", "0.66093487", "0.655105", "0.655105", "0.6387049", "0.63094246", "0.62380975", "0.622621", "0.62161845", "0.6191844", "0.61702806", "0.6145452", "0.61285686", "0.61094004", "0.61094004", "0.6043475", "0.6034672", "0.6022126...
0.0
-1
! Create ssh client. Create ssh client to run commands in host machine from inside container.
def create_client(): hostname = "localhost" username = "she393" password = os.getenv("PASSWORD") client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(hostname=hostname, username=username, password=password) return client
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_sshclient(host, user, port, secret):\n ssh_client = paramiko.SSHClient()\n ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())\n ssh_client.load_system_host_keys()\n if secret and port:\n ssh_client.connect(hostname=host, username=user, password=secret, port=port)\n elif...
[ "0.69851446", "0.6791386", "0.6668736", "0.6655599", "0.6630987", "0.65980434", "0.6580812", "0.65597147", "0.655599", "0.6490338", "0.641064", "0.6405131", "0.6365197", "0.63595355", "0.6352704", "0.6299737", "0.62719107", "0.62428546", "0.6240554", "0.6232706", "0.6225897",...
0.7121306
0
! Wrapper for HTTP responses. message The content of the successful (200) HTTP response. Flask HTTP response object with content of message from the argument and status code 200.
def response(message): res = Response(json.dumps(message)) res.status_code = 200 res.content_type = "application/json" return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response(status, message, code):\n return make_response(jsonify({\n 'status': status,\n 'message': message\n })), code", "def HandleResponse(data,message,success = True,err = 'no err',resp_status = status.HTTP_200_OK):\n return Response({\n 'success':success,\n \"error\":...
[ "0.8077968", "0.7261069", "0.7197937", "0.71356225", "0.7122571", "0.7062746", "0.70605296", "0.70228976", "0.7000634", "0.69415414", "0.6871562", "0.67692024", "0.6674502", "0.6664123", "0.65871406", "0.65599144", "0.6558028", "0.65498847", "0.6513427", "0.6454303", "0.64455...
0.7737896
1
! HTTP route '/' Returns 'OK' successful response to the user.
def home(): return response("OK")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root():\n return Response(\"It's alive!\", status=200)", "def root():\n if request.headers['Accept'] == 'application/json':\n return \"Welcome\\n\\n\", 200\n else:\n return redirect(url_for('index'))", "def index():\n return Response(\n \"Welcome to basic-http-server, you're ready to a...
[ "0.8000715", "0.76302844", "0.7217383", "0.7034739", "0.6969286", "0.69551736", "0.6937947", "0.69072324", "0.684836", "0.6830389", "0.68042636", "0.67833495", "0.6741848", "0.6703643", "0.66771775", "0.6644887", "0.6582273", "0.6569342", "0.65503997", "0.6548875", "0.6541204...
0.7412834
2
! HTTP route '/api/tasks/' API endpoint for manipulating tasks. Allows GET, POST and DELETE requests.
def kamel_get(): client = create_client() task_name = request.args.get('name') if request.method == "GET": if task_name is not None: # describe behavior stdin, stdout, stderr = client.exec_command(f"/usr/local/bin/kamel describe integration {task_name}") # noqa ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_tasks(self, request):\n \"\"\"\n @api {get} /tasks List tasks\n @apiName GetTasks\n @apiGroup Tasks\n @apiVersion 1.0.0\n\n @apiDescription Return a list of all configured tasks, along with their configuration.\n\n @apiSuccessExample {json} Example respon...
[ "0.7414974", "0.73624206", "0.72924006", "0.7080843", "0.6978864", "0.68153924", "0.67486525", "0.667285", "0.65907764", "0.64850056", "0.645972", "0.6416525", "0.6354801", "0.6345557", "0.62794614", "0.6248126", "0.62155837", "0.61991686", "0.61804813", "0.61286545", "0.6125...
0.0
-1
! HTTP route '/api/logs/tasks/' API endpoint for manipulating logs. Allows only GET requests.
def kamel_logs(): task_name = request.args.get('name') if task_name is None: return response("Need to specify task name!") client = create_client() stdin, stdout, stderr = client.exec_command(f"/usr/local/bin/kamel logs {task_name}") # noqa time.sleep(1) stdout.channel.close() body ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_get(self, req, resp):\n try:\n task_model_list = self.state_manager.get_tasks()\n task_list = [x.to_dict() for x in task_model_list]\n resp.text = json.dumps(task_list)\n resp.status = falcon.HTTP_200\n except Exception as ex:\n self.error...
[ "0.6197851", "0.607282", "0.5970462", "0.59704053", "0.5964452", "0.59584445", "0.58986974", "0.581812", "0.5806979", "0.57502735", "0.5739828", "0.5729748", "0.56855357", "0.5676162", "0.56016225", "0.5558941", "0.55346864", "0.5530376", "0.5528069", "0.5521597", "0.55141115...
0.60648406
2
Access token auth logic.
def authenticate(self, request=None, **kwargs): if request is None: return None access_token = jwt_utils.get_access_token_by_request(request) if access_token is None: return None try: payload = jwt_utils.jwt_decode(access_token) except Deco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_token(self):", "def do_auth(self, access_token, *args, **kwargs):\n data = self.user_data(access_token)\n data['access_token'] = access_token\n kwargs.update(data)\n kwargs.update({'response': data, 'backend': self})\n return self.strategy.authenticate(*args, **kwargs)...
[ "0.7375866", "0.7111791", "0.7054406", "0.70490533", "0.70432705", "0.7001905", "0.6994722", "0.6989808", "0.6969049", "0.6969049", "0.69665104", "0.69614655", "0.6938845", "0.68905526", "0.6871101", "0.67952436", "0.6786014", "0.6768033", "0.6756323", "0.67161775", "0.671617...
0.0
-1
Used by django auth system. We don`t need this method implementation.
def get_user(self, user_id): return None # noqa: WPS324
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authentication_hook(self):\n pass", "def auth(self, user):", "def _get_auth_string(self):", "def authenticate_user(self):\n raise NotImplementedError(\n \"\"\"\n authenticate_user must be implemented by a child class\n \"\"\"\n )", "def auth():\...
[ "0.7454468", "0.7185157", "0.7009156", "0.688985", "0.6836429", "0.6836429", "0.6824741", "0.68042165", "0.66339934", "0.66053426", "0.65637714", "0.6532335", "0.64916205", "0.643852", "0.63844854", "0.6349493", "0.6346315", "0.6337269", "0.6337102", "0.63232756", "0.63232756...
0.0
-1
Wraps the function, so that the id's it gets will always be strings
def string_ids(f): @functools.wraps(f) def wrapper(self, *args): return f(self, *[str(arg) for arg in args]) return wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def getId(*args):", "def id_(x: Any) -> Any:\n return x",...
[ "0.72658205", "0.72658205", "0.72658205", "0.72658205", "0.72658205", "0.72658205", "0.72658205", "0.72658205", "0.72658205", "0.72658205", "0.72658205", "0.72658205", "0.7023903", "0.6685517", "0.6608628", "0.6440895", "0.64001304", "0.63244265", "0.6252984", "0.6210254", "0...
0.66786057
14
Saves user to database
def save_user(self, user: dict): logger.debug('Inserting new user....') users = self.db.users users.update(self.user_identification(user), user, upsert=True) logger.debug('New user inserted')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_user(user):\n User.save_user(user)", "def save_users(user):\n user.save_user()", "def save_user(self):\n db.session.add(self)\n db.session.commit()", "def save(self, context=None):\n updates = self.obj_get_changes()\n self.dbapi.update_user(context, self.id, updates...
[ "0.8537059", "0.8319131", "0.8278781", "0.7453417", "0.73806924", "0.7328633", "0.7308185", "0.72789395", "0.7239284", "0.723523", "0.7180633", "0.71803653", "0.7159296", "0.71304476", "0.71304476", "0.7122661", "0.711703", "0.71088237", "0.71088237", "0.7087179", "0.7080573"...
0.7518099
3
One to one identification of the snapshots.
def snapshot_identification(snapshot): return { 'user_id': snapshot['user_id'], 'timestamp': snapshot['timestamp'], 'snapshot_id': snapshot['snapshot_id']}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_id(self):\n return f\"{DOMAIN}_{self._cam_name}_{self._obj_name}_snapshot\"", "def snapshot_id(self) -> Optional[str]:\n return pulumi.get(self, \"snapshot_id\")", "def snapshot_id(self) -> Optional[str]:\n return pulumi.get(self, \"snapshot_id\")", "def snapshot_id(self) -> O...
[ "0.6157024", "0.6145881", "0.6145881", "0.58339775", "0.58339775", "0.58339775", "0.5751372", "0.5697604", "0.5678704", "0.55947214", "0.5580041", "0.5498619", "0.5444909", "0.54207444", "0.53875417", "0.5353588", "0.5305235", "0.52906895", "0.5282701", "0.5255412", "0.525408...
0.6568016
0
The AccountBroker initialze() function before we added the policy stat table. Used by test_policy_table_creation() to make sure that the AccountBroker will correctly add the table for cases where the DB existed before the policy support was added.
def prespi_AccountBroker_initialize(self, conn, put_timestamp, **kwargs): if not self.account: raise ValueError( 'Attempting to create a new database with no account set') self.create_container_table(conn) self.create_account_stat_table(conn, put_timestamp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_init(self) -> None:\n self._check_and_set_network()\n self._check_and_apply_migrations()", "def initialize():\n DATABASE.connect()\n DATABASE.create_tables([User, Entry], safe=True)\n DATABASE.close()", "def init():\n database.create_tables([Tracker])\n database.com...
[ "0.66067785", "0.6455682", "0.6373156", "0.63563114", "0.63563114", "0.62698793", "0.6163393", "0.6154188", "0.60957396", "0.60849506", "0.60809666", "0.5964424", "0.5955808", "0.5944223", "0.5935643", "0.5916183", "0.591556", "0.5893408", "0.58916914", "0.5885537", "0.587170...
0.73197085
0
Copied from AccountBroker before the metadata column was added; used for testing with TestAccountBrokerBeforeMetadata. Create account_stat table which is specific to the account DB.
def premetadata_create_account_stat_table(self, conn, put_timestamp): conn.executescript(''' CREATE TABLE account_stat ( account TEXT, created_at TEXT, put_timestamp TEXT DEFAULT '0', delete_timestamp TEXT DEFAULT '0', container_count INTEGER, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_track_containers_create_policy_stat(self, conn):\n conn.executescript(\"\"\"\n CREATE TABLE policy_stat (\n storage_policy_index INTEGER PRIMARY KEY,\n object_count INTEGER DEFAULT 0,\n bytes_used INTEGER DEFAULT 0\n );\n INSERT OR IGNORE INTO policy...
[ "0.6411355", "0.5693446", "0.5648235", "0.5506348", "0.5451028", "0.53575075", "0.53320557", "0.52726936", "0.5267531", "0.5266184", "0.5225775", "0.5171474", "0.5141938", "0.51097775", "0.5103295", "0.5092772", "0.50799894", "0.5075006", "0.5058689", "0.5051445", "0.5033744"...
0.76754844
0
Copied from AccountBroker before the sstoage_policy_index column was added; used for testing with TestAccountBrokerBeforeSPI. Create container table which is specific to the account DB.
def prespi_create_container_table(self, conn): conn.executescript(""" CREATE TABLE container ( ROWID INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, put_timestamp TEXT, delete_timestamp TEXT, object_count INTEGER, bytes_used INTEGER, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_track_containers_create_container_table(self, conn):\n # revert to old trigger script to support one of the tests\n OLD_POLICY_STAT_TRIGGER_SCRIPT = \"\"\"\n CREATE TRIGGER container_insert_ps AFTER INSERT ON container\n BEGIN\n INSERT OR IGNORE INTO policy_stat\n ...
[ "0.7222646", "0.66707873", "0.5947068", "0.5887795", "0.58477587", "0.5694725", "0.56702393", "0.56475055", "0.56451815", "0.56367904", "0.5633519", "0.55940306", "0.55933654", "0.55901736", "0.5587355", "0.55573237", "0.555128", "0.5534241", "0.55316937", "0.55145425", "0.55...
0.6937344
1