query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
test to make sure the unweighted counts result is the same as npairs_3d
def test_unweighted_counts(): npts = 100 random_coords = np.random.random((npts, 3)) random_vectors = np.random.random((npts, 3)) * 2.0 - 1.0 period = np.array([1.0, 1.0, 1.0]) rbins = np.linspace(0.0, 0.3, 5) weights1 = np.ones((npts, 4)) weights1[:, 1] = random_vectors[:, 0] weights...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_3():\n\n # generate two locusts of points\n npts = 100\n epsilon = 0.001\n # #cluster 1\n coords1 = generate_locus_of_3d_points(npts, 0.1, 0.1, 0.1, epsilon=epsilon)\n # cluster 2\n coords2 = generate_locus_of_3d_points(npts, 0.9, 0.9, 0.9, epsilon=epsilon)\n\n # generate orientati...
[ "0.6804071", "0.6675446", "0.6558152", "0.6553596", "0.6355471", "0.59420466", "0.5904359", "0.5867944", "0.5852378", "0.5840163", "0.57754296", "0.5756164", "0.5666417", "0.5629368", "0.56008625", "0.5580319", "0.55392295", "0.55317265", "0.55268514", "0.55140775", "0.550797...
0.8235178
0
Convert list to string and strip out everything not alphanumeric or underscore Adding a space after the \w keeps a white space when replacing with ''
def convertListToString(list): return re.sub(r'[^\w ]', '', str(list))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createtext(lst):\n newlst = []\n for item in lst:\n item = item.replace(\"_!\",\"\")\n newlst.append(item)\n text = ' '.join(newlst)\n # Lower-casing\n return text.lower()", "def sanitize(mystr):\n retainlist = \"_-\"\n return re.sub(r'[^\\w' + retainlist + ...
[ "0.70441335", "0.67255616", "0.67114735", "0.6680449", "0.65896875", "0.65511245", "0.65050983", "0.64905286", "0.64250445", "0.64132965", "0.63415235", "0.63278353", "0.62990576", "0.62973416", "0.62399995", "0.6236533", "0.62267345", "0.6199033", "0.6196927", "0.6192598", "...
0.74973476
0
Check if both events have occurred.
def both_events(self, Rover, name1, name2): func1 = self.event.get(name1) func2 = self.event.get(name2) return func1(Rover) and func2(Rover)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_event_status(self):\n pass", "def __le__(self, other: Event) -> bool:\n return self.timestamp <= other.timestamp", "def either_events(self, Rover, name1, name2):\n func1 = self.event.get(name1)\n func2 = self.event.get(name2)\n return func1(Rover) or func2(Rover)", ...
[ "0.6898676", "0.6448902", "0.64360255", "0.6405506", "0.64001495", "0.63844377", "0.6315303", "0.6301358", "0.6233651", "0.6232503", "0.6225918", "0.62225395", "0.62174076", "0.6212137", "0.6169394", "0.6145492", "0.60770476", "0.6058647", "0.6055802", "0.6047041", "0.6041531...
0.7315005
0
Check if rover is stuck for stucktime.
def is_stuck_for(self, Rover, stucktime): exceeded_stucktime = False # If not moving then check since when if Rover.vel < 0.1: if not Rover.timer_on: self.starttime = time.time() # start timer Rover.stuck_heading = Rover.yaw Rover.time...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_timer(self, wanted_time):\n if time.time() - self.start_time >= wanted_time:\n return True\n return False", "def check( self ):\n\n if ( self.alive is not None ) \\\n and ( time.time() > ( self.alive + self.timeout ) ):\n return False\n retur...
[ "0.6666799", "0.6664595", "0.6486526", "0.64650047", "0.6416942", "0.6330225", "0.62419987", "0.61649776", "0.6160066", "0.61586726", "0.6139238", "0.6092504", "0.60844237", "0.6078041", "0.6062674", "0.6035044", "0.6020915", "0.6014414", "0.5992468", "0.59783554", "0.5977313...
0.7809134
0
Returns the column expression for all required info retrieved by a user lookup. table is the users SQLAlchemy table object. Required to preserve type information for the columns.
def user_info_columns(table: SqlTable) -> Tuple: return ( table.c.user_id, table.c.system_id, table.c.full_name, table.c.email, table.c.email_verified, table.c.is_active, table.c.last_login_try, table.c.last_login_success, table.c.failed_login...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_columns(self, table):\n if table not in self.columns:\n self.columns[table] = [\n row[0] for row in self.db.iter('describe ' + table)]\n return self.columns[table]", "def column_expression(self, col):\n return getattr(func, self.impl.as_binary)(\n ...
[ "0.5745259", "0.5605924", "0.5448899", "0.5417191", "0.5409962", "0.5288628", "0.52642924", "0.51959676", "0.51773095", "0.51639885", "0.5146367", "0.5129033", "0.51231354", "0.5118728", "0.50761974", "0.507446", "0.49696645", "0.49645376", "0.49541008", "0.49518165", "0.4938...
0.5730073
1
self.spins stores the final lattice configuration for each T in T_range.
def __init__(self, L, T_range): self.L = L self.spins = np.ones((L, L, len(T_range))) self.InitializeSpins(T_range[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def txs(self):\n\n self.sp = self.x", "def SLTrace(self,NSL=100,Pts=[]):\n TOF_end=[]\n SL_end=[]\n \n for i in range(4): #4 Subgrids\n \n if(len(Pts)==0):\n nsl=int(NSL*self.theta[i]/2/np.pi)\n Pts_init=PointOnUnitEdge(nsl) #...
[ "0.5783979", "0.5507732", "0.5491711", "0.51921594", "0.5174145", "0.5129086", "0.50681746", "0.50142837", "0.50092566", "0.49935362", "0.49205694", "0.49145123", "0.4913506", "0.49083507", "0.48946956", "0.4889807", "0.48834133", "0.4874443", "0.48703977", "0.48688805", "0.4...
0.65850097
0
Save observables and lattice to pickle files. The isfile checks will return an error if either one fails.
def save_output(output_name, observables, lattice): import cPickle as pickle from os.path import isfile observables_file = ((r'data\%s.pkl') % (output_name)) with open(observables_file, 'wb') as output: pickle.dump(observables, output, pickle.HIGHEST_PROTOCOL) if isfile(observables_file): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pickle_data(self):\n if 'data_sets.pckl' in self.expected_pickles:\n to_file(\n self.data_sets,\n os.path.join(self.logdir, 'data_sets.pckl')\n )\n if 'all_params.pckl' in self.expected_pickles:\n to_file(\n self.all_pa...
[ "0.6605382", "0.62100697", "0.61895514", "0.6135828", "0.6068063", "0.6059598", "0.6023454", "0.5992661", "0.59752506", "0.59504825", "0.5926284", "0.5879088", "0.58743024", "0.5874081", "0.58527464", "0.58212143", "0.5809227", "0.57809293", "0.5779382", "0.5765579", "0.57561...
0.7103732
0
Average the last N checkpoints in the model_dir.
def avg_checkpoints(model_dir, num_last_checkpoints, global_step, global_step_name): checkpoint_state = tf.train.get_checkpoint_state(model_dir) if not checkpoint_state: utils.print_out("# No checkpoint file found in directory: %s" % model_dir) return None # Checkpoints are ordered fr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_checkpoints(inputs): #权值平均\r\n params_dict = collections.OrderedDict()\r\n params_keys = None\r\n new_state = None\r\n for f in inputs:\r\n state = torch.load(\r\n f,\r\n map_location=(\r\n lambda s, _: torch.serialization.default_restore_location...
[ "0.615217", "0.6006028", "0.5925057", "0.58493394", "0.5845805", "0.5786523", "0.5764014", "0.5678728", "0.562423", "0.5621132", "0.56024176", "0.5591469", "0.5549874", "0.5536095", "0.55152065", "0.549768", "0.5496061", "0.5489397", "0.54665774", "0.54629296", "0.5456299", ...
0.7893913
0
This function illustrates top down view of the car on the road.
def illustrate_driving_lane_with_topdownview(image, left_line, right_line): rows, cols = image.shape[:2] window_img = np.zeros_like(image) window_margin = 56 left_plotx, right_plotx = left_line, right_line ploty = left_line lane_width = right_line[0] - left_line[0] lane_center = (right_lin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_simple_pass():\n m = view(nybb)\n m = view(world)\n m = view(cities)\n m = view(world.geometry)", "def draw_car(self):\n a = self.h / 50\n ellipse(screen, BLACK, (self.x - 15 * a, self.y + 35 * a, 30 * a, 10 * a))\n rect(screen, LIGHT_BLUE, (self.x, self.y, self.dir * 26...
[ "0.5590229", "0.5578065", "0.55074614", "0.541413", "0.53645474", "0.5353133", "0.53382516", "0.5325824", "0.5317306", "0.5310126", "0.530344", "0.52729845", "0.52677834", "0.52625513", "0.5259109", "0.5244894", "0.52315193", "0.52314156", "0.5217538", "0.51871055", "0.518121...
0.6516942
0
Compares two graph edges for equality. The comparison is done by comparing the vertices constituting the respective edge.
def __eq__(self, other): if isinstance(other, GraphEdge): return self.head_vertex == other.head_vertex and self.tail_vertex == other.tail_vertex return NotImplemented
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if isinstance(other, DirectedWeightedGraphEdge):\n if self.head_vertex != other.head_vertex:\n return False\n elif self.tail_vertex != other.tail_vertex:\n return False\n elif self.weight != other.weight:\n ...
[ "0.6894904", "0.6893221", "0.6888254", "0.68807936", "0.6864258", "0.6805243", "0.6741039", "0.6662746", "0.6613348", "0.65787905", "0.656158", "0.6549803", "0.65466356", "0.6527", "0.64482933", "0.6436504", "0.64232814", "0.63450253", "0.63450253", "0.6335306", "0.63133574",...
0.7092343
0
Returns the first vertex in this graph edge.
def get_head_vertex(self): return self.graph.vertices[self.head_vertex.vertex_number]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_start_vertex(self):\n\n return self._start_vertex", "def get_vertex(self, key):\n\n vertex = None\n try: \n vertex = self.graph[key]\n except KeyError:\n raise ValueError(\"Vertex with key {} not in Graph\".format(key))\n\n return vertex", "def ge...
[ "0.7534947", "0.71326864", "0.697388", "0.68991953", "0.6891457", "0.68909526", "0.68523365", "0.67581934", "0.6729876", "0.6686339", "0.66670376", "0.6665354", "0.6635292", "0.6515914", "0.6503775", "0.6495165", "0.6494536", "0.64400387", "0.62428373", "0.6155909", "0.614656...
0.7465771
1
Returns the mate vertex connected to the specified vertex by this graph edge.
def get_mate(self, vertex): if vertex.vertex_number == self.head_vertex.vertex_number: return self.graph.vertices[self.tail_vertex.vertex_number] elif vertex.vertex_number == self.tail_vertex.vertex_number: return self.graph.vertices[self.head_vertex.vertex_number] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vertex(self, vertex):\n # return the vertex if it is in the graph\n if vertex in self.vert_dict:\n return self.vert_dict[vertex]\n else:\n raise ValueError('Vertex not in graph')", "def minimum_other_vertex(self, vertex):\n return min([(len(self.out_edges...
[ "0.67918444", "0.6675857", "0.6527408", "0.6517658", "0.64582753", "0.6442114", "0.63371223", "0.61908114", "0.6128026", "0.6096591", "0.60688514", "0.5953422", "0.59300077", "0.59174347", "0.587875", "0.5864341", "0.5862755", "0.58612406", "0.58481663", "0.5764057", "0.57564...
0.7601112
0
Compares two directed weighted graph edges for equality. The comparison is done by comparing the vertices constituting the respective edges and the weight of the respective edges.
def __eq__(self, other): if isinstance(other, DirectedWeightedGraphEdge): if self.head_vertex != other.head_vertex: return False elif self.tail_vertex != other.tail_vertex: return False elif self.weight != other.weight: return F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return (self.vertices == other.vertices and self.weight == other.weight)", "def __eq__(self, other):\n if isinstance(other, type(self)):\n same_edges = self._edges == other._edges\n same_weights = self._weights == other._weights\n return s...
[ "0.6958796", "0.66861707", "0.6495343", "0.6471634", "0.6320421", "0.62764096", "0.62764096", "0.6267954", "0.6096804", "0.6045613", "0.59932524", "0.5959931", "0.59565455", "0.5941056", "0.592869", "0.5906578", "0.5875933", "0.58749247", "0.58143383", "0.57974845", "0.577917...
0.6716901
1
Returns if this edge is weighted.
def is_weighted(self): return self.weighted
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_weighted(self):\n return self._weighted", "def is_weighted(self):\n return self.properties.weighted", "def is_weighted(G):\n return G.is_weighted()", "def weighted_estimation(self) -> bool:\n\n return self._weighted_estimation", "def is_weight(self):\n return self.id i...
[ "0.85247034", "0.84561473", "0.7810495", "0.7601611", "0.73710126", "0.7284329", "0.7097942", "0.7078276", "0.65169454", "0.64693487", "0.6455727", "0.6354632", "0.63507086", "0.63039726", "0.62808347", "0.6277241", "0.6258785", "0.62173945", "0.6197365", "0.6197365", "0.6197...
0.85533684
0
Returns if this edge is weighted.
def is_weighted(self): return self.weighted
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_weighted(self):\n return self._weighted", "def is_weighted(self):\n return self.properties.weighted", "def is_weighted(G):\n return G.is_weighted()", "def weighted_estimation(self) -> bool:\n\n return self._weighted_estimation", "def is_weight(self):\n return self.id i...
[ "0.85247034", "0.84561473", "0.7810495", "0.7601611", "0.73710126", "0.7284329", "0.7097942", "0.7078276", "0.65169454", "0.64693487", "0.6455727", "0.6354632", "0.63507086", "0.63039726", "0.62808347", "0.6277241", "0.6258785", "0.62173945", "0.6197365", "0.6197365", "0.6197...
0.85533684
1
Load JSON from the request body and store them in self.request.arguments, like Tornado does by default for POSTed form parameters. If JSON cannot be decoded, raises an HTTPError with status 400.
def load_json(self): try: self.request.arguments = json.loads(self.request.body) except ValueError: msg = "Could not decode JSON: %s" % self.request.body logger.debug(msg) raise tornado.web.HTTPError(400, msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_json_body(self, request):\n\n request.json_body = None\n\n if not request.META.get(\"CONTENT_TYPE\", \"\").startswith(\"application/json\"):\n return\n\n if not len(request.body):\n return\n\n try:\n request.json_body = json.loads(request.body.d...
[ "0.7809032", "0.7458779", "0.7396192", "0.7363162", "0.7273717", "0.7221575", "0.71112233", "0.7065461", "0.6721423", "0.6637338", "0.65089893", "0.62159413", "0.6202336", "0.61334753", "0.60533977", "0.5944741", "0.5941503", "0.59275615", "0.59194815", "0.59124786", "0.58578...
0.9050802
0
Find and return the argument with key 'name' from JSON request data. Similar to Tornado's get_argument() method.
def get_json_argument(self, name, default=None): if default is None: default = self._ARG_DEFAULT if not self.request.arguments: self.load_json() if name not in self.request.arguments: if default is self._ARG_DEFAULT: msg = "Missing argument '%s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_json_argument(self, name, default=None):\n if default is None:\n default = self._ARG_DEFAULT\n if not self.request.arguments:\n self.load_json()\n if name not in self.request.arguments:\n if default is self._ARG_DEFAULT:\n msg = \"Missing...
[ "0.7637005", "0.7193931", "0.71123517", "0.69763345", "0.6936398", "0.6922876", "0.6660581", "0.64597905", "0.64124525", "0.6278671", "0.62783426", "0.62357706", "0.6156931", "0.61395764", "0.6017353", "0.59974533", "0.5833328", "0.5769034", "0.57587713", "0.5717934", "0.5701...
0.7650423
0
get_func(func_t or ea) > func_t Take an IDA function (`idaapi.func_t`) or an address (EA) and return an IDA function object. Use this when APIs can take either a function or an address.
def get_func(func_ea): if isinstance(func_ea, idaapi.func_t): return func_ea func = idaapi.get_func(func_ea) if func is None: raise exceptions.SarkNoFunction("No function at 0x{:08X}".format(func_ea)) return func
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_func(op):\n if op == \"-e\":\n return func\n elif op == \"-d\":\n return unfunc", "def get_ea(func_ea):\n if isinstance(func_ea, idaapi.func_t):\n return func_ea.startEA\n return func_ea", "def _get_function(func):\n if isinstance(func, method_types):\n func =...
[ "0.6530803", "0.6504428", "0.64988434", "0.6315862", "0.5867652", "0.57968634", "0.5764787", "0.5734331", "0.5637218", "0.55756813", "0.5573173", "0.55455023", "0.5538783", "0.55112034", "0.54792434", "0.5432875", "0.5425693", "0.54198885", "0.5403437", "0.5390312", "0.537629...
0.78666323
0
get_ea(func_t or ea) > ea Same as `get_func`, but returns the EA.
def get_ea(func_ea): if isinstance(func_ea, idaapi.func_t): return func_ea.startEA return func_ea
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_func(func_ea):\n if isinstance(func_ea, idaapi.func_t):\n return func_ea\n func = idaapi.get_func(func_ea)\n if func is None:\n raise exceptions.SarkNoFunction(\"No function at 0x{:08X}\".format(func_ea))\n\n return func", "def get_func(op):\n if op == \"-e\":\n return...
[ "0.6857561", "0.6226184", "0.55999815", "0.51001966", "0.5099721", "0.5076445", "0.49658352", "0.49461403", "0.49249873", "0.4924352", "0.49189922", "0.49043763", "0.48501197", "0.48474756", "0.4808437", "0.47783166", "0.4774657", "0.47436997", "0.47288248", "0.47219354", "0....
0.7903916
0
Check if a string is printable
def is_string_printable(string_): return set(string_) - set(string.printable)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_printable(s):\n for c in s:\n if c not in PRINTABLE_CHARACTERS:\n return False\n return True", "def is_printable(b):\n return b in e(string.printable)", "def ascii_printable(s: str) -> bool:\n return frozenset(s).issubset(_ascii_pa)", "def is_printable(c):\n return ord...
[ "0.86017025", "0.8182569", "0.7971312", "0.796188", "0.7166954", "0.7078417", "0.7067807", "0.660626", "0.6572274", "0.653476", "0.653476", "0.65230304", "0.6510913", "0.6427872", "0.6382309", "0.63571495", "0.6299116", "0.62191236", "0.61952144", "0.6128172", "0.60902894", ...
0.82233447
1
Set missing addresses to start and end of IDB. Take a start and end addresses. If an address is None or `BADADDR`, return start or end addresses of the IDB instead.
def fix_addresses(start=None, end=None): if start in (None, idaapi.BADADDR): start = idaapi.cvar.inf.minEA if end in (None, idaapi.BADADDR): end = idaapi.cvar.inf.maxEA return start, end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_column_address(start_addr, end_addr):\n send_command(0x21)\n send_command(start_addr)\n send_command(end_addr)", "def deleteAddressRange(self, start: ghidra.program.model.address.Address, end: ghidra.program.model.address.Address, monitor: ghidra.util.task.TaskMonitor) -> None:\n ...", ...
[ "0.5552632", "0.55492634", "0.53836757", "0.5382804", "0.5351938", "0.5299497", "0.5208573", "0.5195564", "0.51394707", "0.50926214", "0.5090475", "0.50299877", "0.50142455", "0.49440485", "0.4939883", "0.4932165", "0.4909151", "0.48797634", "0.48670682", "0.48395842", "0.483...
0.73118097
0
Set the name of an address. Sets the name of an address in IDA.
def set_name(address, name, anyway=False): success = idaapi.set_name(address, name, idaapi.SN_NOWARN | idaapi.SN_NOCHECK) if success: return if anyway: success = idaapi.do_name_anyway(address, name) if success: return raise exceptions.SarkSetNameFailed("Failed r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_name(self, address, name):\n with self.connect() as c:\n cur = c.cursor()\n cur.execute(\"UPDATE AddressBook SET name = '{}' WHERE address = '{}'\".format(name, address))\n return True", "def setName(self, name):\n self.name = str(name)", "def setName(s...
[ "0.75548315", "0.71784353", "0.71413356", "0.7125585", "0.71055186", "0.71055186", "0.70820135", "0.70820135", "0.70316553", "0.70316553", "0.70316553", "0.70316553", "0.7006621", "0.6948661", "0.6948661", "0.6948661", "0.6948661", "0.6948661", "0.693277", "0.69252336", "0.69...
0.7559003
0
Decorator to add an argument to a command.
def argument(*args, **kwargs): def deco(fct): if isinstance(fct, Command): cmd = fct cmd.add_argument(*args, **kwargs) else: if not hasattr(fct, '_acmdlib_arguments'): fct._acmdlib_arguments = [] fct._acmdlib_arguments.append((args, kwa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_argument(self, *args, **kwargs):\n self.parser.add_argument(*args, **kwargs)", "def add_argument(self, *args, **kwargs):\n self.parser.add_argument(*args, **kwargs)", "def add_argument(self, *args, **kwargs):\n self.parser.add_argument(*args, **kwargs)", "def add_argument(self, *...
[ "0.7451828", "0.7451828", "0.7451828", "0.741571", "0.7412598", "0.726459", "0.7180163", "0.7106914", "0.7005616", "0.68368924", "0.6808896", "0.6733548", "0.6690725", "0.6668984", "0.6514335", "0.64958876", "0.64205587", "0.6419554", "0.6404166", "0.63926023", "0.6352386", ...
0.75847644
0
Registers a plugin, given a name and value.
def register(name, value): return Plugins.register(name, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_plugin(self, name):\n\n global plugins_by_name, registerorder\n\n if plugins_by_name.has_key(name):\n warning('Can not add a plugin with duplicate name\\n')\n return False\n plugins_by_name[name] = self\n self.name = name\n registerorder.append(...
[ "0.697755", "0.68559104", "0.6546401", "0.64251965", "0.639463", "0.63811576", "0.63225853", "0.62063575", "0.6146216", "0.61150974", "0.6103113", "0.602875", "0.5994227", "0.5951504", "0.592872", "0.5829238", "0.5812474", "0.57953626", "0.57875925", "0.575865", "0.5722736", ...
0.87815213
0
Solve the obstacle problem u >= psi in D,
def obstacle(psi,f_rhs,tol,f_dist,h0,pts,tri,*args,**kwargs): announce = kwargs.get('announce',False) if announce: print (" obstacle: asking poisson() for linear system and unconstrained soln ...") # use poisson to get unconstrained stiffness, load uhpoisson, inside, AA, bb = poisson(f_rhs,f_di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def potentialSolver4(self, w, max_it, tol):\n\n dx2 = 1.0/(self.dh[0]*self.dh[0]); # dx^2\n dy2 = 1.0/(self.dh[1]*self.dh[1]); # dy^2\n dz2 = 1.0/(self.dh[2]*self.dh[2]); # dz^2\n \n L2 = 0.0 # norm\n \n converged = False\n \n # Step 1: create *integer* ar...
[ "0.63812715", "0.63644165", "0.62942004", "0.62942004", "0.6065367", "0.6041697", "0.59314823", "0.5882779", "0.58666945", "0.58614814", "0.5716704", "0.5688724", "0.5686755", "0.5686196", "0.5678814", "0.56656295", "0.5624756", "0.55952203", "0.5589645", "0.5587976", "0.5583...
0.70703965
0
private func for creating residual block with mfm layers.
def _res_block(self, X, name, out_channels): X_shortcut = X X = self._mfm(X, name = name + '_mfm1', out_channels=out_channels, kernel_size=3, strides=1) X = self._mfm(X, name = name + '_mfm2', out_channels=out_channels, kernel_size=3, strides=1) X = Add()([X, X_shortcut]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _residual_block(input, id_block, conv_block, mid_f, output_f, repetitions, stage, is_first_layer=False):\n\n for i in range(repetitions):\n if i == 0 and is_first_layer is True:\n input = conv_block(mid_f, output_f, stage, i, input, stride=(1, 1))\n elif i == 0 and is_first_layer is...
[ "0.67419946", "0.6413987", "0.6301651", "0.6196587", "0.61700547", "0.6155078", "0.6151", "0.61041856", "0.61016715", "0.59957874", "0.59862506", "0.59693253", "0.595324", "0.59517217", "0.5950013", "0.5940206", "0.58783394", "0.584375", "0.5824607", "0.5810628", "0.5760141",...
0.6444488
1
Implement the mixer unitary on a quantum circuit
def create_mixer_unitary(graph, beta): mixer_unitary = QuantumCircuit(len(graph.nodes), name="Mixer Unitary") # Apply unitary for each node for node in graph.nodes: mixer_unitary.rx(2*beta, int(node)) mixer_unitary.to_gate() return mixer_unitary
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_x_mixer_output(self):\n\n wires = range(4)\n mixer_hamiltonian = qaoa.x_mixer(wires)\n\n mixer_coeffs = mixer_hamiltonian.coeffs\n mixer_ops = [i.name for i in mixer_hamiltonian.ops]\n mixer_wires = [i.wires[0] for i in mixer_hamiltonian.ops]\n\n assert mixer_coef...
[ "0.6317439", "0.6317439", "0.60724324", "0.5952803", "0.57481503", "0.5437349", "0.54311913", "0.5425911", "0.5412592", "0.5407849", "0.5392802", "0.5332992", "0.5329644", "0.53256863", "0.5317726", "0.5311661", "0.52882445", "0.52882445", "0.52882445", "0.52882445", "0.52882...
0.6545433
0
Create the full QAOA circuit for the graph with the given parameters.
def create_qaoa_circuit(graph, params): num_of_iterations = int(len(params)/2) gammas = params[:num_of_iterations] # Let the first half of the params list be gamma parameters betas = params[num_of_iterations:] # Let the second half of the params list be beta parameters # Initialize Circuit qr = Qua...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qaoa_circuit(self,\n with_noise: cirq.SingleQubitGate = None) -> cirq.Circuit:\n # Symbols for the rotation angles in the QAOA circuit.\n alpha = sympy.Symbol('alpha')\n beta = sympy.Symbol('beta')\n\n qubits = cirq.LineQubit.range(self.num_nodes) # Create qubit...
[ "0.6899125", "0.63434273", "0.6278276", "0.6171898", "0.6142525", "0.6135607", "0.61242694", "0.60825694", "0.59941727", "0.59199876", "0.59169763", "0.59160596", "0.59001786", "0.58980465", "0.58540994", "0.5845812", "0.5826757", "0.5815075", "0.57363445", "0.5685105", "0.56...
0.81415427
0
Tests instantiate method, where object config has no _target_ directive
def test_instantiate_no_target(self): # create test configs test_configs = [ {}, {"a": 1, "b": 2} ] # check that instantiate raises ValueError for each test config for test_conf in test_configs: self.assertRaises(ValueError, instantiate, test_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_instantiate_valid_target(self):\n # create test configs\n test_configs = [\n {\"_target_\": \"collections.deque\"},\n {\"_target_\": \"collections.UserString\", \"seq\": \"test string\"}\n ]\n\n # create truth objects\n truth_objs = [deque(), UserSt...
[ "0.7144292", "0.6309696", "0.6302354", "0.62679553", "0.6076424", "0.6020874", "0.6020245", "0.5987849", "0.59708595", "0.59405315", "0.5908926", "0.59018385", "0.5884045", "0.58709836", "0.5863174", "0.5815736", "0.5800829", "0.57929033", "0.57757896", "0.5773337", "0.573020...
0.6917465
1
Tests instantiate method, where target module doesn't exist
def test_instantiate_non_existent_module(self): # create test configs test_configs = [ {"_target_": "non_existent_module.some_class"}, {"_target_": "another_non_existent_module.some_class", "a": 1, "b": 2} ] # check that instantiate raises ModuleNotFoundError for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_can_instantiate(self):\n\n exc_thrown = False\n\n try:\n self.klass(*self.instantiate_args)\n except Exception:\n exc_thrown = True\n\n self.assertFalse(exc_thrown)", "def test_module(self):\n pass", "def test_instantiate_no_target(self):\n ...
[ "0.706873", "0.67120045", "0.6450792", "0.6442711", "0.63833404", "0.632416", "0.62741697", "0.6273905", "0.6213007", "0.61954844", "0.6162283", "0.61395144", "0.61349386", "0.61349386", "0.6088037", "0.60755724", "0.60616666", "0.6052386", "0.60230875", "0.60206574", "0.6020...
0.74603057
0
Tests instantiate method, where target class doesn't exist
def test_instantiate_non_existent_class(self): # create test configs test_configs = [ {"_target_": "collections.NonExistentClass"}, {"_target_": "collections.OtherNonExistentClass", "a": 1, "b": 2} ] # check that instantiate raises AttributeError for each test co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_can_instantiate(self):\n\n exc_thrown = False\n\n try:\n self.klass(*self.instantiate_args)\n except Exception:\n exc_thrown = True\n\n self.assertFalse(exc_thrown)", "def test_instantiate_valid_target(self):\n # create test configs\n test_...
[ "0.79841703", "0.6840013", "0.68238115", "0.6583024", "0.6546963", "0.6464835", "0.6391154", "0.63562906", "0.63544935", "0.62982786", "0.62565255", "0.62392247", "0.62392247", "0.6218023", "0.61846364", "0.6168579", "0.6147168", "0.6129624", "0.612689", "0.6121361", "0.61213...
0.74095106
1
Tests instantiate method with valid target module and class
def test_instantiate_valid_target(self): # create test configs test_configs = [ {"_target_": "collections.deque"}, {"_target_": "collections.UserString", "seq": "test string"} ] # create truth objects truth_objs = [deque(), UserString("test string")] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_can_instantiate(self):\n\n exc_thrown = False\n\n try:\n self.klass(*self.instantiate_args)\n except Exception:\n exc_thrown = True\n\n self.assertFalse(exc_thrown)", "def instantiate(name, *args, **kwargs):\n ...", "def create_module(cls, *args, **...
[ "0.7439965", "0.66417146", "0.64072406", "0.64072406", "0.63771486", "0.6362516", "0.6324918", "0.62324893", "0.6224451", "0.62205917", "0.6088758", "0.6088758", "0.6088758", "0.60410625", "0.6039051", "0.6021471", "0.60123706", "0.601191", "0.6001706", "0.59884065", "0.59884...
0.7038484
1
Checks the given ea and returns True if the function is an imported function (loacted in IAT)
def is_func_imported(self, ea): # If address is located in IAT if ea in self.rt_import_table: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_func_module(self, ea, mod_name):\n if ea in self.rt_import_table:\n (module, ea, name, ord) = self.rt_import_table[ea]\n if module == mod_name:\n return True\n\n return False", "def is_already_import_function(self, fn):\n if isinstance(fn, basestri...
[ "0.72709537", "0.7194983", "0.67754626", "0.64962727", "0.6480057", "0.6466913", "0.643993", "0.63932014", "0.6297886", "0.6242692", "0.6204381", "0.6190035", "0.6064494", "0.60241413", "0.60094076", "0.59370065", "0.59034634", "0.58287877", "0.58248556", "0.5818206", "0.5816...
0.8698025
0
Check if function at ea is part of the imported module
def is_func_module(self, ea, mod_name): if ea in self.rt_import_table: (module, ea, name, ord) = self.rt_import_table[ea] if module == mod_name: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_func_imported(self, ea):\n # If address is located in IAT\n if ea in self.rt_import_table:\n return True\n\n return False", "def is_already_import_function(self, fn):\n if isinstance(fn, basestring):\n for descriptor in self.import_entries:\n ...
[ "0.7575263", "0.7161951", "0.7142891", "0.706428", "0.7060444", "0.6887674", "0.67523146", "0.6639057", "0.6610212", "0.6580285", "0.6576476", "0.65758574", "0.6548188", "0.652603", "0.64948887", "0.6486134", "0.64257395", "0.6387661", "0.6354225", "0.6353084", "0.63428366", ...
0.83145916
0
Check if module has loaded functions in the IAT
def is_loaded_module(self, module_name): for (module, ea, name, ord) in self.rt_import_table.values(): if module == module_name: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_func_imported(self, ea):\n # If address is located in IAT\n if ea in self.rt_import_table:\n return True\n\n return False", "def is_loaded(self):\n return os.path.exists(IPMIService.IPMI_DEV)", "def module_present(module, load=True):\n with open('/proc/modules',...
[ "0.6796747", "0.67405146", "0.6614088", "0.6595028", "0.6520298", "0.64521915", "0.6437729", "0.63793755", "0.63466257", "0.6292399", "0.62761927", "0.62409914", "0.6231317", "0.61804575", "0.6164748", "0.61443764", "0.60850936", "0.60510194", "0.6034376", "0.6029556", "0.601...
0.69943684
0
Print the debug imports
def print_debug_imports(self): for dbgImp in self.rt_import_table: (module_name, ea, name, ord) = self.rt_import_table[dbgImp] idaapi.msg("ModuleName - %s,\t\tFunctionName - %s,\t\t Address in IAT - %s,\t\t Real address - %s\n" % (module_name, name, hex(ea), hex(db...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printImported():\r\n ll = sorted([mod for mod in sys.modules if mod.find('pubsub') >= 0])\r\n\r\n py2and3.print_('\\n'.join(ll))", "def debug():", "def log_imported_packages(self):\n imported_packages_dict = self.get_imported_packages()\n\n res_str = \"\\n\".join(f\"{module}: {version_n...
[ "0.69145983", "0.68204194", "0.6735605", "0.6709566", "0.6446388", "0.64422834", "0.63457614", "0.6312722", "0.6241582", "0.6180094", "0.6085222", "0.6037665", "0.6033095", "0.600908", "0.5980291", "0.59514123", "0.5940747", "0.59297377", "0.59286475", "0.5924386", "0.59223",...
0.8112144
0
extract time from google api answers add results to splited dataframes
def add_times_of_travels(dfs_splited: list, time: datetime.datetime) -> list: results = google_api_request(dfs_splited, time) logger.debug("Ready answer for request") print(results) travel_times = [[i.get('duration', {}).get('value') for i in result['rows'][0]['elements']] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_mql_timeseries_data(response):\n lkeys = response['timeSeriesDescriptor'].get('labelDescriptors', [])\n # (fixme): Is there a better way to fetch and extract this data?\n for result in response.get('timeSeriesData', []):\n data = {}\n lvalues = result.get('labelValues', [])\n ...
[ "0.6128631", "0.56953675", "0.5649638", "0.56355083", "0.56123745", "0.5559543", "0.5550473", "0.5539186", "0.5497718", "0.5465875", "0.54352415", "0.54233277", "0.5397615", "0.53968203", "0.5377205", "0.5354905", "0.5308679", "0.528548", "0.5274197", "0.5265269", "0.5255181"...
0.6170402
0
Create a source from path. `cached` flag activates caching. This can be used to optimize performance if no changes are expected on the filesystem after the source was created. This is usually the case with static generation (as opposed to dynamic preview). If `settings.ini` in the source contains `[paths]` section with...
def create_source(path, cached=False): source = FileSource(path) try: config = source.read_config() ap = config.get('paths', 'additional-paths').strip() additional_paths = [_f for _f in ap.split() if _f] except (configparser.NoSectionError, configparser.NoOptionError, IOError): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_path(cls, path):\n if not os.path.exists(path):\n raise ValueError(\"Invalid path: {}\".format(path))\n\n slist = cls()\n for f in glob.glob(path + '/*.fits'):\n slist.append(cls.source_class.from_file(f))\n\n return slist", "def _get_local_src(self, pat...
[ "0.581367", "0.55751705", "0.5530774", "0.5507068", "0.54484135", "0.5272039", "0.52171546", "0.52124417", "0.51219", "0.5066204", "0.50386703", "0.5028943", "0.5028943", "0.5023799", "0.50104564", "0.49704832", "0.49593455", "0.49291563", "0.49159428", "0.4871208", "0.486494...
0.83463293
0
Context manager for keeping the original request data.
def keep_request_data(context): attr_to_value = preserve_attributes( context, [k for k, _ in default_request_data()]) yield restore_attributes(context, attr_to_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_request(self, req):\n req.context = self.make_context(req)", "def _stash_request_info(request, subject_id, method, version):\n request.environ['api.cache.subject_id'] = subject_id\n request.environ['api.cache.method'] = method\n request.environ['api.cache.version'] = versi...
[ "0.7468367", "0.65382993", "0.64844984", "0.6480656", "0.63075584", "0.63048005", "0.62223434", "0.6155639", "0.6112914", "0.6082265", "0.6061507", "0.60148966", "0.5995146", "0.5915906", "0.58799344", "0.5822937", "0.5812772", "0.57544523", "0.57509345", "0.5732875", "0.5718...
0.76473796
0
a decorator for a step definition which keeps the original request data
def clean_step(step_impl): @functools.wraps(step_impl) def wrapped(context, *args, **kwargs): with keep_request_data(context): returned = step_impl(context, *args, **kwargs) return returned return wrapped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step_impl(context):\n pass", "def step_impl(context):\n pass", "def step(self, func, *args):\n @wraps(func)\n def cached_func(*args):\n \"\"\"Step wise cache function\"\"\"\n try: # fails if cache is not instantiated or if it is None\n value = self....
[ "0.6607942", "0.6607942", "0.6182455", "0.60113436", "0.59532183", "0.58945876", "0.5787957", "0.57758397", "0.57647324", "0.5693262", "0.56900024", "0.5578022", "0.5553434", "0.5513645", "0.5507526", "0.5473006", "0.5470868", "0.54328907", "0.54222167", "0.54109013", "0.5410...
0.78688955
0
Execute steps with the keep_request_data context manager. Useful for calling execute_steps during request build up.
def clean_execute_steps(context, steps_text, save_response_data=None): with keep_request_data(context): context.reset_request_data() context.execute_steps(steps_text) if save_response_data: setattr(context, save_response_data, context.response_object.get('data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_step(step_impl):\n @functools.wraps(step_impl)\n def wrapped(context, *args, **kwargs):\n with keep_request_data(context):\n returned = step_impl(context, *args, **kwargs)\n return returned\n return wrapped", "def handle_execution(self, data, *args, **kwargs):\n ...
[ "0.62266123", "0.51828146", "0.51828146", "0.51276684", "0.5112461", "0.5001797", "0.49459624", "0.49085695", "0.48658034", "0.48318595", "0.47813115", "0.4757837", "0.47547454", "0.4702506", "0.47013927", "0.46367842", "0.46156824", "0.46095034", "0.46075216", "0.4599945", "...
0.6666166
0
Generate a version number string from the specified parts
def generate_version(parts): version = '.'.join([str(part) for part in parts[0:2]]) if len(parts) > 3: version += parts[3] if len(parts) > 4: version += str(parts[4]) return version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_version(self, version, num_of_digits):\n version = \"{}\".format(version).replace(\".\", \"\").replace(\" \", \"\").strip()\n num_of_digits_to_add = (num_of_digits - len(version))\n version += (\"0\" * num_of_digits_to_add)\n version = int(version)\n return version", ...
[ "0.73418146", "0.71678543", "0.7095713", "0.69950414", "0.6820756", "0.67819726", "0.6705109", "0.66558605", "0.6654782", "0.6620144", "0.65936625", "0.6525427", "0.652354", "0.6509772", "0.650463", "0.64316434", "0.64076847", "0.6388761", "0.63629085", "0.63157195", "0.63157...
0.8655365
0
is_compatible_with(new_minor_version) should return True
def test_minor(scraper, version_parts): new_version_parts = list(version_parts) new_version_parts[1] = int(new_version_parts[1]) + 1 assert scraper.is_compatible_with(generate_version(new_version_parts)) is True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def python_compatible():\n result = False\n req_ver = vers.convert('3.9.5')\n pythonver = vers.convert('{major}.{minor}.{micro}'.format(major=sys.version_info.major,\n minor=sys.version_info.minor,\n ...
[ "0.7431041", "0.7178158", "0.7127145", "0.703042", "0.6996341", "0.69099504", "0.6851447", "0.6850589", "0.6769176", "0.6769176", "0.6756499", "0.6756499", "0.6756499", "0.6756499", "0.6734679", "0.6699222", "0.66385555", "0.6627716", "0.66248006", "0.66018736", "0.65530646",...
0.72599
1
is_compatible_with(new_pre_release_version) should return True
def test_pre_release(scraper, version_parts): new_version_parts = list(version_parts) if len(new_version_parts) > 4: new_version_parts[4] = int(new_version_parts[4]) + 1 elif len(new_version_parts) > 3: new_version_parts.append(1) else: new_version_parts.extend(['a', 1]) as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def python_compatible():\n result = False\n req_ver = vers.convert('3.9.5')\n pythonver = vers.convert('{major}.{minor}.{micro}'.format(major=sys.version_info.major,\n minor=sys.version_info.minor,\n ...
[ "0.69594973", "0.69137317", "0.68093014", "0.68081164", "0.6790292", "0.67893136", "0.6782805", "0.6780227", "0.6761403", "0.6713203", "0.6705038", "0.6672537", "0.6574082", "0.6568607", "0.6520334", "0.65041685", "0.6493881", "0.64645916", "0.64434403", "0.6436773", "0.64286...
0.7485356
0
Create a kame object, at the goku's current position.
def __init__(self, ai_settings, screen, goku): super(Kame, self).__init__() self.screen = screen # Create kame rect at (0, 0), then set correct position. self.image = pygame.image.load('kame.bmp') self.rect = self.image.get_rect() self.rect.centerx = goku.rect.cen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, pos):\n self.pos = pos", "def create_new_game(self):\r\n global game_instance\r\n game_instance = game.Game()\r\n game_instance.set_word(db.get_random_word())\r\n print(\"\\n---------NEW GAME---------\")\r\n self.current_word = \"----\"", "def new_object(s...
[ "0.6158132", "0.56564254", "0.5597445", "0.5542725", "0.5536095", "0.547559", "0.5472001", "0.54485244", "0.54428244", "0.54231924", "0.5421016", "0.53994715", "0.53900766", "0.5383519", "0.53785133", "0.53648984", "0.53644687", "0.53632104", "0.5360074", "0.5340445", "0.5326...
0.6344389
0
Draw the kame to the screen.
def draw_kame(self): #pygame.draw.rect(self.screen, self.color, self.rect, self.image) self.screen.blit(self.image, self.rect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self, screen):", "def draw():", "def draw(self):\n\n State.screen.draw()", "def draw(self):\n self.screen.fill(BACKGROUND_COLOR)\n self.cannon.draw(self.screen)\n self.objects.draw(self.screen)", "def draw():\n screen.fill((0, 0, 0))\n alien.draw()", "def draw(sel...
[ "0.8225329", "0.7920574", "0.78136766", "0.77745014", "0.7760726", "0.76907307", "0.7579652", "0.75666505", "0.75666505", "0.75666505", "0.75666505", "0.7559235", "0.75204027", "0.75066805", "0.7476456", "0.74355596", "0.7426095", "0.7424709", "0.7421482", "0.7412151", "0.740...
0.8383208
0
Calculate Maximum Depth From Point Cloud
def fus_points2depth(points): max_z = 0.0 min_z = 0.0 for point in points: if point[2] > max_z: max_z = point[2] if point[2] < min_z: min_z = point[2] return abs(max_z-min_z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max_depth_val():\n data = SUNRGBDTrainDataset(True)\n return max([data[0][i][-1].flatten().item() for i in range(len(data))])", "def get_max_dmag_from_depth(depth):\n return 2.5 * np.log10(depth)", "def convert_pointcloud_to_depth(pointcloud, camera_intrinsics):\r\n\r\n\tassert (pointcloud.sha...
[ "0.71776944", "0.6876848", "0.66646206", "0.637755", "0.6343945", "0.63234144", "0.62752146", "0.61729157", "0.61499417", "0.6110589", "0.6092262", "0.60468256", "0.6045397", "0.6032402", "0.6016253", "0.60043883", "0.5986041", "0.5979987", "0.5952362", "0.59416324", "0.59258...
0.69405186
1
Generate some random tweet text.
def mock_tweet(): count = random.randint(70, 140) return ''.join([random.choice(string.letters) for i in xrange(count)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateRandomePlainText():\n randomPlainTextArray = [random.choice('0123456789abcdef')\n for n in range(24)]\n randomPlainText = \"\".join(randomPlainTextArray)\n return randomPlainText", "def create_random_text(word_count=10):\n sample_text_lst = TEXT_BASE_RUS.replace...
[ "0.7336123", "0.72017545", "0.69617206", "0.6955046", "0.6792115", "0.6696469", "0.66487026", "0.66219026", "0.6560906", "0.6504597", "0.6492525", "0.6492525", "0.6491351", "0.64229876", "0.63740075", "0.6317993", "0.63130176", "0.6288164", "0.62670004", "0.62655485", "0.6264...
0.7941552
0
POSTs the updated properties for a ZFS object to the webservice. zfsobjs is a list of AbstractZFS objects hostname is the hostname of this computer server is the zfs monitor server's hostname
def post_update(zfsobjs, hostname=HOSTNAME, server=ZFSMON_SERVER): ZFS_LOG = logging.getLogger("zfsmond.http") updated = dict() snapshots = False for obj in zfsobjs: # Check if this is a pool or a dataset, and POST to the appropriate resource if obj.type == 'pool': rescollect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def salesforce_collection_update(self, objects):\n for obj in objects:\n assert obj[\n \"id\"\n ], \"Should be a list of objects with Ids returned by Salesforce Collection Insert\"\n if STATUS_KEY in obj:\n del obj[STATUS_KEY]\n\n assert ...
[ "0.5676521", "0.5214823", "0.4971102", "0.4907723", "0.48414955", "0.47924596", "0.4694975", "0.46478626", "0.4644769", "0.4640716", "0.4635108", "0.4612122", "0.4593009", "0.45898503", "0.45867512", "0.45853955", "0.45830682", "0.45690647", "0.4535591", "0.45307365", "0.4529...
0.73352444
0
Gets the active ZFS pools by calling `zpool list` and parsing the output. Returns a list of ZPool objects populated with the properties returned by zpool list H o all.
def get_pools(): poolinfostr = fork_and_get_output("zpool list -H -o all".split()) header = get_zpool_header() poolinfo = poolinfostr.splitlines() poolobjs = [] for poolstr in poolinfo: poolobjs.append(DataZFS(poolstr, header, 'pool')) return poolobjs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pools():\n command = 'zpool list -H'\n try:\n p = subprocess.Popen(command.split(' '), stdout=subprocess.PIPE)\n except OSError:\n raise Exception('No ZFS tools found!')\n zpout, zperr = p.communicate()\n if p.returncode:\n raise Exception(\"Error executing '%s': %d\" % ...
[ "0.80878156", "0.73042035", "0.7050812", "0.67753637", "0.66770947", "0.65869814", "0.6562786", "0.6554524", "0.64835596", "0.644007", "0.6365196", "0.6321016", "0.62798274", "0.6219247", "0.619906", "0.6135923", "0.6128194", "0.6082088", "0.60160434", "0.59826976", "0.597930...
0.84037024
0
Gets the status of each zpool by calling `zpool status` and and parsing the output.
def get_pool_status(): pools_status = split_status_pools(fork_and_get_output("zpool status".split())) pools = [] for p in pools_status: pools.append(status.PoolStatus(p)) return pools
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zpool_status(p):\n # Input file\n f = '/'.join([p, 'zfs/zpool-status-dv.out'])\n check_path(f)\n\n status = {}\n\n # Match empty lines\n empty = re.compile('^\\s*$')\n\n # Match multiple underscores\n underscore = re.compile('^__')\n\n # Match dashes\n dash = re.compile('^--')\n\n...
[ "0.7154575", "0.63748884", "0.63549304", "0.6191073", "0.61175615", "0.60634863", "0.59149086", "0.5862941", "0.58497596", "0.5841862", "0.58097893", "0.5675924", "0.5670489", "0.5643654", "0.55874443", "0.5561089", "0.5522858", "0.55055994", "0.54882914", "0.54734266", "0.54...
0.82554597
0
Get docspans which are sliding window spans from a document
def get_docspans(all_doc_tokens, max_tokens_for_doc, doc_stride): _DocSpan = collections.namedtuple("DocSpan", ["start", "length"]) doc_spans = [] start_offset = 0 while start_offset < len(all_doc_tokens): length = len(all_doc_tokens) - start_offset if length > ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_windows(doc, hws=5):\n length = len(doc)\n assert length > 2*hws, 'doc is too short!'\n\n inside = [(w, doc[(i - hws):i] + doc[(i + 1):(i + hws + 1)]) for i, w in enumerate(doc[hws:-hws], hws)]\n\n # for words that are near the beginning or\n # the end of a doc tuples are slightly different\...
[ "0.6421841", "0.6292646", "0.61049014", "0.605424", "0.586118", "0.5850682", "0.58369684", "0.5816199", "0.57881117", "0.5637001", "0.56275266", "0.5521826", "0.5488609", "0.5459688", "0.5427386", "0.5427386", "0.5425122", "0.5402091", "0.540079", "0.53969455", "0.5393235", ...
0.6968376
0
Check if there is sufficient memory to prevent system from being unresponsive Otherwise system can become unresponsive as memory is slowly filled up, possibly leading to system unable to kill process Interrupts run if CPU memory use is more than 75%, to leave some capacity for model loading
def check_if_sufficient_memory(): percent_memory = psutil.virtual_memory().percent if percent_memory > 75: raise ValueError('Please use a device with more CPU ram or a smaller dataset')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_out_of_memory(self) -> bool:\n return pulumi.get(self, \"device_out_of_memory\")", "def stop_loading(self):\n return psutil.virtual_memory()[2] >= self.max_memory", "def stop_loading(self):\n return psutil.virtual_memory()[2] >= self.max_memory", "def memory_check(self) -> boo...
[ "0.7235018", "0.6932394", "0.6932394", "0.69066733", "0.68662536", "0.6822102", "0.6819577", "0.68071353", "0.678367", "0.655549", "0.65075845", "0.6478597", "0.64649934", "0.64479524", "0.6308393", "0.6290874", "0.6234317", "0.6231586", "0.6203869", "0.61822873", "0.6178238"...
0.7906733
0
Filters out doc_spans, which might not be relevant to answering question, which can be helpful when document is extremely long leading to many doc_spans with no answers
def keep_relevant_docspans(doc_spans, tok_start_position, tok_end_position, mode): if mode == 'all': return doc_spans elif mode == 'only_positive': if tok_start_position in [-1, None] or tok_end_position in [-1, None]: return [] else: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_invalid_sents(doc):\n def is_valid(sent):\n tag_counts = Counter([pos[0] for pos in sent['pos_tags']])\n num_subjects = tag_counts['NOUN'] + tag_counts['PROPN'] \\\n + tag_counts['PRON']\n num_predicates = tag_counts['VERB'] + tag_counts['AUX']\n comp...
[ "0.62472975", "0.5847748", "0.583575", "0.57769537", "0.57591414", "0.57234687", "0.56612074", "0.5646727", "0.56322473", "0.55924857", "0.55790424", "0.5574625", "0.55640864", "0.5542045", "0.55394304", "0.55327314", "0.5477125", "0.54676485", "0.5460647", "0.54581726", "0.5...
0.71136427
0
Saves the passed posts object in a file.
def save_posts(posts): with open(FILE_NAME, 'wb') as f: pickle.dump(posts, f, pickle.HIGHEST_PROTOCOL)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_post(name, elements, status, current_section):\n\n try:\n\n # dealing with Posts\n if status == 4:\n extract_and_write_posts(elements, name)\n return\n\n except:\n print(\"Exception (save_to_file)\", \"Status =\",\n str(status), sys.exc_info()[...
[ "0.72536314", "0.638276", "0.6335936", "0.6335127", "0.6221393", "0.6173248", "0.61729234", "0.6126923", "0.6124318", "0.6120573", "0.6114257", "0.610687", "0.60994494", "0.6076865", "0.6076818", "0.60569996", "0.6044865", "0.60265523", "0.60211146", "0.60089844", "0.60016584...
0.76258934
0
Reads and returns the saved posts from file.
def load_posts(): with open(FILE_NAME, 'r') as f: return pickle.load(f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_post_to_file(country_name: str, post: dict, data_path: str, order: int):\n\n logging.info(f\"[READ POST] Reading post\")\n\n raw_title = post['title']['rendered']\n raw_content = post['content']['rendered']\n\n cleaned_title = clean_html(raw_title)\n cleaned_content = clean_html(raw_content...
[ "0.6364917", "0.6275716", "0.6200789", "0.60762805", "0.5990724", "0.592687", "0.58093065", "0.5789136", "0.5750821", "0.5750821", "0.5740415", "0.5698358", "0.5657045", "0.5597588", "0.5574151", "0.5571945", "0.5571484", "0.5565915", "0.55373085", "0.55215144", "0.5486186", ...
0.7953246
0
Opens the permalink for post at rank rank in default browser.
def browse_rank(posts, rank): if rank > len(posts): click.secho(('\n\tCannot get that rank. Currently %d products have been hunted ' 'with Spear.\n' % len(posts)), fg="red") return url = BASE_URL + posts[int(rank)-1]['permalink'] webbrowser.open(url, new=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(num, rank):\n\n file_existed = os.path.isfile(FILE_NAME)\n\n if rank:\n rank = int(rank)\n \n # if a rank is passed, we assume the user wants to open the product at the\n # rank. But if the local file doesn't exist, we query the API, and retry.\n if rank and file_existed:\n browse_rank(load_po...
[ "0.6182857", "0.56361544", "0.5530104", "0.5205971", "0.5201647", "0.5197045", "0.5194299", "0.5138884", "0.51208854", "0.50970227", "0.50923043", "0.5067071", "0.5056936", "0.5035746", "0.50017977", "0.49854454", "0.49836594", "0.4968917", "0.49597406", "0.49532667", "0.4942...
0.78006464
0
Neatly prints all passed posts to the console.
def print_posts(posts): click.echo() for post in posts: click.secho('%d. ' % post['rank'], nl=False) click.secho('%s\t' % post['title'], bold=True, fg="red", nl=False) click.secho('%s' % post['tagline'], fg="yellow") click.echo()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_post():\n print('| | |'),", "def print(self, *args, **kwargs):\n print(*args, **kwargs)", "def debug_print(self, *args, **kwargs):\n print(\"APP_DEBUG_PRINT\", args, kwargs)", "def debug_print(self, *content):\n if self.debug:\n print(*content)...
[ "0.7115943", "0.6441518", "0.63706803", "0.62422836", "0.62408924", "0.6211438", "0.6161924", "0.6133616", "0.61010075", "0.6070248", "0.60621244", "0.6029152", "0.60103685", "0.5993028", "0.5993028", "0.5993028", "0.5993028", "0.59749794", "0.59646165", "0.59468657", "0.5929...
0.7119509
0
Construct a table name by optionally adding a table name prefix.
def _table_name(self, name: AnyStr) -> bytes: name = ensure_bytes(name) if self.table_prefix is None: return name return self.table_prefix + self.table_prefix_separator + name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bucket_to_tablename(prefix, bucket):\n return prefix + bucket", "def table_name() -> str:\n pass", "def prefix():\r\n class TableA(tables.Table):\r\n name = tables.Column()\r\n\r\n class Meta:\r\n prefix = \"x\"\r\n\r\n assert \"x\" == TableA([]).prefix\r\n\r\n c...
[ "0.6983316", "0.6868761", "0.66902655", "0.6644392", "0.6616669", "0.6526214", "0.65251964", "0.64713275", "0.644586", "0.62785625", "0.6139798", "0.6098526", "0.6013983", "0.5979652", "0.58623594", "0.5846383", "0.58428425", "0.5842715", "0.57911444", "0.57911444", "0.579114...
0.7101793
0
Create and open the underlying client to the HBase instance. This method can safely be called more than once.
async def open(self) -> None: if self.client is not None: return # _refresh_thrift_client opened the transport logger.debug(f"Opening Thrift transport to {self.host}:{self.port}") self.client = await self._client_factory(**self.client_kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_heat_client(self):\n\n print \"\\t* Generating heat client\"\n # request a new auth token from keystone\n keystone = ksclient.Client(auth_url=self.auth_url,\n username=self.username,\n password=self.password,\n ...
[ "0.6232724", "0.6101125", "0.608096", "0.6044116", "0.58246213", "0.5690355", "0.5668486", "0.56504655", "0.5605735", "0.5569847", "0.5556541", "0.5535542", "0.5521138", "0.54744536", "0.5422871", "0.53894156", "0.53798336", "0.53746945", "0.535874", "0.5340033", "0.53263265"...
0.6804419
0
Close the underlying client to the HBase instance. This method can be safely called more than once. Note that the client is destroyed after it is closed which will cause errors to occur
def close(self) -> None: if self.client is None: return if logger is not None: # If called from __del__(), module variables may no longer exist. logger.debug(f"Closing Thrift transport to {self.host}:{self.port}") self.client.close() self.client = No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closeConnecetion(self):\n client.close()", "def close_ssh_client(self):\n self.ssh_client.close()", "def close(self):\n self.shutdown()\n self._client.close()", "async def close(self) -> None:\n\n if self._client:\n await self._client.__aexit__()", "def close(s...
[ "0.71063393", "0.6860559", "0.6856127", "0.6839546", "0.6762218", "0.6728074", "0.6604954", "0.6489788", "0.6444724", "0.64077437", "0.6398559", "0.63399166", "0.6217777", "0.6193713", "0.6177189", "0.6150679", "0.614646", "0.6129677", "0.61130965", "0.60951537", "0.6062458",...
0.715433
0
Return a list of table names available in this HBase instance.
async def tables(self) -> List[bytes]: names = await self.client.getTableNames() # Filter using prefix, and strip prefix from names if self.table_prefix is not None: prefix = self._table_name(b'') offset = len(prefix) names = [n[offset:] for n in names if n.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_tables(self) -> List[str]:\n return self.dynamodb_client.list_tables()[\"TableNames\"]", "def get_table_names(self):\n return self.engine.table_names()", "def get_tables(self):\n return list(self._metadata['tables'].keys())", "def list_tables(self):\n return LIST_TABLES(d...
[ "0.8007392", "0.77783185", "0.7701616", "0.76757056", "0.7655505", "0.76370215", "0.75866014", "0.75735855", "0.7444133", "0.74050945", "0.73407847", "0.7325878", "0.7299059", "0.7193484", "0.71326184", "0.7120677", "0.70863867", "0.70375466", "0.7023705", "0.69402367", "0.68...
0.78835815
1
Enable the specified table.
async def enable_table(self, name: AnyStr) -> None: await self.client.enableTable(self._table_name(name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def is_table_enabled(self, name: AnyStr) -> None:\n return await self.client.isTableEnabled(self._table_name(name))", "async def disable_table(self, name: AnyStr) -> None:\n await self.client.disableTable(self._table_name(name))", "def lock_table(self):\n\n self.status = 'Locked'", ...
[ "0.6090106", "0.59843993", "0.596103", "0.59515077", "0.59515077", "0.58426434", "0.5697303", "0.5694458", "0.56662244", "0.5645401", "0.56410295", "0.56244045", "0.55909985", "0.5585736", "0.55567956", "0.5556704", "0.55556947", "0.55556947", "0.55487466", "0.5543933", "0.55...
0.82251936
0
Disable the specified table.
async def disable_table(self, name: AnyStr) -> None: await self.client.disableTable(self._table_name(name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def delete_table(self, name: AnyStr, disable: bool = False) -> None:\n if disable and await self.is_table_enabled(name):\n await self.disable_table(name)\n\n await self.client.deleteTable(self._table_name(name))", "def disable(ctx):\n\n port_info = {}\n port_info['FLEX_COUNTE...
[ "0.66882545", "0.64297634", "0.6220911", "0.62085795", "0.6183498", "0.59963304", "0.59899276", "0.596315", "0.5847089", "0.5841651", "0.5817108", "0.5815603", "0.58142066", "0.5812355", "0.58106613", "0.5808945", "0.5808786", "0.580826", "0.5758325", "0.57542515", "0.5750066...
0.8292084
0
Return whether the specified table is enabled.
async def is_table_enabled(self, name: AnyStr) -> None: return await self.client.isTableEnabled(self._table_name(name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_table(self, table):\n return table in self.get_table_list(\".\" in table)", "def check_table(self, table_name: str) -> bool:\n try:\n if self.engine.dialect.has_table(self.engine.connect(), table_name):\n return self.get_input(table_name)\n return False\...
[ "0.6898622", "0.6342821", "0.63032", "0.63032", "0.63032", "0.63032", "0.63032", "0.63032", "0.6272063", "0.62631357", "0.62483656", "0.6229805", "0.62060714", "0.61975765", "0.61830944", "0.61462283", "0.6129225", "0.61281174", "0.6115581", "0.61123234", "0.60770994", "0.6...
0.7990121
0
Compact the specified table.
async def compact_table(self, name: AnyStr, major: bool = False) -> None: name = self._table_name(name) if major: await self.client.majorCompact(name) else: await self.client.compact(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_table(self, table: Table):\n self._requires_table(table)\n table.clear()", "def empty_table(self, table):\n print(\"Emptying {0}...\".format(table))\n query = \"TRUNCATE TABLE {0} RESTART IDENTITY CASCADE;\".format(table)\n cursor = connection.cursor()\n cursor...
[ "0.5847997", "0.56457794", "0.5574597", "0.5566873", "0.55524355", "0.55139095", "0.546884", "0.5467198", "0.5423969", "0.54100394", "0.5380569", "0.53520906", "0.5315048", "0.52778924", "0.52724254", "0.5204866", "0.51722646", "0.51642877", "0.5143855", "0.50638324", "0.5055...
0.7088064
0
Compares received's attributes with expected's kwargs.
def attrs_eq(received, **expected): for k, v in expected.iteritems(): eq_(v, getattr(received, k))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_attrs(self):\n for self_attr, wrapper_attr in [(\"reactor\", \"_reactor\"),\n (\"client\", \"_client\")]:\n self.assertIdentical(getattr(self, self_attr),\n getattr(self.wrapper, wrapper_attr))", "def test_attribute...
[ "0.6576146", "0.6564596", "0.6462569", "0.6408045", "0.6395285", "0.6344218", "0.6291002", "0.6240182", "0.62239105", "0.61092496", "0.607779", "0.6026101", "0.6014606", "0.60038954", "0.5952767", "0.5885488", "0.5867236", "0.58600116", "0.5829513", "0.58288026", "0.5824071",...
0.7866361
0
Assert `text` starts with `substring`.
def starts_with(text, substring): assert text.startswith(substring), "%r doesn't start with %r" % (text, substring)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_match_start_check_at_beginning_of_string(self):\n first_letter = \"a\"\n s = \"abcdef\"\n self.assertEqual(__, re.search(first_letter, s).group())", "def test_match_must_start_at_the_beginning(self):\n third_letter = \"c\"\n s = \"abcdef\"\n self.assertEqual(__,...
[ "0.6829674", "0.65287787", "0.64003766", "0.63065535", "0.6265803", "0.62448704", "0.6170393", "0.6124493", "0.6100281", "0.6091578", "0.6072728", "0.603758", "0.60315865", "0.60313207", "0.60114366", "0.5978914", "0.59746695", "0.5931409", "0.5912524", "0.588778", "0.5864748...
0.8459681
0
Make a request, but prepend a locale if there isn't one already.
def request(self, **request): # Fall back to defaults as in the superclass's implementation: path = request.get('PATH_INFO', self.defaults.get('PATH_INFO', '/')) locale, shortened = split_path(path) if not locale: request['PATH_INFO'] = '/%s/%s' % (settings.LANGUAGE_CODE, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_request(self, request):\n if 'HTTP_ACCEPT_LANGUAGE' in request.META:\n # Preserve the browser provided language just in case,\n # the underscore prefix means that you probably shouldn't be using it anyway\n request.META['_HTTP_ACCEPT_LANGUAGE'] = request.META['HTTP...
[ "0.62489927", "0.6160046", "0.5985905", "0.57638955", "0.5707318", "0.5645025", "0.56072253", "0.54957044", "0.54901606", "0.5485183", "0.5457616", "0.5453435", "0.5262661", "0.52122664", "0.5199306", "0.5167903", "0.5166903", "0.5107756", "0.5095502", "0.50909346", "0.502625...
0.69697094
0
Return the absolute path to the migration script folder.
def _migrations_path(): return join(dirname(dirname(dirname(sumo.__file__))), 'migrations')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migration_directory(self) -> str:\n\n with package_resources.path(\n f\"PyFunceble.data.{PyFunceble.cli.storage.ALEMBIC_DIRECTORY_NAME}\",\n \"__init__.py\",\n ) as file_path:\n result = os.path.split(file_path)[0]\n\n if PyFunceble.storage.CONFIGURATION.cl...
[ "0.771517", "0.7598042", "0.73491156", "0.72787374", "0.7230808", "0.6944726", "0.68556404", "0.6811978", "0.6753096", "0.669813", "0.6693428", "0.667507", "0.66400284", "0.66386336", "0.66133446", "0.6611378", "0.6556615", "0.65509653", "0.6544871", "0.6544871", "0.6486247",...
0.8255686
0
Assert that the numeric prefixes of the DB migrations are unique.
def test_unique(self): leading_digits = re.compile(r'^\d+') seen_numbers = set() path = self._migrations_path() for filename in listdir(path): match = leading_digits.match(filename) if match: number = match.group() if number in seen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_prefix(self):\n self.chck_triple('prefix')", "def test_strip_column_prefix():\n assert strip_column_prefix(\"ts_some_name\") == \"some_name\"\n assert strip_column_prefix(\"some_name\") == \"some_name\"\n # only the prefix may be stripped\n assert strip_column_prefix(\"ts_some_ts_name...
[ "0.6097303", "0.6040116", "0.5913195", "0.58292675", "0.58030826", "0.57863855", "0.56782293", "0.5632286", "0.5627914", "0.55827665", "0.55247986", "0.55160433", "0.55130035", "0.5502277", "0.5491454", "0.5479071", "0.5462152", "0.54441065", "0.5438034", "0.5420087", "0.5418...
0.7371309
0
Make sure each created table uses the InnoDB engine and UTF8.
def test_innodb_and_utf8(self): # Heuristic: make sure there are at least as many "ENGINE=InnoDB"s as # "CREATE TABLE"s. (There might be additional "InnoDB"s in ALTER TABLE # statements, which are fine.) path = self._migrations_path() for filename in sorted(listdir(path)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correct_db_schema_utf8(\n instance: Recorder, table_object: type[DeclarativeBase], schema_errors: set[str]\n) -> None:\n table_name = table_object.__tablename__\n if (\n f\"{table_name}.4-byte UTF-8\" in schema_errors\n or f\"{table_name}.utf8mb4_unicode_ci\" in schema_errors\n ):\n ...
[ "0.62925166", "0.62717134", "0.61080253", "0.60827583", "0.5985917", "0.59618616", "0.59618616", "0.59530646", "0.5951511", "0.5904364", "0.5888538", "0.5878991", "0.5784848", "0.57627964", "0.5762103", "0.57413745", "0.5698418", "0.5692719", "0.5662284", "0.56588584", "0.565...
0.7256668
0
Decorate a model maker to add a `save` kwarg. If save=True, the model maker will save the object before returning it.
def with_save(func): @wraps(func) def saving_func(*args, **kwargs): save = kwargs.pop('save', False) ret = func(*args, **kwargs) if save: ret.save() return ret return saving_func
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_auto_save(func: Callable):\n\n @wraps(func)\n def _wrapped(self, *args, **kwargs):\n return_val = func(self, *args, **kwargs)\n if self.auto_save:\n self.save_metadata()\n return return_val\n\n return _wrapped", "def save_model(self, *args, **kwargs):\n rais...
[ "0.6469919", "0.5738694", "0.572271", "0.52655745", "0.52434915", "0.5209758", "0.51709205", "0.5067467", "0.50492924", "0.50204456", "0.5005135", "0.49688715", "0.49463245", "0.49134701", "0.4888065", "0.48869237", "0.48869237", "0.48869237", "0.48597857", "0.48505533", "0.4...
0.7034841
0
Create a list of requirements from given items.
def _do_install_prepare_reqs(self, action): def _make_req(string): try: return Requirement(string) except Exception: raise YAMLException( "Could not parse requirement {!r} from {!r}", string, act...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reconstruct_requirements(req_records):\n recs = [req_record[\"r\"] for req_record in req_records]\n return [Requirement(rec[\"class\"], {k: v for k, v in rec.items() if k != \"class\"})\n for rec in recs]", "def requirements(self):\n requirements = []\n return requirements", ...
[ "0.6201311", "0.6112178", "0.6092989", "0.5920086", "0.58888817", "0.58846074", "0.5810434", "0.5724193", "0.56695217", "0.5665077", "0.5657579", "0.56431586", "0.5634644", "0.5563239", "0.549878", "0.54696786", "0.54629296", "0.5439147", "0.54229116", "0.54197514", "0.537487...
0.61878824
1
Subtract current model from residuals In matrix notation Tamuz et al. write (Eq. 6) R' = R c a^T. The operation here implemented corresponds to (R' = R c^T)^T > R'^T = R^T a c^T (where ^T is the transpose, R is a matrix and a and c are vectors). Returns
def sysrem_update_rij(rij, a, c): return rij - np.outer(a,c)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def residual_of(self, z):\n return np.subtract(z, self.HJacob(self.x)@self.x_prior)", "def residual_of(self, z):\n raise \"Not implemented yet\"\n return z - dot(self._H, self._x)", "def back_substitution(self):\r\n for col in range(self.SIZE - 1, -1, -1):\r\n self.check_...
[ "0.597161", "0.57674617", "0.5653328", "0.5619851", "0.5587978", "0.55241704", "0.5420099", "0.53882575", "0.5380549", "0.5333551", "0.53246033", "0.5320975", "0.5320975", "0.5320975", "0.53125983", "0.5295911", "0.5267064", "0.52474755", "0.5243254", "0.52172714", "0.5211965...
0.59686255
1
Get model corresponding to a,c vector
def get_model(self, last=True, a=None, c=None): if (a is not None) and (c is not None) and (not last): return np.outer(a, c) elif last and (a is None) and (c is None): if len(self.rijs) == 0: raise(PE.PyAValError("Last model requested, but no model exists...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recognition_model(self, x, c):\n x = self.encoder(x)\n c = self.conditional(c)\n temp = self.recog_head(x + c)\n mu = self.mu(temp)\n logvar = self.logvar(temp)\n return mu, logvar", "def recognition_model(self, x, c):\n x = self.encoder(x)\n c = self.c...
[ "0.5943117", "0.5943117", "0.59274226", "0.5790551", "0.57192355", "0.56776786", "0.5629956", "0.5623865", "0.55425984", "0.5500118", "0.5482155", "0.54582584", "0.5437091", "0.5437091", "0.54246694", "0.5345569", "0.5322276", "0.527424", "0.5258969", "0.5258677", "0.52557236...
0.6103821
0
Get the cumulative model (sum of all available models)
def get_cumulative_model(self): cm = None for ac in self.ac: if ac[0] is None: continue m = self.get_model(last=False, a=ac[0], c=ac[1]) cm = m if cm is None else cm+m return cm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_cumulative_mig(model):\r\n return sum(cumulative_mig_list)", "def cum_sum(self):\n\n # create cdo command and runit\n cdo_command = \"cdo -timcumsum\"\n run_this(cdo_command, self, output=\"ensemble\")", "def total_models_produced(self):\n return self._total_models_produced", "def...
[ "0.7080301", "0.62270474", "0.5775094", "0.5704546", "0.55656356", "0.5501783", "0.5465801", "0.53405565", "0.5286122", "0.5220785", "0.5193036", "0.5148923", "0.51433724", "0.51247233", "0.5121645", "0.51210314", "0.51171476", "0.50669336", "0.50564367", "0.5048346", "0.5048...
0.8100918
0
from the documents retrieved, score= exp(score) and then normalize according to sum normalization file is an input file claim num, alpha, beta for each alpha beta, create and than add to it the different claims' doc scores
def normalize_doc_scores(): # doc_res_files_path = base_path+r"claimLM_docLM_doc_ret_output" claims_file_counters_dict = {} #for each claim numas key, have the val a counter - if not 110 per claim -> problem! doc_res_files_path = linux_base_path+"/claimLM_docLM_doc_ret_output" # doc_res_files_path = bas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_sen_scores_corpus_smoothing():\n param_len = 10*11# for alpha*beta =110 \n k_len = 1\n# sen_res_files_path = linux_base_path+r\"/claimLM_senLM_sen_ret_output_corpus_smoothing_corpus_beta_\"+str(corpus_beta)\n sen_res_files_path = base_path+r\"\\claimLM_senLM_sen_ret_output_corpus_smooth...
[ "0.71356165", "0.65784204", "0.63003385", "0.61383694", "0.5840401", "0.5776091", "0.5764244", "0.5727677", "0.57261246", "0.572611", "0.57091475", "0.568436", "0.56770676", "0.5667565", "0.5643428", "0.561692", "0.5612546", "0.5585787", "0.5582222", "0.55724305", "0.55332166...
0.75903165
0
from the sen retrieved, score= exp(score) and then normalize according to sum normalization file is an output file claim num, alpha, beta for each alpha beta, create and than add to it the different claims' doc scores
def normalize_sen_scores_corpus_smoothing(): param_len = 10*11# for alpha*beta =110 k_len = 1 # sen_res_files_path = linux_base_path+r"/claimLM_senLM_sen_ret_output_corpus_smoothing_corpus_beta_"+str(corpus_beta) sen_res_files_path = base_path+r"\claimLM_senLM_sen_ret_output_corpus_smoothing_corpus_be...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_doc_scores():\n# doc_res_files_path = base_path+r\"claimLM_docLM_doc_ret_output\"\n claims_file_counters_dict = {} #for each claim numas key, have the val a counter - if not 110 per claim -> problem!\n doc_res_files_path = linux_base_path+\"/claimLM_docLM_doc_ret_output\"\n# doc_res_fil...
[ "0.7415285", "0.707976", "0.66742116", "0.5899873", "0.5807724", "0.5787788", "0.57867104", "0.5783012", "0.57770485", "0.56916255", "0.56486267", "0.5600242", "0.5599083", "0.55359215", "0.5517576", "0.55115044", "0.5456102", "0.54504824", "0.54460424", "0.5435197", "0.54262...
0.7378386
1
for each alpha and beta values, Get the top k =[50,100,500] docs from which sentences will be retrieved As one of the setups is a according to the LM of the sen and the corpus alone (as done with usual sentence retieval in Indri) then I will create a file for Indri as done in pool creation n ret' process add the top do...
def get_top_k_docs(): # doc_res_dicts_path = base_path+"\\docs_norm_scores_dicts" # sen_ret_input_path = base_path+"\\claimLM_senLM_sen_ret_input" doc_res_dicts_path = linux_base_path+"/docs_norm_scores_dicts" sen_ret_input_path = linux_base_path+"/claimLM_senLM_sen_ret_input" claims_no_SW_dict = re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_sen_scores_corpus_smoothing():\n param_len = 10*11# for alpha*beta =110 \n k_len = 1\n# sen_res_files_path = linux_base_path+r\"/claimLM_senLM_sen_ret_output_corpus_smoothing_corpus_beta_\"+str(corpus_beta)\n sen_res_files_path = base_path+r\"\\claimLM_senLM_sen_ret_output_corpus_smooth...
[ "0.7060057", "0.6779933", "0.6676571", "0.66038054", "0.65266526", "0.61835426", "0.61230075", "0.6115115", "0.60696673", "0.60688215", "0.6056709", "0.6049824", "0.603279", "0.6032701", "0.60288477", "0.6004372", "0.598134", "0.5977768", "0.5961952", "0.5930355", "0.59214824...
0.77609736
0
for each alpha, beta value turn the docs norms dicts to a single dict for all claims sen_norm_scores_dicts_path = base_path+"\\sen_norm_scores_dicts" for each alpha,beta, k value turn the sens norms dicts to a single dict for all claims
def merge_all_claims_norm_dicts_for_docs(): # docs_norm_scores_dicts_path = base_path+"\\docs_norm_scores_dicts" docs_norm_scores_dicts_path = linux_base_path+"/docs_norm_scores_dicts" # all_claims_norms_scores_merged_dict = base_path +"\\all_claims_norms_scores_merged_dict" all_claims_norms_scores...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_sen_scores_corpus_smoothing():\n param_len = 10*11# for alpha*beta =110 \n k_len = 1\n# sen_res_files_path = linux_base_path+r\"/claimLM_senLM_sen_ret_output_corpus_smoothing_corpus_beta_\"+str(corpus_beta)\n sen_res_files_path = base_path+r\"\\claimLM_senLM_sen_ret_output_corpus_smooth...
[ "0.7088313", "0.67298317", "0.65189683", "0.61524886", "0.5593098", "0.55304724", "0.5519807", "0.54319054", "0.5411976", "0.53833836", "0.53432316", "0.5338235", "0.5274585", "0.526474", "0.5180783", "0.5180489", "0.51749146", "0.51542217", "0.51415366", "0.5109483", "0.5080...
0.76682496
0
on the document retrieval results, calc the MAP
def calc_doc_ret_MAP(): # docs_norm_scores_dicts_path = linux_base_path+"/docs_norm_scores_dicts" claim_rel_docno_dict = read_pickle("claim_rel_docno_dict") #key is clm, value is a set of the relevant docno # nDCG_MAP_res = base_path +"\\nDCG_MAP_res\\" # docs_norms_path = base_path+"\\docs_norm_sc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _docMapping(self):\n doc2quests = defaultdict(list)\n for q, d in self.quest2doc.items():\n doc2quests[d].append(q)\n return doc2quests", "def map():", "def getResults():", "def _apply_mapping(self, document, mapping):\n if not mapping:\n return document\...
[ "0.6114611", "0.6031638", "0.59947586", "0.5955202", "0.58502626", "0.5790254", "0.57628024", "0.5761751", "0.5743886", "0.57371366", "0.5696955", "0.5681318", "0.56573915", "0.56136465", "0.5600608", "0.5599281", "0.55984145", "0.5586433", "0.5571157", "0.55652666", "0.55601...
0.64025724
0
1. Leave one out each claim, 2. For every possible value of alpha,beta,lambda calc the nDCG,MAP on the train claims (without the left out) 3. Find the configuration that maximises the measures 4. report the meatures of th e left out claim with this configuration
def find_best_free_param_configuration_LOO_adj_sen(p): measures_res = linux_base_path+ "/measures_res"+setup+"/" # measures_res = base_path +"\\measures_res"+setup+"\\" # nDCG_MAP_res = base_path +"\\nDCG_MAP_res\\" claim_dict = read_pickle("claim_dict") claim_num_list = [4,7,17,21,36,37,39,40,41,4...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_best_free_param_configuration_LOO_corpus_smoothing(p,alpha_range,beta_range,lambda_range):\n measures_res = linux_base_path+ \"/measures_res_corpus_smoothing_corpus_beta_\"+str(corpus_beta)+\"/\"\n# measures_res = \"/IBM_STORAGE/USERS_DATA/liorab/baseline_ret/sen_ret_corpus_smoothing_res/nDCG_MAP_r...
[ "0.6862903", "0.6270026", "0.62612617", "0.599234", "0.5982573", "0.5976929", "0.58862674", "0.58170885", "0.5773099", "0.57533056", "0.57435113", "0.571662", "0.56960785", "0.5683166", "0.5602618", "0.559545", "0.5578115", "0.5569379", "0.5545015", "0.5527642", "0.5518251", ...
0.70153874
0
1. Leave one out each claim, 2. For every possible value of alpha,beta,lambda calc the nDCG,MAP on the train claims (without the left out) 3. Find the configuration that maximises the measures 4. report the meatures of th e left out claim with this configuration
def find_best_free_param_configuration_LOO_corpus_smoothing(p,alpha_range,beta_range,lambda_range): measures_res = linux_base_path+ "/measures_res_corpus_smoothing_corpus_beta_"+str(corpus_beta)+"/" # measures_res = "/IBM_STORAGE/USERS_DATA/liorab/baseline_ret/sen_ret_corpus_smoothing_res/nDCG_MAP_res_corpus_sm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_best_free_param_configuration_LOO_adj_sen(p):\n\n measures_res = linux_base_path+ \"/measures_res\"+setup+\"/\"\n# measures_res = base_path +\"\\\\measures_res\"+setup+\"\\\\\"\n# nDCG_MAP_res = base_path +\"\\\\nDCG_MAP_res\\\\\"\n claim_dict = read_pickle(\"claim_dict\")\n claim_num_lis...
[ "0.7014755", "0.6269574", "0.6260426", "0.59911776", "0.5981472", "0.597715", "0.5884376", "0.58172673", "0.5771162", "0.5752471", "0.57429314", "0.5715644", "0.56959563", "0.5682965", "0.5601803", "0.55960995", "0.55781525", "0.55682933", "0.5544764", "0.5527773", "0.5518287...
0.68619835
1
Update a source Docker image with environment config and publish it to deisregistry.
def publish_release(self, source, config, target, deis_registry): # get the source repository name and tag src_name, src_tag = docker.utils.parse_repository_tag(source) # get the target repository name and tag name, tag = docker.utils.parse_repository_tag(target) # strip any "htt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(self, source, config, repo, tag):\n check_blacklist(repo)\n env = ' '.join(\"{}='{}'\".format(\n k, v.encode('unicode-escape').replace(\"'\", \"\\\\'\")) for k, v in config.viewitems())\n dockerfile = \"FROM {}\\nENV {}\".format(source, env)\n f = io.BytesIO(dockerf...
[ "0.610328", "0.5974144", "0.5876449", "0.57455844", "0.5714578", "0.57040226", "0.5610458", "0.5601322", "0.5594505", "0.5568667", "0.54921347", "0.54339135", "0.5416365", "0.5412983", "0.54030377", "0.53847176", "0.53753495", "0.5353201", "0.5352105", "0.5350578", "0.5342924...
0.6775295
0
Tag a local Docker image with a new name and tag.
def tag(self, image, repo, tag): check_blacklist(repo) logger.info("Tagging Docker image {} as {}:{}".format(image, repo, tag)) if not self.client.tag(image, repo, tag=tag, force=True): raise docker.errors.DockerException("tagging failed")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, repo, tag):\n logger.info(\"Pushing Docker image {}:{}\".format(repo, tag))\n stream = self.client.push(repo, tag=tag, stream=True, insecure_registry=True)\n log_output(stream)", "def update(tag_name: str):\n\n image_full_name = f\"{GITLAB_IMAGE_URL}:{tag_name}\"\n _buil...
[ "0.65464705", "0.65072083", "0.64666855", "0.6431756", "0.6422313", "0.62344396", "0.6217048", "0.6179603", "0.61187536", "0.6083696", "0.6049853", "0.60115", "0.6009453", "0.5975412", "0.5973849", "0.59461796", "0.5944714", "0.5910567", "0.5837", "0.5825065", "0.58246857", ...
0.71745235
0
Log a stream at DEBUG level, and raise DockerException if it contains "error".
def log_output(stream): for chunk in stream: logger.debug(chunk) # error handling requires looking at the response body if '"error"' in chunk.lower(): raise docker.errors.DockerException(chunk)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stream_error(self,err):\n self.__logger.debug(\"Stream error: condition: %s %r\"\n % (err.get_condition().name,err.serialize()))", "def debug(log):\n write(syslog.LOG_DEBUG, 'debug', '{log}'.format(log=log))", "def debug(msg, resource=None, stream_id=None):\n engine = get_engine...
[ "0.59884083", "0.5917202", "0.5891739", "0.56892204", "0.56684613", "0.5657212", "0.55786264", "0.55449605", "0.55404776", "0.55256677", "0.5513519", "0.5486321", "0.5478189", "0.5445965", "0.54356295", "0.54103154", "0.53925633", "0.53724486", "0.53709", "0.53615487", "0.535...
0.72306085
0
Conputes marginal error, the stopping criterion used to terminate Sinkhorn.
def marginal_error(geom: geometry.Geometry, a: jnp.ndarray, b: jnp.ndarray, tau_a: float, tau_b: float, f_u: jnp.ndarray, g_v: jnp.ndarray, norm_error: int, lse_mode) -> jnp.ndarray: if tau_b == 1.0: err = geom.error(f_u, g_v, b, 0, norm_error, lse_mode) elif tau_a == 1.0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _computeError(self, inputs, targets):\n return .5*np.sum((targets-self._pcnfwd(inputs))**2)", "def calc_error_dist(self):\n pass", "def cps_err(self):\n return np.sqrt(self.totalcounts) / self.exptime", "def calcError(self, inherited_error):\r\n\t\tif inherited_error == None:\t\t# ou...
[ "0.55752885", "0.55262184", "0.53878623", "0.53458256", "0.5242713", "0.5219906", "0.51388973", "0.513811", "0.51329106", "0.51179904", "0.50959706", "0.5045472", "0.5027726", "0.501926", "0.50111884", "0.5003115", "0.4994308", "0.49891266", "0.49881127", "0.49779963", "0.496...
0.6124
0
Computes grad of terms linked to marginals a, b in objective. Computes gradient w.r.t. f and g of terms in
def grad_of_marginal_fit(a, b, f, g, tau_a, tau_b, geom): if tau_a == 1.0: grad_a = a else: rho_a = geom.epsilon * tau_a / (1 - tau_a) grad_a = jnp.where(a > 0, a * derivative_phi_star(-f, rho_a), 0.0) if tau_b == 1.0: grad_b = b else: rho_b = geom.epsilon * tau_b / (1 - tau_b) grad_b =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grad(self,w):\n # Calculate the vector -sigma(-y_i * x_i.w)\n s = -np.array([sigmoid(-yi * np.dot(xi,w)) for xi,yi in zip(self.x,self.y)])\n # Multiply it by xy\n g = np.array([np.dot(xyj,s) for xyj in self.xy.transpose()])\n # Add regularisation\n g += self.alpha*w\n return g\n #g = np...
[ "0.70722276", "0.69424504", "0.6891617", "0.6874898", "0.6870639", "0.68621045", "0.68616676", "0.68609214", "0.6854778", "0.68153954", "0.6803334", "0.680243", "0.6780593", "0.6712635", "0.66944325", "0.6691906", "0.6669815", "0.6658177", "0.6646453", "0.6594153", "0.6582312...
0.7828975
0
Makes the snake move, head moves in current direction and each blocks replace its predecessor
def move(self): self.old_tail = self.body[-1][:] # save old position of last block self.head[0] += self.direction[0] # moves head self.head[1] += self.direction[1] self.head[0] = (self.head[0] + self.xMaxSize) % self.xMaxSize self.head[1] = (self.head[1] + s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __snake_move(self):\n self.__eat_candy()\n # move tail and body\n n_snake = len(self.__snake)\n for i in range(1, n_snake):\n s2 = self.__snake[n_snake - i]\n s1 = self.__snake[n_snake - i - 1]\n s2.move(s1.pos())\n # move head\n pos = ...
[ "0.7895844", "0.7185265", "0.7008609", "0.67999005", "0.6541893", "0.6265843", "0.6260639", "0.62456954", "0.62426347", "0.6241239", "0.62059575", "0.6096831", "0.6057173", "0.60542494", "0.6027465", "0.59052736", "0.58953947", "0.5891848", "0.5857788", "0.584062", "0.5828308...
0.79912674
0
Makes the snake direction to the right of the current direction Current direction = [x,y], turn_right gives [y,x]
def turn_right(self): temp = self.direction[0] self.direction[0] = -self.direction[1] self.direction[1] = temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_right(self):\n self.facing_direction += self.config\n if self.facing_direction > 7:\n self.facing_direction -= 8\n self.x, self.y = self.compute_positions()", "def turn_ship_right(self):\n self.degrees -= movement", "def turn_right(self):\n pass", "def t...
[ "0.7601584", "0.75017947", "0.74439204", "0.7421596", "0.7255912", "0.7253135", "0.7243722", "0.7217155", "0.71768004", "0.715687", "0.7089985", "0.7026401", "0.69998384", "0.69393873", "0.69342035", "0.6932262", "0.6792831", "0.6776827", "0.6776374", "0.6773701", "0.67681515...
0.8202334
0
Makes decision for the snake direction according to its current vision Vision is given to the NeuralNetwork and most activated output neuron is considered as decision
def AI(self): decision = np.argmax(self.neural_net.feed_forward(self.vision)) if decision == 1: self.turn_right() elif decision == 2: self.turn_left()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learning_Utility(self):\n # Shape the input that we give to the neural network with the value of sensors, the previous actions the life of the agent \n # Get the results from the sensors according the different movement executed by the agent \n sensors_result_N = self.agent.sensors(self, d...
[ "0.6688485", "0.6361603", "0.59948283", "0.5954132", "0.58629715", "0.58203393", "0.5806262", "0.5754885", "0.5748835", "0.57286066", "0.5708874", "0.5706578", "0.5691866", "0.5690479", "0.56737447", "0.56602836", "0.5638474", "0.56360745", "0.5631764", "0.5631183", "0.562801...
0.70886225
0
Display number of FANs installed on device
def numfans(): click.echo(_wrapper_get_num_fans())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_count():\n _check_init()\n return _pypm.CountDevices()", "def get_num_fans(self):\n return len(self._fan_list)", "def get_number_of_devices(self):\n return self.drt_manager.get_number_of_devices()", "def get_display_devs_count(self):\n\t\treturn call_sdk_function('PrlVmCfg_GetDisplayD...
[ "0.6714575", "0.644456", "0.6435766", "0.59978145", "0.58996135", "0.58919", "0.58656466", "0.5776997", "0.5773106", "0.56975675", "0.56902885", "0.5675769", "0.5651405", "0.56348354", "0.5632863", "0.56094426", "0.56056833", "0.55822414", "0.55681175", "0.55310243", "0.55297...
0.6648106
1
Display FAN airflow direction
def direction(index): supported_fan = list(range(1, _wrapper_get_num_fans() + 1)) fan_ids = [] if (index < 0): fan_ids = supported_fan else: fan_ids = [index] header = ['FAN', 'Direction'] status_table = [] for fan in fan_ids: fan_name = _wrapper_get_fan_name(fan) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_direction(self, feats):\n if feats.name == \"ARNC\":\n if feats[\"z-score\"] < -1.5:\n return Directions.long_dir\n elif feats[\"z-score\"] > 1.5:\n return Directions.short_dir\n elif feats.name == \"UNG\":\n if feats[\"z-scor...
[ "0.571697", "0.570948", "0.56856555", "0.55924267", "0.55637264", "0.55029374", "0.55010337", "0.54541796", "0.5447349", "0.5428513", "0.5391463", "0.5365725", "0.5363149", "0.52824366", "0.52821505", "0.5261962", "0.52349085", "0.5229372", "0.52178097", "0.51884", "0.5187201...
0.66997015
0
Display FAN speed in RPM
def getspeed(index): supported_fan = list(range(1, _wrapper_get_num_fans() + 1)) fan_ids = [] if (index < 0): fan_ids = supported_fan else: fan_ids = [index] if platform_chassis is not None: header = ['FAN', 'SPEED (RPM)'] else: header = ['FAN', 'Front Fan RPM', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fan_speed(self):\n return self.__fan_speed", "def get_fan_speed(self):\n response = self.parent.fancoolers.get_speed()\n if response is not None:\n response = response[0]\n return response", "def get_fan_speed_volts(self):\n return self.__fan_speed_raw ...
[ "0.6203536", "0.59481585", "0.59469396", "0.58515924", "0.5779223", "0.5757819", "0.57366604", "0.5703687", "0.56516325", "0.5622664", "0.5622664", "0.56049806", "0.5601598", "0.5575566", "0.5564433", "0.5561737", "0.5548297", "0.5547397", "0.55427736", "0.5536652", "0.553567...
0.6414959
0
Dump all Fan related SysFS paths
def dump_sysfs(): for fan in range(_wrapper_get_num_fans()): status = _wrapper_dump_sysfs(fan) if status: for i in status: click.echo(i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_sysfs():\n for psu in range(_wrapper_get_num_psus()):\n status = _wrapper_dump_sysfs(psu)\n\n if status:\n for i in status:\n click.echo(i)", "def get_file_systems(self):\n result = {}\n if os.access('/proc/mounts', os.R_OK):\n file = o...
[ "0.6681959", "0.55133736", "0.53833324", "0.5353859", "0.5342153", "0.53066385", "0.5271987", "0.5269195", "0.52592564", "0.5256507", "0.52527386", "0.5240411", "0.5195627", "0.51453215", "0.5107888", "0.50829154", "0.5072956", "0.5066273", "0.5066273", "0.5060286", "0.503605...
0.71562386
0
Run faostat > walden pipeline. Downloads the dataset from source, uploads it to Walden (DO/S3), creates the corresponding metadata file and places it in the walden local project repository.
def to_walden(self): with tempfile.NamedTemporaryFile() as f: # fetch the file locally files.download(self.source_data_url, f.name) # add it to walden, both locally, and to our remote file cache add_to_catalog(self.metadata, f.name, upload=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(unused_argv):\n make_dir(FLAGS.raw_dir)\n\n # Get paths of download/extracted training and evaluation files.\n print(\"Downloading data from source\")\n train_files = get_raw_files(FLAGS.raw_dir, constants.TRAIN_DATA_SOURCES)\n eval_files = get_raw_files(FLAGS.raw_dir, constants.EVAL_DATA_SOURCES)", ...
[ "0.6101038", "0.59202915", "0.58754313", "0.57625264", "0.5744202", "0.5728764", "0.5715347", "0.56936353", "0.5672364", "0.5663005", "0.5636707", "0.5596809", "0.5572518", "0.55700964", "0.5529982", "0.55235684", "0.5514555", "0.55031085", "0.549753", "0.5478355", "0.5470127...
0.6103682
0
Analyze the TIFF image header, which is "specific" for Philips/FEI 30XL microscope control software (running under WinNT from early 2000s)
def analyze_header_XL30(imname, allow_underscore_alias=True): try: with open(imname, encoding = "ISO-8859-1") as of: # TODO seek for [DatabarData] first, then count the 194 lines! ih = dict(l.strip().split(' = ') for l in of.read().split('\n')[:194] if '=' in l) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_header (filename, htypes=None):\n\n # dictionary\n dict_head = {\n # raw header\n # commenting out SIMPLE, BSCALE and BZERO - basic keywords\n # that will be present in images but not in binary fits tables\n #'SIMPLE': {'htype':'raw', 'dtype':bool, 'DB':False, 'None_...
[ "0.6709758", "0.63940704", "0.6387472", "0.6311921", "0.627738", "0.62717474", "0.62314963", "0.62271684", "0.61668515", "0.61574554", "0.60508275", "0.6018981", "0.60126644", "0.6010723", "0.59902763", "0.593532", "0.5927394", "0.5897869", "0.57868385", "0.57868385", "0.5757...
0.66334915
1
For a given set of dimensionless heat capacity data `Cvlist` corresponding to temperature list `Tlist` in K, fit `Nvib` harmonic oscillator and `Nrot` hindered internal rotor modes. External and other previouslyknown modes should have already been removed from `Cvlist` prior to calling this function. You must provide a...
def fitStatmechToHeatCapacity(Tlist, Cvlist, Nvib, Nrot, molecule=None): # You must specify at least 7 heat capacity points to use in the fitting; # you can specify as many as you like above that minimum if len(Tlist) < 7: raise StatmechFitError('You must specify at least 7 heat capacity points to ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitStatmechDirect(Tlist, Cvlist, Nvib, Nrot, molecule=None):\n\n # Construct the lower and upper bounds for each variable\n bounds = []\n # Bounds for harmonic oscillator frequencies\n for i in range(Nvib):\n bounds.append((hoFreqLowerBound, hoFreqUpperBound))\n # Bounds for hindered roto...
[ "0.6258205", "0.59177995", "0.57747304", "0.53855324", "0.52379996", "0.5189323", "0.51705194", "0.5094938", "0.5057895", "0.49590996", "0.49028978", "0.48883164", "0.4881741", "0.48618186", "0.48579624", "0.4830536", "0.47857985", "0.47836864", "0.47786778", "0.47585952", "0...
0.6634018
0
Fit `Nvib` harmonic oscillator and `Nrot` hindered internal rotor modes to the provided dimensionless heat capacities `Cvlist` at temperatures `Tlist` in K. This method assumes that there are enough heat capacity points provided that the vibrational frequencies and hindered rotation frequency barrier pairs can be fit d...
def fitStatmechDirect(Tlist, Cvlist, Nvib, Nrot, molecule=None): # Construct the lower and upper bounds for each variable bounds = [] # Bounds for harmonic oscillator frequencies for i in range(Nvib): bounds.append((hoFreqLowerBound, hoFreqUpperBound)) # Bounds for hindered rotor frequencie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitStatmechToHeatCapacity(Tlist, Cvlist, Nvib, Nrot, molecule=None):\n\n # You must specify at least 7 heat capacity points to use in the fitting;\n # you can specify as many as you like above that minimum\n if len(Tlist) < 7:\n raise StatmechFitError('You must specify at least 7 heat capacity ...
[ "0.7132348", "0.6019964", "0.57076234", "0.5255491", "0.5208966", "0.50486803", "0.49962127", "0.49387914", "0.48546904", "0.47602648", "0.4752867", "0.47441545", "0.47350878", "0.47301233", "0.4673184", "0.46208584", "0.46154496", "0.46078372", "0.45996413", "0.45746738", "0...
0.6103077
1