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
This function defines the solution and the inital view. Returns two lists of lists, inital first then solution.
def getSudoku(puzzleNumber=None): inital = SudokuGrid.SudokuGrid() current = SudokuGrid.SudokuGrid() solution = SudokuGrid.SudokuGrid() inital.createGrid(27, puzzleNumber) current.createGrid(27, puzzleNumber) solution.createGrid(81, puzzleNumber) return inital, current, solution
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solver2_init(self):\n result = []\n colors = [\"white\" for e in self.lettersList]\n for letter in self.dico:\n #print(letter)\n self.solver2_rec([], letter, result, colors, self.dico)\n res = set(result)\n res = self.decreasingList(res)\n return ...
[ "0.62474173", "0.6216478", "0.6104235", "0.58921117", "0.57894963", "0.5755673", "0.57553595", "0.57410777", "0.5664829", "0.56334406", "0.56099427", "0.56008995", "0.5582025", "0.55808014", "0.55638254", "0.5561149", "0.55270886", "0.5500637", "0.545771", "0.54560834", "0.54...
0.0
-1
Entrypoint for new genomic manifest file pipelines Sets up the genomic manifest file record and begin pipeline
def dispatch_genomic_job_from_task(_task_data: JSONObject, project_id=None): ingestion_workflows = ( GenomicJob.AW1_MANIFEST, GenomicJob.AW1F_MANIFEST, GenomicJob.METRICS_INGESTION, GenomicJob.AW4_ARRAY_WORKFLOW, GenomicJob.AW4_WGS_WORKFLOW, GenomicJob.AW5_ARRAY_MANI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def begin(self, pipeline: osbuild.Pipeline):", "def run(self):\n # params\n work_dir = self.param_required(\"work_dir\")\n\n # initial sequence loading, using ensembl-analysis scripts \n self.initial_sequence_loading(work_dir)\n\n # load data from the corresponding core db tabl...
[ "0.6201903", "0.61966634", "0.6005886", "0.5869271", "0.5851664", "0.58461", "0.5791174", "0.5701291", "0.5678775", "0.5667786", "0.5584046", "0.5561336", "0.55507636", "0.55318177", "0.55288357", "0.55028284", "0.5459225", "0.5455119", "0.54455304", "0.5434014", "0.54003793"...
0.0
-1
Entrypoint for new genomic manifest file pipelines Sets up the genomic manifest file record and begin pipeline
def execute_genomic_manifest_file_pipeline(_task_data: dict, project_id=None): task_data = JSONObject(_task_data) if not hasattr(task_data, 'job'): raise AttributeError("job are required to execute manifest file pipeline") if not hasattr(task_data, 'bucket'): raise AttributeError("bucket i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def begin(self, pipeline: osbuild.Pipeline):", "def run(self):\n # params\n work_dir = self.param_required(\"work_dir\")\n\n # initial sequence loading, using ensembl-analysis scripts \n self.initial_sequence_loading(work_dir)\n\n # load data from the corresponding core db tabl...
[ "0.6202425", "0.6193715", "0.6007349", "0.58711624", "0.58502656", "0.57915175", "0.56983083", "0.567966", "0.5665016", "0.55852026", "0.55615926", "0.5551505", "0.5533249", "0.55275273", "0.5503722", "0.54594636", "0.5453697", "0.5446504", "0.54328", "0.54008424", "0.5374719...
0.58453625
5
Writes JSON data to the file specified in the constructor. The data written will append the existing data n the file. If the file does not exists it will be created.
def send_data(self, data): with open(self.file, 'a') as f: json.dump(data, f, ensure_ascii=False) f.write("\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self):\r\n\r\n with open(self.filename + \".json\", mode='w') as json_file:\r\n json.dump(self.data, json_file, separators=(',', ':'))", "def write(self, file, data):\n if not exists(dirname(file)):\n makedirs(dirname(file))\n\n with open(file + '.json', 'w') ...
[ "0.8147043", "0.8026812", "0.7879472", "0.7858803", "0.75729924", "0.7508968", "0.7508968", "0.7464354", "0.7434823", "0.7419369", "0.74149853", "0.7389883", "0.7384196", "0.7345113", "0.7343975", "0.73359025", "0.73159343", "0.7303171", "0.72955114", "0.7281264", "0.7244225"...
0.0
-1
Lines just used to determine if line is trivial/vacuous DOES not convert EOS to SOS
def _finalize_strokes(self, strokes, lines=None): for i, offsets in tqdm(enumerate(strokes)): if lines and not lines[i]: print("Empty line? Stroke:") print(offsets[:10]) continue offsets[:, :2] *= 1.5 curr_strokes = drawing.off...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_Lines(self):\n\n pass", "def is_line(self): \n return False", "def is_line(self):\n return False", "def is_line(self):\n return True", "def is_line(self):\n return True", "def _isLine(self):\n return (self.width == 0 and self.height > 1) or (self...
[ "0.67411554", "0.6611935", "0.6377427", "0.6334415", "0.6334415", "0.62624496", "0.62624496", "0.6237898", "0.6207807", "0.6194193", "0.61676294", "0.61369383", "0.60999155", "0.596017", "0.5954091", "0.59534377", "0.5937131", "0.5931879", "0.5926632", "0.59235907", "0.588372...
0.0
-1
Creates an instance of the SkyCiv SelfWeight class.
def __init__(self, enabled: bool = False, x: float = 0, y: float = 0, z: float = 0 ) -> None: self.enabled = enabled self.x = x self.y = y self.z = z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, weight: float = 1.0):\n\n super().__init__()\n self.weight = weight", "def __init__(self, W):\n self.W = W", "def zero_weight():\n return Weight(kg=0)", "def sky_model(self, which=\"point\"):\n return SkyModel(\n spatial_model=self.spatial_model(wh...
[ "0.5821826", "0.56214917", "0.5540993", "0.5424185", "0.5383756", "0.53307855", "0.53303915", "0.53283125", "0.5323809", "0.53052056", "0.52879834", "0.5234454", "0.52252173", "0.5219809", "0.52050763", "0.51936644", "0.5191941", "0.5176164", "0.5163085", "0.51544744", "0.514...
0.0
-1
Get the self weight object as a dictionary.
def get(self) -> dict: return clone(vars(self))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_weight(self):\n return self.__weight", "def _get_weight(self):\n return self.__weight", "def _get_weight(self):\n return self.__weight", "def _get_weight(self):\n return self.__weight", "def _get_weight(self):\n return self.__weight", "def _get_weight(self):\n return self.__wei...
[ "0.72951293", "0.72951293", "0.72951293", "0.72951293", "0.72951293", "0.72951293", "0.72951293", "0.72951293", "0.72311807", "0.7087231", "0.7067233", "0.7067233", "0.70486575", "0.6990536", "0.6990536", "0.69803715", "0.6973584", "0.69491076", "0.69491076", "0.69136256", "0...
0.0
-1
Potts3D class used for getting information about the lattice and cells Potts3D class used for getting information about the lattice and cells
def __init__(self, *args): this = _CompuCell.new_Potts3D(*args) try: self.this.append(this) except __builtin__.Exception: self.this = this
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Tol3d(self, *args):\n return _Adaptor3d.Adaptor3d_TopolTool_Tol3d(self, *args)", "def __init__(self, u1=(1,0,0), u2=(0,1,0), u3=(0,0,1)):\n u1 = vec3(u1)\n u2 = vec3(u2)\n u3 = vec3(u3)\n\n if triple_scalar_product(u1, u2, u3) != 1:\n print >> sys.stderr, \"!! In...
[ "0.64591336", "0.628939", "0.60183465", "0.59724873", "0.594738", "0.5926596", "0.5878722", "0.5874803", "0.5872248", "0.5800448", "0.5789005", "0.5752864", "0.5690429", "0.56581295", "0.56511575", "0.5619621", "0.55708784", "0.5568822", "0.5567117", "0.55142593", "0.54944754...
0.64276975
1
Returns the number of attempted flips in a Monte Carlo step
def getNumberOfAttempts(self, *args): return _CompuCell.Potts3D_getNumberOfAttempts(self, *args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backtrack_steps():\n\n # Initialize position and number of steps\n x = 0\n n_steps = 0\n\n # Walk until we get to positive 1\n while x < 1:\n x += 2 * np.random.randint(0, 2) - 1\n n_steps += 1\n\n return n_steps", "def number_of_iterations(self) -> int:\n pass", "def...
[ "0.6661965", "0.65042186", "0.64334744", "0.64287806", "0.6290663", "0.62290144", "0.61293006", "0.60690063", "0.6034412", "0.60330486", "0.6003373", "0.59853166", "0.59393054", "0.5934875", "0.5925875", "0.5888969", "0.5864849", "0.58212376", "0.5819417", "0.5800875", "0.579...
0.0
-1
Function to set the Depth (neighbor distance)
def setDepth(self, *args): return _CompuCell.Potts3D_setDepth(self, *args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_depth(self, d):\r\n self.depth = d", "def set_depth(self, new_depth):\n self.caravan_depth = new_depth", "def setDepth(self, *args):\n return _libsbml.Dimensions_setDepth(self, *args)", "def set_depth(node, depth):\n setattr(node[0], \"depth\", depth)", "def _convert_to_dept...
[ "0.7030272", "0.64675653", "0.6385692", "0.6348303", "0.63163817", "0.6291967", "0.61900806", "0.61134195", "0.59872985", "0.5979092", "0.58745337", "0.58379006", "0.5815188", "0.57292175", "0.572485", "0.5710973", "0.570196", "0.56904286", "0.56863755", "0.5674278", "0.56658...
0.6458706
2
Function to set output frequency of debug statements
def setDebugOutputFrequency(self, *args): return _CompuCell.Potts3D_setDebugOutputFrequency(self, *args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug_counter(name, every=1):\r\n setattr(debug_counter, name, getattr(debug_counter, name, 0) + 1)\r\n n = getattr(debug_counter, name)\r\n if n % every == 0:\r\n print >>sys.stderr, \"debug_counter [%s]: %s\" % (name, n)", "def set_debug(self):\n self.logger.setLevel(5)\n if s...
[ "0.6158451", "0.59726447", "0.58677197", "0.58550537", "0.57988405", "0.5754504", "0.57102424", "0.57102424", "0.57052463", "0.5704786", "0.5639605", "0.56269664", "0.5622346", "0.5621204", "0.5620845", "0.56105494", "0.5537305", "0.55235225", "0.5522253", "0.5500236", "0.550...
0.75071925
0
Returns a list of all the cells in the simulation
def getCellInventory(self, *args): return _CompuCell.Potts3D_getCellInventory(self, *args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cells(self):\n return self.container['cells']", "def get_cells(self):\n raise NotImplementedError", "def cells(self) -> List[Tuple[int, int]]:\n return self._cells", "def iter_cells(self):\n\t\treturn iter(self._cells)", "def get_cells(self):\n cell_list = []\n for ce...
[ "0.76289326", "0.752089", "0.71874577", "0.71378446", "0.7102985", "0.70915425", "0.7032665", "0.7032207", "0.69649124", "0.69466865", "0.6744802", "0.6691453", "0.66340387", "0.6527634", "0.65223867", "0.6511846", "0.6509497", "0.6497671", "0.6495779", "0.64542955", "0.64218...
0.0
-1
Simulation class used for getting information about the simulation
def __init__(self, *args): this = _CompuCell.new_Simulator(*args) try: self.this.append(this) except __builtin__.Exception: self.this = this
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSimulation(self):\r\n raise NotImplementedError()", "def _get_simulation_info(self) -> dict:\n # Just a stub for now\n return {}", "def make_simulation(self):\n pass", "def simulation():\n\n return {\n \"type\": \"class\",\n \"base\": \"iso.process_step\",\...
[ "0.8187584", "0.7636824", "0.75250334", "0.7456991", "0.7180433", "0.7118595", "0.6935523", "0.67995685", "0.6776131", "0.6759681", "0.674348", "0.6723356", "0.67214483", "0.6712229", "0.66341585", "0.66034126", "0.6580803", "0.6542956", "0.65052545", "0.6500783", "0.6494156"...
0.0
-1
Returns the number of Monte Carlo steps the simulation will perform
def getNumSteps(self, *args): return _CompuCell.Simulator_getNumSteps(self, *args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_iterations(self) -> int:\n pass", "def number_of_steps(self) -> int:\n return len(self.step_points)", "def num_steps(self) -> int:\n return self._num_steps", "def num_steps(self):\n return self.torsoStepCount() + 1", "def get_steps_num():\n return 0", "def...
[ "0.72277623", "0.7152015", "0.7117779", "0.70664066", "0.6989106", "0.693362", "0.68225485", "0.6770624", "0.67446804", "0.67387", "0.6698841", "0.6647304", "0.6601292", "0.6561426", "0.6547861", "0.6540887", "0.64973104", "0.64744467", "0.64679456", "0.64175385", "0.64162636...
0.6599704
13
Returns the current Monte Carlo step
def getStep(self, *args): return _CompuCell.Simulator_getStep(self, *args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_step(X):\n return MOVING_STEP", "def getCurrentStep():", "def step(self):\n return self._step", "def sim_step(self):\n return traci.simulation.getCurrentTime()/1000 # milliseconds to seconds", "def step ( self ) :\n return self.__step", "def step(self) -> int:\n re...
[ "0.68682575", "0.6746242", "0.66656095", "0.6608056", "0.6605651", "0.6505347", "0.6487519", "0.64310527", "0.6413187", "0.63991755", "0.63991755", "0.63991755", "0.63991755", "0.63723916", "0.6291303", "0.62757725", "0.62633765", "0.62274325", "0.61823744", "0.6169099", "0.6...
0.62197924
18
Returns a bool value on the condition of whether the simulation is currently running
def isStepping(self, *args): return _CompuCell.Simulator_isStepping(self, *args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running(self):\n\t\treturn self._start is not None", "def _is_running(self):\n return self._run_state.is_running()", "def running(self):\n return self._lifetime_state in {\"starting\",\"running\",\"finishing\"}", "def running(self) -> bool:", "def is_running(self):\n\t\treturn self in _ru...
[ "0.77926874", "0.7751431", "0.7733829", "0.7715029", "0.76848954", "0.7648591", "0.7599688", "0.75992846", "0.75943446", "0.7581245", "0.75517577", "0.75486827", "0.7504439", "0.748716", "0.7469798", "0.74649763", "0.7455778", "0.74453723", "0.74405944", "0.7429025", "0.74290...
0.0
-1
Returns a pointer to the Potts class
def getPotts(self, *args): return _CompuCell.Simulator_getPotts(self, *args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_class(bot):\n return TosurnamentPlayerCog(bot)", "def __init__(self, pot, pub):\n\n self.pot = pot\n self.pub = pub", "def cls():\n patcher = patch_debounce()\n patcher.start()\n _import = __import__('homeassistant.components.homekit.type_thermostats',\n ...
[ "0.5514495", "0.5426632", "0.53119606", "0.5161052", "0.5125936", "0.5095161", "0.50123847", "0.49746054", "0.4954212", "0.49435547", "0.4934392", "0.49206352", "0.48933905", "0.48852", "0.48842362", "0.4879044", "0.4854348", "0.48300922", "0.48292398", "0.48275223", "0.48275...
0.5035254
6
Obtain a list of all the features in the list sorted by partial similarity to the question
def feature_list_by_ratio(processed_question, feature_list): ratio_ordered = [] length_question = len(processed_question.text) for feature in feature_list: length_feature = len(feature) if length_feature > length_question: ratio_ordered.append((feature, 0, -1)) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_features(self) -> List[Tuple[str, float]]:\n return [(key, self.features[key]) for key in sorted(self.features, key=self.features.get, reverse=True)]", "def _get_frequent_features(self):\n feature_terms = [sub_items for items in self.data['noun_and_np'].values for sub_items in items]\n...
[ "0.678645", "0.62636334", "0.60991806", "0.597559", "0.5955568", "0.59549016", "0.58404565", "0.58069927", "0.5797778", "0.57971066", "0.578736", "0.5771025", "0.5766309", "0.5766309", "0.5759463", "0.5758711", "0.57309", "0.57095194", "0.5690606", "0.56742805", "0.5673589", ...
0.6981241
0
distance is distance from light, in m returns probability that driver can make the light assumes driver going 100 km/h (250 / 9 m/s)
def make_light_prob(distance): if distance <= 1250 / 9: return 1 return .99 * make_light_prob(distance - 250 / 9)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distmeter(self):\n return self._distance.to(\"m\").value", "def manhatam_distance(self) -> int:\n raise NotImplementedError", "def test_rand_distance(self):\n\t\t\n\t\tdetails= self.watcher.analyze(layers=[self.fc2_layer], randomize=True)\n\t\tactual = details.rand_distance[0]\n\t\texpected =...
[ "0.66249526", "0.65129966", "0.65120053", "0.6509538", "0.6479013", "0.6472196", "0.63685584", "0.634336", "0.6341657", "0.63386166", "0.6302642", "0.6301768", "0.62938505", "0.6221564", "0.61828953", "0.61725366", "0.61725366", "0.61725366", "0.61725366", "0.61725366", "0.61...
0.7146622
0
speed is initial speed of car, in m/s returns diff b/w car's initial position and position after stopping, in m assumes constant deceleration at 2 m/s/s
def dist_to_stop(speed): return speed ** 2 / 4
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_speed(vehicle):\n vel = vehicle.get_velocity()\n\n return 3.6 * math.sqrt(vel.x ** 2 + vel.y ** 2 + vel.z ** 2)", "def get_speed(self) -> float: \r\n if self.distance < self.distance_stop:\r\n print(\"STOP: Obstacle detected ({} cm)\".format(self.distance))\r\n return...
[ "0.7304666", "0.7243308", "0.6970988", "0.6900406", "0.68796957", "0.68796957", "0.6870482", "0.68345296", "0.67147285", "0.66766566", "0.6653964", "0.6650512", "0.6644717", "0.6641357", "0.6595929", "0.6595929", "0.6595622", "0.65891355", "0.65861225", "0.65777284", "0.65156...
0.6667368
10
distance is distance b/w car and other point, in m returns minimum time to reach light from complete stop, in s assumes constant acceleration at 2 m/s/s
def time_to_point(distance): if distance <= (125 / 9) ** 2: return distance ** .5 return distance * 9 / 250 + 125 / 18
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure_distance(self):\n # set Trigger to HIGH\n GPIO.output(self.GPIO_TRIGGER, True)\n\n # set Trigger after 0.01ms to LOW\n time.sleep(0.00001)\n GPIO.output(self.GPIO_TRIGGER, False)\n\n start_time = time.time()\n stop_time = time.time()\n\n # save St...
[ "0.7289774", "0.69155484", "0.6876379", "0.68407476", "0.68127066", "0.6714906", "0.6569321", "0.6453441", "0.63888454", "0.63460386", "0.6335061", "0.6335061", "0.6335061", "0.6335061", "0.6335061", "0.63260436", "0.6305047", "0.63026315", "0.62876195", "0.6284549", "0.62668...
0.5738003
60
Returns the 4 dataframes (trip_link_df, itinerary_df, legs_df, segments_df) initialized as defined in init_data_struct.py with each itinerary/leg/segment assigned a unique IDs (uuid4() converted to string)
def initialize_all_df(itinerary_nodes): # Build nested bundles and assign IDs # (itinerary_ID, itinerary_node) itin_nodes = [(str(uuid.uuid4()), itin) for itin in itinerary_nodes] # (itinerary_ID, leg_ID, leg_node, numbering) leg_nodes = [(itin[0], str(uuid.uuid4()), leg, i) for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_frame_creator(self):\n sequence_folder = [\n '/SEQ1', '/SEQ2', '/SEQ3', '/SEQ4', '/SEQ5', '/SEQ6'\n ]\n rgb_folder = ['/RGBLeft/', '/RGBRight/']\n depth_folder = ['/DepthLeft/', '/DepthRight/']\n segmentation_folder = ['/GTLeft/', '/GTright/']\n rgb_dir...
[ "0.6310724", "0.617593", "0.61627376", "0.5935321", "0.5896558", "0.5864568", "0.5827048", "0.5805143", "0.57813084", "0.57492137", "0.5713851", "0.57109815", "0.55745304", "0.55693126", "0.55637246", "0.55569404", "0.55528224", "0.553132", "0.5521182", "0.5518123", "0.551747...
0.7354393
0
Takes in the XML response and turns it into an etree. Then builds tables containing itinerary/leg/segment including the node in the tree where they reside. The build_ functions then populate all fields of the dataframes with the data associated with that node in the etree. All the paths for the various fields are store...
def build_single_itinerary(response, trip, previous_itineraries_cr, CONFIG): # Build a tree from the XML root = ET.fromstring(response) # Extracts the nodes corresponding to itineraries from the tree itinerary_nodes = xml_path.get_itinerary_nodes(root) # Removes itineraries that have been previou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_all_df(itinerary_nodes):\n\n # Build nested bundles and assign IDs\n\n # (itinerary_ID, itinerary_node)\n itin_nodes = [(str(uuid.uuid4()), itin) for itin in itinerary_nodes]\n\n # (itinerary_ID, leg_ID, leg_node, numbering)\n leg_nodes = [(itin[0], str(uuid.uuid4()), leg, i)\n ...
[ "0.6677911", "0.6437981", "0.6058455", "0.59349716", "0.56626934", "0.5579094", "0.5558294", "0.55306023", "0.545958", "0.5440539", "0.5393666", "0.5390094", "0.5348027", "0.5285629", "0.5282974", "0.52672213", "0.5238531", "0.52304196", "0.5220906", "0.5218273", "0.5213253",...
0.6100067
2
Fetches a block from IOTA with an address. Since IOTA does not support exactly blocks, what is fetched is all the transactions of an address which are then sorted based on their timestamps and then concatenated in one block.
def fetch(self, address: str, log: Logger) -> Block: def get_transactions(address: str) -> Iterable['Transaction']: adapter = self._iota_api.adapter return find_transaction_objects(adapter, addresses=[address]) def get_signature_string(t: 'Transaction') -> str: retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fetch(self, address: str, latest: bool = False) -> None:\n try:\n # Fetch block from the ledger\n self._address_index[address] = self._connector.fetch(address,\n self._logger)\n # Add block to the registry\...
[ "0.63075423", "0.6130317", "0.60563076", "0.59326637", "0.5903281", "0.590054", "0.5893151", "0.5886603", "0.58753556", "0.5863715", "0.57891095", "0.57841134", "0.57321405", "0.57314", "0.5723248", "0.5698044", "0.56945467", "0.56176645", "0.55606705", "0.5559356", "0.550265...
0.7177153
0
Fetch a block from the ledger and update the state of the stream.
def _fetch(self, address: str, latest: bool = False) -> None: try: # Fetch block from the ledger self._address_index[address] = self._connector.fetch(address, self._logger) # Add block to the registry ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_block(self, blnum):\n MogamiLog.debug(\"** read %d block\" % (blnum))\n MogamiLog.debug(\"request to data server %d block\" % (blnum))\n self.p_channel.read_req(self.datafd, blnum)\n\n # change status of the block (to requiring)\n with self.r_buflock:\n sel...
[ "0.6299564", "0.5995834", "0.59561527", "0.5936668", "0.58768857", "0.5831979", "0.5819885", "0.5817211", "0.58122575", "0.5758775", "0.575114", "0.5735385", "0.5709176", "0.56670076", "0.5592112", "0.5553803", "0.5553803", "0.55014235", "0.54505074", "0.54420453", "0.5390549...
0.7019611
0
Create a new Q Table
def __init__(self, observation_space=Observation, action_space=Action, *args, **kwargs): self.store = dict() self.update(dict(*args, **kwargs)) self.observation_space = observation_space self.action_space = action_space
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_table(self):\n pass", "def new_table(self):\n self.c.execute(\n \"\"\"CREATE TABLE IF NOT EXISTS {table} (\n id integer primary key,\n {event} integer,\n {desc} text,\n {date} text,\n {link} text)\n \"\"\".forma...
[ "0.7152252", "0.68994075", "0.6877078", "0.6869424", "0.6855351", "0.6775118", "0.6725069", "0.66761756", "0.6620533", "0.6581835", "0.6554864", "0.6554864", "0.654501", "0.65231", "0.651004", "0.64918876", "0.64918876", "0.6401953", "0.6390644", "0.63892066", "0.6377845", ...
0.0
-1
Get the Qvalue corresponding to the given key
def __getitem__(self, key: tuple) -> float: s, a = key if not isinstance(s, self.observation_space) or not isinstance(a, self.action_space): raise KeyError return self.store.get(s, dict()).get(a, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(key):\n for qol_param in common.QOL_PARAMS:\n if key in common.QOL_PARAMS[qol_param]:\n return common.QOL_PARAMS[qol_param][key]", "def get_value(self, key):\n pass", "def __getitem__(self, key):\n return self.keyvaluepair_set.get(key=key).value", ...
[ "0.733857", "0.7282046", "0.72325957", "0.7180295", "0.70440596", "0.7009097", "0.6964033", "0.696088", "0.6926701", "0.6912365", "0.6876033", "0.68033004", "0.6795951", "0.6771391", "0.6702687", "0.6702687", "0.66993505", "0.6693946", "0.66882354", "0.66818875", "0.66655445"...
0.0
-1
Set a Qvalue for a given (observation, action) pair
def __setitem__(self, key: tuple, value: float): s, a = key if not isinstance(s, self.observation_space) or not isinstance(a, self.action_space): raise KeyError self.store.setdefault(s, dict())[a] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_action_value(self, state, action, value):\n self.value_function[to_table_index(state, action)] = value", "def update_qvals(self, state, action, reward):\n self.qvals[(state, action)] = 0", "def Q(self, observation, action):\n return self[observation, action]", "def updateQValu...
[ "0.7207835", "0.7086363", "0.7083719", "0.70424414", "0.6665662", "0.65934515", "0.64996874", "0.64944345", "0.6423975", "0.6421755", "0.6347077", "0.63399047", "0.633607", "0.6334427", "0.63263094", "0.6285045", "0.6201128", "0.6188193", "0.6188193", "0.6188193", "0.6188193"...
0.5894809
47
Remove an entry from this table
def __delitem__(self, key: tuple): s, a = key if not isinstance(s, self.observation_space) or not isinstance(a, self.action_space): raise KeyError del self.store[s][a]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, e):\n if self.search(e):\n self.table[hash(e) % len(self.table)].remove(e)\n else:\n raise IndexError(\"Unknown value\")", "def remove_row(self, row_id):", "def del_row(self, index):\n self.data.remove(self.data[index])", "def delete_entry_from_db(e...
[ "0.74670136", "0.74467105", "0.72756124", "0.7224693", "0.7171818", "0.7022768", "0.694053", "0.68942314", "0.68868333", "0.6865068", "0.683279", "0.68202114", "0.68200004", "0.6811052", "0.6769219", "0.674637", "0.67381734", "0.67120594", "0.66687924", "0.66652715", "0.66652...
0.0
-1
Obtain the Qvalue for performing the specified action given the observation
def Q(self, observation, action): return self[observation, action]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_qval(self, observation, action):\n obs_variable = Variable(torch.from_numpy(observation),\n volatile=True).type(torch.FloatTensor)\n\n # obs_variable sets volatile to True, thus, we do not set\n # it here\n action_variable = Variable(torch.from_numpy(action)).type(\n ...
[ "0.81143", "0.7915187", "0.7891677", "0.7835517", "0.7801762", "0.77660453", "0.76960266", "0.76921123", "0.7663453", "0.7615161", "0.7614706", "0.75210184", "0.74891776", "0.7462017", "0.7462017", "0.7462017", "0.7462017", "0.7454296", "0.74501723", "0.74501723", "0.74158025...
0.80301124
1
Obtain all Qvalues for multiple possible actions given the observation
def Qs(self, observation, actions): return {a: self[observation, a] for a in actions}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_action_Qvalues(Qvalues,actions):\n\n batch_i = T.arange(Qvalues.shape[0])[:,None]\n time_i = T.arange(Qvalues.shape[1])[None,:]\n action_Qvalues_predicted= Qvalues[batch_i,time_i, actions]\n return action_Qvalues_predicted", "def computeQValueFromValues(self, state, action):\n \"*** YO...
[ "0.71025026", "0.70802724", "0.6990872", "0.6927177", "0.68964356", "0.685025", "0.6729977", "0.67239213", "0.67226744", "0.6694636", "0.66370744", "0.6608392", "0.6598005", "0.6568247", "0.6557059", "0.65552235", "0.6547387", "0.65166014", "0.6490783", "0.64322513", "0.64144...
0.7254307
0
Create a Q Table with the environment's observation and action spaces
def for_env(env: DiscreteEnvironment): return QTable(env.observation_space, env.action_space)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_Qtable_line(self, state):\n # 4. Create qtable with current state\n # Our qtable should be a two level dict,\n # Qtable[state] ={'u':xx, 'd':xx, ...}\n # If Qtable[state] already exits, then do\n # not change it.\n if state not in self.Qtable.keys():\n ...
[ "0.6255378", "0.62204945", "0.6166513", "0.60615325", "0.6026363", "0.5958345", "0.5860154", "0.5855717", "0.5805799", "0.580382", "0.5777994", "0.57499313", "0.57398605", "0.5693433", "0.56837535", "0.56642014", "0.5643528", "0.5640943", "0.5637645", "0.5579142", "0.5579053"...
0.8406137
0
splits msg up in chunks of 160 characters with numbers at the start of the chunk to ensure that the order can be retained in the case of the messages not arriving at the same time, which will most definitely happen.
def chunkify(msg): return ["%s %s" % (i, msg[i*158 : (i+1)*158]) for i in range(len(msg)/158 + 1)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_message(message, max_length):\n ms = []\n while len(message) > max_length:\n ms.append(message[:max_length])\n message = message[max_length:]\n ms.append(message)\n return ms", "def chunk_split(cls, text):\n parts = []\n current = []\n for line in text.spl...
[ "0.65123254", "0.6352726", "0.5945958", "0.5764811", "0.5745976", "0.57398397", "0.56032455", "0.5584404", "0.55716544", "0.5547637", "0.5528964", "0.5514335", "0.5504813", "0.5485734", "0.54836977", "0.54310673", "0.5405054", "0.5393326", "0.53833044", "0.53765863", "0.53716...
0.7787634
0
Read an image into a numpy array given the path of the file.
def read_image(image_path, *args, **kwargs): # TODO: Implement the method image2 = Image.open(image_path) image = num.asarray(image2) return image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_image_into_numpy_array(path):\r\n \r\n return np.array(Image.open(path))", "def load_image_into_numpy_array(path):\n return np.array(Image.open(path))", "def load_image_into_numpy_array(path):\n return np.array(Image.open(path))", "def load_image_into_numpy_array(self, path):\n \n...
[ "0.86715007", "0.8633785", "0.8633785", "0.8493045", "0.84611374", "0.8373229", "0.83648574", "0.83485955", "0.82346785", "0.80594194", "0.80161023", "0.7821089", "0.7815685", "0.7774452", "0.77459216", "0.77195257", "0.7692844", "0.76677877", "0.76604307", "0.76356107", "0.7...
0.72781515
30
Invert the image color by subtracting the image from a white image.
def invert_image(image, *args, **kwargs): # TODO: Implement the method image2 = Image.fromarray(image) image3 = Image.eval(image2, lambda a: 255-a) inv_image = num.asarray(image3) return inv_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_black_and_white(img):\n img = 255 - img\n\n return img", "def invert(self, img):\n return self.inverse()(img)", "def inverse(im): \t \n x,y = np.shape(im)\n img = np.zeros([x,y])\n\t\n for i in range(x):\n for j in range(y):\n img[i,j] = 255 - im[i,j]\n ...
[ "0.8028905", "0.7429058", "0.74069834", "0.7211845", "0.7173375", "0.7119979", "0.7021532", "0.6994248", "0.6861255", "0.6688757", "0.66340476", "0.65448874", "0.65252805", "0.65027505", "0.64128816", "0.6408302", "0.6300732", "0.6250186", "0.6229428", "0.62287366", "0.613614...
0.7413534
2
Save an image to H5 file.
def save_image_to_h5(image, h5_path, *args, **kwargs): # TODO: Implement the method f = h5.File(h5_path, "w") grp = f.create_group("data") grp.create_dataset("image", data=image)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as_hdf5(self, filename):", "def save_image(img: Image, filename: str) -> None:\r\n img.save(filename)", "def save_img(img: np.ndarray, path: str) -> None:\n\n img_obj = Image.fromarray(img)\n img_obj.save(path)", "def save_image(img, path):\n cv2.imwrite(path, img)", "def save_image(se...
[ "0.7164401", "0.6891454", "0.68416053", "0.6818399", "0.6801005", "0.6790581", "0.6781218", "0.6770538", "0.6723622", "0.66964334", "0.6677857", "0.66489947", "0.65959775", "0.6587879", "0.65265673", "0.6482147", "0.64585376", "0.6458208", "0.6433483", "0.6411232", "0.640583"...
0.8219461
0
Read an image into a numpy array given the path of a H5 file.
def read_image_from_h5(h5_path, *args, **kwargs): # TODO: Implement the method h5_pathRd = h5.File(h5_path, "a") image = h5_pathRd["data"]["image"] return image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(path: Union[Path, str]) -> np.ndarray:\n return _reader.imread(str(path))", "def read_data(path):\n with h5py.File(path, 'r') as hf:\n data = np.array(hf.get('data'))\n return data", "def load_h5_file(file_path):\n # load\n fr = h5py.File(file_path, 'r')\n a_group_key = list(fr....
[ "0.7554185", "0.75005555", "0.73265314", "0.73265314", "0.72788644", "0.7277284", "0.72648257", "0.72648257", "0.7202138", "0.71711314", "0.7156384", "0.7148705", "0.713533", "0.71084225", "0.7078591", "0.701594", "0.69675314", "0.6962734", "0.69086313", "0.6829945", "0.67954...
0.74092174
2
Return the gray_scale image by taking the mean over channels.
def gray_scale_image(image, *args, **kwargs): # TODO: Implement the method gray_scale = num.dot(image, [0.298, 0.587, 0.114]) return gray_scale
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mean_image(data):\n\n\tno_of_images = len(data)\n\tmean_im = np.zeros((28, 28))\n\tfor i in xrange(no_of_images):\n\t\tmean_im = mean_im + data[i, 0:28, 0:28]\n\n\tmean_im = mean_im / no_of_images\n\treturn mean_im", "def channel_means(self, samplesize=1.):\n total_pix = 0\n mean = 0\n ...
[ "0.6555185", "0.6541985", "0.64513564", "0.6434896", "0.63752955", "0.6361023", "0.6298471", "0.62833977", "0.62645227", "0.6248899", "0.62414914", "0.62157655", "0.61937994", "0.6193506", "0.61784905", "0.61492467", "0.61472374", "0.6116681", "0.60848844", "0.6049209", "0.60...
0.59650254
22
Find the difference of two Gaussian blurs from an image.
def find_difference_of_gaussian_blur(image, k1, k2, *args, **kwargs): # TODO: Implement the method res1 = snf.gaussian_filter(image, k1) res2 = snf.gaussian_filter(image, k2) res = res2 - res1 minn = num.amin(res) maxx = num.amax(res) if(minn - maxx != 0): res = (res-minn)/(maxx...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def differenceOfGausssians(image,sigma0, sigma1,window_size, roi, out = None):\n return (vigra.filters.gaussianSmoothing(image,sigma0,window_size=window_size,roi = roi)-vigra.filters.gaussianSmoothing(image,sigma1,window_size=window_size,roi = roi))", "def img_compare(A, B):\r\n A = cv2.GaussianBlur(A, (5,...
[ "0.6985116", "0.67345124", "0.650252", "0.6417384", "0.6318204", "0.6304162", "0.6298801", "0.6222766", "0.6212655", "0.61555135", "0.606799", "0.60050595", "0.59965354", "0.5986602", "0.59817517", "0.5940041", "0.59379756", "0.5924522", "0.5862609", "0.5854046", "0.5843962",...
0.77067065
0
Find the difference of two Gaussian blurs from an image.
def keep_top_percentile(image, percentile, *args, **kwargs): # TODO: Implement the method imageSort = num.sort(image, axis=None) elem = int(len(imageSort) * (percentile/100)) big = num.zeros(elem) k = len(imageSort)-1 for i in range(0, elem): if imageSort[k] in big: k -= 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_difference_of_gaussian_blur(image, k1, k2, *args, **kwargs):\n # TODO: Implement the method\n \n res1 = snf.gaussian_filter(image, k1)\n res2 = snf.gaussian_filter(image, k2)\n res = res2 - res1\n minn = num.amin(res)\n maxx = num.amax(res)\n if(minn - maxx != 0):\n res = (r...
[ "0.77065706", "0.69836676", "0.67338467", "0.6501565", "0.64180654", "0.63185185", "0.6304538", "0.6297909", "0.62224245", "0.62112623", "0.6155297", "0.6066071", "0.60023737", "0.5996138", "0.5986763", "0.59822875", "0.59397084", "0.5937418", "0.5926422", "0.5862103", "0.585...
0.0
-1
Returns the hostname and record type of the record.
def extract_query(pkt): request = DNSRecord.parse(pkt) # Extract the hostname qname = request.q.qname hostname = str(qname) # Remove tailing period (artifact of the dnslib) if hostname[-1] == '.': hostname = hostname[:-1] # Record type qtype = QTYPE.get(request.q.qtype) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRecord(self, rr):\n\t\tif rr.type == 1: return {'type': 'a', 'ipv4': socket.inet_ntoa(rr.rdata), 'hostname': rr.name}\n\t\telif rr.type == 28: return {'type': 'aaaa', 'ipv6': socket.inet_ntop(socket.AF_INET6, rr.rdata), 'hostname': rr.name}\n\t\telif rr.type == 5: return {'type': 'cname', 'hostname': rr.nam...
[ "0.7288703", "0.638681", "0.6237808", "0.6174709", "0.59828585", "0.5811655", "0.5811644", "0.5750304", "0.5713665", "0.56564605", "0.56298727", "0.5611728", "0.5604755", "0.5574632", "0.5544346", "0.552044", "0.551721", "0.54946756", "0.54894084", "0.54869735", "0.54860216",...
0.57737625
7
Generates a DNS Response populated with the provided information.
def generate_dns_packet(request_pkt, hostname, ip_addresses): request = DNSRecord.parse(request_pkt) record_type = QTYPE.A response = request.reply() # TODO(kbaichoo): add flexible ttl for ip_address in ip_addresses: # Get the class for resource data that corresponse to the request ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regularResponse(p, dom: string, ip_dom: string, ip_srv: string, dt: float):\n id_IP = int(RandShort()) #id for IP layer\n ar_ans = DNSRR(rrname = dom, rdata = ip_dom) #Domain answer\n ar_ext = DNSRROPT(rclass=4096) #Extension\n an_ans = DNSRR(rrname = dom, rdata = ip_srv) #Domain server answer\n ...
[ "0.6531117", "0.64146197", "0.6380294", "0.6164546", "0.6144472", "0.6139773", "0.60876644", "0.5980946", "0.58792895", "0.5809648", "0.57692605", "0.56878424", "0.565427", "0.56449574", "0.5584822", "0.55758744", "0.55310625", "0.5509591", "0.5491801", "0.5460799", "0.544931...
0.63454044
3
handle an error, by logging it, then raising an exception
def handle_error(msg, err_type, logger, raise_msg=None, log_msg=None): if raise_msg is None: raise_msg = msg if log_msg is None: log_msg = msg logger.error(log_msg) raise err_type(raise_msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_exception(e):\n print(e)\n return error()", "def error(self, *args, **kwargs):\n\n message = self.get_message(*args, **kwargs)\n self.logger.error(message)", "def handle_error(self, request, error):\n self.log.error(\"An error occurred at request \" + repr(request) + \": \...
[ "0.7666846", "0.7146778", "0.70937276", "0.7038922", "0.7030838", "0.7030838", "0.7014399", "0.69710976", "0.6966085", "0.6966085", "0.69523925", "0.6922177", "0.6921734", "0.6916031", "0.6896284", "0.687706", "0.68590826", "0.6856361", "0.6845638", "0.68397397", "0.68397397"...
0.67159426
35
load a file situated in a directory
def read_file_from_directory( dir_path, file_name, jtype, logger, interp_ext=False, ext_types=(("json", (".json",)), ("yaml", (".yaml", ".yaml.j2"))), ): if isinstance(dir_path, string_types): dir_path = pathlib.Path(dir_path) file_path = dir_path.joinpath(file_name) if not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(path):\n pass", "def _load(self, directory):\n pass", "def load(self, path):\n pass", "def load(self, path):\n pass", "def load(self, path: str):\n pass", "def _file_load(path):\n _, _, file_path = path.split('/', 2)\n with open(file_path, 'r', encoding='utf-...
[ "0.7580211", "0.74020463", "0.72088", "0.72088", "0.7139655", "0.7106958", "0.7016052", "0.67880684", "0.65653384", "0.6454418", "0.64124596", "0.6382908", "0.6317649", "0.627729", "0.62068367", "0.61892784", "0.61716443", "0.6151298", "0.61503625", "0.6143393", "0.6128547", ...
0.0
-1
return a directory path to a module
def get_module_path(module): return pathlib.Path(os.path.dirname(os.path.abspath(inspect.getfile(module))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def module_directory(file_path):\n return os.path.dirname(os.path.realpath(file_path))", "def module_path():\n return os.path.dirname(unicode(__file__, sys.getfilesystemencoding( )))", "def modulePath(self, name):\n return os.path.join(self.modulesDir, name)", "def _get_module_path():\n\n return ...
[ "0.81944263", "0.8096354", "0.80722326", "0.7936179", "0.76663285", "0.7579195", "0.7564892", "0.74413705", "0.74383605", "0.743328", "0.7392733", "0.7389454", "0.73743325", "0.7297176", "0.7270132", "0.72672725", "0.7237529", "0.72215545", "0.72154826", "0.7209719", "0.71698...
0.8276851
0
load a file situated in a python module
def read_file_from_module( module_path, file_name, jtype, logger, interp_ext=False, ext_types=(("json", (".json")), ("yaml", (".yaml", ".yaml.j2", "yaml.tex.j2"))), ): try: outline_module = importlib.import_module(module_path) except ModuleNotFoundError: # noqa: F821 han...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(path):\n pass", "def module_file(module):\n ...", "def import_file(name: Text, file_path: Text):\n\n spec = spec_from_file_location(f\"luh3417.{name}\", file_path)\n module = module_from_spec(spec)\n spec.loader.exec_module(module)\n\n return module", "def load_module(file_name...
[ "0.7343817", "0.7325808", "0.7124396", "0.7089663", "0.6965346", "0.6954099", "0.69038224", "0.6900801", "0.68884784", "0.6853388", "0.6853388", "0.67909485", "0.6740944", "0.6740033", "0.6737542", "0.6732569", "0.6664414", "0.66365", "0.66365", "0.6610682", "0.65619195", "...
0.63991064
35
Return the given string converted to a string that can be used for a clean filename. Remove leading and trailing spaces; convert other spaces to underscores; and remove anything that is not an alphanumeric, dash, underscore, or dot. >>> get_valid_filename("john's portrait in 2004.jpg") 'johns_portrait_in_2004.jpg'
def get_valid_filename(s): s = str(s).strip().replace(" ", "_") return re.sub(r"(?u)[^-\w.]", "", s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_valid_filename(s):\n s = str(s).strip().replace(' ', '_')\n return re.sub(r'(?u)[^-\\w.]', '', s)", "def get_valid_filename(s):\n assert(s is not \"\" or s is not None)\n s = str(s).strip().replace(' ', '_')\n return re.sub(r'(?u)[^-\\w.]', '', s)", "def get_valid_filename(s):\n retur...
[ "0.86586744", "0.8547645", "0.8149609", "0.80513585", "0.79863226", "0.7839607", "0.77740246", "0.77427137", "0.7719834", "0.76964754", "0.76964754", "0.76964754", "0.76510334", "0.75894004", "0.75845075", "0.74965084", "0.7492183", "0.7492183", "0.74786764", "0.73877007", "0...
0.8631907
1
find an entry point by name and group
def find_entry_point(name, group, logger, preferred=None): entry_points = list(pkg_resources.iter_entry_points(group, name)) if len(entry_points) == 0: handle_error( "The {0} entry point " "{1} could not be found".format(group, name), pkg_resources.ResolutionError, lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entry(self, name):\n for grp_name in self.h5:\n if grp_name == name:\n grp = self.h5[grp_name]\n if isinstance(grp, h5py.Group) and \\\n (\"start_time\" in grp) and \\\n self.get_attr(grp, \"NX_class\") == \"NXentry\":\n ...
[ "0.7070093", "0.65054095", "0.65054095", "0.6229338", "0.581634", "0.57242376", "0.5711433", "0.5569195", "0.5536396", "0.55361235", "0.55178064", "0.5498068", "0.54924065", "0.541051", "0.53857625", "0.53030723", "0.5294329", "0.5287642", "0.52645725", "0.52266806", "0.51666...
0.6390501
3
Correlated topic model. beta is the only variational parameter.
def __init__( self, n_words: int, n_topics: int = 3, prior_eta_loc: Union[None, tf.Variable, tf.Tensor] = None, prior_eta_scale_diag: Union[None, tf.Variable, tf.Tensor] = None, prior_beta_loc: Union[None, tf.Variable, tf.Tensor] = None, prior_beta_scale_diag: Uni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def beta_model(r, s0, rc, beta, c):\n return s0 * np.power((1.0+(r/rc)**2), 0.5-3*beta) + c", "def phi_topic(self):\n f1 = self.nkw+self.beta\n f2 = np.sum(self.nkw, axis=1, keepdims=True)+self.VT*self.beta\n return f1/f2", "def get_topic_quality():\n model.eval() \n with torch...
[ "0.6237969", "0.5832688", "0.55988395", "0.5563407", "0.55400586", "0.5456696", "0.5450131", "0.5444017", "0.54185635", "0.5395755", "0.5268196", "0.5232785", "0.5191446", "0.517559", "0.51587135", "0.5140319", "0.51181823", "0.50985974", "0.50910425", "0.50865865", "0.507756...
0.5526248
5
Correlated topic model. Only mu and sigma are variationa parameters.
def __init__( self, n_words: int, n_topics: int = 3, prior_mu_loc: Union[None, tf.Variable, tf.Tensor] = None, prior_mu_scale_diag: Union[None, tf.Variable, tf.Tensor] = None, m_mu: Union[None, tf.Variable] = None, sigma_mu: Union[None, tf.Variable] = None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__( self, weights, topics ):\n\n # Number of topics and dictionary size\n self.W, self.K = topics.shape\n assert( self.W > self.K )\n\n self.topics = topics\n MixtureModel.__init__(self, weights, topics)", "def get_topic_quality():\n model.eval() \n with torc...
[ "0.5500858", "0.5468614", "0.5449533", "0.5400399", "0.53025895", "0.5285705", "0.5230494", "0.521933", "0.5216387", "0.5153271", "0.5137738", "0.512959", "0.5115737", "0.5091643", "0.50906026", "0.5078132", "0.5070503", "0.5035436", "0.5020821", "0.5013369", "0.50094414", ...
0.51881254
9
Elbo for each sample.
def elbo( self, X: tf.Tensor, observation_index_points: tf.Tensor = None, kl_weight: float = 1.0, sample_size: int = 1, ) -> tf.Tensor: # del observation_index_points # unused posterior_mu = self.surrogate_posterior_mu mu_sample = posterior_mu.sample...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def samples(self):\n pass", "def sample(self):", "def create_samples(self):\n for s_id in range(len(self.data[\"sample\"])):\n self.samples.add(Sample(s_id, [self.data[key][s_id] for key in self.data.keys() if key not in WRONG_KEYS],\n self.data[\"lab...
[ "0.6299581", "0.6143885", "0.59323496", "0.5910247", "0.5902117", "0.5793561", "0.573086", "0.57278895", "0.57278895", "0.57173216", "0.5677992", "0.56677663", "0.56677663", "0.56526124", "0.5643686", "0.5616339", "0.5549662", "0.55346", "0.553261", "0.55173445", "0.5516863",...
0.0
-1
Returns the summary of the learned topics.
def get_topics_strings( topics_words, mu, sigma, vocabulary, topics_to_print=10, words_per_topic=30 ): mu = np.squeeze(mu, axis=0) sigma = np.squeeze(sigma, axis=0) # Use a stable sorting algorithm so that when alpha is fixed # we always get the same topics. highest_weight_topics = np.argsort(-m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_topics(self):\n topics = self.word_topics\n return topics / topics.sum(axis=1)[:, None]", "def describe_topic(self, index):\n assert(self.has_topics)\n assert(0 <= index < self.K)\n return self.topics[index]", "def topics(self) -> pulumi.Output[Optional[Sequence[str]]...
[ "0.653715", "0.6411843", "0.6337791", "0.6117723", "0.60652214", "0.59418464", "0.59277034", "0.59159243", "0.59126854", "0.58336073", "0.58320534", "0.5820626", "0.58199376", "0.5808728", "0.5808658", "0.580839", "0.57940865", "0.57726717", "0.5767523", "0.57669514", "0.5764...
0.0
-1
Print top words for a topic.
def print_top_words(components, feature_names, n_top_words: int = 10): for topic_idx, topic in enumerate(components): message = "Topic #%d: " % topic_idx message += " ".join( [feature_names[i] for i in topic.argsort()[: -n_top_words - 1 : -1]] ) print(message) print()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_topic(self, series, top=10):\n series.sort(ascending=False)\n t = [u'{} ({:.4f})'.format(word, p)\n for word, p in series[0:top].iteritems()]\n return u' - '.join(t)", "def display_topics(model, feature_names, no_top_words, topic_names=None):\n for ix, topic in enume...
[ "0.7723348", "0.76109993", "0.75774586", "0.7472223", "0.7343527", "0.7328319", "0.7318414", "0.72321844", "0.71997887", "0.7157243", "0.7114651", "0.70796895", "0.6947733", "0.69452626", "0.6838635", "0.6817538", "0.68120825", "0.6801275", "0.6722403", "0.67175907", "0.67012...
0.78302485
0
Build fake data for correlated topic model.
def build_topics_fn( batch_size, n_words=55, n_topics=3, dtype=np.float64, correlated=False ): mean = tf.random.normal([n_topics], dtype=dtype) if correlated: dof = n_topics * (n_topics + 1) // 2 ell = tf.random.normal([dof], dtype=dtype) mdl = tfd.MultivariateNormalTriL( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fake_data(n_docs, n_words, n_sent_length, n_topics):\n # These are log ratios for the doc & word topics\n doc_topics = orthogonal_matrix([n_docs, n_topics])\n wrd_topics = orthogonal_matrix([n_topics, n_words])\n # Multiply log ratios and softmax to get prob of word in doc\n doc_to_wrds = softma...
[ "0.60102993", "0.57279885", "0.56624943", "0.5642761", "0.554409", "0.5533509", "0.54749024", "0.544608", "0.54035926", "0.5394445", "0.5378752", "0.5375638", "0.5372672", "0.5363951", "0.53540754", "0.5348909", "0.53372574", "0.53323054", "0.5322379", "0.532189", "0.5307868"...
0.53648615
13
Obtain the most occurring duplicate rows in the DataFrame.
def get_duplicates(df: pd.DataFrame, supported_columns) -> Optional[pd.DataFrame]: n_head = config["duplicates"]["head"].get(int) if n_head > 0 and supported_columns: return ( df[df.duplicated(subset=supported_columns, keep=False)] .groupby(supported_columns) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_duplicate_rows(df):\n\treturn df.duplicated().sum()", "def find_most_common(df):\n return list(df['hotel_cluster'].value_counts().head().index)", "def Get_dup_records(ds,key_var):\n temp = ds.groupby([key_var]).agg({key_var:'count'}).rename(columns={key_var:'Freq'}).reset_index()\n temp = temp...
[ "0.71041465", "0.6621927", "0.64482075", "0.59977007", "0.59540874", "0.5924099", "0.58198225", "0.58193105", "0.5815351", "0.5643223", "0.55991393", "0.5563188", "0.5556685", "0.55548275", "0.55259687", "0.55153686", "0.5490492", "0.54738134", "0.5449375", "0.54491234", "0.5...
0.6521344
2
Draw the entire plot
def on_update(self): if self.main.data is not None: font = { 'family': str(self.le_font.text()), 'size': int(str(self.le_font_size.text())) } mpl.rc('font', **font) # Clear the plot self.ax.clear() # Get t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __draw(self):\n plt.rcParams.update(self.settings.rcParams)\n\n self.fig = plt.figure()\n self.ax = self.fig.add_axes(self.axes_rect)\n\n xs = np.arange(1, self.xmax+1)\n ys = [np.arange(0, self.ymax) for i in range(self.xmax)]\n\n self.ax.plot(xs, ys)\n\n self....
[ "0.77593386", "0.744799", "0.738159", "0.73762006", "0.7344343", "0.7312454", "0.7309355", "0.7304695", "0.7240875", "0.72356033", "0.72157085", "0.72157085", "0.72157085", "0.72157085", "0.72157085", "0.71430635", "0.71402645", "0.71080464", "0.70965207", "0.7086411", "0.704...
0.0
-1
Copy the current plot to the clipboard
def on_copy(self): path = os.path.dirname(os.path.realpath(__file__)) path = os.path.join(path, 'test.png') self.fig.savefig(path) img = QtGui.QImage(path) QtGui.QApplication.clipboard().setImage(img)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toClipboard(self):\n buf = io.BytesIO()\n self.fig.savefig(buf, dpi=300, facecolor='w', format='png',\n transparent=True)\n QtGui.QApplication.clipboard().setImage(\n QtGui.QImage.fromData(buf.getvalue()))\n buf.close()", "def __editCopy(self):\n...
[ "0.7606093", "0.67240316", "0.6549864", "0.635706", "0.63442725", "0.63283503", "0.63100284", "0.6305897", "0.62985206", "0.62625074", "0.6260492", "0.6237598", "0.6230931", "0.62308145", "0.6198418", "0.6189235", "0.61865187", "0.61849517", "0.6175345", "0.6145666", "0.61348...
0.74077797
1
Some win32 COM magic to interact with powerpoint
def on_to_ppt(self): try: import win32com.client except ImportError: print('ERROR: The win32com library needs to be installed') return # First, copy to the clipboard self.on_copy() # Connect to an open PowerPoint application app = win...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UsePresentation(self, event):\n pass", "def comdlg32_PrintDlgEx(jitter, get_str, set_str):\n ret_ad, args = jitter.func_args_stdcall([\"lppd\"])\n raise RuntimeError('API not implemented')\n jitter.func_ret_stdcall(ret_ad, ret_value)", "def connect():\n Rhino = win32com.client.Dispatch(\"R...
[ "0.52668995", "0.51922184", "0.509907", "0.50320804", "0.4994227", "0.49861234", "0.4938685", "0.49147597", "0.48995832", "0.48588198", "0.48588198", "0.4839947", "0.48387888", "0.48261172", "0.48254737", "0.47565627", "0.4731225", "0.47279295", "0.47279295", "0.4720214", "0....
0.58805686
0
Export the current plot to a file
def on_export(self): path = os.path.dirname(os.path.realpath(__file__)) filters = ('Portable Network Graphics (*.png);;' 'Portable Document Format (*.pdf);;' 'Postscript (*.ps);;' 'Encapsulated Postscript (*.eps);;' 'Scalable V...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_plot(self, ):\n pass", "def save(file_name):\n setup()\n plt.savefig(file_name)", "def save_file(self):\n\n file_name, _ = QFileDialog.getSaveFileName(self, \"Save Experiment Output\", \"\", \"Text Files (*.txt);;CSV Files (*.csv)\")\n plot_name = file_name.split(\".\")[0] +...
[ "0.82230926", "0.75553966", "0.7543578", "0.7473358", "0.74572897", "0.74014264", "0.7289143", "0.7271964", "0.7206692", "0.7201089", "0.7180118", "0.68991715", "0.68895453", "0.6872977", "0.6829215", "0.6811007", "0.6809205", "0.6782367", "0.67744595", "0.67675734", "0.67591...
0.694286
11
Initialise EnsembleHull from a cursor, with other keywords following QueryConvexHull.
def __init__( self, cursor, data_key, energy_key="enthalpy_per_atom", chempot_energy_key=None, num_samples=None, parameter_key=None, species=None, voltage=False, verbosity=None, **kwargs, ): # sometimes the first hull ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convex_hull(self):\n nodes = self._datacontroller.get_data('nodes')\n scale = self._datacontroller.get_data('scale')\n hull = tsputil.convex_hull_helper(nodes)\n if hull:\n result = construct_step(hull, 'Most Top Left Node', 'Clockwise', nodes, scale)\n self._d...
[ "0.56471527", "0.5645025", "0.560803", "0.55001235", "0.5461656", "0.5383847", "0.52694416", "0.5206169", "0.5176081", "0.5166029", "0.51593155", "0.5150027", "0.5116916", "0.5103227", "0.5053244", "0.50198245", "0.49959636", "0.4989708", "0.49692374", "0.49644575", "0.493446...
0.571932
0
Creates a histogram that counts how many times each structure is found to be stable in the ensemble.
def generate_stability_statistics(self, group_by="structure"): from collections import defaultdict histogram = defaultdict(int) for pd in self.phase_diagrams: for doc in pd.stable_structures: if group_by == "formula": histogram[get_formula_from_st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_histogram(iterator, key):\n buckets = defaultdict(int)\n values = {}\n\n num_objects = 0\n for obj in iterator:\n num_objects += 1\n\n try:\n val = obj[key]\n except (KeyError, TypeError):\n continue\n\n value_hash = hashlib.sha1()\n va...
[ "0.63627726", "0.6352377", "0.6288616", "0.62625545", "0.6225235", "0.6221272", "0.6221272", "0.6166877", "0.6086975", "0.6064678", "0.6055093", "0.60502535", "0.6042109", "0.6033234", "0.60054344", "0.6002974", "0.5989935", "0.596553", "0.5952552", "0.5952456", "0.59200233",...
0.6267253
3
Hull plot helper function.
def plot_hull(self, **kwargs): from matador.plotting.hull_plotting import plot_ensemble_hull return plot_ensemble_hull( self, self.data_key, formation_energy_key=self.formation_key, **kwargs )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __plot_convex_hull(self, ax=None) -> None:\n ax.plot(self.points[:, 0], self.points[:, 1], \"o\")\n for simplex in self.hull.simplices:\n ax.plot(self.points[simplex, 0], self.points[simplex, 1], \"k-\")", "def convex_hull(points):\n\n # Sort the points lexicographically (tuples a...
[ "0.72648054", "0.71242744", "0.675127", "0.6645084", "0.6607129", "0.6524251", "0.64874196", "0.64434457", "0.6329919", "0.6279547", "0.621393", "0.6190576", "0.61847645", "0.6131978", "0.6116441", "0.6116435", "0.61010134", "0.6088186", "0.60798055", "0.6066331", "0.59839064...
0.6888191
2
This function generates a voronoi centroid point list from arrays of latitude and longitude
def _get_voronoi_centroid_array(lsm_lat_array, lsm_lon_array, extent): YMin = extent[2] YMax = extent[3] XMin = extent[0] XMax = extent[1] ptList = [] if (lsm_lat_array.ndim == 2) and (lsm_lon_array.ndim == 2): # generate point list with 2D lat lon lists if extent: #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pointsToVoronoiGridArray(lat, lon, extent=None):\n voronoi_centroids = _get_voronoi_centroid_array(lat, lon, extent)\n # find nodes surrounding polygon centroid\n # sort nodes in counterclockwise order\n # create polygon perimeter through nodes\n log(\"Building Voronoi polygons...\")\n # comp...
[ "0.65372", "0.6385518", "0.6369866", "0.6352986", "0.63227725", "0.6310845", "0.6269614", "0.62459695", "0.62092495", "0.6206954", "0.6184177", "0.6160597", "0.61529094", "0.61167246", "0.6113499", "0.6096009", "0.6049528", "0.60330814", "0.60061824", "0.6005695", "0.5998281"...
0.7456306
0
This function returns the corner points for a polygon from scipy voronoi information
def _get_voronoi_poly_points(vert_index_list, voronoi_vertices, voronoi_centroid): voronoi_poly_points = [] if -1 not in vert_index_list and len(vert_index_list) > 3: voronoi_poly_points = voronoi_vertices[vert_index_list] elif vert_index_list.size > 0: # ASSUME ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def voronoi_polygons(self, voronoi, radius=None):\n\n if voronoi.points.shape[1] != 2:\n raise ValueError(\"Requires 2D input\")\n\n new_regions = []\n new_vertices = voronoi.vertices.tolist()\n\n center = voronoi.points.mean(axis=0)\n if radius is None:\n r...
[ "0.68197215", "0.670755", "0.67009354", "0.6434472", "0.62601817", "0.6184525", "0.6176979", "0.61670077", "0.61580414", "0.6120427", "0.60982144", "0.6064844", "0.60642666", "0.6035292", "0.6015687", "0.60129887", "0.60129887", "0.600831", "0.5997366", "0.59831345", "0.59699...
0.78336376
0
Converts points to shapefile grid via voronoi
def pointsToVoronoiGridShapefile(lat, lon, vor_shp_path, extent=None): voronoi_centroids = _get_voronoi_centroid_array(lat, lon, extent) # set-up output polygon shp log("Creating output polygon shp {0}" .format(os.path.basename(vor_shp_path))) if os.path.exists(vor_shp_path): os.remove(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def voronoi(points, buffer_percent=100):\n # Remove duplicate xy points bc that would make delauney fail, and must remember z (if any) for retrieving originals from index results\n seen = set() \n uniqpoints = [ p for p in points if str( p[:2] ) not in seen and not seen.add( str( p[:2] ) )]\n classpoin...
[ "0.73642546", "0.6624605", "0.6493146", "0.64552146", "0.64445776", "0.6433658", "0.6414309", "0.64070576", "0.62853026", "0.62327176", "0.6230993", "0.6223746", "0.6214373", "0.6130584", "0.6109224", "0.6064484", "0.60588217", "0.60203505", "0.6009164", "0.5995349", "0.59607...
0.77111614
0
Converts points to grid array via voronoi
def pointsToVoronoiGridArray(lat, lon, extent=None): voronoi_centroids = _get_voronoi_centroid_array(lat, lon, extent) # find nodes surrounding polygon centroid # sort nodes in counterclockwise order # create polygon perimeter through nodes log("Building Voronoi polygons...") # compute voronoi ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def voronoi(points, buffer_percent=100):\n # Remove duplicate xy points bc that would make delauney fail, and must remember z (if any) for retrieving originals from index results\n seen = set() \n uniqpoints = [ p for p in points if str( p[:2] ) not in seen and not seen.add( str( p[:2] ) )]\n classpoin...
[ "0.7390621", "0.6877065", "0.67941904", "0.66441345", "0.66243017", "0.65572363", "0.65515393", "0.65475076", "0.6483277", "0.6442599", "0.6416807", "0.6381285", "0.6378487", "0.63503474", "0.634898", "0.62505853", "0.6236391", "0.61788255", "0.61699975", "0.6052225", "0.6026...
0.7085668
1
Execute ore to upload the tarball and register the image
def gcp_run_ore(build, args): arg_exp_str = "parameter '--{}' or envVar '{}' must be defined" if args.bucket is None: raise Exception(arg_exp_str.format("bucket", "GCP_BUCKET")) if args.json_key is None: raise Exception(arg_exp_str.format("json-key", "GCP_JSON_AUTH")) if args.project is ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload():\n sh('python setup.py register sdist upload')", "def push(self) -> None:\n\n with ImportExtensions(required=True):\n import requests\n\n pkg_path = Path(self.args.path)\n if not pkg_path.exists():\n self.logger.critical(f'`{self.args.path}` is not a val...
[ "0.6445943", "0.6345193", "0.6112207", "0.60838425", "0.60793", "0.60702914", "0.60136545", "0.5944828", "0.5930545", "0.5895048", "0.5834163", "0.5818871", "0.5809871", "0.5761869", "0.5721698", "0.5712487", "0.57094765", "0.56582814", "0.56502765", "0.5649153", "0.56359637"...
0.5593222
25
Extend a parser with the GCP options
def gcp_cli(parser): parser.add_argument("--bucket", help="Storage account to write image to", default=os.environ.get("GCP_BUCKET")) parser.add_argument("--json-key", help="GCP Service Account JSON Auth", default=os....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setupParserOptions(self):\n\t\treturn", "def add_options(cls, parser):\n pass", "def add_options(self, parser):\n pass", "def setup_parser(cls, option_group, args, mkflag):", "def setup_parser(cls, option_group, args, mkflag):", "def parse_options(self, options):\n pass", "def ...
[ "0.6701871", "0.66601294", "0.65994394", "0.6569085", "0.6569085", "0.6527695", "0.6483356", "0.648255", "0.64565897", "0.64239097", "0.64224505", "0.6420105", "0.6396288", "0.6383029", "0.6342312", "0.63168025", "0.6312604", "0.62959886", "0.6274193", "0.6250876", "0.6232706...
0.0
-1
Instantiates and returns the list of permissions that this view requires.
def get_permissions(self): if self.action == 'list': permission_classes = [IsAuthenticated] else: permission_classes = [IsAdminUser] return [permission() for permission in permission_classes]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_permissions(self):\n if self.action in ['list', 'retrieve']:\n permission_classes = [IsAuthenticated]\n else:\n permission_classes = [IsAdminUser]\n return [permission() for permission in permission_classes]", "def get_permissions(self):\n if self.action ...
[ "0.7738158", "0.76905394", "0.7635271", "0.7618894", "0.7523193", "0.7523193", "0.7523193", "0.7497525", "0.74957764", "0.74865115", "0.7463958", "0.7431705", "0.7412355", "0.7407442", "0.7388661", "0.73826563", "0.73599124", "0.73599124", "0.7338907", "0.73276186", "0.73226"...
0.77929497
0
Check if original word matches encoded word.
def _does_words_matches(original_word: str, encoded_word: str) -> bool: return( len(original_word) == len(encoded_word) and original_word[0] == encoded_word[0] and original_word[-1] == encoded_word[-1] and sorted(original_word[1:-1]) == sorted(encoded_word[1:-1]) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(self, word):\n length = len(word)\n if length == 1:\n for letter in string.ascii_lowercase:\n key = \"{}/{}\".format(1, letter)\n if key in self.origin and letter != word:\n return True\n return False\n\n key = \...
[ "0.6823817", "0.6497194", "0.64674133", "0.6466808", "0.6456004", "0.6433033", "0.6371502", "0.6352263", "0.63260645", "0.62544364", "0.6197851", "0.61972284", "0.6180082", "0.609289", "0.6079167", "0.60727626", "0.6068379", "0.60665554", "0.6060675", "0.6059112", "0.6057214"...
0.8261765
0
Decode sentence encoded with encoder.encode method.
def decode(sentence: str) -> str: decoded_sentence = '' validate_sentence(sentence) encoded_sentence, original_words_str = sentence[ len(SEPARATOR):].split(SEPARATOR) encoded_words = TOKENIZER_RE.split(encoded_sentence) original_words = original_words_str.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(self, encoded):", "def decode(self, s):", "def decode(self, s):", "def decode():\n with tf.Session() as sess:\n # Create model and load parameters.\n model = create_model(True)\n model.batch_size = 1 # We decode one sentence at a time.\n init_model(sess, model)\n\n ...
[ "0.71830916", "0.69393015", "0.69393015", "0.68883383", "0.65182525", "0.65182525", "0.63291436", "0.63272095", "0.62871397", "0.6197337", "0.6123003", "0.6121859", "0.6107391", "0.5994099", "0.5978425", "0.59513134", "0.5930908", "0.5929146", "0.5859886", "0.5859116", "0.582...
0.659247
4
Return a dictionary containing input indices as keys.
def return_index(self, input_index: int, output_index: int, input_string: str, output_string: str, original_str: str, intermediate_index: dict) -> Dict[int, Dict[str, str]]: intermediate_index = copy.deepcopy(intermediate_index) # (n)one-to-(n)one if len...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_dict(self):\n msk = self.load_mask()\n mski = enumerate(msk)\n ifiltered = (i for (i, m) in mski if m == 1)\n return {i: j for (j, i) in enumerate(ifiltered)}", "def index_dict(self):\n msk = self.load_mask()\n mski = enumerate(msk)\n ifiltered = (i for ...
[ "0.7376745", "0.7376745", "0.68859404", "0.6614742", "0.65970737", "0.65850186", "0.644078", "0.6436385", "0.6332246", "0.63185793", "0.62937194", "0.6284356", "0.62446797", "0.6205429", "0.619118", "0.6178936", "0.6165062", "0.6141704", "0.6120503", "0.61143786", "0.6100224"...
0.0
-1
Apply all the rules in self.mapping sequentially.
def apply_rules(self, to_convert: str, index: bool = False, debugger: bool = False) -> Union[str, Tuple[str, Indices]]: indices = {} rules_applied = [] if not self.case_sensitive: to_convert = to_convert.lower() if self.norm_form: to_convert = normalize(to_conve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applyMapping(self):\n pass", "def apply_rules(self):\n if len(self.rules) == 0:\n return\n for gene in self.population:\n for rule in self.rules:\n if rule.type == \"gene\":\n rule.check_and_apply(gene)", "def update_acc_by_rules(...
[ "0.6870016", "0.6807365", "0.6359072", "0.5989758", "0.59754294", "0.5941417", "0.5922669", "0.5870509", "0.5850322", "0.56956595", "0.5693735", "0.56777894", "0.56363416", "0.56088626", "0.56088626", "0.55772895", "0.5564215", "0.5534191", "0.55324304", "0.55242485", "0.5508...
0.0
-1
Add a filter condition
def do_add(self, args): if len(args) == 0: self.parent.printErr("Missing argument(s)") return False def try_add(ftype, fvalue): if ftype == "has" and value not in self.FILTER_HAS_ARGUMENTS: self.parent.printErr("Could not add '%s': Invalid filter argument" % (fvalue)) return False elif ftype not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_filter(self, f):\n raise NotImplementedError", "def append_crds_filter(self, filter):\n if filter not in self.filters:\n self.filters = self.filters + [filter]", "def add_filter(self, name: str, value: any):\n self.filters[name] = value", "def add_filter(self, label):\...
[ "0.7320016", "0.6955272", "0.69102764", "0.6869964", "0.6778317", "0.67044574", "0.659386", "0.64774996", "0.6473486", "0.64462256", "0.64094585", "0.6396877", "0.63724196", "0.63635975", "0.63545793", "0.63013667", "0.6236209", "0.62223536", "0.6185292", "0.6181667", "0.6174...
0.0
-1
Set a filter condition
def do_set(self, args): if len(args) == 0: self.parent.printErr("Missing argument(s)") return False args = args.split() ftype = args[0] values = " ".join(args[1:]) if ftype not in self.SET_ARGUMENTS: self.parent.printErr("Invalid argument: %s" % (ftype)) return False if values not in self.SET_A...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(self, filter):\n self._filter = filter", "def setFilter(self, type: int, filter: int) -> None:\n ...", "def setFilter(self, afilter):\n\n if afilter in (self.FilterU, self.FilterG, self.FilterR, self.FilterI, self.FilterZ, self.FilterY):\n self.filter = afilter\n ...
[ "0.72871226", "0.7082709", "0.6731277", "0.66711164", "0.66606605", "0.6547762", "0.6492684", "0.64741904", "0.6388909", "0.63713723", "0.6349744", "0.6324059", "0.6318113", "0.62171096", "0.61462915", "0.6141084", "0.61403936", "0.613226", "0.6124676", "0.61213964", "0.61182...
0.0
-1
Remove a filter condition
def do_del(self, args): args = args.split() if not args: self.parent.printErr("Missing argument(s)") return False ftype = args[0] values = args[1:] try: if len(values) == 0: del self.parent.filter[ftype] else: for value in values: try: self.parent.filter[ftype].remove(value) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_crds_filter(self, filter):\n if filter in self.filters:\n self.filters.remove(filter)", "def removeAutoSaveFilter(filter):", "def removeAutoSaveDeleteFilter(filter):", "def remove_filter_field(self, field):\n if self.filters:\n category_filter = self.filters.get...
[ "0.76162535", "0.70678407", "0.68647385", "0.65887207", "0.6549521", "0.6409385", "0.6278248", "0.6273095", "0.62444645", "0.62345153", "0.62262887", "0.62140304", "0.61754817", "0.6133612", "0.61193436", "0.60502726", "0.60375565", "0.600674", "0.59830534", "0.5902867", "0.5...
0.0
-1
List available commands with 'help' or detailed help with 'help '.
def do_help(self, arg): if arg: funcarg = arg.replace(" ", "_") try: func = getattr(self, 'help_' + funcarg) except AttributeError: try: doc=getattr(self, 'do_' + funcarg).__doc__ if doc: self.stdout.write("%s\n"%str(doc)) return except AttributeError: pass self.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help_help(self):\n print(\"List commands or print details about a command\")", "def command_help(self, *args, **kwargs):\n print(\"Commands available:\\n\")\n for name in dir(self):\n if not name.startswith(\"command_\"):\n continue\n name_clean = nam...
[ "0.88306653", "0.85278547", "0.8374269", "0.81042904", "0.80777556", "0.8062357", "0.8029705", "0.7955193", "0.79127324", "0.79102737", "0.7904455", "0.7891752", "0.78172946", "0.78154", "0.7801859", "0.7791199", "0.7773003", "0.77717626", "0.7761225", "0.7751631", "0.7688721...
0.7344574
67
Remove all filter conditions
def do_reset(self, args): self.parent.filter = {} self.apply_filter() self._update_prompts()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(self, filters):", "def filter_all(_):\n return True", "def reset_filter(self):\n arlen = len(self.variant_list)\n self.filter = np.zeros((arlen, arlen)) == 0", "def filter(self, filter_dict):\n pass", "def removeAutoSaveFilter(filter):", "def filter_data(self):\n ...
[ "0.72743833", "0.68908715", "0.6815627", "0.67424655", "0.6691591", "0.65708435", "0.65384483", "0.6527705", "0.650927", "0.64387804", "0.6348202", "0.63146204", "0.6306806", "0.63063633", "0.6216846", "0.6182027", "0.6143951", "0.61240137", "0.60571593", "0.60439235", "0.602...
0.0
-1
Determine whether a data binding is of the appropriate type and format.
def isvalid(type, binding, fetch=True, **kwargs): kwargs = kwargs.copy() kwargs['auto_convert'] = False kwargs['validate'] = False analysis = get_validator_analysis(Validator(type, binding['format'])) outputs = run(analysis, {'input': binding}, fetch=fetch, **kwargs) return outputs['output']['d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _has_numeric_or_bool(self) -> bool:\n dtypes: Set[str] = set(self._data.keys())\n return 'i' in dtypes or 'f' in dtypes or 'b' in dtypes", "def isdatatype(object):\n return isinstance(object, (str, int, bool, float, type(None)))", "def _type_check_double(self, data):\n if type(data)...
[ "0.6223285", "0.6189173", "0.6107559", "0.60485756", "0.59289765", "0.5921664", "0.59216315", "0.58960766", "0.5890562", "0.58866364", "0.58792275", "0.5872497", "0.5869114", "0.58285296", "0.58271784", "0.5789367", "0.57888556", "0.5770035", "0.57668763", "0.5721911", "0.569...
0.6020364
4
Convert data from one format to another.
def convert(type, input, output, fetch=True, status=None, **kwargs): kwargs = kwargs.copy() kwargs['auto_convert'] = False if fetch: input['data'] = io.fetch(input, **kwargs) if input['format'] == output['format']: data = input['data'] else: data_descriptor = input ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertData(data):\n\n return data", "def _get_converted_data(self):\n pass", "def transform(self, data):", "def convert(self, other):\n pass", "def convert(data, to):\n converted = None\n if to == 'array':\n if isinstance(data, np.ndarray):\n converted = da...
[ "0.7114094", "0.64868015", "0.6396119", "0.62465113", "0.61797225", "0.6072322", "0.6057339", "0.60300004", "0.5995171", "0.59841365", "0.5978683", "0.5911665", "0.5908059", "0.5862227", "0.58611584", "0.5809141", "0.5808851", "0.5808677", "0.5757577", "0.56230116", "0.561206...
0.5155527
62
Create a decorators factory (decorator itself). The factory accepts a function (lambda) as an input and returns a decorator that will return the result of the function as the first argument, the result of the decorated function is passed. The function which the factory accepts (in the example below it is a `lambda`) ca...
def apply(func: Callable): def decorator(wrapped_func: Callable): def wrapper(*args, **kwargs): return func( wrapped_func(*args, **kwargs) ) return wrapper return decorator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _function_factory(name: str, _command_type: type) -> Callable:\n\n def _new_func(**kwargs) -> None:\n \"\"\"Actual execution starter.\n\n We need so many wrappers because all those decorators\n could not be applied in a simple cycle. Last applied\n instance will just overwrite al...
[ "0.6920388", "0.63988346", "0.63499737", "0.61898935", "0.60974675", "0.59654754", "0.5951429", "0.58779454", "0.5823041", "0.5817788", "0.56814325", "0.5610465", "0.55802304", "0.55800915", "0.55653507", "0.5541751", "0.55168056", "0.5484077", "0.5475037", "0.5472731", "0.54...
0.49178922
71
Filter log records with stack traces. Multiline messages must be processed differently than those of standard application logs.
def filter(self, record): if record.exc_info: is_included = 0 else: is_included = 1 return is_included
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_stack_trace_logs(\n self, log_lines: List[str], application: str\n ) -> List[str]:\n\n # Search for the known crash/stack file marker\n LOG.debug(f\"Extracting crash stack traces from {application} log\")\n for idx, log in enumerate(log_lines):\n # This marker ...
[ "0.6531771", "0.60258055", "0.57975245", "0.56572425", "0.5582351", "0.5303621", "0.5278194", "0.5270556", "0.52677524", "0.5258347", "0.5241843", "0.52294147", "0.5205558", "0.51737654", "0.5148116", "0.5102461", "0.5092486", "0.5062234", "0.504904", "0.5035688", "0.5020069"...
0.45750955
71
Context manager for collecting runtime data. See the README section on Examples for more details.
def __init__(self, next_frame_name): self._next_frame_name = next_frame_name # A depth of 0 returns the frame at the top of the call stack. # An offset is therefore required to account for calling the # Tracer itself. self._current_frame = sys._getframe(1) self._previous...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def context_started(self, cls, example):", "def __init__(self):\n self._data = dict() # stores the data in the context\n self._last_context = None # stores previous context if the current one is used in a with block\n self._thread_id = self._get_thread_id(...
[ "0.60875124", "0.60169476", "0.59946185", "0.59126204", "0.5874837", "0.58475924", "0.5845038", "0.58297396", "0.5684618", "0.5673435", "0.5644431", "0.5611183", "0.55998546", "0.5590673", "0.5575626", "0.5567212", "0.55456126", "0.55155605", "0.55095476", "0.5500103", "0.549...
0.0
-1
Convert the object into a serializable primitive. Returns dict
def to_json(self): data = { 'next_frame_name': self._next_frame_name, 'current_frame_file_path': self._current_frame.f_code.co_filename, 'current_frame_line_number': self._current_frame.f_lineno, 'current_frame_name': self._current_frame.f_code.co_name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_obj(self):\n return dict()", "def dict(self):\n return objToDict(self)", "def realized(self):\n result = {\"Object\": True}\n for key in self.__dict__:\n if isinstance(self.__dict__[key], Object):\n result[key] = self.__dict__[key].asdict()\n ...
[ "0.7387259", "0.7290816", "0.7202115", "0.7008207", "0.6972943", "0.69579923", "0.6957049", "0.6866749", "0.68591046", "0.6849841", "0.68327343", "0.6811414", "0.6793216", "0.6789673", "0.67794603", "0.67794603", "0.67794603", "0.67794603", "0.67794603", "0.67794603", "0.6779...
0.0
-1
Tests if we can actually talk to the CircleCI PostgreS instance
def test_database(): conn = psycopg2.connect(host=DB_HOST, port=DB_PORT, dbname=DB_NAME, user=DB_USER, password=DB_PASS) cur = conn.cursor() # Create table cur.execute("CREATE TABLE test (id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_postgresql_connect_fail(self):\n if _is_backend_avail('postgresql', user=\"openstack_cifail\"):\n self.fail(\"Shouldn't have connected\")", "def test_postgresql_connect_fail(self):\n if test_migrations._is_backend_avail(\n 'postgres', 'kickstand_cifail', self.PASS...
[ "0.70803386", "0.6899531", "0.68414414", "0.6723227", "0.6564367", "0.6487806", "0.6434857", "0.6415995", "0.6398834", "0.6395887", "0.6354604", "0.63163835", "0.629356", "0.62251985", "0.6210736", "0.6197262", "0.61967343", "0.6148353", "0.614586", "0.6142585", "0.61403704",...
0.0
-1
Extract the variable and wrap it in a stream.
def extracted(self, variable, timestep): try: process = cmd_run(cmd_make(variable, self.uda, timestep)) except subprocess.CalledProcessError: print("The timestep {timestep} was not found in {uda}" " and was therefore ignored.".format(timestep=timestep, uda=self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_variable_value(variable):\n def pipeline_from_info(variableinfo):\n controller = variableinfo._controller\n version = controller.vistrail.get_version_number(\n 'dat-var-%s' % variable.name)\n return controller.vistrail.getPipeline(version), version\n\n def pipeline_fro...
[ "0.5547266", "0.53885806", "0.53768164", "0.5351466", "0.5347634", "0.53024673", "0.5286729", "0.52457756", "0.52190644", "0.51141566", "0.50830096", "0.5061464", "0.49422723", "0.49422723", "0.4932786", "0.4878473", "0.48528296", "0.48392415", "0.48339707", "0.4821986", "0.4...
0.5781148
0
Generate a list of timestep indices. If a list of timesteps is provided, return the index of the bestfitting timestep. If instead the caller wants every nth timestep, the list of timesteps is generated from the frequency. If the caller wants a total of N samples, the list of timesteps returned contains N + 1 timesteps,...
def get_timesteps(self, timesteps=None, every=None, samples=None): timedict = self.generate_timedict() if samples is not None: stride = len(timedict) // samples return [str(i) for i in range(0, len(timedict), stride)] elif every is not None: max_time_index = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_steps_by_times(times,chosen_times):\n\n time_steps = []\n chosen_index = 0\n for i in range(len(times)):\n if times[i] >= chosen_times[chosen_index]:\n time_steps.append(i)\n chosen_index += 1\n if chosen_index == len(chosen_times): #We're done\n return time_steps\n if chosen_i...
[ "0.62273204", "0.61630476", "0.5811249", "0.56252664", "0.54821074", "0.54376155", "0.5382979", "0.5318907", "0.5290574", "0.5282313", "0.5265857", "0.5237639", "0.5224652", "0.52216583", "0.5208017", "0.5204625", "0.51511866", "0.5112422", "0.51089954", "0.51061344", "0.5036...
0.6946111
0
Assemble the command line instruction to extract variable. If timestep is provided, the timestep options are included in the command. Time can be a list as [mintime, maxtime], and returns results inbetween as well. Time can be a single float value, in which case only the snapshot is returned. This function should be in...
def cmd_make(var, uda, timestep=None): cmdargs = ["-partvar", var] if timestep: if not isinstance(timestep, list): timestep = [timestep] cmdargs.extend([ "-timesteplow", str(min(timestep)), "-timestephigh", str(max(timestep)) ]) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extracted(self, variable, timestep):\n try:\n process = cmd_run(cmd_make(variable, self.uda, timestep))\n except subprocess.CalledProcessError:\n print(\"The timestep {timestep} was not found in {uda}\"\n \" and was therefore ignored.\".format(timestep=times...
[ "0.55020946", "0.52989984", "0.49934685", "0.4907491", "0.48960564", "0.482947", "0.4793823", "0.47426504", "0.4690532", "0.4642535", "0.46189365", "0.45930195", "0.45800135", "0.45407873", "0.4529616", "0.45236787", "0.4522197", "0.4518992", "0.4496263", "0.4483122", "0.4449...
0.47799358
7
Shortcut for the long and winding subprocess call output decoder.
def cmd_run(cmd): return subprocess.run( cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True).stdout.decode("utf-8")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd(args):\n return subprocess.check_output(args).decode(\"utf-8\")", "def _run_cmd(args, cwd):\n p = subprocess.Popen(\n args, stdin=subprocess.PIPE, stdout=subprocess.PIPE,\n stderr=subprocess.PIPE, cwd=cwd)\n streams = tuple(s.decode('latin1').strip() for s in p.communicate())\n ...
[ "0.59607446", "0.5693977", "0.56818235", "0.5655966", "0.5633082", "0.55249584", "0.5523715", "0.5523092", "0.55009043", "0.5493441", "0.54856473", "0.5449936", "0.5401454", "0.5393981", "0.53768855", "0.5362725", "0.5354375", "0.5344374", "0.53303695", "0.53295946", "0.53125...
0.48390943
76
Parse isbn from url querystring
def parse_isbn_url(url): parts = urlparse.urlparse(url) query = urlparse.parse_qs(parts.query) if ISBN_QS_KEY in query and len(query[ISBN_QS_KEY]): return query[ISBN_QS_KEY][0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isbn_lookup(isbn):\n base = \"https://www.googleapis.com/books/v1/volumes?q=isbn=\"\n# Unfortunately we can't use the superior \"with spam as eggs\" syntax here...\n search = urlopen(base + isbn + \"&prettyprint=false\")\n lines = search.read()\n search.close()\n for bool_pair in [(\"false\", \"...
[ "0.63817704", "0.63102347", "0.6045895", "0.5558513", "0.5465694", "0.54510826", "0.5408801", "0.53625476", "0.53564936", "0.5326564", "0.5249726", "0.52439344", "0.52134913", "0.52124333", "0.5165924", "0.5154762", "0.51323634", "0.5130722", "0.508087", "0.5070255", "0.50632...
0.8076228
0
Sets the current pose to the start pose. Doesn't move the robot.
def reset_pose(self): loginfo("Resetting pose.") req = PoseWithCovarianceStamped() req.header = Header(stamp=Time.now(), frame_id='/map') req.pose.pose = self._x_y_yaw_to_pose(self._start_x, self._start_y, self._start_yaw) req.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self, start_pose: np.ndarray) -> NoReturn:\n self._pose = start_pose", "def set_to_start(self) -> None:\n start_config = self._path_points[0]\n self._mobile.set_2d_pose(start_config[:3])\n self._path_done = False", "def set_start_position(self) -> None:\n self.cozmo...
[ "0.76283246", "0.7573792", "0.73643184", "0.7146873", "0.7074296", "0.7046799", "0.7001277", "0.7001277", "0.7001277", "0.6842821", "0.6816941", "0.6769608", "0.6753545", "0.67295164", "0.66798276", "0.6642579", "0.64370704", "0.6358715", "0.63499314", "0.633923", "0.6288679"...
0.7210527
3
Moves to the given x, y, and yaw in map coordinates.
def go_to(self, x_map, y_map, yaw_map): loginfo("Going to pose x = %s, y = %s, yaw = %s." % (x_map, y_map, yaw_map)) goal = MoveBaseGoal() goal.target_pose.header = Header(stamp=Time.now(), frame_id = '/map') goal.target_pose.pose = self._x_y_yaw_to_pose(x_map, y_map...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, pitch: float, yaw: float):\n move_pitch = pitch - self.pitch\n move_yaw = yaw - self.yaw\n\n while move_pitch != 0 or move_yaw != 0:\n if (move_pitch > 0 and move_pitch < (STEP_DEGREES / 2)) or (move_pitch < 0 and -move_pitch < (STEP_DEGREES / 2)):\n mo...
[ "0.6938535", "0.6257815", "0.62501764", "0.6088437", "0.59798133", "0.59639096", "0.59628", "0.596222", "0.5912571", "0.5895394", "0.5874179", "0.5847769", "0.57818645", "0.5766529", "0.5648399", "0.55993503", "0.5585821", "0.558317", "0.5575346", "0.55749583", "0.55735433", ...
0.64824414
1
get the battery voltage
def get_voltage(self): print("voici le voltage de la batterie")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBatteryVoltage(self):\n return self.values[BATTERY_VOLTAGE]", "def get_voltage(self):\n status = self.get_status_response()\n volts = status[20] + (status[21] * 0x100) + (status[22] * 0x10000) + (status[23] * 0x1000000)\n volts = float(volts)\n volts /= (1000.0 * 1000.0)...
[ "0.86550456", "0.8127854", "0.7928992", "0.78065944", "0.77453196", "0.7619697", "0.7566325", "0.7537705", "0.7511109", "0.747756", "0.74493533", "0.7421177", "0.74002737", "0.73456454", "0.73354095", "0.7327306", "0.7295995", "0.7285319", "0.7237761", "0.72339785", "0.717703...
0.8460618
1
Fixe la vitesse d'un moteur en nombre de degres par seconde
def set_motor_dps(self, port, dps): if not (isinstance(port, int)): print("le port passé doit être un int, ca n'est pas le cas") elif not (isinstance(dps, int)): print("le dps passé doit être un int, ca n'est pas le cas") else: print("le moteur " + str(port)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_lineEdit_u_moyens_mesure_textChanged(self, p0):\n u_moyens = np.sqrt(float(self.lineEdit_u_moyens_mesure.text()))\n self.lineEdit_u_moyens.setText(str(u_moyens))\n \n for ligne in range(9):\n \n item = QtGui.QTableWidgetItem(str(u_moyens))\n s...
[ "0.5980366", "0.58465487", "0.58388746", "0.57756543", "0.57584697", "0.5739366", "0.5739307", "0.572274", "0.5718118", "0.57175946", "0.5687547", "0.56587934", "0.56018186", "0.5593999", "0.559111", "0.5558186", "0.5539442", "0.5535778", "0.5529928", "0.5514718", "0.5510163"...
0.0
-1
Lit les etats des moteurs en degre.
def get_motor_position(self): print("voici la position du moteur")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mezclar_bolsa(self):", "def cellules(self): # itérateur rendu safe\n cellule_courante = self.tete\n while cellule_courante is not None:\n cellule_suivante = cellule_courante.suivant # sauvegarde\n yield cellule_courante\n cellule_courante = cellule_suivante # ré...
[ "0.6055225", "0.60215896", "0.59027433", "0.58529854", "0.5663609", "0.5645166", "0.55688685", "0.5566209", "0.55532664", "0.55422026", "0.5534982", "0.55191433", "0.5470199", "0.5469051", "0.54583985", "0.54471", "0.54386014", "0.54367566", "0.541074", "0.5397518", "0.539320...
0.0
-1
Fixe l'offset des moteurs (en degres) (permet par exemple de reinitialiser a 0 l'etat du moteur gauche avec offset_motor_encode(self.MOTOR_LEFT,self.read_encoders()[0])
def offset_motor_encoder(self, port, offset): if not (isinstance(port, int)): print("le port passé doit être un int, ca n'est pas le cas") elif not (isinstance(offset, int)): print("l'offset passé doit être un int, ca n'est pas le cas") else : print("...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _change_offset(self, value, direction):\n if direction == 1:\n if value >= self.POSITIONS-1:\n value = 0\n else:\n value += 1\n elif direction == -1:\n if value == 0:\n value = self.POSITIONS-1\n else:\n ...
[ "0.5942462", "0.5827062", "0.57833177", "0.5647549", "0.55279064", "0.55191183", "0.55130816", "0.5497624", "0.54105806", "0.5408701", "0.538775", "0.53876925", "0.53823066", "0.5352017", "0.53499883", "0.5324033", "0.53148234", "0.5283687", "0.527997", "0.52785933", "0.52719...
0.6282114
0
Lit le capteur de distance (en mm).
def get_distance(self): print("voici la distance à l'obstacle")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distmeter(self):\n return self._distance.to(\"m\").value", "def distance():\n return str(us.get_distance())", "def convertDistance(self, mm):\n\t\treturn mm/(self.microstep)", "def get_distance(self) -> int:\n return self.get_measurement_data().distance", "def calc_time(self, distance)...
[ "0.7376884", "0.7073833", "0.69406843", "0.6809358", "0.67730165", "0.67294645", "0.6682598", "0.66707164", "0.6631686", "0.6629515", "0.6608616", "0.6550821", "0.6542114", "0.65061015", "0.649578", "0.6476012", "0.64298254", "0.64225173", "0.64225173", "0.64225173", "0.64225...
0.68658257
3
Tourne le servo a l'angle en parametre.
def servo_rotate(self,position): if not(isinstance(position, int)): print("la position passée doit être un int, ca n'est pas le cas") elif (position < 0) or (position > 180): print("la position passée doit être entre 0 et 180 degrès, ca n'est pas le cas", e) else...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_param_motor():\n servo.setSpeed(0, 0) # max = 255\n servo.setAccel(0, 0)\n servo.setSpeed(1, 150) # max = 255\n servo.setAccel(1, 150)", "def servo_force(self, *args, **kwargs) -> Any:\n pass", "def servo_vmax(self, *args, **kwargs) -> Any:\n pass", "def servo_active(s...
[ "0.752218", "0.69889224", "0.6733783", "0.64845175", "0.6435678", "0.62595946", "0.62264234", "0.62247854", "0.61952895", "0.6178397", "0.60382855", "0.59854555", "0.5982937", "0.59416366", "0.58504766", "0.58346975", "0.5829404", "0.5828003", "0.58223003", "0.57286364", "0.5...
0.62540394
6
calls CURL to pull the file from a given URL URL is the target URL on remote FILE is the output file location on local
def download(FILE,URL): CMD = ['curl','-o',FILE,URL] call(CMD)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_retrieve(url, output_file):\n r = requests.get(url, allow_redirects=True)\n if r.status_code != 200:\n raise ConnectionError(f\"Could not download {url}\\nError code: {r.status_code}\")\n\n output_file.write_bytes(r.content)", "def get_remote_file(url):\n # Disable the proxies by not t...
[ "0.74769384", "0.7252042", "0.7239829", "0.71526814", "0.7101987", "0.7098477", "0.7090487", "0.699232", "0.6973781", "0.69418174", "0.6901856", "0.68841106", "0.688299", "0.6854513", "0.6851065", "0.68380386", "0.6809919", "0.6761908", "0.6742494", "0.6732254", "0.66787374",...
0.76820236
0
The main route of the app.
def index(args): if args.get('postcode'): query_result = Postcodes.select().where( Postcodes.postcode.contains(args['postcode']) ) elif args.get('nearby') and args.get('radius'): all_coordinates = Postcodes.select().where( Postcodes.longitude, Postcodes.latitude ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route(self):\n pass", "def root(self):\n return self.app.get('/',headers=self.headers)", "def index():\n print('This is the root of the app, should have something better')\n return 'Root, this is where some front end would go on a server'", "def home():\n logging.info('Entering...
[ "0.6843621", "0.6831854", "0.6729167", "0.6648347", "0.66400474", "0.660815", "0.6578234", "0.6496017", "0.6496017", "0.6410235", "0.64055043", "0.6377318", "0.6365606", "0.634989", "0.6319955", "0.6239046", "0.6237752", "0.622894", "0.6227741", "0.62206686", "0.61866283", ...
0.0
-1