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
Produces a string representation of the trip.
def __repr__(self): s = "<DivvyTrip {}: Station {} to Station {}>" s= s.format(self.trip_id, self.from_station.station_id, self.to_station.station_id) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n dstr = 'Reactome Pathway\\n'\n dstr += ' ID: %s\\n' % self.id\n dstr += ' Description: %s\\n' % self.description\n dstr += ' Proteins: (%d)\\n' % len(self.proteins)\n dstr += ' Metabolites: (%d)\\n' % len(self.metabolites)\n dst...
[ "0.71879387", "0.6941198", "0.69187486", "0.69025534", "0.6785215", "0.672751", "0.6561159", "0.6489851", "0.64890873", "0.6483546", "0.6467029", "0.64618766", "0.6404803", "0.631699", "0.63167787", "0.629023", "0.6286794", "0.6268923", "0.6261166", "0.6227455", "0.6203087", ...
0.7706964
0
Returns the total distance of all the Divvy trips
def get_total_distance(self): total_distance = 0.0 for trip in self.trips: total_distance += trip.get_distance() return total_distance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distances(self, trips: list[Trip]) -> list[float]:\n raise NotImplementedError()", "def get_total_distance(trip):\n total_distance = 0\n for visit_index in range(len(trip) - 1):\n start = trip[visit_index] \n stop = trip[visit_index + 1] \n coords_1...
[ "0.7481388", "0.6978762", "0.69567424", "0.674678", "0.66295546", "0.6472056", "0.6456284", "0.6412936", "0.6378096", "0.6359892", "0.63431513", "0.6294736", "0.62829435", "0.62811685", "0.62751895", "0.62464976", "0.61913526", "0.61484164", "0.6132673", "0.6123849", "0.61184...
0.7534877
0
Computes the total duration, in seconds, of all the Divvy trips
def get_total_duration(self): total_duration = 0.0 for trip in self.trips: total_duration += trip.tripduration return total_duration
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_total_duration(trip):\n return trip[len(trip) - 1].start - trip[0].start + trip[len(trip) - 1].duration", "def totalSeconds(self):\n return self.leadout.getFrames()//75 - self.cdtoc[0].getFrames()//75", "def actual_duration(self) -> int:\n output = 0\n for flow_step in self.flow...
[ "0.66670084", "0.6479047", "0.6427605", "0.6368067", "0.63447046", "0.63000846", "0.6294224", "0.6289857", "0.6281352", "0.62755924", "0.62313265", "0.62297827", "0.6224424", "0.62199634", "0.621298", "0.6202346", "0.6200322", "0.61920553", "0.61758214", "0.6175321", "0.61711...
0.6843598
0
Converts a time in seconds to a string representation in days, hours, minutes, seconds.
def time_str(t): MINUTE = 60 HOUR = 60 * MINUTE DAY = 24 * HOUR t = int(t) days = t // DAY hours = (t % DAY) // HOUR minutes = (t % HOUR) // MINUTE seconds = t % MINUTE if days == 0: return "{}h {}m {}s".format(hours, minutes, seconds) else: return "{}d {}h ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fmt_time(seconds):\n return (\n str(datetime.timedelta(seconds=seconds))\n )", "def timestr(self, t):\n daysecs = 60 * 60 * 24\n if t < daysecs:\n return time.strftime(\"%H:%M:%S\", time.gmtime(t))\n elif t < daysecs * 2:\n return \"1 day\"\n el...
[ "0.7776659", "0.77588105", "0.7696329", "0.76295686", "0.7576087", "0.7557422", "0.7534917", "0.7509446", "0.75039965", "0.7462039", "0.7437039", "0.7428902", "0.7368408", "0.7336474", "0.7330293", "0.7311844", "0.73018265", "0.73018265", "0.72832906", "0.7267246", "0.7264852...
0.76074886
4
Create an empty pandas object containing the desired metadata.
def make_meta_object(x, index=None): if is_arraylike(x) and x.shape: return x[:0] if index is not None: index = make_meta_dispatch(index) if isinstance(x, dict): return pd.DataFrame( {c: _empty_series(c, d, index=index) for (c, d) in x.items()}, index=index ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dataframe(self):\n summary = self.get_summary()\n single_summary, row = [], []\n for head in self.TABLE_HEADS:\n row.append(summary[head])\n single_summary.append(row)\n df = DataFrame(single_summary, columns=self.TABLE_HEADS)\n df.index.name = \"Index\...
[ "0.66614556", "0.65362144", "0.64387447", "0.6434247", "0.6424217", "0.63438684", "0.6272487", "0.6175506", "0.61603564", "0.60749686", "0.6024976", "0.60212725", "0.6000058", "0.5992661", "0.5987045", "0.5968967", "0.5948718", "0.59475803", "0.59276164", "0.59165984", "0.589...
0.63323504
6
Splits the input dataframe in train set and test set. The split is stratified on the column passed as parameter (only one column name is accepted) and the ratio can be given as parameter.
def train_test_split_by_column( data: pd.DataFrame, column: str, ratio: float = 0.7, random_state: int = None, ) -> (pd.DataFrame, pd.DataFrame): if column not in data.columns: raise ValueError("The column parameter must be one of the columns of the 'data' dataframe") ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_test_splitter(df):\r\n RANDOM_SEED=40\r\n train,test = train_test_split(df, test_size=0.2,train_size = 0.8, random_state=RANDOM_SEED)\r\n print('train and test split done')\r\n return train, test", "def test_train_split(df, test_size=.1, splitting_method='prediction', **kwargs):\n\n ntr...
[ "0.75563693", "0.74960524", "0.7452467", "0.7341327", "0.72924083", "0.7291334", "0.727671", "0.71212924", "0.707269", "0.7028103", "0.7008543", "0.698748", "0.69832754", "0.69331133", "0.6919804", "0.6891369", "0.68854374", "0.68503374", "0.6842914", "0.68416864", "0.6812330...
0.78496295
0
Checks if an integer number n is prime. n integer The function returns True if the number is prime and it returns False otherwise.
def n_is_prime(n): if n == 2: return True if n < 2 or n % 2 == 0: return False for i in range(3, int(sqrt(n)) + 1, 2): if n % i == 0: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isprime(n):\n if prime(n):\n return True\n else:\n return False", "def isprime(n):\n if prime(n):\n return True\n else:\n return False", "def is_prime(n: int) -> int:\n assert isinstance(n, int)\n assert n > 0\n\n for x in range(2, int(math.sqrt(n) + 1)):\n ...
[ "0.88395494", "0.88395494", "0.87508154", "0.87178946", "0.8715702", "0.87098306", "0.86612314", "0.8640528", "0.86278236", "0.85890716", "0.85600996", "0.8556497", "0.8554581", "0.85540265", "0.8536962", "0.85233057", "0.8515484", "0.8513967", "0.8492125", "0.8477676", "0.84...
0.8607986
9
Generates the first prime number smaller that a given number n.
def first_nb_prime(n): while n > 0: n -= 1 if n_is_prime(n): return n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smallest_prime_factor(n):\n return next(gen_prime_factors(n))", "def getrandprime(n):\n\t\"\"\" expected runtime O(n) as a consequence of the prime number theorem \"\"\"\n\tif n == 2:\n\t\treturn 3\n\twhile 1:\n\t\tp = (1<<(n-1)) + random.getrandbits(n-2)*2 + 1\n\t\tif is_prime(p):\n\t\t\treturn p", "de...
[ "0.80389404", "0.7517021", "0.74703026", "0.74685913", "0.74320567", "0.7310024", "0.72068846", "0.719196", "0.714701", "0.7145298", "0.712401", "0.7100069", "0.7095458", "0.7006022", "0.7004524", "0.7001833", "0.69941026", "0.6988887", "0.6982938", "0.6971923", "0.696029", ...
0.783201
1
Returns the root component of the application.
def root(self): return self._root
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root_component(self) -> component.Component:\n\t\treturn component.Component(core.BNGetRootComponent(self.handle))", "def get_root(self):\n return ROOT", "def get_root(self):\n return self.root", "def get_root(self):\n return self.root", "def root(self):\r\n return self[self...
[ "0.75387627", "0.7523267", "0.7302871", "0.7302871", "0.716731", "0.70968425", "0.70968425", "0.7068918", "0.7031268", "0.69826114", "0.69547474", "0.68538284", "0.6813331", "0.68019074", "0.68005776", "0.67936516", "0.67545396", "0.67487895", "0.67432773", "0.67066693", "0.6...
0.70653546
11
Converts a MAVLink packet millimeter format to decimal meters.
def mavlink_alt(self,dist): return dist / 1000.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def millimeterToMeter(self):\n testName = \"millimeter_to_meter\"\n try:\n log.print_test_begin(testName)\n # ------------------------------------\n millimeters = 1000\n meters = sc_Length.millimeter_to_meter(millimeters)\n self.assertEquals(mete...
[ "0.7626224", "0.7475898", "0.7126639", "0.67198443", "0.64775676", "0.64757586", "0.6358822", "0.6257077", "0.6202504", "0.61517745", "0.6142202", "0.61352384", "0.60948163", "0.6054369", "0.60530657", "0.6041331", "0.6022396", "0.60151434", "0.60096616", "0.5960032", "0.5929...
0.0
-1
If weights is none, simple MLP is assumed, otherwise this should be the list of weights matrices from some model
def solve(self, weights=None, fitness_fn=None, n_generations=100, seed=None, detailed_log=False): if weights is None: weights = self.model.get_weights(copy=True) if fitness_fn is None: fitness_fn = self.evaluate_model if seed is not None: np.random.seed(seed)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ml_weights(inputmtx, targets):\n Phi = np.matrix(inputmtx)\n targets = np.matrix(targets).reshape((len(targets),1))\n weights = linalg.inv(Phi.transpose()*Phi)*Phi.transpose()*targets\n return np.array(weights).flatten()", "def weights_load(model, weights):\n model.load_weights(weights)\n l...
[ "0.6588782", "0.6503688", "0.6493194", "0.64459866", "0.64248705", "0.63597775", "0.6348168", "0.63239807", "0.6313227", "0.62571603", "0.6255854", "0.61987734", "0.61890405", "0.61762494", "0.61543655", "0.6147525", "0.613821", "0.61315817", "0.6128882", "0.612415", "0.61104...
0.0
-1
calculates a 1D gaussian kernel based on a given sigma normalizes result
def _calc_gauss1d_kernel(self, sigma): fwhm = self._halfwidth len = fwhm * 2 + 1 kern = np.zeros(len) if sigma < 0.0: kern[fwhm] = 1.0 return kern x = np.arange(-fwhm, fwhm+1) kern = np.exp(-.5 * x**2 / (sigma**2)) kern = kern /...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Gaussian_kernel(sigma=1):\n\n #number of points after 4 stds\n N = int(3*sigma)\n\n #distances\n dx = np.r_[ np.arange(-N,0), np.arange(0,N+1)]\n\n #evaluating the expenontial\n cnst = 1/( np.sqrt(2*np.pi) * sigma)\n\n\n kernel = cnst*np.exp(-dx**2/(2*sigma**2))\n\n return kernel / np.s...
[ "0.82243705", "0.8211775", "0.81792766", "0.7823996", "0.77954304", "0.77878433", "0.77460855", "0.7696546", "0.76146036", "0.75847846", "0.7557866", "0.75427926", "0.7527141", "0.75070256", "0.74936754", "0.7446715", "0.7419598", "0.7411367", "0.737006", "0.73658854", "0.736...
0.8324284
0
Sets the gateway client for this JavaGateway. This sets the appropriate gateway_property and resets the main jvm view (self.jvm). This is for advanced usage only. And should only be set before the gateway is loaded.
def set_gateway_client(self, gateway_client): if self.gateway_parameters.auto_convert: gateway_client.converters = proto.INPUT_CONVERTER else: gateway_client.converters = None gateway_client.gateway_property = self.gateway_property self._gateway_client = gateway_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gateway(self, gateway):\n\n self._gateway = gateway", "def gateway(self, gateway):\n\n self._gateway = gateway", "def public_gateway(self, public_gateway):\n self._public_gateway = public_gateway", "def gateway_id(self, gateway_id):\n self._gateway_id = gateway_id", "def gat...
[ "0.6914374", "0.6914374", "0.6191129", "0.6125193", "0.61007553", "0.5776132", "0.5659658", "0.5514068", "0.54175436", "0.53760403", "0.5371739", "0.53689796", "0.5363689", "0.5359578", "0.5346885", "0.5346885", "0.5342275", "0.5332983", "0.5332983", "0.5311829", "0.5259444",...
0.8475838
0
Creates a Java array of type `java_class` of `dimensions`
def new_array(self, java_class, *dimensions): if len(dimensions) == 0: raise Py4JError("new arrays must have at least one dimension") command = proto.ARRAY_COMMAND_NAME +\ proto.ARRAY_CREATE_SUB_COMMAND_NAME +\ get_command_part(java_class._fqn) for dimension i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeArray(*args, **kwargs):\n return Array(*args, **kwargs)", "def dim(inner_type_or_bitwidth, *size: int, name: str = None) -> hw.ArrayType:\n if isinstance(inner_type_or_bitwidth, int):\n ret = types.int(inner_type_or_bitwidth)\n else:\n ret = inner_type_or_bitwidth\n for s in size:\n ret = ...
[ "0.57666767", "0.567805", "0.5612229", "0.55851644", "0.5574938", "0.55675423", "0.54931504", "0.5459049", "0.5374391", "0.5313901", "0.5300511", "0.5251594", "0.52468425", "0.5211878", "0.5196798", "0.5182714", "0.5177465", "0.5176605", "0.5169312", "0.5167317", "0.5156963",...
0.7079469
0
Stops listening and accepting connection requests. All live connections are closed. This method can safely be called by another thread.
def shutdown(self): logger.info("Callback Server Shutting Down") with self.lock: self.is_shutdown = True quiet_shutdown(self.server_socket) quiet_close(self.server_socket) self.server_socket = None for connection in self.connections: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unlisten(self):\n self._http.close_all_connections()\n self._http.stop()", "def stop(self) :\n self.socketListener.close()", "def stop(self) -> None:\n self.server.stop_listening()", "def stop(self):\n \n self.connection.close()\n \n self._halted()"...
[ "0.7917594", "0.7514119", "0.7428993", "0.7377321", "0.7299307", "0.7186907", "0.71207833", "0.71077216", "0.70676225", "0.70258915", "0.7015204", "0.6984208", "0.69565654", "0.69277525", "0.6921206", "0.68872374", "0.6875601", "0.6863733", "0.68560797", "0.68519", "0.6847945...
0.63550997
76
Test if, when we are logged with an admin account, the API deletes correctly the equipment
def test_admin_delete_one_equipment(self): self.client.login(username='admin_user', password='admin_password') initial_equipments = Equipment.objects.count() kb = Equipment.objects.get(name="kettlebell") url = reverse('equipment_detail', kwargs={'pk': kb.pk}) response = self.clie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_admin_delete_one_equipment(self):\n self.client.login(username='ordinary_user', password='ordinary_password')\n initial_equipments = Equipment.objects.count()\n kb = Equipment.objects.get(name=\"kettlebell\")\n url = reverse('equipment_detail', kwargs={'pk': kb.pk})\n ...
[ "0.7650651", "0.6905233", "0.690449", "0.6886095", "0.6853166", "0.67741644", "0.6732775", "0.6614498", "0.65426123", "0.6484666", "0.64569086", "0.64363253", "0.6434805", "0.6361421", "0.63556814", "0.63374", "0.6292803", "0.6285187", "0.62551385", "0.62551177", "0.6246789",...
0.7263668
1
Test if, when we are logged with a non admin account, the API does not delete the equipment
def test_non_admin_delete_one_equipment(self): self.client.login(username='ordinary_user', password='ordinary_password') initial_equipments = Equipment.objects.count() kb = Equipment.objects.get(name="kettlebell") url = reverse('equipment_detail', kwargs={'pk': kb.pk}) response =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_permission_delete_not_owner(self):\n\n error_message = \"Authentication credentials were not provided.\"\n\n data = {\n \"item\": self.item_2.id,\n \"status\": \"SELL\",\n \"entry_quantity\": 700,\n \"price\": Decimal(\"3222.23\"),\n }...
[ "0.70590895", "0.6869486", "0.67299104", "0.6661963", "0.662754", "0.66245633", "0.65868956", "0.6477703", "0.64496577", "0.64418185", "0.6401097", "0.6399346", "0.6382662", "0.6331489", "0.6306275", "0.62710345", "0.62626076", "0.6236905", "0.62279016", "0.62241524", "0.6223...
0.74662036
0
rotate an image while keeping its center and size
def rot_center(image, angle): orig_rect = image.get_rect() rot_image = pygame.transform.rotate(image, angle) rot_rect = orig_rect.copy() rot_rect.center = rot_image.get_rect().center rot_image = rot_image.subsurface(rot_rect).copy() return rot_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate(img, angle, resample=False, expand=False, center=None):\n \n return img.rotate(angle, resample, expand, center)", "def rotate(self):\n\t\tlast_center = self.rect.center\n\t\tself.image = pg.transform.rotate(self.image_copy, self.angle)\n\t\tself.rect = self.image.get_rect() #...
[ "0.81452334", "0.7805273", "0.7710145", "0.76269615", "0.757972", "0.7482823", "0.7466026", "0.7434072", "0.7427269", "0.7427269", "0.7416224", "0.7411056", "0.7391068", "0.7391068", "0.73487955", "0.73358566", "0.73342544", "0.7307618", "0.72054905", "0.7154155", "0.7125723"...
0.736141
15
The React appplication id.
def appId(self): return self.app_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app_id(self) -> str:\n return pulumi.get(self, \"app_id\")", "def app_id(self) -> str:\n return pulumi.get(self, \"app_id\")", "def app_id(self) -> str:\n return pulumi.get(self, \"app_id\")", "def app_id(self) -> str:\n return pulumi.get(self, \"app_id\")", "def app_id(self...
[ "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "0.8215099", "...
0.7486466
36
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): df=pd.read_csv(CITY_DATA[city]) df['Start Time']=pd.to_datetime(df['Start Time']) df['month']=df['Start Time'].dt.month df['day_of_week']=df['Start Time'].dt.weekday df['hour']=df['Start Time'].dt.hour months=['all','jan','feb','mar','apr'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_city_data(city, month, day):\n df = pd.read_csv(CITY_DATA[city])\n #extract month, day, hour from start time\n df['month'] = pd.to_datetime(df['Start Time']).dt.month_name()\n df['day'] = pd.to_datetime(df['Start Time']).dt.weekday\n df['hour'] = pd.to_datetime(df['Start Time']).dt.hour\n\n...
[ "0.83183694", "0.8226695", "0.8150808", "0.80794895", "0.80427766", "0.8017983", "0.8001192", "0.79902804", "0.7979157", "0.797769", "0.79721206", "0.7957008", "0.7955993", "0.79484135", "0.7931038", "0.79188", "0.7912735", "0.791154", "0.790504", "0.7902931", "0.79026365", ...
0.775371
57
Displays statistics on the most frequent times of travel.
def time_stats(df): print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() # TO DO: display the most common month most_common_month = df['month'].mode() print("The most common month is :", most_common_month) # TO DO: display the most co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\r\n\r\n print('\\nThese are the statistics of the most frequent times of travel:\\n')\r\n start_time = time.time()\r\n\r\n # Display the most common month\r\n common_month = df['month'].mode()[0]\r\n print(\"- That's the most common month based on your selection: \" +\r\n ...
[ "0.79734164", "0.78498113", "0.7798944", "0.7781289", "0.7773746", "0.7761129", "0.7752243", "0.7737066", "0.77249265", "0.7717843", "0.7684565", "0.768247", "0.76785123", "0.7648882", "0.76441973", "0.7642864", "0.76418155", "0.7629008", "0.7623696", "0.7623371", "0.7620226"...
0.76798487
12
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # TO DO: display most commonly used start station most_common_start_station = df['Start Station'].mode()[0] print("The most commonly used start station :", most_common...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\033[1m' + 'Calculating the most popular stations and trip...\\n' + '\\033[0m')\n start_time = time.time()\n\n # display the most commonly used start station\n\n start_stn = df['Start Station'].mode()[0]\n print('Most popular start station is {}.'.format(start_stn)...
[ "0.7810814", "0.7673659", "0.7539738", "0.74988055", "0.74905735", "0.7489628", "0.74380475", "0.7430417", "0.74277467", "0.74258155", "0.74136025", "0.74059916", "0.7382939", "0.73798674", "0.73749375", "0.73665637", "0.7356157", "0.73522407", "0.7324741", "0.7305609", "0.73...
0.7104903
72
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # TO DO: display total travel time total_travel_time = df['Trip Duration'].sum() print("Total travel time :", total_travel_time) # TO DO: display mean travel time me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(df):\r\n\r\n print('\\nThese are the statistics related to the trips durations:\\n')\r\n start_time = time.time()\r\n\r\n # Display total travel time\r\n total_travel_time = df['Trip Duration'].sum()\r\n print(\"\\n- The total travel time based on your selection is: \" +\r\n ...
[ "0.82713985", "0.8119831", "0.804956", "0.80484164", "0.7979546", "0.79608977", "0.7947713", "0.79379344", "0.79312456", "0.7929292", "0.7928497", "0.7926215", "0.792144", "0.7917393", "0.79170704", "0.79146737", "0.790914", "0.7905247", "0.7903778", "0.78938603", "0.789253",...
0.79644394
5
Tests if a midpoint could have occured sometime during a sort.
def history_contains(array_history, potential_midpoint): for A in array_history: if arrays_equal(A[0], potential_midpoint): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stairstep(arr):\n arr = np.array(arr)\n if monotonic(arr):\n return False\n if count_spikes(np.diff(arr)) < arr.size/100:\n return False\n return (arr[0] == arr[1]) and spikes(np.diff(arr))", "def check_separation(values, distance_threshold):\n for i in range(len(values) - 1):\n ...
[ "0.602438", "0.59537596", "0.5931192", "0.58822936", "0.573643", "0.5692727", "0.568819", "0.5674372", "0.56152374", "0.5565147", "0.5543182", "0.5542726", "0.54908764", "0.5466142", "0.5459645", "0.5428258", "0.5421856", "0.5419994", "0.5400098", "0.5399667", "0.53922695", ...
0.50581014
62
Use 1 MAXHEAP for bottom half of numbers. Use 1 MINHEAP for top half of numbers.
def __init__(self): self.low = [] # maxheap self.high = [] # minheap
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\r\n self.upperHeap = [float('inf')]\r\n self.lowerHeap = [float('inf')]\r\n # lowerHeap's numbers are minus original numbers, because in Python heap is min-heap\r\n\r\n # always maintain that their lens are equal, or upper has 1 more than lower\r", "def build_heap(...
[ "0.6942151", "0.6758497", "0.67197144", "0.67174476", "0.67049056", "0.67049056", "0.6684114", "0.6661423", "0.6586838", "0.65580595", "0.6425189", "0.6403301", "0.6400801", "0.6373777", "0.63425285", "0.63394934", "0.63355166", "0.63355166", "0.63094115", "0.62820673", "0.62...
0.6692095
6
Method create to handle http post request to create shop details.
def create(request): payload = ShopSerializer(data=request.data) if payload.is_valid(raise_exception=True): return CreateShopService.execute(payload.validated_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create():\n try:\n request_data = request.get_json()\n response = ShoppingList.create(request_data)\n return response, 200\n except Exception as error:\n print('Error {}'.format(error))", "def post(self):\r\n data = request.json\r\n return save_new_product(data...
[ "0.69303554", "0.6598204", "0.6516153", "0.6513212", "0.6503747", "0.6499093", "0.6344963", "0.633857", "0.6309348", "0.63041496", "0.6292075", "0.6264474", "0.62361676", "0.6212475", "0.62114555", "0.6185552", "0.6166637", "0.61600536", "0.6156318", "0.6154393", "0.61377954"...
0.81337756
0
return the path to the output POD dataset metadata file
def pod_file(self): return os.path.join(self.bagdir, "metadata", POD_FILENAME)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _metadata_filepath(\n name: str, run_id: Optional[str] = None, operator_id: Optional[str] = None\n) -> str:\n path = _data_filepath(name, run_id, operator_id).lstrip(f\"{BUCKET_NAME}/\")\n path = f\"{path}.metadata\"\n\n return path", "def static_metadata_path(self):\r\n return os.path.joi...
[ "0.70126104", "0.67649555", "0.65997154", "0.6491819", "0.644661", "0.6445812", "0.64037144", "0.6361311", "0.63311327", "0.629494", "0.629494", "0.628326", "0.62661254", "0.6263706", "0.62473863", "0.62328124", "0.6232435", "0.61823905", "0.61648685", "0.61549604", "0.615215...
0.66726846
2
Generator to read the data in chunks of size of data_buffer.
def load_buffer(self): self.data_buffer = [] while self.processed_buffers < len(self.csv_files_per_task_per_worker): ( current_file_path, num_examples, start_id, ) = self.csv_files_per_task_per_worker[self.processed_buffers] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def read_chunks(self) -> AsyncIterator[bytes]:\n while True and not self.chunks_readed:\n chunk_size = int((await self.connection.reader.readline()).rstrip(), 16)\n if not chunk_size:\n # read last CRLF\n await self.connection.reader.readline()\n ...
[ "0.7088122", "0.70636785", "0.7050901", "0.6909458", "0.69048995", "0.6903343", "0.6903343", "0.6903343", "0.6903343", "0.6903343", "0.6903343", "0.6902528", "0.6902528", "0.68911666", "0.68236923", "0.6785956", "0.67353433", "0.6734736", "0.6651178", "0.6634299", "0.6623636"...
0.64743686
32
Return a string representation of the model.
def __str__(self): return self.project
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_model_(self):\n return str(self)", "def __str__(self):\n\n return str(self.model)", "def get_model_string(self):\n raise NotImplementedError()", "def __repr__(self):\n s = '' \n s += 'Model Name: ' + self._name + '\\n'\n s += 'Machine Learning Model: ' + st...
[ "0.8599919", "0.84243745", "0.81054443", "0.79581624", "0.7925775", "0.7876123", "0.783886", "0.78203756", "0.7745494", "0.77300745", "0.7717298", "0.76521814", "0.76501584", "0.75655025", "0.7556755", "0.75339997", "0.75320625", "0.7511401", "0.7503638", "0.74986756", "0.749...
0.0
-1
Return a string representation of the model.
def __str__(self): return self.text[:50] + "..."
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_model_(self):\n return str(self)", "def __str__(self):\n\n return str(self.model)", "def get_model_string(self):\n raise NotImplementedError()", "def __repr__(self):\n s = '' \n s += 'Model Name: ' + self._name + '\\n'\n s += 'Machine Learning Model: ' + st...
[ "0.85999465", "0.8424725", "0.8106197", "0.7958379", "0.7925403", "0.78757435", "0.7839306", "0.7820724", "0.7745776", "0.7730187", "0.77172416", "0.7652457", "0.765012", "0.75656146", "0.75568616", "0.7534002", "0.7531865", "0.75113434", "0.7503921", "0.7498677", "0.7494436"...
0.0
-1
Compiling a function into a callable TensorFlow graph. Do not use this decorator in every function, just in upper function. Because 'tf.function' decorator require function's input and output to be tensorflow tensors, so we need to transform tfe tensors to tensorflow tensors and transform inversely.
def function(func: Callable) -> Callable: @tf.function def graph_function(args, kwargs): args, kwargs = input_wrap(args, kwargs) result = func(*args, **kwargs) result = unwrap_func(result) return result @functools.wraps(func) def wrap_function(*args: Any, **kwargs: Any)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compiled(*args, _fn=None, _self=None, **kwargs):\n args = tf.nest.map_structure(tf.convert_to_tensor, args)\n kwargs = tf.nest.map_structure(tf.convert_to_tensor, kwargs)\n if tf.compat.v1.executing_eagerly() or not is_xla_available():\n if _self is not None:\n return _fn(_self, *args, **kwargs)\n ...
[ "0.728713", "0.68735164", "0.677896", "0.6728014", "0.65175086", "0.6454985", "0.64382094", "0.6432865", "0.63787395", "0.636313", "0.6345672", "0.6340944", "0.6333894", "0.62960064", "0.62039095", "0.6125526", "0.609604", "0.608143", "0.60788167", "0.607732", "0.6054515", ...
0.77654773
0
Returns the filtered queryset based on the value provided in the query string and retrievable via `self.value()`.
def queryset(self, request, queryset): # Compare the requested value # to decide how to filter the queryset. if self.value(): categories = Category.objects.all().filter(part=self.value()) return queryset.filter(category__in=[current.id for current in categories]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_queryset(self, value, queryset, field_name):\n filter_kwargs = {'%s__%s' % (field_name, self.lookup): value}\n return qs_filter(queryset, **filter_kwargs)", "def queryset(self, request, queryset):\n # Compare the requested value (either '80s' or '90s')\n # to decide how to ...
[ "0.77500844", "0.7561385", "0.74755234", "0.73904526", "0.73747724", "0.73111415", "0.72904456", "0.7271404", "0.72579867", "0.72442716", "0.72273624", "0.7179518", "0.7167556", "0.7117073", "0.7007768", "0.69978076", "0.6974762", "0.6973128", "0.6968191", "0.6968191", "0.694...
0.7421251
3
Method for getting an `older_than` value which is used in a few tests below. The tests specifically look for the second package in ALL_PACKAGES_MOCK_RESPONSE, as it's older than the first
def _get_older_than(): created_at = datetime.datetime.strptime( ALL_PACKAGES_MOCK_RESPONSE[0]["created_at"], "%Y-%m-%dT%H:%M:%S.%fZ" ) older_than = ( datetime.datetime.now() - created_at + datetime.timedelta(seconds=600) ) # Adding 5m in case the tests run long return older_than
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def versions_older_than(older_than: date, files: Iterable[Tuple[date, str, str]]) \\\n -> List[Tuple[date, str, str]]:\n return [x for x in files if older_than > x[0]]", "def _newerThanGivenYears(self):\n if self.max_review_age != float(np.inf):\n if len(self.data) > 0:\n ...
[ "0.6115824", "0.5873386", "0.5587882", "0.5552626", "0.5541184", "0.5498473", "0.5483047", "0.54309225", "0.5384619", "0.52839136", "0.5258588", "0.5255325", "0.5227806", "0.5224798", "0.51745623", "0.5166559", "0.5125901", "0.51246077", "0.51181376", "0.5109903", "0.5108506"...
0.8711674
0
When enddate should be greater than the startdate.
def check_start_end_date(self): if self.date_to and self.date_from: if self.date_to < self.date_from: raise ValidationError(_('End Date should be greater \ than Start Date.'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constrains_start_end_date(self):\n for rec in self:\n if not all([rec.start_date, rec.end_date]):\n continue\n if rec.start_date > rec.end_date:\n raise Warning(_(\n 'End Date must be after or equal to Start Date'))", "def clean_en...
[ "0.7471257", "0.69926214", "0.68767047", "0.6842853", "0.679922", "0.6727031", "0.6656853", "0.663644", "0.66089624", "0.66089624", "0.6532991", "0.6531116", "0.64947295", "0.6462521", "0.639547", "0.6395043", "0.6346554", "0.633894", "0.6322119", "0.6309633", "0.62912416", ...
0.7246074
1
Obtain the packge version from a python file e.g. pkg/__init__.py
def version(path): version_file = read(path) version_match = re.search(r"""^__version__ = ['"]([^'"]*)['"]""", version_file, re.M) if version_match: return version_match.group(1) raise RuntimeError("Unable to find version string.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version():\n with open(path.join(PACKAGE, \"__init__.py\"), encoding=\"utf-8\") as f:\n for line in f:\n if line.startswith(\"__version__\"):\n return eval(line.split(\"=\")[-1])", "def _get_version():\n\n to_match = comp(r'VERSION\\s=\\s\"(.*)\"\\n')\n\n try:\n ...
[ "0.82910275", "0.8008421", "0.8004209", "0.78058124", "0.7766488", "0.7731147", "0.7721274", "0.76584387", "0.7655471", "0.758105", "0.7564751", "0.75528854", "0.75417006", "0.75414175", "0.7534418", "0.7520407", "0.7520407", "0.7520407", "0.7520407", "0.7520407", "0.7520407"...
0.70753926
50
Initialize a new network.
def __init__(self, input_dim=3 * 32 * 32, hidden_dim=100, num_classes=10, weight_scale=1e-3, reg=0.0): self.params = {} self.reg = reg ############################################################################ # TODO: Initialize the weights and biases of the two-layer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_network(self):\n #Create the network\n self.network = Network(\"50.19.23.117\", 8080)", "def __init__(self, amount_nodes, amount_links):\n self.nodes = {}\n self.__createNetwork__(amount_nodes, amount_links)", "def init_network(name=NETWORK_NAME, nodes=[\"Alice\",\"Bob\",...
[ "0.8108218", "0.76692665", "0.7656324", "0.76131594", "0.7444921", "0.74334115", "0.7371696", "0.72837204", "0.70510834", "0.7018292", "0.69512916", "0.69427025", "0.6935787", "0.69219816", "0.6816404", "0.6807591", "0.67830807", "0.6775899", "0.67708445", "0.6768226", "0.676...
0.0
-1
Returns a string that represent the given term.
def term_to_string(deg,cof): if deg == 0: return str(cof) elif deg == 1: if cof != 1: return str(cof) + "x" else: return "x" else: if cof != 1: return str(cof) + "x^" + str(deg) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_label (\n self,\n term: rdflib.term.Identifier,\n ) -> str:\n tname = str(term)\n\n if isinstance(term, rdflib.term.Variable):\n tname = \"?\" + tname\n elif isinstance(term, rdflib.term.URIRef):\n tname = self._get_local_name(term)\n ...
[ "0.67617816", "0.65619546", "0.65034497", "0.64907837", "0.6433811", "0.63800544", "0.6378887", "0.6245395", "0.60785913", "0.60361975", "0.602544", "0.5986893", "0.5976006", "0.597389", "0.59708756", "0.5950705", "0.59274596", "0.5887056", "0.5874434", "0.5857903", "0.585473...
0.61064595
8
Get the coefficient of the given exponent.
def __getitem__(self, key): if key in self.data: return self.data[key] else: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_coeff(self):\n\t\treturn self.coeff.round(6).transpose()[0]", "def exponent(num, power=2):\n\treturn num ** power", "def compute_coefficient(self):\n\t\tx_trans = self.x.transpose()\n\t\tcoeff = np.matmul(np.matmul(np.linalg.inv(np.matmul(x_trans, self.x)), x_trans), self.y)\n\t\treturn coeff.round(8)"...
[ "0.67434555", "0.6617967", "0.6534851", "0.636156", "0.62599945", "0.6171046", "0.61490774", "0.6139507", "0.61395067", "0.61128443", "0.6099295", "0.6055656", "0.6034027", "0.598495", "0.5950759", "0.5854515", "0.5849566", "0.58414716", "0.5835317", "0.5835317", "0.5835317",...
0.0
-1
Get a string representation.
def __repr__(self): return " + ".join(Polynomial.term_to_string(i, self[i]) for i in self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_string(self):\r\n return self.__str__()", "def toString(self):\n return self.__str__()", "def to_string(self) -> str:\n pass", "def to_str(self):\n return self.str", "def get_str(self):\n pass", "def to_str(self):\n return pformat(self.to_dict())", "def ...
[ "0.7903598", "0.7763912", "0.7676324", "0.76720774", "0.7557249", "0.7452516", "0.7452516", "0.7452516", "0.7452516", "0.7452516", "0.7452516", "0.7452516", "0.7452516", "0.7452516", "0.7452516", "0.7452516", "0.7452516", "0.7452516", "0.7452516", "0.7452516", "0.7452516", ...
0.0
-1
Verify overflow property resolution
def test_overflow_resolution(): # All possible permutations of overflows and mismatch_alerts overflows = tuple(x.name for x in uut.properties.Overflow) alerts = tuple(x.name for x in uut.properties.Alert) permutations = [ ( {'overflow': x, 'mismatch_alert': xx}, {'overflo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_overflow(self):\n return False", "def checkOverflow(self, *__args): # real signature unknown; restored from __doc__ with multiple overloads\r\n return False", "def is_overflow(self):\n return False # TODO: implement it", "def has_overflow(self)->bool:\n for field in self.values()...
[ "0.71463877", "0.7063077", "0.69256294", "0.65015185", "0.6500108", "0.6500108", "0.6500108", "0.6500108", "0.5682134", "0.55565697", "0.5417526", "0.5330531", "0.5325887", "0.5313933", "0.5301892", "0.5296938", "0.5275316", "0.526799", "0.5257121", "0.52398187", "0.52031773"...
0.6439107
8
rotate the image by n90 degrees
def rotate90(self, I, n): M = cv.getRotationMatrix2D((I.shape[0]/2, I.shape[1]/2), 90*n, 1.0) return cv.warpAffine(I, M, dsize=I.shape[:2])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotation_90(image):\n image_rotated = flip_h(image)\n image_rotated = transpose(image_rotated)\n\n return image_rotated", "def rotate(img, angle, resample=False, expand=False, center=None):\n \n return img.rotate(angle, resample, expand, center)", "def rotate(image, angle...
[ "0.7966642", "0.7487715", "0.73778886", "0.73388743", "0.7338834", "0.7246001", "0.71972924", "0.71091455", "0.7087569", "0.7046213", "0.7046213", "0.7046213", "0.70084274", "0.6967483", "0.6920565", "0.689853", "0.6878664", "0.6851507", "0.6801716", "0.677569", "0.6754852", ...
0.79257673
1
Polygon to polyline conversion. Multipart shapes are converted to singlepart. The singlepart geometry is used to produce the polylines.
def pgon_to_pline(in_fc, out_fc): result = check_path(out_fc) if result[0] is None: print(result[1]) return result[1] gdb, name = result SR = getSR(in_fc) temp = arcpy.MultipartToSinglepart_management(in_fc, r"memory\in_fc_temp") a, IFT, IFT_2 = fc_geometry(temp, SR) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_polylines(self):\n raise NotImplementedError", "def polygon2pathd(polyline):\n return polyline2pathd(polyline, True)", "def _polygon_(t, side=6, lenght=100):\n angle = 360.0/side\n polyline(t, side, lenght, angle)", "def linepoly(poly):\n\n # If the polygon consists of multiple isla...
[ "0.6837928", "0.67501724", "0.6506185", "0.6495332", "0.6290623", "0.6282177", "0.6274506", "0.62616456", "0.6223034", "0.6215899", "0.60304123", "0.5999987", "0.59844273", "0.5976746", "0.5913174", "0.5846163", "0.57852453", "0.57793516", "0.5774857", "0.57692933", "0.574261...
0.5721702
21
Pads the matrix with the bias, zeros, and one in the corner, to avoid having to compute the bias separately
def pad_bias(matrix, bias, size): bias = np.pad(bias, [0, size - bias.size], 'constant') bias = bias.reshape((1, len(bias))) side = np.zeros((matrix.shape[0] + 1, 1)) # side[-1] = 1 matrix = np.concatenate((matrix, bias), axis=0) matrix = np.concatenate((matrix, side), axis=1) return matr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_bias(matrix, bias):\n bias = bias.reshape((1, len(bias)))\n\n side = np.zeros((matrix.shape[0] + 1, 1))\n side[-1] = 1\n\n matrix = np.concatenate((matrix, bias), axis=0)\n matrix = np.concatenate((matrix, side), axis=1)\n\n return matrix", "def zero_pad(X, pad):\n\n ### START CODE H...
[ "0.81753254", "0.61822844", "0.60346633", "0.598708", "0.5972064", "0.592904", "0.5858382", "0.57937044", "0.578354", "0.5778411", "0.5764694", "0.5734268", "0.5700774", "0.5675995", "0.56479603", "0.5644457", "0.55626416", "0.5499451", "0.5476762", "0.5468824", "0.5459388", ...
0.8119685
1
Convert input CXC time (sec) to the time base required for the matplotlib plot_date function (days since start of the Year 1 A.D yes, really).
def convert_time(rawtimes): # rawtimes is in units of CXC seconds, or seconds since 1998.0 # Compute the Delta T between 1998.0 (CXC's Epoch) and 1970.0 (Unix Epoch) seconds_since_1998_0 = rawtimes[0] cxctime = dt.datetime(1998, 1, 1, 0, 0, 0) unixtime = dt.datetime(1970, 1, 1, 0, 0, 0) # Ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_time_format(stime, dtype):\n#\n#--- today's ydate and year\n#\n cdate = int(float(time.strftime('%j', time.gmtime())))\n tyear = int(float(time.strftime('%Y', time.gmtime())))\n\n ctime = []\n byear = 0\n schk = 0\n for ent in stime:\n#\n#--- set date in ydate\n#\n if dtype in...
[ "0.6540273", "0.61797804", "0.6092257", "0.5799954", "0.5603301", "0.5579794", "0.5568002", "0.5559444", "0.552024", "0.55084366", "0.549942", "0.5485169", "0.5347964", "0.53335005", "0.5325216", "0.5324779", "0.5266588", "0.52605534", "0.5242397", "0.52421445", "0.5233334", ...
0.6508316
1
Return batches of images
def image_generator_hist(image_dir, image_dir_name, batch_size, mode="one-hot"): if image_dir is None: image_dir = os.listdir(image_dir_name) shuffle(image_dir) n = 0 while True: batch_im_names = image_dir[n:n+batch_size] batch_imputs = np.zeros((batch_size, 256, 256, 1)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_batch(self):\n # get images\n image_form_arr = []\n train_images = []\n train_images_masks = []\n\n print(\"\\n %s\" % os.getcwd())\n work_dir = os.getcwd()+\"/train_imgs/\"\n os.chdir(work_dir)\n for files in os.walk(work_dir):\n for...
[ "0.7570384", "0.73649466", "0.72603285", "0.725723", "0.7179897", "0.7158304", "0.7138625", "0.7070942", "0.70320064", "0.701385", "0.7003616", "0.6893685", "0.6888555", "0.6883822", "0.68718356", "0.6864629", "0.6856278", "0.68429804", "0.68386954", "0.6828148", "0.6758715",...
0.0
-1
Call from the given directory "git status" in order to retrieve the current commit. If the path is relative, it is relative to the cwd
def get_git_commit(self, *folder) -> str: p = self._abs_wrt_cwd(*folder) result, stdout, stderr = self.operating_system.execute_return_stdout( commands=[["git", "rev-parse", "HEAD"]], cwd=p, ) return stdout.strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_current_branch(path, commit=\"HEAD\"):\n try:\n p = subprocess.run(\n [\"git\", \"rev-parse\", \"--abbrev-ref\", commit],\n stdout=subprocess.PIPE,\n stderr=subprocess.DEVNULL,\n cwd=path,\n check=True,\n ...
[ "0.726467", "0.7186074", "0.7085773", "0.67962044", "0.67815685", "0.6626333", "0.65638584", "0.6510096", "0.6490694", "0.6490448", "0.64813894", "0.63148147", "0.6308585", "0.6287079", "0.6263892", "0.6246538", "0.6241196", "0.6236944", "0.6219318", "0.6185567", "0.61738247"...
0.6771612
5
Call from the given directory "git" in order to retrieve the current branch. If the path is relative, it is relative to the cwd
def get_git_branch(self, *folder) -> str: p = self._abs_wrt_cwd(*folder) result, stdout, stderr = self.operating_system.execute_return_stdout( commands=[["git", "branch", "--show-current"]], cwd=p, ) return stdout.strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def git_branch_retrieve():\n git_branch = None\n if shutil.which(\"git\"):\n original_working_folder = os.getcwd()\n os.chdir(SCRIPTDIR)\n git_branch = CFunc.subpout(\"git rev-parse --abbrev-ref HEAD\")\n os.chdir(original_working_folder)\n else:\n git_branch = \"master\...
[ "0.80002016", "0.7990478", "0.7946039", "0.7735753", "0.7673389", "0.7645841", "0.73590016", "0.7312536", "0.7306712", "0.72928005", "0.69589937", "0.69571507", "0.6950347", "0.69282335", "0.68531615", "0.68526536", "0.68524295", "0.68273526", "0.6824016", "0.6818609", "0.681...
0.7482826
6
Call from the given directory "git" in order to retrieve if the associated git repo has no changes. If the path is relative, it is relative to the cwd
def is_git_repo_clean(self, *folder) -> bool: p = self._abs_wrt_cwd(*folder) result, stdout, stderr = self.operating_system.execute_return_stdout( commands=[["git", "status"]], cwd=p, ) return "nothing to commit, working tree clean" in stdout
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_git_dir() -> None:\n check_git_installed()\n with subprocess.Popen(\n [GIT_PATH, \"status\"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL\n ) as process:\n if process.wait():\n raise click.ClickException(\"Not a git directory.\")", "def checkIfGitRepo():\n ...
[ "0.7125402", "0.69427174", "0.67426497", "0.67403615", "0.66983676", "0.6649411", "0.66356117", "0.6591551", "0.65318656", "0.6527492", "0.65062255", "0.6476407", "0.64561874", "0.6437207", "0.6432201", "0.63805765", "0.6377521", "0.6370182", "0.6328394", "0.6311416", "0.6307...
0.6034023
34
Convert input attribute name into a valid HTCondor attribute name HTCondor ClassAd attribute names consist only of alphanumeric characters or underscores. It is not clearly documented, but the alphanumeric characters are probably restricted to ASCII. Attribute names created from multiple words typically capitalize the ...
def safe_htcondor_attribute(attribute: str) -> str: # splitting by invalid characters removes them from the resulting array split_attr = re.split(r"[^\w]", attribute, flags=re.ASCII) safe_attr = "".join([word.capitalize() for word in split_attr if word]) return safe_attr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_attribute(name):\n return '_'.join(part.lower() for part in name_parts(name))", "def clean_attr(attr):\n return ' '.join([word[0].upper() + word[1:] for word in attr.split('_')])", "def mangled_attribute_name(clsname: str, attributename: str) -> str:\n return lcamelcase(clsname) + '__' + unde...
[ "0.7328959", "0.7233768", "0.6934075", "0.67279166", "0.6452584", "0.6214228", "0.6134311", "0.6120379", "0.6114387", "0.6114201", "0.60941136", "0.6092679", "0.6083295", "0.60829055", "0.598698", "0.5985216", "0.5965096", "0.5963181", "0.5954043", "0.5904531", "0.58845866", ...
0.74602884
0
Get a sql statement which create a result table for SHAP
def get_create_shap_result_sql(conn, data_table, result_table, label_column): schema = db.get_table_schema(conn, data_table) fields = ["%s STRING" % f[0] for f in schema if f[0] != label_column] return "CREATE TABLE IF NOT EXISTS %s (%s)" % (result_table, "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_sp_table(sql: str, *params):\n # todo methods for showing table\n pass", "def sql_query(self, statement):\n\t\tself.engine.connect()\n\n\t\tres = self.engine.execute(statement)\n\t\theaders = res.keys()\n\t\tdata = res.fetchall()\n\n\t\tif len(data) == 0:\n\t\t\treturn False\n\n\t\ttabl...
[ "0.6598033", "0.63490975", "0.613143", "0.5917217", "0.58982813", "0.5890795", "0.5871582", "0.58477294", "0.58459234", "0.5819349", "0.5803754", "0.5757012", "0.5744232", "0.573159", "0.569132", "0.5668833", "0.5644222", "0.56372935", "0.5608198", "0.5548364", "0.55419135", ...
0.7804311
0
A view to return the Blog Page
def blog(request): return render(request, "blog/blog.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blog(request):\n # TODO: pagination for blog posts\n try:\n blogposts = LifeXBlog.objects.order_by('-date')\n # contruct meta tags\n title = 'LifeX Blog'\n description = 'LifeX blog at harshp.com'\n keywords = ['blog', 'lifeX', 'experiments', 'life', ]\n url = re...
[ "0.8153079", "0.7984823", "0.7820355", "0.76811504", "0.7666801", "0.7625174", "0.7595283", "0.75570095", "0.75570095", "0.75173724", "0.75052524", "0.74864167", "0.74538636", "0.74158317", "0.7413083", "0.73617053", "0.7352364", "0.72874475", "0.7271862", "0.72261953", "0.72...
0.81017226
1
Computes the VAE loss function. KL(N(\mu, \sigma), N(0, 1)) = \log \frac{1}{\sigma} + \frac{\sigma^2 + \mu^2}{2} \frac{1}{2}
def loss_function(self, input, recons, mu, log_var): recons_loss = F.binary_cross_entropy(recons, input) kld_loss = torch.mean(-0.5 * torch.sum(1 + log_var - mu ** 2 - log_var.exp(), dim = 1), dim = 0) loss = recons_loss + self.kl_weight * kld_loss return {'loss': loss, 'rec_loss': rec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_loss_vae(self, dim_z, mu,logsigma, _lambda=1.0 ):\n #mu, logsigma = mu_logsigma\n sigma = tf.exp(logsigma)\n sigma2 = tf.square(sigma)\n \n kl = 0.5*tf.reduce_sum( (tf.square(mu) + sigma2) - 2*logsigma, 1) - dim_z*.5\n return tf.reduce_mean( tf.maximum(_lambda, kl )...
[ "0.73999935", "0.7369475", "0.7325026", "0.70330113", "0.69927585", "0.6936097", "0.6906023", "0.67200124", "0.67169625", "0.6692288", "0.6681703", "0.6636796", "0.6632088", "0.6535589", "0.65093935", "0.65087616", "0.64606863", "0.64587104", "0.64412564", "0.6439507", "0.641...
0.5769796
84
Returns 0 (False) if the particle doesn't cross the monomer Returns t the time of crossing if it does.
def DetectChromaCollision(self, position, velocity, monomer): n = velocity d = monomer.direction m = position - monomer.from_position r = self.chromatin.captureRadius md = np.dot(m,d) nd = np.dot(n,d) dd = np.dot(d,d) nn = np.dot(n,n) mn = np.dot(m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_crossing_time(self, threshold):\n # Crossing time is defined as infinity if the curve does not drop\n # below threshold.\n crossing_time = np.inf\n # Pass over curve to find first crossing time.\n for i in range(self.n_points):\n if self.y_vals[i] < thresho...
[ "0.6425555", "0.6162357", "0.5798749", "0.56437695", "0.5641242", "0.5569565", "0.5541599", "0.54301643", "0.54019654", "0.53717375", "0.5331423", "0.5319986", "0.52946115", "0.5291462", "0.5286901", "0.52381444", "0.52374154", "0.5233122", "0.5221619", "0.5190093", "0.518184...
0.0
-1
Returns a batch normalization layer that automatically switch between train and test phases based on the tensor is_training
def batch_normalization_layer(x, is_training, scope='batch_norm', epsilon=0.001, decay=0.999): assert isinstance(is_training, (ops.Tensor, variables.Variable)) and is_training.dtype == tf.bool return tf.cond( is_training, lambda: batch_norm_layer(x=x, scope=scope, epsilon=epsilon, decay=decay, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_norm(training, updates, name):\n bn = tfkl.BatchNormalization(name=name)\n def batch_norm_layer(x):\n # This emits a warning that training is a placeholder instead of a concrete\n # bool, but seems to work anyway.\n applied = bn(x, training)\n updates.extend(bn.updates)\n return applied\...
[ "0.74003875", "0.71683556", "0.7094886", "0.67639923", "0.66454405", "0.65198696", "0.65162885", "0.6515", "0.6475469", "0.6456728", "0.63816977", "0.63369507", "0.62625384", "0.6248391", "0.6245837", "0.6224366", "0.61973625", "0.61662847", "0.61333007", "0.6131661", "0.6119...
0.7283079
1
An application for the tests.
def app(): _app = create_app(config=TestConfig) ctx = _app.test_request_context() ctx.push() yield _app ctx.pop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app():\n _app = create_app('testing')\n\n return _app", "def app():\n params = {\n 'DEBUG': False,\n 'TESTING': True,\n }\n\n _app = create_app(config_name=params)\n\n # Establish an application context before running the tests.\n ctx = _app.app_context()\n ctx.push()\n\...
[ "0.8564325", "0.8215678", "0.8113179", "0.8113179", "0.8103458", "0.7875386", "0.7875386", "0.7875386", "0.7875386", "0.7874525", "0.78432924", "0.7755346", "0.77322614", "0.76805973", "0.7666848", "0.7664101", "0.76604795", "0.7625385", "0.7570374", "0.7570374", "0.750789", ...
0.7707333
13
Return ISO code for specified country
def get_country_iso(self, place: Loc) -> str: lookup_target, modified = GeoKeys.country_normalize(place.country_name) if len(lookup_target) == 0: return '' # Try each query until we find a match - each query gets less exact query_list = [ Query(where="name = ? AN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country_code(country):\n try:\n region = pycountry.subdivisions.lookup(country).country_code\n region_two = pycountry.countries.lookup(region).alpha_3\n return region_two\n except LookupError:\n return 'XXX'", "def iso3166_country_code(country_name: str) -> str:\n if len(...
[ "0.7971127", "0.7744499", "0.7681696", "0.7662039", "0.7631773", "0.7629738", "0.74039805", "0.72186303", "0.71991533", "0.71733296", "0.7106338", "0.7084847", "0.7064889", "0.7056029", "0.7002019", "0.697596", "0.697596", "0.6973611", "0.6972746", "0.6960022", "0.6941921", ...
0.72298324
7
Funtion to edit response headers so that no cached versions can be viewed. Returns the modified response.
def responseHeadersModifier(response): # Modifying response headers response["Cache-Control"] = "no-cache, no-store, must-revalidate" response["Pragma"] = "no-cache" response["Expires"] = "0" # Returning response return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_header(response):\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0\"\n return response", "def add_header(response):\n response.headers['Cache-Control'] = 'public, max-age=0'\n return response", "def add_header(r):\n r.headers[\"Cache-Control\"] = \"no-cache, no...
[ "0.80948895", "0.78057283", "0.7724437", "0.76968324", "0.7686073", "0.7669852", "0.7669852", "0.7669852", "0.7669852", "0.7669852", "0.7669852", "0.7669852", "0.7669852", "0.7669852", "0.7669852", "0.7669852", "0.7669852", "0.7669852", "0.7669852", "0.7669852", "0.7669852", ...
0.86434793
0
convert index representation to onehot representation
def one_hot(x, n):#将索引转化为one-hot编码形式 x = np.array(x)#将x转化为数组类型 assert x.ndim == 1#assert为断言函数,如果布尔表达式的值为False,就会抛出错误 return np.eye(n)[x]#将x转化为one-hot编码形式,n为每个one-hot数组的组成个数
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot(length, index):\n result = np.zeros(length)\n result[index] = 1\n return result", "def indices_to_one_hot(data, nb_classes):\n targets = np.array(data).reshape(-1)\n return np.eye(nb_classes)[targets]", "def one_hot_encode(x):\n return np.array([[1 if j==i else 0 for j in range(...
[ "0.7942597", "0.79097795", "0.77236027", "0.76846963", "0.76497966", "0.7575393", "0.75711006", "0.75484544", "0.75451684", "0.7542133", "0.75123954", "0.74976957", "0.7495114", "0.73838514", "0.73805916", "0.73732567", "0.7361169", "0.7359601", "0.734579", "0.7330141", "0.73...
0.77637523
2
Implement a method to perform basic string compression using the counts of repeated characters. For example, the string aabcccccaaa would become a2b1c5a3, If the "compressed" string would not become smaller than the original string, your method should return the original string. You can assume the string has only upper...
def string_compression(string): # the catch here is stat using normal string append "+=" in python case # is very expensive so you should use other approach such as StringBuilder in Java # in python case we will use "".join() to simulate the string builder compressed = '' counter = 1 for i in r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress(s):\n\n # Begin Run as empty string\n r = \"\"\n l = len(s)\n\n # Check for length 0\n if l == 0:\n return \"\"\n\n # Check for length 1\n if l == 1:\n return s + \"1\"\n\n # Intialize Values\n cnt = 1\n i = 1\n\n while i < l:\n\n # Check to see if...
[ "0.8367759", "0.824936", "0.7776379", "0.77467626", "0.77385974", "0.761017", "0.7541657", "0.74441355", "0.7286486", "0.72136796", "0.7074178", "0.7004729", "0.69842476", "0.69832283", "0.6852351", "0.66524804", "0.6643488", "0.65799165", "0.65313643", "0.6512932", "0.648923...
0.77494305
3
Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column are set to 0
def zero_matrix(matrix): # we will iterate the matrix and mark all rows and columns that have at least a 0 zero_rows = set() zero_cols = set() for i in range(0, len(matrix)): for j in range(0, len(matrix[0])): if matrix[i][j] == 0: zero_rows.add(i) z...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setZeroes(self, matrix: List[List[int]]) -> None:\n # TODO A simple improvement uses O(m + n) space, but still not the best solution. Could you devise a constant space solution?\n #zero_row = []\n zero_col = []\n for row, lst in enumerate(matrix):\n if 0 not in lst:\n ...
[ "0.8406313", "0.82955176", "0.82955176", "0.82495946", "0.8194699", "0.8193648", "0.8172053", "0.81489587", "0.812844", "0.812504", "0.8116227", "0.8112843", "0.8101992", "0.80930024", "0.8082512", "0.80061287", "0.79928195", "0.7976891", "0.79385173", "0.78866726", "0.786843...
0.83101
1
Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column are set to 0
def zero_matrix_o1_space(matrix): # flag to keep track if the first row and col have zero values first_row_zero = False first_col_zero = False # check if first row has 0 for i in range(0, len(matrix)): if matrix[i][0] == 0: first_col_zero = True # check if first col has 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setZeroes(self, matrix: List[List[int]]) -> None:\n # TODO A simple improvement uses O(m + n) space, but still not the best solution. Could you devise a constant space solution?\n #zero_row = []\n zero_col = []\n for row, lst in enumerate(matrix):\n if 0 not in lst:\n ...
[ "0.84061426", "0.83087367", "0.8294913", "0.8294913", "0.82494694", "0.81935585", "0.81921655", "0.81717014", "0.81487554", "0.81278354", "0.8124422", "0.81164366", "0.8112957", "0.81018513", "0.8092836", "0.8082601", "0.8005776", "0.7992506", "0.7975691", "0.79387605", "0.78...
0.788591
20
Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, si and s2, write code to check if s2 is a rotation of si using only one call to isSubstring (e.g.,"waterbottle" is a rotation of "erbottlewat").
def string_rotation(first, second): # the trick here is to see that if you combine the first string twice # the result string s1s1 will contain all the possible rotation for the string s1 # so substring(s1s1, s2) it's the actual solution if len(first) != len(second): return False first_du...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isSubstring(s1, s2):\n return s1 in s2", "def is_substring(s1,s2):\n\tlength_1 = len(s1)\n\tlength_2 = len(s2)\n\tif (length_1 != length_2):\n\t\treturn False\n\tk = find_position(s1[0],s2)\n\tfor i in range(0,length_1):\n\t\tif (s1[i] != s2[k]):\n\t\t\treturn False\n\t\tk = k+1;\n\t\tif (k == length_1):\...
[ "0.77557546", "0.7679529", "0.7638166", "0.7325192", "0.7205222", "0.7147359", "0.7124406", "0.69980675", "0.68663496", "0.6698275", "0.6681468", "0.662121", "0.6616866", "0.6374677", "0.63713026", "0.63200647", "0.6287059", "0.6129849", "0.610572", "0.60522825", "0.6041257",...
0.70624125
7
Use `tf.parse_single_example()` to extract data from a `tf.Example` protocol buffer, and perform any additional perrecord preprocessing.
def parser(record): keys_to_features = { "colorspace": tf.FixedLenFeature(shape=(), dtype=tf.string, default_value="RGB"), "channels": tf.FixedLenFeature(shape=(), dtype=tf.int64, default_value=3), "format": tf.FixedLenFeature(shape=(), dtype=tf.string, default_value="PNG"), "filename": tf.FixedLenF...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_example(example_proto):\n \n record_dict = {\n 'context': tf.FixedLenFeature(shape=[], dtype=tf.string),\n 'context_len': tf.FixedLenFeature(shape=[], dtype=tf.string),\n 'response': tf.FixedLenFeature(shape=[], dtype=tf.string),\n 'source': tf.Fi...
[ "0.7879496", "0.7796888", "0.7759848", "0.74639523", "0.73876685", "0.73866135", "0.7365497", "0.73403597", "0.72341114", "0.7192714", "0.71637183", "0.71199095", "0.7117978", "0.70995337", "0.70756966", "0.7069341", "0.70621526", "0.70588654", "0.70286596", "0.6999931", "0.6...
0.7073564
15
Creates a convolutional layer, with optional batch normalization.
def conv(in_channels, out_channels, kernel_size, stride=2, padding=1, batch_norm=True): layers = [] conv_layer = nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, stride=stride, padding=padding, bias=False) layers.append(conv_layer) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convolutional_layer(input, filters, strides, is_training):\n x = tf.layers.conv2d(\n input,\n filters=filters,\n kernel_size=(3, 3),\n strides=strides,\n padding='same',\n activation=tf.nn.relu,\n kernel_initializer=tf.truncat...
[ "0.76681197", "0.76516026", "0.7297478", "0.7271395", "0.7191911", "0.7056119", "0.7031629", "0.70266473", "0.6983139", "0.6819768", "0.68156755", "0.6805758", "0.68049985", "0.67829245", "0.6777323", "0.6777323", "0.67766595", "0.6758401", "0.6758165", "0.67431605", "0.67424...
0.6719256
24
Applies initial weights to certain layers in a model . The weights are taken from a normal distribution with mean = 0, std dev = 0.02.
def weights_init_normal(m): # classname will be something like: # `Conv`, `BatchNorm2d`, `Linear`, etc. print("Initializing weights") classname = m.__class__.__name__ # if ('Conv' in classname) or ('Linear' in classname): # m.weight.data.normal_(0.0, 0.02) # else: # m.weight.fill...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight_init(model):\n for module in model.modules():\n if isinstance(module, nn.Conv2d) or isinstance(module, nn.Linear):\n nn.init.kaiming_normal_(module.weight)\n if module.bias is not None:\n module.bias.data.zero_()", "def weight_init(mod...
[ "0.77145195", "0.77145195", "0.7675761", "0.760798", "0.76043445", "0.760038", "0.75978786", "0.75932634", "0.7550311", "0.75439006", "0.7541036", "0.7539223", "0.753783", "0.753783", "0.7535041", "0.7527709", "0.7518001", "0.7494315", "0.7478463", "0.7469241", "0.74617016", ...
0.76775974
2
Create an iterator for this collection's contents.
def _makeIterator(self): from typhon.objects.collections.lists import listIterator return listIterator(self.objectSet.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\r\n yield from self.__collection", "def __iter__(self) -> Iterator:\n return iter(self.collection.values())", "def __iter__(self):\n\t\tcursor = self._items\n\t\twhile not cursor is None:\n\t\t\tyield cursor.data\n\t\t\tcursor=cursor.next", "def __iter__(self):\n for ...
[ "0.7479604", "0.7440421", "0.7278874", "0.7232521", "0.7206319", "0.720505", "0.7145828", "0.71304417", "0.70452684", "0.7008355", "0.7005956", "0.7005956", "0.7001524", "0.70008516", "0.6994165", "0.6957311", "0.6939344", "0.69370884", "0.6912204", "0.68577677", "0.68384326"...
0.7011918
9
Determine whether an element is in this collection.
def contains(self, needle): return needle in self.objectSet
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains__(self, element: Element):\n return element in self.get_elements()", "def contains(self, element):\n return element in self.elements", "def contains(self, element): \n return element in self.elements", "def contains(self, element):\n for e in self:\n if(e == ele...
[ "0.81974703", "0.81211543", "0.80927444", "0.79263717", "0.76326495", "0.76017433", "0.7579401", "0.75227654", "0.7463226", "0.74322015", "0.73929876", "0.7378804", "0.72919226", "0.7286567", "0.7148819", "0.7087089", "0.7066706", "0.7065974", "0.7033869", "0.7033869", "0.703...
0.66610014
57
Create a question with the given 'question_text' and published the given number of 'days' offset to now (negative for questions published in the past, positive for questions that have yet to be published).
def create_question(question_text, days): time = timezone.now() + datetime.timedelta(days=days) return Question.objects.create(question_text=question_text, pub_date=time)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_question(question_text, days):\n time_of_pub_date = timezone.now() + datetime.timedelta(days=days)\n time_of_end_date = datetime.timedelta(\n days=30) + time_of_pub_date\n return Question.objects.create(question_text=question_text, pub_date=time_of_pub_date, end_date=time_of_end_date)", ...
[ "0.81295174", "0.80259806", "0.80259806", "0.7962921", "0.7958463", "0.7909303", "0.7801103", "0.6297289", "0.61756617", "0.5971725", "0.57339656", "0.56567174", "0.5602929", "0.5577591", "0.55563116", "0.5528778", "0.55095303", "0.54944307", "0.54934156", "0.5455967", "0.544...
0.79531616
8
was_published_recently() returns False for questions whose pub_date is in the future.
def test_was_published_recently_with_future_question(self): time = timezone.now() + datetime.timedelta(days=30) future_question = Question(pub_date=time) self.assertIs(future_question.was_published_recently(), False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def was_published_recently(self):\n now = timezone.now()\n return now - datetime.timedelta(days=1) <= self.pub_date <= now", "def was_published_recently(self):\n now = timezone.now()\n return now - datetime.timedelta(days=1) <= self.pub_date <= now", "def test_was_published_recently...
[ "0.87720805", "0.87720805", "0.85350966", "0.8440619", "0.84323686", "0.8415921", "0.84035045", "0.8403317", "0.8397786", "0.83945", "0.8389539", "0.8380137", "0.83719283", "0.83719194", "0.8357887", "0.8333119", "0.8331787", "0.8324863", "0.831577", "0.831577", "0.828532", ...
0.8411833
8
was_published_recently() returns False for questions whose pub_date is older than one day.
def test_was_published_recently_with_old_question(self): time = timezone.now() - datetime.timedelta(days=1, seconds=1) old_question = Question(pub_date=time) self.assertIs(old_question.was_published_recently(), False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def was_published_recently(self):\n now = timezone.now()\n return now - datetime.timedelta(days=1) <= self.pub_date <= now", "def was_published_recently(self):\n now = timezone.now()\n return now - datetime.timedelta(days=1) <= self.pub_date <= now", "def was_published_recently(self...
[ "0.8746411", "0.8746411", "0.8332309", "0.82866246", "0.8260725", "0.8251758", "0.8251409", "0.8236437", "0.8218188", "0.8207908", "0.8199159", "0.8199159", "0.8167667", "0.815362", "0.81395274", "0.81342983", "0.8127158", "0.8125538", "0.8125538", "0.8125538", "0.8087785", ...
0.8123918
20
was_published_recently() returns True for questions whose pub_date is within the last day.
def test_was_published_recently_with_recent_question(self): time = timezone.now() \ - datetime.timedelta(hours=23, minutes=59, seconds=59) recent_question = Question(pub_date=time) self.assertIs(recent_question.was_published_recently(), True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def was_published_recently(self):\n now = timezone.now()\n return now - datetime.timedelta(days=1) <= self.pub_date <= now", "def was_published_recently(self):\n now = timezone.now()\n return now - datetime.timedelta(days=1) <= self.pub_date <= now", "def was_published_recently(self...
[ "0.87522864", "0.87522864", "0.8353324", "0.8257336", "0.81841487", "0.8170885", "0.8138643", "0.8138643", "0.8078239", "0.80610174", "0.80533206", "0.80337113", "0.8021213", "0.80043614", "0.7999724", "0.79857576", "0.79526764", "0.79507333", "0.79275423", "0.79275423", "0.7...
0.8157147
6
Question with a pub_date in the past are displayed on the index page.
def test_past_question(self): past_question = create_question(question_text="Past question.", days=-30) create_choice(past_question, 'Choice text.') response = self.client.get(reverse('polls:index')) self.assertQuerysetEqual( response.context['latest_question_list'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_index_view_with_a_past_question(self):\n create_question(question_text = \"Past question.\", days = -30)\n response = self.client.get(reverse('polls:index'))\n self.assertQuerysetEqual(response.context['latest_question_list'], ['<Question: Past question.>'])", "def test_index_view_w...
[ "0.7101182", "0.69957656", "0.6912576", "0.6881224", "0.6850522", "0.6769827", "0.6688635", "0.6682953", "0.6614703", "0.66035604", "0.65113795", "0.6505518", "0.6498966", "0.649663", "0.64836913", "0.64632297", "0.6463088", "0.6463088", "0.6454826", "0.6433479", "0.6433479",...
0.6133196
72
Questions with a pub_date in the future aren't displayed on the index page.
def test_future_question(self): future_question = create_question(question_text="Future question.", days=30) create_choice(future_question, choice_text='Choice text.') response = self.client.get(reverse('polls:index')) self.assertContains(response, "No polls are available.") self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_published_with_future_question(self):\n time = timezone.now() + datetime.timedelta(days=30)\n future_question = Question(pub_date=time)\n self.assertFalse(future_question.is_published())", "def test_index_view_with_a_future_question(self):\n create_question(question_text=\...
[ "0.7139376", "0.6976401", "0.68437654", "0.68400615", "0.68353647", "0.6830868", "0.67962044", "0.6776414", "0.6773052", "0.6771583", "0.6771583", "0.6767086", "0.67542255", "0.67524177", "0.673967", "0.6731869", "0.6728744", "0.6728744", "0.6720216", "0.6717914", "0.6713085"...
0.6338848
77
Even if both past and future questions exist, only past questions are displayed.
def test_future_question_and_past_question(self): past_question = create_question(question_text="Past question.", days=-30) create_choice(past_question, 'Past question choice.') future_question = create_question(question_text="Future question.", days=30) create_choice(future_question, 'F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_future_question_and_past_question(self):\n create_question(question_text=\"Past question.\", days=-30)\n create_question(question_text=\"Future question.\", days=30)\n response = self.client.get(reverse(\"polls:index\"))\n self.assertQuerysetEqual(\n response.context...
[ "0.75174665", "0.7515785", "0.75083977", "0.74557954", "0.74335575", "0.7364604", "0.73484737", "0.73281544", "0.73064107", "0.72896", "0.72837555", "0.7263921", "0.72619194", "0.7258031", "0.72338164", "0.7230826", "0.72262144", "0.72188145", "0.72010666", "0.71973723", "0.7...
0.74465305
4
The detail view of a question with a pub_date in the future returns a 404 not found.
def test_future_question(self): future_question = create_question(question_text='Future question.', days=5) create_choice(future_question, 'Choice text.') url = reverse('polls:detail', args=(future_question.id,)) response = self.client.get(url) self.assertEqual(response.status_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_detail_view_with_a_future_question(self):\n future_question = create_question(question_text ='Future question.', days = 5)\n response = self.client.get(reverse('polls:detail', args=(future_question.id,)))\n self.assertEqual(response.status_code, 404)", "def test_detail_view_with_a_p...
[ "0.724679", "0.68078476", "0.6728737", "0.67270404", "0.6707231", "0.6698708", "0.66060907", "0.6527195", "0.6494938", "0.649013", "0.6427367", "0.6424404", "0.64044845", "0.63912326", "0.63638616", "0.63371944", "0.631283", "0.62520695", "0.6208631", "0.61889404", "0.6170408...
0.6104218
27
The detail view of a question with a pub_date in the past displays the question's text.
def test_past_question(self): past_question = create_question(question_text='Past Question.', days=-5) create_choice(past_question, 'Choice text') url = reverse('polls:detail', args=(past_question.id,)) response = self.client.get(url) self.assertContains(response, past_question.q...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_detail_view_with_a_past_question(self):\n past_question = create_question(question_text =\"Past question.\", days = -5)\n response = self.client.get(reverse('polls:detail', args=(past_question.id,)))\n self.assertContains(response, past_question.question_text, status_code = 200)", "...
[ "0.6688488", "0.6360751", "0.6330101", "0.62954795", "0.607839", "0.60420316", "0.6041928", "0.60407066", "0.6039859", "0.60126466", "0.59804463", "0.5971641", "0.594005", "0.589977", "0.58318293", "0.58313435", "0.5824982", "0.5818974", "0.58117664", "0.5794213", "0.57463986...
0.5757425
20
The detail view of a question with a pub_date in the past but without any choices returns a 404 not found.
def test_past_question_without_choices(self): past_question = create_question(question_text='Past Question.', days=-5) url = reverse('polls:detail', args=(past_question.id,)) response = self.client.get(url) self.assertEqual(response.status_code, 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_detail_view_with_a_past_question(self):\n past_question = create_question(question_text =\"Past question.\", days = -5)\n response = self.client.get(reverse('polls:detail', args=(past_question.id,)))\n self.assertContains(response, past_question.question_text, status_code = 200)", "...
[ "0.6975173", "0.6959609", "0.69123846", "0.67941856", "0.66410697", "0.65093386", "0.6504083", "0.6446227", "0.642949", "0.6428081", "0.64212054", "0.6418487", "0.64175224", "0.64029586", "0.6390455", "0.63880146", "0.6378096", "0.636628", "0.6364848", "0.6360302", "0.635401"...
0.7017974
0
The results view of a question with a pub_date in the future returns a 404 not found.
def test_future_question(self): future_question = create_question(question_text='Future question.', days=5) create_choice(future_question, 'Choice text.') url = reverse('polls:results', args=(future_question.id,)) response = self.client.get(url) self.assertEqual(response.status_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_index_view_with_a_future_question(self):\n create_question(question_text=\"Future question.\", days = 30)\n response = self.client.get(reverse('polls:index'))\n self.assertContains(response, 'No polls are available.', status_code = 200)\n self.assertQuerysetEqual(response.conte...
[ "0.6731462", "0.6730834", "0.6609141", "0.6564448", "0.64857596", "0.64488655", "0.6443733", "0.643012", "0.64293456", "0.6390525", "0.6380984", "0.63797534", "0.63014066", "0.61830276", "0.61390376", "0.6125834", "0.6096988", "0.6066507", "0.60634804", "0.6061336", "0.605900...
0.62162143
13
The results view of a question with a pub_date in the past returns the question vote results
def test_past_question(self): past_question = create_question(question_text='Past question.', days=-5) create_choice(past_question, 'Choice text') url = reverse('polls:results', args=(past_question.id,)) response = self.client.get(url) self.assertContains(response, past_question....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_index_view_with_two_past_questions(self):\n create_question(question_text=\"Past question 1.\", days = -30)\n create_question(question_text=\"Past question 2.\", days = -5)\n response = self.client.get(reverse('polls:index'))\n self.assertQuerysetEqual(\n response.co...
[ "0.620585", "0.61524236", "0.6141864", "0.60251427", "0.6010779", "0.6007302", "0.5993484", "0.5987173", "0.59735775", "0.5972589", "0.5972589", "0.5964405", "0.5964405", "0.5957632", "0.59511673", "0.59405434", "0.59400916", "0.5937665", "0.5937665", "0.5923592", "0.586036",...
0.0
-1
The results view of a question with a pub_date in the past but without any choices returns a 404 not found.
def test_past_question_without_choices(self): past_question = create_question(question_text='Past Question.', days=-5) url = reverse('polls:results', args=(past_question.id,)) response = self.client.get(url) self.assertEqual(response.status_code, 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_past_question_without_choices(self):\n past_question = create_question(question_text='Past Question.', days=-5)\n url = reverse('polls:detail', args=(past_question.id,))\n response = self.client.get(url)\n self.assertEqual(response.status_code, 404)", "def test_index_view_wit...
[ "0.69213694", "0.6797306", "0.667772", "0.66164404", "0.65499914", "0.65119815", "0.64898974", "0.6465741", "0.6457061", "0.6426499", "0.63917434", "0.636546", "0.6363808", "0.6325544", "0.63200164", "0.6287912", "0.62866646", "0.6264282", "0.6253252", "0.6245788", "0.6233679...
0.7173593
0
Test constructor raises if Hue beyond range[0, 360]
def test_raises_hue_wrong_value(self): with self.assertRaises(ValueError): Color(Color.HLS, -2, 0, 0) Color(Color.HLS, 361, 0, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\n delta=18.0):\n\n super(RandomHue, self).__init__()\n assert delta >= 0.0 and delta <= 360.0\n self.delta = delta", "def test_raises_rgb_beyond_range(self):\n with self.assertRaises(ValueError):\n Color(Color.RGB, 0, 0, -1)\n C...
[ "0.7076514", "0.60783947", "0.6061078", "0.59873784", "0.5955075", "0.59361523", "0.58800745", "0.5797263", "0.57725567", "0.57208323", "0.57170683", "0.5704754", "0.5685546", "0.56621915", "0.56518465", "0.5635064", "0.56034404", "0.55742043", "0.5541192", "0.55332863", "0.5...
0.67223066
1
This function is twice the conditional logposterior density of phi, and is the optimality criterion.
def f(x): tmp = phi ** 2 + variance + math.exp(x) a = math.exp(x) * (difference_squared - tmp) / (2 * tmp ** 2) b = (x - alpha) / (TAU ** 2) return a - b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def poisson_log_posterior(y, f, cK_inv, f0=0.0, \n grad=False, hess=False, \n hessp=False, p=None):\n #if bias term is included, shift fs\n f = f + f0 #\n assert len(f)==cK_inv.shape[0], \"log_like f doesn't match covariance mat\"\n if grad: \n ...
[ "0.6274148", "0.6210305", "0.6018601", "0.6014697", "0.5984968", "0.59552187", "0.5952869", "0.59106094", "0.59019476", "0.5887951", "0.5864189", "0.5864189", "0.58208543", "0.57989395", "0.5747845", "0.5738641", "0.5734008", "0.57284385", "0.5719469", "0.5714538", "0.5709473...
0.0
-1
Returns if there is any word in the trie that starts with the given prefix.
def startsWith(self, prefix): node = self.root for c in prefix: if c not in node.childs: return False node = node.childs[c] return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startsWith(self, prefix: str) -> bool:\n node = self.trie\n for w in prefix:\n if w not in node:\n return False\n node = node[w]\n \n return True", "def startsWith(self, prefix):\n root = self.trie\n for c in prefix:\n ...
[ "0.84252757", "0.8373269", "0.83657616", "0.8358083", "0.8349312", "0.8286922", "0.8126382", "0.8102869", "0.8027282", "0.7957613", "0.7937967", "0.7937402", "0.79320663", "0.79283863", "0.7882381", "0.7868962", "0.78641963", "0.7852686", "0.7843421", "0.78312224", "0.7830627...
0.7521376
43
Play the environment using a trained agent This function opens a (graphical) window that will play a trained agent. The function will try to retrieve the model saved in the model_dir with filename formatted to contain the associated env_name. If the model is not found, then the function will first call the train functi...
def play(self): env = self.env.unwrapped state = env.reset() model = self.master_model model_path = os.path.join(self.model_dir, 'model_{}.h5'.format(self.env_name)) if not os.path.exists(model_path): logger.info('A3CMaster: No model found at {}, starting fresh traini...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play(self):\n env = self.env.unwrapped\n state = env.reset()\n model = self.master_model\n model_path = os.path.join(self.model_dir, 'model_{}.h5'.format(self.env_name))\n if not os.path.exists(model_path):\n logger.info('A3CMaster: No model found at {}, starting f...
[ "0.6532755", "0.61711556", "0.6066056", "0.59697336", "0.5928794", "0.5835716", "0.57085735", "0.5699204", "0.5596758", "0.5587028", "0.5567378", "0.551776", "0.5512715", "0.54852885", "0.5476315", "0.546352", "0.5446989", "0.5444137", "0.54438305", "0.544265", "0.54400617", ...
0.6626448
0
Plot training statistics This function plot the training statistics like the steps, rewards, discounted_rewards, and loss in each of the training episode.
def plot_training_statistics(self, training_statistics=None): training_statistics = A3C_Worker.global_shared_training_stats if training_statistics is None \ else training_statistics all_episodes = [] all_steps = [] all_rewards = [] all_discounted_rewards = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_training_statistics(self, training_statistics = None):\n\n steps = self.trainingStats_steps_in_each_episode if training_statistics is None else training_statistics[0]\n rewards = self.trainingStats_rewards_in_each_episode if training_statistics is None else training_statistics[1]\n di...
[ "0.8022187", "0.78751254", "0.76791984", "0.74968076", "0.74571985", "0.74548316", "0.728948", "0.7285729", "0.7244875", "0.72308284", "0.72139347", "0.7209477", "0.71941364", "0.71168697", "0.7111128", "0.7052476", "0.70342976", "0.6990056", "0.69842386", "0.69075406", "0.68...
0.8077866
0
return a list of book selected by ISBN
def get_book_isbn(self, isbn: str) -> (tuple, list): sql_expr = \ ''' SELECT * FROM Books WHERE isbn = '%s'; ''' % (isbn) sql_result = self._my_connect.execute_sql_read(sql_expr) return sql_result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getByIsbn(isbn):\n isbn = isbn.strip()\n return Books.query.filter(Books.isbn==isbn)", "def query_book_info(isbn):\n def match_isbn(book):\n \"\"\"Book Identifiers: (key,val)\n [('google_id', 'dwSfGQAACAAJ'),\n ('ISBN', '0132350882'),\n ('ISBN', '97801...
[ "0.766866", "0.71686393", "0.71331674", "0.683524", "0.6807876", "0.642463", "0.63651884", "0.6332885", "0.6332179", "0.6290492", "0.62558687", "0.62407196", "0.621365", "0.6172118", "0.6170331", "0.6146196", "0.61376035", "0.61148566", "0.6083662", "0.60645086", "0.6052909",...
0.73990864
1
return a list of book selected by name
def get_book_name(self, name: str) -> (tuple, list): sql_expr = \ ''' SELECT * FROM Books WHERE name = '%s'; ''' % (name) sql_result = self._my_connect.execute_sql_read(sql_expr) return sql_result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_book_name_part(self, name: str) -> (tuple, list):\n sql_expr = \\\n '''\n SELECT * FROM Books WHERE name = '%{0}%';\n '''.format(name)\n sql_result = self._my_connect.execute_sql_read(sql_expr)\n return sql_result", "def select(books):\n headers = ...
[ "0.65293795", "0.6409212", "0.61814815", "0.6111567", "0.60725695", "0.60350966", "0.6028693", "0.6027788", "0.60202926", "0.59850204", "0.59679556", "0.5858089", "0.58322096", "0.58060193", "0.5783784", "0.57639647", "0.5750172", "0.5744428", "0.5740984", "0.5725584", "0.571...
0.6681894
0
Stacks frames together across feature dim input is batch_size, feature_dim, num_frames output is batch_size, feature_dimframe_splicing, num_frames
def splice_frames(x, frame_splicing): seq = [x] for n in range(1, frame_splicing): tmp = torch.zeros_like(x) tmp[:, :, :-n] = x[:, :, n:] seq.append(tmp) return torch.cat(seq, dim=1)[:, :, ::frame_splicing]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature_stacker(x, context_frames=11):\n return np.column_stack([\n x[np.minimum(len(x) - 1, np.maximum(0, np.arange(len(x), dtype=np.int) + d))]\n for d in range(-context_frames, context_frames + 1)\n ])", "def preprocess_frames(dataset_info, example, jpeg='False'):\n frames = tf.conc...
[ "0.66249883", "0.6135116", "0.6132439", "0.61073554", "0.59943134", "0.5957993", "0.59128094", "0.58890957", "0.5876653", "0.5860163", "0.5842482", "0.5800917", "0.5794468", "0.57660174", "0.5708448", "0.57060045", "0.56731725", "0.5664409", "0.56299245", "0.5622051", "0.5578...
0.65500414
1
Get the date string for the following Friday.
def target_date(self): value = self.settings.get('targetDate') if not value: today = datetime.date.today() # If today is a Friday, we skip to next Friday if datetime.datetime.today().weekday() == 4: friday = str(today + datetime.timedelta((3-today.week...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def this_friday(d):\n if d.weekday() == 4:\n return d\n if d.weekday() < 4:\n return d + td(days=4 - d.weekday())\n return d + td(days=11 - d.weekday())", "def last_friday(d):\n if d.weekday() == 4:\n return d-td(days=7)\n return d - td(days=d.weekday() + 3)", "def dow (self...
[ "0.7875018", "0.7248198", "0.6565478", "0.6525712", "0.64265376", "0.64007825", "0.6376668", "0.63762176", "0.6328386", "0.6301963", "0.62834173", "0.62804765", "0.61202425", "0.6027242", "0.59661055", "0.59520495", "0.5925132", "0.59151846", "0.5903422", "0.5872217", "0.5863...
0.69354403
2
Returns a tuple of the child nodes.
def children(self): raise NotImplementedError('abstract') # pragma: no cover
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children(self):\n return tuple(self._children.itervalues())", "def children(self):\n return tuple(self.__children)", "def get_child_nodes(node):\r\n return list(iter_child_nodes(node))", "def to_tuple(self) -> tuple:\n\n if self.child:\n return (self.name, ) + self.chil...
[ "0.7999174", "0.79017264", "0.7337427", "0.69581574", "0.688569", "0.679539", "0.6769186", "0.67292017", "0.6568271", "0.65454525", "0.6526647", "0.6493934", "0.64462537", "0.64277744", "0.64277744", "0.64131516", "0.6411206", "0.64107096", "0.6367427", "0.6367427", "0.636529...
0.57358485
91
Returns a copy of this but with the given children.
def with_children(self, children): raise NotImplementedError('abstract') # pragma: no cover
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone(self):\n return self.with_children([child.clone() for child in self.children()])", "def set_children(self, children):\n self._update_children(children)\n return self", "def clone(self):\n copy = self.__class__(self.name, content=self.content,\n attributes=di...
[ "0.76198846", "0.713896", "0.7101554", "0.69652426", "0.68767846", "0.65531045", "0.65408224", "0.6533542", "0.6459414", "0.645436", "0.64404416", "0.6295213", "0.62773263", "0.62699336", "0.6253195", "0.6178166", "0.61140984", "0.61140984", "0.6099096", "0.60878897", "0.6087...
0.6991793
3
Returns the result of evaluating the expression in env.
def evaluate(self, env): raise NotImplementedError('abstract') # pragma: no cover
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, expression):\n response = self.session.send('Runtime.evaluate', expression=expression)\n if 'value' in response['result']:\n return response['result']['value']\n else:\n return response['result']", "def _evaluate(self, expression):\n\t\tresult = self....
[ "0.7141905", "0.68223137", "0.67871594", "0.67294437", "0.67031115", "0.6564847", "0.65091765", "0.6496503", "0.6496503", "0.6440222", "0.64240843", "0.639134", "0.63876903", "0.63805467", "0.62721163", "0.6236952", "0.62155807", "0.62146187", "0.6188181", "0.6185185", "0.614...
0.70792764
1
True if there are uncomsumed tokens remaining.
def is_empty(self): return not self.tokens
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_more_tokens(self):\r\n return self.__token_counter < len(self.__tokens_list)-1", "def has_more_tokens(self):\n return len(self.tokens) > 0", "def unblinded_token_count(self) -> None:\n self.case.assertThat(\n self.store.count_unblinded_tokens(),\n Equals(self....
[ "0.7467826", "0.74132854", "0.71323055", "0.7049206", "0.68847215", "0.67671067", "0.67671067", "0.67671067", "0.6616934", "0.65420204", "0.64686716", "0.6454046", "0.6432969", "0.6429786", "0.64005375", "0.6394263", "0.63810307", "0.6373162", "0.63048726", "0.6302726", "0.61...
0.72480047
3
True if the token at the front of the queue is ignorable. The default implementation returns False for nonempty tokens, but may be overridden.
def is_ignorable(self): return self.peek() == ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n if self.front:\n return False\n return True", "def is_empty(queue):\n return queue.front == None", "def is_empty(self):\n if self.front == None:\n return True\n else:\n return False", "def is_empty(self):\n\n if self.front == None...
[ "0.6995158", "0.6857475", "0.67946094", "0.67642725", "0.66138595", "0.65762997", "0.65748227", "0.65641224", "0.6561722", "0.6541191", "0.6515034", "0.65090466", "0.64949405", "0.64949405", "0.64727", "0.64727", "0.64727", "0.64727", "0.64727", "0.64727", "0.64727", "0.647...
0.6964554
1
The location of the token cursor.
def loc_at(self): return Loc(self.loc.src, self.line)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location(self):\n if not hasattr(self, \"_loc\"):\n self._loc = conf.lib.clang_getCursorLocation(self)\n\n return self._loc", "def token_loc(self) -> Location:\n return self.token.location", "def location(self):\n return conf.lib.clang_getTokenLocation(self._tu, self)...
[ "0.79510987", "0.77184415", "0.75751156", "0.7461948", "0.7317492", "0.73074204", "0.7182377", "0.7033804", "0.70295995", "0.6928937", "0.6928937", "0.69248337", "0.6876772", "0.68618506", "0.68552065", "0.684191", "0.684191", "0.6828324", "0.68030477", "0.67742497", "0.67143...
0.6496304
23
Advances the cursor past the current token.
def consume(self, n_tokens=1): line = self.line for consumed in self.tokens[:n_tokens]: pos = -1 while True: pos = consumed.find('\n', pos+1) if pos < 0: break line += 1 self.line, self.tokens = line, sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def advance(self):\n self.pos += 1\n if self.pos >= len(self.tokens):\n self.current_token = None # Indicates end of input\n else:\n self.current_token = self.tokens[self.pos]", "def advance(self):\r\n try:\r\n self.current_token = next(self.tokens)\r...
[ "0.8465147", "0.8426641", "0.8352985", "0.83473384", "0.7975128", "0.78708667", "0.7673141", "0.7639669", "0.7639669", "0.76094836", "0.751511", "0.71934325", "0.71934325", "0.71934325", "0.71647584", "0.6860675", "0.68540096", "0.683221", "0.68316615", "0.6813979", "0.681116...
0.0
-1
NoneType > NoneType Test incorrect username or password in login form.
def test_incorrect_login(self): # test incorrect username self.incorrect_login("", "password") # test incorrect password self.incorrect_login("admin", "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_login_failed(self):\r\n self.F.UserFactory.create(username=\"test\", password=\"sekrit\")\r\n\r\n form = self.get().forms[\"loginform\"]\r\n form[\"username\"] = \"test\"\r\n form[\"password\"] = \"blah\"\r\n res = form.submit(status=200)\r\n\r\n res.mustcontain(\...
[ "0.7973983", "0.7862501", "0.7842008", "0.7778106", "0.7772611", "0.7693851", "0.76700836", "0.7642858", "0.76211977", "0.7611638", "0.7603932", "0.75976634", "0.7588401", "0.7578364", "0.75396", "0.75303346", "0.7503144", "0.7473993", "0.74694705", "0.74607736", "0.74331826"...
0.83727604
0
Takes in a number and returns a list of exponents in binary
def binlist(x): L=[] while x>0: a=int(log(x)/log(2)) L.append(a) x-=2**a return L
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_exponentsof2(number: int) -> list:\n\t\tnum = Factor.get_int2list(number)\n\t\tnum.reverse()\n\t\treturn [i for i in range(len(num)) if num[i] == '1']", "def power_list(numbers):\n return [n**i for i, n in enumerate(numbers)]", "def get_power(number: int) -> set:\n\t\tn = list(bin(number)[2:])\n\t\t...
[ "0.76944286", "0.7470982", "0.73858565", "0.73488355", "0.7093647", "0.6899146", "0.67535853", "0.6725903", "0.6700814", "0.66961926", "0.6655891", "0.6655539", "0.6632921", "0.648832", "0.6413211", "0.6413119", "0.6382942", "0.63355076", "0.6254261", "0.62368417", "0.6147179...
0.65312713
13
Ensure that role Admin does have update permissions for Regions.
def test_update_regions__access(self) -> None: self.regions.visit() assert bool(self.regions.fab_button) is True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_permission(self):\n try:\n rol_a_editar = self.get_object()\n roles_usuario = RolAdministrativo.objects.filter(user=self.request.user)\n if(rol_a_editar in roles_usuario or rol_a_editar.name == ROL_ADMINISTRADOR_NOMBRE):\n return False\n except ...
[ "0.5910742", "0.57970154", "0.57201284", "0.5687901", "0.568766", "0.56633973", "0.56616366", "0.56426644", "0.5628768", "0.5628768", "0.5628768", "0.5628768", "0.56274825", "0.5627445", "0.5626712", "0.559379", "0.55574226", "0.5544352", "0.5541055", "0.5536293", "0.5526377"...
0.5241192
55
get both conv and bn in a single run.
def get_conv_bn(self, name, bottom, pretrained=False, relu=(False, True), bias=False, scale=False, momentum=0.9997, is_training=True, strides=(1, 1, 1, 1), k_size=(1, 1), num_outputs=1, atrous=False): bottom = self.get_conv(name, bottom, pretrained, relu[0], bias, strides, k_size, num_outp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def efficient_conv_bn_eval_forward(bn: nn.modules.batchnorm._BatchNorm,\n conv: nn.modules.conv._ConvNd,\n x: torch.Tensor):\n # These lines of code are designed to deal with various cases\n # like bn without affine transform, and conv witho...
[ "0.64855576", "0.6471645", "0.64486724", "0.60441256", "0.6031434", "0.60253733", "0.5881226", "0.5854428", "0.58519685", "0.584533", "0.5776075", "0.5774416", "0.5718936", "0.5697736", "0.56904876", "0.5683241", "0.5683241", "0.56425226", "0.5598825", "0.55895615", "0.555414...
0.645876
2