query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Loop through available emails at the specified time and send emails containing link to the youtube video
def send_video_links(): email_list = Emails.query.filter_by(status="active").all() print("Sending newsletters to ", len(email_list), " users") random_video = get_random_video_link() video_link = f"https://www.youtube.com/watch?v={random_video[1]}" for email in email_list: #send email to us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_realtime_email(self,body_):\n import smtplib, ssl\n\n port = 465 # For SSL\n smtp_server = \"smtp.gmail.com\"\n sender_email = self.fromaddr # Enter your address\n receiver_email = self.toaddr # Enter receiver address\n password = self.pswd\n message = f...
[ "0.6318766", "0.62500906", "0.6119919", "0.5765977", "0.5693172", "0.5690263", "0.56841874", "0.56350535", "0.5619672", "0.56012964", "0.55933404", "0.5580555", "0.55799156", "0.55671567", "0.5559276", "0.55554837", "0.554504", "0.5533154", "0.5532039", "0.5523625", "0.550718...
0.80123353
0
Perform "delta test" which, for each station checks each hour in a day, checks for jumps between consecutive observations that exceed a given threshold.
def step_check(obs, nstnnets, var, ivar, qc_flag): iqcflag = istepflag ndts = len(obs[:, 0, ivar]) # # of hours in d. level1 = suspflag level2 = warnflag # if too_many_spikes (hours around which a spike is found) or more are found, flag all ndts worth. too_many_spikes = 2 # set two max...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_stimOn_delays(data, **_):\n metric = np.nan_to_num(data[\"stimOn_times\"] - data[\"stimOnTrigger_times\"], nan=np.inf)\n passed = (metric <= 0.15) & (metric > 0)\n assert data[\"intervals\"].shape[0] == len(metric) == len(passed)\n return metric, passed", "def check_stimOff_delays(data, **_...
[ "0.5618953", "0.55575085", "0.5495588", "0.5383822", "0.5307905", "0.5293913", "0.5288574", "0.52735865", "0.52714", "0.52712524", "0.52702117", "0.52625877", "0.5234081", "0.5225572", "0.52182305", "0.5217845", "0.52138704", "0.52123916", "0.51968604", "0.5191688", "0.518829...
0.53497034
4
For each station, for a day of data, calculate mean and std deviation. Compare std deviation to set values and if it's too small, flag entire day as suspect (1) or warning (2). Also check the difference between subsequent obs and flag if this difference is too small.
def persistence_check(obs, nstnnets, var, ivar, qc_flag): iqcflag = ipersistflag ndts = len(obs[:, 0, ivar]) # number of dts in obs. min_nobs = 8 # minimum number of good obs to do 24-hr std deviation test. level = warnflag pdeltas = { 'dew': 0.1, 'wind_gust': 0.0, 'rel_h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_std(data, tables, detrend=False, detrend_kw={'how':'linear'}, chunk_size='2min', falseverbose=False):\n from . import signal as pmdata\n import numpy as np\n import pandas as pd\n from . import algs\n\n #-----------\n # Detrend the data or not\n if detrend:\n df = pmdata.detre...
[ "0.6323308", "0.6181202", "0.5973835", "0.5918576", "0.588349", "0.5823822", "0.5766629", "0.5749268", "0.57383245", "0.57383245", "0.5730596", "0.5702945", "0.569965", "0.5698367", "0.56733954", "0.567308", "0.56422246", "0.56317925", "0.56248516", "0.552794", "0.5518978", ...
0.5318998
50
Spatial_check does does a spatial QC test using a simple neighbor check whereby it looks at stations within a radius and elevation band and checks if at least one value is near the value in question. If not, it tries a bigger radius and checks again, and if not again, the value is flagged.
def spatial_check(obs, nstnnets, lat, lon, elev, var, ivar, qc_flag): ndts = len(obs[:, 0, 0]) # number of hours in obs. roism = 100.0 # smaller radius of influence. roibg = 150.0 # bigger radius of influence. min_stations = 2 # min # of stns needed for testing. level1 = suspflag level2 = w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_nearest_filter(self):\n for airport, reports, count in (\n (True, True, 6),\n (True, False, 16),\n (False, True, 6),\n (False, False, 30),\n ):\n stations = station.nearest(30, -80, 30, airport, reports, 1.5)\n self.assertEqua...
[ "0.5917477", "0.5785617", "0.5634171", "0.5627542", "0.56037885", "0.54991764", "0.5456539", "0.54477155", "0.5431013", "0.53721654", "0.5309238", "0.52754253", "0.5254569", "0.52498955", "0.5234829", "0.520549", "0.520544", "0.51749706", "0.5160689", "0.5160598", "0.51577854...
0.6094638
0
Execute an external process with the given command.
def execute(parent, cmd, *args, **kwargs): with xtrace(parent, flatten(cmd)) as h: try: code = subprocess.call(cmd, *args, **kwargs) except: sys.exit( DiagnosticReporter.fatal(EXCEPTION_EXECUTING_PROCESS, cmd[0])) finally: h.report(code) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(command, **kwargs):\n proc = ProcessWrapper(command, **kwargs)\n proc.run()\n return proc.join()", "def execute(command):\n process = subprocess.Popen(command, stdout=subprocess.PIPE)\n return process.communicate()", "def executeCommand(command):\n time.sleep(1)\n #return os.sy...
[ "0.7686777", "0.7311152", "0.7208237", "0.7196334", "0.7129636", "0.7074382", "0.69738877", "0.69667447", "0.68976897", "0.684397", "0.68372613", "0.67790544", "0.67153364", "0.6662913", "0.6654921", "0.664873", "0.66351396", "0.6610151", "0.65903133", "0.6584907", "0.6583633...
0.61334276
85
Verifica si el numero es par
def es_par(x): if x == 0: print('Es cero') elif x % 2: print('Es impar') else: print('Es par')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_if_it_includes_a_number_if_the_number_is(self):\n self.assertNotIn(16, prime_numbers(16))", "def isintparname(self,parname_): # 3\n res,resargs = self.__obj.isintparname(parname_)\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n ...
[ "0.62935865", "0.6170519", "0.6041902", "0.6038277", "0.60228485", "0.5984323", "0.59038234", "0.5883155", "0.5881418", "0.5859558", "0.5853608", "0.5849341", "0.5844487", "0.5840633", "0.58350194", "0.58315754", "0.5823626", "0.58214515", "0.58213025", "0.58170676", "0.58013...
0.5861336
9
Convert a coordinate to the point format used in R3 protocol
def to_cmd(c: Coordinate, pose_flag: Optional[int] = 7): txt = ("{:.{d}f}".format(i, d=c.digits) if i is not None else "" for i in c.values) return f'({",".join(txt)}) ({pose_flag},0)'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coordinate_point_to_coordinate(self, point):\n return self.gen(self._point_to_ray[point])", "def convert(coords):\n lat = coords[:4]\n lon = coords[4:]\n\n lat = lat[:2] + \".\" + lat[2:]\n\n if int(lon[0]) > 5:\n lon = \"-\" + lon[:2] + \".\" + lon[2:]\n else:\n lon = \"-...
[ "0.66741616", "0.64301664", "0.62839675", "0.6281405", "0.62608045", "0.62392443", "0.62174106", "0.6155676", "0.61556274", "0.6136992", "0.611316", "0.61059934", "0.6103914", "0.60896146", "0.608129", "0.6037829", "0.598683", "0.5964238", "0.5938356", "0.5923728", "0.5906637...
0.0
-1
Gets a dataset tuple with instructions for reading ImageNet.
def get_split(split_name, dataset_dir, file_pattern=None, reader=None): if split_name not in _SPLITS_TO_SIZES: raise ValueError('split name %s was not recognized.' % split_name) if not file_pattern: file_pattern = _FILE_PATTERN file_pattern = os.path.join(dataset_dir, file_pattern % split_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataset(self):\n\n trainset = datasets.ImageNet('datasets/ImageNet/train/', split='train', transform=self.train_transforms,\n target_transform=None, download=True)\n valset = datasets.ImageNet('datasets/ImageNet/val/', split='val', transform=self.val_transf...
[ "0.68794817", "0.6613766", "0.6534691", "0.64912057", "0.62819463", "0.627172", "0.6127508", "0.60656", "0.6060858", "0.6053814", "0.6050378", "0.60380644", "0.59980446", "0.5997365", "0.5990953", "0.5964309", "0.59536415", "0.593581", "0.5916653", "0.5915211", "0.5911865", ...
0.0
-1
Returns a function run by the chief worker to warmstart the training.
def get_variables_to_restore(): # checkpoint_exclude_scopes=["distance-module", "InceptionV4/Logits"] checkpoint_exclude_scopes=["DeInceptionV4"] exclusions = [scope.strip() for scope in checkpoint_exclude_scopes] variables_to_restore = [] for var in slim.get_model_variables(): excluded = F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_train_function(self):\n if self.train_function is None:\n print('compiling train function...')\n start = time.time()\n inputs = self._estimator.inputs + [self.T_Y]\n\n training_updates = self.optimizer.get_updates(\n self._estimator.traina...
[ "0.6448144", "0.59868366", "0.5864569", "0.57344204", "0.56454474", "0.5639581", "0.5620158", "0.5602923", "0.55440265", "0.5528322", "0.5525694", "0.5521015", "0.55153054", "0.55153054", "0.55153054", "0.5466412", "0.54663765", "0.5445845", "0.54326403", "0.54326403", "0.542...
0.0
-1
Searches the provided modules for the named class and returns it.
def find_class_by_name(name, modules): modules = [getattr(module, name, None) for module in modules] return next(a for a in modules if a)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_class(class_name, module_paths=None):\n class_ = locate(class_name)\n if (class_ is None) and (module_paths is not None):\n for module_path in module_paths:\n class_ = locate('.'.join([module_path, class_name]))\n if class_ is not None:\n break\n\n if cl...
[ "0.799943", "0.78490835", "0.768902", "0.76566696", "0.7428545", "0.7255041", "0.71981335", "0.7016138", "0.690594", "0.6841157", "0.68327856", "0.6830363", "0.67620075", "0.67466897", "0.67217135", "0.6679323", "0.6639524", "0.6617279", "0.66102403", "0.64862704", "0.6444248...
0.8418128
0
Tests wholefunction forcedcompilation. This test checks that stateless_random_ can be used in forcedcompilation scenarios (e.g. TPU). The new version of stateless_random_ requires the intermediate tensor `alg` to be compiletime constant, so we need to check that this requirement won't prevent `seed` from depending on v...
def testForcedCompile(self): if config.list_logical_devices('TPU'): self.skipTest('To accommodate OSS, experimental_compile support for TPU ' 'is not linked in.') # GPU doesn't support int32 variables, so we use int64. v = variables.Variable([1, 2], dtype=dtypes.int64) @def_fu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testDistributionOfStatelessRandomUniform(self, alg, dtype, seed):\n philox = random_ops_util.Algorithm.PHILOX\n auto_select = random_ops_util.Algorithm.AUTO_SELECT\n device = xla_device()\n if 'CPU' in device.device_type:\n device_type = 'CPU'\n elif 'GPU' in device.device_type:\n devi...
[ "0.68754524", "0.59406036", "0.5894597", "0.58839476", "0.5882948", "0.5839431", "0.58107805", "0.5770772", "0.5769387", "0.57007724", "0.56494707", "0.5602415", "0.55889", "0.55538785", "0.5541321", "0.5540075", "0.55398744", "0.55398744", "0.55097663", "0.5445315", "0.54414...
0.75544333
0
Tests all values of `alg`.
def testAlg(self, op, alg_group): if config.list_logical_devices('TPU') or config.list_logical_devices('GPU'): self.skipTest('Only _cpu tests linked in support for jit_compile on CPU.') seed = [1, 2] shape = [2, 3] outputs = [] for alg in alg_group: with ops.device('CPU'): output...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testing():\n from random import randint\n algorithms = [dynamic_programming, patience_sort, lis]\n\n sequences = [[],\n [1, 2, 3, 4, 5],\n [5, 4, 3, 2, 1],\n [1, 1, 1, 1],\n [3, 2, 6, 4, 5, 1]]\n sequences.append([26, 65, 42, 18, 73, 7...
[ "0.5886989", "0.5785402", "0.56681657", "0.55894595", "0.5576564", "0.55730575", "0.55704665", "0.5555382", "0.55321616", "0.55156225", "0.54750127", "0.5433971", "0.54276794", "0.53705645", "0.5362628", "0.5354084", "0.53357923", "0.53281313", "0.5325226", "0.5306349", "0.52...
0.6314615
0
Tests an OOM bug of StatelessRandomNormalV2 on TPU.
def testLargeNormal(self): with self.session() as sess, self.test_scope(): seed_t = array_ops.placeholder(dtypes.int32, shape=[2]) key, counter, alg = (gen_stateless_random_ops_v2. stateless_random_get_key_counter_alg(seed_t)) x = gen_stateless_random_ops_v2.stateless_ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_random_small_sample_error(self):\n with self.assertRaises(ValueError):\n random_small_sample([], 1e7)", "def safe_rand(self):\n rand_n = np.random.rand()\n if rand_n == float(1):\n rand_n -= 1e-10\n return rand_n", "def test_rng_null(self):\n assert check_random_...
[ "0.6402965", "0.6271759", "0.6156134", "0.60297525", "0.60209405", "0.5990309", "0.5852385", "0.58344805", "0.58285826", "0.5805117", "0.5793341", "0.57845455", "0.5761305", "0.5755326", "0.56997", "0.567426", "0.56445813", "0.5642521", "0.56110024", "0.5595961", "0.55892664"...
0.68676966
0
Use Pearson's Chisquared test to test for uniformity.
def testDistributionOfStatelessRandomUniform(self, alg, dtype, seed): philox = random_ops_util.Algorithm.PHILOX auto_select = random_ops_util.Algorithm.AUTO_SELECT device = xla_device() if 'CPU' in device.device_type: device_type = 'CPU' elif 'GPU' in device.device_type: device_type = 'G...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_perfect_square():", "def test_handcrafted_examples(self):\n for i in range(1000):\n self.assertEqual(perfectd(0), True)\n self.assertEqual(prime(0), False)\n self.assertEqual(prime(2), True)\n self.assertEqual(prime(7), True)\n self.assertEqual...
[ "0.63705397", "0.6365156", "0.6357226", "0.63283384", "0.62204665", "0.6165126", "0.6116574", "0.61068803", "0.60982686", "0.6009989", "0.5992657", "0.59221864", "0.59080833", "0.590566", "0.59009594", "0.5900922", "0.58917534", "0.5864173", "0.586082", "0.58577067", "0.58508...
0.0
-1
Use AndersonDarling test to test distribution appears normal.
def testDistributionOfStatelessRandomNormal(self, dtype, seed): with self.session() as sess, self.test_scope(): seed_t = array_ops.placeholder(dtypes.int32, shape=[2]) n = 1000 x = stateless.stateless_random_normal(shape=[n], seed=seed_t, dtype=dtype) y = sess.run(x, {seed_t: seed}) # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_2_normal(self):\n print(\"test 2: normal distributions\")\n\n mean = self.means[0]\n dispersion = self.dispersions[0]\n\n for i, x in enumerate(self.X):\n print(i+1, normal(x, mean, dispersion), sep=' : ')", "def calculate_anderson_darling(p, scipy_distribution='no...
[ "0.67574555", "0.6637979", "0.6378692", "0.6172181", "0.61652255", "0.6160517", "0.60518044", "0.6038389", "0.58880514", "0.5874568", "0.5843989", "0.5839309", "0.5826366", "0.5820332", "0.5807704", "0.5770181", "0.5748254", "0.5744736", "0.5732599", "0.5699256", "0.56802166"...
0.63507676
3
Convert base 4 representation of nucleotide pattern back into the pattern
def number_to_pattern(cls, number: int, k: int, nucleotide_map: dict=None) -> str: if nucleotide_map is None: nucleotide_map = cls._nucleotide_int_map base = 4 new_str = '' while number > 0: new_str += str(number % base) number = number // base ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patten2number(sequence):\n try:\n if len(sequence) == 0:\n return 0\n last_base = sequence[-1]\n prefix = sequence[:-1]\n return 4 * patten2number(prefix) + BASE_TO_NUMBER[last_base]\n except KeyError:\n raise ValueError('Not able to convert nucleotide: %s' %...
[ "0.65671915", "0.630287", "0.5952596", "0.5781955", "0.5513129", "0.54676986", "0.54493964", "0.5342942", "0.5323698", "0.52741677", "0.5225667", "0.52242655", "0.5197174", "0.5196729", "0.5168805", "0.51648843", "0.516025", "0.51343155", "0.5102335", "0.5079092", "0.50685626...
0.5834671
3
Get reverse complement of a nucleotide sequence e.g. ACTG > CAGT
def get_reverse_complement(cls, pattern: str) -> str: return ''.join(reversed([cls.dna_complement[nuc] for nuc in pattern]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_reverse_complement(dna):\r\n\r\n seq = Seq(dna)\r\n rev_seq = seq.reverse_complement()\r\n return str(rev_seq)", "def reverse_complement(seq):\n if sys.version_info.major == 2:\n conversion = string.maketrans('ACGTacgt','TGCAtgca')\n else:\n conversion = str.maketrans('ACGTac...
[ "0.80981606", "0.808695", "0.8052708", "0.8022656", "0.8015278", "0.80125123", "0.7950907", "0.7912492", "0.78892535", "0.7876142", "0.7800502", "0.77927697", "0.7769712", "0.776244", "0.7713318", "0.77050287", "0.7662372", "0.7642589", "0.7624215", "0.7604546", "0.75933224",...
0.7605945
19
Get all nearby patterns within hamming distance max_distance
def _get_neighbors(cls, pattern: str, max_distance: int) -> List[str]: return get_neighborhood(pattern, ''.join(cls.nucleobases.keys()), max_distance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbors(pattern, d):\n tides = set([\"A\", \"C\", \"G\", \"T\"])\n if d == 0:\n return set([pattern])\n if len(pattern) == 1:\n return tides\n neighborhood = set([])\n suffix_neighbors = neighbors(pattern[1:], d)\n for text in suffix_neighbors:\n if ham_dist(pattern[1:]...
[ "0.60756433", "0.586826", "0.5829426", "0.57467127", "0.5627865", "0.5625409", "0.5618249", "0.55964565", "0.5565963", "0.55327606", "0.54889137", "0.54708976", "0.5464563", "0.5462131", "0.53667754", "0.5361143", "0.5356188", "0.5352204", "0.53446394", "0.52754647", "0.52659...
0.6922144
0
Return whether a user has already voted
def has_voted(self, user): return user.choice_set.filter(vote=self).exists()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_voted(self, user, ip_address):\r\n if user.is_anonymous():\r\n return len(self.usedip_set.filter(address=ip_address))>0\r\n else:\r\n return self.is_expert(user) and self.expert_set.filter(user=user)[0].voted", "def vote_exists(self):\n con = psycopg2.connect(**...
[ "0.77529603", "0.7535864", "0.65836215", "0.6361191", "0.6361191", "0.62889564", "0.626759", "0.625303", "0.6251645", "0.62177384", "0.6179546", "0.61739177", "0.6148994", "0.6078883", "0.5977957", "0.5973656", "0.5966548", "0.58713126", "0.5856128", "0.584966", "0.58388305",...
0.84560186
0
Generates a sequential id unique for this exe session.
def newId(): global lastId lastId += 1 return 'id%d' % lastId
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_session_id():\n return utils.get_32bit_random_num()", "def gen_id(self) -> str:\n self._id += 1\n return str(self._id)", "def get_generator_id() -> str:\n res = os.name + str(os.getpid()) + str(random.randint(-1000, 1000))\n res = hashlib.sha224(res.encode('utf-8')).dige...
[ "0.79363555", "0.7690968", "0.7679877", "0.7678485", "0.7678172", "0.76593244", "0.76256436", "0.7593852", "0.7585659", "0.7561776", "0.7545377", "0.7545377", "0.74505085", "0.7432396", "0.7419196", "0.73942035", "0.7390403", "0.73147666", "0.7304635", "0.72568166", "0.725517...
0.6847583
57
Generates the documentation type string
def docType(): return (u'<?xml version="1.0" encoding="UTF-8"?>\n' u'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 ' u'Transitional//EN" ' u'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type_doc_name(type):\n name = type.name\n if type.is_simple:\n return _get_simple_type_mapping(name)\n elif type.is_enum:\n return '{0}.{1}'.format(get_package_name(name), get_enum_name(name))\n elif type.is_complex:\n return '{0}.{1}'.format(get_package_name(name), get_cla...
[ "0.709732", "0.70114326", "0.6969742", "0.6881393", "0.6750534", "0.6399172", "0.6352584", "0.63299954", "0.62866646", "0.6270518", "0.62495774", "0.6239356", "0.6220442", "0.62143224", "0.61934704", "0.61934704", "0.6177531", "0.61766106", "0.6158902", "0.61579823", "0.61572...
0.658089
5
Generates the common header XHTML
def header(style=u'default'): return (docType() + u'<html xmlns="http://www.w3.org/1999/xhtml">\n' u'<head>\n' u'<style type="text/css">\n' u' @import url(/css/exe.css);\n' u' @import url(/style/base.css);\n' u' @import url(/style/%s/conten...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def renderHeader(self, name):\n html = u\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"\n html += u'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 '\n html += u'Transitional//EN\" '\n html += u'\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\\n'\n html += u...
[ "0.74553525", "0.7425798", "0.7310361", "0.72088915", "0.7052019", "0.70107", "0.6935558", "0.6934121", "0.6880456", "0.67663515", "0.6619934", "0.6499455", "0.6466389", "0.6450139", "0.6448158", "0.644058", "0.63944995", "0.63919437", "0.63732743", "0.6343069", "0.633073", ...
0.7433771
1
Generates the common page footer XHTML
def footer(): return u'</form></body></html>\n'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_footer():\n return '</body></html>'", "def WriteFooter(self):\n return", "def common_html_footer(outfile: TextIO, indexpath: str = \"\") -> None:\n outfile.write(\"\\n\")\n outfile.write(\" <footer>\\n\")\n outfile.write(\" <figure id=\\\"footmap\\\"><script type=\\\"text/javasc...
[ "0.8209114", "0.7574358", "0.7457577", "0.73935664", "0.7313318", "0.7277284", "0.7117509", "0.6951311", "0.6943452", "0.6894811", "0.68390125", "0.6802921", "0.6785685", "0.6785685", "0.66476876", "0.6617712", "0.66044176", "0.65872484", "0.65571517", "0.6428135", "0.6368189...
0.69917154
7
Adds a hidden field to a form
def hiddenField(name, value=u""): html = u"<input type=\"hidden\" " html += u"name=\"%s\" " % name html += u"id=\"%s\" " % name html += u"value=\"%s\"/>\n" % value return html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_Hidden(request):\n schema = schemaish.Structure()\n schema.add('Visible', schemaish.String())\n schema.add('Hidden', schemaish.String())\n\n form = formish.Form(schema, 'form')\n form['Hidden'].widget = formish.Hidden()\n return form", "def add_hidden_input(\n self,\n nam...
[ "0.7501152", "0.70271856", "0.65093476", "0.65093476", "0.65093476", "0.6465911", "0.63139683", "0.6194723", "0.6082944", "0.6055618", "0.59255236", "0.5911473", "0.56137574", "0.5548985", "0.55037236", "0.54748195", "0.53836066", "0.53755033", "0.53438234", "0.5320544", "0.5...
0.73137796
1
Adds a text input to a form
def textInput(name, value=u"", size=40, disabled=u"", **kwargs): html = u"<input type=\"text\" " html += u"name=\"%s\" " % name html += u"id=\"%s\" " % name html += u"value=\"%s\" " % value html += u"size=\"%s\" " % size for key, val in kwargs.items(): html += u' %s="%s"' % (key.replace...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TextFieldOptionsAddText(builder, text):\n return AddText(builder, text)", "def add_text_edit(self, name, value=None, label=None, add_indicator=None, location=(None,0)):\n widget=edit.LVTextEdit(self,value=value)\n widget.setObjectName(_fromUtf8(self.name+\"_\"+name))\n return self.add...
[ "0.66011745", "0.64968944", "0.6393522", "0.63851357", "0.6345662", "0.6336389", "0.63294166", "0.6301488", "0.62964344", "0.62394214", "0.62078243", "0.61974514", "0.6119116", "0.60870457", "0.60489494", "0.60489494", "0.60489494", "0.6038742", "0.6032041", "0.59584516", "0....
0.6069953
14
Adds a text area to a form
def textArea(name, value="", disabled="", cols="80", rows="8"): log.debug(u"textArea %s" % value) html = u'<textarea name="%s" ' % name html += 'id = "%s"' % name if disabled: html += u'disabled="disabled" ' html += u'style=\"width:100%"' html += u'cols="%s" rows="%s">' %(cols, rows) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_TextAreaColsAndRows(request):\n schema = schemaish.Structure()\n schema.add('textAreaCustom', schemaish.String())\n\n form = formish.Form(schema, 'form')\n form['textAreaCustom'].widget = formish.TextArea(cols=20,rows=4)\n return form", "def form_TextAreaStrip(request):\n schema = sche...
[ "0.70033205", "0.65260094", "0.64773655", "0.63208395", "0.614079", "0.6058951", "0.60212314", "0.59914464", "0.5919031", "0.584087", "0.5834448", "0.57610804", "0.57148194", "0.5706627", "0.5695541", "0.5676627", "0.5663998", "0.5651863", "0.5630527", "0.5580933", "0.5561570...
0.6582529
1
Adds a editor to a form
def richTextArea(name, value="", width="100%", height=100): log.debug(u"richTextArea %s, height=%s" % (value, height)) html = u'<textarea name="%s" ' % name html += u'style=\"width:' + width + '; height:' + str(height) + 'px;" ' html += u'class="mceEditor" ' html += u'cols="52" rows="8">' html ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addEditor(self, editor: QWidget, type: str):\n if type == NodeType.Node:\n self.ui.layoutNode.addWidget(editor)\n else:\n self.ui.layoutSpec.addWidget(editor)\n editor.setVisible(False)\n self._editor_dict[type] = editor", "def editor():\n pass", "de...
[ "0.71680623", "0.6764222", "0.6761778", "0.6656136", "0.66182566", "0.6595414", "0.63707495", "0.6299939", "0.596213", "0.5892001", "0.58302903", "0.57997614", "0.57550246", "0.57416964", "0.5740289", "0.57223016", "0.56482834", "0.56267375", "0.5620819", "0.55850405", "0.556...
0.0
-1
Returns the XHTML for an image
def image(name, value, width="", height="", alt=None): if alt is None: alt = name log.debug(u"image %s" % value) html = u"<img id=\"%s\" " % name html += u'alt="%s" ' % alt if width: html += u"width=\"%s\" " % width if height: html += u"height=\"%s\" " % height html ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image(self, src, title, text):\n src = escape_link(src)\n text = escape(text, quote=True)\n if title:\n title = escape(title, quote=True)\n html = '<img src=\"%s\" alt=\"%s\" title=\"%s\"' % (src, text, title)\n else:\n html = '<img src=\"%s\" alt=\"...
[ "0.69611996", "0.67423284", "0.67166317", "0.669368", "0.6571337", "0.6528769", "0.64684045", "0.6419062", "0.6330245", "0.6321424", "0.62781984", "0.62261355", "0.6211105", "0.61640394", "0.61532664", "0.61467296", "0.6129031", "0.6124882", "0.6118638", "0.61112887", "0.6087...
0.65244746
6
Returns the XHTML for flash. 'params' is a dictionary of name, value pairs that will be turned into a bunch of tags
def flash(src, width, height, id_=None, params=None, **kwparams): log.debug(u"flash %s" % src) stan = \ T._object(type='application/x-shockwave-flash', width=width, height=height, **kwparams) if id_: stan.attributes['id'] = id_ stan.attr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flash_message(self, request):\n return FlashMessagesElement()", "def flash_message(self, request):\n return FlashMessagesElement()", "def mediaplayer(src,width=400,height=250):\n return XML('<embed allowfullscreen=\"true\" allowscriptaccess=\"always\" flashvars=\"height=%(height)s&widt...
[ "0.57332635", "0.57332635", "0.54264164", "0.5292242", "0.52749646", "0.52352464", "0.52238834", "0.5138303", "0.5057226", "0.49932578", "0.48965406", "0.48927727", "0.48299986", "0.4776292", "0.4755645", "0.4748481", "0.47427863", "0.47350845", "0.46903166", "0.46795943", "0...
0.6152918
0
Returns the XHTML for a flash movie
def flashMovie(movie, width, height, resourcesDir=''): log.debug(u"flash %s" % movie) src = resourcesDir src += 'videoContainer.swf?videoSource=%s&autoPlay=false' % movie return flash(src, width, height, params={'movie': src, 'menu' : 'false'})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mediaplayer(src,width=400,height=250):\n return XML('<embed allowfullscreen=\"true\" allowscriptaccess=\"always\" flashvars=\"height=%(height)s&width=%(width)s&file=%(src)s\" height=\"%(height)spx\" src=\"%(url)s\" width=\"%(width)spx\"></embed>'%dict(url=URL('static','plugin_wiki/mediaplayer.swf'),src=...
[ "0.67839944", "0.66639304", "0.57066834", "0.55713564", "0.5500554", "0.5500554", "0.5404905", "0.5377051", "0.53009015", "0.5279575", "0.5074877", "0.5065303", "0.506393", "0.5044238", "0.49113828", "0.48947486", "0.48934996", "0.48878092", "0.48661235", "0.48661235", "0.481...
0.66404533
2
Adds a submit button to a form
def submitButton(name, value, enabled=True, **kwargs): html = u'<input class="button" type="submit" name="%s" ' % name html += u'value="%s" ' % value if not enabled: html += u' disabled' for key, val in kwargs.items(): html += u' %s="%s"' % (key.replace('_', ''), val.replace('"', '\\"')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit(self):\n self.driver.find_element(*BaseLocators.SUBMIT_BUTTON).click()", "def htmlSubmit(text, parName, attr='', onlyOnce=False):\n if onlyOnce:\n # FIXME: this doesn't work yet - it disables submission\n s = '<input type=\"button\" name=\"%s\" value=\"%s\"' % (parName,text)\n ...
[ "0.68879074", "0.6494475", "0.64015305", "0.62032175", "0.603863", "0.5858578", "0.5552755", "0.553243", "0.55282384", "0.551249", "0.5505816", "0.5478316", "0.5471883", "0.5449857", "0.5446425", "0.5442419", "0.54329383", "0.5431257", "0.54045117", "0.5382428", "0.53795224",...
0.6159708
4
Adds a NONsubmit button to a form
def button(name, value, enabled=True, **kwargs): html = u'<input type="button" name="%s"' % name html += u' value="%s"' % value if not enabled: html += u' disabled' for key, val in kwargs.items(): html += u' %s="%s"' % (key.replace('_', ''), val.replace('"', '\\"')) html += u'/>\n' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def htmlSubmit(text, parName, attr='', onlyOnce=False):\n if onlyOnce:\n # FIXME: this doesn't work yet - it disables submission\n s = '<input type=\"button\" name=\"%s\" value=\"%s\"' % (parName,text)\n s += ' onclick=\"this.form.submit()\"'\n s += '%s />\\n' % sep(attr)\n re...
[ "0.6327102", "0.5945655", "0.5778734", "0.56412446", "0.55579346", "0.5518062", "0.5501025", "0.5490777", "0.5484271", "0.5459105", "0.54470176", "0.54278964", "0.5370909", "0.5295769", "0.5279715", "0.5274572", "0.5236318", "0.52006644", "0.5200261", "0.5189816", "0.5171976"...
0.0
-1
Adds a feedback button
def feedbackButton(name, value=None, enabled=True, **kwparams): if value is None: value = _(u'Feedback') kwparams.setdefault('class', 'feedbackbutton') return button(name, value, enabled, **kwparams)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feedback():\n return render_template(\"feedback.html\")", "async def feedback(self, ctx, *, feedback):\n url = os.environ.get(\"FEEDBACK_WEBHOOK\", None)\n if url:\n webhook = Webhook.from_url(url, adapter=RequestsWebhookAdapter())\n embed = discord.Embed(description=fe...
[ "0.6485179", "0.6422864", "0.63804656", "0.61001223", "0.60035086", "0.5993185", "0.5932232", "0.59071183", "0.58853", "0.58728164", "0.5863927", "0.57498777", "0.5733604", "0.5621053", "0.5585151", "0.5584186", "0.5577006", "0.55740017", "0.5564906", "0.555417", "0.5552995",...
0.7189924
0
Adds an image link which will trigger the javascript needed to post a form with the action and object passed in the args
def submitImage(action, object_, imageFile, title=u"", isChanged=1): onclick = "submitLink('%s', '%s', %d);" % (action, object_, isChanged) titleText = u'' if title: titleText = u'title="%s" ' % title html = u'<a %s' % titleText html += u' href="#" onclick="%s">' % onclick html += u'<im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirmThenSubmitImage(message, action, object_, imageFile, \n title=u\"\", isChanged=1):\n html = u\"<a \"\n if title:\n html += u\"title=\\\"\"+title+\"\\\" \"\n html += \" href=\\\"#\\\" \"\n html += \"onclick=\\\"confirmThenSubmitLink('\"+message+\"', '\"+actio...
[ "0.6467419", "0.6291856", "0.5695191", "0.55512077", "0.54058975", "0.54002887", "0.5396562", "0.5381138", "0.5377608", "0.5334084", "0.52907336", "0.52907336", "0.52527887", "0.524726", "0.5207052", "0.51895213", "0.51895213", "0.51895213", "0.51895213", "0.5137885", "0.5096...
0.75600076
0
Adds an image link which will trigger the javascript needed to post a form with the action and object passed in the args
def insertSymbol(name, image, title, string, text ='', num=0): onclick = "insertSymbol('%s', '%s', %d);" % (name, string, num) html = u'<a onclick="%s" ' % onclick html += u'title="%s">' % title html += text if image <> "": html += u'<img alt="%s" src="%s"/>' % ('symbol', image) html += ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submitImage(action, object_, imageFile, title=u\"\", isChanged=1):\n onclick = \"submitLink('%s', '%s', %d);\" % (action, object_, isChanged)\n titleText = u''\n if title:\n titleText = u'title=\"%s\" ' % title\n html = u'<a %s' % titleText\n html += u' href=\"#\" onclick=\"%s\">' % oncl...
[ "0.755693", "0.6464906", "0.62912494", "0.56953716", "0.55490845", "0.5405367", "0.5399931", "0.5397571", "0.53791434", "0.5375661", "0.5333625", "0.528877", "0.528877", "0.5250972", "0.52447456", "0.52054894", "0.51920485", "0.51920485", "0.51920485", "0.51920485", "0.513760...
0.0
-1
Adds an image link which will trigger the javascript needed to post a form with the action and object passed in the args
def confirmThenSubmitImage(message, action, object_, imageFile, title=u"", isChanged=1): html = u"<a " if title: html += u"title=\""+title+"\" " html += " href=\"#\" " html += "onclick=\"confirmThenSubmitLink('"+message+"', '"+action+"', " html += "'"+object_+"',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submitImage(action, object_, imageFile, title=u\"\", isChanged=1):\n onclick = \"submitLink('%s', '%s', %d);\" % (action, object_, isChanged)\n titleText = u''\n if title:\n titleText = u'title=\"%s\" ' % title\n html = u'<a %s' % titleText\n html += u' href=\"#\" onclick=\"%s\">' % oncl...
[ "0.75593275", "0.62918144", "0.56968886", "0.5551059", "0.5405228", "0.5401838", "0.5398058", "0.5381089", "0.53773266", "0.5335524", "0.5290609", "0.5290609", "0.52529365", "0.52459806", "0.52074254", "0.51923656", "0.51923656", "0.51923656", "0.51923656", "0.51381063", "0.5...
0.6467512
1
Add a option input
def option(name, checked, value): chkStr = u'' if checked: chkStr = u'checked="checked"' html = (u'<input type="radio" name="%s"' u' value="%s" %s/>\n' % (name, value, chkStr)) return html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_option(self, label, action, type_func, shortcut):\n pass", "def addOption(self, parser):\n pass", "def add_option(self, *args, **kwargs):\n self.parser.add_option(*args, **kwargs)", "def add_input(self, var):\n raise NotImplementedError", "def add_option(self, label, act...
[ "0.70007855", "0.651464", "0.64733064", "0.64430857", "0.63783973", "0.6359492", "0.6343427", "0.6325761", "0.6278913", "0.62763506", "0.62433684", "0.618273", "0.6166285", "0.6092797", "0.6078784", "0.6073309", "0.6062212", "0.60102624", "0.5983635", "0.59361875", "0.5933234...
0.0
-1
Add a help instruction for a element
def elementInstruc(instruc, imageFile="help.gif", label=None): if label is None: label = _(u"Instructions") if not instruc.strip(): html = u'' else: id_ = newId() html = u'<a onmousedown="Javascript:updateCoords(event);" ' html += u' title="%s" ' % _(u'Click for comp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_help(text):\n global default_text\n default_text += text", "def help(self):", "def help(self):", "def help_description():\n pass", "def help(self, value: str):\n self._help = value", "def help(self):\r\n self._short_help(None, None, None, None)", "def help():\n \n ...
[ "0.71474516", "0.7015725", "0.7015725", "0.6980685", "0.6937339", "0.6921581", "0.6878647", "0.6869714", "0.6837826", "0.6819098", "0.67912656", "0.67912656", "0.6771253", "0.6769475", "0.6750411", "0.6733238", "0.6719639", "0.67021394", "0.66982436", "0.6681121", "0.666716",...
0.0
-1
A standard way for showing any form field nicely
def formField(type_, caption, action, object_='', instruction='', *args, **kwargs): html = '<div class="block">' html += '<strong>%s</strong>' % caption if instruction: html += elementInstruc(instruction) html += '</div>' html += '<div class="block">' if type_ == 'select': html ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html(self):\n lbl = escape(self._label)\n dis = ('disabled' if not self._enabled else '')\n typ = ('password' if self._password else 'text')\n nam = escape(self._name)\n val = escape(self._value)\n return '%s <input name=\"%s\" %s type=\"%s\" value=\"%s\" size=\"%i\">' % (lbl, nam, dis, typ, ...
[ "0.6636922", "0.6503447", "0.6492283", "0.64133143", "0.64047253", "0.64039874", "0.6366983", "0.62991357", "0.62760854", "0.6225514", "0.61878324", "0.6112394", "0.6105818", "0.6105642", "0.6099386", "0.6054292", "0.6020611", "0.5959966", "0.59108335", "0.58825946", "0.58703...
0.68652034
0
Adds a dropdown selection to a form
def select(action, object_='', options=[], selection=None): html = u'<select ' html += u'name="'+action+object_+'" ' if action and object_: html += u'onchange="submitLink(\''+action+'\', \''+object_+'\');"' html += u'>\n' for option, value in options: html += u' <option value="'+uni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_SelectChoice(request):\n schema = schemaish.Structure()\n schema.add('mySelect', schemaish.Integer())\n options = [(1,'a'),(2,'b'),(3,'c')]\n\n form = formish.Form(schema, 'form')\n form['mySelect'].widget = formish.SelectChoice(options)\n return form", "def form_SelectWithOtherChoice(...
[ "0.70253795", "0.68037504", "0.619008", "0.61317617", "0.6127463", "0.60849595", "0.6075871", "0.6057535", "0.60314304", "0.59447914", "0.58972394", "0.58765864", "0.5842999", "0.5775621", "0.56882447", "0.56757563", "0.5617067", "0.55429757", "0.5520181", "0.5507859", "0.550...
0.52415097
32
Provides a styled editSectionHeading
def editModeHeading(text): return u'<p style="editModeHeading">%s</p>' % text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heading(self):\n return self.wrap(\"-------\")", "def format_heading(self, level, text):\n underlining = ['=', '-', '~', ][level-1] * len(text)\n return '%s\\n%s\\n\\n' % (text, underlining)", "def print_section_header(title, color):\n block = \"#\" * (len(title) + 2)\n print(\"\...
[ "0.66849434", "0.6272026", "0.6106788", "0.61038226", "0.60833454", "0.6072701", "0.5986174", "0.59668994", "0.5961167", "0.594331", "0.5935845", "0.5911637", "0.58749354", "0.58624434", "0.5846889", "0.5835326", "0.5825542", "0.58238256", "0.5794538", "0.57842624", "0.578426...
0.67918336
0
Construct a molecule from a InChI string
def MolFromInchi(inchi, sanitize=True, removeHs=True, logLevel=None, treatWarningAsError=False): try: mol, retcode, message, log = rdinchi.InchiToMol(inchi, sanitize, removeHs) except ValueError as e: logger.error(str(e)) return None if logLevel is not None: if logLevel not in logLevelToLogFuncti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_molecule_subclass_from_inchi(self):\n mol = MyMol.from_inchi(\"InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3\")\n assert isinstance(mol, MyMol)", "def ReadMolFromInchi(inchi=\"\"):\n import pybel\n temp=pybel.readstring(\"inchi\",inchi)\n smi=temp.write(\"smi\")\n mol = Chem.MolFromSmiles(...
[ "0.72785413", "0.69075364", "0.6564429", "0.6517638", "0.642409", "0.6403566", "0.62167716", "0.6087867", "0.60767406", "0.6017357", "0.5984189", "0.59590703", "0.5955019", "0.5944773", "0.5714933", "0.5712715", "0.5630374", "0.5622037", "0.56003404", "0.5586199", "0.5564522"...
0.0
-1
Returns the standard InChI string and InChI auxInfo for a molecule
def MolToInchiAndAuxInfo(mol, options="", logLevel=None, treatWarningAsError=False): inchi, retcode, message, logs, aux = rdinchi.MolToInchi(mol, options) if logLevel is not None: if logLevel not in logLevelToLogFunctionLookup: raise ValueError("Unsupported log level: %d" % logLevel) log = logLevelToL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inchi(self) -> str:\n if not self._inchi:\n self.sanitize(raise_exception=False)\n self._inchi = Chem.MolToInchi(self.rd_mol)\n if self._inchi is None:\n raise MoleculeException(\"Could not make InChI\")\n return self._inchi", "def MolToInchi(mol,...
[ "0.6346383", "0.5750787", "0.57444793", "0.5686185", "0.56063706", "0.56049293", "0.55815786", "0.55815786", "0.5549947", "0.5546916", "0.5512506", "0.54929435", "0.5482103", "0.5443629", "0.54201764", "0.5419237", "0.5418019", "0.533771", "0.52724075", "0.5272198", "0.523930...
0.58500123
1
Returns the standard InChI string and InChI auxInfo for a mol block
def MolBlockToInchiAndAuxInfo(molblock, options="", logLevel=None, treatWarningAsError=False): inchi, retcode, message, logs, aux = rdinchi.MolBlockToInchi(molblock, options) if logLevel is not None: if logLevel not in logLevelToLogFunctionLookup: raise ValueError("Unsupported log level: %d" % logLevel) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MolBlockToInchi(molblock, options=\"\", logLevel=None, treatWarningAsError=False):\n if options.find('AuxNone') == -1:\n if options:\n options += \" /AuxNone\"\n else:\n options += \"/AuxNone\"\n\n try:\n inchi, aux = MolBlockToInchiAndAuxInfo(molblock, options, logLevel=logLevel,\n ...
[ "0.64976436", "0.60744226", "0.6004788", "0.57994264", "0.5761588", "0.5618919", "0.554857", "0.5285582", "0.52573204", "0.52302134", "0.51718366", "0.5170532", "0.515442", "0.51395327", "0.5137501", "0.5132895", "0.5129088", "0.51100504", "0.5109222", "0.5099051", "0.5088721...
0.64511925
1
Returns the standard InChI string for a molecule
def MolToInchi(mol, options="", logLevel=None, treatWarningAsError=False): if options.find('AuxNone') == -1: if options: options += " /AuxNone" else: options += "/AuxNone" try: inchi, aux = MolToInchiAndAuxInfo(mol, options, logLevel=logLevel, treatWarn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inchi(self) -> str:\n if not self._inchi:\n self.sanitize(raise_exception=False)\n self._inchi = Chem.MolToInchi(self.rd_mol)\n if self._inchi is None:\n raise MoleculeException(\"Could not make InChI\")\n return self._inchi", "def inchi_key(self)...
[ "0.7660741", "0.63990366", "0.60433763", "0.595492", "0.5946647", "0.59346324", "0.592875", "0.5795559", "0.5732636", "0.57045305", "0.566792", "0.5595976", "0.5595365", "0.5565196", "0.55554646", "0.55542576", "0.5534849", "0.54897135", "0.54738885", "0.5453322", "0.5441915"...
0.5070574
79
Returns the standard InChI string for a mol block
def MolBlockToInchi(molblock, options="", logLevel=None, treatWarningAsError=False): if options.find('AuxNone') == -1: if options: options += " /AuxNone" else: options += "/AuxNone" try: inchi, aux = MolBlockToInchiAndAuxInfo(molblock, options, logLevel=logLevel, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inchi(self) -> str:\n if not self._inchi:\n self.sanitize(raise_exception=False)\n self._inchi = Chem.MolToInchi(self.rd_mol)\n if self._inchi is None:\n raise MoleculeException(\"Could not make InChI\")\n return self._inchi", "def ReadMolFromInch...
[ "0.6524756", "0.63204664", "0.5977838", "0.57800525", "0.5521084", "0.54988", "0.54791445", "0.5471375", "0.54505354", "0.54045933", "0.53946084", "0.53804225", "0.5335063", "0.52932346", "0.52757055", "0.524747", "0.5240518", "0.5237671", "0.5237412", "0.5205528", "0.5186665...
0.58252805
3
Return the InChI key for the given InChI string. Return None on error
def InchiToInchiKey(inchi): ret = rdinchi.InchiToInchiKey(inchi) if ret: return ret else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inchi_to_inchi_key(ich):\n return _rd_chem.inchi.InchiToInchiKey(ich)", "def inchi_key(self) -> str:\n if not self._inchi_key:\n self.sanitize(raise_exception=False)\n self._inchi_key = Chem.MolToInchiKey(self.rd_mol)\n if self._inchi_key is None:\n r...
[ "0.71598774", "0.7087606", "0.70870805", "0.67726326", "0.66098547", "0.6378951", "0.62275", "0.61656976", "0.59837407", "0.587364", "0.5690562", "0.5690562", "0.5690562", "0.5690562", "0.5690562", "0.5690562", "0.5690562", "0.5690562", "0.5690562", "0.5690562", "0.5690562", ...
0.7775047
0
Returns the standard InChI key for a molecule
def MolToInchiKey(mol, options=""): return rdinchi.MolToInchiKey(mol,options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inchi_key(self) -> str:\n if not self._inchi_key:\n self.sanitize(raise_exception=False)\n self._inchi_key = Chem.MolToInchiKey(self.rd_mol)\n if self._inchi_key is None:\n raise MoleculeException(\"Could not make InChI key\")\n return self._inchi_k...
[ "0.81321317", "0.7113956", "0.6988666", "0.68637294", "0.6657926", "0.6496378", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", ...
0.7232959
1
Compute the accuracies for a batch of predictions and answers
def batch_accuracy(predicted, true): _, predicted_index = predicted.max(dim=1, keepdim=True) agreeing = true.gather(dim=1, index=predicted_index) ''' Acc needs to be averaged over all 10 choose 9 subsets of human answers. While we could just use a loop, surely this can be done more efficiently (and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_metrics_for_multiclass(self, predicted_answers):\n total_correct_in_all = 0\n total_pred_in_all = len(predicted_answers)\n # initial a dict for total correct in topK counting.\n total_correct_in_topK = dict([(i, 0) for i in self.topK_list])\n total_pred_in_topK = dict([...
[ "0.72240007", "0.7196117", "0.7156245", "0.71237266", "0.7044354", "0.7011002", "0.69618726", "0.69563323", "0.69142157", "0.6911175", "0.69000417", "0.6897008", "0.6889631", "0.68849134", "0.6882984", "0.68819773", "0.68688965", "0.6854075", "0.6837835", "0.68339974", "0.681...
0.7324437
0
Parse command line arguments.
def parse_args(): parser = argparse.ArgumentParser("BaselineMembershipInferenceAttack") parser.add_argument("--batch_size", type=int, default=128, help="The batch size of normal training.") parser.add_argument("--train_epoch", type=int,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def parse_command_line(self, argv):\n from optparse import OptionParser\n usage = \"usage: %prog [options]\"\n parser = OptionParser(usage)\n\n (options, args) = parser.parse_args(argv)", "def parseArguments(self):\n iterator = iter(sys.argv[1:])...
[ "0.807208", "0.74767", "0.73985106", "0.73932225", "0.73173845", "0.72599804", "0.7232453", "0.7222555", "0.713585", "0.7102058", "0.71020466", "0.7096281", "0.7093058", "0.70890576", "0.7080071", "0.70745754", "0.70641047", "0.70633066", "0.70568484", "0.7051162", "0.7048470...
0.0
-1
get train dataset and test dataset for cifar10
def get_data(): transform = Compose([paddle.vision.Resize(32), Normalize(mean=[127.5], std=[127.5], data_format='CHW'), paddle.vision.transforms.Transpose()]) train_data = paddle.vision.datasets.Cifar10(mode='train', transform=transform) l = len(train_data) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataset(self):\n\n trainset = datasets.CIFAR10('datasets/CIFAR10/train/', train=True, transform=self.train_transforms,\n target_transform=None, download=True)\n valset = datasets.CIFAR10('datasets/CIFAR10/test/', train=False, transform=self.val_transforms,\n...
[ "0.80263996", "0.7815118", "0.73785543", "0.7335551", "0.7159393", "0.7085548", "0.7073933", "0.7025835", "0.702049", "0.69826376", "0.6974629", "0.6938204", "0.693361", "0.69160396", "0.6911001", "0.690179", "0.68777454", "0.6869696", "0.6860709", "0.6856323", "0.68560594", ...
0.69423556
11
get labels from multiple dataset
def get_all_labels(data_list): labels = [] for dataset in data_list: for data in dataset: labels.append(data[1]) return paddle.to_tensor(labels)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data_labels(datasets):\n # Split by words\n x_text = datasets['data']\n x_text = [clean_str(sent) for sent in x_text]\n # Generate labels\n labels = [0, 1, 2, 3, 4]\n print(len(x_text))\n for i in range(len(x_text)):\n label = [0 for j in datasets['target_names']] \n ...
[ "0.77368695", "0.7720466", "0.7348672", "0.7334549", "0.7235436", "0.71652806", "0.7130086", "0.7105828", "0.70865", "0.70461166", "0.6970475", "0.6970475", "0.6970475", "0.6970475", "0.6970475", "0.6970475", "0.6970475", "0.6970475", "0.6970475", "0.6970475", "0.6970475", ...
0.7676018
2
The training procedure that starts from training target model, then launchs baseline membership inference attack
def train_and_attack(args): mem_data, non_mem_data = get_data() num_classes = 10 model = paddle.Model(ResNet(num_classes)) # train model model.prepare(paddle.optimizer.Adam(parameters=model.parameters(), learning_rate=args.train_lr), paddle.nn.CrossEntropyLoss(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def train():\n # YOUR TRAINING CODE GOES HERE", "def train():\n pass", "def training(self) -> None:\n self.compile_model()\n self.train_epoch()\n self.agent.save()", "def train_nai...
[ "0.6831418", "0.67969114", "0.6743277", "0.6665565", "0.65510994", "0.6513925", "0.6478302", "0.6475857", "0.6475857", "0.6475857", "0.6475857", "0.6475857", "0.6414337", "0.6410145", "0.6364995", "0.6352841", "0.6326412", "0.63112336", "0.6307469", "0.6284598", "0.6273873", ...
0.73666734
0
Save checkpoint if a new best is achieved
def save_checkpoint(model, is_best, filename='./model/checkpoint.pth.tar'): if is_best: torch.save(model.state_dict(), filename) # save checkpoint else: print ("=> Validation Accuracy did not improve")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_checkpoint(state, is_best, filename='checkpoint/chpt.tar'):\n if is_best:\n print (\"=> Saving a new best\")\n torch.save(state, filename) # save checkpoint\n else:\n print (\"=> Validation Accuracy did not improve\")", "def save_checkpoint(self):\n ...
[ "0.8414909", "0.8096639", "0.79832625", "0.79078", "0.7821017", "0.78085893", "0.7779003", "0.77387804", "0.761438", "0.74721783", "0.735547", "0.735091", "0.73230714", "0.72978014", "0.7288464", "0.7276494", "0.7276335", "0.7263861", "0.7252227", "0.7241171", "0.7217522", ...
0.7952169
3
Querys the db and returns a list of the TrafficControl objects that are stored there. returns as a list of dicts that have a key for 'tc' and 'timeout'
def get_saved_shapings(self): query = 'SELECT * FROM CurrentShapings' with self._get_conn() as conn: results = conn.execute(query).fetchall() conn.close() # shapings = [{'tc': tc_obj, 'timeout': 123456}, ... ] shapings = [] for result in results: s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getConnectionTime(probe,since=None):\n\ttry:\n\t\tresult = {}\n\t\t\t\t\n\t\tconnectionResults = ProbeConnectionResult.objects.filter(test__log__probe = probe).prefetch_related('timecheck_set')\n\t\tif since != None:\n\t\t\tconnectionResults = connectionResults.filter(date__gte=since)\n\n\t\tssids = set(connec...
[ "0.5754736", "0.55170316", "0.54215854", "0.52672046", "0.5189539", "0.5179965", "0.5162168", "0.5150871", "0.5091114", "0.5085517", "0.5053782", "0.50338143", "0.50289965", "0.5020709", "0.5008953", "0.5006596", "0.49898326", "0.49799904", "0.49670634", "0.49581826", "0.4955...
0.490537
26
Test that pulling of debian native packages works
def test_pull_explicit_remote(self, repo): dest = os.path.join(self._tmpdir, 'cloned_repo') clone(['arg0', repo.path, dest]) cloned = ComponentTestGitRepository(dest) self._check_repo_state(cloned, 'master', ['master']) eq_(pull(['argv0', 'origin']), 0) assert len(repo.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_download_linux(salt_test_command, pkg_container, root_url, salt_release):\n res = pkg_container.container.run(salt_test_command)\n assert res.returncode == 0", "def test_get_rpms_in_external_repo(mock_makedirs, mock_dnf_base):\n RPM = namedtuple(\"RPM\", [\"arch\", \"epoch\", \"name\", \"releas...
[ "0.654571", "0.64206904", "0.631205", "0.6275644", "0.6266007", "0.61789083", "0.6118366", "0.6115174", "0.60432506", "0.60055846", "0.59587467", "0.5954195", "0.5938046", "0.59331083", "0.5919058", "0.59029514", "0.58995456", "0.5886596", "0.5878436", "0.584673", "0.58319265...
0.0
-1
Test that pulling of debian native packages works
def test_pull_default_remote(self, repo): dest = os.path.join(self._tmpdir, 'cloned_repo') clone(['arg0', repo.path, dest]) cloned = ComponentTestGitRepository(dest) self._check_repo_state(cloned, 'master', ['master']) eq_(pull(['argv0']), 0) assert len(repo.get_commits()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_download_linux(salt_test_command, pkg_container, root_url, salt_release):\n res = pkg_container.container.run(salt_test_command)\n assert res.returncode == 0", "def test_get_rpms_in_external_repo(mock_makedirs, mock_dnf_base):\n RPM = namedtuple(\"RPM\", [\"arch\", \"epoch\", \"name\", \"releas...
[ "0.6546456", "0.6420844", "0.6313209", "0.6276825", "0.62671494", "0.61788535", "0.6118443", "0.6115961", "0.6044262", "0.60066915", "0.5959526", "0.59548897", "0.5938736", "0.5934302", "0.59197736", "0.5903306", "0.58999807", "0.58880717", "0.5879673", "0.5848288", "0.583314...
0.0
-1
Implement signal generation method
def generateSignal(self, input): raise NotImplementedError("generateSignals() not implemented!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_signals(self):\n\n raise NotImplementedError('''\n Must implement generate_signals. Call help() for details.\n ''')", "def _generate_signal(self):\n x = np.arange(self.n, dtype='float')\n resample = np.random.rand(self.n) >= self.proba\n resample[0] = Tr...
[ "0.70712364", "0.685625", "0.6824514", "0.67229414", "0.66387045", "0.64469135", "0.6422895", "0.63325095", "0.630998", "0.62810314", "0.61788267", "0.6141524", "0.60813624", "0.6066498", "0.6045314", "0.6020478", "0.60055816", "0.59975064", "0.599733", "0.59551203", "0.59359...
0.77800155
0
Examples to run this script
def main(): input_video = sys.argv[1] input_audio = sys.argv[2] output_video = sys.argv[3] set_audio(input_video, input_audio, output_video)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def examples():\n script = \"DFT: Performs a Density Functional Theory .\"\n explain = (\"This code produces a numerical solution for the energy of a system of \"\n \"atoms.\")\n contents = [((\"Find the charge density for a sc cell with lattice parameter of 6 \"\n \"with 4 ...
[ "0.7200266", "0.7133502", "0.6964735", "0.6952409", "0.6941993", "0.6908678", "0.6896632", "0.6867165", "0.6867165", "0.6867165", "0.6867165", "0.6814864", "0.6543554", "0.6504114", "0.6484388", "0.6484388", "0.646267", "0.64583576", "0.64355856", "0.64224166", "0.6421345", ...
0.0
-1
Return all valid assignment statuses
def valid() -> List[str]: return [ AssignmentState.CREATED, AssignmentState.LAUNCHED, AssignmentState.ASSIGNED, AssignmentState.COMPLETED, AssignmentState.ACCEPTED, AssignmentState.MIXED, AssignmentState.REJECTED, As...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_assignment_completion_status(self, assignments):\n\n status_summary = {}\n\n for a in assignments:\n project_id = a.project_id\n user_id = a.user_id\n lof_labels_for_assignment = self._get_users_labels_for_assignment(project_id,\n ...
[ "0.70143026", "0.6910826", "0.6844077", "0.68170166", "0.68170166", "0.6687421", "0.6442801", "0.6300295", "0.62620544", "0.62461126", "0.6133815", "0.6131959", "0.609542", "0.6061567", "0.60590816", "0.60590816", "0.5903232", "0.5902111", "0.5862888", "0.5786772", "0.5783396...
0.7898887
0
Return all statuses that are considered incomplete
def incomplete() -> List[str]: return [ AssignmentState.CREATED, AssignmentState.LAUNCHED, AssignmentState.ASSIGNED, ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stalled(self):\n oneHourAgo = datetime.today() - timedelta(hours = 1)\n return self.filter(status=m.Update.IN_PROGRESS, requestedAt__lte=oneHourAgo)", "def valid_statuses(self):\n return [\n \"dish_maintenance\",\n \"dish_ok\",\n \"RF_maintenance\",\n ...
[ "0.64917", "0.6279671", "0.62576777", "0.6151896", "0.61158884", "0.61158884", "0.6105256", "0.58749634", "0.5759064", "0.5759049", "0.57464796", "0.5656729", "0.5593512", "0.5588268", "0.55776554", "0.55524373", "0.5532122", "0.55231184", "0.54844177", "0.5471768", "0.546771...
0.6704028
0
Return all statuses that should be considered spent budget
def payable() -> List[str]: return [ AssignmentState.LAUNCHED, AssignmentState.ASSIGNED, AssignmentState.COMPLETED, AssignmentState.ACCEPTED, AssignmentState.SOFT_REJECTED, ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_budgets(self) -> list:\n return list(self.budgets.values())", "def get_budgets(self) -> list:\n return self.budget_manager.get_budgets()", "def get_expenses(budget):\n return sum(expense['bgt'] for expense in budget['spend'])", "def goalStatus(self, fromdt, todt):\r\n ret = {}\r\n...
[ "0.6197711", "0.5866314", "0.58636606", "0.5837114", "0.5803818", "0.57145053", "0.5618266", "0.5618266", "0.557279", "0.55300575", "0.5525475", "0.5521347", "0.549343", "0.544975", "0.54426533", "0.5441119", "0.54360914", "0.5415565", "0.54076195", "0.5386957", "0.5374891", ...
0.0
-1
Return all statuses that are valids for a Unit
def valid_unit() -> List[str]: return [ AssignmentState.CREATED, AssignmentState.LAUNCHED, AssignmentState.ASSIGNED, AssignmentState.COMPLETED, AssignmentState.ACCEPTED, AssignmentState.REJECTED, AssignmentState.SOFT_REJECTED, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_statuses(self):\n return [\n \"dish_maintenance\",\n \"dish_ok\",\n \"RF_maintenance\",\n \"RF_ok\",\n \"digital_maintenance\",\n \"digital_ok\",\n \"calibration_maintenance\",\n \"calibration_ok\",\n ...
[ "0.656063", "0.5927815", "0.5911592", "0.5833105", "0.58151245", "0.57673633", "0.5725099", "0.5665793", "0.5665793", "0.5660064", "0.55945444", "0.553925", "0.55057263", "0.5491091", "0.54821205", "0.54818356", "0.5468045", "0.5451015", "0.5422831", "0.54221743", "0.536189",...
0.7242456
0
Return all statuses that are terminal for a Unit
def final_unit() -> List[str]: return [ AssignmentState.ACCEPTED, AssignmentState.EXPIRED, AssignmentState.SOFT_REJECTED, ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_status():\n return \"\"", "def all_status_strings(cls):\n return [info[1] for info in cls._STATUS_INFO]", "def get_statuses(self):\n return self.statuses", "def available_statuses(self):\n return self.pipeline.get(self.status, ())", "def available_statuses(self):\n ...
[ "0.64170635", "0.636362", "0.6179687", "0.6164907", "0.6164907", "0.615675", "0.6095279", "0.60594827", "0.60594827", "0.5980172", "0.5957454", "0.5952193", "0.594075", "0.5914528", "0.59069455", "0.59009343", "0.5834746", "0.5790579", "0.5789686", "0.5777166", "0.57682526", ...
0.5450325
49
Return all statuses that denote a unit having been completed
def completed() -> List[str]: return [ AssignmentState.COMPLETED, AssignmentState.ACCEPTED, AssignmentState.REJECTED, AssignmentState.SOFT_REJECTED, ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def final_unit() -> List[str]:\n return [\n AssignmentState.ACCEPTED,\n AssignmentState.EXPIRED,\n AssignmentState.SOFT_REJECTED,\n ]", "def get_completed_outputs(self):\n return [o for o in self.get_outputs() if o.get_status() == Constants.DONE]", "def get...
[ "0.67235607", "0.6332416", "0.62031937", "0.61352724", "0.6079362", "0.6010533", "0.5997141", "0.59853554", "0.5900161", "0.5900161", "0.5868536", "0.5863787", "0.5846556", "0.5814982", "0.5788143", "0.5734089", "0.57160795", "0.5701123", "0.5682662", "0.5680916", "0.56778914...
0.619753
3
Return all statuses that are terminal changes to a Unit's agent
def final_agent() -> List[str]: return [ AssignmentState.COMPLETED, AssignmentState.ACCEPTED, AssignmentState.REJECTED, AssignmentState.SOFT_REJECTED, AssignmentState.EXPIRED, ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_statuses(self):\n return self.statuses", "def all_statuses(cls):\n return list(cls.pipeline.keys())", "def all_statuses(cls):\n return list(cls.pipeline.keys())", "def all_status_strings(cls):\n return [info[1] for info in cls._STATUS_INFO]", "def available_statuses(self...
[ "0.6090644", "0.606578", "0.606578", "0.602715", "0.6008285", "0.6008285", "0.5971154", "0.59391505", "0.5897747", "0.5881984", "0.5844441", "0.5834486", "0.5834267", "0.58058405", "0.5776367", "0.5741957", "0.5713715", "0.57072484", "0.56672096", "0.5628539", "0.5623949", ...
0.54473484
33
Returns the rendered template in HTML format of the main page of the website for the GET request along the path "/" or "index.html". Returns Any
def index() -> Any: return render_template("index.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_page():\n return render_template(\"index.html\")", "def get(self):\n return render_template(\"index.html\")", "def get(self):\n template = Constants.JINJA_ENVIRONMENT.get_template('homepage.html')\n self.response.headers['Content-Type'] = 'text/html'\n self.response.writ...
[ "0.7773576", "0.7701407", "0.76876473", "0.75099677", "0.7498149", "0.7437251", "0.7437251", "0.7436899", "0.7420055", "0.7402748", "0.7386607", "0.7386607", "0.7386607", "0.73803544", "0.73803544", "0.73736036", "0.734291", "0.7334071", "0.73024625", "0.72956324", "0.7279382...
0.7218152
25
Returns the site icon for the GET request along the path "/favicon.ico". Returns Any
def favicon() -> Any: return send_from_directory(os.path.join(app.root_path, "static"), "favicon.ico", mimetype="image/png")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_favicon(self): \n favurl = \"%s://%s/favicon.ico\" % (self.urlparts.scheme, self.domain)\n r = requests.get(favurl)\n if r:\n return favurl\n else:\n return \"\"", "async def api_favicon(self):\n # SECURITY: We control the path of the file so ...
[ "0.79970914", "0.75161207", "0.7465618", "0.74292725", "0.74158657", "0.73389995", "0.73227185", "0.72797966", "0.72470355", "0.72041726", "0.7127063", "0.7098606", "0.6974032", "0.6884807", "0.6819414", "0.66975546", "0.6694368", "0.64336145", "0.64245147", "0.6389769", "0.6...
0.7102287
11
Prepares the file (image) to be sent for segmentation.
def prepare_input(image) -> Optional[np.ndarray]: try: array = np.array(Image.open(image)) if len(array.shape) != 3 or (array.shape[2] != 3): return None return array except Exception as e: print(e, file=sys.stderr) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self):\n meta_file_path = os.path.join(database_directory, 'data.txt')\n meta = pd.read_csv(meta_file_path, delimiter=' ', header=None)\n meta = meta[meta[0] != '45567.jpg'] # Corrupt image.\n meta.to_pickle(os.path.join(database_directory, 'meta.pkl'))\n for file...
[ "0.6084572", "0.59575695", "0.5840077", "0.583626", "0.5746459", "0.57462585", "0.5689625", "0.5584192", "0.55820864", "0.5489294", "0.54305816", "0.5362292", "0.53555655", "0.5353772", "0.5340276", "0.5322325", "0.5318856", "0.53078175", "0.5304188", "0.5268499", "0.5263105"...
0.0
-1
Prepares the image for sending to the client by converting it to text format.
def prepare_output(image: np.ndarray) -> str: response_image = Image.fromarray(np.uint8(image * 255)) buffer = BytesIO() response_image.save(buffer, "PNG") encoded = base64.b64encode(buffer.getvalue()) return "data:image/png;base64," + str(encoded)[2:-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prep_msg(self, msg):\r\n self.msg_image = self.font.render(\r\n msg, True, self.text_color, self.button_color)\r\n self.msg_image_rect = self.msg_image.get_rect()\r\n self.msg_image_rect.center = self.rect.center", "def prep_msg(self, msg):\r\n\t\tself.msg_image = self.font.r...
[ "0.65707946", "0.6427434", "0.6427434", "0.6412722", "0.63966095", "0.62622935", "0.61812085", "0.60693014", "0.5919003", "0.58565766", "0.5826771", "0.581563", "0.58148193", "0.5772711", "0.5729759", "0.5698953", "0.56830406", "0.5657847", "0.56474227", "0.5642789", "0.56408...
0.60236084
8
Processes a POST request for image segmentation and processes it based on the received request parameters. Returns Any
def predict() -> Any: threshold = request.form.get("threshold", type=float) source_size = request.form.get("source_size", type=bool) images = request.files.getlist("images") result = {} for image in images: input_image = prepare_input(image) if input_image is not None: ou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_handler(data, context):\n if context.request_content_type == 'application/x-image':\n payload = data.read()\n\n img = Image.open(io.BytesIO(payload))\n img = img.convert('RGB')\n img = img.resize((IMG_SIZE, IMG_SIZE), Image.NEAREST)\n img_array = image.img_to_array(i...
[ "0.6971213", "0.655263", "0.63524324", "0.61500496", "0.61297464", "0.60867846", "0.6001201", "0.59744674", "0.5959857", "0.5941481", "0.58751166", "0.58427125", "0.5840908", "0.57562405", "0.5677892", "0.56442463", "0.5642099", "0.56363547", "0.5599171", "0.55561036", "0.555...
0.5706896
14
The function is executed after each request and allows the client access to resources.
def after_request(response: Response) -> Response: response.headers.add("Access-Control-Allow-Origin", "*") response.headers.add("Access-Control-Allow-Headers", "Content-Type,Authorization") response.headers.add("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE") return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _after_serve_actions(self):\n pass", "def _handle_first_request(self):\n pass", "def request_access(self):\n pass", "def preRun_(self):\n super().preRun_()\n self.client = None", "def resources(self):", "async def _response_handler(self):", "def authorizeClients(s...
[ "0.6888452", "0.6410466", "0.60665774", "0.6043423", "0.59470767", "0.5932155", "0.5909394", "0.5878597", "0.5843578", "0.5820882", "0.58163774", "0.5806532", "0.57784736", "0.57709193", "0.5765497", "0.5747301", "0.573821", "0.5729589", "0.57053524", "0.56958234", "0.5678566...
0.0
-1
Returns if the next K elements exists in a list given a NODE
def is_group_valid(node, k): counter = 0 while node.next is not None and counter < k: node = node.next counter += 1 return counter == k
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_element_of(node, lst):\n for k in lst:\n if node is k:\n return True\n return False", "def my_func(k: int, lst: List) -> bool:\n\n if not len(lst) > 0:\n raise ValueError(\"Parameter 'lst' must have at least 2 elements\")\n\n try:\n for x in lst:\n fo...
[ "0.69980997", "0.64902776", "0.64226055", "0.61012685", "0.60695064", "0.6065002", "0.60114795", "0.5890691", "0.588333", "0.5854959", "0.58148426", "0.57728654", "0.577021", "0.57222736", "0.57114935", "0.57027185", "0.57027185", "0.5697907", "0.5697862", "0.56517047", "0.56...
0.65423954
1
Reverses a group of length K given a GROUP_HEAD, returning the new HEAD, new TAIL, and the next element that was detached.
def reverse_group(group_head, k): counter = 0 group_head.next = None previous_node = group_head next_node = previous_node.next_node while counter < k: new_next_node = new_node.next next_node.next = previous_node previous_node = next_node next_node = new_next_node ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverseList(head, k) :\n\n ptr = head\n new_head = None\n new_tail = None\n \n num_reverse = (n % k) if (n%k) != 0 else k\n while ptr :\n \n left_portion_start = ptr\n \n i = 1\n while ptr.next and i < num_reverse :\n ptr = ptr.next\n i...
[ "0.5858687", "0.56919616", "0.56714123", "0.54803526", "0.546783", "0.52534944", "0.519177", "0.51836807", "0.5168894", "0.5149832", "0.51307", "0.51258576", "0.5063978", "0.5059032", "0.505075", "0.50137126", "0.50092584", "0.50075793", "0.498712", "0.496472", "0.4932703", ...
0.8169252
0
Sorts records for fetch_state method fetch_state is expecting these records to be ordered from newest to oldest
def sort_records(records): return sorted(records, key=lambda r: r.value.event.datetime, reverse=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sort_records(self):\n self.records.sort(reverse=True, key=lambda record: record.timestamp)", "def sort_results(self):\n pass", "def sortby(self):\n ...", "def orderby():\n pass", "def _sort(self, row):\n if not self._head:\n self._head = self._create_head(row)...
[ "0.68760866", "0.65122795", "0.621062", "0.6098413", "0.5909024", "0.5905206", "0.5877997", "0.57966155", "0.5737469", "0.5735158", "0.57189", "0.5637238", "0.5595025", "0.55897605", "0.558635", "0.5570938", "0.5564488", "0.5541713", "0.55372554", "0.5536486", "0.5525967", ...
0.64857996
2
ensure we handle different styles of host_port specifications correctly
def test_host_port_parsing() -> None: examples = [ "http://localhost:9200", "https://localhost:9200", "localhost:9300", "localhost", "http://localhost:3400", "192.168.0.1", "192.168.0.1:9200", "http://192.168.2.1", "https://192.168.0.1:9300", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parse_host_port(self):\n # test default port for http\n endpoint = \"1.2.3.4\"\n default_protocol = baidubce.protocol.HTTP\n ret_protocol, host, port = utils.parse_host_port(endpoint, default_protocol)\n self.assertEqual(ret_protocol, baidubce.protocol.HTTP)\n sel...
[ "0.73706514", "0.69666415", "0.6963635", "0.6923132", "0.68688023", "0.677662", "0.67610186", "0.672299", "0.6717529", "0.66561246", "0.6630539", "0.6600969", "0.65933025", "0.65751106", "0.65122914", "0.64998335", "0.6483765", "0.63974476", "0.6387543", "0.63678545", "0.6342...
0.64203054
17
Compute the cross entropy loss given outputs and labels.
def loss_fn(outputs, labels): return nn.CrossEntropyLoss()(outputs, labels)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_entropy_loss(outputs, labels): \n# works properly\n \n m = labels.shape[0]\n p = outputs\n log_likelihood = -1*torch.log(p[range(m),labels])\n loss = torch.sum(log_likelihood) / m\n return loss.item()", "def loss_fn(outputs, labels, wts):\n\n # reshape labels to give a flat vecto...
[ "0.8123369", "0.78822637", "0.78552246", "0.76500595", "0.76134384", "0.7363692", "0.73583025", "0.73449636", "0.7331515", "0.7310738", "0.72997314", "0.7284572", "0.7263381", "0.7261452", "0.7139764", "0.71252644", "0.71147245", "0.7082844", "0.707002", "0.7058059", "0.70415...
0.8459237
0
Compute the accuracy, given the outputs and labels for all images.
def accuracy(outputs, labels): outputs = np.argmax(outputs, axis=1) return np.sum(outputs==labels)/float(labels.size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accuracy(outputs, labels):\n predicted = outputs.argmax(dim=1)\n correct = (predicted == labels).sum().item()\n return correct / labels.size(0)", "def accuracy(outputs, labels):\n outputs = np.argmax(outputs, axis=1)\n return np.sum(outputs == labels) / float(labels.size)", "def accuracy(out...
[ "0.8425722", "0.83553445", "0.8349379", "0.8345116", "0.81717366", "0.80323327", "0.8018599", "0.7950924", "0.7903909", "0.7850474", "0.7824042", "0.7801253", "0.77871346", "0.7722627", "0.7703765", "0.7697583", "0.76889527", "0.7661256", "0.76277435", "0.7615854", "0.7610093...
0.83619267
2
Demonstrate configuring an AWS KMS discoverylike keyring a particular AWS region and failover to others.
def run(aws_kms_cmk, source_plaintext): # type: (str, bytes) -> None # Prepare your encryption context. # Remember that your encryption context is NOT SECRET. # https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context encryption_context = { "encrypti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_from_conf(aws_conf):\n aws_access_key = config.get(aws_conf,'access_key','')\n aws_secret_key = config.get(aws_conf,'secret_key','')\n aws_region = config.get(aws_conf, 'region','')\n\n return {\n 'ec2':\n boto.ec2.connect_to_region(\n region_name = aws_region,\n aws_access_key_id...
[ "0.60066545", "0.5716527", "0.5659477", "0.558825", "0.5491737", "0.54010624", "0.5273491", "0.52714884", "0.51753235", "0.5171362", "0.503142", "0.50292635", "0.501804", "0.5014415", "0.49773937", "0.4953896", "0.4916813", "0.48963338", "0.48947433", "0.4876656", "0.48352057...
0.46199822
46
Get user to authenticate.
def get_user(self): if "user" not in self._data: self._data["user"] = User.objects.get(pk=self.kwargs["user_id"]) return self._data["user"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getUser(self):\n user = users.get_current_user()\n if not user:\n self.redirect(users.create_login_url(self.request.uri))\n else:\n return user", "def get_user(self):\n\n user_session = self.get()\n if not user_session:\n return None\n\n us = ServiceLocator....
[ "0.8123508", "0.8005101", "0.79044837", "0.79044837", "0.7888709", "0.7852747", "0.7719708", "0.7672492", "0.7597761", "0.75580394", "0.7552152", "0.7516508", "0.74907863", "0.7489541", "0.7483551", "0.74748856", "0.747313", "0.74607813", "0.7458102", "0.74417126", "0.7425163...
0.71351135
44
Return all approved jobs.
def get_queryset(self): jobs = Job.objects.all() if not self.kwargs.get("pk"): jobs = jobs.filter( status=choices.APPROVED, submission_deadline__gte=datetime.today() ).order_by("-created_at") if not self.request.user.is_anonymous(): # i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approved_jobs(self):\n\n return Job.objects.filter(\n house=self.house,\n approved=True,\n )", "def get(self):\n # TODO: auth\n return list(self.app.db.jobs.find())", "def get_jobs(self):\n return list(self._jobs.values())", "def jobs(self):\n ...
[ "0.8423612", "0.6918933", "0.68650305", "0.6849823", "0.6733432", "0.6682889", "0.66028017", "0.6548614", "0.6484468", "0.64795184", "0.64795184", "0.64699847", "0.6453018", "0.64463496", "0.64217526", "0.63939035", "0.63658416", "0.63469434", "0.63382804", "0.62918526", "0.6...
0.6868619
2
Create and store image if present.
def create(self, request, *args, **kwargs): if request.data.get("audition_range"): if not ( request.data["audition_range"].get("lower") and request.data["audition_range"].get("upper") ): raise ValidationError( "Audition ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_image(self, path):\n\t\treturn None", "def init_image_info():\n if not os.path.exists(UPLOAD_FOLDER):\n os.makedirs(UPLOAD_FOLDER)", "def add_image(self, image):\r\n metadata = self.collection.find_one( { \"_id\": image.identifier } )\r\n if metadata:\r\n raise Image...
[ "0.7149512", "0.6749277", "0.6722661", "0.6690721", "0.6631919", "0.6602101", "0.6598603", "0.6576423", "0.65016603", "0.6495591", "0.6426691", "0.63978994", "0.6382946", "0.63492", "0.6312564", "0.6279855", "0.62750727", "0.6258959", "0.6241422", "0.6241246", "0.6229668", ...
0.0
-1
Sort by natural keys like humans do.
def _natural_key_sort(string_to_sort): return [int(s) if s.isdigit() else s for s in re.split(r'(\d+)', string_to_sort)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def natural_sorted(iterable, key=None, reverse=False):\n prog = re.compile(r\"(\\d+)\")\n\n def alphanum_key(element):\n \"\"\"Split given key in list of strings and digits\"\"\"\n return [int(c) if c.isdigit() else c for c in prog.split(element[0])]\n\n return sorted(iterable, key=alphanum_...
[ "0.7241791", "0.72414905", "0.7165252", "0.714794", "0.7144302", "0.7127257", "0.69953287", "0.6937837", "0.6937837", "0.6929218", "0.68815076", "0.68514144", "0.6846641", "0.68061537", "0.6733701", "0.6701501", "0.66959745", "0.66778487", "0.6677466", "0.6673203", "0.6665935...
0.6931419
9
Return true if in service mode.
def is_in_service(self) -> bool: return self._enabled
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __some_alive(self):\n for service in self.__services.values():\n if service.is_alive():\n return True\n return False", "def _interesting_service(self, service: UpnpService) -> bool:\n service_type = service.service_type\n for service_types in self._SERVIC...
[ "0.6862805", "0.6793361", "0.67728746", "0.6701036", "0.66946507", "0.66204697", "0.65540534", "0.6552107", "0.6548141", "0.65428823", "0.6535179", "0.6533675", "0.6501911", "0.6458908", "0.6420852", "0.6314876", "0.63050145", "0.6295161", "0.62929493", "0.62170863", "0.62095...
0.812418
0
Add an alert about a technical problem.
def add_technical_alert(self, device, issue): del device del issue # this is prepared but not yet implemented in service mode
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def requestAlert(self, text=\"Error\", buttons=None):\n\t\tself.alerts.append((text, buttons))", "def add_alerts(self):", "def add_alert(self, content):\n self._add_content(html_alert(content))", "def send_alert(self, level, title, additional_data):\n\n full_title = \"{}: {}\".format(self.build...
[ "0.61283493", "0.5944216", "0.56979954", "0.56085527", "0.55186415", "0.5486692", "0.539759", "0.5389057", "0.5285975", "0.5193649", "0.5193604", "0.5187262", "0.5168358", "0.5166665", "0.5079088", "0.50631", "0.50447834", "0.5036596", "0.50321543", "0.5027627", "0.50111544",...
0.726797
0
Return a map of all switches in the machine.
def get_switch_map(self, do_sort=True): switch_map = [] for switch in self.machine.switches.values(): switch_map.append(SwitchMap(switch.hw_switch.get_board_name(), switch)) # sort by board + driver number if do_sort: switch_map.sort(key=lambda x: (self._natural_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switches(self) -> List[dict]:\n return self.items_by_domain(\"switch\")", "def switches(self):\n return {k:v for k, v in self._data.items() \n if v[\"type\"] == \"SWITCH\"}", "async def get_hw_switch_states(self) -> Dict[str, bool]:\n raise NotImplementedError", "d...
[ "0.7777836", "0.7621708", "0.7443831", "0.73941827", "0.72622395", "0.7212569", "0.6953223", "0.68368125", "0.6708856", "0.6657472", "0.6531701", "0.65303135", "0.64049363", "0.6335255", "0.61550575", "0.6124635", "0.59139466", "0.57728636", "0.5758768", "0.5725718", "0.56988...
0.7177897
6
Return a map of all coils in the machine.
def get_coil_map(self, do_sort=True) -> List[CoilMap]: coil_map = [] for coil in self.machine.coils.values(): assert coil.hw_driver is not None coil_map.append(CoilMap(coil.hw_driver.get_board_name(), coil)) # sort by board + driver number if do_sort: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_cliffs(self):\n cliff_list = Cliff.list()\n rtn = {}\n\n for clf in cliff_list:\n rtn[clf] = self.read_cliff(clf)\n\n return rtn", "def councils(self):\n catalog = getToolByName(self.context, 'portal_catalog')\n\n return [dict(url=council.getURL(), ti...
[ "0.61735106", "0.6158383", "0.6126377", "0.6033344", "0.5983551", "0.59124845", "0.58763355", "0.57980853", "0.57952774", "0.57756484", "0.56649864", "0.5617694", "0.55903614", "0.5582277", "0.5558947", "0.5551839", "0.5548989", "0.55406815", "0.55191165", "0.5518905", "0.549...
0.6748809
0
Return a map of all lights in the machine.
def get_light_map(self, do_sort=True) -> List[LightMap]: light_map = [] for light in self.machine.lights.values(): light_map.append(LightMap(next(iter(light.hw_drivers.values()))[0].get_board_name(), light)) # sort by board + driver number if do_sort: light_map.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lights(self) -> List[dict]:\n return self.items_by_domain(\"light\")", "def lights(self):\n return list(self.GetLights())", "def get_light_list(self):\n return self.light_array", "async def Lights_Description() -> List[Dict[str, Any]]:\n result = []\n for index, light in enumer...
[ "0.77625406", "0.7692243", "0.666766", "0.6640105", "0.6638155", "0.66082543", "0.6484388", "0.6472033", "0.64579195", "0.63853127", "0.6246505", "0.6225373", "0.5922354", "0.5830553", "0.5820328", "0.5761303", "0.5710284", "0.57049817", "0.568536", "0.5679185", "0.5666204", ...
0.7016345
2
This function responds to a request for /api/movie with the complete lists of movies
def read_all(): # Get the list of movies from our DB movies = Movie.query.order_by(Movie.movie_id).all() # Serialize for the response movie_schema = MovieSchema(many=True) return movie_schema.dump(movies)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_movies(jwt):\n\n movies = Movie.query.all()\n\n return jsonify({\n 'success': True,\n 'movies': [movie.format() for movie in movies],\n }), 200", "def get_movies(self, **kwargs):\n self.url = f\"{self.base_url}{self.FILMS_URL}\"\n self.method = \"g...
[ "0.80497384", "0.7806071", "0.76628554", "0.76375085", "0.7446299", "0.7426503", "0.73704696", "0.7356363", "0.7258904", "0.72565234", "0.72373384", "0.7051818", "0.6993698", "0.69705373", "0.6852738", "0.6796348", "0.67957854", "0.6794787", "0.67766225", "0.67315435", "0.672...
0.6311159
41
This function responds to a request for /api/movie/{movie_id} with one matching movie.
def read_one(**kwargs): # Get the movie by id movie_id = kwargs['movie_id'] fields = kwargs.get('fields') movie = Movie.query.filter(Movie.movie_id == movie_id).one_or_none() # Did we find a movie? if movie is not None: #Intersect supplied fields with Schema defined ones => Receive only...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_movie(movie_id=None):\n movie = [movie for movie in store.data if movie['id'] == int(movie_id)]\n msg = helper.create_message(MSG['movie_not_found'])\n\n return (jsonify(movie=movie[0]), 200) if movie else (jsonify(msg), 404)", "def get_movie(payload: PayloadJSON, movie_id: int) -> ResourceJSON:...
[ "0.77707213", "0.7636874", "0.7499034", "0.7423642", "0.7315157", "0.72396636", "0.71681803", "0.7103371", "0.7078891", "0.7065013", "0.6978475", "0.69712627", "0.695383", "0.6861186", "0.6836065", "0.6782413", "0.6756869", "0.67431486", "0.67383784", "0.6677799", "0.64845866...
0.70478445
10
This function creates a new movie record in the DB
def create(movie): schema = MovieSchema() new_movie = schema.load(movie, session=db.session) # Add the new movie record to the database db.session.add(new_movie) db.session.commit() # Return the newly created record in the response data = schema.dump(new_movie) return data, 201
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_movie(input_title, input_overview, input_release_date, input_poster_path):\n \n movie = Movie(title=input_title, overview=input_overview, release_date=input_release_date, poster_path=input_poster_path)\n\n db.session.add(movie)\n db.session.commit()\n\n return movie", "def create_movie(...
[ "0.7874085", "0.78123325", "0.76599956", "0.73156875", "0.7210305", "0.720738", "0.7147179", "0.7054669", "0.69906896", "0.6978543", "0.69119096", "0.6850396", "0.67323774", "0.6692045", "0.6638124", "0.66215795", "0.65686864", "0.6558507", "0.6555675", "0.6542822", "0.650204...
0.8181835
0
This function updates an existing movie in the database
def update(movie_id, movie): # Get the movie requested from the db into session update_movie = Movie.query.filter( Movie.movie_id == movie_id ).one_or_none() # Are we trying to find a movie that does not exist? if update_movie is None: abort( 404, "Movie not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(director_id, movie_id, movie):\n\n uid = movie.get(\"uid\")\n title = movie.get(\"title\")\n\n # validators\n if not((uid or uid==0) and title):\n return \"\",400\n\n update_movie = (\n Movies.query.filter(Directors.id == director_id)\n .filter(Movies.id == movie_id)\...
[ "0.7535328", "0.7432664", "0.7139674", "0.6838955", "0.6776376", "0.6612775", "0.6560875", "0.6487124", "0.64318943", "0.6392981", "0.63567483", "0.6219889", "0.6115629", "0.6100723", "0.6053239", "0.6041352", "0.6033099", "0.5974189", "0.5945165", "0.5855674", "0.58400196", ...
0.74178797
2
This function deletes a movie from the Database The method will always succeed, because we want idempotent delete
def delete(movie_id): # Get the movie requested movie = Movie.query.filter(Movie.movie_id == movie_id).one_or_none() if movie is not None: db.session.delete(movie) db.session.commit() return "", 200
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_movie():\n id = request.params.get('id')\n mongo_mgr.remove_film_from_user(id, aaa.current_user.id)", "def test_delete_movie(self):\n # add movie to update -- this functionality requires the executive\n # producer token\n res = self.client().post('/movies', headers={\n ...
[ "0.7769285", "0.7741501", "0.77175105", "0.76620966", "0.7380153", "0.7365287", "0.7278483", "0.7272325", "0.71963173", "0.70115995", "0.69912124", "0.69016904", "0.6759788", "0.6758979", "0.6728785", "0.671315", "0.6663361", "0.6526206", "0.6491936", "0.6491221", "0.6486579"...
0.80962527
0
Use Bayes' rule for random variables to compute the posterior distribution of a hidden variable X, given N observations Y_0, Y_1, ..., Y_{N1}. Conditioned on X, these observations Y_0, Y_1, ..., Y_{N1} are i.i.d. Hidden random variable X is assumed to take on a value in {0, 1, ..., M1}. Each random variable Y_i takes o...
def compute_posterior(prior, likelihood, y): # ------------------------------------------------------------------------- # ERROR CHECKS -- DO NOT MODIFY # # check that prior probabilities sum to 1 if np.abs(1 - np.sum(prior)) > 1e-06: exit('In compute_posterior: The prior probabilities nee...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def posterior(self, rnn_hidden, obs):\n hidden_obs = self.hidden_obs(torch.cat([rnn_hidden, obs], dim=-1)) # [batch, hidden]\n poster = self.poster(hidden_obs) # [batch, hidden]\n poster_mean = self.post_mean(poster) # [batch, state]\n # poster_sigma = F.softplus(self.post_sigma(post...
[ "0.5937747", "0.59187853", "0.59155023", "0.591405", "0.59086555", "0.5886364", "0.576593", "0.5758174", "0.57571816", "0.5747239", "0.56912947", "0.56840754", "0.5660271", "0.5657272", "0.56493473", "0.56485134", "0.5631239", "0.5609588", "0.56038404", "0.56019413", "0.55819...
0.5578112
21
Compute the rating likelihood probability distribution of Y given X where Y is an individual rating (takes on a value in {0, 1, ..., M1}), and X is the hidden true/inherent rating of a movie (also takes on a value in {0, 1, ..., M1}). Please refer to the instructions of the project to see what the likelihood for rating...
def compute_movie_rating_likelihood(M): # define the size to begin with likelihood = np.zeros((M, M)) # ------------------------------------------------------------------------- # YOUR CODE GOES HERE FOR PART (c) # # Remember to normalize the likelihood, so that each column is a # probabil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infer_true_movie_ratings(num_observations=-1):\n\n M = 11 # all of our ratings are between 0 and 10\n prior = np.array([1.0 / M] * M) # uniform distribution\n likelihood = compute_movie_rating_likelihood(M)\n\n # get the list of all movie IDs to process\n movie_id_list = movie_data_helper.get_...
[ "0.6651372", "0.64923996", "0.6368747", "0.6227888", "0.60699147", "0.606234", "0.6056535", "0.6044773", "0.6008728", "0.5998901", "0.598668", "0.5961036", "0.59381664", "0.5892908", "0.58896697", "0.58854824", "0.58576494", "0.5855964", "0.58468914", "0.58361566", "0.5829488...
0.75495005
0
For every movie, computes the posterior distribution and MAP estimate of the movie's true/inherent rating given the movie's observed ratings. Input
def infer_true_movie_ratings(num_observations=-1): M = 11 # all of our ratings are between 0 and 10 prior = np.array([1.0 / M] * M) # uniform distribution likelihood = compute_movie_rating_likelihood(M) # get the list of all movie IDs to process movie_id_list = movie_data_helper.get_movie_id_lis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_rating(self, movie):\n\n #\n # option 1: SQLAlchemy ORM\n #\n UserMovies = db.aliased(Rating)\n MovieUsers = db.aliased(Rating)\n\n query = (db.session.query(Rating.user_id, Rating.score, UserMovies.score, MovieUsers.score)\n .join(UserMovies, U...
[ "0.6833105", "0.67717224", "0.65626323", "0.62562567", "0.6245194", "0.6105975", "0.60951227", "0.60900235", "0.6040918", "0.5983867", "0.59045374", "0.58595026", "0.5855716", "0.5835745", "0.5835745", "0.58348227", "0.5734984", "0.5729565", "0.57091314", "0.5681885", "0.5681...
0.7685785
0
Called when the Player object is initialized. You can use this to store any persistent data you want to store for the game.
def __init__(self): self.transposition = {} self.currentDepthLimit = 0 self.counter = 0 pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\r\n self.players = {}", "def __init__(self):\n self.games = {} # Dict from gameIDs to game objects. Initially empty.\n self.players = {} # Dict from playerID to player name\n self._version = __version__ # Used in version check during un-pickling\n\n # Log...
[ "0.687386", "0.6623529", "0.64238656", "0.6392974", "0.63051546", "0.62751853", "0.6266884", "0.62623644", "0.62329775", "0.6226287", "0.62254786", "0.6207377", "0.6186291", "0.6179973", "0.61705506", "0.6159125", "0.6156226", "0.6151657", "0.6132384", "0.61177516", "0.609563...
0.0
-1
You're free to implement the move(self, state) however you want. Be run time efficient and innovative.
def move(self, state): result = None self.currentDepthLimit = 0 self.transposition = {} self.counter = 0 while True: u = float("inf") v = float("-inf") self.counter = 0 result = None self.transposition = {} for a in state.actions(): new = self.min_value(state.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, state):\n raise NotImplementedError(\"Need to implement this method\")", "def move(self):\n pass", "def move(self):\n raise NotImplementedError", "def move(self, move):\n raise NotImplementedError()", "def play_move(self,state):\n raise AIError(\"Must be im...
[ "0.8853466", "0.7574632", "0.7553293", "0.7552819", "0.7345882", "0.7279182", "0.72217304", "0.7157332", "0.7038979", "0.70239437", "0.70111984", "0.70072323", "0.70054066", "0.696469", "0.69503534", "0.69253767", "0.690871", "0.6824246", "0.6807558", "0.6804139", "0.6804139"...
0.69629246
14
Evaluates the state for the player with the given row
def evaluate(self, state, my_row): stoneonmyside = 0.00 stoneonopside = 0.00 result = 0.00 for a in range(0,state.M+1): stoneonmyside += state.board[a] for a in range(state.M+1, 2*(state.M)+1): stoneonopside += state.board[a] if my_row == 0: result = (stoneonmyside - stoneonopside) / (2*(state....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, state, my_row):\n myStones = 0.0\n opponentStones = 0.0\n for i in range(len(state.board)):\n if my_row == 0:\n if i <= State.M:\n myStones += state.board[i]\n else:\n opponentStones += state.boar...
[ "0.6999296", "0.6501366", "0.6476799", "0.6461873", "0.6389604", "0.63032645", "0.62785196", "0.62500495", "0.6232211", "0.6228227", "0.6160248", "0.61407185", "0.6129514", "0.59984934", "0.5966352", "0.59632826", "0.59607756", "0.5958547", "0.595793", "0.5954501", "0.5954304...
0.654148
1
Checks newly inited props.
def _testConnectionProps(self, connection): self.assertEquals(36, len(connection.id)) self.assertEquals(self.channel.name, connection.channel_name) self.assertTrue(connection.connected) self.assertFalse(connection.authenticated) self.assertEquals(None, connection.flex_user) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_properties(self):\r\n for prop in self.mandatory_properties:\r\n if not hasattr(self, prop):\r\n raise NameError(prop)", "def set_check_props(self, props):\n _api.check_isinstance(dict, props=props)\n if 's' in props: # Keep API consistent with constructo...
[ "0.67081404", "0.6280929", "0.62653726", "0.6081199", "0.60551053", "0.5979137", "0.5961813", "0.59598356", "0.5843566", "0.58019894", "0.58019894", "0.58019894", "0.579083", "0.5786345", "0.57684004", "0.5756698", "0.5751388", "0.57487404", "0.5727648", "0.57009995", "0.5695...
0.0
-1