query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Create Pipeline instance from dictionary data structure, containing at least "id" and "runs" keys. The "runs" key must have a list of dict, and each dict is parsed using Run.from_data. Raises KeyError if a required key is missing.
def from_data(cls, data): runs_data = data["runs"] working_dir = data["working_dir"] apps_dir = data.get("apps_dir") # Read tau options and ensure tau_exec is in PATH tau_profiling = data.get("tau_profiling", False) tau_tracing = data.get("tau_tracing", False) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, dikt) -> 'PipelineDefinition':\n return util.deserialize_model(dikt, cls)", "def from_dict(cls, data):\n requirements = {k: v for k, v in data['params']['requirements'].items()}\n return cls(requirements)", "def from_dict(cls, data: Dict[str, any]):\n return cls(*...
[ "0.62826705", "0.5836043", "0.57351434", "0.5706999", "0.56834847", "0.5664038", "0.56130713", "0.5518909", "0.55022204", "0.54202926", "0.5388858", "0.5361477", "0.52798754", "0.52520746", "0.5250068", "0.52363145", "0.5198829", "0.5178344", "0.5171866", "0.51331735", "0.512...
0.71467227
0
Start all runs in the pipeline, along with threads that monitor their progress and signal consumer when finished. Use join_all to wait until they are all finished.
def _start(self): _log.debug("Pipeline {} launching run components".format(self.id)) self._start_time = time.time() for run in self.runs: run.start() if run.sleep_after: time.sleep(run.sleep_after)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invoke_all_and_wait(self):\n list_promise = []\n for thread in self.__list_thread:\n thread.start()\n list_promise.append(thread)\n for process in list_promise: process.join()", "def _join_running_pipelines(self):\n still_running = list(self._running_pipeline...
[ "0.69185233", "0.6915545", "0.6590577", "0.65650755", "0.650658", "0.6440931", "0.6338167", "0.63376737", "0.63204694", "0.6094544", "0.60749394", "0.60620654", "0.5973233", "0.59609616", "0.59609616", "0.59380203", "0.5928629", "0.5912606", "0.5897279", "0.58685094", "0.5848...
0.60917056
10
Returns the product model that is used by this cart.
def get_product_model(): return _get_module(settings.CART_PRODUCT_MODEL)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model(self):\n return Product", "def product(self):\n return self._product", "def product(self):\n return self._product", "def product(self):\n return self._product", "def get_card_product(self):\n\n return self.card_product", "def model(self) -> Model:\n ret...
[ "0.7923212", "0.7329233", "0.7329233", "0.7329233", "0.7027875", "0.69704604", "0.68747425", "0.6841671", "0.6765259", "0.67052335", "0.6700221", "0.6680645", "0.66567427", "0.6653926", "0.6578887", "0.6549363", "0.6540445", "0.65371966", "0.64235234", "0.6414897", "0.6409914...
0.817874
0
Returns the class that is used by this cart for its items.
def get_cart_item_class(): return _get_module(carton_settings.CART_ITEM_CLASS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_product_class(self):\n if self.is_child:\n return self.parent.product_class\n else:\n return self.product_class", "def _get_class(self, item):\n\t\t# it's already a class, return it\n\t\tif type(item) == type:\n\t\t\treturn item\n\n\t\t# get the class\n\t\treturn item....
[ "0.74389124", "0.73782074", "0.7159134", "0.69944555", "0.68042964", "0.65821123", "0.64814126", "0.64621717", "0.6374596", "0.6303918", "0.6267455", "0.626183", "0.62356424", "0.6226835", "0.62168664", "0.6211506", "0.618528", "0.61821634", "0.61821634", "0.6170714", "0.6121...
0.83166784
0
Convert a DNSSEC algorithm value to text value, an ``int`` a DNSSEC algorithm. Returns a ``str``, the name of a DNSSEC algorithm.
def algorithm_to_text(value): text = _algorithm_by_value.get(value) if text is None: text = str(value) return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def algorithm_from_text(text):\n\n value = _algorithm_by_text.get(text.upper())\n if value is None:\n value = int(text)\n return value", "def algorithm(self) -> str:\n return pulumi.get(self, \"algorithm\")", "def algorithm(self) -> str:\n return pulumi.get(self, \"algorithm\")", ...
[ "0.6194019", "0.5925451", "0.5925451", "0.5837144", "0.5816566", "0.56493956", "0.56332815", "0.5512348", "0.5488962", "0.5472465", "0.5460301", "0.5432506", "0.54019254", "0.5278066", "0.5278066", "0.5278066", "0.5278066", "0.52765304", "0.5237211", "0.52275324", "0.52275324...
0.7657377
0
Obtain the latest version of a given package name from Pypi.
def get_latest_version_number(package_name: str) -> str: r = requests.get(os.path.join("https://pypi.org/pypi/", package_name, "json")) return r.json().get("info").get("version")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pypi_version(name):\n r = requests.get(\"https://pypi.org/pypi/{name}/json\".format(name=name))\n return r.json()[\"info\"][\"version\"]", "def get_pypi_latest_version(package_name: str, only_stable_version: bool) -> str:\n\n #\n # reterive package data\n #\n\n json_response = _retreive...
[ "0.78697866", "0.77563596", "0.7564214", "0.74963534", "0.7230627", "0.7162591", "0.710268", "0.7063345", "0.7051173", "0.6964184", "0.68492466", "0.6845399", "0.6827669", "0.6761373", "0.6666752", "0.6664775", "0.66629547", "0.664778", "0.6631957", "0.65878826", "0.6587769",...
0.8176022
0
O(nklog(k)) in time, O(1) in space, with heap
def mergeKLists3(self, lists: 'List[ListNode]') -> 'ListNode': if not lists or not lists[0]: return None newList = ListNode(0) curr = newList # build heap heap = [] for i in range(len(lists)): if lists[i]: heapq.heappush(heap, (lis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildHeap(A):\n n = len(A)\n for i in range(n/2-1, -1, -1):\n heapify(A, i, n)", "def down_heap(array, k, n):\n new_elem = array[k]\n while k <= n / 2:\n child = 2 * k\n if child < n and array[child] < array[child + 1]:\n child += 1\n ...
[ "0.64962316", "0.64651793", "0.6337879", "0.63116044", "0.63019454", "0.6282743", "0.62584156", "0.622449", "0.6169023", "0.6160081", "0.6159929", "0.6110873", "0.60850936", "0.608084", "0.60737044", "0.6069754", "0.6024432", "0.60162973", "0.60097426", "0.5999193", "0.595742...
0.0
-1
Broadcast X and Y, while ignoring the last axis of X and Y. If X.shape = xs + (i,) and Y.shape = ys + (j,) then the output arrays have shapes Xb.shape = zs + (i,) Yb.shape = zs + (j,) where zs is the shape of the broadcasting of xs and ys shaped arrays.
def generalized_broadcast(arrays): arrays1 = np.broadcast_arrays(*[A[..., 0] for A in arrays]) shapes_b = [A1.shape + (A.shape[-1],) for A1, A in zip(arrays1, arrays)] strides_b = [A1.strides + (A.strides[-1],) for A1, A in zip(arrays1, arrays)] arrays_b = [as_strided(A, shape=shape_Ab, strides=strides_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def broadcast_arrays(*args):\n args = [np.asarray(_m) for _m in args]\n shapes = [x.shape for x in args]\n if len(set(shapes)) == 1:\n # Common case where nothing needs to be broadcasted.\n return args\n shapes = [list(s) for s in shapes]\n strides = [list(x.strides) for x in args]\n ...
[ "0.5937629", "0.58346087", "0.5689254", "0.568108", "0.56589913", "0.5616185", "0.5616185", "0.5616185", "0.5601964", "0.55948716", "0.55785406", "0.55062014", "0.5502236", "0.5474832", "0.54602015", "0.54562664", "0.54482216", "0.527015", "0.5242044", "0.52245086", "0.522285...
0.5977688
0
return an ArgumentParser instance that is configured with options for the commandline interface.
def define_options(progname): description = "send a notification message to subscribers via configured channels" epilog = None parser = ArgumentParser(progname, None, description, epilog) parser.add_argument('-c', '--config', type=str, dest='cfgfile', metavar='FILE', default=No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_line_argument_parser() -> argparse.ArgumentParser:\n parser = argparse.ArgumentParser(\n description=description(),\n epilog=epilog(),\n formatter_class=argparse.RawDescriptionHelpFormatter,\n )\n return parser", "def command_line_argument_parser() -> argparse.ArgumentPa...
[ "0.81277025", "0.81277025", "0.78262836", "0.7479633", "0.74738", "0.7468879", "0.74442804", "0.74085265", "0.73349726", "0.72832996", "0.7278386", "0.7241651", "0.72396564", "0.7236881", "0.7210148", "0.71748155", "0.71455896", "0.7129466", "0.7121451", "0.7096999", "0.70825...
0.0
-1
Given a path, split into all parts.
def split_all( path ): ret = [] while True: head, tail = os.path.split( path ) if len( tail ) > 0: ret.append( tail ) if head == path: ret.append( head ) break path = head return ret[::-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitPath(self, path):\n return os.path.split(path)", "def __split_path(path: str) -> List[str]:\n return [part for part in path.split('/') if part] # Splits path at '/', handles extra slashes in the process", "def split_path(self, path):\n path = path.strip(\"/\")\n return pa...
[ "0.81495583", "0.8060876", "0.79306364", "0.7920623", "0.78465366", "0.7785627", "0.7779942", "0.77788496", "0.7643702", "0.76115966", "0.75535864", "0.7540321", "0.75140643", "0.7388313", "0.7341422", "0.73352027", "0.73327816", "0.7319796", "0.7313663", "0.7296013", "0.7280...
0.73703057
14
Convert MACs to string.
def macs_to_str(self, reached_max_depth: bool) -> str: if self.num_params > 0 and ( reached_max_depth or not any(self.module.children()) ): return f"{self.macs:,}" return "--"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mac_ntoa(mac):\n return '%.2x:%.2x:%.2x:%.2x:%.2x:%.2x' % tuple(map(ord, list(mac)))", "def get_mac_string():\n mac_int = getnode()\n mac_str = ':'.join((\"%012x\" % mac_int)[i:i + 2] for i in range(0, 12, 2))\n return mac_str", "def get_mac(self) -> str:\n hex_mac = hexlify(self.message)...
[ "0.7712281", "0.7533739", "0.7033478", "0.70192784", "0.68408644", "0.683976", "0.6832208", "0.6826157", "0.66243434", "0.6585789", "0.6569437", "0.6560742", "0.6419041", "0.6409777", "0.6409777", "0.6400001", "0.6359617", "0.6337561", "0.6329451", "0.6294302", "0.6282555", ...
0.653292
12
Convert num_params to string.
def num_params_to_str(self, reached_max_depth: bool = False) -> str: if self.is_recursive: return "(recursive)" if self.num_params > 0: param_count_str = f"{self.num_params:,}" if reached_max_depth or not any(self.module.children()): if not self.traina...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_params(self, size):\n msg = []\n if self.params:\n msg = ['$PARAMS\\n']\n for (key, param) in sorted(self.params.iteritems()):\n msg.append(param.print_card(size))\n return ''.join(msg)", "def param_str(self, pnames=None):\n l = self.get...
[ "0.6304768", "0.626755", "0.6180778", "0.61469966", "0.6001768", "0.59285706", "0.5891182", "0.58489877", "0.58152467", "0.57227284", "0.5719443", "0.5696451", "0.56889254", "0.56834644", "0.5675154", "0.5647663", "0.56351095", "0.5628327", "0.5628327", "0.5628327", "0.562832...
0.74791616
0
Convert the number from string to float type without builtin function float
def pseudo_float(string_num): sign = {'+': 1, '-': -1}.get(string_num[0], 1) # Get unary operation if string_num[0] in '+-': string_num = string_num[1:] if string_num[0] == '.': string_num = '0' + string_num if '.' in string_num: int_part, fract_part...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_str_float(x):\n\ttry:\n\t\treturn float(x)\n\texcept ValueError:\n\t\tprint(\"must be a number\")", "def _convert_to_float(s):\n try:\n return float(s)\n except:\n return s", "def _to_float(self, s: str) -> float:\n return int(s[:-1]) / 1e9 if s.endswith('n') else float(s...
[ "0.85335606", "0.84020936", "0.8246393", "0.81158775", "0.80919737", "0.8054082", "0.80037856", "0.7865081", "0.78474545", "0.7765933", "0.7759682", "0.7738867", "0.77240354", "0.76826197", "0.76430243", "0.7627505", "0.76047254", "0.76012415", "0.7576136", "0.7575462", "0.75...
0.74269557
29
Transform an array with one flattened image per row, into an array in which images are reshaped and layed out like tiles on a floor. This function is useful for visualizing datasets whose rows are images, and also columns of matrices for transforming those rows (such as the first layer of a neural net).
def tile_raster_images(X, img_shape, tile_shape, tile_spacing=(0, 0), scale_rows_to_unit_interval=True, output_pixel_vals=True): assert len(img_shape) == 2 assert len(tile_shape) == 2 assert len(tile_spacing) == 2 # The expression below can be re-written i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flattenImage(input_array):\r\n shp = np.size(input_array)\r\n return np.reshape(input_array, (shp,))", "def flatten_image(x):\n *batch_shape, h, w, c = x.shape\n return x.reshape((*batch_shape, h * w * c))", "def reshape_pixel_array(self, pixel_arr):\n reshaped_pixel_arr = []\n n ...
[ "0.76184297", "0.69537", "0.68663317", "0.6771791", "0.65826255", "0.6561428", "0.64458716", "0.64410496", "0.64410496", "0.64410496", "0.63503015", "0.63122076", "0.6275036", "0.62737244", "0.6262288", "0.62448776", "0.62002105", "0.61763865", "0.61444575", "0.6124879", "0.6...
0.58482873
40
Opens a new database connection if there is none yet for the current application context.
def get_db(): if not hasattr(g, 'sqlite_db'): g.sqlite_db = connect_db() return g.sqlite_db
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_open():\n if not hasattr(g, 'sqlite_db'):\n g.sqlite_db = db_connect()\n return g.sqlite_db", "def open_database(self):\n if self._conn is None:\n self._conn = sqlite3.connect(self._db_path)", "def open_db(db_name: str = DB_NAME) -> DBConnection:\n return sqlite3.connec...
[ "0.7737639", "0.7582971", "0.73180443", "0.71693045", "0.70220166", "0.6966687", "0.6954785", "0.69486743", "0.6897534", "0.6842663", "0.68292314", "0.68191963", "0.680592", "0.67950195", "0.67697805", "0.6762173", "0.6751266", "0.6746273", "0.67316663", "0.670031", "0.668866...
0.640242
80
Define layers for a vanilla rnn encoder
def __init__(self, vocab_size, embedding_size, output_size, lat_dim): super(Encoder, self).__init__() self.vocab_size = vocab_size self.embedding = nn.Embedding(vocab_size, embedding_size) self.lstm = nn.LSTM(embedding_size, output_size) self.hidden2mean = nn.Linear(out...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _define_encoder(self):\n self.encoder = nn.Sequential(nn.Conv2d(in_channels=3, out_channels=32, kernel_size=4, stride=2, padding=1), # B, 32, 32, 32\n nn.SELU(),\n nn.Conv2d(32, 32, 4, 2, 1), # B, 32, 16, 16\n ...
[ "0.7218295", "0.71548826", "0.6907792", "0.66667175", "0.65487325", "0.6534074", "0.6520071", "0.647997", "0.64723253", "0.6469614", "0.64522153", "0.6433063", "0.64292246", "0.6428599", "0.64261454", "0.64033186", "0.6395273", "0.63338053", "0.6322398", "0.63109756", "0.6310...
0.0
-1
Returns the total gravitational force acting on the body from the Earth and Moon.
def force_on_satellite(position, mass): earth_grav_force = gravitational_force(position, mass, earth_position, earth_mass) moon_grav_force = gravitational_force(position, mass, moon_position, moon_mass) F_x = earth_grav_force[0] + moon_grav_force[0] F_y = earth_grav_force[1] + moon_grav_force[1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gravitation_force(self, other):\n force = ((CONSTANTS.G * self.mass * other.mass) /\n (self.distance(other) ** 2))\n return force", "def force_gravity(body1, body2, rel_positions):\n r_mag = np.linalg.norm(rel_positions)\n F = (CONST_G * body1.mass * body2.mass / r_mag ** ...
[ "0.71080023", "0.68899685", "0.66905564", "0.6641266", "0.65015244", "0.6494756", "0.6480524", "0.6430629", "0.6377404", "0.63519543", "0.6351334", "0.6269306", "0.6187852", "0.61872977", "0.6139606", "0.61322623", "0.6092323", "0.60388166", "0.6034025", "0.6031539", "0.60158...
0.6172307
14
Returns the acceleration based on all forces acting upon the body.
def acceleration_of_satellite(position, mass): F_x, F_y = force_on_satellite(position, mass) return F_x / mass, F_y / mass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_acceleration(self) -> np.array:\n F = self.calculate_net_force()\n m = self.mass\n a = F / m\n\n return a", "def gravity(acceleration, *bodies):\n\n gravity_force = []\n for body in bodies:\n if not isinstance(body, BodyBase):\n raise TypeError(f'...
[ "0.7344626", "0.69035375", "0.68625116", "0.65773505", "0.6517349", "0.6507465", "0.64710975", "0.63481534", "0.6326572", "0.6274453", "0.6256414", "0.6249561", "0.62353057", "0.62144464", "0.62131", "0.61764073", "0.6175256", "0.6151717", "0.6089929", "0.6054933", "0.6044895...
0.58435374
29
Return True if the number of function evaluations meets or exceeds a maximum. This function compares the number of function evaluations that have been generated with a specified maximum. It returns True if the maximum is met or exceeded.
def evaluation_termination(population, num_generations, num_evaluations, args): max_evaluations = args.setdefault('max_evaluations', len(population)) return num_evaluations >= max_evaluations
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exceeded_max(self):\n return self.total_max is not None and self.counter > self.total_max", "def check_max():\n if maximum([1,2,3]) == 3 : # check for first input\n subtest1 = True\n print(\"Congrats!, first subtest have succeed\")\n else :\n subtest1 = False\n print(...
[ "0.726781", "0.6831815", "0.647854", "0.6375833", "0.6347752", "0.63110393", "0.625945", "0.62417173", "0.6210913", "0.6209003", "0.6200967", "0.61702836", "0.61476177", "0.60869217", "0.60771525", "0.603631", "0.60052776", "0.5931501", "0.59139305", "0.5910704", "0.5827647",...
0.706152
1
Return True if the number of generations meets or exceeds a maximum. This function compares the number of generations with a specified maximum. It returns True if the maximum is met or exceeded.
def generation_termination(population, num_generations, num_evaluations, args): max_generations = args.setdefault('max_generations', 1) return num_generations >= max_generations
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exceeded_max(self):\n return self.total_max is not None and self.counter > self.total_max", "def evaluation_termination(population, num_generations, num_evaluations, args):\r\n max_evaluations = args.setdefault('max_evaluations', len(population))\r\n return num_evaluations >= max_evaluations", ...
[ "0.6958613", "0.65232986", "0.644045", "0.6379273", "0.63630545", "0.63624084", "0.6307385", "0.62758017", "0.6267249", "0.6261489", "0.62117016", "0.6198984", "0.6130319", "0.6120931", "0.6086946", "0.60665566", "0.5955923", "0.594338", "0.59216315", "0.59101915", "0.5888205...
0.68479806
1
Return an inspyred mutator function based on the given function. This function generator takes a function that operates on only one candidate to produce a single mutated candidate. The generator handles the iteration over each candidate in the set to be mutated.
def mutator(mutate): @functools.wraps(mutate) def ecspy_mutator(random, candidates, args): mutants = [] for i, cs in enumerate(candidates): mutants.append(mutate(random, cs, args)) return mutants ecspy_mutator.single_mutation = mutate return ecspy_mutator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutates(func):\n @wraps(func)\n def inner(self, *args, **kwargs):\n self.mutate()\n return inner.__wrapped__(self, *args, **kwargs)\n inner.__wrapped__ = func\n return inner", "def generator(func):\n\n @fn\n @wraps(func)\n def gen(*args, **kwargs):\n return Iter(func...
[ "0.5899329", "0.574317", "0.569271", "0.5662341", "0.5625317", "0.561668", "0.55707294", "0.55707294", "0.55707294", "0.55707294", "0.55707294", "0.55707294", "0.55707294", "0.5563718", "0.555099", "0.55231255", "0.5520418", "0.55102414", "0.5508387", "0.55058813", "0.5483143...
0.68156064
0
Returns the neighbors using a star topology. This function sets all particles as neighbors for all other particles. This is known as a star topology. The resulting list of lists of neighbors is returned.
def star_topology(random, population, args): for _ in range(len(population)): yield population[:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbors(node, topology):\n return [n for n in topology[node]]", "def get_neighbours(self):\n return []", "def neighbors(self) -> List['Node']:\r\n self._load_neighbors()\r\n return [edge.source if edge.source != self else edge.target\r\n for edge in self._neighb...
[ "0.7332176", "0.6481409", "0.6427175", "0.6426885", "0.6409326", "0.6407098", "0.63992095", "0.6388319", "0.6386848", "0.63844997", "0.63525826", "0.63211983", "0.6242472", "0.62375045", "0.62321514", "0.620606", "0.61932236", "0.61932236", "0.61932236", "0.61932236", "0.6159...
0.0
-1
Returns the neighbors using a ring topology. This function sets all particles in a specified sized neighborhood as neighbors for a given particle. This is known as a ring topology. The resulting list of lists of neighbors is returned.
def ring_topology(random, population, args): neighborhood_size = args.setdefault('neighborhood_size', 3) half_hood = neighborhood_size // 2 neighbor_index_start = [] for index in range(len(population)): if index < half_hood: neighbor_index_start.append(len(population) - half_ho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbors(node, topology):\n return [n for n in topology[node]]", "def _get_neighbors(size, point):\n i, j = point\n\n neighbors = [(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)]\n _valid_neighbor = lambda neighbor: all(0 <= x < size for x in neighbor)\n neighbors = list(filter(_valid_neighbo...
[ "0.699807", "0.6864225", "0.6389402", "0.63735", "0.6339805", "0.62892646", "0.6280005", "0.6278137", "0.6221659", "0.62207574", "0.62198806", "0.6209953", "0.6209953", "0.6209953", "0.6209953", "0.61716914", "0.6136785", "0.6130306", "0.6111617", "0.61060625", "0.6099525", ...
0.66711277
2
Return the number of constraints that candidate violates.
def my_constraint_function(candidate): # In this case, we'll just say that the point has to lie # within a circle centered at (0, 0) of radius 1. if candidate[0]**2 + candidate[1]**2 > 1: return 1 else: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_constraints(self):\n return len(self.constraints)", "def objectiveFunction(self):\n # start at zero\n satisfiedConstraints = 0\n # loop through all of the constraints\n for constraint in self.constraints:\n # if the constraint is satisfied, then increas...
[ "0.76880556", "0.760202", "0.7501228", "0.73207724", "0.7030049", "0.70090544", "0.6870931", "0.64724267", "0.6409413", "0.6318883", "0.63022226", "0.6286983", "0.61978734", "0.6193231", "0.61387074", "0.61330813", "0.61330813", "0.61164117", "0.60837233", "0.60837233", "0.60...
0.0
-1
get the sign of a number
def sign(n): return (n > 0) - (n < 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign(num: float):\n return 1 if num >= 0 else -1", "def sign(x):\n if x >= 0:\n return 1\n else:\n return -1", "def sign(x):\n if x >= 0:\n return 1\n return -1", "def sign(n: float) -> int:\n return 1 if n > 0 else -1", "def _sign(self, number):\n return c...
[ "0.84514207", "0.79649866", "0.7890495", "0.78804296", "0.7856162", "0.7720991", "0.75752825", "0.74736726", "0.7368184", "0.73457", "0.7156251", "0.7015637", "0.6891703", "0.68902284", "0.68553257", "0.6550094", "0.6453952", "0.6432561", "0.6397442", "0.6375982", "0.6375404"...
0.7818496
5
Recursive product with an iterable >>> prodri( iter([1,2,3,4,5,6,7]) ) 5040
def prodri( iterable ): try: head= next(iterable) except StopIteration: return 1 return head*prodri(iterable)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product(it):\n prod = 1\n for x in it:\n prod *= x\n return prod", "def product(iterable):\n prod = 1\n for i in iterable:\n prod *= i\n return prod", "def prod(iterable):\n return reduce(operator.mul, iterable, 1)", "def prod(iterable):\n return reduce(operator.mul,...
[ "0.76065856", "0.7599433", "0.7559788", "0.7559788", "0.7559788", "0.7552357", "0.74883544", "0.6990066", "0.69723904", "0.69003946", "0.6856784", "0.6856248", "0.685256", "0.6814677", "0.66982377", "0.65767187", "0.65740263", "0.6569931", "0.65299594", "0.6524031", "0.647151...
0.77514243
0
Generates both the player's position randomly such that they are not in collision with the obstacle
def generate_player_positions(): global obstacles # Generate random position for player1 such that it is not in collision # with fixed obstacles y_pos = SCREEN_HEIGHT - PLAYER_IMAGE.get_height() x_pos = randrange(SCREEN_WIDTH - PLAYER_IMAGE.get_width()) player1.rect.left, player1.rect.top = x_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_player_position(world, empty, player):\n\n position = [0, 0]\n is_valid = False\n\n while not is_valid:\n position[0] = randint(0, len(world) - 1)\n position[1] = randint(0, len(world) - 1)\n\n if world[position[0]][position[1]] == empty:\n is_valid = True\n ...
[ "0.72164774", "0.70396125", "0.68947154", "0.6859447", "0.67187166", "0.6655429", "0.664563", "0.6538025", "0.6535365", "0.6508721", "0.65051126", "0.65032417", "0.64932895", "0.64702535", "0.64650077", "0.64307606", "0.63987446", "0.6383692", "0.63556176", "0.63420504", "0.6...
0.83153445
0
Decorates the `__get__()` method of a descriptor to turn the it into a binding descriptor, which returns an unbound attribute whenever accessed from the containing class instead of from an instance.
def binding(get): @wraps(get) def __get__(desc, instance, owner=None): if instance is None: return desc.__get__ else: return get(desc, instance, owner) return __get__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fget(self):\n # type: (...) -> Any\n try:\n return getattr(self, private_attr)\n except AttributeError:\n raise AttributeError(\n \"'{}' object has no attribute '{}'\".format(\n _get_type_name(type_), attr...
[ "0.60898376", "0.6047647", "0.5957599", "0.59229624", "0.58224416", "0.580687", "0.5800031", "0.5750781", "0.57396215", "0.57100946", "0.5706919", "0.5693913", "0.5634734", "0.56057006", "0.5591216", "0.5491851", "0.5425707", "0.5385313", "0.5372444", "0.53650784", "0.5347163...
0.76170903
0
Asks user to specify a city, month, and day to analyze.
def get_filters(): city = "" month="" day="" i=0 cont="yes" cont_flag = False cont_flag2= False print('Hello! Let\'s explore some US bikeshare data!') while city not in CITY_DATA: city = input('Please choose the city you want to explore! Choose between (Chicago - ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)", "def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f...
[ "0.66714007", "0.65354675", "0.64593667", "0.6374057", "0.6348314", "0.63097656", "0.62868035", "0.6259136", "0.62316", "0.62130964", "0.62050414", "0.6181105", "0.6171822", "0.61686903", "0.6158568", "0.61582303", "0.61532456", "0.61444426", "0.6131269", "0.610484", "0.61025...
0.0
-1
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): while month != "": # load data file into a dataframe filename = CITY_DATA[city] df = pd.read_csv(filename) # convert the Start Time column to datetime df['Start Time'] = pd.to_datetime(df['Start Time']) # extract month and day of we...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.81320685", "0.8108889", "0.8045821", "0.8042514", "0.80090284", "0.80071104", "0.79991937", "0.7998333", "0.7988789", "0.797905", "0.79737365", "0.79610896", "0.7956163", "0.7947432", "0.79463065", "0.7908287", "0.7908229", "0.7904569", "0.7900715", "0.78930074", "0.788921...
0.0
-1
Displays statistics on the most frequent times of travel.
def time_stats(df): test= months[df['month'].mode()[0]] print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() # TO DO: display the most common month print("\nThe most common month of travel is {}".format(months[df['month'].mode()[0]])) # TO DO: display the most...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80247396", "0.80233026", "0.7915788", "0.78266186", "0.7822246", "0.78143597", "0.77659196", "0.7740343", "0.773628", "0.77344066", "0.76867086", "0.7668633", "0.7651731", "0.7644636", "0.76399267", "0.76367253", "0.7625196", "0.7623158", "0.7612803", "0.76002145", "0.7583...
0.7483016
35
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # TO DO: display most commonly used start station print("\nThe most commonly used start station is: ",df['Start Station'].mode()[0]) # TO DO: display most commonly used end station p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.7815675", "0.7662213", "0.7553417", "0.74914914", "0.74748665", "0.7446617", "0.7428588", "0.74237514", "0.74177027", "0.7400495", "0.7387161", "0.7385634", "0.73647535", "0.735934", "0.73566747", "0.73548365", "0.7351854", "0.7351274", "0.735057", "0.73421645", "0.7340198...
0.7140461
56
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # TO DO: display total travel time # travel_time= df['Trip Duration'].sum() # result = datetime.timedelta(seconds = df['Trip Duration'].sum()) print("\nTotal Travel time =", datetime.timedelta(secon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.814274", "0.8025143", "0.80041367", "0.79496753", "0.7937415", "0.79312176", "0.7926815", "0.7915187", "0.79142886", "0.7908032", "0.79055744", "0.7900715", "0.7891682", "0.78894734", "0.7886722", "0.78851086", "0.7884266", "0.7882474", "0.78738385", "0.78686154", "0.78664...
0.77135193
68
Given a sequence like "the cat slept", returns a consecutive sequence of words & corresponding data.
def select_subsequence(emg): # Get locations of each word new_word_begins = np.hstack([[0], np.where(emg["word"][1:] != emg["word"][:-1])[0] + 1]) #print(emg["word"][new_word_begins]) full_transcript = " ".join(emg["word"][new_word_begins]).replace("$", "").strip() if len(new_word_begins) <= 3:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_sequences(text, sequence_length, step):\n sequences = []\n labels = []\n for i in range(0, len(text) - sequence_length, step):\n sequences.append(text[i: i + sequence_length])\n labels.append(text[i + sequence_length])\n return sequences, labels", "def getSequence(word):\n\n ...
[ "0.6496729", "0.59615755", "0.5920084", "0.58905035", "0.57816243", "0.57769203", "0.5610558", "0.5596787", "0.5568636", "0.5568294", "0.5562042", "0.554696", "0.55381775", "0.5525043", "0.5518096", "0.5484196", "0.5482894", "0.5473901", "0.5469157", "0.546708", "0.5456908", ...
0.0
-1
Creates a context with an open SQLAlchemy session.
def db_session(): engine = create_my_engine() connection = engine.connect() db_session = scoped_session(sessionmaker(autocommit=False, autoflush=True, bind=engine)) yield db_session db_session.close() connection.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _session_maker(self) -> ContextManager[Session]:\r\n session = self._Session()\r\n try:\r\n yield session\r\n session.commit()\r\n except DBAPIError:\r\n session.rollback()\r\n raise\r\n finally:\r\n session.close()", "def ses...
[ "0.7091904", "0.7077166", "0.7059174", "0.70035", "0.68487376", "0.6820748", "0.6756059", "0.674851", "0.67420226", "0.67399", "0.67313755", "0.6715202", "0.67071086", "0.66829187", "0.66743994", "0.66691864", "0.6664774", "0.6658964", "0.658326", "0.65668786", "0.6556565", ...
0.6696005
13
Whether this symbol is a function
def is_function(self): return self.type == 'STT_FUNC'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_function(self):\n return False", "def isfunction(object):\r\n return isinstance(object, types.FunctionType)", "def isCSymbolFunction(self):\n return _libsbml.ASTNode_isCSymbolFunction(self)", "def is_function(self):\n line = self.line.strip()\n if line.startswith('fu'):\...
[ "0.76650476", "0.76534337", "0.7551693", "0.7549486", "0.75053996", "0.74058247", "0.73679864", "0.7334828", "0.7171973", "0.71688074", "0.7163859", "0.6951308", "0.6933153", "0.6928426", "0.69211733", "0.6793649", "0.6778523", "0.66848606", "0.66556233", "0.6598789", "0.6573...
0.82395965
0
parse string to number if possible e.g. "123" => 123 "12.2" => 12.3 "abc" => "abc" "$var" => "$var"
def parse_string_value(str_value: Text) -> Any: try: return ast.literal_eval(str_value) except ValueError: return str_value except SyntaxError: # e.g. $var, ${func} return str_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parseNumber(self, str):\r\n\t\tif (str.count(\".\") == 0):\r\n\t\t\treturn int(str)\r\n\t\tif (str.count(\".\") == 1):\r\n\t\t\treturn float(str)\r\n\t\treturn str", "def string_to_number(s):\n\n if type(s).__name__==\"str\":\n s = s.strip()\n if s ==\"-\":\n s = 0\n else:...
[ "0.7947508", "0.7452889", "0.7320762", "0.7170755", "0.7130158", "0.712436", "0.7076404", "0.70752305", "0.70732933", "0.7069421", "0.7003231", "0.69658357", "0.6948489", "0.68844414", "0.6848807", "0.68331605", "0.6778646", "0.6730626", "0.67176664", "0.6676476", "0.66641223...
0.0
-1
test if an error is raised bescause user's already exists
def test_error_user_already_exists(self): User.objects.create_user(self.data) client = Client() client.post('/register/', self.data) self.assertRaisesMessage(ValueError, 'user already exists')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_user(msg):\n if \"Error\" in msg:\n raise ValueError('User already exists.')", "def test_registration_when_user_already_exists(self):\n # register the user the first time\n self.register_user()\n # register the same user the second time\n result = self.client().pos...
[ "0.7891834", "0.7502146", "0.747177", "0.7348039", "0.7288836", "0.7278826", "0.7259907", "0.71137196", "0.7024067", "0.7021013", "0.6953002", "0.69374716", "0.68948555", "0.68641317", "0.6791628", "0.6772556", "0.67675877", "0.6758929", "0.67550194", "0.6746676", "0.671716",...
0.75366026
1
Closes the connection to the mud.
def close(self): if self.connected: #self.onClose() self.con.close() self._close() # Reset the thread and connection, and stop all sounds playing through the output. else: raise UserError(errors['NotConnectedYet'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n self._connection.close()", "def close(self): \n self.connection.close()", "def close(self):\n with self.connlock:\n self.conn.do_close()", "def close(self):\n self.__connection.close()", "async def close(self):\n await self._connection.close()", ...
[ "0.71155745", "0.70898485", "0.7078498", "0.70474046", "0.6996102", "0.69850695", "0.6978653", "0.6978653", "0.6978653", "0.6978653", "0.6978653", "0.6978653", "0.6978653", "0.6968377", "0.6957211", "0.69460243", "0.69324905", "0.69320387", "0.6928942", "0.6907357", "0.690321...
0.6846822
24
Compute the area of the polygon, upto 6 sides.
def polygon_area(side_length, **kwargs): if not isinstance(side_length, int): raise ValueError('Positional argument `side_length` must be an integer') if not kwargs: raise ValueError('Missing keyword arguments!') else: if 'sides' not in kwargs: raise ValueError('Missing ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n if len(self.exterior) < 3:\n raise Exception(\"Cannot compute the polygon's area because it contains less than three points.\")\n poly = self.to_shapely_polygon()\n return poly.area", "def area(self):\n area = 0\n\n for room in self.rooms:\n ...
[ "0.8274093", "0.80719155", "0.8024979", "0.7826404", "0.7769608", "0.7759761", "0.75311214", "0.7508029", "0.74880326", "0.74532646", "0.74513847", "0.7451332", "0.7416935", "0.7415009", "0.7414074", "0.7380425", "0.73610014", "0.73607177", "0.7331812", "0.7328357", "0.731230...
0.7400229
15
Scatter plot colored (and optionally sorted) by density.
def density_scatter( x: ArrayLike | str, y: ArrayLike | str, df: pd.DataFrame | None = None, ax: plt.Axes | None = None, sort: bool = True, log_cmap: bool = True, density_bins: int = 100, xlabel: str | None = None, ylabel: str | None = None, identity: bool = True, stats: bool...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def density_scatter(x, y, xlab, ylab, ax = None, sort = True, bins = 20,xlim=(4,12),ylim=(4,12)):\n bad_indices=np.where(np.isnan(x))+np.where(np.isnan(y))\n x=x[~np.isin(np.arange(x.size),bad_indices)]\n y=y[~np.isin(np.arange(y.size),bad_indices)]\n\n if ax is None :\n fig , ax = plt.subplots(...
[ "0.7580087", "0.6841208", "0.6805754", "0.6266967", "0.6250015", "0.6014909", "0.5944461", "0.5887009", "0.5806752", "0.57651573", "0.574919", "0.57455814", "0.57039154", "0.56870073", "0.56746507", "0.5653176", "0.5634566", "0.56332177", "0.5631015", "0.5620232", "0.55804455...
0.7039963
1
r"""Plot targets on the xaxis vs residuals (y_err = y_true y_pred) on the yaxis.
def residual_vs_actual( y_true: ArrayLike | str, y_pred: ArrayLike | str, df: pd.DataFrame | None = None, ax: plt.Axes | None = None, xlabel: str = r"Actual value", ylabel: str = r"Residual ($y_\mathrm{true} - y_\mathrm{pred}$)", **kwargs: Any, ) -> plt.Axes: y_true, y_pred = df_to_array...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def residual_plot(targets, predictions, filename):\n\tfig, ax = plt.subplots()\n\tfig.suptitle(str(targets.shape[0]) + ' samples, Residual Plot', fontsize=12)\n\tresiduals = targets - predictions\n\taxes = plt.gca()\n\taxes.set_ylim(np.min(residuals), np.max(residuals))\n\taxes.set_xlim(np.min(predictions), np.max...
[ "0.7442949", "0.7084865", "0.66364", "0.6546609", "0.6514092", "0.65077156", "0.64263046", "0.6384985", "0.63701236", "0.635427", "0.6341082", "0.63369775", "0.6327903", "0.63161445", "0.62817305", "0.62722707", "0.62722707", "0.62607723", "0.6215634", "0.618986", "0.61602473...
0.63102204
14
find the KL divergence loss between P and Q
def KL(P, Q): assert P.size() == Q.size() # To prevent divide by zero Q = Q + 1e-15 return torch.sum(P * torch.log(P / Q))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def KL(P,Q):\n epsilon = 0.00001\n \n #You may want to instead make copies to avoid changing the np arrays.\n P = P+epsilon\n Q = Q+epsilon\n \n divergence = np.sum(P*np.log(P/Q))\n return divergence", "def _kl_divergence(p, p_logits, q):\n for tensor in [p, p_logits, q]:\n if not ten...
[ "0.8112003", "0.7791337", "0.7695158", "0.7655455", "0.76393193", "0.75874823", "0.7579889", "0.75225097", "0.75201464", "0.74268115", "0.7346678", "0.7286397", "0.72329456", "0.7137074", "0.71358126", "0.71203804", "0.707886", "0.70347136", "0.70031315", "0.7000409", "0.6945...
0.70162994
18
Only keep `name` and `homepage` keys.
def clean_info(package_dict: dict) -> dict: return {_: package_dict[_] for _ in ("name", "home-page")}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_content_keys(obj: Dict[Any, Any]) -> Dict[Any, Any]:\n return {k: v for k, v in obj.items() if not k.startswith(\"__\")}", "def pop_non_relevant_search_fields(data: Dict):\n keys_to_keep = [\"title\", \"published_at\", \"identifier\"]\n for key in list(data):\n if key not in keys_to_ke...
[ "0.57457364", "0.5717312", "0.5613688", "0.55435693", "0.5485916", "0.54287857", "0.53698766", "0.52679604", "0.5230988", "0.5159908", "0.50734746", "0.5000754", "0.49602306", "0.49581036", "0.49547997", "0.49144703", "0.49006462", "0.4885446", "0.4870702", "0.48694193", "0.4...
0.69399047
0
Sets the name of this RegisterFields.
def name(self, name): if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501 raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 if (self.local_vars_configuration.client_side_validation and name is not None and len(n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self, name):\n\n self._set_field(\"name\", name)", "def set_name(self, name):\n\t\tself.name_ = name", "def set_name(self, name):\r\n self.__name = name", "def set_name(self, name):\n self.__name = name", "def set_name(self, name):\n self.__name = name", "def set_name...
[ "0.7709194", "0.7506048", "0.7401514", "0.7392196", "0.7392196", "0.7386344", "0.73674613", "0.73674613", "0.73674613", "0.73674613", "0.73674613", "0.735745", "0.73238796", "0.73130083", "0.7304306", "0.7282761", "0.72386724", "0.72036904", "0.72036904", "0.71974397", "0.719...
0.0
-1
Sets the nip of this RegisterFields.
def nip(self, nip): if self.local_vars_configuration.client_side_validation and nip is None: # noqa: E501 raise ValueError("Invalid value for `nip`, must not be `None`") # noqa: E501 if (self.local_vars_configuration.client_side_validation and nip is not None and len(nip) >...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_NID(i, n=8):\n global NID, ppn\n ppn = n\n assert NID is None, \"Attempting to call set_NID() more than once\"\n msg = \"NID (%s) must be an even multiple of # processors per node (%s)\"\n assert i % ppn == 0, msg % (i, ppn)\n NID = i", "def ip_not(self, ip_not):\n\n self._ip_not...
[ "0.5865628", "0.5856925", "0.571393", "0.5704942", "0.56599027", "0.56599027", "0.56169444", "0.5576257", "0.5523248", "0.53943455", "0.53746486", "0.53405327", "0.53255564", "0.5280542", "0.52710307", "0.5229604", "0.5228709", "0.52253324", "0.52112794", "0.51913846", "0.518...
0.6697168
0
Sets the krsedg of this RegisterFields.
def krsedg(self, krsedg): if (self.local_vars_configuration.client_side_validation and krsedg is not None and len(krsedg) > 32): raise ValueError("Invalid value for `krsedg`, length must be less than or equal to `32`") # noqa: E501 self._krsedg = krsedg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gallbladder(self, gallbladder):\n\n self.logger.debug(\"In 'gallbladder' setter.\")\n\n self._gallbladder = gallbladder", "def setg(self, var, val):\n self.rpc.call(MsfRpcMethod.CoreSetG, [var, val])", "def set_dcmgnd(self, gnd):\n self.dcmgnd = gnd", "def rfid_origin_dg(self,...
[ "0.5297589", "0.5247048", "0.52103674", "0.513815", "0.510941", "0.49439088", "0.49180603", "0.48912662", "0.48312798", "0.48275292", "0.4824642", "0.4804914", "0.4799177", "0.4770441", "0.47488332", "0.47471485", "0.47410426", "0.46904555", "0.46886435", "0.46713415", "0.467...
0.72962093
0
Sets the address_city of this RegisterFields.
def address_city(self, address_city): if self.local_vars_configuration.client_side_validation and address_city is None: # noqa: E501 raise ValueError("Invalid value for `address_city`, must not be `None`") # noqa: E501 if (self.local_vars_configuration.client_side_validation and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_City(self, value):\n super(AddressValidationInputSet, self)._set_input('City', value)", "def city(self, city):\n self._city = city", "def city(self, city):\n\n self._city = city", "def city(self, city):\n\n self._city = city", "def city(self, city):\n\n self._city...
[ "0.7651331", "0.69357413", "0.6892848", "0.6892848", "0.6892848", "0.6892848", "0.6892848", "0.6892848", "0.6892848", "0.6892848", "0.6892848", "0.66883856", "0.6384777", "0.6207537", "0.6195283", "0.6131134", "0.6065059", "0.5989517", "0.59117293", "0.58410776", "0.57797337"...
0.75672567
1
Sets the address_code of this RegisterFields.
def address_code(self, address_code): if self.local_vars_configuration.client_side_validation and address_code is None: # noqa: E501 raise ValueError("Invalid value for `address_code`, must not be `None`") # noqa: E501 if (self.local_vars_configuration.client_side_validation and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_address(self, address):\n pass", "def set_PostalCode(self, value):\n super(AddressValidationInputSet, self)._set_input('PostalCode', value)", "def postal_code(self, postal_code):\n\n self._postal_code = postal_code", "def postal_code(self, postal_code):\n\n self._postal_co...
[ "0.6666516", "0.652473", "0.6446803", "0.6446803", "0.6446803", "0.6321607", "0.6218594", "0.61759424", "0.60994095", "0.60922766", "0.60736084", "0.60736084", "0.60736084", "0.60736084", "0.60736084", "0.60736084", "0.60736084", "0.60736084", "0.60672474", "0.60660565", "0.6...
0.73309183
0
Sets the create_api of this RegisterFields.
def create_api(self, create_api): self._create_api = create_api
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_api_key(sender, **kwargs):\r\n if kwargs.get('created') is True:\r\n ApiKey.objects.create(user=kwargs.get('instance'))", "def create_api(self, Name: str, ProtocolType: str, RouteSelectionExpression: str, ApiKeySelectionExpression: str = None, Description: str = None, DisableSchemaVa...
[ "0.58077115", "0.5772339", "0.57648736", "0.57556206", "0.546506", "0.5433217", "0.54209805", "0.53228396", "0.52858615", "0.52246904", "0.5195222", "0.5192759", "0.51685935", "0.5120898", "0.509295", "0.49907872", "0.49826452", "0.49825454", "0.49605042", "0.49364546", "0.49...
0.79738724
0
Sets the api_password of this RegisterFields.
def api_password(self, api_password): if self.local_vars_configuration.client_side_validation and api_password is None: # noqa: E501 raise ValueError("Invalid value for `api_password`, must not be `None`") # noqa: E501 if (self.local_vars_configuration.client_side_validation and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_password(self, auth_password):\n\n self._auth_password = auth_password", "def set_password(self, password):\n self.authentication.password = password", "def set_password(self, password):\n self.PASSWORD = password", "def setUserPassword(self,value):\n self.PDFreactorConfi...
[ "0.66908455", "0.6476591", "0.6449306", "0.6437026", "0.6432204", "0.64194953", "0.6352782", "0.6337416", "0.6300637", "0.6300637", "0.6300637", "0.6300637", "0.6300428", "0.626471", "0.626471", "0.6259784", "0.62399966", "0.6238826", "0.6221495", "0.62172556", "0.62159806", ...
0.76354295
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, RegisterFields): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, RegisterFields): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
Input n>=6, Returns a list of primes, 2 <= p < n
def primes2(n): correction = (n%6>1) n = {0:n,1:n-1,2:n+4,3:n+3,4:n+2,5:n+1}[n%6] sieve = [True] * (n/3) sieve[0] = False for i in xrange(int(n**0.5)/3+1): if sieve[i]: k=3*i+1|1 sieve[ ((k*k)/3) ::2*k]=[False]*((n/6-(k*k)/6-1)/k+1) sieve[(k*k+4*k-2*k*(i&1))/3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_primes(n):\n\n return list(primes_sieve(n))", "def make_primes(n):\n out_list = []\n for i in range(2, n):\n if is_prime(i):\n out_list.append(i)\n return out_list", "def list_primes(n):\n primeList = []\n for i in range(n):\n if is_prime(i):\n primeList.append(i...
[ "0.85413843", "0.84438545", "0.84063387", "0.8358301", "0.82609856", "0.8234336", "0.8213978", "0.82113606", "0.82060546", "0.8170585", "0.81014943", "0.8003272", "0.7959604", "0.79537195", "0.79436857", "0.7939605", "0.78893626", "0.78684366", "0.78684366", "0.78623396", "0....
0.773269
26
Finds the next prime in primelist larger than n
def next_prime(n, primelist): if primelist is None: primelist = primes2(n) return primelist[bisect_right(primelist, n)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nthPrime(n):\n return (j for i, j in enumerate(sieveOfEra()) if i == n-1).next()", "def nth_prime(n):\n # Tweaked version of the itertools nth recipe\n return next(islice(generate_primes(), n-1, None), None)", "def _findNextPrime(self, N):\n primes = self.primes\n nextPrime = primes[...
[ "0.8037094", "0.80067563", "0.79834205", "0.79641604", "0.7864188", "0.7800047", "0.7722714", "0.7718171", "0.75503916", "0.7536423", "0.7525545", "0.75176424", "0.75039595", "0.74502414", "0.7449788", "0.73468775", "0.72875965", "0.72629374", "0.7237506", "0.72345126", "0.72...
0.8521558
0
Inclusive datetime beginning of range (first moment in).
def inc_begin(self): return self._inc_begin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n return _uhd_swig.range_t_start(self)", "def start(self):\n return _uhd_swig.meta_range_t_start(self)", "def get_start_indef_range(start: int) -> models.IndefiniteRange:\n return models.IndefiniteRange(value=start - 1, comparator=\"<=\",\n ...
[ "0.6449627", "0.6411848", "0.63219756", "0.62515324", "0.6106339", "0.60154736", "0.60089624", "0.6003135", "0.59873074", "0.5983188", "0.59673136", "0.5925746", "0.5907553", "0.5897209", "0.5885647", "0.58458304", "0.5827929", "0.58247167", "0.5812998", "0.5807696", "0.58029...
0.0
-1
Inclusive datetime end of range (last moment in).
def inc_end(self): return self._exc_end - TIMERANGE_PRECISION
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end(self) -> datetime:\n return self._end", "def end(self, end):\n # type: (datetime) -> None\n\n if end is not None:\n if not isinstance(end, datetime):\n raise TypeError(\"Invalid type for `end`, type has to be `datetime`\")\n\n self._end = end", "def...
[ "0.6738059", "0.65454054", "0.653473", "0.6514087", "0.6332052", "0.62996036", "0.6280622", "0.62601197", "0.6259415", "0.6207147", "0.62043035", "0.62035835", "0.6150026", "0.6144536", "0.61209285", "0.6117827", "0.60855216", "0.60418415", "0.6038448", "0.6036076", "0.601524...
0.0
-1
Exclusive datetime end of range (first moment after).
def exc_end(self): return self._exc_end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end(self, end):\n # type: (datetime) -> None\n\n if end is not None:\n if not isinstance(end, datetime):\n raise TypeError(\"Invalid type for `end`, type has to be `datetime`\")\n\n self._end = end", "def end(self) -> datetime:\n return self._end", "def...
[ "0.6699334", "0.66721815", "0.6425855", "0.63313067", "0.63001466", "0.6294652", "0.62772286", "0.62500423", "0.6155483", "0.6103599", "0.6064913", "0.6049992", "0.6025492", "0.6018145", "0.6015735", "0.6004263", "0.59891444", "0.5983742", "0.59602684", "0.592305", "0.5905501...
0.0
-1
create dictionary based on formula given
def formula_to_dictionary(formula='', thickness=np.NaN, density=np.NaN, database='ENDF_VIII'): _formula_parsed = re.findall(r'([A-Z][a-z]*)(\d*)', formula) _dictionary = {} _elements_array = [] _atomic_ratio_array = [] for _element in _formula_parsed: [_single_element, _atomic_ratio] = list...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_formula(cls, formula: str) -> dict[str, int]:\n try:\n tokens = cls._formula.parseString(formula)\n except pyparsing.ParseException as exc:\n raise ValueError(\n f\"Could not parse: {formula!r}, error: {exc.msg},\"\n f\" error at char {ex...
[ "0.6438855", "0.60169065", "0.5960932", "0.5859141", "0.583369", "0.58026433", "0.57903683", "0.5777682", "0.576174", "0.57131696", "0.5679617", "0.56772053", "0.560847", "0.560521", "0.56010145", "0.55801684", "0.5553955", "0.55515456", "0.5544396", "0.55387676", "0.55292076...
0.658051
0
return the density (g.cm3) of the element
def get_density(element): return pt.elements.isotope(element).density
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def density(self):\n return self.get_density()", "def density_g_cm3(self):\n return self._density_kg_m3 / 1000.0", "def density( self ) :\n return self.__density", "def density( self ) :\n return self.__density", "def density( self ) :\n return self.__density", "def ele...
[ "0.7589724", "0.7573091", "0.7519295", "0.7519295", "0.7519295", "0.7415925", "0.7310231", "0.723882", "0.72067434", "0.71935934", "0.71438974", "0.71274835", "0.7078725", "0.69930124", "0.69501007", "0.6662576", "0.664713", "0.6632854", "0.66200966", "0.66179603", "0.6486457...
0.77611524
0
return the interpolated x and y axis for the given x range [E_min, E_max] with step defined
def get_interpolated_data(df=[], E_min=np.NaN, E_max=np.NaN, E_step=np.NaN): nbr_point = (E_max - E_min) / E_step # remove data outside specified range [x_min, x_max] #df = df.drop(df[df.E_eV < E_min].index) #df = df.drop(df[df.E_eV > E_max].index) # reset index df = df.reset_index(drop=Tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def axis_range ( xmin , xmax , delta = 0.05 , log = False ) :\n xmn = min ( xmin , xmax )\n xmx = max ( xmin , xmax )\n \n import math\n \n ## 1) special case\n if isequal ( xmn , xmx ) :\n return math.floor ( xmn - 0.1 ) , math.ceil ( xmx + 0.1 ) \n\n ## 2) special case\n if islo...
[ "0.58194965", "0.5796217", "0.57760465", "0.5742764", "0.571837", "0.57161224", "0.5663599", "0.55366814", "0.5443032", "0.54369795", "0.5396692", "0.53905815", "0.5388902", "0.538024", "0.53755546", "0.5372901", "0.5335529", "0.53277266", "0.5315367", "0.52724695", "0.524886...
0.7221659
0
convert into lambda from the energy array
def energy_to_lambda(energy_ev=[]): energy_mev = energy_ev * 1000 lambda_array = np.sqrt(81.787 / energy_mev) return lambda_array
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def energy_function(self, x):\n \n return -T.dot(T.transpose(x), T.dot(self.W, x)) -\\\n T.dot(T.transpose(self.b), x)", "def function(self):\r\n lambd = 5*np.sin(2*np.pi*self.x_array) #The function in question\r\n return 3*np.pi*np.exp(-lambd)", "def nm_to_ev(lambda_):\n h = 6...
[ "0.65815353", "0.63888586", "0.6364471", "0.6298795", "0.60196996", "0.59137785", "0.5831157", "0.58037996", "0.5792658", "0.5792658", "0.5786205", "0.573432", "0.57070535", "0.5704296", "0.5675678", "0.5661071", "0.56513244", "0.5650119", "0.5634636", "0.56302124", "0.558009...
0.85084826
0
Create a ``Hardsigmoid`` module.
def __init__(self, inplace=False): super(Hardsigmoid, self).__init__() self.inplace = inplace
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_hardsigmoid(cls, onnx_node, inputs, opset_version):\n alpha = onnx_node.getattr(\"alpha\", 0.2)\n beta = onnx_node.getattr(\"beta\", 0.5)\n _, forward = cls._common_onnx_node_to_singa_op(onnx_node, inputs,\n opset_version)\n ...
[ "0.7416955", "0.73930794", "0.72880834", "0.667573", "0.66707754", "0.65585554", "0.623439", "0.58852416", "0.5839309", "0.5833664", "0.58197224", "0.5728852", "0.5709927", "0.5704215", "0.5704215", "0.57001173", "0.5692615", "0.568344", "0.56792986", "0.5668869", "0.56523585...
0.57768434
11
Create a ``Sigmoid`` module.
def __init__(self, inplace=False): super(Sigmoid, self).__init__() self.inplace = inplace
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_sigmoid(node, **kwargs):\n return create_basic_op_node('Sigmoid', node, kwargs)", "def sigmoid(module, x):\n _import_modules()\n if module in [np, ma]:\n return sp.special.sigmoid(x)\n elif module == torch:\n return module.sigmoid(x)\n elif module == jnp:\n return ...
[ "0.73525035", "0.72924227", "0.6972096", "0.68352455", "0.6780676", "0.67110586", "0.66815704", "0.65463454", "0.6464417", "0.6463697", "0.6420661", "0.6414392", "0.6414392", "0.6407477", "0.640187", "0.63773626", "0.63773626", "0.63590384", "0.6355498", "0.6347501", "0.63252...
0.58533573
85
Create a ``Softmax`` module.
def __init__(self, dim, inplace=False): super(Softmax, self).__init__() self.dim = dim self.inplace = inplace
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(module, x, axis=None):\n _import_modules()\n if module in [np, ma]:\n return sp.special.softmax(x, axis=axis)\n elif module == torch:\n return module.nn.functional.softmax(x, dim=axis)\n elif module == jnp:\n return jax.nn.softmax(x, axis=axis)\n elif module == tf:\n...
[ "0.6897564", "0.67357105", "0.6596676", "0.6556684", "0.6374694", "0.6256345", "0.61956096", "0.6157063", "0.6145981", "0.6084458", "0.60542923", "0.6045682", "0.60230285", "0.59699494", "0.59426063", "0.590255", "0.5850743", "0.582771", "0.58272976", "0.5817536", "0.5785041"...
0.58883315
16
Return the QoS policy Id of a port that is being created/updated Return the QoS policy assigned directly to the port (after update or originally), or the policy of the network, if it is a compute port that should inherit it.
def _get_port_qos_policy_id(self, context, original_port, updated_port): orig_compute = False if original_port: orig_compute = original_port.get('device_owner', '').startswith( constants.DEVICE_OWNER_COMPUTE_PREFIX) updated_compute = up...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy_id(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"policy_id\")", "def policy_id(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"policy_id\")", "def policy_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"policy_id\")", "def inte...
[ "0.5770068", "0.5762775", "0.571495", "0.56987125", "0.5663792", "0.56397825", "0.5631886", "0.5612986", "0.55695003", "0.5552621", "0.5552621", "0.555043", "0.55413365", "0.5460963", "0.5460963", "0.5454186", "0.5398242", "0.53619325", "0.53444576", "0.53444576", "0.53248936...
0.821569
0
Sets the payment_holds of this Payment.
def payment_holds(self, payment_holds): self._payment_holds = payment_holds
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def holds(self, holds):\n\n self._holds = holds", "def bills(self, bills):\n\n self._bills = bills", "def set_share(self, total_people):\n self.paid = self._get_paid()\n self.share = round(self.paid/Decimal(total_people), 2)", "def onsite_payments(self, onsite_payments):\n\n ...
[ "0.66051483", "0.5282388", "0.5123398", "0.49883637", "0.4970497", "0.49344748", "0.49249256", "0.48853365", "0.4821813", "0.48059687", "0.4785118", "0.47141185", "0.46996123", "0.4663364", "0.46221453", "0.462151", "0.46103117", "0.46103117", "0.45891073", "0.45327556", "0.4...
0.9005802
0
Sets the payment_method of this Payment.
def payment_method(self, payment_method): self._payment_method = payment_method
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment_method_enum(self, payment_method_enum):\n\n self._payment_method_enum = payment_method_enum", "def payment_type(self, payment_type):\n\n self._payment_type = payment_type", "def payment_date(self, payment_date):\n\n self._payment_date = payment_date", "def payment_date(self, ...
[ "0.7435351", "0.68702346", "0.61693656", "0.61693656", "0.6158854", "0.6120407", "0.6081163", "0.60164744", "0.59533834", "0.5940646", "0.56684315", "0.56375104", "0.56295013", "0.558102", "0.55654424", "0.55408925", "0.55190665", "0.54321104", "0.5409764", "0.5227823", "0.51...
0.8651521
0
Sets the payment_reference_id of this Payment.
def payment_reference_id(self, payment_reference_id): self._payment_reference_id = payment_reference_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_reference_id(self, reference_id):\n self.reference_id = reference_id", "def payment_id(self, payment_id):\n\n self._payment_id = payment_id", "def reference_id(self, reference_id):\n\n self._reference_id = reference_id", "def reference_number(self, reference_number):\n\n s...
[ "0.72737056", "0.70639056", "0.6997522", "0.5994073", "0.58336467", "0.57651675", "0.57651675", "0.5742397", "0.57342", "0.57259613", "0.5600892", "0.5600892", "0.55861217", "0.5528435", "0.5508361", "0.5470026", "0.54667014", "0.53517276", "0.53295517", "0.5326318", "0.52689...
0.8816966
0
Sets the payment_status of this Payment.
def payment_status(self, payment_status): self._payment_status = payment_status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_payment_status(payment):\n _assert_payment_is_yandex_kassa(payment)\n yk_payment = api.get_payment_by_id(payment.gateway_payment_id)\n _update_payment_status(payment, yk_payment)", "def update_payment_status(self):\n payments = Payment.query.filter_by(invoice_id=self.id).all()\n ...
[ "0.66182643", "0.650321", "0.6380238", "0.6360035", "0.63200504", "0.630407", "0.6279144", "0.6279144", "0.6279144", "0.60252833", "0.6020388", "0.59772515", "0.59245986", "0.59225494", "0.58907974", "0.58851737", "0.5883288", "0.5861886", "0.5836898", "0.5819311", "0.5807506...
0.88526183
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Payment): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Creates a linear expression of current integral binary variables. Current dependency cuts are only sound when this expression is satisfied so the cuts are added in conjuction with the expression.
def _get_lin_descr(delta, _delta): le = LinExpr() for i in range(len(vmodel.lmodel.layers)): l = vmodel.lmodel.layers[i] if l.activation == Activations.relu: d = delta[i] _d = _delta[i] for j in range(len(d)): i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Linear(v):\n bias = Symbol('h_{}'.format(v), REAL)\n\n min_, max_ = linear_energy_ranges[v]\n\n theta.assertions.add(LE(bias, limitReal(max_)))\n theta.assertions.add(GE(bias, limitReal(min_)))\n\n return bias", "def to_linear(self):\n return inv(quad...
[ "0.5798423", "0.534226", "0.53385556", "0.5323671", "0.52748454", "0.52675945", "0.52139914", "0.5201853", "0.5176351", "0.51704633", "0.51448435", "0.51392025", "0.5135146", "0.5120408", "0.5111654", "0.50896144", "0.5069765", "0.50565547", "0.5054382", "0.5016118", "0.49927...
0.0
-1
Returns the next action the agent will take
def getAction(self, state): if 'actionIndex' not in dir(self): self.actionIndex = 0 if self.actionIndex == 0: self.actions = self.spreadOutAndFindDot(state) if len(self.actions) == 1: return self.actions[0] else: self.actionIndex += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action(self):\n next_action = self.strategy.get_next_move(self)\n return next_action", "def get_next_action(self):\n\n u = self.plan.pop(0)\n return u", "def get_next_action(self):\n chosen_action = None\n while chosen_action is None:\n choice = input('A...
[ "0.8337207", "0.79425484", "0.79240257", "0.75870395", "0.7547049", "0.73340666", "0.73014915", "0.7267236", "0.7194915", "0.71547794", "0.71327364", "0.7079289", "0.70439297", "0.69918877", "0.6959046", "0.6955211", "0.69239324", "0.69239324", "0.6898673", "0.6885382", "0.68...
0.0
-1
Verifies an image array is valid. An image should consist of a 2D array, 11x11. Each array element is again an arry, containing a valid colour (see valid_color()).
def valid_image(self, image): valid = False if (isinstance(image, list) and len(image) == 11): valid = True for row in image: if (isinstance(row, list) and len(row) == 11): for pixel in row: if not self.valid_color(pixel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_image(path):\n problems = False\n # Rasterio env is required to make sure that the gdal bindings are setup correctly.\n with rasterio.Env():\n try:\n dataset = rasterio.open(path)\n except Exception as e:\n logging.error(\"Could not open dataset\", e)\n ...
[ "0.69907063", "0.6628675", "0.65698457", "0.654781", "0.6223626", "0.6212039", "0.6194003", "0.6153692", "0.61125004", "0.6109303", "0.60833055", "0.6073538", "0.6056568", "0.60472417", "0.6038874", "0.60378206", "0.5935475", "0.5934053", "0.591937", "0.589891", "0.5895801", ...
0.79637307
0
Grab filename of a file inside a specific directory that has a specific file extension
def get_file(path, extension, override=False): ext_lst = [] for f_name in os.listdir(path): if f_name.endswith(extension): ext_lst.append(f_name) if len(ext_lst) == 0: return ext_lst elif len(ext_lst) == 1: return ext_lst[0] else: if ov...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_specific_file_extension_in_dir(dir_path, extension):\r\n return glob.glob(os.path.join(dir_path, r'*{}'.format(extension)))[0].replace('\\\\', '/').split('/')[-1]", "def find_file(directory, extensions):\n for filename in os.listdir(directory):\n if filename.endswith(extensions):\n ...
[ "0.8159145", "0.7833061", "0.76203996", "0.7513476", "0.74889696", "0.7435228", "0.74166095", "0.7396118", "0.73533046", "0.72493005", "0.7237454", "0.7231785", "0.7219062", "0.72186875", "0.72172874", "0.72098106", "0.72052807", "0.71939605", "0.717696", "0.71744823", "0.717...
0.0
-1
Sets the asset of this BalanceSheetResponse.
def asset(self, asset): self._asset = asset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_asset(self, asset, expiration, timestamp):\n return self \\\n .asset_id(asset.asset_id) \\\n .fold() \\\n .coalesce(\n # The asset exists.\n __.unfold()\n .choose(\n __.values('first_seen').is_(P.gt(time...
[ "0.56663287", "0.5655941", "0.5442714", "0.5317689", "0.5245131", "0.5146978", "0.5071249", "0.5071249", "0.49653563", "0.49569318", "0.49485067", "0.4905685", "0.4860848", "0.4860848", "0.48567066", "0.48478153", "0.4792268", "0.4753543", "0.47104928", "0.4710258", "0.470983...
0.6991855
0
Sets the liability of this BalanceSheetResponse.
def liability(self, liability): self._liability = liability
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def liability_account(self, liability_account):\n\n self._liability_account = liability_account", "def reliability(self, reliability):\n self._reliability = reliability", "def set_liability(self, people, currency):\n for name, person in people.items():\n if self.name != name:\n ...
[ "0.7148366", "0.50299805", "0.47544593", "0.47082624", "0.46826044", "0.46816212", "0.46490225", "0.46420383", "0.4620017", "0.460696", "0.45473304", "0.45454252", "0.45278692", "0.45130315", "0.44984996", "0.44908172", "0.4476904", "0.4476904", "0.4476904", "0.44643736", "0....
0.80835104
0
Provides acl_user acquisition wrapped owner of object
def ownerOfObject(obj): udb, uid = obj.getOwnerTuple() root = obj.getPhysicalRoot() udb = root.unrestrictedTraverse(udb, None) if udb is None: user = SpecialUsers.nobody else: user = udb.getUserById(uid, None) if user is None: user = SpecialUsers.nobody el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user(self):\n return self.owner.user", "def get_owner(self, obj):\n return obj.user.username", "def user(self):\n if self._user is None:\n pk, full_name = self.owner.split(',')\n pk = int(pk)\n self._user = User.objects.get(pk=pk)\n return self._...
[ "0.7301267", "0.7274408", "0.69771713", "0.68102026", "0.6794391", "0.6782739", "0.6782739", "0.6782739", "0.6782659", "0.6730782", "0.66899914", "0.66899914", "0.66899914", "0.66899914", "0.66899914", "0.6631292", "0.6580809", "0.6556197", "0.6535707", "0.6496461", "0.649646...
0.7049495
2
Get the size of an IP range between two IP addresses
def filter_ipnet_range_size(network_cidr, range_start, range_end): try: network_cidr_str = unicode(network_cidr) range_start_str = unicode(range_start) range_end_str = unicode(range_end) except NameError as ex: network_cidr_str = str(network_cidr) range_start_str = str(ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overlap_len(range1, range2):\n return min(range1[1], range2[1]) - max(range1[0], range2[0])", "def part_2(ranges: 'RangeSet', total_ips_count: int = 1 << 32) -> int:\n\n allowed_count = total_ips_count - len(ranges)\n print(f\"part 2: there are total {allowed_count} allowed IPs\")\n return allowe...
[ "0.75239325", "0.70771736", "0.64909214", "0.6339636", "0.6309138", "0.6297126", "0.62068313", "0.59807116", "0.59765637", "0.5971388", "0.5944476", "0.59031457", "0.5833933", "0.58259654", "0.57977855", "0.57947385", "0.57709235", "0.57447606", "0.5684807", "0.5605645", "0.5...
0.7326709
1
Contracts the edge between node1 and node2 of a graph. All modifications are done inplace, i.e., the input graph is mutated to the output graph. Thus, there is no explicit output value returned.
def contract_edge(graph, node1, node2): # Add the edges of the second note to the edges of the first node graph[node1].extend(graph.pop(node2)) # Relabel all edges pointing to the second node to edges pointing # to the first node for node in graph: for idx, edge in enumerate(graph[node]): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, node1: Node, node2: Node):\n self.__add_edge(node1, node2)\n self.__add_edge(node2, node1)", "def get_edge(self, node1, node2):\n assert node1 in self.nodes, \"No node \"+str(node1)+\" in graph \"+str(self)\n assert node2 in self.nodes, \"No node \"+str(node2)+\" in...
[ "0.658597", "0.6477135", "0.6426503", "0.63824064", "0.6347948", "0.6332721", "0.6221025", "0.6212467", "0.62078524", "0.6173099", "0.6151804", "0.6148558", "0.61477923", "0.6089226", "0.6059773", "0.60320055", "0.60186476", "0.60104877", "0.597998", "0.5961898", "0.5883053",...
0.76296526
0
Constructor for JSONEncoder, with sensible defaults. If skipkeys is False, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is True, the output is guaranteed to be str objects with all incoming unicode char...
def __init__(self, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8'): self.skipkeys = skipkeys self.ensure_ascii = ensure_ascii self.check_circular = check_circular self.allow_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,\n allow_nan=True, cls=None, indent=None, separators=None,\n encoding='utf-8', default=None, sort_keys=False, **kw):\n # cached encoder\n if (not skipkeys and ensure_ascii and\n check_circular and allow_nan and\n ...
[ "0.78486615", "0.76752955", "0.6866837", "0.64836866", "0.6204258", "0.61003757", "0.59813267", "0.5967136", "0.5928099", "0.5913954", "0.57838464", "0.57742614", "0.5734574", "0.5651326", "0.5651072", "0.5629727", "0.5607927", "0.5601313", "0.5587081", "0.5578469", "0.555265...
0.68341976
3
Return the Python representation of ``s`` (a ``str`` or ``unicode`` instance containing a JSON document)
def decode(self, s, _w=WHITESPACE.match): obj, end = self.raw_decode(s, idx=_w(s, 0).end()) end = _w(s, end).end() if end != len(s): raise ValueError(errmsg("Extra data", s, end, len(s))) return obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_json(s):\n return json.dumps(s.as_dict())", "def as_json_response(s):\n return JsonResponse(s.as_dict(), safe=False)", "def json_str(js: Union[Dict[str, Any], Input, str]) -> str:\n if type(js) is dict:\n js = json.dumps(js)\n elif type(js) is Input:\n js = json.dumps(j...
[ "0.7389219", "0.650332", "0.6420524", "0.63189644", "0.63189644", "0.63189644", "0.63189644", "0.63189644", "0.63189644", "0.63189644", "0.63189644", "0.63189644", "0.63189644", "0.63189644", "0.63189644", "0.63189644", "0.63189644", "0.63189644", "0.63189644", "0.63189644", ...
0.0
-1
Deserialize ``fp`` (a ``.read()``supporting filelike object containing a JSON document) to a Python object. If the contents of ``fp`` is encoded with an ASCII based encoding other than utf8 (e.g. latin1), then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS2) are not ...
def load(fp, encoding=None, cls=None, object_hook=None, **kw): return loads(fp.read(), encoding=encoding, cls=cls, object_hook=object_hook, **kw)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,\n parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):\n return loads(fp.read(),\n encoding=encoding, cls=cls, object_hook=object_hook,\n parse_float=parse_float, parse_int=parse_int,\n parse_con...
[ "0.75355", "0.6528654", "0.6524313", "0.6424895", "0.6363184", "0.6089399", "0.607569", "0.58753705", "0.5839447", "0.5839447", "0.5831649", "0.5749229", "0.5743833", "0.5696048", "0.56695485", "0.562944", "0.5596189", "0.55291873", "0.5513738", "0.5509332", "0.54805064", "...
0.766229
0
Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) to a Python object. If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding other than utf8 (e.g. latin1) then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS2) are not...
def loads(s, encoding=None, cls=None, object_hook=None, **kw): if cls is None and encoding is None and object_hook is None and not kw: return _default_decoder.decode(s) if cls is None: cls = JSONDecoder if object_hook is not None: kw['object_hook'] = object_hook return cls(encodi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,\n parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):\n if (cls is None and encoding is None and object_hook is None and\n parse_int is None and parse_float is None and\n parse_constant is None...
[ "0.808103", "0.5960895", "0.5956469", "0.58589184", "0.57529974", "0.56702185", "0.56604004", "0.5645725", "0.5613678", "0.5505644", "0.5437702", "0.5422464", "0.54089415", "0.53521883", "0.5340952", "0.5320991", "0.53008944", "0.5278458", "0.5232494", "0.5173803", "0.5162433...
0.8434584
0
Action generation method. This is a required method that generates list of actions corresponding to the list of units.
def gen_action(self, agent_list, observation, frame_idx, train, free_map=None): #TODO add multiple agent functionality with a for loop if train == True: epsilon = self.epsilon_by_frame(frame_idx) if random.random() > epsilon: state = observation ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_actions(self) -> list:\n pass", "def generate_actions(self):\n \n # For all state nodes\n action = 0\n \n for l in range(self.u0_n):\n for m in range(self.u1_n):\n \n u = np.array([ self.ud[0][l] , self.ud[1][m] ])\n...
[ "0.78039974", "0.6599961", "0.6583888", "0.6550404", "0.6318069", "0.6303104", "0.62136245", "0.6202786", "0.6168279", "0.6121591", "0.6121242", "0.6101409", "0.6096415", "0.6063816", "0.59970564", "0.5992893", "0.5979426", "0.5932875", "0.5930897", "0.5893786", "0.58743036",...
0.6241119
6
Asserts that a schema section is returned successfully.
def test_successful_parse_documented_endpoints(monkeypatch) -> None: monkeypatch.setattr(django_settings, 'SWAGGER_TESTER', {'PATH': yml_path}) monkeypatch.setattr('django_swagger_tester.static_schema.loader.LoadStaticSchema.get_schema', ret_schema) documented_endpoints = [ { 'url': '/ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_valid_section(self):\n arm = self.ar[2009][11]\n ars = arm['general']\n self.assertTrue(isinstance(ars, awstats_reader.AwstatsSection))", "def test_section_is_correct(self):\n res = self.client().post('/api/v1/sections/', headers={'Content-Type': 'application/json'},\n ...
[ "0.63375217", "0.6236801", "0.6043724", "0.60129607", "0.59968656", "0.59787166", "0.59246194", "0.5907567", "0.5836429", "0.5791745", "0.57532513", "0.5714468", "0.56544596", "0.5636282", "0.563355", "0.5622975", "0.5606759", "0.55755216", "0.5552246", "0.55517346", "0.55316...
0.0
-1
Asserts that a schema section is returned successfully.
def test_successful_parse_undocumented_endpoints(monkeypatch) -> None: monkeypatch.setattr(django_settings, 'SWAGGER_TESTER', {'PATH': yml_path}) monkeypatch.setattr('django_swagger_tester.static_schema.loader.LoadStaticSchema.get_schema', ret_schema) for url in ['/api/v1/cars/incorrect/', '/api/v1/trucks/i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_valid_section(self):\n arm = self.ar[2009][11]\n ars = arm['general']\n self.assertTrue(isinstance(ars, awstats_reader.AwstatsSection))", "def test_section_is_correct(self):\n res = self.client().post('/api/v1/sections/', headers={'Content-Type': 'application/json'},\n ...
[ "0.63362134", "0.6236526", "0.60436726", "0.6013245", "0.59971094", "0.5977459", "0.59233713", "0.5907124", "0.5835508", "0.5790342", "0.575346", "0.5713936", "0.5652794", "0.5636672", "0.56332076", "0.56219596", "0.5605913", "0.55726606", "0.5552061", "0.55516595", "0.553086...
0.0
-1
Asserts that the right exception is raised when an endpoint is not documented in the schema.
def test_no_matching_routes(monkeypatch) -> None: monkeypatch.setattr(django_settings, 'SWAGGER_TESTER', {'PATH': yml_path}) monkeypatch.setattr('django_swagger_tester.static_schema.loader.LoadStaticSchema.get_schema', ret_bad_schema) with pytest.raises(ValueError, match='Could not resolve path'): L...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_raise_on_invalid(self):\n assert \"raise_on_invalid\" not in self.route.route\n assert self.route.raise_on_invalid().route[\"raise_on_invalid\"]", "def assert_schema_error(*args):\n assert_exception(SchemaError, *args)", "def test_bad_schema(self, mock_provider):\n p = mock_pro...
[ "0.66290885", "0.6589994", "0.6465615", "0.64435554", "0.64254934", "0.63481367", "0.6320499", "0.61972", "0.61816716", "0.6179937", "0.61683005", "0.6147189", "0.61388695", "0.61040753", "0.609478", "0.6084303", "0.60668993", "0.6025201", "0.6018969", "0.6005042", "0.5989284...
0.5578484
99
Tests if the maximum is in the end of the list
def test_end(self): lst = [1, 5, 98] self.assertEqual(max_integer(lst), 98)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_max_end(self):\n self.assertEqual(max_integer([5, 3, 4, 8]), 8)", "def exceeded_max(self):\n return self.total_max is not None and self.counter > self.total_max", "def recurrent_max_value_in_list(lst, max_value):\n if len(lst) == 0:\n return max_value\n elif lst[0] > max_val...
[ "0.71259797", "0.67548877", "0.6693627", "0.66736656", "0.65468043", "0.64953953", "0.6486684", "0.64616114", "0.63404614", "0.6324984", "0.6286272", "0.628014", "0.6240216", "0.62391406", "0.621565", "0.61904174", "0.61837685", "0.6183155", "0.6154539", "0.61475307", "0.6130...
0.67132455
2
Test for a list containing equal positive numbers
def equal_pos_numbers(self): lst = [98, 98, 98] self.assertEqual(max_integer(lst), 98)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonzero(list_):\n for a in list_:\n if a!=0:\n return True\n return False", "def has_positive(l):\n return any([p > 0 for p in l])", "def onlyonepositive(a):\n nbr = 0\n for e in a:\n if e >= 0: \n nbr += 1\n if nbr>1: return False\n return n...
[ "0.73180497", "0.7258623", "0.71384597", "0.68535435", "0.65990275", "0.6504538", "0.6499228", "0.6464319", "0.6455612", "0.6447883", "0.6402161", "0.63938046", "0.63630766", "0.6358199", "0.6354805", "0.634186", "0.63348347", "0.63304996", "0.6330068", "0.63282305", "0.63254...
0.61451536
31
Test for a list containing equal negative numbers
def equal_neg_numbers(self): lst = [-98, -98, -98] self.assertEqual(max_integer(lst), -98)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonzero(list_):\n for a in list_:\n if a!=0:\n return True\n return False", "def has_positive(l):\n return any([p > 0 for p in l])", "def test_neg_ordered(self):\n no_list = [-1, -2, -3, -4, -5]\n self.assertEqual(max_integer(no_list), -1)", "def test_lists_negati...
[ "0.7076897", "0.7064754", "0.68930846", "0.6874181", "0.6748502", "0.67405194", "0.66181076", "0.6546811", "0.6488424", "0.64318657", "0.6418424", "0.6365974", "0.63108015", "0.6272018", "0.626679", "0.6247835", "0.6206056", "0.6201767", "0.6188527", "0.6161763", "0.61460274"...
0.73772514
0
Given a listlike object, divide into training, dev, and test sets.
def train_dev_test_split(sequence, train_frac, dev_frac, random_seed=None): if random_seed: random.seed(random_seed) if train_frac > 1 or train_frac < 0 or dev_frac > 1 or dev_frac < 0: raise ValueError("train and dev fractions must be between 0 and 1!") if train_frac + dev_frac > 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_dev_test_split(object_list, split_ratio=(0.8, 0.1, 0.1), seed=2018):\n train_size, dev_size, test_size = split_ratio\n # TODO: add stratify option for split on pair level, investigate same option for document/sentence level?\n train, tmp = train_test_split(object_list, random_state=seed, train_s...
[ "0.76097775", "0.67750794", "0.66856766", "0.66627574", "0.65703756", "0.65089947", "0.64809936", "0.6321968", "0.62032795", "0.61771846", "0.61729765", "0.61183095", "0.6111564", "0.60862833", "0.6072344", "0.6064078", "0.60625905", "0.604864", "0.60336804", "0.60042447", "0...
0.6033994
18
Strip "Data", etc. off the end to get the name of the parent table to this data table
def parent_table(self): for suffix in self.SUFFIXES: if self.table.endswith(suffix): return self.table[:-len(suffix)] raise ValueError("{} does not match any of the known suffixes for a data table".format(self.table))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_col_of_parent(self):\n if self.parent_table() == 'SupplyEfficiency':\n return 'id'\n\n parent_col = self.parent_col\n if parent_col.endswith('tech_id') or parent_col.endswith('node_id') or\\\n parent_col.endswith('technology_id') or parent_col == 'subsector_id':\n ...
[ "0.6307871", "0.6136946", "0.61235917", "0.60738796", "0.59629494", "0.5932281", "0.5929961", "0.5915642", "0.5902401", "0.5889462", "0.578498", "0.57787806", "0.5777392", "0.57764745", "0.5773203", "0.5773203", "0.5773203", "0.5769027", "0.57683986", "0.57663757", "0.5722591...
0.7856414
0
Returns the last integer found in a string (1 if none)
def get_last_number(s:str): array = re.findall(r'[0-9]+', s) if array.__len__() is 0: return -1 return int(array[-1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_numeric_char(self, s):\n keep = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '.'}\n i = 0\n not_done = True\n while not_done:\n if s[i] in keep:\n i += 1\n else:\n not_done = False\n\n if i >= len(s):\n ...
[ "0.6896008", "0.6872279", "0.65133303", "0.64869636", "0.6372288", "0.63218755", "0.62476844", "0.6202068", "0.6181913", "0.6166645", "0.61248183", "0.61079323", "0.61073995", "0.6087945", "0.6053075", "0.6051329", "0.60404825", "0.6020991", "0.6010801", "0.59993106", "0.5983...
0.83541495
0
In this function we initialize the parameters using the prior. The variance of the weights depends on the prior !!
def reset_parameters(self): for i in range(self.num_layers): getattr(self, 'LSTMCell%i'%(i+1)).reset_parameters()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_parameters(self):\n stdv = 1. / math.sqrt(self.weight.data.size(1))\n self.weight.data.uniform_(-stdv, stdv)\n if self.bias is not None:\n self.bias.data.uniform_(-stdv, stdv)", "def initialise_parameters(self):\n # Weights\n init = select_w_init(self.w_init...
[ "0.7803075", "0.725282", "0.72102064", "0.71267134", "0.70833135", "0.7010625", "0.700099", "0.6907211", "0.68955886", "0.6876174", "0.6856942", "0.6856942", "0.6856793", "0.6827381", "0.67992646", "0.6798266", "0.6796257", "0.67947084", "0.6790654", "0.67878944", "0.6777694"...
0.0
-1
Mock of sphinx' pathto() just for the homepage. Otherwise we cannot reuse our sphinx templates.
def pathto(*args): return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_template_home(self):\n self.assertTemplateUsed(self.response, 'index.html')", "def test_html_documentation(self):\n app = Sphinx(\n self.source_dir,\n self.config_dir,\n self.output_dir,\n self.doctree_dir,\n buildername='html',\n ...
[ "0.62544733", "0.6210216", "0.6135812", "0.61168873", "0.61097676", "0.60635585", "0.60095423", "0.5986903", "0.5982867", "0.5947885", "0.5922503", "0.5922022", "0.5909157", "0.58936256", "0.58916813", "0.58687884", "0.5845921", "0.5835059", "0.5818576", "0.58080834", "0.5807...
0.0
-1
Loads data for the specified city and filters by month and/or day if applicable.
def filter_data(city, data_filter, Month, Day): directory = 'C:/Users/The Presence/Documents/Personal Document/Personal Development/Data Science and Analytics/Udacity (Python Course)/Labs Tasks-20200924T221854Z-001/Lab Results/Capstone Project/bikeshare-2/' + city df = pd.read_csv(directory) df_1 = df.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.80950326", "0.8056632", "0.7996945", "0.7982038", "0.7966112", "0.79466665", "0.7942356", "0.79383606", "0.79283273", "0.7906326", "0.7904717", "0.7902317", "0.78923416", "0.7883008", "0.78672147", "0.7849188", "0.784072", "0.7838124", "0.7828984", "0.78285855", "0.7816761...
0.0
-1
Yield successive nsized chunks from lst.
def chunks(lst, n): for i in range(0, len(lst), n): yield lst[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunks(self, lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]", "def chunks(lst: list, n: int):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]", "def chunks(lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]", "de...
[ "0.83073896", "0.81937337", "0.8191178", "0.8191178", "0.81903666", "0.81268156", "0.812207", "0.812207", "0.80774724", "0.80527616", "0.80527616", "0.80527616", "0.80527616", "0.80527616", "0.80042547", "0.7870935", "0.78464705", "0.7828888", "0.78281975", "0.78149104", "0.7...
0.80534166
18
Gets a Github Token with read permission to repositories
def get_read_token(self, repo_names: List[str]) -> str: permissions = {"contents": "read", "metadata": "read"} return self.get_access_token(repo_names, permissions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_github_credendial(cls) -> 'ApiCredential':\n return cls.select_token_for_api(GITHUB_API_NAME)", "def get_read_token(repo_names: List[str]) -> None:\n github_app = get_default_app()\n print(github_app.get_read_token(repo_names))", "def _get_github_cred(github_login=None):\n cred_identity = \...
[ "0.7388206", "0.7281786", "0.7081964", "0.67628413", "0.67486924", "0.6516352", "0.6467427", "0.64288074", "0.6357329", "0.6353102", "0.6352296", "0.62776095", "0.61808753", "0.61502045", "0.61355114", "0.6119075", "0.6097837", "0.6041554", "0.5988363", "0.5977112", "0.597440...
0.7311923
1