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
Check whether the given date format is match to YYYYMMDD.
def validate_date(str_date: str) -> datetime or None: try: # global entered_date entered_date = datetime.strptime(str_date, date_format) num_of_days = (datetime.now() - entered_date).days if num_of_days > 60: print('cannot display more than 60 days history') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verifying_date_format(input_date):\n\timport datetime\n\n\tinput_date = input_date\n\n\ttry:\n\t\tyear = int(input_date[:4])\n\t\tmonth = int(input_date[5:7])\n\t\tday = int(input_date[-2:])\n\t\tconverted_date = str(datetime.date(year,month,day))\n\t\tcorrect_date = True\n\texcept ValueError:\n\t\tcorrect_dat...
[ "0.7639165", "0.75451237", "0.7296419", "0.7258855", "0.7246465", "0.71782565", "0.71676505", "0.7139564", "0.704037", "0.7032708", "0.6990744", "0.69826174", "0.698097", "0.6958256", "0.6948986", "0.68833303", "0.68833303", "0.6847544", "0.6814962", "0.68123454", "0.6766003"...
0.0
-1
Convert str into int and check the validations.
def validate_day_count(count: str) -> int or None: try: int_count = int(count) if int_count > 59 or int_count < 0: print('valid day count should be in 0-59') return None return int_count except ValueError as e: print('enter valid integer upto 59') exce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_int(self, str):\n try:\n return int(str)\n except ValueError:\n return 0", "def convertToInt(str):\n res = 0\n if str:\n try:\n res = int(str)\n except:\n pass\n return res", "def convert_str_to_int(value):\n\n pass",...
[ "0.7827486", "0.7354839", "0.72817874", "0.72270954", "0.72058326", "0.72058326", "0.71933293", "0.71684265", "0.7164451", "0.7155244", "0.7148742", "0.712652", "0.71039224", "0.70925766", "0.70678777", "0.7063525", "0.70476806", "0.70476806", "0.7035887", "0.70328367", "0.70...
0.0
-1
Test that start_date is respected.
def test_start_date(trigger: CalendarIntervalTrigger, timezone: DstTzInfo): now = timezone.localize(datetime(2016, 1, 15)) expected = timezone.localize(datetime(2016, 3, 5, 3, 0, 8)) assert trigger.get_next_fire_time(None, now) == expected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_start_date_validator(self):\n invalid_date = 123\n result = start_date_validator(start_date=invalid_date)\n self.assertFalse(result)\n\n invalid_date = '12323fd'\n result = start_date_validator(start_date=invalid_date)\n self.assertFalse(result)\n\n test_da...
[ "0.7663912", "0.7292256", "0.7161526", "0.69298196", "0.6893634", "0.68486494", "0.67848366", "0.6732364", "0.6720931", "0.6716177", "0.6716177", "0.6716177", "0.6716177", "0.6716177", "0.6716177", "0.6716177", "0.6707083", "0.6664802", "0.66504335", "0.66369754", "0.6619382"...
0.6284654
50
Test that end_date is respected.
def test_end_date(trigger: CalendarIntervalTrigger, timezone: DstTzInfo): now = timezone.localize(datetime(2020, 12, 31)) previous = timezone.localize(datetime(2020, 12, 25)) assert trigger.get_next_fire_time(now, previous) is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_end_date_validator(self):\n invalid_date = {'end_date': 123,\n 'start_date': '2019-02-12'}\n result = end_date_validator(**invalid_date)\n self.assertFalse(result)\n\n invalid_date = {'end_date': '2019-01-12',\n 'start_date': '2019-...
[ "0.81905854", "0.7773628", "0.73433274", "0.72962487", "0.72471", "0.7173273", "0.7141011", "0.70901483", "0.7080094", "0.7024083", "0.69922376", "0.6980188", "0.6978096", "0.6948171", "0.6944271", "0.6944271", "0.6944271", "0.6944271", "0.6944271", "0.6944271", "0.6944271", ...
0.69388515
22
Test that if the designated time does not exist on a day due to a forward DST shift, the day is skipped entirely.
def test_missing_time(timezone: DstTzInfo): trigger = CalendarIntervalTrigger(days=1, hour=2, minute=30) now = timezone.localize(datetime(2016, 3, 27)) expected = timezone.localize(datetime(2016, 3, 28, 2, 30)) assert trigger.get_next_fire_time(None, now) == expected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def only_daytime_overpasses(self, sun):\n observer_on_the_ground = ephem.Observer()\n observer_on_the_ground.lat = np.radians(self.lat)\n observer_on_the_ground.long = np.radians(self.long)\n observer_on_the_ground.date = self.datetime\n\n \"\"\"\n Improvment from\n ...
[ "0.6633574", "0.64754385", "0.64056766", "0.6371326", "0.6371326", "0.6350903", "0.62029016", "0.6139463", "0.6099243", "0.60043246", "0.59857625", "0.5951042", "0.59296715", "0.59001905", "0.5899844", "0.5885312", "0.5883733", "0.5863177", "0.586095", "0.58582187", "0.583321...
0.6521377
1
Returns markers. If markers not found returns None. Reads attribute self._markers_(system), where system is given in the arguments.
def getMarkers(self, system, gl=False): # make attribute name for this case name = '_markers_' + str(system) if gl: name = name + '_gl' # get attribute value try: result = getattr(self, name) except AttributeError: result = N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMarkers1(self):\n return self.getMarkers(system=1)", "def return_markers(self):\n markers = []\n return markers", "def getMarkers2(self):\n return self.getMarkers(system=2)", "def getMarkers2Gl(self):\n return self.getMarkers(system=2, gl=True)", "def get_markers(s...
[ "0.7263846", "0.7122764", "0.7119469", "0.69130737", "0.6589499", "0.6324581", "0.6293317", "0.58095634", "0.5803297", "0.5686172", "0.5686172", "0.5686172", "0.5541219", "0.5520586", "0.53976434", "0.5341815", "0.53289765", "0.5181241", "0.51508254", "0.5021874", "0.5020439"...
0.7653378
0
Solves for x in the minimization of ||xA y|| using linear regression.
def LeastSquaresProjection(A, y, eps=1e-10): m, n = A.shape l, k = y.shape if l == 1 and k == n: # find a solution for x*A = y (x, y are row vectors) return LinearRegression._LeastSquaresProjection(A, y, eps) elif k == 1 and l == m: # find a solution for A*x = y (x, y are col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def least_square_regression(self, x, y, var):\n # Count the number of given x values. \n n = len(x)\n \n #Find XY, X2 for the given values.\n def xy_x2(x, y):\n \n xx = [i ** 2 for i, j in zip(x, y)]\n xy = [i * j for i, j in zip(x, y)]\n r...
[ "0.7070138", "0.69220126", "0.68612623", "0.6853189", "0.6842073", "0.6814304", "0.6793603", "0.6689697", "0.665287", "0.6642366", "0.66332895", "0.6592991", "0.6582612", "0.6555362", "0.654246", "0.6523429", "0.6498952", "0.6486915", "0.6451687", "0.64394736", "0.64075273", ...
0.0
-1
Rotates the atoms in the cell around a given point in space by an axis parallel to z axis
def rotate(self, angle, pivot = np.array([0,0,0])): rotMatrix = np.array([[np.cos(angle), -np.sin(angle), 0], \ [np.sin(angle), np.cos(angle), 0],[0, 0, 1]]) self.translate(-pivot) for atom in self.atoms: atom.coord = np.dot(rotMatrix, atom.coord) self.trans...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_by(self, x, y, z, local=True):\n x, y, z = [v * 0.0174533 for v in [x, y, z]]\n space = OpenMaya.MSpace.kObject if local else OpenMaya.MSpace.kWorld\n self.transform_matrix.rotateBy(OpenMaya.MEulerRotation(x, y, z), space)", "def rotateZ(self, angle, point_3D):\n\t\trad = angle * ...
[ "0.68790597", "0.670871", "0.6656477", "0.6649968", "0.6497977", "0.6489067", "0.64746946", "0.6398415", "0.63817626", "0.63687176", "0.63620937", "0.63360554", "0.6319267", "0.629909", "0.62862366", "0.62848836", "0.6271628", "0.6261666", "0.62437195", "0.6205576", "0.619274...
0.64994663
4
Add data to the database that are available for all module tests. Comps and countries need to exist in order for teams to be created
def django_db_setup(django_db_setup, django_db_blocker): with django_db_blocker.unblock(): test_source, created = games.models.Source.objects.get_or_create(name=games.naming.test_source_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_data(self):\n # Make a connexion with a mock database\n self.generate_template()\n self.generate_workspace()\n self.generate_data_collection()", "def setUpTestData(cls):\n TestDatabase.create()", "def setUpTestData(cls):\n TestDatabase.create()", "def setU...
[ "0.697853", "0.65798414", "0.65798414", "0.64959836", "0.642575", "0.6274345", "0.62405324", "0.62381625", "0.6223928", "0.62011856", "0.62000793", "0.6191677", "0.61851", "0.61628294", "0.61554176", "0.6151559", "0.6136334", "0.61305165", "0.6123741", "0.6098518", "0.6084853...
0.0
-1
Return a PdfHeader object representing the header data from the PDF file in data
def _get_header(data): data.seek(0) if data.read(1) != b'%': raise PdfParseError('PDF version header not found') hline = read_until(data, EOLS) hline = hline.decode() rc = ReCacher() if rc.match(r'PDF\-(\d+\.\d+)$', hline): header = PdfHeader(rc....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_header(self):\n\n if self.stream.tell() != 0:\n self.stream.seek(0, os.SEEK_SET)\n\n header = self.stream.readline().rstrip()\n\n def is_valid_header(header):\n \"\"\"Only %PDF-1.[0-7] is accepted.\"\"\"\n\n return (len(header) == 8 and \\\n ...
[ "0.674115", "0.6502261", "0.6480818", "0.64078325", "0.63493747", "0.63275814", "0.63081974", "0.62913233", "0.6287383", "0.62428343", "0.6163371", "0.61600703", "0.60995054", "0.6098997", "0.6090928", "0.60718083", "0.6067982", "0.6035953", "0.6002113", "0.59892625", "0.5987...
0.76267785
0
Define the command line arguments using argparse
def add_arguments(self, parser): super().add_arguments(parser) parser.add_argument( '--api-url', dest='aa_api_url', type=str, help='The URL of the Academic Analytics API Endpoint', default=settings.ACADEMIC_ANALYTICS_API_URL, requi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_args():\n # Obtain the server number needed to split the data\n parser = argparse.ArgumentParser(description='')\n parser.add_argument(\n '-server',\n type=int,\n required=True,\n help='Current server number between 1 and total number of servers')\n parser.add_argu...
[ "0.75815326", "0.7500114", "0.7490416", "0.7464264", "0.7414924", "0.73751646", "0.7355917", "0.73380554", "0.7330462", "0.7292653", "0.7246808", "0.7231026", "0.7227317", "0.7213652", "0.7197159", "0.7195469", "0.71936387", "0.71919924", "0.71910393", "0.71859187", "0.718113...
0.0
-1
Ensures the URL has a trailing slash
def __trailingslashit(self, url): if url.endswith('/'): return url else: return f"{url}/"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_with_slash(url):\n\n if not url.endswith(\"/\"):\n return url + \"/\"\n\n return url", "def addPathEnd(url):\n if url[-1] is not '/':\n url += '/'\n return url", "def __sanitize_url(url):\n if not url.endswith(\"/\"):\n url += \"/\"\n return url", "def ensure_tr...
[ "0.76993173", "0.7496262", "0.7287814", "0.7098505", "0.70757884", "0.6867", "0.68490267", "0.66911864", "0.6668618", "0.6655556", "0.65839744", "0.64710295", "0.64710295", "0.63173866", "0.6230154", "0.621224", "0.6155961", "0.6124821", "0.60970324", "0.6091234", "0.6047287"...
0.6378002
13
Compute the percentage of misclassified examples. In this case, a network output >= 0 is consdired a '1' label, an output < 0 a '0' label.
def calc_misclassification(weights, data, targets): output = network_fun(data, weights) return np.count_nonzero(np.abs(data - output) > 1) / len(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure_misclassification(self, classifier, x_test, y_test):\r\n predictions = np.argmax(classifier.predict(x_test), axis=1)\r\n return 1 - np.sum(predictions == np.argmax(y_test, axis=1)) / y_test.shape[0]", "def multiclass_accuracy(preds, y):\n rounded_preds = torch.argmax(nf.softmax(preds...
[ "0.70625186", "0.6808213", "0.6690431", "0.6667008", "0.6630961", "0.65918815", "0.6577123", "0.6574503", "0.651165", "0.6502941", "0.64706373", "0.6449055", "0.6447367", "0.64183927", "0.64183927", "0.64109516", "0.63942295", "0.63920355", "0.6387237", "0.6386646", "0.638593...
0.72456586
0
Converts amplitude to decibels.
def amplitude_to_db(amplitude): amin = 1e-20 # Avoid log(0) instabilities. db = np.log10(np.maximum(amin, amplitude)) db *= 20.0 return db
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bin_dec(self):\r\n j = len(self.bin_num) - 1\r\n dec = 0\r\n for i in self.bin_num:\r\n dig = int(i) * 2**j\r\n dec = dec + dig\r\n j -= 1\r\n return dec", "def dBmToVolts(col):\n return numpy.exp(math.log(10)*col/10)", "def bin2dec(data):...
[ "0.5943985", "0.5864928", "0.55647296", "0.5552323", "0.5540008", "0.54930454", "0.54471594", "0.5421606", "0.5413373", "0.5351735", "0.52760243", "0.51940614", "0.51838493", "0.51553947", "0.512195", "0.51069295", "0.50992936", "0.5068647", "0.5059873", "0.5033659", "0.50129...
0.51835334
13
Compute power of audio in dB.
def calc_power(audio, frame_size=_RMS_FRAME, hop_size=64, range_db=_DB_RANGE, ref_db=20.7, pad_end=True): rms_energy = compute_rms_energy(audio, frame_size, hop_size,pad_end=pad_end) power_db = amplitude_to_db(rms_energy**2) #print(po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gain(dB):\n return 10.**(dB/10.)", "def dBm(power):\n if type(power) == float or type(power) == int:\n return 10*math.log10(power*1000.)\n elif type(power) == numpy.ndarray:\n return 10*numpy.log10(power*1000.)\n else:\n return 10*numpy.log10(numpy.array(power)*1000.)", "def get_power(self):\n...
[ "0.7564001", "0.73857856", "0.7086272", "0.698569", "0.69301975", "0.68330425", "0.6761269", "0.6621717", "0.66052", "0.66021055", "0.6598355", "0.6581405", "0.6572585", "0.65070945", "0.64172333", "0.6409144", "0.6352776", "0.63047284", "0.6292424", "0.61917555", "0.6181511"...
0.70967865
2
This function determines if we are ready for a new step and in the process checks for other conditions too.. The return value is True if we need to do a checkpoint now, and False otherwise. if the state of the simulation is failed, then we set ``self.is_done`` to True, and return False see if we are ready for the next ...
def update_step(self): #--------------- # set next step #--------------- next_step = self.curr_step + 1 #-------------- # did we fail? #-------------- if self.state == "failed": self.fwk.logEvent(self.name, None, 'all_fail', 'simulation faile...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkpoint(self):\n if self.fwk.debug:\n print(\".\", end=' ')\n #print \" ##### checkpointing\", self.fwk.fwk_global_time, self.curr_phase, self.curr_step\n self.fwk.logEvent(self.name, None, 'checkpoint', 'checkpointing simulation at step %d' % self.curr_step)\n self.nu...
[ "0.69929343", "0.6329585", "0.62938243", "0.6242834", "0.62428313", "0.62046444", "0.61537856", "0.61249053", "0.6116416", "0.59890544", "0.5985951", "0.595919", "0.58514655", "0.5811706", "0.5807744", "0.5777978", "0.5752062", "0.5742242", "0.57388186", "0.5712555", "0.57055...
0.79598594
0
Inserts a value to the set. Returns true if the set did not already contain the specified element.
def insert(self, val): if val not in self.place: self.data.append(val) self.place[val] = len(self.data)-1 return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, val: int) -> bool:\n if val in self.setlist :\n return False\n self.setlist.add(val)\n return True", "def insert(self, val: int) -> bool:\n if val in self.sett:\n return False\n self.sett.add(val)\n return True", "def insert(self,...
[ "0.78731596", "0.7779424", "0.7596031", "0.7447975", "0.73717517", "0.73445475", "0.72741324", "0.70932525", "0.7087485", "0.7077372", "0.70677626", "0.7036298", "0.70267475", "0.7004483", "0.69775593", "0.6928664", "0.6910149", "0.6877414", "0.68752253", "0.68532836", "0.682...
0.6842808
20
Deserialize a `Slice` object from a JSON representation.
def from_json( cls, data: dict, objects: VolumeObjectCollection, plane_name: str, slices_count: Optional[int] = None, key_id_map: Optional[KeyIdMap] = None, ): index = data[INDEX] if index < 0: raise ValueError("Frame Index have to be >= 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(cls, json_str):\n return cls.deserialize_json(json.loads(json_str))", "def slice(self, start: int, stop: int) -> List:\n json = self.json[start:stop]\n self.change_json(json)\n return json", "def from_json(src):\n return json.loads(src, object_pairs_hook=Decoder()...
[ "0.58108467", "0.5526962", "0.5343211", "0.53047276", "0.5266016", "0.52521145", "0.52461755", "0.5219648", "0.5165969", "0.5128728", "0.5104818", "0.5091098", "0.50841296", "0.50710475", "0.5062132", "0.50494295", "0.5028091", "0.49955904", "0.4990608", "0.4990608", "0.49810...
0.48714197
40
Method to throw a number of dice. Only throw as many dice as you have left
def throw_dice(self, NR_OF_DICE): self.thrown_dice = [] for x in range(NR_OF_DICE): self.thrown_dice.append(random.randint(1, 6)) return self.thrown_dice
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roll_die(number_of_rolls, number_of_sides):\n import random\n res = 0\n\n if number_of_rolls == 0 or number_of_sides == 0:\n return\n if number_of_rolls >= 1:\n res += random.randint(1, number_of_sides)\n if number_of_rolls >= 2:\n res += random.randint(1, number_of_sides)\n...
[ "0.7631714", "0.7351285", "0.7277491", "0.72677463", "0.7196784", "0.7171269", "0.71449536", "0.7132507", "0.7128562", "0.7074143", "0.70679957", "0.7065591", "0.7065591", "0.70648974", "0.70572466", "0.7039753", "0.70175695", "0.701446", "0.7008887", "0.7003957", "0.69866955...
0.80226445
0
Serialize this component to a dictionary.
def to_dict(self) -> Dict[str, Any]: return default_to_dict( self, model_name_or_path=self.model_name_or_path, device=self.device, use_auth_token=self.use_auth_token, prefix=self.prefix, suffix=self.suffix, batch_size=self.batch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self):\n return {\n\n \"system\": self.system,\n \"value\": self.value,\n \"use\" : self.use\n }", "def serialize(self) -> dict:\n\n return {\n 'id': self.id,\n 'name': self.name,\n }", "def serialized(self):\n ...
[ "0.7576803", "0.750125", "0.7454287", "0.7450265", "0.73906124", "0.73763466", "0.73327965", "0.73163295", "0.7311963", "0.7311963", "0.731044", "0.7302751", "0.7302751", "0.7302751", "0.7302751", "0.7302751", "0.7302409", "0.7302409", "0.7302409", "0.7302409", "0.7283132", ...
0.0
-1
Deserialize this component from a dictionary.
def from_dict(cls, data: Dict[str, Any]) -> "SentenceTransformersTextEmbedder": return default_from_dict(cls, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(self, obj_dict):\n return", "def from_dict(cls, dikt):\n return util.deserialize_model(dikt, cls)", "def from_dict(cls, dikt):\n return util.deserialize_model(dikt, cls)", "def from_dict(cls, dikt):\n return util.deserialize_model(dikt, cls)", "def from_dict(cls,...
[ "0.67496115", "0.65773344", "0.65773344", "0.65773344", "0.65773344", "0.65773344", "0.65773344", "0.65773344", "0.65773344", "0.65773344", "0.65773344", "0.65773344", "0.6576646", "0.6576646", "0.6576646", "0.6562097", "0.6561824", "0.65386295", "0.65386295", "0.65386295", "...
0.0
-1
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
def get_distance(lon1, lat1, lon2, lat2): # 经度1,纬度1,经度2,纬度2 (十进制度数) # lon1, lat1 = point1.longitude, point1.latitude # lon2, lat2 = point2.longitude, point2.longitude # 将十进制度数转化为弧度 lon1, lat1, lon2, lat2 = float(lon1), float(lat1), float(lon2), float(lat2) lon1, lat1, lon2, lat2 = map(radians, [lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle_distance(latitudes1: float, longitudes1: float, latitudes2: float, longitudes2: float) -> float:\n dlat = math.radians(latitudes1 - latitudes2)\n dlon = math.radians(longitudes1 - longitudes2)\n alat = math.radians((latitudes1 + latitudes2) / 2)\n R = 3958.8\n x = dlon * math.cos(al...
[ "0.8263672", "0.79028153", "0.76523226", "0.7635832", "0.7599059", "0.75452703", "0.75348586", "0.7534801", "0.7523721", "0.7497239", "0.74971086", "0.7460991", "0.7404893", "0.73632264", "0.7353057", "0.7325208", "0.73241794", "0.72988456", "0.72679293", "0.7267184", "0.7219...
0.69637656
49
Test that .connect() raises ConnectionError with missing/empty credentials
def test_connect_fails_with_empty_username_password(self): client = GarminClient(username="", password="falsepassword") with pytest.raises(ConnectionError) as excinfo: client.connect() err_msg = f"Missing credentials. Your forgot to provide username or password. " \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_connect(*args, **kwargs):\n raise ConnectionError", "def test_connect_failure(self):\n driver = InstrumentDriver(self._got_data_event_callback)\n driver._autoconnect = False\n\n current_state = driver.get_resource_state()\n self.assertEqual(current_state, DriverConnectionS...
[ "0.7571256", "0.713541", "0.70968515", "0.7078203", "0.6979184", "0.69608843", "0.69288826", "0.68871415", "0.6873137", "0.68420756", "0.6817004", "0.6816894", "0.6814014", "0.6794998", "0.6753604", "0.67207307", "0.6715232", "0.66582394", "0.6626415", "0.6613425", "0.6610164...
0.7733753
0
Test that .get() command only works with authenticated sessions
def test_get_raises_exception_on_non_authed_session(self, client): with pytest.raises(ConnectionError) as excinfo: client.get(url="dummy_url", err_message="") assert ( "Attempt to use GarminClient without being connected. Call connect() before first use." in str(excin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_authenticated():\n return get()", "def test_get__authenticated(self):\n request = self.factory.get(self.url)\n request.user = self.user\n response = self.view(request)\n\n self.assertEqual(response.status_code, 200)", "def test_not_get_users_list_no_auth(test_client, test...
[ "0.691536", "0.6862463", "0.68577516", "0.6840389", "0.6824642", "0.68222827", "0.6800711", "0.6774728", "0.6756029", "0.67404836", "0.6722546", "0.66929734", "0.66800606", "0.6674355", "0.66599375", "0.66322595", "0.66092736", "0.6605036", "0.6592851", "0.6569058", "0.656809...
0.0
-1
What SUV has the highest annual fuel cost? Use "Carline Class Desc" to identify SUVs. The function must return the carline (a string).
def q8(df): return df.loc[(df['Carline Class Desc'].str.contains('SUV', na=False)), "Annual Fuel1 Cost - Conventional Fuel"] \ .idxmax()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def q6(df):\n return (df[\"Hwy FE (Guide) - Conventional Fuel\"] - df[\"City FE (Guide) - Conventional Fuel\"]).idxmax()", "def describe_carver(self) -> str:\r\n description = f\"Model: {self.name_carver}, Klasse: Caver, Marke: {self.brand}, \" \\\r\n f\"Carver-Typ: {self.typ}, Län...
[ "0.5615189", "0.5343265", "0.53421444", "0.5319455", "0.53067976", "0.5300177", "0.5205699", "0.5199318", "0.51515305", "0.5123598", "0.51176625", "0.5105851", "0.50645375", "0.506244", "0.50515974", "0.5034073", "0.50206125", "0.50194716", "0.5007195", "0.4990588", "0.498349...
0.7166645
0
Get single data by dataset idx and data_idx
def get_data(self, dataset_idx: int, data_idx: int) -> object: data = self.__datasets[dataset_idx][data_idx] if self._need_pass_indices: if not isinstance(data, dict): data = {'data': data} return dict(data, **{'data_idx': str(dataset_idx) + "_" + str(data_idx)}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_data_by_index(self, index):\n return self.data[index]", "def get_data_by_index(self, index):\n pass", "def __getitem__(self, idx):\n return self.get_samples([idx])[0]", "def __getitem__(self, idx):\n while idx < len(self.dataset):\n sample = self._safe_get_item...
[ "0.7056221", "0.690373", "0.687221", "0.6594117", "0.65130717", "0.63943946", "0.6388072", "0.6382734", "0.63374877", "0.6204255", "0.619752", "0.619112", "0.617837", "0.6153076", "0.6143266", "0.613064", "0.6121277", "0.6090349", "0.608599", "0.60853547", "0.6077611", "0.6...
0.722867
0
Get an iterator of resource info, filtered by patterns. This method enhances `~fs.base.FS.scandir` with additional filtering functionality.
def todo_filterdir( self, path, # type: Text files=None, # type: Optional[Iterable[Text]] dirs=None, # type: Optional[Iterable[Text]] exclude_dirs=None, # type: Optional[Iterable[Text]] exclude_files=None, # type: Optional[Iterable[Text]] namespaces=None, # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_read(path_pattern, ld=True):\n raise NotImplementedError", "def resources_with(self, pattern: Pattern) -> List[str]:\n return [\n resource for resource in self.get_resource_list() if isinstance(resource, str) and pattern.match(resource)\n ]", "def find_matching(cls, pat...
[ "0.6466275", "0.63304895", "0.630156", "0.6244844", "0.62172234", "0.61533344", "0.6138757", "0.61376506", "0.61053175", "0.59303206", "0.5913288", "0.58771175", "0.5857331", "0.5844752", "0.5797595", "0.57822645", "0.5770434", "0.57636875", "0.5760446", "0.5760019", "0.57491...
0.66916955
0
Adjust contrast of an Image.
def adjust_contrast(img, contrast_factor): enhancer = ImageEnhance.Contrast(img) img = enhancer.enhance(contrast_factor) return img
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enhance(self):\n\n # these values seem to work well for most images – a more adaptive\n # method would but nice, but it's not a priority\n contrast = 1.07\n brightness = 1.01\n\n self.image = ImageEnhance.Contrast(self.image).enhance(contrast)\n self.image = ImageEnhan...
[ "0.75882405", "0.74968904", "0.74243826", "0.7422659", "0.7361508", "0.73477185", "0.7329534", "0.71746624", "0.7156832", "0.7152199", "0.70921576", "0.7069125", "0.69658303", "0.69611573", "0.69148695", "0.69109386", "0.6902595", "0.6843309", "0.6843309", "0.6815054", "0.678...
0.8608795
0
Adjust hue of an image. The image hue is adjusted by converting the image to HSV and cyclically shifting the intensities in the hue channel (H). The image is then converted back to original image mode. `hue_factor` is the amount of shift in H channel and must be in the interval `[0.5, 0.5]`.
def adjust_hue(img, hue_factor): input_mode = img.mode if input_mode in {'L', '1', 'I', 'F'}: return img h, s, v = img.convert('HSV').split() np_h = np.array(h, dtype=np.uint8) # uint8 addition take cares of rotation across boundaries with np.errstate(over='ignore'): np_h += n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_hue(input: torch.Tensor, hue_factor: Union[float, torch.Tensor]) -> torch.Tensor:\n\n # convert the rgb image to hsv\n x_hsv: torch.Tensor = rgb_to_hsv(input)\n\n # perform the conversion\n x_adjusted: torch.Tensor = adjust_hue_raw(x_hsv, hue_factor)\n\n # convert back to rgb\n out: to...
[ "0.8400727", "0.7526595", "0.69121563", "0.6871149", "0.6636638", "0.64031017", "0.62790525", "0.62440425", "0.62226695", "0.61348385", "0.6007232", "0.59685236", "0.5703367", "0.56969947", "0.5591076", "0.55770546", "0.5545712", "0.5410758", "0.5386229", "0.534664", "0.53347...
0.8843813
0
The version of a standard interface specification that this interface complies with. When the interface is provided in the context of a Capability element, then the standard being refered to is the one identified by the Capability's standardID element. If the standardID is not provided, the meaning of this attribute is...
def version(self): return self._version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code_hook_interface_version(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"code_hook_interface_version\")", "def get_version(self):\n return \"built-in\"", "def getVersion():\r\n\treturn gc.getDefineINT(\"CIV4_VERSION\")", "def standardid(self):\n return self._standardid", ...
[ "0.5666056", "0.5620255", "0.5530759", "0.5467767", "0.5467767", "0.5362039", "0.5349352", "0.53466547", "0.53316104", "0.53316104", "0.53316104", "0.53316104", "0.53316104", "0.53316104", "0.5329268", "0.5283028", "0.52677464", "0.52485055", "0.5246398", "0.5243174", "0.5240...
0.0
-1
A list of access urls in the interface. Must contain only `AccessURL` objects.
def accessurls(self): return self._accessurls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_web_access_uris(self):\n pass", "def get_list_urls(self):\n return self.list_urls", "def urls(self):\n return self.get_urls()", "def generated_url_list(self):\n return self.url_list", "def get_urls(self) :\n return self._urls", "def get_access_urls(run_config: ...
[ "0.6839277", "0.6764526", "0.66943306", "0.6650436", "0.661729", "0.65781224", "0.6379843", "0.62874216", "0.62129796", "0.62129796", "0.62129796", "0.62129796", "0.62129796", "0.62129796", "0.62129796", "0.6164914", "0.6058487", "0.6030106", "0.60297287", "0.6015235", "0.598...
0.81784916
0
a description of how to call the service to access this capability Since the Interface type is abstract, one must describe the interface using a subclass of Interface, denoting
def interfaces(self): return self._interfaces
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getInterface(self):\n\t\treturn describeInterface(self)", "def describe(self):\n print(\"Capability {}\".format(self.standardid))\n print()\n\n if self.description:\n print(self.description)\n print()\n\n for interface in self.interfaces:\n interfa...
[ "0.73969775", "0.73816234", "0.6988121", "0.6656875", "0.6577873", "0.65436506", "0.65228194", "0.6379233", "0.63168365", "0.6310646", "0.62266225", "0.62266225", "0.62266225", "0.62266225", "0.62266225", "0.62266225", "0.62266225", "0.62266225", "0.62266225", "0.62266225", "...
0.0
-1
Test processing a statement containing the connect command with an unrecognised bot name.
def test_process_connect_invalid(self, multibot_adapter): self.process( multibot_adapter, Statement('start_session test_bot_-1'), confidence=1, match=('Sorry, no bot with that name was found. Type \'list\' to ' 'see available bots.'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_process_connect_invalid_while_connected(self, multibot_adapter):\n self.process(multibot_adapter, Statement('start_session test_bot_1'))\n self.process(\n multibot_adapter,\n Statement('start_session test_bot_-1'),\n confidence=1,\n match='You are ...
[ "0.69311255", "0.6766669", "0.6048351", "0.6041401", "0.59552985", "0.59411746", "0.59245443", "0.5895058", "0.5828452", "0.571797", "0.5712922", "0.5706991", "0.5692057", "0.5626344", "0.5596252", "0.5590437", "0.555082", "0.5546696", "0.55369216", "0.55221874", "0.5517167",...
0.77358484
0
Test processing a statement containing the connect command with an unrecognised bot name whilst connected to a bot.
def test_process_connect_invalid_while_connected(self, multibot_adapter): self.process(multibot_adapter, Statement('start_session test_bot_1')) self.process( multibot_adapter, Statement('start_session test_bot_-1'), confidence=1, match='You are already in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_process_connect_invalid(self, multibot_adapter):\n self.process(\n multibot_adapter,\n Statement('start_session test_bot_-1'),\n confidence=1,\n match=('Sorry, no bot with that name was found. Type \\'list\\' to '\n 'see available bots.'...
[ "0.78487235", "0.69497705", "0.65588427", "0.65010506", "0.6421985", "0.63934094", "0.6050204", "0.57584256", "0.5733914", "0.5704745", "0.54962957", "0.54803926", "0.5479249", "0.54735684", "0.54075867", "0.540104", "0.5381448", "0.53726727", "0.5365945", "0.5357636", "0.535...
0.7137437
1
Get cfg for simulation type
def for_sim_type(sim_type): if sim_type not in cfg: return {} return pkcollections.map_to_dict(cfg[sim_type])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config():\n return ImSimConfiguration()", "def _ConfigClass(self):\n return util_simulation_config.Config", "def cfg(self):\n return self._cfg", "def getattr(self):\r\n config = self.config\r\n\r\n try:\r\n if keyInSection(config, section=ConfigSection.desc, key=...
[ "0.70344096", "0.6584938", "0.6302683", "0.62858695", "0.6254673", "0.6150202", "0.5866012", "0.5852664", "0.58499944", "0.5847734", "0.5779937", "0.5727291", "0.5717441", "0.57017124", "0.569634", "0.5687195", "0.56818473", "0.56518716", "0.5648038", "0.5635753", "0.56308997...
0.7123771
0
Convert `data` to a contiguous array with the specified properties. The datatype of the array will match `dtype` as closely as possible. If `force_integer` is `True`, it will be an integer datatype. If `force_unsigned` is `True`, it will be an unsigned datatype. If `force_float` is `True`, it will be a floating point d...
def coerce_array(data, dtype=None, force_integer=False, force_unsigned=False, force_float=False, force_gl=True): if dtype is None: if hasattr(data, "dtype"): dtype = Datatype.from_numpy(data.dtype) else: if force_integer: dtype = int32 else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vispy_array(data, dtype=np.float32):\n if not data.flags['C_CONTIGUOUS']:\n data = np.ascontiguousarray(data, dtype=dtype)\n if data.dtype != dtype:\n data = data.astype(dtype, copy=False)\n return data", "def coerced(self, force_integer=False, force_unsigned=False, force_float=False, ...
[ "0.67281055", "0.62665504", "0.5552902", "0.53682774", "0.5284333", "0.52259773", "0.52187103", "0.52023304", "0.51893914", "0.5161565", "0.51421213", "0.5119924", "0.5114238", "0.51010984", "0.50530803", "0.5046014", "0.5036841", "0.49636093", "0.489922", "0.4857007", "0.484...
0.8220314
0
Renders the dashboard page.
def dashboard_view(request): assert isinstance(request, HttpRequest) statuses = Status.objects.filter(submitter=request.user).order_by('-timestamp') return render(request, 'app/dashboard.html', { 'title':'Dashboard', 'year':now(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dashboard():\n return render_template('dashboard.html', title=\"Dashboard\")", "def dashboard():\n return render_template('home/dashboard.html', title=\"Dashboard\")", "def dashboard():\n return render_template('home/dashboard.html', title=\"Dashboard\")", "def dashboard():\n return render_te...
[ "0.83014834", "0.82225573", "0.82225573", "0.82225573", "0.8102937", "0.77032244", "0.7610232", "0.75640774", "0.7492825", "0.74563956", "0.74384975", "0.74347705", "0.7413493", "0.7374931", "0.73496467", "0.7307833", "0.7268651", "0.7219054", "0.70892745", "0.70770955", "0.6...
0.6374521
31
Changes the speed of the video
def apply_transform( self, video_path: str, output_path: str, metadata: Optional[List[Dict[str, Any]]] = None, ) -> str: return F.change_video_speed(video_path, output_path, self.factor, metadata=metadata)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_speed(self, speed):\r\n self.speed = speed", "def set_speed(self, v):\n self.v = v", "def setSpeed(self, speed):\n pass", "def set_speed(self, speed) :\n self.speed = speed", "def set_speed(self,speed):\n if(not self.stopped):\n self.stop_spindle(self.i...
[ "0.7563655", "0.7497567", "0.7467837", "0.74361634", "0.7435606", "0.73026305", "0.7298984", "0.7272485", "0.7250881", "0.71431106", "0.7092471", "0.6985374", "0.69416827", "0.6857766", "0.68476486", "0.68441206", "0.68191546", "0.6782401", "0.67744255", "0.6726668", "0.66643...
0.64465463
32
Color jitters the video
def apply_transform( self, video_path: str, output_path: str, metadata: Optional[List[Dict[str, Any]]] = None, ) -> str: return F.color_jitter( video_path, output_path, self.brightness_factor, self.contrast_factor, s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_pyramid_and_save(vid_pyr_flted, orig_video, enlarge_multiple, fps, save_filename):\r\n width, height = get_frame_dimensions(orig_video[0])\r\n pulse = []\r\n \"\"\"\r\n averages = []\r\n for x in range(1, orig_video.shape[0] - 1):\r\n averages.append(orig_video[x, :, :, :].sum())\...
[ "0.63853264", "0.60361016", "0.6021069", "0.59483707", "0.5881643", "0.581162", "0.5806488", "0.5796305", "0.5793367", "0.56546485", "0.56165993", "0.56153494", "0.56034064", "0.5591741", "0.5579607", "0.55756044", "0.55756044", "0.55756044", "0.55660105", "0.5546028", "0.554...
0.57979447
7
Changes a video to be grayscale
def apply_transform( self, video_path: str, output_path: str, metadata: Optional[List[Dict[str, Any]]] = None, ) -> str: return F.grayscale(video_path, output_path, metadata=metadata)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_greyscale(self, orig):\n frame = cv.CreateImage(cv.GetSize(orig), cv.IPL_DEPTH_8U, 1)\n cv.CvtColor(orig, frame, cv2.COLOR_RGB2GRAY)\n cv.ShowImage(\"Greyscale\", frame)", "def grayscale(image):\r\n return cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)", "def grayscale(img):\n return cv2.cv...
[ "0.6536507", "0.634865", "0.63220584", "0.63220584", "0.63220584", "0.63220584", "0.6288488", "0.6269047", "0.62676084", "0.6179404", "0.60790354", "0.6057979", "0.60399216", "0.6014671", "0.60107315", "0.60107315", "0.60107315", "0.60046375", "0.59975314", "0.59931993", "0.5...
0.57174766
40
Removes the audio stream from a video
def apply_transform( self, video_path: str, output_path: str, metadata: Optional[List[Dict[str, Any]]] = None, ) -> str: return F.remove_audio(video_path, output_path, metadata=metadata)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\r\n self._video_is_playing = False\r\n self._audio.stop()", "def stop(self):\n if self.done:\n return\n \n self.done = True\n self.voice_client._unlink_audio_stream(self)", "def delete_video(self):\n self.multipler_request('video/%s/de...
[ "0.6982494", "0.66319144", "0.65840256", "0.6471991", "0.63729763", "0.6200819", "0.6145385", "0.6119181", "0.6100667", "0.60394275", "0.60042185", "0.59923506", "0.5989047", "0.59856164", "0.59566844", "0.5912184", "0.5864598", "0.5840548", "0.58376276", "0.58074355", "0.580...
0.616363
6
Transform that randomly changes the contrast of a video
def apply_random_transform( self, video_path: str, output_path: str, metadata: Optional[List[Dict[str, Any]]] = None, ) -> str: return F.contrast( video_path, output_path, level=self.chosen_value, metadata=metadata )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _autocontrast(video: torch.Tensor, **kwargs) -> torch.Tensor:\n return torchvision.transforms.functional.autocontrast(video)", "def apply_random_transform(\n self,\n video_path: str,\n output_path: str,\n metadata: Optional[List[Dict[str, Any]]] = None,\n ) -> str:\n ...
[ "0.6834742", "0.66281223", "0.6571781", "0.646033", "0.63433814", "0.6273331", "0.6245194", "0.6229187", "0.6201463", "0.61296964", "0.6068734", "0.60545605", "0.60430205", "0.600922", "0.59693396", "0.5917139", "0.5903803", "0.58157456", "0.5766978", "0.57420594", "0.5714012...
0.73075086
0
Transform that randomly changes the video speed
def apply_random_transform( self, video_path: str, output_path: str, metadata: Optional[List[Dict[str, Any]]] = None, ) -> str: return F.change_video_speed( video_path, output_path, factor=self.chosen_value, metadata=metadata )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_transform(\n self,\n video_path: str,\n output_path: str,\n metadata: Optional[List[Dict[str, Any]]] = None,\n ) -> str:\n return F.change_video_speed(video_path, output_path, self.factor, metadata=metadata)", "def apply_random_transform(\n self,\n vi...
[ "0.6581306", "0.6457711", "0.6401623", "0.61912155", "0.60232437", "0.5947196", "0.5934137", "0.59121495", "0.58765584", "0.5797324", "0.5778085", "0.57374567", "0.56968874", "0.56945777", "0.569237", "0.55855024", "0.5548157", "0.552809", "0.5505112", "0.5503283", "0.5488802...
0.73894614
0
Return the manufacturer as a json object.
def json(self) -> dict: manufacturer = { 'submittingParty': self.submitting_party.json, 'ownerGroups': [], 'location': { 'locationType': MhrLocationTypes.MANUFACTURER.value, 'leaveProvince': False, 'dealerName': self.dealer.busi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json(self):\n return {\n \"serial_number\": self.serial_number,\n \"name\": self.name,\n \"brand\": self.brand,\n \"cameras\": self.cameras\n }", "def get_manufacturer():\r\n\t\treturn \"\"", "def manufacturer(self):\n return self._manufactur...
[ "0.7198066", "0.6811823", "0.67908186", "0.67908186", "0.67393315", "0.66571796", "0.66571796", "0.6526839", "0.6431812", "0.64138", "0.6309503", "0.6270475", "0.6153561", "0.6128603", "0.6114013", "0.60522276", "0.60511047", "0.6028445", "0.5993926", "0.59510666", "0.5932531...
0.76432115
0
increase size of head by 1
def increase_head_length(self): self.body[0]['length'] += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grow(self):\n self.head.increment()", "def __init__(self, head = None):\n self.head = head\n self.size = 1 if head else 0", "def head(self, head):\n\n self._head = head", "def grow(self, newsize):\r\n oldbody = self.body\r\n self.body = [None] * int(newsize)\r\n ...
[ "0.77899975", "0.7172976", "0.705469", "0.6975635", "0.6818731", "0.679354", "0.6761624", "0.67149615", "0.66779983", "0.6611013", "0.6596635", "0.65935427", "0.6456024", "0.64386237", "0.6365367", "0.63262624", "0.63185114", "0.6284278", "0.62716365", "0.6265944", "0.6249246...
0.7320919
1
fire a bullet if the maximum number of bullets allowed on screen is not reached
def fire_bullet(ci_settings, screen, broccoli, bullets): # create a bullet and add it to group if len(bullets) < ci_settings.bullets_allowed: new_bullet = Bullet(ci_settings, screen, broccoli) bullets.add(new_bullet)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fire_bullet(self):\n if len(self.bullets) < self.settings.bullets_allowed:\n new_bullet = Bullet(self)\n self.bullets.add(new_bullet)", "def _fire_bullet(self):\n if len(self.bullets) < self.settings.bullets_allowed:\n new_bullet = Bullet(self)\n sel...
[ "0.8050909", "0.8050909", "0.8050909", "0.8050909", "0.8042397", "0.78590536", "0.7739733", "0.7727589", "0.76889086", "0.74351454", "0.74083525", "0.7359565", "0.7298604", "0.70813704", "0.6972512", "0.6960736", "0.68932664", "0.67801857", "0.64467883", "0.6432685", "0.64230...
0.6976798
14
update the position of bullets, delete bullets that have disappeared from the screen.
def update_bullets(ci_settings, screen, stats, sb, broccoli, cats, bullets): bullets.update() for bullet in bullets.copy(): if bullet.rect.bottom <= 0: bullets.remove(bullet) check_bullet_cat_collisions(ci_settings, screen, stats, sb, broccoli, cats, bullets)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_bullets(bullets):\n bullets.update()\n # Delete bullets once they pass the screen.\n for bullet in bullets.copy():\n if bullet.rect.bottom <= 0: # when the bullets gets past the top of the screen.\n bullets.remove(bullet)", "def update_bullet(bullets):\n # Update bullet p...
[ "0.8582112", "0.84771615", "0.8260858", "0.8237326", "0.8233263", "0.81619465", "0.8102002", "0.805317", "0.80395913", "0.7978392", "0.793545", "0.78879386", "0.78040266", "0.7725927", "0.7721276", "0.76984227", "0.7669545", "0.7669366", "0.7581874", "0.75093037", "0.7451345"...
0.7909997
11
Returns the switch of the packet.
def get_switch(pkt): return pkt['switch']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_switch(self, host):\n nw_adapters = get_host_attributes(host)[u'network_adapters']\n for nwa in nw_adapters:\n if (u'network_address' in nwa and\n nwa[u'network_address'] == host.address):\n return nwa[u'switch']", "def read_switch(self):\n ...
[ "0.73774016", "0.7009266", "0.66569334", "0.65792465", "0.6458394", "0.6422403", "0.6419805", "0.6410447", "0.6350123", "0.63331866", "0.62848073", "0.62841797", "0.61697423", "0.61233056", "0.60847026", "0.6083882", "0.60632116", "0.5968714", "0.59551203", "0.59171087", "0.5...
0.8526548
0
Returns the port the packet came in on.
def get_inport(pkt): return pkt['inport']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_port(self):\n return self.__port", "def port(self):\n return self[1]", "def port(self):\n return self._b.port", "def port_number(self):\n return self._port_number", "def port(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"port\")", "def port(self) -> p...
[ "0.8111512", "0.8069944", "0.79080695", "0.78699", "0.7841221", "0.7841221", "0.7785216", "0.7785216", "0.7754738", "0.7754738", "0.7754738", "0.7754738", "0.77468", "0.77087444", "0.7642834", "0.7642834", "0.7638723", "0.7635605", "0.7634722", "0.7634722", "0.7634722", "0....
0.75324947
32
Returns the port the packet came in on.
def get_outport(pkt): return pkt['outport']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_port(self):\n return self.__port", "def port(self):\n return self[1]", "def port(self):\n return self._b.port", "def port_number(self):\n return self._port_number", "def port(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"port\")", "def port(self) -> p...
[ "0.8111512", "0.8069944", "0.79080695", "0.78699", "0.7841221", "0.7841221", "0.7785216", "0.7785216", "0.7754738", "0.7754738", "0.7754738", "0.7754738", "0.77468", "0.77087444", "0.7642834", "0.7642834", "0.7638723", "0.7635605", "0.7634722", "0.7634722", "0.7634722", "0....
0.7346959
58
Computes the PROscore and intersection over union (IOU)
def compute_pro_auc(predictions, targets, expect_fpr=0.3, max_steps=300): if targets.ndim == 1: warnings.warn("Can't compute a meaningful pro score with only" "labels, returning 0.") return 0. def rescale(x): return (x - x.min()) / (x.max() - x.min()) if torch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_image_iou(gt, pred, img):\n if len(gt) != len(pred):\n print(\"Manually calculate \" + img)\n return -1\n total_iou = 0\n for i in range(len(gt)):\n # if gt[i][0] != pred[i][0]:\n # print(\"Manually calculate \" + img)\n # return -1\n total_i...
[ "0.6975583", "0.67347753", "0.6603474", "0.6602161", "0.65891016", "0.6578797", "0.64227045", "0.6390922", "0.63679945", "0.63429695", "0.63143724", "0.63126284", "0.6310128", "0.6308362", "0.630811", "0.6286793", "0.62582856", "0.62525845", "0.6224507", "0.6217898", "0.61941...
0.0
-1
Sets the employee_number of this SuperMembership.
def employee_number(self, employee_number): if employee_number is None: raise ValueError( "Invalid value for `employee_number`, must not be `None`" ) # noqa: E501 self._employee_number = employee_number
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_employees(self, number_of_employees):\n\n self._number_of_employees = number_of_employees", "def employee_id(self, employee_id):\n\n self._employee_id = employee_id", "def employee(self, employee: Employee):\n\n self._employee = employee", "def employee_name(self, employee_...
[ "0.6865494", "0.66461754", "0.6307666", "0.62772584", "0.6096224", "0.6022603", "0.58537257", "0.5846896", "0.5846896", "0.5817749", "0.5801077", "0.5749513", "0.57266736", "0.5722283", "0.5666443", "0.5666443", "0.5666443", "0.5666443", "0.56473505", "0.5613625", "0.5613075"...
0.7444823
0
Check if quantile is enabled
def get_quantiles_config(self, name): # Check quantiles is enabled return getattr(self.perfomance, f"enable_{name}_quantiles", False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ggml_is_quantized(type: int) -> bool:\n ...", "def quantile_99(self):\n return mstats.mquantiles(self.masked_img, prob=0.99, axis=0).flatten()", "def quantile_concrete(self, x):\n y = torch.sigmoid((torch.log(x) - torch.log(1 - x) + self.qz_loga) / self.temperature)\n return y * (li...
[ "0.6334717", "0.6064831", "0.6018772", "0.59551805", "0.5890669", "0.5814732", "0.5788249", "0.57814723", "0.5779891", "0.57406193", "0.5699366", "0.5697049", "0.5686986", "0.5670614", "0.5634763", "0.56176734", "0.5587878", "0.55397475", "0.5539448", "0.5502003", "0.54942834...
0.6972337
0
Return UTC offset for configured timezone
def tz_utc_offset(self) -> int: import pytz import datetime if not hasattr(self, "_utcoffset"): dt = datetime.datetime.now(tz=pytz.utc) self._utcoffset = dt.astimezone(self.timezone).utcoffset() return int(self._utcoffset.total_seconds())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tzoffset(self):\n\n if self._datetime.tzinfo is not None:\n return compute_offset(self._datetime)\n return 0", "def s3_get_utc_offset():\n\n offset = None\n\n if auth.is_logged_in():\n # 1st choice is the personal preference (useful for GETs if user wishes to see times i...
[ "0.75396127", "0.75286424", "0.7457935", "0.7238158", "0.7166397", "0.7157053", "0.71419615", "0.7067272", "0.6866446", "0.6804935", "0.6698783", "0.6694499", "0.6547016", "0.64063674", "0.6338237", "0.6325366", "0.63189286", "0.6222764", "0.62086284", "0.6189098", "0.6159097...
0.7735086
0
PUT method provided by the webservice.
def put(self, server=None, name=None, backup=None): args = self.parser.parse_args() l = args['list-sc'] s = args['strip-sc'] p = args['prefix-sc'] f = args['force-sc'] to = args['restoreto-sc'] j = [] err = [] # Check params if not l or not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put (self, request, pk = None):\n return Response({'method':'PUT'})", "def do_PUT(self):\n # pylint: disable=invalid-name\n self._respond()", "def put(self, request, pk=None):\n return Response({'method':'PUT'})", "async def _put(self, *args, **kwargs):\n\t\traise Http405Metho...
[ "0.8054654", "0.79508007", "0.79267025", "0.7920401", "0.79172325", "0.79172325", "0.79172325", "0.79172325", "0.79172325", "0.79172325", "0.79172325", "0.79172325", "0.79172325", "0.79172325", "0.79172325", "0.79172325", "0.79172325", "0.79172325", "0.79172325", "0.79172325", ...
0.0
-1
A function to calculate the binomial beta distribution.
def binomial_beta(self, alpha, beta, n, k): choices = sm.comb(n, k) top = sp.betaln(k+alpha, n-k+beta) top = top.replace(np.inf, np.nan) top.fillna(0, inplace=True) bottom = sp.betaln(n, k) bottom = bottom.replace(np.inf, np.nan) bottom.fillna(0, inplace=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bn(n, x, beta):\n phi_n_x = phin(n, x/beta)\n return phi_n_x/np.sqrt(beta)", "def Beta(x,y):\n \n return Gamma(x)*Gamma(y)/Gamma(x+y)", "def B(alpha, beta):\n return math.gamma(alpha)*math.gamma(beta)/math.gamma(alpha + beta)", "def beta(self,param,x,y=None):\n p=[]\n for i i...
[ "0.7483778", "0.74567187", "0.73317796", "0.7259695", "0.70676124", "0.7057166", "0.7041787", "0.702266", "0.7008472", "0.70044464", "0.6779213", "0.6777545", "0.6743233", "0.67303395", "0.6726851", "0.6694701", "0.6668567", "0.66055554", "0.65923864", "0.6589964", "0.6580898...
0.8039822
0
Helper method to add a suffix dict key
def seperate_dict(dic): dic = dic.copy() for i in dic.copy(): if isinstance(dic[i],list): if dic[i]: count= 0 for j in dic[i]: count+=1 dic[i+str(count)] = j del dic[i] return dic
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _key_suffix(self):\n # type: () -> Optional[str]\n return None", "def make_suffix_string(args, suffix_key):\n try:\n file_suffix = args[suffix_key]\n if file_suffix != \"\" and not file_suffix.startswith('_'):\n file_suffix = '_' + file_suffix\n except KeyError:\n...
[ "0.6736381", "0.6686015", "0.6534138", "0.6189934", "0.6152107", "0.6144975", "0.6096199", "0.6079816", "0.6070045", "0.6042136", "0.59863925", "0.59623367", "0.59501255", "0.5945631", "0.5945072", "0.5843925", "0.5744478", "0.571572", "0.57002646", "0.56754714", "0.5617717",...
0.0
-1
Convert iterable of Points into ParetoSet.
def from_list(self, A): for a in A: self.add(a)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_Set(self) -> set:\n nouveau_set = set()\n for element in self: # Parcours le support\n nouveau_set.add(element)\n return nouveau_set", "def to_set(self):\n\n return to_set(self, set)", "def face_point_sets(self, homogeneous=False):\n result = set()\n ...
[ "0.61424696", "0.5950802", "0.59243554", "0.58773047", "0.57580835", "0.57540005", "0.5739643", "0.57156473", "0.5691886", "0.56649274", "0.5588928", "0.5529824", "0.55136377", "0.54680246", "0.54315746", "0.54297817", "0.5427961", "0.53880644", "0.538568", "0.5338865", "0.53...
0.0
-1
Reposition this file to the beginning of the line most recently read from it. Return this FileReader instance.
def rewindOneLine(self): self.file.seek(self.pos) self.line_number-=1 return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_beginning(self):\r\n self.__fh.seek(0)", "def rewind(self):\n self.line_number = 0", "def readline(self):\n\n if self.eof:\n return ''\n # Remember this new line's position in our file.\n self.pos=self.file.tell()\n # Attempt to read the next line. line=='' indicates E...
[ "0.7136113", "0.70154727", "0.6434467", "0.6326882", "0.62723976", "0.62391794", "0.6227015", "0.6223536", "0.61809844", "0.61409235", "0.6025104", "0.5952528", "0.5942053", "0.5900139", "0.588384", "0.5804409", "0.57437426", "0.5672447", "0.56616235", "0.5621671", "0.5605436...
0.77237767
0
Getter for the lda's parameters.
def get_params(self) -> dict: # Create params dictionary. params = dict(n_components=self._param_value(self.n_components), remove_zeros=self.remove_zeros) return params
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getParameters(self):\n return self.sequential.getParameters()", "def _get_parameters(self):\n return (self.location_, self.scale_,\n self.precision_cholesky_, self.dof_)", "def getParameters(self):\n\t\td = Algorithm.getParameters(self)\n\t\td.update({\n\t\t\t\t'levy': self.lev...
[ "0.69301593", "0.6930081", "0.69239235", "0.6837127", "0.68135786", "0.6739526", "0.6714691", "0.66721714", "0.66329336", "0.6615526", "0.66095227", "0.658862", "0.658862", "0.658862", "0.6583126", "0.65707254", "0.6566445", "0.65617657", "0.65617657", "0.6536938", "0.6534771...
0.0
-1
Create a Model from a dictionary.
def from_dict(cls, d: Dict, _filepath: str = None, _path_to_readme: str = None): lc_keys = lowercase_keys(d) copy_fields = [ "name", "paper", "code", "weights", "config", "readme", "metadata", "results", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\r\n dictionary):\r\n if dictionary is None:\r\n return None\r\n\r\n # Extract variables from the dictionary\r\n id = dictionary.get('id')\r\n created_date = dictionary.get('createdDate')\r\n\r\n # Clean out expected prope...
[ "0.79916286", "0.7915993", "0.7860857", "0.7772558", "0.77075416", "0.7680441", "0.76540375", "0.7580833", "0.7552121", "0.7552121", "0.75317544", "0.75180197", "0.75115496", "0.74697465", "0.74605316", "0.74030465", "0.73846644", "0.731656", "0.7292234", "0.7270205", "0.7248...
0.0
-1
Get the results as a Result object
def results(self): return self.data.get("Results", None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_results(self):\n\t\treturn self.results", "def get_results(self):\n \n return self.results", "def get_results(self) :\n raise NotImplementedError()", "def each_result(self):\n return (result for result in self.results)", "def get_results(self):\n return self.resul...
[ "0.7703593", "0.7628162", "0.7617764", "0.760162", "0.75418305", "0.75390655", "0.74299777", "0.738935", "0.73561937", "0.7355457", "0.7281102", "0.7276051", "0.7249421", "0.7247603", "0.7247603", "0.71800184", "0.7127871", "0.70396554", "0.70353544", "0.7015844", "0.7006311"...
0.6795128
33
Test if other element equals to this symbol.
def __eq__(self, other): if self is other: return True if not isinstance(other, self.__class__): return NotImplemented if self.obj is None or other.obj is None: return False else: return self.obj == other.obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n try:\n return (\n self.name == other.name\n and self.symbol == other.symbol\n and self.Z == other.Z\n )\n except Exception:\n raise ElementError(\"Cannot determine equality\")", "def __eq__(self...
[ "0.7962832", "0.7689492", "0.73829186", "0.737473", "0.7279528", "0.7262326", "0.7199764", "0.7185402", "0.7143481", "0.7143481", "0.71226996", "0.71207553", "0.7119688", "0.70796937", "0.70692164", "0.7066571", "0.7058292", "0.7051239", "0.70403475", "0.70101446", "0.7007034...
0.0
-1
Return a term where the NOT function is moved inward. This is achieved by canceling double NOTs and using de Morgan laws.
def demorgan(self): term = self.cancel() if term.isliteral or\ not isinstance(term.args[0], self.algebra.operations): return term op = term.args[0] return op.dual(*tuple(self.__class__(arg, eval=False).cancel() for arg in op.args)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_not_inwards(s):\n s = expr(s)\n if s.op == '~':\n def NOT(b):\n return move_not_inwards(~b)\n a = s.args[0]\n if a.op == '~':\n return move_not_inwards(a.args[0]) # ~~A ==> A\n if a.op == '&':\n return associate('|', list(map(NOT, a.args)...
[ "0.7014344", "0.67270255", "0.67089146", "0.66761416", "0.65632993", "0.6499719", "0.6480664", "0.64359766", "0.6402608", "0.63285017", "0.62846863", "0.6189025", "0.61776584", "0.6172551", "0.6166583", "0.6166461", "0.6135034", "0.6108762", "0.6076907", "0.60716355", "0.6068...
0.0
-1
Tests if expr is a subterm.
def __contains__(self, expr): if expr in self.args: return True if isinstance(expr, self.__class__): if all(arg in self.args for arg in expr.args): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_subcase_count(node):\n if not isinstance(node, BinaryExpression):\n return False\n\n return isinstance(node.left, FunctionCall) and node.left.name == 'subcase-count'", "def isSub(unit):\n\treturn unit.name == SUB", "def add_sub(expr):\n \n if expr.__class__ == add_t and e...
[ "0.6293137", "0.60811734", "0.5937802", "0.5775162", "0.5655049", "0.56421906", "0.55858606", "0.5568405", "0.5565319", "0.5481275", "0.5379361", "0.53705746", "0.5321574", "0.5298493", "0.5266185", "0.5239378", "0.5212744", "0.51564556", "0.5116466", "0.510957", "0.5073269",...
0.55350804
9
Transform a expression into its normal form in the given operation. Returns a tuple of arguments that will satisfy the condition operation(args) == expr (here mathematical equality is meant) and the operation doesn't occur in any arg. Also NOT is only appearing in literals.
def normalize(operation, expr): dualoperation = operation.getdual() # Move NOT inwards. expr = expr.literalize() # Simplify as much as possible, otherwise rdistributive may take # forever. expr = expr.eval() # Totally flatten everything. def rdistributive(expr): if expr.islitera...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eliminate_implications(s):\n s = expr(s)\n if not s.args or is_symbol(s.op):\n return s # Atoms are unchanged.\n args = list(map(eliminate_implications, s.args))\n a, b = args[0], args[-1]\n if s.op == '==>':\n return b | ~a\n elif s.op == '<==':\n return a | ~b\n eli...
[ "0.64206797", "0.6372073", "0.60259515", "0.5991975", "0.5991975", "0.5907328", "0.5854755", "0.58323956", "0.5697199", "0.5696819", "0.5631535", "0.5620482", "0.5605888", "0.5541284", "0.54581624", "0.53473026", "0.53285027", "0.5270289", "0.52539605", "0.5246812", "0.523729...
0.69726986
0
Returns a boolean expression created from the given string.
def parse(expr, eval=True): if not isinstance(expr, str): raise TypeError("Argument must be string but it is %s." % expr.__class__) def prime_to_tilde(expr): """ Converts all NOTs in tilde notation into prime notation. This allows for parse to be reused without the need of rewr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string2boolean_parser(string):\n\n string = string.lower()\n if string == 'true' or string == 't':\n return True\n elif string == 'false' or string == 'f':\n return False\n else:\n raise ValueError", "def bool(string):\n if string == \"True\":\n return True\...
[ "0.7016499", "0.6909879", "0.6830348", "0.68165165", "0.67624104", "0.6756125", "0.6693887", "0.65889263", "0.6579974", "0.65720475", "0.6541178", "0.6530949", "0.64946187", "0.6476598", "0.64514345", "0.6450474", "0.6450474", "0.64474934", "0.6437962", "0.64266807", "0.63847...
0.0
-1
Generates a DynamoDB data source for the given GraphQL type. This includes the Dynamo table, the AppSync data source, a data source role, and the resolvers.
def generate_dynamo_data_source(type_name): table = dynamodb.Table(f"{stack_name}_{type_name}_table", name=f"{stack_name}.{type_name}", hash_key="id", attributes=[ { "name": "id", "type": "S" } ]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GenerateData(args):\n module = dataplex_api.GetMessageModule()\n\n if args.IsSpecified('data_source_entity'):\n data = module.GoogleCloudDataplexV1DataSource(\n entity=args.data_source_entity\n )\n else:\n data = module.GoogleCloudDataplexV1DataSource(\n resource=args.data_source_reso...
[ "0.54411715", "0.51296073", "0.5117157", "0.50982594", "0.50589913", "0.49850225", "0.49394158", "0.48938885", "0.48303893", "0.48168674", "0.48114678", "0.48084015", "0.48062772", "0.47870824", "0.4770506", "0.47591802", "0.47573555", "0.47568837", "0.47480223", "0.47480223", ...
0.7606733
0
Creates AppSync resolvers for the given GraphQL type. Resolvers are created by iterating through the `resolvers` directory in the API's build folder and parsing the resolver template filenames to find the operation name and type.
def generate_resolvers(type_name, data_source): resolvers_dir = amplify_api_build_dir.joinpath("resolvers") resolvers = [] for req_file in resolvers_dir.iterdir(): regex_match = match(f"^([a-zA-Z]+)\.([a-zA-Z]+{type_name}s?)\.req\.vtl$", str(req_file.name)) if regex_match: oper...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def composer(name: str):\n stub = os.path.dirname(__file__) + '/stubs/composer.py'\n dest = uvicore.config('app.paths.view_composers') + '/' + name + '.py'\n\n Schematic(\n type='composer',\n stub=stub,\n dest=dest,\n replace = [\n ('xx_composername', name),\n ...
[ "0.47839177", "0.45985514", "0.4473586", "0.43984318", "0.43775064", "0.4336256", "0.43114826", "0.42961687", "0.42722246", "0.42505383", "0.42490014", "0.41834491", "0.41614208", "0.4155192", "0.4143386", "0.41317067", "0.41145274", "0.41041583", "0.40865377", "0.40650433", ...
0.7782825
0
Test that if we do not already have a connection, self.connection creates and returns an HTTPConnection
def test_connection_not_cached(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __connect(self):\n c = self.credientials\n if self.debug:\n return httplib.HTTPSConnection(c.get(\"testhost\"))\n else:\n return httplib.HTTPSConnection(c.get(\"host\"))", "def _http_connection(netloc):\n return closing(HTTPConnection(netloc))", "def create...
[ "0.7100121", "0.70072365", "0.6986192", "0.6734626", "0.64237654", "0.6410882", "0.62992716", "0.620972", "0.6208129", "0.6200346", "0.61817396", "0.6123818", "0.610926", "0.60994554", "0.6080636", "0.60798305", "0.6071361", "0.6067177", "0.6054329", "0.60346365", "0.6022378"...
0.5588935
67
Show add_exercise view as landing page, may change this
def index(): if request.form and session.get('user'): add_exercise() return redirect("/add_exercise") else: flash('Please log in') return render_template("add_exercise.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_exercise_form():\n\tif request.form:\n\t\tif session.get('user'):\n\t\t\tadd_exercise()\n\t\t\treturn redirect(\"/add_exercise\")\n\t\telse:\n\t\t\tflash('Please Login Sir or Ma\\'am')\n\t\t\treturn redirect(\"/login\")\n\telse:\n\t\treturn render_template(\"add_exercise.html\")", "def allex():\n # ro...
[ "0.67488056", "0.65954745", "0.6564511", "0.65233195", "0.6505743", "0.644662", "0.62954164", "0.62394446", "0.6213993", "0.61948276", "0.619401", "0.6191051", "0.61865515", "0.6141062", "0.6132728", "0.612814", "0.6106665", "0.6104015", "0.6102374", "0.60711384", "0.606396",...
0.753211
0
Get the state this ticket is going to be in.
def _get_state(self, req, ticket): if 'action' not in req.args: return 'new' action = req.args['action'] action_changes = {} for controller in self._get_action_controllers(req, ticket, action): action_changes.update(controller.get_ticket_changes(req, ticket, ac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state(self):\r\n \r\n return self.state", "def get_state(self):\n return self.state", "def get_state(self):\n return self.state", "def get_state(self):\n return self.state", "def get_state(self):\n return self.state", "def get_state(self):\n return...
[ "0.789179", "0.7839977", "0.7839977", "0.7839977", "0.7839977", "0.7839977", "0.7826733", "0.77396816", "0.7681725", "0.7681725", "0.76809764", "0.7655763", "0.7642758", "0.76404583", "0.7640288", "0.7640288", "0.7595301", "0.7590753", "0.75847703", "0.7510439", "0.7457553", ...
0.0
-1
pad_batch_tensorize double pad and turn it to one hot vector
def double_pad_batch_tensorize(inputs, pad, cuda=True): #tensor_type = torch.cuda.LongTensor if cuda else torch.LongTensor tensor_type = torch.cuda.FloatTensor if cuda else torch.FloatTensor batch_size = len(inputs) max_sent_num = max([len(labels) for labels in inputs]) max_side_num = max([labels[-1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_collate(batch: List, padding_value: int = 0):\n data, labels = zip(*batch)\n\n return (pad_sequence(data, batch_first=True, padding_value=padding_value),\n torch.tensor(labels),\n torch.tensor([len(element) for element in data]))", "def _pad_batch_func(input_tensor_dict):\n ...
[ "0.6935554", "0.6535754", "0.65140796", "0.64349777", "0.6433654", "0.6340582", "0.62738407", "0.624955", "0.62192184", "0.62146914", "0.6201872", "0.6190966", "0.6185979", "0.61797947", "0.61677396", "0.6150906", "0.6126177", "0.61172354", "0.6113055", "0.6113055", "0.608821...
0.7711533
0
Transform image to greyscale and blur it
def prepare_image(img): img = img.filter(ImageFilter.SMOOTH_MORE) img = img.filter(ImageFilter.SMOOTH_MORE) if 'L' != img.mode: img = img.convert('L') return img
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blur(img):\n\n new_img = SimpleImage.blank(img.width, img.height)\n\n for r in range(img.height):\n for c in range(img.width):\n pixel = img.get_pixel(c, r)\n pixel_blur = new_img.get_pixel(c, r)\n new_pixel = get_blur_color(c, r)\n pixel_blur.red = new_...
[ "0.79438066", "0.7523611", "0.75187737", "0.74052536", "0.7397123", "0.7366231", "0.73201275", "0.72513026", "0.7233079", "0.7147886", "0.71416485", "0.71363753", "0.71252906", "0.70584375", "0.7041742", "0.70276815", "0.7027614", "0.7017013", "0.6968893", "0.69644", "0.69618...
0.0
-1
Instantiate the ball in the middle of the field
def test_ball_instantiate_in_middle_of_field(self): x = (FIELD_WIDTH - entities.Ball.WIDTH) / 2.0 y = (FIELD_HEIGHT - entities.Ball.HEIGHT) / 2.0 ball = entities.Ball(Vector2(x, y)) self.assertEqual(ball.location.x, x) self.assertEqual(ball.location.y, y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_ball(space):\n mass = 1\n radius = 14\n inertia = pymunk.moment_for_circle(mass, 0, radius, (0,0))\n body = pymunk.Body(mass, inertia)\n x = random.randint(120,380)\n body.position = x, 550\n shape = pymunk.Circle(body, radius, (0,0))\n shape.collision_type = 0\n space.add(body, ...
[ "0.764528", "0.71239597", "0.68977195", "0.66491306", "0.65819734", "0.6559781", "0.652672", "0.6504334", "0.64864296", "0.64042765", "0.6385862", "0.6366208", "0.6315281", "0.6283165", "0.6238968", "0.62350893", "0.6223227", "0.62171704", "0.6208272", "0.6190833", "0.6170143...
0.75552356
1
The ball's heading should flip on the Y axis; from going up to going down
def test_update(self): self.ball.update(TICK_SECOND) self.assertEqual(self.ball.heading.y, self.heading.y * -1) self.assertEqual(self.ball.location.y, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_ball_direction_vertical(ai_settings, balls):\n for ball in balls.sprites():\n ball.rect.y -= ai_settings.ball_speed_factor\n ai_settings.ball_y_direction *= -1", "def bounce_y(self):\n # Negates the ball's y movement so the ball changes y direction\n self.y_move *= -1", "d...
[ "0.7355142", "0.69849104", "0.6769931", "0.67538756", "0.64695996", "0.6463927", "0.63145554", "0.6297361", "0.6273855", "0.6221664", "0.61908764", "0.61544853", "0.6085613", "0.60244495", "0.60103846", "0.60022223", "0.5999459", "0.59769905", "0.59488875", "0.5940781", "0.59...
0.6002551
15
The ball's heading should flip on the Y axis; from going up to going down
def test_update(self): self.ball.update(TICK_SECOND) self.assertEqual(self.ball.heading.y, self.heading.y * -1) self.assertEqual(self.ball.location.y, FIELD_HEIGHT - self.ball.HEIGHT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_ball_direction_vertical(ai_settings, balls):\n for ball in balls.sprites():\n ball.rect.y -= ai_settings.ball_speed_factor\n ai_settings.ball_y_direction *= -1", "def bounce_y(self):\n # Negates the ball's y movement so the ball changes y direction\n self.y_move *= -1", "d...
[ "0.73527", "0.69816273", "0.6767314", "0.6752928", "0.6473949", "0.64614886", "0.63175416", "0.62973017", "0.6272597", "0.62223816", "0.6195932", "0.6153834", "0.608428", "0.6020503", "0.60105956", "0.6002746", "0.60027117", "0.599895", "0.5977892", "0.59490716", "0.5939289",...
0.5837877
23
Convert the integer UTC time value into a local datetime.
def _utc_int_to_local_datetime(cls, utc_int): if utc_int is None: return None # Convert from a UTC integer (seconds since the epoch) to a UTC datetime datetime_utc = datetime.utcfromtimestamp(0) + timedelta(seconds=utc_int) # Get the offset from UTC to local timestamp = time.mktime(datetime_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_datetime_local(self):\r\n r=datetime_utc_to_local(self.timestamp)\r\n return r", "def datetime_from_utc_to_local(utc_datetime):\n now_timestamp = time.time()\n offset = datetime.datetime.fromtimestamp(now_timestamp) - datetime.datetime.utcfromtimestamp(now_timestamp)\n ...
[ "0.7287791", "0.6993242", "0.6851847", "0.67215997", "0.6640397", "0.66037625", "0.65990347", "0.6561572", "0.65302545", "0.64751273", "0.64541495", "0.6412276", "0.6345563", "0.62795705", "0.62174153", "0.6208142", "0.6187865", "0.6171931", "0.61192554", "0.60908204", "0.608...
0.7799947
0
Return the h user for the given username.
def get_user(self, username): userid = HUser(username).userid(self._authority) user_info = self._api_request("GET", path=f"users/{userid}").json() return HUser(username=username, display_name=user_info["display_name"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(self, username):\n return self._get_user(username)", "def get_user(cls, username):\n key = ndb.Key(User, username.lower())\n u = key.get()\n return u", "def get_user(self, username) -> User:\n raise NotImplementedError", "def get_user(self, username) -> User:\n...
[ "0.8029973", "0.7884502", "0.7774306", "0.7774306", "0.77536786", "0.77012044", "0.76102257", "0.7587355", "0.7584093", "0.7583267", "0.7559522", "0.75310534", "0.7522954", "0.7476872", "0.74278116", "0.7380655", "0.73407394", "0.73364395", "0.72698706", "0.72665924", "0.7264...
0.854891
0
Round time to the nearest base so that minute hand on time will look nicer in db
def round_time(time_string, base=5): rounded = str(base * round(int(time_string)/base)) if len(rounded) == 1: rounded = "0" + rounded return rounded
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def round_time(self):\n return round(self.time, ROUND_VALUE)", "def _round_up_to_current_fifteen_minutes(time: datetime) -> datetime:\n minutes = time.minute\n minute = 0\n for min in range(0, 61, TIME_DIFFERENCE):\n if minutes >= min and minutes < min + TIME_DIFFERENCE:\n minut...
[ "0.7360396", "0.6912254", "0.6809872", "0.6690823", "0.66849995", "0.66204447", "0.6580171", "0.65569526", "0.6545864", "0.6543773", "0.6530702", "0.6506811", "0.64517695", "0.6281595", "0.6230073", "0.61485994", "0.61306703", "0.60889816", "0.60885656", "0.6048147", "0.59739...
0.7664617
0
This code takes a dataframe generated by utils.getThermoStats and computes the bulk modulus of the values.
def calcBulkModT(self): V,dV,P,dP,dPdV,ddPdV,midV = self.getForwDif("Volume","Press") N = len(midV) bM = np.zeros(N) #Initializing Bulk Modulus dbM = np.zeros(N)# Uncertainty in bM dmidV = np.zeros(N) # Uncertainty in midV bM = [-V[i]*dPdV[i] for i in range(len(dPdV))] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def motion_24_friston(dataframe):\n\n motion_24_friston = dataframe \n\n for col in dataframe.columns:\n temp_diff = np.roll(dataframe[col], 1, axis = 0)\n temp_diff[0] = 0\n temp_diff = pd.DataFrame(temp_diff)\n motion_24_friston[col + '_td'] = temp_diff\n \n for col in mot...
[ "0.5753569", "0.5530064", "0.5444359", "0.5377394", "0.53695637", "0.5310466", "0.52813596", "0.52265686", "0.5224954", "0.5179566", "0.5142311", "0.5137676", "0.51048744", "0.50824255", "0.50788367", "0.50660676", "0.505232", "0.5046905", "0.5034696", "0.50300723", "0.502617...
0.55842185
1
This code takes a dataframe generated by utils.getThermoStats and computes the heat capacity of the values for constant volume.
def calcHeatCapV(self): T,dT,E,dE,dEdT,ddEdT,midT = self.getForwDif("Temp","TotEng") dmidT = np.array((1/2)*sqrt(dT[i+1]**2 + dT[i]**2) for i in range(len(dT) - 1)) return dEdT,ddEdT,T[:-1],dT[:-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volumetric_heat_capacity(self):\n return self.rho * self.cp", "def specific_heat_capacity(self):\n return self.fluid.specific_heat(self.T_C)", "def constant_volume_heat_capacity(partition, temperature,\n scale_factor=const.N_A, *, d_t=1E-4):\n return (\n ...
[ "0.7096447", "0.69610363", "0.6586265", "0.63652617", "0.6029112", "0.588522", "0.58675295", "0.58562577", "0.58557236", "0.58093643", "0.5808291", "0.57367253", "0.56946135", "0.5688899", "0.5642055", "0.56279635", "0.5584205", "0.55439806", "0.55332375", "0.55164295", "0.55...
0.5711716
12
Return a unique identifier for this element.
def elemid(obj): return '%s-%s' % (obj.__class__.__name__, obj.pk)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_id(self) -> str:\n return self._id", "def unique_id(self) -> str:\n return self._id", "def unique_id(self) -> str:\n return self._name", "def unique_id(self) -> str:\n return self._unique_id", "def unique_id(self) -> str:\n return self._unique_id", "def uniqu...
[ "0.83958346", "0.83958346", "0.8279597", "0.8278677", "0.8278677", "0.8278677", "0.8278677", "0.82710254", "0.80993575", "0.80993575", "0.80993575", "0.8080669", "0.8052915", "0.8037063", "0.80260015", "0.80260015", "0.80260015", "0.80260015", "0.80260015", "0.80260015", "0.8...
0.0
-1
Check if there is a NaN in a trajectory's TrajDataFrame.
def check_nan(tdf): if not tdf['tile_ID'].isna().values.any(): return tdf else: tdf['tile_ID'] = -1 return tdf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_has_nulls(self):\n return self.df.isnull().any()", "def isna(self):\n # TODO: revisit definition of missingness\n return rows_na(self.data, axis=1) & rows_na(self.time_index, axis=1)", "def isna(obj):\n if isinstance(obj, BasePandasDataset):\n return obj.isna()\n else...
[ "0.785191", "0.71731615", "0.7057204", "0.70311284", "0.69941074", "0.69449306", "0.6841854", "0.68179697", "0.6798761", "0.6790535", "0.6787635", "0.6692254", "0.6595813", "0.65779173", "0.65757746", "0.6560879", "0.65301585", "0.6521442", "0.65054286", "0.6471967", "0.64717...
0.72492695
1
The license for CuteKitchen.
def license(): return generic_path_render("outside/license/license.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def license(self):\n return self.__license", "def license(self):\n # type: () -> string_types\n return self._license", "def license(self):\n return self._license", "def license(self) -> Optional[str]:\n return pulumi.get(self, \"license\")", "def show_license():\n clic...
[ "0.80647874", "0.79536515", "0.79137695", "0.7909224", "0.7396715", "0.737765", "0.73648727", "0.72108746", "0.70759875", "0.70511717", "0.70407194", "0.693974", "0.6904796", "0.68718046", "0.68190974", "0.67832756", "0.67062443", "0.6705101", "0.6698921", "0.6686568", "0.666...
0.7623517
5
return the generator of all combinations of the given length from all odd numbers x , where start <= x <= end
def _get_odds_cb_gen(start, end, length): first_odd = start if start % 2 == 1 else start + 1 odds_gen = range(first_odd, end + 1, 2) odds_cb_gen = _cb(odds_gen, length) return odds_cb_gen
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lgen(even=False, nmax=1000000):\n start = 2 if even else 1\n n, lst = 1, list(range(start, nmax + 1, 2)) # List full of odd numbers \n len_lst = len(lst)\n yield lst[0]\n\n print(lst)\n \n while n < len_lst and lst[n] <= len_lst:\n yield lst[n]\n print(lst[n], \"it's oouuuu...
[ "0.66002697", "0.65953046", "0.6572099", "0.6465878", "0.6454783", "0.64414835", "0.6399674", "0.6366528", "0.63378143", "0.63123083", "0.63077766", "0.6204774", "0.61998266", "0.6198215", "0.61893606", "0.61201155", "0.6110097", "0.6108009", "0.61016536", "0.6081841", "0.607...
0.7149351
0
return the generator of all combinations of the given length from all even numbers x , where start <= x <= end
def _get_evens_cb_gen(start, end, length): first_even = start if start % 2 == 0 else start + 1 evens_gen = range(first_even, end + 1, 2) evens_cb_gen = _cb(evens_gen, length) return evens_cb_gen
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_odds_cb_gen(start, end, length):\n\tfirst_odd = start if start % 2 == 1 else start + 1\n\todds_gen = range(first_odd, end + 1, 2)\n\todds_cb_gen = _cb(odds_gen, length)\n\n\treturn odds_cb_gen", "def combinations(iterable, r):\n # combinations('ABCD', 2) --> AB AC AD BC BD CD\n # combinations(rang...
[ "0.6723464", "0.6614742", "0.6528314", "0.6473863", "0.647177", "0.63887125", "0.633931", "0.6318152", "0.6306071", "0.629302", "0.62815595", "0.6258895", "0.6250308", "0.6239719", "0.6233862", "0.6161872", "0.6157212", "0.61569196", "0.6137793", "0.6115061", "0.6109726", "...
0.61717224
15
transform a date into a unix day number
def unix_time(self,dt): epoch = datetime.datetime.utcfromtimestamp(0) delta = dt - epoch return delta.total_seconds()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ephem2unix(date):\n return int(86400 * (date - ephem.date('1970/1/1')))", "def convert_unix_date_format(dt):\n return int(datetime.strptime(dt, \"%Y-%m-%d\").timestamp())", "def get_num_date(date):\n day = date[0]\n month = date[1]\n year = date[2]\n days_index = 10000 * year + 100 * mont...
[ "0.7336247", "0.71744317", "0.7005251", "0.69694674", "0.6963574", "0.6937913", "0.6823916", "0.67831016", "0.67193145", "0.6696966", "0.6692409", "0.66828203", "0.66824985", "0.6564022", "0.6554016", "0.6465615", "0.64400226", "0.64064074", "0.6316674", "0.63158715", "0.6311...
0.0
-1
Function to add a planet to the solar system.
def add_planet(self, name, angle, radius, period): tmp_planet = Planet(name, angle, radius, period) tmp_planet.upadate_position(self._time) self._planets.append(tmp_planet)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_planet(self, planet: Planet) -> None:\n planet.parent = self\n self._children.append(planet)", "def test_run_with_planet(self):\n tso = TestTSO(add_planet=True)", "def test_run_with_planet(self):\n tso = ModelTSO(add_planet=True)", "def test_run_with_planet(self):\n ...
[ "0.7845235", "0.71874803", "0.7154906", "0.6829599", "0.6818092", "0.6384912", "0.63138914", "0.62184024", "0.58803433", "0.5848799", "0.5809626", "0.5717927", "0.5673721", "0.5642412", "0.55813813", "0.5546456", "0.5420955", "0.5392508", "0.53712815", "0.53537637", "0.528916...
0.7455431
1
Test robustness of FitPolynomialTask in the presence of junk We add a bunch of junk and see how FitPolynomialTask behaves, both when it knows where the junk is, and when it has to find the junk itself.
def testRobust(self, badFrac=0.25): coeffs = (1234.567, 1.2345, -0.12345) noise = 0.321 self.config.order = 3 data = self.makeData(coeffs, noise) num = len(data.xx) bad = np.zeros_like(data.xx, dtype=bool) bad[self.rng.randint(num, size=int(badFrac*num))] = True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_setup_polynomial_no_x(small_data):\n y, x, *_ = _algorithm_setup._setup_polynomial(small_data)\n\n assert isinstance(x, np.ndarray)\n assert_array_equal(x, np.linspace(-1, 1, y.shape[0]))", "def testBasic(self, coeffs, noise):\n data = self.makeData(coeffs, noise)\n self.config.or...
[ "0.6057688", "0.5731919", "0.57258856", "0.5649879", "0.56384414", "0.5635473", "0.5549834", "0.5540172", "0.5526797", "0.55218315", "0.5517265", "0.5507056", "0.5499215", "0.54967797", "0.5481986", "0.54451215", "0.5434121", "0.54275286", "0.5402606", "0.53996634", "0.539431...
0.71907574
0
Test easing off the rejection This feature guards against rejecting all the data. We make a bimodal distribution of points, and set the rejection threshold very small, so ordinarily all the points would be rejected.
def testEaseOff(self): xx = np.arange(1000, dtype=int) yy = 0.5 + 1.0*(xx % 2) self.config.order = 0 self.config.rejThresh = 0.1 self.config.easeOff = 0 with self.assertRaises(RuntimeError): result = self.task.run(xx, yy) self.config.easeOff = 3 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rejection_sampling(self, num_steps=1):\n z_ = torch.rand((num_steps, 2), dtype=self.image.dtype, device=self.image.device)\n prob = torch.rand(num_steps, dtype=self.image.dtype, device=self.image.device)\n ind = (z_ * (self.image_size - 1)).long()\n intensity = self.image[ind[:, 0],...
[ "0.6427502", "0.63268536", "0.6213933", "0.6018284", "0.5975409", "0.5970582", "0.59509265", "0.5941649", "0.5862265", "0.57548255", "0.5721333", "0.5709083", "0.56754476", "0.561376", "0.55871457", "0.5564228", "0.55641526", "0.5544663", "0.5536972", "0.55301964", "0.5496533...
0.0
-1
Calculates the gradient penalty loss for WGAN GP
def global_compute_gradient_penalty(self, D, real_samples, fake_samples): # Random weight term for interpolation between real and fake samples Tensor = torch.cuda.FloatTensor alpha = Tensor(np.random.random((real_samples.size(0), 1, 1, 1))).cuda() # Get random interpolation between real and fake samples ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loss_gradients(forward_info, W):\n batch_size = forward_info['X'].shape[0]\n \n #L = np.power(Y - P,2)\n dLdP = -2 * (forward_info['y'] - forward_info['P'])\n \n #P = np.dot(X,W) + B = X.W + B = N + B \n #dPbN = B #constant\n #N = np.dot(X,W)\n dPdN = np.ones_like(forward_info['N'])\...
[ "0.7249316", "0.72169995", "0.7151837", "0.71505266", "0.7141581", "0.7069998", "0.7018755", "0.6997957", "0.6972993", "0.6968627", "0.69229525", "0.6882534", "0.6861737", "0.6838044", "0.68380105", "0.6828631", "0.68209356", "0.68069786", "0.6804284", "0.680114", "0.6797113"...
0.0
-1
Calculates the gradient penalty loss for WGAN GP
def local_compute_gradient_penalty(self, D, real_samples, fake_samples): # Random weight term for interpolation between real and fake samples Tensor = torch.cuda.FloatTensor alpha = Tensor(np.random.random((real_samples.size(0), 1, 1, 1))).cuda() # Get random interpolation between real and fake samples...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loss_gradients(forward_info, W):\n batch_size = forward_info['X'].shape[0]\n \n #L = np.power(Y - P,2)\n dLdP = -2 * (forward_info['y'] - forward_info['P'])\n \n #P = np.dot(X,W) + B = X.W + B = N + B \n #dPbN = B #constant\n #N = np.dot(X,W)\n dPdN = np.ones_like(forward_info['N'])\...
[ "0.7251111", "0.7217685", "0.71515447", "0.7151396", "0.7143271", "0.7070653", "0.70194197", "0.6996876", "0.6973477", "0.6968773", "0.6921727", "0.68831366", "0.6859768", "0.6839016", "0.68388957", "0.6829186", "0.6822236", "0.680637", "0.6805507", "0.6802409", "0.6796462", ...
0.0
-1
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary dst_site_name = dictionary.get('dstSiteName') dst_site_uuid = dictionary.get('dstSiteUuid') dst_site_web_url = dictionary.get('dst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(cls, dictionary):\n return cls(**dictionary)", "def create(cls, dictionary):\n return cls(**dictionary)", "def from_dictionary(cls,\r\n dictionary):\r\n if dictionary is None:\r\n return None\r\n\r\n # Extract variables from the dictionar...
[ "0.8168118", "0.8168118", "0.81387204", "0.80260164", "0.8004128", "0.79881746", "0.79450303", "0.7879887", "0.7842279", "0.7836853", "0.78155565", "0.7809863", "0.7801973", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407"...
0.0
-1
Returns the IP address of the current node.
def get_node_ip(self): if "node_ip" not in self.__dict__: self.node_ip = ray._private.services.get_node_ip_address() return self.node_ip
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node_ip(self):\n return ray._private.services.get_node_ip_address()", "def ip_address(self) -> str:\n return pulumi.get(self, \"ip_address\")", "def ip_address(self) -> str:\n return pulumi.get(self, \"ip_address\")", "def ip_address(self) -> str:\n return pulumi.get(self,...
[ "0.8608388", "0.7954593", "0.7954593", "0.7954593", "0.7954593", "0.7954593", "0.7954593", "0.7954593", "0.7954593", "0.7954593", "0.7954593", "0.79170084", "0.7843283", "0.7800886", "0.77272993", "0.7676619", "0.7676619", "0.7676238", "0.76524913", "0.76334697", "0.7629631",...
0.8394604
1
Returns the OAuth scope.
def scope(self): return self._scope
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oauth_scopes(self) -> Optional[Sequence[str]]:\n return pulumi.get(self, \"oauth_scopes\")", "def oauth_scopes(self) -> Optional[Sequence[str]]:\n return pulumi.get(self, \"oauth_scopes\")", "def oauth_scopes(self) -> Optional[Sequence[str]]:\n return pulumi.get(self, \"oauth_scopes\")...
[ "0.7494001", "0.7494001", "0.7494001", "0.7494001", "0.74935323", "0.74935323", "0.74935323", "0.74935323", "0.74935323", "0.74935323", "0.74935323", "0.74935323", "0.74935323", "0.74935323", "0.74935323", "0.74935323", "0.74935323", "0.74935323", "0.74935323", "0.74935323", ...
0.65498644
93
Compute checksum of file.
def checksum(self, chunk_size=None, progress_callback=None, **kwargs): fp = self.open(mode="rb") try: value = self._compute_checksum( fp, size=self._size, chunk_size=None, progress_callback=progress_callback, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Checksum(file_name):\n return Database.ChecksumForText(file_utils.ReadFile(file_name))", "def checksum(fname):\n return hash_bytestr_iter(file_as_blockiter(open(fname, 'rb')), hashlib.sha256())", "def calculate_checksum(filename):\n m = hashlib.new(constants.DEFAULT_HASHLIB)\n with open(filenam...
[ "0.79333824", "0.77278024", "0.77260894", "0.7702381", "0.7626049", "0.74599075", "0.74515074", "0.74470776", "0.73617965", "0.733138", "0.7319144", "0.72891283", "0.7236507", "0.7186504", "0.7155788", "0.7127667", "0.7023843", "0.7019137", "0.7002179", "0.6989742", "0.696594...
0.6504897
49
View function for home page.
def index(request): # Render the HTML template index.html with the data in the context variable return render(request, 'index.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n\t\n return render(request, 'base/home.html')", "def home(request):\r\n return render(request, 'home.html')", "def home():\n\treturn render_template('home.html')", "def home(request):\n return render_to_response(\"home.html\", {\n \n }, context_instance=RequestContext(r...
[ "0.8624976", "0.85270166", "0.85128987", "0.8480253", "0.8461587", "0.84556156", "0.8429327", "0.84283227", "0.8426117", "0.83920974", "0.83885175", "0.8377646", "0.8377646", "0.8353728", "0.8350181", "0.83480984", "0.8308283", "0.8308283", "0.8308283", "0.8308283", "0.830828...
0.0
-1
Indicates if this notification service expects extra config or not.
def requires_extra_config(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_extra_config(self, config):\n pass", "def is_additional_configuration_required(self) -> bool:\n if self.has_sub_profiles and self.sub_profile is None:\n return True\n if self.needs_fixed_config:\n return True\n return False", "def extra_config(self...
[ "0.7522945", "0.7054419", "0.69495463", "0.6485183", "0.6419135", "0.6180537", "0.6140998", "0.6110256", "0.61046153", "0.5921833", "0.58682436", "0.5819311", "0.5778188", "0.57498443", "0.57498443", "0.57471544", "0.57398486", "0.5724023", "0.57234657", "0.57234657", "0.5723...
0.77560353
0
Sets up data for the tests.
def setup_data(es_with_collector): country_uk = constants.Country.united_kingdom.value.id country_us = constants.Country.united_states.value.id country_anguilla = constants.Country.anguilla.value.id uk_region = constants.UKRegion.south_east.value.id CompanyFactory( name='abc defg ltd', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_test_data(self, *args, **kwargs) -> None:\n pass", "def setUpTestData(cls):\n pass", "def setUpTestData(cls):\n data_gen.run()", "def setUpTestData(cls):\n data_gen.run()", "def setUpTestData(cls):\n cls._db_aliases = test_utils.get_db_aliases()", "def setUp(s...
[ "0.85304207", "0.8152717", "0.8057943", "0.8057943", "0.7983634", "0.7906009", "0.7792726", "0.7780673", "0.7780673", "0.775312", "0.7673094", "0.7540556", "0.7511164", "0.7458675", "0.7443754", "0.7411682", "0.7410135", "0.74000895", "0.7383548", "0.73790586", "0.73780394", ...
0.0
-1