query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Finds a items in a shopcart based on the shopcart item id provided
def find(cls, item_id): cls.logger.info("Processing lookup for shopcart item id %s ...", item_id) return cls.query.get(item_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_by_id(object_id, items):\n for item in items:\n if object_id == item[\"id\"]:\n return item\n\n raise Exception(f\"Item with {object_id} not found\")", "def find_item_by_id(self, item_id: str) -> ClientWorklistItem:\n # print(f'Finding item with id {item_id}')\n sel...
[ "0.72068936", "0.7161496", "0.6994926", "0.6827417", "0.6820161", "0.672863", "0.6563946", "0.6532324", "0.6524091", "0.63743305", "0.6335048", "0.6279147", "0.62637603", "0.6261255", "0.6179372", "0.6164789", "0.61519736", "0.61519736", "0.60507023", "0.6040707", "0.6030221"...
0.7806043
0
Finds a items in a shopcart based on the shopcart id and sku id provided
def find_by_sku_and_sid(cls, sku, sid): cls.logger.info( "Processing lookup for shopcart item with sku %s and sid %s", str(sku), str(sid) ) return cls.query.filter_by(sid=sid).filter_by(sku=sku).first()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_by_sku(cls, sku: int):\n cls.logger.info(\"Processing sku query for %s ...\", sku)\n return cls.query.filter(cls.sku == sku).order_by(cls.id).all()", "def find(cls, item_id):\n cls.logger.info(\"Processing lookup for shopcart item id %s ...\", item_id)\n return cls.query.get(...
[ "0.698353", "0.65687984", "0.6552062", "0.64504516", "0.64365184", "0.62305814", "0.6212393", "0.6193556", "0.6191495", "0.611413", "0.6089563", "0.59819525", "0.594802", "0.5902748", "0.58571416", "0.5855772", "0.57699645", "0.57411164", "0.5729211", "0.5712144", "0.5701182"...
0.7568256
0
Interprets a layer from a given layout for an aux network and generates the specified layers.
def interpret_layout(aux_layer, input, id=-1, aux_weight_decay=3e-4): if aux_layer[0] == 'cbr': filters = 256 kernel_size = (3, 3) strides = (1, 1) if len(aux_layer) > 1: filters = aux_layer[1] if len(aux_layer) > 2: kernel_size = (aux_layer[2], aux_layer[2]) if len(aux_layer) > 3: strides = (aux_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aux_net(input, num_coarse_classes, id=0, aux_layout=None, aux_weight_decay=3e-4):\n\tfor layer in aux_layout:\n\t\tinput = interpret_layout(layer, input, id=id, aux_weight_decay=aux_weight_decay)\n\n\tinput = Dense(num_coarse_classes, name='aux_output' + str(id), activation='softmax')(input)\n\treturn input", ...
[ "0.6894786", "0.5946718", "0.5918659", "0.57725006", "0.57571197", "0.5744258", "0.5696059", "0.5669251", "0.55825245", "0.5545148", "0.5528999", "0.5525612", "0.5518188", "0.5490324", "0.54839283", "0.54819405", "0.5451555", "0.544451", "0.5405276", "0.5395078", "0.5368853",...
0.7332984
0
Returns a sprite image consisting of images passed as argument. Images should be count x width x height
def create_sprite_image(images): if isinstance(images, list): images = np.array(images) images = images.reshape([images.shape[0], images.shape[1], images.shape[2]]) img_h = images.shape[1] img_w = images.shape[2] n_plots = int(np.ceil(np.sqrt(images.shape[0]))) plt.figure() spri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_images(self):\n return [self.get_image(i) for i in range(0, self.number_sprites - 1)]", "def get_images_from_sheet(sheet, width, height):\n sprites = []\n dest_rect = pygame.Rect((0, 0), (width, height))\n total = sheet.get_width() / width\n i = 0\n while i < total:\n image =...
[ "0.7012395", "0.6914571", "0.6670941", "0.6593173", "0.6472102", "0.64590514", "0.64368695", "0.63947475", "0.63875127", "0.6349778", "0.63277173", "0.6284437", "0.61723024", "0.6149518", "0.6114381", "0.61125886", "0.60974604", "0.60816395", "0.60454214", "0.60402775", "0.60...
0.7838497
0
Permits to hide a value from the variable's domain
def hideValue(self, value: Any) -> None: if value in self._domain: self._hiddenValue.add(value) else: raise VariableError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unhideValue(self, value: Any) -> None:\r\n if value in self._hiddenValue:\r\n self._hiddenValue.remove(value)\r\n else:\r\n raise VariableError", "def hidden(self, val):\n self.set_property(\"Hidden\", val)", "def validate_visibility(value):\n if value not in [...
[ "0.6782038", "0.63535845", "0.58242273", "0.57843626", "0.57419914", "0.568113", "0.56786615", "0.55955535", "0.5557744", "0.5522025", "0.54637635", "0.54593235", "0.543313", "0.54026675", "0.5402602", "0.5376117", "0.5365743", "0.5357342", "0.53549635", "0.53549635", "0.5342...
0.80546945
0
Permits to unhide a value from the variable's domain
def unhideValue(self, value: Any) -> None: if value in self._hiddenValue: self._hiddenValue.remove(value) else: raise VariableError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hideValue(self, value: Any) -> None:\r\n if value in self._domain:\r\n self._hiddenValue.add(value)\r\n else:\r\n raise VariableError", "def resetDomain(self) -> None:\r\n self._hiddenValue.clear()", "def hidden(self, val):\n self.set_property(\"Hidden\", v...
[ "0.7428028", "0.6470163", "0.6279896", "0.6251874", "0.60896075", "0.59496284", "0.5893593", "0.57621133", "0.5756035", "0.5707808", "0.5684089", "0.56359017", "0.56280655", "0.55982834", "0.5594381", "0.5567098", "0.5557392", "0.54952025", "0.5485452", "0.5481336", "0.548126...
0.7597665
0
Returns the document manager passed to the OptionsDialog constructor.
def GetDocManager(self): return self._docManager
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetManager(self):\r\n\r\n return self.manager", "def getManager(self):\n return self._manager", "def manager(self):\n if \"manager\" in self._prop_dict:\n if isinstance(self._prop_dict[\"manager\"], OneDriveObjectBase):\n return self._prop_dict[\"manager\"]\n ...
[ "0.63119507", "0.6261067", "0.582946", "0.5719122", "0.5658591", "0.56215465", "0.55796313", "0.5552599", "0.5450422", "0.54357135", "0.5407822", "0.539085", "0.5389986", "0.5338017", "0.5335322", "0.53101045", "0.5309024", "0.5299167", "0.52744746", "0.52717155", "0.52716357...
0.73266417
0
Calculates a given distance function between vectors u and v
def distance(self, u, v): # Implement the distance function between vectors u and v] # Note: you can also think of this as computing a similarity measure # Use of cosine similarity measure, assumes u and v have equal length num = np.dot(u,v) # den_u = np.sum(u**2) # den_v = np.sum(v*...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __dist(u, v):\n return spatial.distance.euclidean(u, v)", "def distance_metric(u, v):\n if len(u) != len(v):\n raise Exception(\n \"Distance metric not valid for differently sized vectors\")\n sum = 0.\n for i in range(len(u)):\n sum += ((u[i] - v[i]) ** 2)\n return ma...
[ "0.8126299", "0.80916023", "0.7917656", "0.76422846", "0.76043147", "0.7560202", "0.7542679", "0.7541057", "0.7514119", "0.74381447", "0.7220888", "0.72040594", "0.71462476", "0.7145333", "0.71101606", "0.7085074", "0.70238346", "0.6957934", "0.6946973", "0.6899375", "0.68172...
0.83443034
0
Generates a list of movies based on the input vector u using collaborative filtering
def recommend(self, u): # Implement a recommendation function that takes a user vector u # and outputs a list of movies recommended by the chatbot rec_list = [] for i, movie in enumerate(self.ratings): rxi = 0.0 for tup in u: j = tup[0] rxj = tup[1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_users_movies(myRatings):\n #return [x[1] for x in myRatings]\n return list(myRatings.map(lambda x: x[1]).collect())", "def preprocessingUserMovies(self):\n \n listUM = self.manager.getAllUsersMovies()\n \n usersList = np.empty(len(listUM), dtype = \"int\")\n moviesL...
[ "0.63528687", "0.5911775", "0.58507776", "0.57842404", "0.5782858", "0.5773624", "0.5639058", "0.5595368", "0.55699426", "0.55013716", "0.54875565", "0.54561055", "0.5417415", "0.5343818", "0.5324451", "0.53149116", "0.5301913", "0.52555436", "0.52552867", "0.52489233", "0.52...
0.64734787
0
Stop the thread pool; wait for pool to finish
def stop_thread_pool(cls): if cls.executor is not None: cls.executor.shutdown(wait=True) cls.executor = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self.queue.put(STOP)\n for thread in self.pool:\n thread.join()", "def end_thread_pool():\n main_thread = threading.currentThread()\n for aThread in threading.enumerate():\n if aThread is main_thread:\n continue\n aThre...
[ "0.8030248", "0.7473638", "0.729057", "0.7101794", "0.7088813", "0.7029257", "0.6931624", "0.6864362", "0.6864362", "0.6783695", "0.66925406", "0.66912174", "0.6673943", "0.66697204", "0.6619683", "0.6607162", "0.6607162", "0.6607162", "0.6607162", "0.6607162", "0.6607162", ...
0.82421356
0
Write a pv put to the put log
def write_pv_put(self, pv_name, new_value, old_value): time_now = datetime.datetime.now() time_str = time_now.strftime("%d-%b-%y %H:%M:%S") message = "{} {} {} {} {} {}".format(time_str, LOCALHOST, self._ioc_name, pv_name, new_value, old_value) self.logger.write_to_log(message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_vm_log(self, content):\n if not self.ensure_initialized():\n logger.error(\"host plugin channel is not available\")\n return\n if content is None or self.goal_state.container_id is None or self.goal_state.deployment_id is None:\n logger.error(\n ...
[ "0.6087631", "0.5985308", "0.5771085", "0.57163477", "0.57138157", "0.5658521", "0.54289305", "0.54289305", "0.54169726", "0.5404585", "0.5369223", "0.53495884", "0.5342545", "0.5294318", "0.52646804", "0.5227174", "0.5218917", "0.5198461", "0.5162123", "0.51458675", "0.51392...
0.7521677
0
Locate a root of f(x) by subdividing the original range.
def bisect(f, x1, x2, tol=1.0e-9): assert callable(f), "User-supplied function must be callable." assert x1 != x2, "Bad initial range given to bracket." f1 = f(x1) f2 = f(x2) assert f1 * f2 < 0.0, "Range does not clearly bracket a root." while abs(x2 - x1) > tol: x_mid = 0.5*(x1+x2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bisect2d(f, x1, x2, tol=1.0e-9):\n assert callable(f), \"User-supplied function must be callable.\"\n assert x1 != x2, \"Bad initial range given to bracket.\"\n f1 = f(x1)\n f2 = f(x2)\n assert f1 * f2 < 0.0, \"Range does not clearly bracket a root.\"\n while abs(x2 - x1) > tol:\n x_mi...
[ "0.65946895", "0.6446489", "0.6419146", "0.63083184", "0.6217952", "0.6149435", "0.61187816", "0.6107819", "0.60543424", "0.6036317", "0.5991405", "0.592353", "0.5916614", "0.5903087", "0.5844376", "0.58176214", "0.58127916", "0.58009446", "0.5789002", "0.5784142", "0.5763617...
0.6727693
0
Locate a root of f(x) by subdividing the original range.
def bisect2d(f, x1, x2, tol=1.0e-9): assert callable(f), "User-supplied function must be callable." assert x1 != x2, "Bad initial range given to bracket." f1 = f(x1) f2 = f(x2) assert f1 * f2 < 0.0, "Range does not clearly bracket a root." while abs(x2 - x1) > tol: x_mid = 0.5*(x1+x2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bisect(f, x1, x2, tol=1.0e-9):\n assert callable(f), \"User-supplied function must be callable.\"\n assert x1 != x2, \"Bad initial range given to bracket.\"\n f1 = f(x1)\n f2 = f(x2)\n assert f1 * f2 < 0.0, \"Range does not clearly bracket a root.\"\n while abs(x2 - x1) > tol:\n x_mid ...
[ "0.6727268", "0.64447665", "0.64182067", "0.6308255", "0.6216441", "0.61485904", "0.6116825", "0.6104715", "0.6051277", "0.6037059", "0.59908694", "0.592555", "0.59164697", "0.590178", "0.5843855", "0.581557", "0.5813352", "0.5800978", "0.5788245", "0.57822627", "0.5760519", ...
0.6594038
1
Fix equal aspect bug for 3D plots.
def set_aspect_equal_3d(ax): xlim = ax.get_xlim3d() ylim = ax.get_ylim3d() zlim = ax.get_zlim3d() xmean = mean(xlim) ymean = mean(ylim) zmean = mean(zlim) plot_radius = max([abs(lim - mean_) for lims, mean_ in ((xlim, xmean), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_axes_equal_3d(ax):\n\n limits = np.array([ax.get_xlim3d(), ax.get_ylim3d(), ax.get_zlim3d()])\n spans = np.abs(limits[:, 0] - limits[:, 1])\n centers = np.mean(limits, axis=1)\n radius = 0.5 * np.max(spans)\n ax.set_xlim3d([centers[0]-radius, centers[0]+radius])\n ax.set_ylim3d([centers[1...
[ "0.67141896", "0.6421578", "0.6421578", "0.6328374", "0.6139307", "0.60397804", "0.5962885", "0.5959633", "0.5886268", "0.584793", "0.5758814", "0.5753971", "0.5668422", "0.56459", "0.56459", "0.5632882", "0.5619555", "0.5578513", "0.5528595", "0.5485646", "0.5481223", "0.5...
0.7381928
0
This function load a csv file to MySQL table according to the load_sql statement.
def csv_to_mysql(load_sql, host, user, password): try: con = pymysql.connect(host=host, user=user, password=password, autocommit=True, local_infile=1) print('Connected to DB: {}'.f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadCSV(input_file):", "def populate_table_from_csv(csv_file, csv_encoding='iso-8859-15'):\n try:\n with open(file=csv_file, mode='r', encoding=csv_encoding) as input_file:\n # Could find a good place to add iterators/generators/comprehensions elsewhere, so made a new function\n ...
[ "0.72082055", "0.7207321", "0.712487", "0.7101685", "0.68397695", "0.68142563", "0.66798365", "0.66089433", "0.658838", "0.65071476", "0.6473633", "0.6461828", "0.645994", "0.64497226", "0.6441933", "0.64413345", "0.64203775", "0.6413361", "0.6410578", "0.63990146", "0.633394...
0.7671702
0
add L2 pooling layer to input L2norm pooling selects average of squared rectangular neighborhood & apply square root.
def l2pool(input, filter_h, filter_w, stride_h, stride_w, padding, name): with tf.name_scope(name): squared = tf.square(input) subsample = tf.nn.avg_pool(squared, ksize=[1, filter_h, filter_w, 1], strides=[1, stride_h, stride_w, 1], padding=padding) subsamp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_average_pooling_2d(x, use_cudnn=True):\n\n return F.average_pooling_2d(x, ksize=(x.shape[2], x.shape[3]), use_cudnn=use_cudnn)", "def l2(weights):\n\treturn np.sqrt(np.sum(weights * weights))", "def convert_pool2d(g, op, block):\n\n adaptive = op.attr(\"adaptive\")\n ceil_mode = op.attr(\"c...
[ "0.5871164", "0.5676643", "0.5663675", "0.5580594", "0.55603546", "0.5511111", "0.5453032", "0.5402045", "0.5380037", "0.534318", "0.53420675", "0.53215724", "0.5320973", "0.53174394", "0.53137684", "0.5274193", "0.52677375", "0.52624005", "0.52130866", "0.5212137", "0.520823...
0.6388516
0
List dummy records by paging through them.
def list_dummy_records(): _t_start = time.time() timestamp = None message_id = None try: next_token = request.args.get('next') if next_token is not None: timestamp, message_id = request.args.get('next').split('_') timestamp = int(timestamp) except ValueError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_txn_list_paginated_without_count(self):\n paging = Mocks.make_paging_response(2, 4)\n self.stream.preset_response(\n head_id='d',\n paging=paging,\n transactions=Mocks.make_txns('b', 'a'))\n\n response = await self.get_assert_200('/transactions?m...
[ "0.60916716", "0.60906106", "0.59797055", "0.59122306", "0.5851407", "0.58245665", "0.5786887", "0.57812506", "0.57719177", "0.57099533", "0.5679711", "0.5665633", "0.56482464", "0.5642667", "0.5639698", "0.5632669", "0.5632023", "0.5632023", "0.55891895", "0.55860406", "0.55...
0.62826157
0
Tests that typ tags must be in a tuple.
def testTypTagsTupleEnforced(self) -> None: fake_typ_tuple = typing.cast(tuple, ['win', 'x86']) with self.assertRaises(AssertionError): _ = data_types.Result('test', fake_typ_tuple, (1, 10), 'build_id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tuples():\n\n @type_checked\n def _run_test(something:(str, int, bool)):\n assert isinstance(something[0], str)\n assert isinstance(something[1], int)\n assert isinstance(something[2], bool)\n\n _run_test(something=(None, \"12\", 1))", "def is_tuple_of(seq, expected_type):\...
[ "0.7318963", "0.6859566", "0.65626335", "0.652866", "0.6464916", "0.6359323", "0.62493694", "0.614658", "0.6138197", "0.6135991", "0.61102873", "0.61083007", "0.6091313", "0.60713184", "0.6038247", "0.6025708", "0.6019369", "0.60017824", "0.59973234", "0.5986661", "0.59794265...
0.7323954
0
Tests that image diff tag must be in a tuple.
def testImageDiffTupleEnforced(self) -> None: fake_image_diff_tuple = typing.cast(tuple, [1, 10]) with self.assertRaises(AssertionError): _ = data_types.Result('test', ('win', 'x86'), fake_image_diff_tuple, 'build_id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testTypTagsTupleEnforced(self) -> None:\n fake_typ_tuple = typing.cast(tuple, ['win', 'x86'])\n with self.assertRaises(AssertionError):\n _ = data_types.Result('test', fake_typ_tuple, (1, 10), 'build_id')", "def test_tag_valid_image(self):\n alpine = self.docker.images.get(con...
[ "0.6209862", "0.6067407", "0.6009348", "0.5768724", "0.5696563", "0.5689986", "0.55821776", "0.5528516", "0.55158615", "0.54976505", "0.5485725", "0.54738533", "0.5442287", "0.5429008", "0.5412863", "0.5331477", "0.5306774", "0.5261644", "0.5253585", "0.52521074", "0.52519363...
0.71935666
0
Tests that image diff tag must be 2 length.
def testImageDiffLengthEnforced(self) -> None: with self.assertRaises(AssertionError): _ = data_types.Result('test', ('win', 'x86'), (1, 2, 3), 'build_id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_retag_valid_image(self):\n alpine = self.docker.images.get(constant.ALPINE)\n self.assertTrue(alpine.tag(\"demo\", \"rename\"))\n\n alpine = self.docker.images.get(constant.ALPINE)\n self.assertNotIn(\"demo:test\", alpine.tags)", "def test_tag_valid_image(self):\n alpi...
[ "0.6255042", "0.6036077", "0.60065067", "0.5961959", "0.58449745", "0.57746196", "0.5710536", "0.5690402", "0.568345", "0.5642201", "0.5614331", "0.5583475", "0.5578828", "0.5552167", "0.55369854", "0.55312604", "0.5521943", "0.5516837", "0.5494345", "0.548568", "0.54820865",...
0.717412
0
Tests that Result objects are hashable.
def testHashability(self) -> None: r = data_types.Result('test_1', ('win', 'x86'), (1, 10), 'id') test_set = set([r]) test_set.add(r) self.assertEqual(1, len(test_set)) r = data_types.Result('test_2', ('win', 'x86'), (2, 30), 'id') test_set.add(r) self.assertEqua...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_hashable(self, setup):\n try:\n hash(setup)\n except TypeError as e:\n raise AssertionError(f\"setup object is not hashable:\\n{setup}\") from e", "def test_hash(self):\n self.assertEqual(hash(self.compound), hash((\"t1\", \"test compound\")))", "def test_ha...
[ "0.70370966", "0.68295664", "0.67201537", "0.6607579", "0.6517348", "0.6515055", "0.6482595", "0.6451068", "0.64170456", "0.6373241", "0.63660705", "0.63372886", "0.6308647", "0.6245171", "0.6245171", "0.6205656", "0.6191468", "0.6186153", "0.60845083", "0.60811776", "0.60745...
0.81648606
0
Generate a random United States Individual Taxpayer Identification Number (ITIN). An United States Individual Taxpayer Identification Number (ITIN) is a tax processing number issued by the Internal Revenue Service. It is a ninedigit number that always begins with the number 9 and has a range of 7088 in the fourth and f...
def itin(self) -> str: area = self.random_int(min=900, max=999) serial = self.random_int(min=0, max=9999) # The group number must be between 70 and 99 inclusively but not 89 or 93 group: int = self.random_element([x for x in range(70, 100) if x not in [89, 93]]) itin = f"{area...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genAccountNo():\n from random import randint\n\n accountNumber = randint(0000000000, 9999999999)\n return accountNumber", "def _random_issn():\n first = randint(1000, 9999)\n second = randint(100, 999)\n return str(first) + \"-\" + str(second) + str(_select_from([1, 2, 3, 4, 5, 6, 7, 8, 9, ...
[ "0.62998307", "0.6124395", "0.58056724", "0.5574674", "0.55190504", "0.54868203", "0.5480039", "0.5425345", "0.53848785", "0.53548336", "0.5320895", "0.5309065", "0.52968985", "0.5295846", "0.5280685", "0.5269144", "0.524975", "0.5242477", "0.52177083", "0.5216105", "0.521523...
0.66108423
0
Generate a random United States Employer Identification Number (EIN). An United States An Employer Identification Number (EIN) is also known as a Federal Tax Identification Number, and is used to identify a business entity. EINs follow a format of a
def ein(self) -> str: # Only certain EIN Prefix values are assigned: # # https://www.irs.gov/businesses/small-businesses-self-employed/how-eins-are-assigned-and-valid-ein-prefixes ein_prefix_choices: List[str] = [ "01", "02", "03", "04", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def itin(self) -> str:\n\n area = self.random_int(min=900, max=999)\n serial = self.random_int(min=0, max=9999)\n\n # The group number must be between 70 and 99 inclusively but not 89 or 93\n group: int = self.random_element([x for x in range(70, 100) if x not in [89, 93]])\n\n i...
[ "0.60033274", "0.58758867", "0.5875787", "0.5840039", "0.57153285", "0.5701205", "0.5681064", "0.56764835", "0.56096095", "0.5591005", "0.5551279", "0.55171835", "0.5484305", "0.5462546", "0.54304606", "0.5371505", "0.5335441", "0.5277129", "0.52713925", "0.5239948", "0.52139...
0.6028611
0
Generate a random invalid United States Social Security Identification Number (SSN).
def invalid_ssn(self) -> str: itin_group_numbers = [ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _random_issn():\n first = randint(1000, 9999)\n second = randint(100, 999)\n return str(first) + \"-\" + str(second) + str(_select_from([1, 2, 3, 4, 5, 6, 7, 8, 9, \"X\"]))", "def social_security_number():\r\n\r\n return '%.3i-%.2i-%.4i' % (_random.randrange(999),\r\n ...
[ "0.6681073", "0.66298175", "0.63042825", "0.6258822", "0.62298083", "0.6222309", "0.6005247", "0.5968961", "0.5954642", "0.59066147", "0.58551735", "0.5844419", "0.5844419", "0.5791997", "0.57770675", "0.5765054", "0.5750797", "0.5747113", "0.574692", "0.5708202", "0.570709",...
0.73712426
0
Generate a random United States Taxpayer Identification Number of the specified type. If no type is specified, a US SSN is returned.
def ssn(self, taxpayer_identification_number_type: str = SSN_TYPE) -> str: if taxpayer_identification_number_type == self.ITIN_TYPE: return self.itin() elif taxpayer_identification_number_type == self.EIN_TYPE: return self.ein() elif taxpayer_identification_number_type =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genAccountNo():\n from random import randint\n\n accountNumber = randint(0000000000, 9999999999)\n return accountNumber", "def createAccountNo():\n account_no = \"\"\n for i in range(8):\n account_no += str(randint(0, 9))\n return int(account_no)", "def generate_random_value(self, ...
[ "0.65881294", "0.59639823", "0.59593594", "0.5905967", "0.59052336", "0.5841776", "0.57393014", "0.5723755", "0.5721922", "0.5693278", "0.5654323", "0.5634416", "0.5577713", "0.557766", "0.5574969", "0.557008", "0.557008", "0.557008", "0.5514524", "0.5511113", "0.5481344", ...
0.71594876
0
Pearson correlation. Return a list of pearsons autocorrelations of players votes in dataset (DEAFULT_PEARSON_VALUE if NaN).
def pearsonCorrelation(player, dataset): df = pd.DataFrame() # Set "votes" column values votes = getPlayerValues(player, dataset, diff=True) df['votes'] = votes #Set "period" column values df["period"] = range(1, len(votes)+1) df.set_index('period') nLags = SEASON_LENGTH+1 return [ df['votes'].aut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correlation(self) -> List[float]:\n self.pearson_corr = self.sim_data[\"Human (mean)\"].corr(self.sim_data[\"assigned_sim\"], method=\"pearson\")\n self.spearman_corr = self.sim_data[\"Human (mean)\"].corr(self.sim_data[\"assigned_sim\"], method=\"spearman\")\n return [self.pearson_corr, s...
[ "0.6859696", "0.65952903", "0.65223897", "0.64279145", "0.6311284", "0.62720233", "0.62504923", "0.62471044", "0.62411594", "0.61967605", "0.61426634", "0.6066104", "0.6025432", "0.59991306", "0.5991608", "0.5958317", "0.592591", "0.59124047", "0.58863735", "0.5852274", "0.58...
0.82866526
0
Find weight (w) that minimize error in wmlp_forecasts + (aw)arima_forecasts
def best_weigth(test, lstm_forecasts, arima_forecasts): errors = [] for i in range(0, 100): alpha = i / 100 beta = 1 - alpha weighted_forecasts = (alpha * lstm_forecasts + beta * arima_forecasts) meanError = ((test - weighted_forecasts)**2).mean() #mse errors.append(meanError) return np.array(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_wma(self,period):\n length=period\n total_weight = 0.5 * length * (length + 1)\n weights = pd.Series(np.arange(1, length + 1))\n # aberracion que hace pandas_ta\n def linear(w):\n def _compute(x):\n return np.dot(x, w) / total_weight\n ...
[ "0.6365375", "0.62967956", "0.6177325", "0.61678", "0.607918", "0.6024685", "0.5935133", "0.59260416", "0.5911828", "0.5890361", "0.5876826", "0.58715653", "0.58633894", "0.5852845", "0.5843816", "0.584225", "0.58415854", "0.58394563", "0.58346707", "0.5825843", "0.58164763",...
0.7062113
0
returns one or more similar Spotify artist objects
def getSimilarArtists(artist_id, limit = 5): response = requests.get("https://api.spotify.com/v1/artists/%s/related-artists"%artist_id).json() return response.get('artists')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_similar_artists(artist):\n\n l = []\n for artist in _lastfm.get_artist(artist).get_similar():\n artist = artist.item\n l.append(artist.get_name())\n\n return l", "def _query_artist_by_song(self, entities: List[str]):\n artists = []\n for e in entities:\n a...
[ "0.76213807", "0.73288226", "0.72910154", "0.7120298", "0.7085451", "0.6993886", "0.6958779", "0.6950343", "0.6920288", "0.68820065", "0.68416125", "0.6817209", "0.6759406", "0.6752173", "0.6723199", "0.6713781", "0.6707174", "0.66639477", "0.6648825", "0.66162604", "0.659208...
0.74025154
1
Compute the active target at each timestep.
def get_active_target(self, inp_hist): go = inp_hist[:, 0] curr_targ = inp_hist[:, 3:5] next_targ = inp_hist[:, 5:7] return curr_targ * (1 - go[:, None]) + next_targ * go[:, None]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_output_delta(self, target):\r\n self.compute_activation\r\n out=self.activation\r\n self.delta=out*(1-out)*(target-out)", "def process_current_time(self):\n if self.new_input:\n self.new_input = False\n\n if self.activation_count == self.mask_init_tim...
[ "0.644946", "0.6336728", "0.6122467", "0.6122467", "0.6104193", "0.6104193", "0.6034702", "0.6020157", "0.59769714", "0.58960944", "0.5879537", "0.5855097", "0.5851015", "0.5844139", "0.5838", "0.5827435", "0.5781464", "0.57802045", "0.57802045", "0.5776595", "0.5776595", "...
0.648026
0
Computes loss between hand and active target.
def target_loss(self, inp_hist): active_targ = self.get_active_target(inp_hist) return torch.mean((inp_hist[:, 1:3] - active_targ) ** 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_loss(self):", "def _compute_loss(self):\n state, action, reward, next_state, done = self.replay_buffer.sample(self.batch_size)\n\n state = torch.FloatTensor(state)\n next_state = torch.FloatTensor(next_state)\n action = torch.LongTensor(action)\n reward ...
[ "0.7310685", "0.7214347", "0.70066017", "0.7002609", "0.6913564", "0.6908017", "0.69011974", "0.6885899", "0.68221873", "0.68188846", "0.6804904", "0.67836934", "0.6754861", "0.67179716", "0.67072797", "0.6707276", "0.6707276", "0.6689799", "0.6686646", "0.6679426", "0.667427...
0.72731215
1
Lazily load the McQuillan rotation periods table
def get_rotationtable(): import astropy.io.ascii as ascii import pkgutil global rotation_table if rotation_table is None: logger.info("Reading McQuillan rotation table") rotation_table = ascii.read(pkgutil.get_data(__name__, 'data/rotation_McQuillan.txt')) return rotation_table
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_cdm_tables():\n tpath = os.getcwd() + '/../data'\n cdmpath='https://raw.githubusercontent.com/glamod/common_data_model/master/tables/' # cdm tables \n \n \"\"\" Selecting the list of table definitions. Some of the entires do not have the corresponding implemented tables \"\"\"\n ...
[ "0.60886174", "0.55600536", "0.54160815", "0.53699327", "0.5285024", "0.52519953", "0.5248757", "0.52302575", "0.5123666", "0.5103518", "0.50931823", "0.5075893", "0.5044132", "0.50173527", "0.5016384", "0.5014286", "0.5011924", "0.49583673", "0.4953372", "0.49530986", "0.494...
0.7154331
0
Lazily load the Kepler TCE table
def get_transit_table(): # from Seader et al. # "The search includes a total of $198,646$ targets, # of which $112,001$ were observed in every quarter # and $86,645$ were observed in a subset of the 17 quarters." import astropy.io.ascii as ascii import pkgutil global transit_table if tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_tilenames_cache(tablename):\n import desdb\n fname=get_tilename_cache_file(tablename)\n\n if not os.path.exists(fname):\n print(\" caching from database\")\n dir=get_tilename_cache_dir()\n if not os.path.exists(dir):\n print(\"making dir:\",dir)\n os....
[ "0.6193555", "0.585236", "0.54784864", "0.5423744", "0.53716886", "0.5342768", "0.5327782", "0.5295515", "0.5292855", "0.52874804", "0.52726483", "0.5249693", "0.521238", "0.5160513", "0.5158663", "0.51458925", "0.51310074", "0.51298285", "0.51177126", "0.51124763", "0.510120...
0.6212151
0
Draw a random transit from the Kepler TCE list
def draw_transit(prng=np.random): row = prng.choice(get_transit_table()) T14 = row['tce_duration'] / 24.0 return Trapezoid(P=row['tce_period'], E=row['tce_time0bk'] + 2545833.0, T14=T14, T23=max(T14 - 2 * row['tce_ingress'] / 24.0, 0), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_transit_table():\n # from Seader et al.\n # \"The search includes a total of $198,646$ targets,\n # of which $112,001$ were observed in every quarter\n # and $86,645$ were observed in a subset of the 17 quarters.\"\n import astropy.io.ascii as ascii\n import pkgutil\n global transit_ta...
[ "0.53655136", "0.53051764", "0.5229888", "0.5191288", "0.51765734", "0.51744246", "0.51632136", "0.5160802", "0.5159935", "0.51417094", "0.5141599", "0.513669", "0.51335144", "0.5120196", "0.5119164", "0.51068985", "0.51047444", "0.5098132", "0.5088636", "0.5078805", "0.50591...
0.6910991
0
extract name and traits from a lightcurve code
def parseCode(code): traits = {} name, traitstrings = code.split('|') for t in traitstrings.split(','): k, v = t.split('=') traits[k] = np.float(v) return name, traits
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def substantiate():", "def lhco_line(self):\n if not self.check_def(['eta','phi','pt','mass','pid']): \n sys.exit('Particle error: some attribute not defined')\n\n jet=[1,2,3,4,5,6,21]\n inv_list=[12,14,16,18,1000022,1000023,1000024,1000025,1000035]\n\n #define ...
[ "0.54734457", "0.5432759", "0.51081216", "0.5106474", "0.50877905", "0.5073923", "0.5046749", "0.49993062", "0.49906957", "0.4959342", "0.49556524", "0.4950251", "0.4947459", "0.4932866", "0.49156448", "0.4915603", "0.49055657", "0.49024856", "0.488508", "0.4882138", "0.48743...
0.6171501
0
integrate the flux over a finite exposure time. for proper averageing, model() must be defined in magnitudes
def integrated(self, t, exptime=30.0 / 60.0 / 24.0, resolution=100): # deal with the edge case of only a single time point being passed try: t.shape except AttributeError: t = np.array([t]) # don't waste time on this if the light curve is a constant if s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integrate_spectrum(self):\n flux = sum(self.spectrum)\n return flux", "def integrate(self, t):", "def Flux(self, flux, r_lim, z_lim):\n if flux == 'mass':\n set_integrand = lambda x: x\n\n elif flux == 'momentum':\n set_integrand = lambda x: x**2\n\n ...
[ "0.63860464", "0.61580443", "0.6108688", "0.599843", "0.58956486", "0.5823643", "0.58209777", "0.57958734", "0.5767359", "0.5738043", "0.572816", "0.57171005", "0.5592596", "0.55659324", "0.5556063", "0.55476475", "0.55376035", "0.55376035", "0.5516704", "0.5508825", "0.54826...
0.61841863
1
Plot combined rewards chart for all values of gamma.
def plot_reward_combined(df1, df2, df3, prefix, tdir): # get figure and axes fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(6, 4)) # plot reward curve k = df1['k'] r1 = df1['r'] r2 = df2['r'] r3 = df3['r'] ax.plot(k, r1, color='b', label='Gamma 0.1') ax.plot(k, r2, color='r', lab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize_data(dqn_rewards, ddqn_rewards):\n \n fig, ax = plt.subplots()\n x_values = list(range(1, dqn_rewards.size + 1))\n ax.plot(x_values, dqn_rewards, label='dqn rewards')\n ax.plot(x_values, ddqn_rewards, label='ddqn rewards')\n plt.xlabel('episodes')\n plt.title('Cumulative Rewa...
[ "0.6384979", "0.63619906", "0.62200695", "0.61667085", "0.61263806", "0.6083732", "0.60175455", "0.59781224", "0.5953127", "0.5945391", "0.59337455", "0.59209085", "0.58942837", "0.58804804", "0.5806925", "0.5805874", "0.58055896", "0.5802153", "0.58011055", "0.57793975", "0....
0.6644031
0
Plot combined delta chart for all values of gamma.
def plot_delta_combined(df1, df2, df3, prefix, tdir): # get figure and axes fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(6, 4)) # plot reward curve k = df1['k'] r1 = df1['d'] r2 = df2['d'] r3 = df3['d'] ax.plot(k, r1, color='b', label='Gamma 0.1') ax.plot(k, r2, color='r', labe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delta_beta(p1=database['K+'], p2=database['pi+'], p3=database['p+'], pmin=0, pmax=80):\r\n p_range = np.linspace(pmin, pmax, 1000)\r\n m1 = p1.mass\r\n m2 = p2.mass\r\n m3 = p3.mass\r\n db2, db3 = [], []\r\n for p in p_range:\r\n b1 = beta(p, m1)\r\n b2 = beta(p, m2)\r\n ...
[ "0.6294526", "0.6017868", "0.6016631", "0.6014686", "0.57786244", "0.5737543", "0.5719298", "0.56802446", "0.56649363", "0.558411", "0.55780655", "0.556404", "0.55574054", "0.5539532", "0.55391675", "0.55086553", "0.54897994", "0.5482972", "0.54706943", "0.54672277", "0.54600...
0.6570579
0
Enables the UI and action groups
def enable(self): self.uimanager.insert_action_group(self.action_group, 1) self.active = self.uimanager.add_ui_from_string(self.ui) self.uimanager.ensure_update()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _enable(self):\n self.debug_log(\"Enabling...\")\n self._register_handlers()", "def enable_btns(self):\n self.saveBtn.setEnabled(True)\n self.openVideoBtn.setEnabled(True)\n self.openAnnotationBtn.setEnabled(True)\n self.resetBtn.setEnabled(True)\n self.speedC...
[ "0.63979316", "0.638495", "0.6371019", "0.63688517", "0.63683355", "0.6358224", "0.63176847", "0.6275958", "0.62276185", "0.6187365", "0.615335", "0.615335", "0.60478354", "0.59659195", "0.5955411", "0.59264135", "0.59147966", "0.58947295", "0.5864876", "0.58598214", "0.58515...
0.7950176
0
Method to do modal run of the ManagedWindow. Connect the OK button to a method that checks if all is ok, Do not call close, close is called here. (if not ok, do self.window.run() to obtain new response )
def modal_call(self, after_ok_func=None): #self.show() while True: response = self.window.run() if response == Gtk.ResponseType.OK: # dialog will be closed by connect, now continue work while # rest of dialog is unresponsive, release when finished...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n # show the dialog\n self.dlg.show()\n # Run the dialog event loop\n result = self.dlg.exec_()\n\n # See if OK was pressed\n if result:\n # Do something useful here - delete the line containing pass and\n # substitute with your code.\n...
[ "0.6925353", "0.68951225", "0.68951225", "0.68951225", "0.6546415", "0.63895905", "0.6275096", "0.625744", "0.61765337", "0.6117913", "0.60932934", "0.5919492", "0.5910626", "0.5896983", "0.5893871", "0.5890106", "0.58881134", "0.58722556", "0.58542556", "0.58542556", "0.5854...
0.7662957
0
Set the dimensions of the window
def _set_size(self): if self.width_key is not None: width = config.get(self.width_key) height = config.get(self.height_key) self.window.resize(width, height)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setwinsize(self, rows, cols):", "def configure_window(self, width, height):\n self.configure_surface(width, height)", "def set_igv_window_size(self, width=800, height=600):\n self.set_igv_window_width(width)\n self.set_igv_window_height(height)", "def setWindowSize(width,height):\n ...
[ "0.8105132", "0.7926816", "0.79115814", "0.77045995", "0.7679221", "0.7523142", "0.74925464", "0.73685586", "0.7355737", "0.73117524", "0.7297934", "0.7177685", "0.71588576", "0.7069889", "0.7022341", "0.6978059", "0.69625723", "0.69488716", "0.68822104", "0.6819684", "0.6817...
0.81039464
1
Save the dimensions of the window to the config file
def _save_size(self): if self.width_key is not None: (width, height) = self.window.get_size() config.set(self.width_key, width) config.set(self.height_key, height) config.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_config(self):\n self.config.app_w = self.width()\n self.config.app_h = self.height()\n self.config.splitter = self.splitter.saveState()\n self.config.save()", "def WriteWindowSize(self, width, height, win_name):\n if win_name == \"main\":\n height_str = \"wi...
[ "0.78373945", "0.7546125", "0.73151284", "0.7140902", "0.66826296", "0.65606594", "0.6458817", "0.6294136", "0.6251657", "0.62302727", "0.61648685", "0.6157747", "0.61550605", "0.60601693", "0.600536", "0.59786886", "0.5951714", "0.5923524", "0.5916387", "0.5866266", "0.58605...
0.8272255
0
Plot several scalarvalued fields over all time.
def plot_scalar_fields(self, fields, title="", xlabel="", ylabel=""): plt.figure() for f in fields: plt.plot(self._log[f], linewidth=2, markersize=12, label=f) plt.legend() self._set_title_and_axis_labels(title, xlabel, ylabel)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_data(self):", "def plot(self, *args, **kwargs):\n pass", "def plot(self,ax,**kwargs):\n # filter arguments for field lines\n plot_kwargs = { k: kwargs[k] for k in self.__line_args if kwargs.has_key(k)} \n # apply custom plot style set manually with set_plotstyle()\n ...
[ "0.64791644", "0.6126389", "0.6100611", "0.6064946", "0.6054005", "0.59486866", "0.5948109", "0.5789152", "0.5779034", "0.5777818", "0.5747564", "0.5729951", "0.5710759", "0.570517", "0.569635", "0.5696092", "0.5673885", "0.56675255", "0.5664621", "0.565133", "0.5648469", "...
0.7648193
0
Plot the controls over time for the final optimized trajectory
def plot_controls(self): u = np.array(self._log['u1s']) u = u[-1,:,:,:] u1 = u[:,0].flatten() u2 = u[:,1].flatten() t = np.arange(1, u.shape[0]+1) * 0.1 plt.figure() fig, axs = plt.subplots(2,1) axs[0].plot(t, u1) axs[0].set_xlabel('time...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_control_loops(data):\n plot_attitude_rate_loops(data)\n plot_attitude_loops(data)\n plot_velocity_loops(data)\n plot_position_loops(data)", "def plot():\n ts, ys, lin_model, K, us, dt_control, biass, end_time = simulate()\n\n matplotlib.rcParams.update({'font.size': 18})\n fig, axes...
[ "0.69881994", "0.6822807", "0.67511094", "0.6647955", "0.6637834", "0.65978336", "0.65553445", "0.6497429", "0.64948165", "0.6466267", "0.6441299", "0.64375675", "0.64365417", "0.6430549", "0.6414752", "0.6387012", "0.6371516", "0.63282704", "0.6326874", "0.6302435", "0.62711...
0.7306016
0
Plot the disturbance over time for the final optimized trajectory
def plot_disturbances(self): d = np.array(self._log['u2s']) d = d[-1,:,:,:] d1 = d[:,0].flatten() d2 = d[:,1].flatten() t = np.arange(1, d.shape[0]+1) * 0.1 plt.figure() plt.plot(t, d1, label='d1') plt.plot(t, d2, label='d2') plt.xlabel('time (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_2():\n\n # To store the list of speeds to plot\n list_of_speeds = []\n list_of_times = []\n list_of_time_difference = [0]\n\n # To go from 1 through 80\n for i in range(LOW_SPEED, HIGH_SPEED + 1, 5):\n list_of_speeds.append(i)\n list_of_times.append(((DISTANCE / i) * 60))\n...
[ "0.6544662", "0.6306716", "0.62702215", "0.62260836", "0.6143988", "0.6057471", "0.60215646", "0.5995268", "0.59741133", "0.5967416", "0.59295076", "0.59194493", "0.591846", "0.5876262", "0.5845372", "0.5836303", "0.5819409", "0.58074236", "0.5798038", "0.57823634", "0.577743...
0.68027586
0
returns a dictionary whose keys are a level number, and whose elements are a list of agents at that level
def createLevelMap(self): for a in self.hierarchy.iterkeys(): self.lvl = 0 self.calcLevel(a) if self.lvl > self.levelMap.highestLevel: self.levelMap.highestLevel = self.lvl self.levelMap.addLevelData(AgentName=a, Level=self.lvl)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createLevelMap(self):\n\t\tfor a in self.hierarchy.iterkeys():\n\t\t\tself.lvl = 0\n\t\t\tself.calcLevel(a)\n\t\t\tif self.lvl > self.levelMap.highestLevel: self.levelMap.highestLevel = self.lvl\n\t\t\tself.levelMap.addLevelData(AgentName=a, Level=self.lvl)", "def extract_levels(enemy_behavior: List[Any]):\n...
[ "0.6467349", "0.64367056", "0.62141895", "0.61744845", "0.6060825", "0.5936814", "0.5921964", "0.5849848", "0.58325076", "0.5798009", "0.56478757", "0.5552219", "0.5499714", "0.5480819", "0.54636955", "0.5458438", "0.5458438", "0.5364306", "0.53599507", "0.532528", "0.5292418...
0.64803183
0
returns a dictionary whose keys are a level number, and whose elements are a list of agents at that level
def createLevelMap(self): for a in self.hierarchy.iterkeys(): self.lvl = 0 self.calcLevel(a) if self.lvl > self.levelMap.highestLevel: self.levelMap.highestLevel = self.lvl self.levelMap.addLevelData(AgentName=a, Level=self.lvl)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createLevelMap(self):\n for a in self.hierarchy.iterkeys():\n self.lvl = 0\n self.calcLevel(a)\n if self.lvl > self.levelMap.highestLevel: self.levelMap.highestLevel = self.lvl\n self.levelMap.addLevelData(AgentName=a, Level=self.lvl)", "def extract_levels(e...
[ "0.6477455", "0.64382297", "0.62136155", "0.6173927", "0.60613805", "0.59354794", "0.5921332", "0.5849983", "0.5832884", "0.57968664", "0.56455916", "0.5551069", "0.5500393", "0.54812795", "0.54629946", "0.5460071", "0.5460071", "0.5364656", "0.53575754", "0.5324641", "0.5290...
0.64645314
1
Handle POST requests to create a game.
def post_game(): body_json = flask.request.json if body_json is None: flask.abort(400) request = PostGameRequest(**body_json) try: response = minesweeper_service.create_game(request) return flask.jsonify(response) except ValueError: # todo: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_new():\n posted = request.get_json()\n\n # Parse out the settings from the post\n settings = {}\n possible_settings = Game.DEFAULT_SETTINGS.keys()\n for setting in possible_settings:\n if setting in posted:\n settings[setting] = int(posted[setting])\n\n # Create and sta...
[ "0.7769519", "0.7315136", "0.73124284", "0.71983933", "0.6911297", "0.69110715", "0.6812735", "0.6807961", "0.67599016", "0.67563987", "0.6750548", "0.6743752", "0.669605", "0.66851693", "0.65809345", "0.65261096", "0.64966613", "0.6421226", "0.6402421", "0.6391252", "0.63448...
0.7900587
0
Test retrieving a UFT test report.
def test_test_report(self): self.__opener.contents = '''<Report><Doc><Summary failed="1" passed="2"/></Doc></Report>''' self.assertEqual(1, self.__uft.failed_tests('url')) self.assertEqual(2, self.__uft.passed_tests('url')) self.assertEqual(0, self.__uft.skipped_tests('url'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_basic_report(self):\n report = self.analytics.suites[testReportSuite].report\n queue = []\n queue.append(report)\n response = omniture.sync(queue)\n self.assertIsInstance(response, list)", "def test_get_report_file_id(self):\n vt_analyses = VirusTotalAPIAnalyses...
[ "0.6279645", "0.60395545", "0.59870124", "0.5927604", "0.5763517", "0.576197", "0.57379055", "0.57249016", "0.57116485", "0.564976", "0.5616352", "0.559702", "0.5562271", "0.553291", "0.5522734", "0.5516519", "0.55107796", "0.5480383", "0.5475257", "0.5473321", "0.5468173", ...
0.6927546
0
Test that the minimum datetime is returned when the xml is incomplete.
def test_incomplete_xml_datetime(self): self.__opener.contents = '<Report></Report>' self.assertEqual(datetime.datetime.min, self.__uft.datetime('url'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_incomplete_xml_no_timestamp(self):\n self.__opener.contents = '<Report><Doc><Summary/></Doc></Report>'\n self.assertEqual(datetime.datetime.min, self.__uft.datetime('url'))", "def test_missing_report_datetime(self):\n self.assertEqual(datetime.datetime.min, self.__uft.datetime('rais...
[ "0.77981293", "0.7071564", "0.6479173", "0.6121281", "0.61047405", "0.60125893", "0.59849316", "0.59644204", "0.5887457", "0.58694124", "0.5866695", "0.5803215", "0.57517827", "0.57504296", "0.5722503", "0.5721075", "0.5693223", "0.5668826", "0.566664", "0.56627333", "0.56521...
0.7814731
0
Test that the minimum datetime is returned when the xml is incomplete.
def test_incomplete_xml_no_timestamp(self): self.__opener.contents = '<Report><Doc><Summary/></Doc></Report>' self.assertEqual(datetime.datetime.min, self.__uft.datetime('url'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_incomplete_xml_datetime(self):\n self.__opener.contents = '<Report></Report>'\n self.assertEqual(datetime.datetime.min, self.__uft.datetime('url'))", "def test_missing_report_datetime(self):\n self.assertEqual(datetime.datetime.min, self.__uft.datetime('raise'))", "def test_event_...
[ "0.78159803", "0.7072184", "0.6478877", "0.61210614", "0.6104521", "0.60127336", "0.59850144", "0.59632283", "0.58864516", "0.58706677", "0.5866611", "0.5802808", "0.5751983", "0.5751574", "0.5723724", "0.57210684", "0.56933916", "0.5669743", "0.5668502", "0.5661382", "0.5653...
0.77988875
1
Test that the urls point to the HTML versions of the reports.
def test_urls(self): # Points to the XML at the moment because the UFT HTML report isn't stored at a predictable location. self.assertEqual(['http://server/uft/uft.xml'], self.__uft.metric_source_urls('http://server/uft/uft.xml'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_html_output(self):\n pass", "def test_gettesttools_html(self):\n pass", "def test_export_html(self):\r\n resp = self.client.get_html(self.url)\r\n self.assertEquals(resp.status_code, 200)\r\n self.assertContains(resp, \"Export My Course Content\")", "def test_get_v...
[ "0.6906392", "0.6749156", "0.6708148", "0.659616", "0.6570736", "0.6521748", "0.6497345", "0.6425999", "0.63807815", "0.636785", "0.6276291", "0.6251723", "0.6240863", "0.6210974", "0.6194761", "0.61896366", "0.61885303", "0.6184228", "0.61838347", "0.61639833", "0.6153524", ...
0.6764364
1
Set individual properties of the model object.
def set(self, model_object: dict) -> None: for k, v in model_object.items(): if hasattr(self, k): setattr(self, str(k), v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(self, properties):\n raise NotImplementedError", "def _set_attributes(self, model):\n\n if model:\n self._get_dict(model)", "def update(self, **kwargs):\n print(\"Updating model\")\n print(kwargs)\n for key in kwargs:\n setattr(self, key, kwargs[...
[ "0.7180497", "0.69314396", "0.6712755", "0.6613148", "0.6560314", "0.655397", "0.6528665", "0.6447989", "0.63996226", "0.6368269", "0.63447994", "0.6321752", "0.6300409", "0.62455666", "0.6243545", "0.6225299", "0.621521", "0.61914366", "0.61419314", "0.60830086", "0.6077481"...
0.70464903
1
A null (undefined) instance of `GXBIGRID `
def null(cls): return GXBIGRID()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(cls):\n ret_val = gxapi_cy.WrapBIGRID._create(GXContext._get_tls_geo())\n return GXBIGRID(ret_val)", "def G0(self):\n if self.g0_ref is None:\n return self.g0\n return self.g0_ref.nid", "def null(cls):\n return GXMXD()", "def get_handle_from_gramps_id(...
[ "0.62319994", "0.5926228", "0.58988255", "0.57559645", "0.5750438", "0.5611295", "0.55230314", "0.5358531", "0.5351588", "0.5266861", "0.51954263", "0.51842195", "0.51728535", "0.51697934", "0.51502794", "0.51250243", "0.51191247", "0.5114751", "0.5104956", "0.50764424", "0.5...
0.85281885
0
Create a handle to a Bigrid object
def create(cls): ret_val = gxapi_cy.WrapBIGRID._create(GXContext._get_tls_geo()) return GXBIGRID(ret_val)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, handle: db.DBHandle, openMode: int, factory: ghidra.program.model.address.AddressFactory, baseImageOffset: long, monitor: ghidra.util.task.TaskMonitor):\n ...", "def __init__(self):\n\n self.ptr = c_void_p()\n self.obj = byref(self.ptr)\n # container holding attache...
[ "0.63302785", "0.57902455", "0.55245507", "0.5511996", "0.5373931", "0.5344959", "0.53256994", "0.5292334", "0.5265826", "0.52657723", "0.5232851", "0.5178976", "0.5174586", "0.51284575", "0.5127531", "0.5117623", "0.5026308", "0.5025537", "0.5021109", "0.49996623", "0.499767...
0.64762557
0
Get default values for max line separation, max point separation and trend angle.
def get_defaults(cls, db, x, y, z, cell, maxLineSeparation, maxPointSeparation, trendAngle, lowPassWavelength, highPass, noneLinear, preFilter): ret_val, maxLineSeparation.value, maxPointSeparation.value, trendAngle.value, lowPassWavelength.value, highPass.value, noneLinear.value, preFilter.value = gxapi_cy.Wra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metrics_defaults(self) -> Tuple[float, ...]:\n return (\n MIN_AP,\n self.tp_threshold_m,\n MAX_NORMALIZED_ASE,\n MAX_YAW_RAD_ERROR,\n MIN_CDS,\n )", "def DEFAULT_MAX_POINTS_PART(self): # real signature unknown; restored from __doc__\n ...
[ "0.6314324", "0.5781534", "0.5363183", "0.5312945", "0.5249158", "0.51911354", "0.5186408", "0.51816905", "0.51796806", "0.5171725", "0.51595587", "0.5154236", "0.511402", "0.50997514", "0.5095896", "0.5094029", "0.50718254", "0.50654924", "0.50654924", "0.50593257", "0.50207...
0.62917775
1
Get default cell size value.
def get_default_cell_size(cls, db, x, y, z, cell): ret_val, cell.value = gxapi_cy.WrapBIGRID._get_default_cell_size(GXContext._get_tls_geo(), db, x.encode(), y.encode(), z.encode(), cell.value) return ret_val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Size(self, default=None):\n return self.data.get('size', default)", "def get_default_page_size(self):\n return self.default_page_size", "def _get_default_size(self):\n default_width = default_height = ''\n if self.selector_declarations:\n default_width = self.sele...
[ "0.7406437", "0.71481436", "0.70099425", "0.68779343", "0.6874531", "0.67571783", "0.6701486", "0.6659154", "0.6642595", "0.65857077", "0.6541842", "0.6533074", "0.6533074", "0.6533074", "0.6525733", "0.6525733", "0.6494386", "0.64833504", "0.64423037", "0.64131445", "0.63781...
0.8013108
0
Return the entity manager.
def get_entity_manager(self): return self.game.entity_manager
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetManager(self):\r\n\r\n return self.manager", "def getManager(self):\n return self._manager", "def get_manager():\n return __manager__", "def get_instance():\n if PersistenceManager._instance is None:\n PersistenceManager._instance = PersistenceManager()\n retu...
[ "0.75554377", "0.7492295", "0.70782036", "0.6458615", "0.6402218", "0.63616216", "0.6285682", "0.62742215", "0.6272994", "0.6261487", "0.62318075", "0.6209214", "0.5985774", "0.59778917", "0.5898104", "0.58915365", "0.5732652", "0.5730242", "0.5730242", "0.570737", "0.5702821...
0.87234014
0
Get the resource loader.
def get_resource_loader(self): return self.game.resource_loader
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loader(self):\n return self.loader_class()", "def get_loader(self) -> BaseLoader:\n return FileSystemLoader(getattr(self, \"cwd\"))", "def loader(self):\r\n return self._loader", "def loader(self):\n return self._loader", "def loader(self):\n if \"loader\" in self.recipe:...
[ "0.7984167", "0.796627", "0.76860344", "0.7479044", "0.7179834", "0.70296586", "0.6541784", "0.6223375", "0.6119609", "0.6088874", "0.6088874", "0.6006737", "0.59779936", "0.5931386", "0.58897316", "0.5886071", "0.585002", "0.58476967", "0.572046", "0.572046", "0.57170594", ...
0.871324
0
Return the debug level.
def get_debug_level(self): return self.debug_level
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug():\n return int(DEBUG)", "def get_log_level(self) -> int:\n logging.debug(self.args)\n return getattr(logging, self.args.loglevel.upper(), None)", "def get_debug():\n return _DEBUG", "def get_level(self):\n return self.debug_level, self.verbosity", "def _debug():\n r...
[ "0.7776957", "0.7705681", "0.7624644", "0.7500297", "0.73505557", "0.72796845", "0.70753914", "0.7012735", "0.6925337", "0.67769396", "0.6725767", "0.6472028", "0.6449201", "0.6443026", "0.6333895", "0.62958086", "0.62776005", "0.6271146", "0.6249575", "0.6233272", "0.6202483...
0.8904503
0
Reads cookie and returns the base value if secure
def read_secure_cookie(self, name): cookie_val = self.request.cookies.get(name) return cookie_val and check_secure_val(cookie_val)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_secure_cookie(self, name):\n\n cookie_val = self.request.cookies.get(name)\n return cookie_val and check_secure_val(cookie_val)", "def get_secure_cookie( name, value=None ):", "def get_cookie():\n response = requests.get(base_url)\n cookie = response.url.split('/')[3]\n return c...
[ "0.72487885", "0.71642566", "0.67987007", "0.67506063", "0.6529716", "0.6279527", "0.62721896", "0.62511057", "0.62383705", "0.61611617", "0.61570984", "0.6147241", "0.6110637", "0.60898805", "0.60394865", "0.5891209", "0.58734506", "0.578169", "0.57684565", "0.5768393", "0.5...
0.73040134
1
Returns the value of Phi used in complex production amplitude calculation, and thus number of events (nTrue.nTrue()), for a specified mass and resonance.
def getPhi(mass,resonance): return numpy.arctan((resonance.r0*resonance.w0)/(mass**2-resonance.w0**2)) #need to make this arccotan? invert args
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phi(self):\n return (np.sum(self.diameters**self.ndim)*np.pi / (2*self.ndim))", "def Phi(self):\n return self.E0*np.sqrt(self.f1*self.f2*self.f3)*self.dT**2*self.dp.phi0", "def n_e(self) -> u.m**-3:\n return np.sum(self._n_elem * self.ionic_fractions * self.charge_numbers)", "def phi...
[ "0.62840515", "0.60297966", "0.60248625", "0.5922856", "0.57522386", "0.5730563", "0.5687038", "0.5684719", "0.56753844", "0.56643933", "0.56511045", "0.56500965", "0.5648746", "0.5630508", "0.5591719", "0.559154", "0.5586281", "0.55775464", "0.55382746", "0.5505299", "0.5483...
0.6588434
0
Override default `save` method to shorten URL if not provided explictly
def save(self, force_insert=False, force_update=False, using=None, update_fields=None): # If the short url wasn't specified if not self.short_url: # We pass the model instance that is being saved self.short_url = create_shortene...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, *args, **kwargs):\n if not self.slug:\n self.slug = self.generate_slug()\n super().save(*args, **kwargs)", "def save(self, *args, **kwargs):\n if not self.slug:\n self.slug = self.generate_slug()\n super().save(*args, **kwargs)", "def save(self, ...
[ "0.6521677", "0.6521677", "0.6399488", "0.63704604", "0.6313694", "0.62229246", "0.6219528", "0.6179201", "0.6123621", "0.6109798", "0.6080481", "0.6073362", "0.6068303", "0.60008013", "0.59755415", "0.5970358", "0.59260124", "0.5924528", "0.59220415", "0.59007657", "0.589737...
0.7618865
0
Check if a key is in the dict. It locks it for writes when doing so.
def __contains__(self, key): self.lock.acquire() result = dict.__contains__(self, key) self.lock.release() return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_key(self, key):\n return key in self", "def __contains__(self, key):\n try:\n self._get(key)\n return True\n except Exception:\n return False", "async def _exists(self, key):\n return key in SimpleMemoryBackend._cache", "def containsKey(sel...
[ "0.7379723", "0.7336187", "0.730255", "0.7298554", "0.7275533", "0.72476125", "0.7223141", "0.71732944", "0.71608734", "0.7158853", "0.7138419", "0.7101295", "0.7097493", "0.70956665", "0.70701647", "0.70668185", "0.704773", "0.7043495", "0.70369303", "0.7025736", "0.7024086"...
0.80088013
0
mass_matrix = delta_x/2 int_{1,1} phi_iphi_j dx
def Mass_Matrix(self): self.mass_matrix = np.empty((self.N,self.N)) for n1 in range(self.N): for n2 in range(self.N): self.mass_matrix[n1,n2] = integrate.quad(lambda x:self.basis[n1](x)*self.basis[n2](x),-1,1)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_mass_matrix(self, m, jsa):\n\n rho_i = self.r_i.local_coordinates - self.r_g_loc\n tr_rho_i = rho_i.transpose()\n x = np.array([self.r_j.local_coordinates - self.r_i.local_coordinates,\n self.u.local_coordinates, self.v.local_coordinates])\n a = np.mat...
[ "0.6398663", "0.6361548", "0.6346588", "0.6262903", "0.62591064", "0.61091286", "0.5952977", "0.5878329", "0.58002967", "0.5778006", "0.57657534", "0.5755887", "0.5678478", "0.5654369", "0.56417835", "0.5638299", "0.56187916", "0.5614764", "0.56064075", "0.5569935", "0.556040...
0.69225574
0
Hit Ratio @ top_K
def cal_hit_ratio(self): full, top_k = self._subjects, self._top_k top_k = full[full['rank']<=top_k] score = 0.0 # golden items hit in the top_K items score_1 = sum([(len(d[(d['item'].isin(self._test_items[d['user'].iloc[0]]))& (d['ratings']==1.0)])) for i,d in top_k.groupby('use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cal_hit_gbratio(self):\n full, top_k = self._subjects, self._top_k\n top_k = full[full['rank']<=top_k]\n #print({d['user'].iloc[0]:d['ratings'].to_list() for i,d in top_k.groupby('user')})\n score = 0.0\n # golden items hit in the top_K items\n score_1 = {d['user'].il...
[ "0.6987941", "0.6394878", "0.6227712", "0.6196806", "0.6143892", "0.6015702", "0.6013519", "0.59990567", "0.5998232", "0.59628224", "0.5934958", "0.5926738", "0.59126824", "0.5903186", "0.5890792", "0.5857573", "0.58426315", "0.5794794", "0.5783312", "0.5774442", "0.57651824"...
0.6790218
1
Hit Ratio @ top_K
def cal_hit_gbratio(self): full, top_k = self._subjects, self._top_k top_k = full[full['rank']<=top_k] #print({d['user'].iloc[0]:d['ratings'].to_list() for i,d in top_k.groupby('user')}) score = 0.0 # golden items hit in the top_K items score_1 = {d['user'].iloc[0]:len(d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cal_hit_ratio(self):\n full, top_k = self._subjects, self._top_k\n top_k = full[full['rank']<=top_k]\n score = 0.0\n # golden items hit in the top_K items\n score_1 = sum([(len(d[(d['item'].isin(self._test_items[d['user'].iloc[0]]))& (d['ratings']==1.0)])) for i,d in top_k.gr...
[ "0.6790218", "0.6394878", "0.6227712", "0.6196806", "0.6143892", "0.6015702", "0.6013519", "0.59990567", "0.5998232", "0.59628224", "0.5934958", "0.5926738", "0.59126824", "0.5903186", "0.5890792", "0.5857573", "0.58426315", "0.5794794", "0.5783312", "0.5774442", "0.57651824"...
0.6987941
0
Plot n_samples from list of image batches
def plot_examples(n_samples, images, start_image=0): n_cols = len(images) index = 0 for j in range(0+start_image, n_samples+start_image): for col_id, img in enumerate(images): img_to_plot = img[j:j+1, :, :, :] img_to_plot = np.squeeze(img_to_plot) plt.subplot(n_sa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_data(self, samples=5):\n self._samples = samples\n \n idx = 0\n batch = next(iter(self._loader))\n while idx <= self._samples:\n\n (img_batch, label_batch) = batch\n\n fig = plt.figure()\n ax1 = fig.add_subplot(121)\n ax2 =...
[ "0.7137175", "0.7018269", "0.7000667", "0.69671047", "0.68263894", "0.680654", "0.668836", "0.668828", "0.66608685", "0.66449815", "0.66413474", "0.6628781", "0.66179234", "0.66171217", "0.6582072", "0.6542184", "0.65348357", "0.65122736", "0.6501277", "0.6492836", "0.6479856...
0.744542
0
Calculates the mean of squares of error of two signals. This function calculates the mean square error in time domain. If the input is spectrum then it transforms it to time domain. And in the case of length conflict zeros are appended.
def mean_squared_error_time(input_signalorspectrum, output_signalorspectrum): if isinstance(input_signalorspectrum, list) != True: observed_l = [] observed_l.append(input_signalorspectrum) else: observed_l = input_signalorspectrum if isinstance(output_signalorspectrum, list) != True:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_squared_error_time_range(input_signalorspectrum, output_signalorspectrum, freq_range):\n if isinstance(input_signalorspectrum, list) != True:\n ip = []\n ip.append(input_signalorspectrum)\n else:\n ip = input_signalorspectrum\n if isinstance(output_signalorspectrum, list) != ...
[ "0.7063442", "0.67404956", "0.6703756", "0.65794367", "0.6525531", "0.6439825", "0.63509834", "0.6248002", "0.6212916", "0.6091217", "0.59656656", "0.59121174", "0.58680093", "0.5772564", "0.57634544", "0.57582414", "0.57494944", "0.56925285", "0.5670902", "0.5668414", "0.566...
0.7259068
0
Calculates the mean of squares of error of two signals. This function calculates the mean square error in time domain. If the input is spectrum then it transforms it to time domain. And in the case of length conflict zeros are appended.
def mean_squared_error_time_range(input_signalorspectrum, output_signalorspectrum, freq_range): if isinstance(input_signalorspectrum, list) != True: ip = [] ip.append(input_signalorspectrum) else: ip = input_signalorspectrum if isinstance(output_signalorspectrum, list) != True: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_squared_error_time(input_signalorspectrum, output_signalorspectrum):\n if isinstance(input_signalorspectrum, list) != True:\n observed_l = []\n observed_l.append(input_signalorspectrum)\n else:\n observed_l = input_signalorspectrum\n if isinstance(output_signalorspectrum, lis...
[ "0.7259001", "0.6740993", "0.6704113", "0.65808725", "0.65246516", "0.6440702", "0.6351207", "0.6249262", "0.6213285", "0.6093502", "0.5967094", "0.59125787", "0.5870309", "0.57741046", "0.5765237", "0.5759188", "0.57501864", "0.5692197", "0.5671698", "0.56708515", "0.5665812...
0.7061948
1
Calculates the mean of squares of error of two spectrums. This function calculates the mean square error in frequency domain. If the input is signal then it transforms it to frequency domain. And in the case of length conflict zeros are appended.
def mean_squared_error_freq(input_signalorspectrum, output_signalorspectrum): if isinstance(input_signalorspectrum, list) != True: observed_l = [] observed_l.append(input_signalorspectrum) else: observed_l = input_signalorspectrum if isinstance(output_signalorspectrum, list) != True:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_squared_error_time(input_signalorspectrum, output_signalorspectrum):\n if isinstance(input_signalorspectrum, list) != True:\n observed_l = []\n observed_l.append(input_signalorspectrum)\n else:\n observed_l = input_signalorspectrum\n if isinstance(output_signalorspectrum, lis...
[ "0.705798", "0.6943505", "0.676711", "0.66829854", "0.6649612", "0.6594172", "0.6518363", "0.6483232", "0.6384308", "0.6082567", "0.60780287", "0.60535026", "0.5997609", "0.5980551", "0.59170455", "0.5892448", "0.5889665", "0.58660245", "0.58094305", "0.57865965", "0.5772426"...
0.73214686
0
Creates a chart with top 10 pages.
def create_chart(info): lst = output_data(info)[1] plt.rcdefaults() objects = (lst[i][1] for i in range(len(lst))) y_pos = np.arange(10) performance = [lst[i][0] for i in range(len(lst))] plt.bar(y_pos, performance, color='r', align='center', alpha=0.5) plt.xticks(y_pos, objects) plt.yla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_charts(page_num=1):\n # Download charts that belong to the current user\n charts = Chart.query.filter_by(owner_id=current_user.id).paginate(page_num)\n return render_template('reports/my_charts.html', charts=charts)", "def top_apps_data():\n\n # Query for the top 10 apps data\n results = db...
[ "0.56691766", "0.56471646", "0.54608697", "0.5408328", "0.5357681", "0.531945", "0.5266156", "0.5252861", "0.5240106", "0.5232828", "0.51999104", "0.5199234", "0.51863045", "0.5172367", "0.51611215", "0.5153726", "0.5153099", "0.5120459", "0.5114518", "0.51118666", "0.5108794...
0.77079666
0
Saves all ranks to a csv file.
def save_to_csv(info): all_ranks = sorted(output_data(info)[0], key=lambda x: x[1]) with open('page_ranks.csv', 'w') as file: file.write('\t\t' + "Contains ranks of all pages" + '\n') for rank in all_ranks: file.write('Page number: ' + str(rank[1]) + ', page rank:' + str(rank[0]) + '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n file_name = common.RANK_FILE % (self.week.season.name, self.week.num)\n with open(file_name, 'w') as rank_file:\n for team, score in self.score.items():\n rank_file.write('%s,%s\\n' % (team, score))", "def save_csv(self, filename: str, type='n', **args):\...
[ "0.68406206", "0.6825165", "0.6808849", "0.6722013", "0.6614456", "0.65601677", "0.6478112", "0.64380205", "0.63819486", "0.6377197", "0.62950784", "0.62459296", "0.6232834", "0.6232487", "0.6190865", "0.61792743", "0.6154506", "0.6152174", "0.6146851", "0.6134389", "0.610478...
0.74110544
0
Set the parameters threshold.
def set_threshold(self, threshold): self._threshold = check_value_positive('threshold', threshold)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setThreshold(self, threshold): # real signature unknown; restored from __doc__\n pass", "def setThreshold(self, v):\n self._set(threshold=v)\n return self", "def setThreshold(self, v):\n self._set(threshold=v)\n return self", "def setThreshold(self, v):\n self._s...
[ "0.75904775", "0.6962668", "0.6962668", "0.6962668", "0.6962668", "0.6962668", "0.66798", "0.6573095", "0.6557857", "0.65344787", "0.647978", "0.6470806", "0.6400144", "0.63341093", "0.6318119", "0.63161755", "0.6308599", "0.6299662", "0.6247986", "0.62410915", "0.62218195", ...
0.69708884
1
Test DKBCCCsvStatementParser Open sample csv to parse >>> import os >>> csvfile = os.path.join(os.path.dirname(__file__), ... 'samples', 'dkbcc.csv')
def doctest_DKBCCCsvStatementParser():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_csv_file():\n data = loader.load_csv_file(\"buildup/reference/comsol_solution/lofi/voltage.csv.bz2\")\n\n assert data.any()", "def test_csv_row_bug(script_runner, tmpdir, test_dir):\n csv_file = tmpdir / 'csv_file.csv'\n\n ret = script_runner.run(\n 'mwcp-tool', '-p', 'foo', '-c'...
[ "0.6135683", "0.60333097", "0.59999573", "0.5931239", "0.5901514", "0.587623", "0.5830923", "0.5816932", "0.57849133", "0.57803977", "0.5779418", "0.5766579", "0.5763014", "0.57579195", "0.57145923", "0.5702009", "0.564203", "0.56308275", "0.5599092", "0.5598436", "0.55574083...
0.70500314
0
Compute mean and standard deviation for historical daily counts in given window.
def _compute_mean_std(self, history, window=28): history = np.array(history[-window - 1: -1]) decay_weights = [self.decay ** a for a in range(len(history), 0, -1)] weighted = history * decay_weights mean = weighted.mean() std = weighted.std() return mean, std
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rolling_std(self, window=20, normalize=False):\n values = self.daily['Adj Close']\n if normalize: values = self.normalize(values)\n return values.rolling(window).std()", "def get_rolling_std(values, window):\r\n return pd.rolling_std(values, window=window)", "def get_rolling_std(val...
[ "0.7156707", "0.69563454", "0.68889934", "0.68031394", "0.65568167", "0.64584196", "0.6405226", "0.62985945", "0.6296525", "0.6267641", "0.617713", "0.6114039", "0.6094793", "0.6086178", "0.6078605", "0.60264426", "0.5976451", "0.59609866", "0.59573233", "0.59519356", "0.5931...
0.6974525
1
For a given query and the search count of a target day, print if it is a trending search.
def is_trending(self, query, obs, threshold=2.0, verbose=False): mean_std = self.model[query] mean = mean_std['mean'] std = mean_std['std'] if std == 0: return 0 z_score = 0 if std == 0 else (obs - mean) / std if z_score >= threshold: print('Query:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_summaries(query, **kwargs):\n kwargs.update(stop=40)\n results = search(query, **kwargs)\n return results", "def print_query_results(top, ranked_docs, tweets_dict):\n print(\"\\n======================\\nTop {} results out of {} for the seached query:\\n\".format(top, len(ranked_docs)))\n f...
[ "0.5548936", "0.5346215", "0.5323977", "0.5319022", "0.5254017", "0.5195979", "0.5192909", "0.5135565", "0.5119089", "0.5085207", "0.50782067", "0.50756866", "0.5059136", "0.5048238", "0.504457", "0.50232935", "0.50215286", "0.5013767", "0.49961308", "0.49793246", "0.49758604...
0.67611754
0
Insert the node in the pool while keeping the list ordered
def _insort(self, node): lo = 0 hi = len(self._pool) while lo < hi: mid = (lo+hi)//2 if node.getFScore() < self._pool[mid].getFScore(): hi = mid else: lo = mid + 1 self._pool.insert(lo, node)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, item):\n self.pool.append(item)\n if len(self.pool) == self.min_tree_size:\n self.trees.append(_ExtendedVPTree(self.pool, self.dist_fn))\n self.pool = []\n while len(self.trees) > 1 and self.trees[-1].size == self.trees[-2].size:\n a = self.tre...
[ "0.7667233", "0.6957252", "0.6911093", "0.6906873", "0.6902494", "0.68778276", "0.68612325", "0.68103176", "0.6698447", "0.6686913", "0.6661174", "0.6657637", "0.663719", "0.6592982", "0.65645444", "0.65637296", "0.6548128", "0.6548128", "0.65428025", "0.65298736", "0.6517346...
0.7041996
1
Select a training set using bounds and removing bad stars listed by miles_id
def reselect(psi, mlib, bad_ids, bounds, normwave=1.0): psi.load_training_data(training_data=mlib) psi.renormalize_library_spectra(bylabel='luminosity') ind = [psi.training_labels['miles_id'].tolist().index(b) for b in bad_ids if b in psi.training_labels['miles_id']] psi.leave_out(ind) ps...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_miles():\n pass", "def prepare_stars_that_need_bg_ols():\n\n wanted = Table.read(\n '/priv/mulga1/marusa/chronostar_projects/solar_neighbourhood/data/ScoCen_box_result_15M_ready_for_bg_ols.fits')\n\n old = Table.read('../scocen/data/data_table_cartesian_including_tims_stars_with_bg_ols_an...
[ "0.5276049", "0.5273973", "0.51479864", "0.5062504", "0.5028881", "0.50263315", "0.5004832", "0.4982481", "0.49806812", "0.49644077", "0.4949936", "0.49388617", "0.49267182", "0.49214765", "0.48964393", "0.4892896", "0.4888821", "0.48468703", "0.48425525", "0.48361737", "0.48...
0.66139275
0
Add a new cost to the game, and specify its argument to be either "x" or an integer indicating which player's control it is, e.g. 0 corresponds to u0. Also assign a weight.
def add_cost(self, cost, arg, weight=1.0): self._costs.append(cost) self._args.append(arg) self._weights.append(weight)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modify_cost_ui(self):\n start = int(input('start vertex: '))\n end = int(input('end vertex: '))\n new_cost = int(input('new cost:'))\n self._graph.set_cost(start, end, new_cost)", "def pay_costs(self):\r\n cost = self.cost\r\n if cost:\r\n self.owner.playe...
[ "0.6767534", "0.6652392", "0.6588768", "0.6343475", "0.6253546", "0.6237438", "0.6206167", "0.6081702", "0.60636467", "0.6009516", "0.60010755", "0.60007304", "0.59654087", "0.5939619", "0.5916045", "0.5913929", "0.5879315", "0.58626837", "0.5856857", "0.5855542", "0.58376867...
0.73511064
0
search the connection dict for a connection with the given credentials if it does not exist return None
def _search_connection(self, host, login, passwd, conn): self._connections_lock.acquireRead() try: if (host in self._connections): connections = self._connections[host] for connection in connections: if (connection.login == login and conne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_conn(self, v):\n pass", "def find(self, host, auth):\n key = (host, auth)\n if key not in self.conns:\n conn = None\n hooks = self._conn_hooks or self._default_hooks\n for hook in hooks:\n conn = hook.connect(host, auth)\n ...
[ "0.6082193", "0.595682", "0.57623744", "0.57599026", "0.5676277", "0.5652135", "0.5629163", "0.55771023", "0.5570008", "0.5568602", "0.55506784", "0.55425876", "0.5504469", "0.54814166", "0.54796517", "0.54769784", "0.54490864", "0.5443782", "0.5438864", "0.54086894", "0.5344...
0.7468279
0
returns True if the given host is up and we are able to establish a connection using the given credentials.
def host_is_up(self, conn_type, hostname): try: socket_host = socket.socket(socket.AF_INET, socket.SOCK_STREAM) socket_host.settimeout(1) if conn_type == CONN_SSH: if ':' in hostname: LIBVIRT_HOST, PORT = (hostname).split(":") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _hostOK(self, host):\n if os.system(\"ping -c 1 $node &> /dev/null\"):\n # No access to host\n return False\n elif os.system(\"ssh -n -a -x $node 'ls' &> /dev/null\"):\n # No route to host\n return False\n else:\n return True", "def connect(self, host):\...
[ "0.7012886", "0.6841955", "0.683889", "0.6831195", "0.6776678", "0.672287", "0.6645877", "0.66088516", "0.6569485", "0.65640897", "0.6558447", "0.64660376", "0.6453001", "0.6423161", "0.6347177", "0.6343511", "0.6319121", "0.63095516", "0.63028175", "0.6296875", "0.6284501", ...
0.7004618
1
Get cache available modes
def get_cache_modes(self): return { 'default': 'Default', 'none': 'Disabled', 'writethrough': 'Write through', 'writeback': 'Write back', 'directsync': 'Direct sync', # since libvirt 0.9.5 'unsafe': 'Unsafe', # since libvirt 0.9.7 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_modes(self):\n return self.__modes", "def get_modes(self):\n return self.circuit.get_modes()", "def get_modes(self):\n return [i for i, j in enumerate(self._modemap._map) if j is not None]", "def GetPackageModes(self):\n return self._modes", "def getDisplayModes(self, obj):\n ...
[ "0.7667383", "0.72479606", "0.69156", "0.6770021", "0.6730972", "0.67248976", "0.67051697", "0.65991604", "0.6582566", "0.6569532", "0.6535891", "0.65308326", "0.6494066", "0.64745134", "0.64707595", "0.6465972", "0.6453078", "0.6370738", "0.6333793", "0.6291779", "0.6269459"...
0.8117048
0
Get available image filename extensions
def get_file_extensions(self): return [ 'img', 'qcow', 'qcow2' ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def img_extensions():\n return [\".JPG\"]", "def _find_image_ext(path):\n path = os.path.splitext(path)[0]\n for ext in _KNOWN_IMG_EXTS:\n this_path = '%s.%s' % (path, ext)\n if os.path.isfile(this_path):\n break\n else:\n ext = 'png'\n return ('%s.%s' % (path, ext)...
[ "0.82903993", "0.75822943", "0.6993073", "0.69822615", "0.6939367", "0.6936169", "0.6916194", "0.6858548", "0.6853195", "0.68105775", "0.67916983", "0.6760089", "0.6752293", "0.67319727", "0.66924596", "0.665736", "0.66368914", "0.66174495", "0.65980184", "0.65717566", "0.655...
0.7709785
1
Get variables that participate in an expression The exact variables returned depends on the method used to determine incidence. For example, ``method=IncidenceMethod.identify_variables`` will return all variables participating in the expression, while ``method=IncidenceMethod.standard_repn`` will return only the variab...
def get_incident_variables(expr, **kwds): config = IncidenceConfig(kwds) method = config.method include_fixed = config.include_fixed linear_only = config.linear_only if linear_only and method is IncidenceMethod.identify_variables: raise RuntimeError( "linear_only=True is not supp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables(self, *args, **kwargs):\n return self._optimizer.variables(*args, **kwargs)", "def variables(self) -> pulumi.Input[Sequence[pulumi.Input['AssetModelExpressionVariableArgs']]]:\n return pulumi.get(self, \"variables\")", "def variables(self) -> pulumi.Input[Sequence[pulumi.Input['...
[ "0.54273486", "0.519651", "0.519651", "0.5124917", "0.511992", "0.5001495", "0.4977053", "0.4906163", "0.4903531", "0.48541722", "0.48529178", "0.4833822", "0.48131612", "0.47701487", "0.47678682", "0.47662506", "0.47530222", "0.4728819", "0.4672121", "0.4639792", "0.46338844...
0.6816663
0
Convert data columns to datetimes. Check if object columns in a dataframe can be parsed as dates. If yes, rewrite column with values parsed as dates.
def recognize_dates(dframe): for i, dtype in enumerate(dframe.dtypes): if dtype.type == np.object_: column = dframe.columns[i] new_column = _convert_column_to_date(dframe, column) if not new_column is None: dframe[column] = new_column return dframe
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert(frame):\n frame = frame.convert_objects(convert_numeric=True)\n for column in frame:\n if column in c.dates:\n frame[column] = frame[column].astype('datetime64')\n return frame", "def _preprocess_temporal_columns(df: DataFrame) -> DataFrame:\n for col in df.select_dtype...
[ "0.75098544", "0.7087017", "0.7058885", "0.69461", "0.69408333", "0.69273263", "0.6719332", "0.65359586", "0.65048695", "0.6471247", "0.63772154", "0.63733363", "0.636413", "0.63515455", "0.6293363", "0.6286831", "0.622281", "0.61918646", "0.613217", "0.60787344", "0.6051648"...
0.7748912
0
Inline conversion of column in dframe to date type.
def _convert_column_to_date(dframe, column): try: return dframe[column].apply(parse_date) except AttributeError: # it is already a datetime pass except ValueError: # it is not a correctly formatted date pass except OverflowError: # it is a number that is t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert(frame):\n frame = frame.convert_objects(convert_numeric=True)\n for column in frame:\n if column in c.dates:\n frame[column] = frame[column].astype('datetime64')\n return frame", "def recognize_dates(dframe):\n for i, dtype in enumerate(dframe.dtypes):\n if dtype...
[ "0.73377407", "0.7082545", "0.70686716", "0.6882879", "0.6664283", "0.65086806", "0.6308564", "0.6289679", "0.6258719", "0.62177616", "0.6204766", "0.61239797", "0.6123751", "0.612236", "0.61110026", "0.6083815", "0.6065003", "0.6064322", "0.60449094", "0.6017213", "0.5970576...
0.77725387
0
Factory method to create products in bulk
def _create_products(self, count): products = [] for _ in range(count): test_product = ProductFactory() resp = self.app.post( "/products", json=test_product.serialize(), content_type="application/json" ) self.assertEqual( re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_products():\n try:\n # Instantiate the class and separate objects into two lists\n challenge = Challenge()\n # Get all products\n product_base = challenge.get_products(\"product_groups.json\")\n # Divide the products into independent (no parent) and dependent (with ...
[ "0.6968747", "0.6812674", "0.6615797", "0.64685774", "0.64421254", "0.6324715", "0.63008446", "0.62979835", "0.62922496", "0.6292198", "0.62311196", "0.6229129", "0.6210707", "0.6197677", "0.6176031", "0.6120767", "0.60924333", "0.60886025", "0.6088115", "0.6080419", "0.60525...
0.74040735
0
Get a Product thats not found
def test_get_product_not_found(self): resp = self.app.get("/products/0") self.assertEqual(resp.status_code, status.HTTP_404_NOT_FOUND)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_view_product_that_doesnot_exist_in_inventory(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['token']\n product = dict(\n prod_name='NY_denims',\n category='denims',\n stock=20,\n price=150\n ...
[ "0.64637876", "0.6316111", "0.62717265", "0.62078625", "0.6204175", "0.6191436", "0.6137049", "0.6117989", "0.60395724", "0.6025381", "0.5980918", "0.5956974", "0.5952704", "0.59502584", "0.59479815", "0.5933025", "0.59325606", "0.59083056", "0.5860325", "0.58585984", "0.5841...
0.7146867
0
Update a product that's not found
def test_update_product_not_found(self): test_product = ProductFactory() resp = self.app.put( "/products/0", json=test_product.serialize(), content_type="application/json") self.assertEqual(resp.status_code, status.HTTP_404_NOT_FOUND)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_nonexistant_product(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['token']\n product_update = dict(\n prod_name='NY_jeans',\n category='denims',\n stock=50,\n price=180\n )\n r...
[ "0.7755959", "0.69539016", "0.68117", "0.6803016", "0.67777824", "0.67455566", "0.6744153", "0.66796154", "0.66655266", "0.66557616", "0.6611811", "0.6587238", "0.6578127", "0.650325", "0.64935625", "0.6461904", "0.6457218", "0.64401424", "0.6436152", "0.64352506", "0.6408705...
0.7826843
0
Query Products by Name
def test_query_product_list_by_name(self): products = self._create_products(10) test_name = products[0].name name_products = [product for product in products if product.name == test_name] resp = self.app.get( "/products", query_string="name={}".format(quote_plus(test_name)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_product_by_name(name, filters):\n return store_handler.search_product_by_name(name, filters)", "def get_products_by_name(name: str = '') -> List[Product]:\n products = []\n for p in get_market().products.values():\n if not name or p.name == name:\n products.append(p)\n re...
[ "0.77571255", "0.7277679", "0.69687986", "0.6940939", "0.68371516", "0.6783547", "0.6539629", "0.649505", "0.6493726", "0.6487274", "0.63656807", "0.63614637", "0.6341274", "0.6323044", "0.63042194", "0.63033676", "0.6300684", "0.6264636", "0.6254242", "0.61925507", "0.617534...
0.787972
0
Query Products by Price
def test_query_product_list_by_price(self): products = self._create_products(10) test_price_low = 30 test_price_high = 100 price_products = [product for product in products if product.price >= test_price_low and product.price <= test_price_high] resp = self.app.get( "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_by_price(cls, price: float):\n cls.logger.info(\"Processing price query for %s ...\", price)\n return cls.query.filter(cls.price == price).order_by(cls.id).all()", "def get_price():\n \n #Teacher's code. Could not get it working.\n #price = db(db.product.name == productName).selec...
[ "0.77169204", "0.70002115", "0.69464356", "0.6510316", "0.65097415", "0.62784094", "0.60495", "0.5991454", "0.591836", "0.59093183", "0.59022754", "0.58641595", "0.5856563", "0.58137536", "0.58039916", "0.5785772", "0.57851064", "0.5779367", "0.57670563", "0.57445174", "0.571...
0.7231043
1
Query Products by Owner
def test_query_product_list_by_owner(self): products = self._create_products(10) test_owner = products[0].owner owner_products = [product for product in products if product.owner == test_owner] resp = self.app.get( "/products", query_string="owner={}".format(quote_plus(test_o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def types_query(owner_name):\n query = Products.query.with_entities(Products.type_name.label('Type'))\\\n .filter_by(owner_name=owner_name)\\\n .distinct()\n return query", "def get_queryset(self):\n # distinct is needed to prevent multiple instances of product in resultset if multiple...
[ "0.6768723", "0.61156183", "0.609776", "0.5931458", "0.5862229", "0.5770455", "0.57525074", "0.56665504", "0.56071067", "0.5597102", "0.55941105", "0.5563768", "0.55417967", "0.5494908", "0.5489049", "0.54659927", "0.5462975", "0.5459433", "0.5454487", "0.54510623", "0.537464...
0.7920442
0
Query Products by Category
def test_query_product_list_by_category(self): products = self._create_products(10) test_category = products[0].category category_products = [product for product in products if product.category == test_category] resp = self.app.get( "/products", query_string="category={}".for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_by_category(self, category):\n products = self.db.query(f\"\"\"\n SELECT product.id, product.name, product.nutrition_grade,\n product.url from product\n JOIN product_category ON product_category.product_id = product.id\n JOIN category ON product_catego...
[ "0.74648166", "0.7428132", "0.7380659", "0.7182066", "0.71150404", "0.7018691", "0.6981515", "0.69386107", "0.67928493", "0.65949214", "0.65824056", "0.65634036", "0.6523916", "0.6504536", "0.64832276", "0.6429339", "0.64186263", "0.640796", "0.6405535", "0.63815475", "0.6366...
0.7572366
0
Create a Product with missing data
def test_create_product_no_data(self): resp = self.app.post( "/products", json={}, content_type="application/json" ) self.assertEqual(resp.status_code, status.HTTP_400_BAD_REQUEST)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_product_nullables(self):\n self.assertIsNone(self.product3.main_image)\n self.assertIsNone(self.product3.protein)\n self.assertIsNone(self.product3.fat)\n self.assertIsNone(self.product3.carbs)\n self.assertIsNone(self.product3.calories)", "def test_object_is_not_creat...
[ "0.65588826", "0.65119845", "0.64869165", "0.64614993", "0.64162344", "0.6397853", "0.63894874", "0.63328326", "0.63087726", "0.63005304", "0.62383354", "0.61990327", "0.6116126", "0.6066462", "0.60569936", "0.6048549", "0.6039679", "0.6032216", "0.60268784", "0.6024345", "0....
0.6918995
0
Changes the autorestart of containers from `enabled` to `disabled` before testing. and Rolls them back after testing.
def disable_and_enable_autorestart(duthost): containers_autorestart_states = duthost.get_container_autorestart_states() disabled_autorestart_containers = [] for container_name, state in containers_autorestart_states.items(): if state == "enabled": logger.info("Disabling the autorestart ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_snat_with_docker_restart(self):\n client1, client2, client3, client4 = self.setup_common_namespaces_pods(isolation=True,\n ip_fabric_snat=True,\n ...
[ "0.61138785", "0.60227", "0.58034", "0.5697476", "0.56964064", "0.56822544", "0.5647414", "0.5551629", "0.5535789", "0.5524584", "0.5502802", "0.54687196", "0.5447686", "0.54389983", "0.539913", "0.53575975", "0.53541076", "0.5346021", "0.53380066", "0.5320651", "0.5305538", ...
0.7235915
0
Determine whether all critical processes are running on a DUT.
def check_all_critical_processes_running(duthost): processes_status = duthost.all_critical_process_status() for container_name, processes in processes_status.items(): if processes["status"] is False or len(processes["exited_critical_process"]) > 0: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_all_critical_processes_running(duthost, containers_in_namespaces):\n for container_name in containers_in_namespaces.keys():\n critical_group_list, critical_process_list, succeeded = duthost.get_critical_group_and_process_lists(container_name)\n pytest_assert(succeeded, \"Failed to get c...
[ "0.65400195", "0.60207695", "0.57399637", "0.57262933", "0.57225025", "0.56745917", "0.56673086", "0.56650007", "0.56184125", "0.5609883", "0.5588666", "0.558465", "0.55782294", "0.5553434", "0.55380064", "0.55248475", "0.552245", "0.55095863", "0.55095375", "0.55017614", "0....
0.7781073
0
Postchecks the status of critical processes and state of BGP sessions.
def post_test_check(duthost, up_bgp_neighbors): return check_all_critical_processes_running(duthost) and duthost.check_bgp_session_state(up_bgp_neighbors, "established")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postcheck_critical_processes_status(duthost, up_bgp_neighbors):\n logger.info(\"Post-checking status of critical processes and BGP sessions...\")\n return wait_until(CONTAINER_RESTART_THRESHOLD_SECS, CONTAINER_CHECK_INTERVAL_SECS,\n post_test_check, duthost, up_bgp_neighbors)", "de...
[ "0.80828786", "0.5697959", "0.5336708", "0.529694", "0.52572876", "0.52431744", "0.5241118", "0.5191066", "0.51878256", "0.51425236", "0.5135133", "0.51114684", "0.5093498", "0.50799394", "0.5071869", "0.50672776", "0.50268024", "0.5007689", "0.4973994", "0.49144378", "0.4879...
0.7309506
1
Calls the subfunctions to postcheck the status of critical processes and state of BGP sessions.
def postcheck_critical_processes_status(duthost, up_bgp_neighbors): logger.info("Post-checking status of critical processes and BGP sessions...") return wait_until(CONTAINER_RESTART_THRESHOLD_SECS, CONTAINER_CHECK_INTERVAL_SECS, post_test_check, duthost, up_bgp_neighbors)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_test_check(duthost, up_bgp_neighbors):\n return check_all_critical_processes_running(duthost) and duthost.check_bgp_session_state(up_bgp_neighbors, \"established\")", "def test_monitoring_critical_processes(duthosts, rand_one_dut_hostname, tbinfo):\n duthost = duthosts[rand_one_dut_hostname]\n ...
[ "0.72556096", "0.5686549", "0.5339325", "0.5301807", "0.52516687", "0.52454084", "0.519396", "0.5187959", "0.51391155", "0.51372373", "0.512589", "0.5117025", "0.50786775", "0.50724775", "0.5057341", "0.50528455", "0.5034411", "0.5020003", "0.50148195", "0.50130874", "0.50058...
0.7728775
0
Generates the regex of expected alerting messages for the critical processes in each namespace.
def get_expected_alerting_messages(duthost, containers_in_namespaces): expected_alerting_messages = [] for container_name in containers_in_namespaces.keys(): logger.info("Generating the expected alerting messages for container '{}'...".format(container_name)) critical_group_list, critical_proce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consolidate_messages(self, msg):", "def test_grammar_rules_regex(self) -> None:\n for rule in self.rules.grammar_regex:\n positions: List[Tuple[int, int]] = self.report.get_regex_postions(\n rule[\"regex\"], ignore_case=True\n )\n for position in positio...
[ "0.50213844", "0.50037074", "0.5003278", "0.48729175", "0.48187172", "0.48116156", "0.4792515", "0.47602898", "0.47558495", "0.47525597", "0.47493368", "0.4742021", "0.47021222", "0.46752995", "0.46742684", "0.46568444", "0.46313027", "0.46234998", "0.46216774", "0.45829964", ...
0.56598777
0
This function will get namespace ids for each running container.
def get_containers_namespace_ids(duthost, skip_containers): containers_in_namespaces = defaultdict(list) logger.info("Getting the namespace ids for each container...") containers_states, succeed = duthost.get_feature_status() pytest_assert(succeed, "Failed to get feature status of containers!") fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ids_from_container_name(base_container_name):\n container_prefix = base_container_name + \".\"\n lines = dockercall(\"ps\", \"-a\").splitlines()\n ids = []\n for line in lines[1:]:\n parts = line.strip().split()\n id = parts[0]\n name = parts[-1]\n if name == base_co...
[ "0.70109284", "0.6791072", "0.6595834", "0.63834894", "0.63087237", "0.6285637", "0.6281564", "0.6224409", "0.60925496", "0.60820377", "0.60146886", "0.5981212", "0.5971256", "0.5968702", "0.5937967", "0.59332734", "0.59242743", "0.59154207", "0.5843595", "0.5813481", "0.5806...
0.7505328
0