query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Get the file size The output is in bytes. Divide by 1_000_000 to get it in Mb. Returns int The file size in bytes.
def file_size(self) -> int: return self.get_main_information()['FileSize']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_size_in_mb(file_size):\n return round(file_size / (1024 * 1024), 2)", "def get_size(file):\n size_in_bytes = os.path.getsize(file)\n size_in_megabytes = size_in_bytes / 1000000\n return size_in_megabytes", "def file_size():\n return os.path.getsize(FILE_NAME)", "def getsize(f):\n ...
[ "0.8200503", "0.81074035", "0.8036968", "0.79008865", "0.788222", "0.7760057", "0.77199465", "0.76608866", "0.765912", "0.76312697", "0.7630199", "0.76117456", "0.7585376", "0.7585376", "0.7585376", "0.75809", "0.75562626", "0.7542097", "0.7540565", "0.7520552", "0.751691", ...
0.7468882
26
Get the parent series identifier Returns str The parent series identifier.
def series_id(self) -> str: return self.get_main_information()['ParentSeries']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parent_series_identifier(self) -> str:\n return self.get_main_information()['ParentSeries']", "def parent_id(self) -> str:\n return self._db_data.parent_id", "def parent_id(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"parent_id\")", "def parentname(self):\n ret...
[ "0.92970544", "0.78279936", "0.76215035", "0.76149553", "0.74115235", "0.7385767", "0.7385767", "0.7272", "0.7255494", "0.7199033", "0.7193378", "0.7178861", "0.7127745", "0.7127745", "0.71097845", "0.70960456", "0.70178497", "0.69846237", "0.69846237", "0.69846237", "0.69846...
0.8738562
1
Get tags Returns Dict Tags in the form of a dictionary.
def tags(self) -> Dict: return dict(self.client.get_instances_id_tags(self.id_))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags(self):\r\n url = '{0}/tags/'.format(self.get_url())\r\n request = http.Request('GET', url)\r\n\r\n return request, parsers.parse_json", "def tags_dict(self):\n return ({'name': 'tag', 'attrs': {'k': k, 'v': v}} for k, v in self.tags.items())", "def tags(self):\r\n ...
[ "0.78366023", "0.77766544", "0.77100295", "0.76350796", "0.7626297", "0.7590476", "0.7512308", "0.748885", "0.748885", "0.74765265", "0.7471147", "0.743219", "0.7404852", "0.7404852", "0.7404852", "0.7404852", "0.73989564", "0.7320073", "0.73197424", "0.72644734", "0.725131",...
0.7135628
26
Anonymize Instance If no error has been raise, then it creates a new anonymous series.
def anonymize(self, remove: List = None, replace: Dict = None, keep: List = None, force: bool = False) -> bytes: remove = [] if remove is None else remove replace = {} if replace is None else replace keep = [] if keep is None else keep return self.client.post_instances_id_anonymize( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_instrument(self, entry=\"entry\", instrument_name=\"id00\",):\n if not isinstance(entry, h5py.Group):\n entry = self.new_entry(entry)\n return self.new_class(entry, instrument_name, \"NXinstrument\")", "def test_fit_series_anonymize(self):\n # Setup\n data = pd.Seri...
[ "0.5048538", "0.49667823", "0.48863208", "0.4884051", "0.48793235", "0.47703812", "0.47308272", "0.46933794", "0.4677837", "0.46441287", "0.46360543", "0.4630676", "0.46261704", "0.45711458", "0.45291048", "0.45270613", "0.4525731", "0.4524572", "0.45151043", "0.44993293", "0...
0.44151756
25
Turns a text document to a list of formatted words. Get rid of possessives, special characters, multiple spaces, etc.
def format_word_split(txt): tt = re.sub(r"'s\b", '', txt).lower() # possessives tt = re.sub(r'[\.\,\;\:\'\"\(\)\&\%\*\+\[\]\=\?\!/]', '', tt) # weird stuff tt = re.sub(r'[\-\s]+', ' ', tt) # hyphen -> space tt = re.sub(r' [a-z] ', ' ', tt) # single letter -> space tt = re.sub(r' [0-9]* ', ' ', t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def txt_to_word_list(text):\r\n return [w for w in text.split()]", "def _preprocess_text(text: str) -> List[List[str]]:\n\n # replace all except characters_to_keep with space\n characters_to_keep = '[^\\n:-äÄöÖåÅA-Za-z0-9]'\n text = re.sub(characters_to_keep,' ', text )\n\n # split the whole text ...
[ "0.75856394", "0.7289259", "0.70614195", "0.6978565", "0.6967208", "0.6941163", "0.6941163", "0.6938435", "0.69239265", "0.6863578", "0.68202513", "0.68147016", "0.68060166", "0.67887497", "0.67801964", "0.67791176", "0.6771628", "0.6768111", "0.67661166", "0.67602044", "0.67...
0.7247614
2
Constructor. If `lazy_init` is True, `scan_interval` is forced to 0, disabling autodiscovery of tasks.
def __init__(self, scan_interval=20, lazy_init=False): self._interfaces = [ self.list_tasks, self.task_history, self.task_history_detail, self.task_log, ] self._listeners = { 'TASK_RELOAD':self.init_package, 'TASK_STARTED'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_task_cache(self):\n\n # read task_cache_internal (this is one-time job)\n files = os.listdir(self.tasks_dir_internal)\n for pkg_name in files:\n self.init_package(pkg_name)\n\n # trigger the autodiscover procedure immediately\n if self.autodiscover_call:\n ...
[ "0.63104564", "0.5973844", "0.5680552", "0.56794953", "0.56246847", "0.5582442", "0.55460775", "0.5531155", "0.5523532", "0.5518999", "0.54995203", "0.5472872", "0.5468531", "0.54525435", "0.54497", "0.5426556", "0.5374223", "0.53717333", "0.5371491", "0.5368932", "0.53471124...
0.77438354
0
Choose a random option from a list.
async def cmd_choose(self, args: Args, **_): response = "From what you gave me, I believe `{}` is the best choice".format( args[randint(0, len(args) - 1)] ) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _random_pick(lst):\n\n choice = random.randint(0, len(lst) - 1)\n return lst[choice]", "def choice(L):\r\n LEN = len(L) # Get the length\r\n randomindex = int(LEN*random()) # Get a random index\r\n return L[randomindex] # Return that element\r", "def spinit(list):\n retu...
[ "0.80354464", "0.7451409", "0.7426208", "0.73760533", "0.7307208", "0.72032464", "0.7174973", "0.7151649", "0.7096815", "0.7096655", "0.7046616", "0.70093316", "0.69621336", "0.6949564", "0.69441324", "0.69393367", "0.6919515", "0.687021", "0.68643415", "0.68580943", "0.68407...
0.0
-1
Update the sent_at timestamp to now.
def update_sent_at_timestamp_to_now(self, records: List[EventRecord]) -> None: self.update_timestamp_column_to_now(records, "sent_at")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_timestamp(self):\n self._timestamp = datetime.datetime.now()", "def sent(self, sent):\n\n self._sent = sent", "def updated_at(self, updated_at):\n\n self._updated_at = updated_at", "def updated_at(self, updated_at):\n\n self._updated_at = updated_at", "def updated_at(...
[ "0.7161649", "0.66133463", "0.6510962", "0.6510962", "0.6510962", "0.6510962", "0.6510962", "0.6510962", "0.6510962", "0.6510962", "0.6510962", "0.6510962", "0.65079635", "0.65079635", "0.65079635", "0.64580244", "0.6425893", "0.6308499", "0.6204587", "0.61875117", "0.6057654...
0.7337081
0
Check if another escalation notification is allowed to the source_type escalation recipient. Returns false if there was an escalation sent to them within `escalation_reminder_cadence`.
def may_send_escalation(self, source_type: str, escalation_reminder_cadence: timedelta) -> bool: with self.session.begin() as session: last_escalated = ( session.query(EventRecord.escalated_at) .filter(EventRecord.source_type == source_type) .order_by(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_needs_escalation(self, escalation_time: timedelta, event: EventRecord) -> bool:\n oldest_event = self.get_oldest_event_with_fingerprint(event.fingerprint)\n\n if not oldest_event:\n return False\n\n return oldest_event.received_at <= datetime.utcnow() - escalation_time", ...
[ "0.5944898", "0.5790665", "0.55833715", "0.55507815", "0.5356594", "0.53247124", "0.5308472", "0.5180672", "0.5163573", "0.5089797", "0.5053194", "0.5022199", "0.49584794", "0.49579525", "0.49490127", "0.4948518", "0.4948518", "0.49341375", "0.4931448", "0.4922604", "0.487308...
0.8098139
0
Initialize foreground and background attributes.
def init(): global _default_foreground, _default_background, _default_style try: attrs = GetConsoleScreenBufferInfo().wAttributes except (ArgumentError, WindowsError): _default_foreground = GREY _default_background = BLACK _default_style = NORMAL else: _default_fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, foreground = None, background = None, options = None):\n if options is None:\n options = list();\n assert isinstance(options, list);\n\n self.__foreground = None;\n self.__background = None;\n self.__options = list();\n\n if (None is not foreg...
[ "0.6378653", "0.6296253", "0.62731427", "0.6259417", "0.6251762", "0.62379247", "0.62212074", "0.61731297", "0.5925152", "0.5831774", "0.57300967", "0.5647935", "0.56432647", "0.5640408", "0.5632676", "0.562265", "0.56148", "0.56062627", "0.5605095", "0.55975354", "0.5583296"...
0.7144257
0
Implements the between/3 builtin.
def _builtin_between(low, high, value, **k): mode = check_mode((low, high, value), ['iii', 'iiv'], functor='between', **k) low_v = int(low) high_v = int(high) if mode == 0: # Check value_v = int(value) if low_v <= value_v <= high_v: return [(low, high, value)] else: # E...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_sure_between(val, start=None, end=None):\n if start is not None:\n if val < start:\n return start\n if end is not None:\n if val > end:\n return end\n return val", "def is_between(a, b, c):\n a = round(a, 4)\n b = round(b, 4)\n c = round(c, 4)\n i...
[ "0.66318214", "0.6530259", "0.6462244", "0.6351088", "0.63178635", "0.63077104", "0.6172667", "0.61402", "0.59774745", "0.5959362", "0.593605", "0.5883841", "0.5813426", "0.5803961", "0.57454145", "0.5685608", "0.5615251", "0.5612574", "0.5606729", "0.5545989", "0.5535396", ...
0.7240199
0
Return bool if a dataset was modified wrt to a given remote state
def has_diff(ds, remote_branch_name, remote, paths): remote_ref = '/'.join((remote, remote_branch_name)) if remote_ref not in ds.repo.get_remote_branches(): lgr.debug("Remote '%s' has no branch matching %r. Will publish", remote, remote_branch_name) # we don't have any remote s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasChanged(self):\r\n if self.is_updated:\r\n self.is_updated = False\r\n return True\r\n else:\r\n return False\r\n\r\n # if not self.hasBeenUpdatedOnce:\r\n # self.hasBeenUpdatedOnce = True\r\n # return True\r\n # else:\r\n ...
[ "0.6826237", "0.6691344", "0.6476402", "0.64020306", "0.6395858", "0.6387539", "0.63689125", "0.63324857", "0.6292419", "0.6207242", "0.6188861", "0.6162772", "0.61311287", "0.6118802", "0.61092055", "0.6037916", "0.5989463", "0.5976631", "0.5974529", "0.5971352", "0.5965422"...
0.5571067
70
Shows an image using matplotlib capabilities
def show_img_with_matplotlib(color_img, title, pos): # Convert BGR image to RGB img_RGB = color_img[:, :, ::-1] ax = plt.subplot(2, 3, pos) plt.imshow(img_RGB) plt.title(title) plt.axis('off')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_image(path):\n img = mpimg.imread(path)\n imgplot = plt.imshow(img)\n plt.show()\n plt.close()", "def show(image):\n from matplotlib import pyplot\n import matplotlib as mpl\n fig = pyplot.figure()\n ax = fig.add_subplot(1,1,1)\n imgplot = ax.imshow(image, cmap=mpl.cm.Greys)\n...
[ "0.8210535", "0.8040822", "0.8040822", "0.8040822", "0.80380106", "0.79964787", "0.79678005", "0.79633343", "0.79343766", "0.7898508", "0.7898195", "0.7716115", "0.7637182", "0.75814646", "0.74868494", "0.74849766", "0.74408007", "0.7418635", "0.73909366", "0.73699933", "0.73...
0.73185223
25
OneHot Encodes categorical features. Adds a column for each unique value per column
def own_OneHotColumnCreator(df, columns): for col in cat_attribs: for value in df[col].unique(): df[value] = (df[col] == value).astype(int)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __encode_one_hot_util(self):\n for col in self.cat_cols:\n if (\n col in self.train_df\n and col + str(\"Encoded\") not in self.ord_cols\n ):\n if self.test_df is not None:\n self.test_df = pd.concat(\n ...
[ "0.82732314", "0.82615805", "0.80795556", "0.8031646", "0.8007636", "0.79606694", "0.79106146", "0.7869421", "0.7852588", "0.7836303", "0.7833114", "0.78308296", "0.7741153", "0.76642996", "0.7654914", "0.76482594", "0.7632753", "0.76158947", "0.758775", "0.758513", "0.758342...
0.7727236
13
Returns a lr_scheduler callback which is used for training. Feel free to change the values below!
def get_lr_callback(batch_size=64, plot=False): LR_START = 0.001 LR_MAX = 0.0001 * BATCH_SIZE # higher batch size --> higher lr LR_MIN = 0.000001 # 30% of all epochs are used for ramping up the LR and then declining starts LR_RAMP_EP = EPOCHS * 0.3 # how many epochs shall L_RMAX be sustained ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_scheduler(optimizer, opt):\n \n epochs_no_decay = opt.epochs - opt.lr_linear\n lr_policy = opt.lr_policy\n \n if lr_policy == 'linear':\n def lr_lambda(epoch):\n return 1. - max(0, epoch - epochs_no_decay) / float(opt.lr_linear + 1)\n scheduler = lr_scheduler.LambdaL...
[ "0.7702285", "0.76820457", "0.7509008", "0.7500915", "0.7467739", "0.7381181", "0.7354323", "0.73253083", "0.7256489", "0.72052073", "0.7186172", "0.716693", "0.7112174", "0.69857645", "0.6967071", "0.69223374", "0.68475175", "0.68369454", "0.68254936", "0.68011487", "0.67588...
0.71174264
12
Fully connected autoencoder model, symmetric.
def autoencoder(dims, act='relu', init='glorot_uniform'): x = tf.keras.layers.Input(shape=(1,), dtype=tf.string) h = tf.keras.layers.Lambda(UniversalEmbedding, output_shape=(512,))(x) return Model(inputs=x, outputs=h, name='encoder')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_full_conv_autoencoder():\n input_img = Input(shape=(84, 84, 3))\n\n x = Convolution2D(48, 8, 8, activation='relu', border_mode='same', name='c1')(input_img)\n x = MaxPooling2D((2, 2), border_mode='same')(x)\n x = Convolution2D(32, 4, 4, activation='relu', border_mode='same', name='c2')(x)\n ...
[ "0.71975", "0.68935287", "0.674669", "0.66891253", "0.6652663", "0.65951586", "0.6574075", "0.65317166", "0.64927214", "0.6445265", "0.6428753", "0.61677235", "0.61570114", "0.61489797", "0.6143373", "0.606591", "0.60201234", "0.60187095", "0.5994407", "0.5975581", "0.5952737...
0.6065488
16
Exponentially increasing values of integers.
def exponential_linspace_int(start, end, num, divisible_by=1): def _round(x): return int(np.round(x / divisible_by) * divisible_by) base = np.exp(np.log(end / start) / (num - 1)) return [_round(start * base**i) for i in range(num)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raise_iter(number, exponent):\n prod = 1\n for i in range(exponent, 0, -1):\n prod *= number\n return prod", "def calculate_exponent():\n pass", "def power(x, n):\n power = 1\n for i in range(abs(n)):\n power = multiply(power, x) \n return power", "def __ipow__(self,n):...
[ "0.6702514", "0.6202229", "0.6193432", "0.61460966", "0.6111368", "0.60964406", "0.60280865", "0.60104436", "0.6002035", "0.59920084", "0.59914327", "0.5985681", "0.5980414", "0.59499055", "0.5927031", "0.5898896", "0.58980244", "0.5850765", "0.58505076", "0.5845466", "0.5836...
0.6011636
7
Set the neuron in recognition mode. Once the training is complete, the neuron's threshold value H is set to HG.
def end_training(self): self.training = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setSegmentation(self):\n self.regression = False\n self.loss_function = \"categorical_crossentropy\"", "def set_auto_tuning(self, f_phot_cent=0, phot_cent=0.0, r_lambda=0.0):\n self.F_CENTRAL = 1\n self.F_PHOT_CENT = f_phot_cent\n self.PHOT_CENT = phot_cent\n self.R_...
[ "0.5734275", "0.5520731", "0.5509743", "0.5443928", "0.54155403", "0.53961754", "0.5360212", "0.5316837", "0.52803665", "0.5243153", "0.5240244", "0.5226745", "0.52164036", "0.5189196", "0.51564944", "0.5144714", "0.51369363", "0.51285523", "0.51267356", "0.5123545", "0.51158...
0.0
-1
factory function for creating flask application
def create_app(): app = Flask(__name__) app.config.from_object('app.configs.config') app.config.from_object('app.configs.settings') return app
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app():\n return create_app()", "def create_app():\n app = Flask(__name__)\n\n\n @app.route('/')\n def barebones():\n return 'the barebones'\n\n return app", "def create_app():\n app = Flask(__name__)\n\n @app.route('/')\n def root():\n \"\"\"Base view.\"\"\"\n r...
[ "0.81913793", "0.8183192", "0.8113862", "0.80999327", "0.8020305", "0.7987065", "0.79263043", "0.7926137", "0.7914196", "0.78681517", "0.7847101", "0.78375894", "0.7831771", "0.78306013", "0.7801242", "0.77984685", "0.77976227", "0.7771524", "0.77677745", "0.77655977", "0.774...
0.76860434
26
Return a new graph that contains only the edges that exist in both G and H. The node sets of H and G must be the same.
def intersection(G, H): if G.order() != H.order(): msg = "Node sets of the two directed graphs are not equal!" raise StaticGraphNotEqNodesException(msg) n_nodes = G.order() edges = ((u, v) for u in G.nodes() for v in set(G.successors(u)) & set(H.successors(u))) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def union(G, H):\n\n if G.order() != H.order():\n msg = \"Node sets of the two directed graphs are not equal!\"\n raise StaticGraphNotEqNodesException(msg)\n\n n_nodes = G.order()\n edges = ((u, v) for u in G.nodes()\n\t\t for v in chain(G.successors(u), H.successors(u)))\n deg = make_...
[ "0.6904437", "0.6880209", "0.6704046", "0.6702223", "0.6606309", "0.65519935", "0.6523473", "0.64748293", "0.64739656", "0.6446924", "0.6429239", "0.64057463", "0.6389816", "0.63647735", "0.63518214", "0.6315509", "0.6283729", "0.626796", "0.6252708", "0.6200881", "0.6156531"...
0.7471127
0
Return a new graph that contains the edges that exist in G but not in H. The node sets of H and G must be the same.
def difference(G, H): if G.order() != H.order(): msg = "Node sets of the two directed graphs are not equal!" raise StaticGraphNotEqNodesException(msg) n_nodes = G.order() edges = ((u, v) for u in G.nodes() for v in set(G.successors(u)) - set(H.successors(u))) de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complement(G):\n R = G.__class__()\n R.add_nodes_from(G)\n R.add_edges_from(((n, n2)\n for n, nbrs in G.adjacency()\n for n2 in G if n2 not in nbrs\n if n != n2))\n return R", "def symmetric_difference(G, H):\n\n if G.order() != H....
[ "0.6971542", "0.6828409", "0.676607", "0.672366", "0.6658269", "0.6474017", "0.643997", "0.6423529", "0.6403956", "0.6274295", "0.62654114", "0.6235656", "0.6183345", "0.61710227", "0.6161887", "0.61617595", "0.6144613", "0.6138552", "0.6137598", "0.6133113", "0.6128235", "...
0.6847599
1
Pack and pad batch into torch tensors
def tied_featurize(batch, device, chain_dict, fixed_position_dict=None, omit_AA_dict=None, tied_positions_dict=None, pssm_dict=None, bias_by_res_dict=None, ca_only=False): alphabet = 'ACDEFGHIKLMNPQRSTVWYX' B = len(batch) lengths = np.array([len(b['seq']) for b in batch], dtype=np.int32) #sum of chain seq l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(batch):\n batch_split = list(zip(*batch))\n seqs, num, targs, lengths, visits = batch_split[0], batch_split[1], batch_split[2], batch_split[3], batch_split[4]\n num = torch.vstack([torch.as_tensor(sample, dtype=torch.float32) for sample in zip(*num)]).T\n visits = [torch.as_tensor(s, dtype=torc...
[ "0.71949345", "0.70411265", "0.702527", "0.69463325", "0.6836841", "0.6782733", "0.67762315", "0.6768253", "0.6710295", "0.6613126", "0.6595264", "0.65876526", "0.6514706", "0.6439469", "0.64269495", "0.6417542", "0.63876194", "0.63215864", "0.6294953", "0.62693626", "0.62479...
0.0
-1
Convert a batch of 3D rotations [R] to quaternions [Q] R [...,3,3] Q [...,4]
def _quaternions(self, R): # Simple Wikipedia version # en.wikipedia.org/wiki/Rotation_matrix#Quaternion # For other options see math.stackexchange.com/questions/2074316/calculating-rotation-axis-from-rotation-matrix diag = torch.diagonal(R, dim1=-2, dim2=-1) Rxx, Ryy, Rzz = diag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quat2transform(q):\n x, y, z, w = q\n xx2 = 2 * x * x\n yy2 = 2 * y * y\n zz2 = 2 * z * z\n xy2 = 2 * x * y\n wz2 = 2 * w * z\n zx2 = 2 * z * x\n wy2 = 2 * w * y\n yz2 = 2 * y * z\n wx2 = 2 * w * x\n\n rmat = np.empty((3, 3), float)\n rmat[0,0] = 1. - yy2 - zz2\n rmat[0,1...
[ "0.7315719", "0.710663", "0.6928822", "0.6887139", "0.6799304", "0.6688825", "0.66861653", "0.66570175", "0.6593116", "0.6593116", "0.6582221", "0.6548662", "0.6542666", "0.6401955", "0.63949436", "0.6392839", "0.63708776", "0.63556904", "0.634197", "0.634084", "0.634084", ...
0.70090777
2
Finds the number of people that user_A and user_B have in common.
def count_common_connections(network, user_A, user_B): count = 0 if user_A not in network or user_B not in network: return False for person in network[user_A][0]: if person in network[user_B][0]: count += 1 return count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_common_connections(network, user_A, user_B):\n if user_A not in network or user_B not in network:\n return False\n common_connections = 0\n for conn in network[user_A]['connections']:\n if conn in network[user_B]['connections']:\n common_connections += 1\n return comm...
[ "0.7501403", "0.6471781", "0.6242167", "0.60771847", "0.6073546", "0.58809507", "0.5817833", "0.5770371", "0.5768573", "0.5764238", "0.57323", "0.56635493", "0.5648626", "0.56373334", "0.5618848", "0.5590228", "0.55231297", "0.5518846", "0.5515029", "0.55143344", "0.5510842",...
0.81370157
0
Negates the value at the top of the stack.
def invert(val): return -1 * coerce_to_int(val)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discard_if_false(value):\n if not value:\n stack = currentframe().f_back.f_locals.setdefault(SN, [])\n stack.pop()\n return value", "def pop(self):\n x = -1\n if self.top == -1:\n print(\"Stack is Underflow\")\n else:\n x = self.arr[self.top]\n ...
[ "0.683129", "0.67011434", "0.6653512", "0.6407964", "0.6399964", "0.6390002", "0.6377388", "0.6186068", "0.6147635", "0.6146879", "0.6107341", "0.6094897", "0.6079991", "0.6071588", "0.6056693", "0.603838", "0.6026986", "0.6023855", "0.6023855", "0.6018136", "0.6003404", "0...
0.0
-1
Ensure connectivity matrix shape matches existing attributes.
def _validate_connectivity_matrix_shape(self, connectivity_matrix): validate_array_ndim('connectivity matrix', connectivity_matrix, 2) for attr, axis in zip(['no_ser_neurons', 'no_gaba_neurons'], [0, 1]): if ( hasattr(self.attrs, attr) and self.attrs[attr] !=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fix_connectivity(X, connectivity, affinity):\n n_samples = X.shape[0]\n if connectivity.shape[0] != n_samples or connectivity.shape[1] != n_samples:\n raise ValueError(\n \"Wrong shape for connectivity matrix: %s when X is %s\"\n % (connectivity.shape, X.shape)\n )\n\...
[ "0.59439474", "0.57655776", "0.5765118", "0.5666277", "0.5654219", "0.5653875", "0.5627914", "0.5604546", "0.55618614", "0.55409896", "0.553846", "0.552472", "0.5522694", "0.5513832", "0.54949033", "0.54772484", "0.5474063", "0.5428948", "0.5405596", "0.54032683", "0.5380483"...
0.7484497
0
This function creates a random string of characters of the given size in the first keyword argument.
def stringGen(size, chars=string.ascii_uppercase + string.digits): return ''.join(random.choice(chars) for _ in range(size))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _random_string(self, size, chars=None):\n return ''.join(random.choice(chars or _DEFAULT_CHARS) for _ in range(size))", "def _rand_str(size=16):\n return \"\".join(random.SystemRandom().choices(string.ascii_lowercase, k=size))", "def generator(size=6, chars=string.ascii_uppercase + string.digits):\n ...
[ "0.8342772", "0.7930801", "0.77327174", "0.77259296", "0.767971", "0.7662384", "0.76364464", "0.75585383", "0.75367117", "0.7524333", "0.7478372", "0.74692637", "0.74664944", "0.7422514", "0.7401179", "0.737576", "0.73483485", "0.7344798", "0.7313995", "0.73138595", "0.730124...
0.8367706
0
Thanks to itertools it's really easy getting permutations of values of given range, with no repeating values, in a nice list of sequences.
def part_1(): return itertools.permutations(range(5))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def part_2():\n return itertools.permutations(range(5, 10))", "def parameter_space():\n return [list(range(7, 17)),\n list(range(17, 27)),\n list(range(27, 37)),\n list(permutations(range(1, 5), 4))]", "def gen_tuples_for_loops(range_len: int, limit: int) -> list:\n ra...
[ "0.72272414", "0.681213", "0.6765708", "0.6720187", "0.6687841", "0.66627276", "0.6472954", "0.63354963", "0.6328454", "0.6280594", "0.6258111", "0.6248037", "0.6209359", "0.61989534", "0.6196809", "0.6183543", "0.61692023", "0.61535794", "0.613345", "0.6094155", "0.60837626"...
0.706944
1
Thanks to itertools it's really easy getting permutations of values of given range, with no repeating values, in a nice list of sequences.
def part_2(): return itertools.permutations(range(5, 10))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def part_1():\n return itertools.permutations(range(5))", "def parameter_space():\n return [list(range(7, 17)),\n list(range(17, 27)),\n list(range(27, 37)),\n list(permutations(range(1, 5), 4))]", "def gen_tuples_for_loops(range_len: int, limit: int) -> list:\n ranges...
[ "0.70683587", "0.6811745", "0.67658883", "0.67200065", "0.6690073", "0.6662713", "0.6471747", "0.6337583", "0.632828", "0.6280346", "0.6256708", "0.6248203", "0.6211704", "0.6201291", "0.61972815", "0.6181048", "0.6169403", "0.615301", "0.6134938", "0.60926276", "0.60830176",...
0.7226254
0
Get the app configuration
def get_app_config(session_key, stanza="default"): # If the stanza is empty, then just use the default if stanza is None or stanza.strip() == "": stanza = "default" # Get the configuration try: app_config = NetworkToolsConfig.get(NetworkToolsConfig.build_id(stanza, "network_tools", "n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app_config(self):\n return self._app_conf[\"aiscalator\"]", "def get_config():\n app = NbConvertApp()\n app.load_config_file()\n return app.config", "def config(self):\n return self[CONFIG_KEY]", "def get_config(self):\n return self.config", "def get_config():\n return ...
[ "0.83647794", "0.8055059", "0.80437773", "0.789439", "0.7887363", "0.77965695", "0.774515", "0.77376187", "0.77290165", "0.7688345", "0.76736057", "0.76736057", "0.76029116", "0.76029116", "0.76029116", "0.76029116", "0.76029116", "0.76029116", "0.76029116", "0.76029116", "0....
0.0
-1
Gets all of the students for this user and makes a key map for them.
def get_students(user): students = Student.query(ancestor=get_parent_key(user)).order(Student.rose_username).fetch() students_map = {} teams = [] for student in students: students_map[student.key] = student if student.team not in teams: teams.append(student.team) return stu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def student_view_data(self):\n def get_student_profile_data():\n # pylint: disable=no-member\n \"\"\"\n Returns profile data for all students on the course.\n \"\"\"\n try:\n regexp_string = self.regexp_from_users_included_email(self.user...
[ "0.6553198", "0.6468656", "0.64664316", "0.6457629", "0.63440126", "0.63406616", "0.63206315", "0.62897164", "0.6194717", "0.61313075", "0.612875", "0.6109554", "0.61020684", "0.60999364", "0.6088831", "0.60462195", "0.60381323", "0.599141", "0.58995205", "0.58808386", "0.585...
0.735907
0
Clear the table and update it with stats from the current set.
def update_table(self, set_data, rep_stats): self.tableSetStats.setColumnCount(len(rep_stats.keys())) # Update table for r, rep in enumerate(rep_stats.keys()): # Add a combo box that allows the user to select whether they failed the rep, it was a false detection, # or re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_metric_stats(self):\n self.__stats_table = {}", "def reset_metric_stats(self):\n\n self.__stats_table = {}", "def flush(self):\n self.table = []", "def clear(self):\n\n self.size = 0\n\n self.table = [[]] * 100\n\n self.keys_set = set()\n\n self.keys...
[ "0.7479955", "0.7463407", "0.7255904", "0.70964026", "0.6999153", "0.688259", "0.68641984", "0.6848541", "0.68348265", "0.681058", "0.68062633", "0.6796051", "0.6796051", "0.66604656", "0.6631", "0.6611965", "0.6520464", "0.64752364", "0.64445156", "0.6439964", "0.62844735", ...
0.61464614
26
Loads an image, and add gaussian blur
def deblur_loader(fname, blur_type, noise_sigma, GRAY_SCALE = False): BLUR_TYPE = 'gauss_blur' if blur_type == 'g' else 'uniform_blur' img_np = read_image_np(fname) # loadload_and_crop_image img_pil, # if GRAY_SCALE: # img_np = rgb2gray(img_pil) blurred = blur(img_np, BLUR_TYPE) # bl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Blur(image):\n\n return cv2.GaussianBlur(image,(7,7),0)", "def gaussian_blur(self,img):\n return cv2.GaussianBlur(img, (self.kernel_size, self.kernel_size), 0)", "def gaussian_blur(self, img):\n kernel_size = self.gaussian_blur_params[\"kernel_size\"]\n return cv2.GaussianBlur(img, ...
[ "0.72343475", "0.7130351", "0.7075262", "0.7061264", "0.7016979", "0.7015421", "0.7015421", "0.7015421", "0.7015421", "0.7015421", "0.7015421", "0.7015421", "0.7015421", "0.7015421", "0.7015421", "0.7015421", "0.7015421", "0.7015421", "0.7015421", "0.7015421", "0.70123875", ...
0.7050302
4
Computes the precision for the specified values of k
def accuracy(output, target, topk=(1,)): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: correct_k = correct[:k].view(-1).float().sum(0, keepdim=Tru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den", "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\...
[ "0.76427615", "0.74189496", "0.7418079", "0.72710466", "0.72456723", "0.72446615", "0.7237539", "0.72213703", "0.7210107", "0.7058935", "0.6852219", "0.6786084", "0.67836976", "0.6768417", "0.67273885", "0.67181736", "0.67181736", "0.67181736", "0.67181736", "0.67181736", "0....
0.0
-1
Generator that iterates all joplin files
def joplin_file_name(joplin_dir: str) -> str: for (_, _, files) in os.walk(joplin_dir): for filename in files: file_full_name = os.path.join(joplin_dir, filename) if os.path.isfile(file_full_name): yield file_full_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filelist_generator(self):\n for filename in self.filenames:\n yield filename", "def walkSource(sourcedir):\n for parent, dnames, fnames in os.walk(sourcedir):\n for fname in fnames:\n if fname not in SKIP_FILES:\n filename = os.path.join(parent, fname)\n ...
[ "0.6222856", "0.6178041", "0.603236", "0.6010619", "0.5951841", "0.5922671", "0.58498347", "0.5826322", "0.58022916", "0.5793513", "0.5787218", "0.57737046", "0.5722709", "0.56911975", "0.566289", "0.56441385", "0.5643234", "0.5621843", "0.5601058", "0.56004983", "0.550213", ...
0.6636076
0
Evaluate MetropolisHastings proposal `W_prop`.
def _evaluate_proposal(self, W_prop): return self.log_likelihood(W=W_prop)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _evaluate_proposal(self, W_prop):\n if self.marginalize:\n return self.log_marginal_likelihood(self.X, W_prop)\n else:\n return self.log_likelihood(W=W_prop)", "def computeProportionWings(self):\n self.ws_me_pointsA = []\n self.ws_me_pointsIy = []\n se...
[ "0.6515359", "0.5985837", "0.59248805", "0.5780798", "0.573071", "0.56655294", "0.5559811", "0.55434054", "0.547753", "0.54658157", "0.5436293", "0.5421811", "0.5410349", "0.53904915", "0.53743124", "0.5344021", "0.5316213", "0.5291408", "0.52840084", "0.5280489", "0.52752924...
0.6771412
0
Strip trailing slash if any.
def strip_trailing_slash(text) -> str: if text is None: return "" l = len(text) if not l: return "" end = l-1 if text[l-1] == "/" else l return text[:end]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_trailing_slash(path):\n if len(path) > 0:\n if path[len(path) - 1] == \"/\":\n return path[0:-1]\n else:\n return path\n else:\n return path", "def remove_trailing_slash(self, path_info):\n if len(path_info) > 1 and path_info[-1] == '/':\n ...
[ "0.77117515", "0.74455047", "0.7314768", "0.7239549", "0.7236624", "0.68018794", "0.6783173", "0.67721987", "0.67537165", "0.6581092", "0.65170985", "0.64496076", "0.64496076", "0.63499695", "0.6288774", "0.6251275", "0.6226301", "0.61992276", "0.6196383", "0.6097115", "0.606...
0.7673637
1
Extension of categorical_crossentropy for a multivariate target. Computes the categorical crossentropy between a list of predictions and a multivariate target.
def multivariate_categorical_crossentropy(predictions, targets): #num_results = len(predictions) losses = 0. for i, pred in enumerate(predictions): losses += theano.tensor.nnet.categorical_crossentropy(pred, targets[:,i]) return losses
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categorical_crossentropy(predictions, targets):\n return theano.tensor.nnet.categorical_crossentropy(predictions, targets)", "def categorical_crossentropy(predictions, targets):\n return theano.tensor.nnet.categorical_crossentropy(predictions, targets)", "def score_multivariate_categorical_crossentro...
[ "0.83212966", "0.83212966", "0.823576", "0.7462485", "0.7337843", "0.72716516", "0.7197688", "0.7060448", "0.69552124", "0.6905344", "0.67761344", "0.67504257", "0.6730525", "0.66347057", "0.66285247", "0.66260123", "0.6599683", "0.65953076", "0.65932816", "0.6581279", "0.655...
0.8322457
0
Converts a bit string in the format '01' to a float, representing the NTP short format (32bit)
def bit_to_short(bits: str) -> float: ints = int(bits, 2) result = ints / _max_16bit return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _eight_byte_real_to_float(value):\n short1, short2, long3 = struct.unpack(\">HHL\", value)\n exponent = (short1 & 0x7F00) // 256 - 64\n mantissa = (\n ((short1 & 0x00FF) * 65536 + short2) * 4294967296 + long3\n ) / 72057594037927936.0\n if short1 & 0x8000:\n return -mantissa * 16.0...
[ "0.6525259", "0.6515711", "0.63894624", "0.61735207", "0.6138032", "0.5948746", "0.58451456", "0.5820546", "0.5786763", "0.5737321", "0.5724533", "0.57232624", "0.570611", "0.562947", "0.561444", "0.56039274", "0.5597018", "0.55400866", "0.5535901", "0.5534812", "0.5531123", ...
0.7090817
0
Converts a bit string in the format '01' to a float, representing the NTP long format (64bit)
def bit_to_long(bits: str) -> Decimal: ints = int(bits, 2) result = Decimal(ints) / Decimal(_max_32bit) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_64timestamp_fraction(bits: str) -> str:\n assert len(bits) == 64\n bits = bits[32:64]\n # __log.info(bits)\n ints = int(bits, 2)\n result = ints / _max_32bit\n result = int(result * 1000000000)\n result = str(result)\n while len(result) < 9:\n result = '0' + result\n r...
[ "0.6633979", "0.6063586", "0.60377383", "0.6030979", "0.59153354", "0.5846214", "0.5825458", "0.57339996", "0.57103884", "0.5657389", "0.5622907", "0.55460334", "0.553697", "0.5534825", "0.5531536", "0.55300474", "0.55239743", "0.5512677", "0.5497268", "0.5451999", "0.5443638...
0.58482605
5
Convert Decimals back to primitives
def decode(val): if isinstance(val, Decimal): return float(val) return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_decimal(value: t.Any) -> Decimal:\n return Decimal(value)", "def _serialize_decimal(val):\n return float(val)", "def transform_bson(self, value):\r\n return value.to_decimal()", "def transform_bson(self, value):\r\n return value.to_decimal()", "def convert(self, valu...
[ "0.7085167", "0.6668999", "0.6310854", "0.6310854", "0.6192656", "0.60814613", "0.604838", "0.60443026", "0.600437", "0.5951371", "0.58752877", "0.5831463", "0.5786492", "0.5784276", "0.5784094", "0.57620615", "0.57620615", "0.57144386", "0.56613714", "0.56403625", "0.5640049...
0.64803654
2
Returns a specific rule if it exists
def find(self, rules): for rule in rules: if self == rule: return rule return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_rule(self, rule):\n for kbrule in self.rules:\n if rule == kbrule:\n return kbrule", "def _get_rule(self, rule):\n for kbrule in self.rules:\n if rule == kbrule:\n return kbrule", "def _get_rule(self, rule):\n for kbrule in self....
[ "0.79431427", "0.79431427", "0.79431427", "0.74559814", "0.71458393", "0.7102342", "0.7043005", "0.7043005", "0.7043005", "0.7043005", "0.7043005", "0.7043005", "0.7043005", "0.70429343", "0.68261766", "0.6800644", "0.66917", "0.6604122", "0.6537954", "0.6486622", "0.6486622"...
0.7297769
4
Return the email address to satisfy FlaskLogin's requirements.
def get_id(self): return self.username
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")", "def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")", "def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")", "def email(self) -> Optional[str]:\n return pulumi.get(self,...
[ "0.74636996", "0.74636996", "0.74636996", "0.74636996", "0.744493", "0.744493", "0.744493", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7421634", "0.72910833", "0.7233626", "0.7228416", "0.72064245", "0.7176058", "0.71472573",...
0.0
-1
Return True if the user is authenticated.
def is_authenticated(self): return self.authenticated
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_authenticated(self):\n return self.user is not None and self.state == AuthenticationOptions.authenticated", "def is_authenticated(self):\n return bool(get_auth_token())", "def is_authenticated(self):\n return True", "def is_authenticated(self):\n return True", "def is_aut...
[ "0.87395746", "0.8709825", "0.8657669", "0.8657669", "0.8657669", "0.8657669", "0.8657669", "0.8657669", "0.8657669", "0.861379", "0.8609933", "0.8578681", "0.83724886", "0.83597", "0.8259432", "0.8227734", "0.8211322", "0.82007444", "0.81761247", "0.81279445", "0.8113457", ...
0.85811096
16
False, as anonymous users aren't supported.
def is_anonymous(self): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_anonymous():\n return False", "def is_anonymous(self):\r\n return False", "def is_anonymous(self):\n return False", "def is_anonymous_access_allowed(self):\n return self._is_anonymous_access_allowed", "def is_authenticated(self):\n return False", "def _is_anonymous_u...
[ "0.85624325", "0.83800477", "0.82456774", "0.7815806", "0.7576082", "0.72904116", "0.72619915", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72338396", "0.715833", "0.7106215", "0.70944613", "0.70567185", "0.70209265", "...
0.8360155
9
Generates random string of latin characters and digits
def random_str(length=8, letters=string.ascii_letters + string.digits): return "".join(random.choice(letters) for x in range(length))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_random_string():\n return \"\".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(16)) # nosec", "def rand_string():\n out = ''\n for _ in range(24):\n out += choice(ascii_letters)\n return out", "def gen_random_char_string(n, base_s=\"\"):\n if n == 0...
[ "0.7880922", "0.78204024", "0.7764741", "0.7707224", "0.76895994", "0.7656719", "0.76132256", "0.7612287", "0.75797176", "0.7544573", "0.7495433", "0.7415297", "0.740673", "0.7377637", "0.7372338", "0.737096", "0.733355", "0.7330852", "0.7319798", "0.73071295", "0.7296976", ...
0.72743887
23
Sanitize scope/variable name for tensorflow and mlflow This is needed as sometimes variables automatically created while building layers contain forbidden characters >>> from tensorflow.python.framework.ops import _VALID_SCOPE_NAME_REGEX as TF_VALID_REGEX >>> from mlflow.utils.validation import _VALID_PARAM_AND_METRIC_...
def sanitize_metric_name(name: str) -> str: name = name.replace(":", "-") return name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_name(self, value):\n if self.sanitize_names:\n new_value = re.sub('[^a-zA-Z0-9_]', '_', value[:127])\n else:\n new_value = value\n return new_value", "def legal_variable_name(name):\n var_name = name.replace(' ', '_')\n for char in r'''[]{}\\/^%$#@!+-...
[ "0.6610228", "0.6547186", "0.6503946", "0.6472729", "0.6438676", "0.6427837", "0.63838094", "0.6374954", "0.6358613", "0.63584065", "0.6348282", "0.6332288", "0.63272977", "0.6317582", "0.6303226", "0.62421775", "0.6234113", "0.6216284", "0.62074375", "0.6130954", "0.61107725...
0.6653427
0
Returns all of the unique tags for all of the ``Node``\s in the ``FeaturesCollection`` as a ``dict``. Both the keys and values of the ``dict`` will be ``str``\s.
def get_node_tags(self): return loads(self.scala_features.getNodeTags())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_tags(self):\n tags = set()\n query = self.sql_session.query(Feature).all()\n for tag in query:\n tags.add((tag.key, json.loads(tag.value)))\n return tags", "def tags_dict(self):\n return ({'name': 'tag', 'attrs': {'k': k, 'v': v}} for k, v in self.tag...
[ "0.7061967", "0.69106007", "0.6804205", "0.67947286", "0.6514138", "0.64924437", "0.6445423", "0.6445423", "0.6445423", "0.6445423", "0.6445423", "0.6445423", "0.6445423", "0.6445423", "0.6445423", "0.6445423", "0.6445423", "0.6445423", "0.6445423", "0.6432218", "0.6432218", ...
0.6980028
1
Returns all of the unique tags for all of the ``Way``\s in the ``FeaturesCollection`` as a ``dict``. Both the keys and values of the ``dict`` will be ``str``\s.
def get_way_tags(self): return loads(self.scala_features.getWayTags())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_tags(self):\n tags = set()\n query = self.sql_session.query(Feature).all()\n for tag in query:\n tags.add((tag.key, json.loads(tag.value)))\n return tags", "def tags_dict(self):\n return ({'name': 'tag', 'attrs': {'k': k, 'v': v}} for k, v in self.tag...
[ "0.69791543", "0.6658776", "0.65888757", "0.6576306", "0.6396887", "0.63873225", "0.63873225", "0.63873225", "0.63873225", "0.63873225", "0.63873225", "0.63873225", "0.63873225", "0.63873225", "0.63873225", "0.63873225", "0.63873225", "0.63873225", "0.6354029", "0.634934", "0...
0.6956051
1
Returns all of the unique tags for all of the ``Relation``\s in the ``FeaturesCollection`` as a ``dict``. Both the keys and values of the ``dict`` will be ``str``\s.
def get_relation_tags(self): return loads(self.scala_features.getRelationTags())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_dict(self):\n tag_dict = dict()\n for document in self.documents:\n for tag in document.tags:\n tag_type = tag['tag']\n tag_dict[tag_type] = tag_dict.get(tag_type, []) + [tag]\n return tag_dict", "def all_tags(self):\n tags = set()\n ...
[ "0.67400295", "0.6642197", "0.6547415", "0.6240513", "0.62249845", "0.6198712", "0.6198712", "0.6198712", "0.6198712", "0.6149932", "0.6149498", "0.6114023", "0.6114023", "0.610949", "0.6072208", "0.60205066", "0.60205066", "0.60205066", "0.60205066", "0.60205066", "0.6020506...
0.7054464
0
Retrieves solution or a member of a solution. Overrides the default implementation of item access (obj[key]) to retrieve a solution object or member of a solution from the result object. If the Result object does not contain any solutions, then a KeyError will always be raised. If the Result object contains a single so...
def __getitem__(self, key): try: if self.solution is not None: if isinstance(self.solution, list): if isinstance(key, tuple): return getattr(self.solution.__getitem__(key[0]), key[1]) else: return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, key):\n for k,v in list(self.__dict__.items()):\n if k == key:\n return v\n try:\n return v[key]\n except:\n pass\n\n print((\"Item %s could not be found...\" %key))", "def __getitem__(self, item):\n...
[ "0.61259854", "0.5973721", "0.5968483", "0.57727283", "0.57650703", "0.57550794", "0.56779176", "0.5648555", "0.55474705", "0.5513394", "0.5503969", "0.54643625", "0.5442909", "0.54390633", "0.54372215", "0.54197574", "0.54094803", "0.54086185", "0.5402295", "0.54001427", "0....
0.71011585
0
Assert that the sum of a raster is equal to the specified value.
def assert_array_sum(base_raster_path, desired_sum): base_raster = gdal.OpenEx(base_raster_path, gdal.OF_RASTER) base_band = base_raster.GetRasterBand(1) base_array = base_band.ReadAsArray() raster_sum = numpy.sum(base_array) numpy.testing.assert_almost_equal(raster_sum, desired_sum)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_results():\n x = 0.5\n np.testing.assert_almost_equal(nbf.sum_x_n_calc(\n x, z_n, k_n_1), npf.sum_x_n_calc(x, z_n, k_n_1))", "def test_uniformity_values(self):\n for key, exp_val in self.unif_values.items():\n meas_val = self.quart.uniformity_module.rois[key].pixel_value\n...
[ "0.59365606", "0.56843793", "0.5673206", "0.5597674", "0.55940706", "0.5570633", "0.5560795", "0.5554182", "0.55519754", "0.552357", "0.54616356", "0.54612356", "0.54606867", "0.54367733", "0.53877324", "0.53574693", "0.53516954", "0.534397", "0.5329125", "0.5321784", "0.5300...
0.7449854
0
Override setUp function to create temp workspace directory.
def setUp(self): # this lets us delete the workspace after its done no matter the # the rest result self.workspace_dir = tempfile.mkdtemp()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.workspace_dir = tempfile.mkdtemp()", "def setUp(self):\n self.workspace_dir = tempfile.mkdtemp()", "def setUp(self):\n self.workspace_dir = tempfile.mkdtemp()", "def setUp(self):\n self.workspace_dir = tempfile.mkdtemp()", "def setUp(self):\n self....
[ "0.8956782", "0.8956782", "0.8956782", "0.8956782", "0.8956782", "0.8956782", "0.8956782", "0.87487847", "0.861696", "0.85287", "0.8521918", "0.8521918", "0.8412986", "0.82994586", "0.8105876", "0.8061965", "0.80480665", "0.80480665", "0.79960126", "0.79871035", "0.76726997",...
0.85572475
9
Override tearDown function to remove temporary directory.
def tearDown(self): shutil.rmtree(self.workspace_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n print(\n \"\\nDeleting temporary files...\\n\")\n try:\n shutil.rmtree(TEST_DIR)\n except OSError:\n pass", "def tearDown(self):\r\n shutil.rmtree(self.temp_dir_path)", "def tearDown(self):\n \tshutil.rmtree(self.tempdir)", "de...
[ "0.8990117", "0.8973664", "0.8880884", "0.8845629", "0.88130945", "0.8763792", "0.8720481", "0.868719", "0.85937536", "0.853607", "0.8506219", "0.84205496", "0.8419631", "0.8399157", "0.8372123", "0.83627397", "0.8287353", "0.8287353", "0.82600176", "0.8250573", "0.82341594",...
0.78779083
42
Simple Kalman filter implementation. Parameters selected adhoc. For proper estimation see Rajamani and Rawlings (2007, 2009) y(t) = x(t)beta(t) + e(t) beta(t) = beta(t1) + w(t)
def kf_simple(obs, obs_model): x = np.stack((obs_model, np.ones(len(obs_model))), axis=1) param_dim = x.shape[1] # parameters of Kalman filter delta = 0.0001 # large delta gives quicker change in beta. Vw = delta / (1 - delta) * np.eye(param_dim) Ve = 0.001 y_hat = np.full(obs....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def KFilt(sample,fs=25):\n\t#kalman filter inputs\n \n # Dimensions of parameters:\n # 'transition_matrices': 2,\n # 'transition_offsets': 1,\n # 'observation_matrices': 2,\n # 'observation_offsets': 1,\n # 'transition_covariance': 2,\n # 'observation_covariance': 2,\n # 'initial_sta...
[ "0.69341964", "0.6864327", "0.6859966", "0.68212306", "0.6797041", "0.6782388", "0.67823577", "0.66672254", "0.66148305", "0.653961", "0.6293188", "0.62582684", "0.6050151", "0.60222757", "0.5975348", "0.5970937", "0.5964529", "0.58623725", "0.58201265", "0.5815514", "0.57507...
0.7863003
0
Init weights for the model.
def init_weights(self, pretrained: Optional[str] = None) -> None: if isinstance(pretrained, str): logger = MMLogger.get_current_instance() load_checkpoint(self, pretrained, strict=False, logger=logger) elif pretrained is None: for m in self.modules(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)", "def init_weights(model):\n ...", "def _initialize_weights(self):\n pass", "def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)\n # Tie weights if nee...
[ "0.8947807", "0.89318025", "0.8876894", "0.8852135", "0.8840873", "0.8825266", "0.8496819", "0.8488651", "0.84201205", "0.83625734", "0.8343249", "0.8278179", "0.82656187", "0.8218615", "0.82129097", "0.820363", "0.82035464", "0.82035464", "0.82035464", "0.8195083", "0.818459...
0.0
-1
Freeze stages param and norm stats.
def _freeze_stages(self) -> None: if self.frozen_stages >= 0: if self.deep_stem: self.stem.eval() for param in self.stem.parameters(): param.requires_grad = False else: self.norm1.eval() for m in [self.co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freeze(self):\n # Freeze.\n self.frozen = True\n for param in self.parameters():\n param.requires_grad = False", "def freeze(self):\n for p in self.parameters():\n p.requires_grad = False\n FrozenBatchNorm2d.convert_frozen_batchnorm(self)\n retu...
[ "0.6843416", "0.667812", "0.6553079", "0.65441793", "0.65441793", "0.6282355", "0.6107587", "0.6103051", "0.6100416", "0.61001694", "0.6038317", "0.59611756", "0.59112054", "0.5905484", "0.5870811", "0.58102214", "0.58011925", "0.5769317", "0.57632244", "0.57603234", "0.57573...
0.7994289
0
take 1D float array of rewards and compute discounted reward
def discount_rewards(rewards, gamma): reward_shape = rewards.shape if len(reward_shape) == 1: discounted_r = np.zeros(shape=(*reward_shape, 1), dtype=np.float) else: discounted_r = np.zeros(shape=reward_shape, dtype=np.float) running_add = 0 for t in reversed(range(0, rewards.size))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discount_rewards(rewards):\r\n discounted_r = np.zeros_like(rewards)\r\n running_add = 0\r\n for t in reversed(range(0, len(rewards))): \r\n running_add = running_add * reward_discount + rewards[t]\r\n discounted_r[t] = running_add\r\n return discounted_r", "def discoun...
[ "0.8100923", "0.7792625", "0.7742053", "0.7653779", "0.75987715", "0.7583268", "0.75820553", "0.7579539", "0.7536054", "0.7519005", "0.75047183", "0.7467692", "0.7456702", "0.7433794", "0.7426565", "0.74062765", "0.73950297", "0.7370545", "0.73564714", "0.7328519", "0.7201842...
0.78397125
1
Mark the conversation as read/unread REQUIRES AUTH Marking a conversation as read will mark `all` its messages as read as well. On the other hand, marking it as unread will only mark its `last_message` as unread.
def read(self, request, *args, **kwargs): conversation = self.get_object() if request.method == 'POST': conversation.mark_as_read(request.user) elif request.method == 'DELETE': conversation.mark_as_unread(request.user) return Response(status=status.HTTP_202_ACCEPT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_messages_read(self, mbox, msgset):\n self._add_flag(mbox, msgset, r'(\\Seen)')", "def mark_all_as_read(self, recipient=None):\n qs = self.unread()\n if recipient:\n qs = qs.filter(recipient=recipient)\n\n return qs.update(unread=False)", "def mark_all_read(self):...
[ "0.7009314", "0.69392866", "0.6739005", "0.6679763", "0.64627486", "0.64006454", "0.6357593", "0.63535786", "0.63371575", "0.63241917", "0.62763494", "0.6266434", "0.61745656", "0.6145781", "0.6136149", "0.6102251", "0.6061712", "0.5925853", "0.59196746", "0.5880591", "0.5861...
0.6724079
3
Remove profile from this conversation. REQUIRES AUTH The logged in profile should be admin in the conversation. Request Body {
def remove_profile(self, request, *args, **kwargs): context = { 'conversation': self.get_object(), 'request': request } serializer = RemoveProfileSerializer(data=request.data, context=context) serializer.is_valid(raise_exception=True) serializer.save() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_remove_profile_action(self):\n profile = self.Manager.profile\n\n # TODO: while it can probably be safely assumed that currentData() and currentIndex() will refer to the same profile as Manager.profile, it is NOT guaranteed; we should either verify that they are indeed the same or search the m...
[ "0.7026644", "0.67010254", "0.66556114", "0.6538831", "0.6529989", "0.64792323", "0.64768356", "0.6428269", "0.63669294", "0.6366328", "0.63212484", "0.6252459", "0.62517375", "0.6247149", "0.6162667", "0.6075223", "0.6067074", "0.59916675", "0.59699184", "0.59509826", "0.592...
0.84627134
0
sets all the cameras in the current scene to cacheable
def set_all_cameras_cacheable(progress_controller=None): if progress_controller is None: progress_controller = ProgressControllerBase() all_cameras = pm.ls(type=pm.nt.Camera) progress_controller.maximum = len(all_cameras) for camera in all_cameras: camera_transform = camera.getParent() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cameras(self, cameras):\n self._cameras = cameras[:]", "def get_cameras(self):\n return self._cameras[:]", "def refresh_cameras(self):\n self.comboCamera.clear()\n self.camera_list = webcam.list_available_cameras()\n for c in self.camera_list:\n self.comboC...
[ "0.70317554", "0.66901296", "0.6623873", "0.6579956", "0.62859666", "0.6140639", "0.61029375", "0.6055192", "0.6039285", "0.6029164", "0.59636533", "0.5872348", "0.58246547", "0.5792553", "0.5784006", "0.5780899", "0.5680305", "0.5679459", "0.5679361", "0.5648878", "0.5596665...
0.7918148
0
Delete empty namespaces checks and deletes empty namespaces
def delete_empty_namespaces(progress_controller=None): if progress_controller is None: progress_controller = ProgressControllerBase() # only allow namespaces with DAG objects in it and no child namespaces empty_namespaces = [] all_namespaces = ( mc.namespaceInfo(recurse=True, listOnlyN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_up_namespaces(node, namespace=None):\n if namespace is not None:\n Namespaces.delete_namespace(node, namespace)\n return\n\n namespace_copy = deepcopy(Namespaces.__namespaces)\n for namespace_name in namespace_copy:\n Namespaces.delete_namespace(node,...
[ "0.7232386", "0.696627", "0.6428616", "0.6422125", "0.6421747", "0.64161396", "0.6370938", "0.6182109", "0.6096773", "0.6072833", "0.60639703", "0.60363436", "0.6030372", "0.60276836", "0.6010919", "0.5980092", "0.5949941", "0.5946253", "0.5938209", "0.59377384", "0.5915915",...
0.7288554
0
tries to fix check_shot_name_format
def check_shot_name_format___fix(): shot_nodes = pm.ls(type="shot") # auto fix if there is only 1 shot in the scene if len(shot_nodes) == 1: from stalker import Shot from anima.dcc import mayaEnv m = mayaEnv.Maya() v = m.get_current_version() if v: curr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_shot_name_format(progress_controller=None):\n if progress_controller is None:\n progress_controller = ProgressControllerBase()\n\n shots_with_wrong_shot_name_format = []\n\n shot_nodes = pm.ls(type=\"shot\")\n progress_controller.maximum = len(shot_nodes)\n\n for shot in shot_nodes:...
[ "0.796697", "0.6750311", "0.63873017", "0.6341223", "0.62039524", "0.6174318", "0.6112633", "0.60573167", "0.60507494", "0.6047524", "0.60303754", "0.60133207", "0.60085267", "0.59781015", "0.5958022", "0.5951932", "0.5910291", "0.5875191", "0.585494", "0.5848339", "0.5844843...
0.80660063
0
A ColumnWidths object for nested tables or None if no nested tables.
def subtable(self): return self._subtable
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def width(self) -> \"EffectiveWidth\":\n if len(self.widths) == 0:\n return None\n potential_width = self.widths[0]\n for width in self.widths[1:]:\n if potential_width != width:\n return None\n return potential_width", "def _calculate_column_width...
[ "0.60832524", "0.606296", "0.60506743", "0.5822603", "0.562754", "0.549159", "0.5412957", "0.5377428", "0.52798355", "0.5096546", "0.50830936", "0.5016755", "0.49832973", "0.495257", "0.4942549", "0.48951134", "0.48775104", "0.4861845", "0.48508564", "0.48360357", "0.4833415"...
0.0
-1
Selects individuals out of a population with the best fitness function values. Uses a tourney algorithm.
def selectTourney(population, fitnessFunction, nrOfContenders = 2, highIsGood = True): populationSize = len(population) selectedPopulation = [] #select until original populationSize is reached while len(selectedPopulation) < populationSize: if highIsGood: bestFitness = -math.inf else: best...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(individuals, grammar, replacement, selection, fitness_function, best_ever):\n #Select parents\n parents = selection(individuals)\n #Crossover parents and add to the new population\n new_pop = []\n while len(new_pop) < GENERATION_SIZE:\n new_pop.extend(onepoint_crossover(*random.sampl...
[ "0.6952191", "0.6825646", "0.6780393", "0.6758352", "0.6728664", "0.6719449", "0.67187256", "0.67049444", "0.6643305", "0.66411394", "0.6533296", "0.65035886", "0.6494779", "0.64861166", "0.6483819", "0.6468742", "0.6439304", "0.64081544", "0.63660353", "0.6365164", "0.633753...
0.7498939
0
The XHTTPMethod_Override header field value.
def method_override(self): return self.headers.get("X-HTTP-Method-Override")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_override(self, method):\n\t\tself.headers['X-HTTP-Method-Override'] = method.upper()", "def override(method):\n method.override = True\n return method", "def request_method(self):\r\n return self._environ['REQUEST_METHOD']", "def get_requestmethod(self):\n return self.request.m...
[ "0.7537536", "0.53763443", "0.52425617", "0.52198726", "0.5201388", "0.51971596", "0.5195939", "0.5160927", "0.51539475", "0.5087049", "0.5083633", "0.5077916", "0.50086826", "0.49829802", "0.49439573", "0.48685795", "0.48430327", "0.48063114", "0.47871935", "0.4778978", "0.4...
0.8259129
0
The XHTTPMethod_Override header field value.
def method_override(self, method): self.headers['X-HTTP-Method-Override'] = method.upper()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_override(self):\n\t\treturn self.headers.get(\"X-HTTP-Method-Override\")", "def override(method):\n method.override = True\n return method", "def request_method(self):\r\n return self._environ['REQUEST_METHOD']", "def get_requestmethod(self):\n return self.request.method.lower(...
[ "0.8259674", "0.5374735", "0.5244553", "0.5222457", "0.5199522", "0.5199307", "0.5196219", "0.51582557", "0.51558715", "0.509018", "0.508091", "0.5077229", "0.5008969", "0.49859914", "0.4945547", "0.48667982", "0.48464862", "0.4806976", "0.47889727", "0.4777518", "0.47456646"...
0.7536655
1
True if all attributes of these two APIRequests are the same.
def __eq__(self, other): return all((getattr(self, attr, None) == getattr(other, attr, None) for attr in self.attrs))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if not isinstance(other, Secure3D21AuthenticationRequestAllOf):\n return False\n\n return self.__dict__ == other.__dict__", "def __eq__(self, other):\n if not isinstance(other, DeviceRequest):\n return False\n\n return self.__dict__ == ...
[ "0.68351465", "0.6741693", "0.67206717", "0.67009366", "0.666163", "0.66231585", "0.6609764", "0.6603205", "0.6572032", "0.65576214", "0.65414673", "0.64963466", "0.646717", "0.6445858", "0.64431417", "0.64296013", "0.6414396", "0.64061546", "0.63980895", "0.6368459", "0.6367...
0.67143536
3
Initialize the road with length constants.ROAD_LENGTH
def __init__(self, color, distribution): self._spots = [spot.Spot() for _ in xrange(0, constants.ROAD_LENGTH)] self._spots[constants.CROSSING_LOCATION - 1].add_light(color, 0) self._spots[constants.CROSSING_LOCATION + constants.NUM_LANES].add_light(color, 1) self._steps = 0 self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, road):\n # TODO: move speed parameter to class Lane?\n self.road = road\n self.source = road.source\n self.target = road.target\n self.leftAdjacent = None\n self.rightAdjacent = None\n self.leftmostAdjacent = None\n self.rightmostAdjacent =...
[ "0.6720245", "0.6509824", "0.6475671", "0.6064217", "0.6053165", "0.60139656", "0.59564304", "0.5954103", "0.59328115", "0.58867633", "0.5880645", "0.5743", "0.57130414", "0.56764466", "0.56389695", "0.5629231", "0.5618215", "0.5607546", "0.5587292", "0.555759", "0.5550796", ...
0.50357825
87
create a bullet object at the ship's current position
def __init__(self, ai_settings, screen, ship): super().__init__() self.screen = screen #create bullet rect at (0,0) the set correct position self.rect = pygame.Rect(0,0,ai_settings.bullet_width, ai_settings.bullet_height) self.rect.centerx = ship.rect.centerx self.rect.top = ship.rect.top #store ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,canvas=0,spritePath=bulletSpritePath,hitboxRadius=bulletHitboxRadius,xPos=0,yPos=0,entityThatCreatedMe=None):\n Entity.__init__(self,canvas,spritePath,xPos=xPos,yPos=yPos)\n self.creationTime=time.time()#a time stamp for exactly when the bullet was spawned, this is used in preventin...
[ "0.7525764", "0.73547894", "0.73482805", "0.7324015", "0.727372", "0.7192708", "0.7143946", "0.7063782", "0.7036791", "0.70055544", "0.6908273", "0.68792915", "0.68611234", "0.6856172", "0.68525165", "0.6849271", "0.68236095", "0.68236095", "0.68034095", "0.67932254", "0.6785...
0.69242716
10
Add a vertex into the array
def addVertex(self, v, vertices): vn = v / np.linalg.norm(v) * self._radius vertices += [[vn[0], vn[1], vn[2]]] return len(vertices)-1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vertex(self, vertex):\n self.vertices.append(vertex)\n self.vertex_edge[vertex] = []", "def add_vertex(self, vertex):\n raise NotImplementedError", "def add_vertex(self, v):\n v = {'x': v[0], 'y': v[1]}\n if v not in self:\n self.append(v)\n retu...
[ "0.786367", "0.77275324", "0.7681921", "0.76212597", "0.7608196", "0.757264", "0.75337464", "0.7437016", "0.73980004", "0.73620653", "0.7289883", "0.72743773", "0.7253365", "0.72464246", "0.7231046", "0.72214377", "0.7216883", "0.71716934", "0.7156576", "0.71548116", "0.71429...
0.695894
29
Return the first integer N such that 2N >= abs(x)
def nextpow2(x): return int(numpy.ceil(numpy.log2(numpy.abs(x))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_i(n):\n lst = []\n for i in range(1, n):\n lst.append(2 * compute(n - i) + 2 ** i - 1)\n result = min(lst)\n return lst.index(result) + 1", "def _nearest_bigger_power_of_two(x: int) -> int:\n y = 2\n while y < x:\n y *= 2\n return y", "def constrain(n: int, low: int,...
[ "0.6649566", "0.6609812", "0.6370164", "0.6355804", "0.6342654", "0.6290205", "0.626454", "0.62434494", "0.620994", "0.62022424", "0.6103995", "0.6089674", "0.60560673", "0.60290074", "0.6026413", "0.60125744", "0.60119915", "0.59861535", "0.5983134", "0.59784025", "0.5961290...
0.58186966
36
Get the wait interval of this context. If the wait interval for element is not set, return the driver's wait interval.
def get_wait_interval(self): if self.__wait_interval is not None: return self.__wait_interval return self.get_web_driver().get_wait_interval()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_wait_timeout(self):\n if self.__wait_timeout is not None:\n return self.__wait_timeout\n return self.get_web_driver().get_wait_timeout()", "def poll_interval(self):\n return self.opts.poll_interval", "def interval(self):\n if self.keep_interval:\n retur...
[ "0.67781305", "0.6618373", "0.653233", "0.6379192", "0.6358046", "0.63529646", "0.63529646", "0.6262153", "0.6208943", "0.6183666", "0.6127585", "0.6073243", "0.6046297", "0.6031834", "0.6031834", "0.60110694", "0.60091573", "0.59370863", "0.58148724", "0.5808721", "0.5808721...
0.8260443
0
Get a Waiter instance.
def waiter(self, interval=None, timeout=None): _interval = self.get_wait_interval() if interval is None else interval _timeout = self.get_wait_timeout() if timeout is None else timeout return Waiter(_interval, _timeout)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_waiter(self, waiter_name: str = None) -> Waiter:\n pass", "def get_waiter(self, waiter_name: str = None) -> Waiter:\n pass", "def get_waiter(self, waiter_name: str = None) -> Waiter:\n pass", "def get_waiter(waiter_name=None):\n pass", "def get_waiter(waiter_name=None):\n ...
[ "0.7028446", "0.7028446", "0.7028446", "0.6472089", "0.6472089", "0.6472089", "0.6472089", "0.6472089", "0.6472089", "0.6472089", "0.6472089", "0.6472089", "0.6472089", "0.6472089", "0.6472089", "0.5957761", "0.56758094", "0.56142205", "0.56142205", "0.5516085", "0.5359289", ...
0.68758947
3
Nice R function Made to raise errors when input is not a 2d array
def ncol(arr): assert isinstance(arr, ndarray) assert len(arr.shape) == 2 return arr.shape[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_array(arr: Arrayable) -> np.ndarray:\n if isinstance(arr, np.ndarray):\n return arr\n return np.array(arr)", "def array_input(f):\n @wraps(f)\n def wrapped(self, t):\n t = np.atleast_1d(t)\n r = f(self, t)\n return r\n return wrapped", "def _is_1d_varray(arr...
[ "0.6551575", "0.64547604", "0.6408003", "0.63854486", "0.6359478", "0.62367445", "0.6176139", "0.6066386", "0.6052078", "0.6040988", "0.60254943", "0.6015661", "0.60000247", "0.5991109", "0.59764194", "0.5972997", "0.5966124", "0.59657466", "0.59531766", "0.59404314", "0.5939...
0.0
-1
Return the range of times represented by this timeseries
def range(self): return self.times[0], self.times[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeRange(self):\r\n _times = self.getTimes()\r\n return _times[0], _times[-1]", "def get_range(self):\n return time_to_range(self.get_time())", "def time_range(self) -> TimeRange:\n return self._time_range", "def range(self):\n\n return time_stat(self, stat=\"range\")", ...
[ "0.80645055", "0.8043529", "0.76724786", "0.76198673", "0.7241181", "0.7240329", "0.70996726", "0.70473796", "0.69075835", "0.69075835", "0.6848586", "0.674378", "0.6681333", "0.6626346", "0.6549983", "0.65160185", "0.64859796", "0.6460811", "0.64376193", "0.64139915", "0.635...
0.76220155
3
read a json file and return a dict
def from_json(fname): with open(fname, 'r') as fh: d = json.load(fh) return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_json_file(file_name: str) -> Dict[str, Any]:\n with open(file_name) as file:\n return json.load(file)", "def parse_json(json_file: str) -> dict:\n json_data = {}\n\n if not os.path.isfile(json_file):\n error_log(os.path.basename(json_file) + ' does not exist.')\n sys.exit(1...
[ "0.83197236", "0.82860035", "0.81846005", "0.81344545", "0.81327224", "0.8129253", "0.8095002", "0.808493", "0.80733955", "0.80560595", "0.8021873", "0.8021374", "0.801055", "0.79800254", "0.79617435", "0.79283464", "0.7917639", "0.7879397", "0.78773475", "0.78661776", "0.786...
0.7552228
60
Splits a dataframe into the X and y components and into test and training sets
def get_age_files(x_f, filename, remove_duplicates=True): X_train = pd.read_csv(x_f) y_n = filename.replace("X", "y") y_train = pd.read_csv(y_n) val = pd.read_csv((filename.replace("X_", "")).replace("train", "validation")) X_test, y_test = get_X_y(val) X_test = X_test.drop(columns="Samples") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_test_split(df):\n training_size = int(len(df) * .67)\n test_size = int(len(df) - training_size)\n train, test = df[0:training_size], df[training_size:len(df)]\n return train, test", "def prep_data(df):\n y = df.target\n X = df.drop([\"target\"], axis=1)\n X_train, X_test, y_train, ...
[ "0.7892827", "0.76950264", "0.76847714", "0.7634729", "0.7623673", "0.7618402", "0.7579548", "0.7578756", "0.7510197", "0.7435542", "0.7388698", "0.7367428", "0.7365825", "0.73162705", "0.7269782", "0.7217761", "0.72124505", "0.720962", "0.7204492", "0.72037464", "0.7202891",...
0.0
-1
Plots a confusion matrix
def plot_confusion(classifier, X_test, y_test, class_names): # https://scikit-learn.org/stable/auto_examples/model_selection/plot_confusion_matrix.html#sphx-glr-auto-examples-model-selection-plot-confusion-matrix-py np.set_printoptions(precision=2) # Plot non-normalized confusion matrix titles_options...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(self):\r\n interp = ClassificationInterpretation.from_learner(self.learn)\r\n interp.plot_confusion_matrix()", "def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\...
[ "0.8505238", "0.8212915", "0.8170546", "0.814627", "0.8081412", "0.8046241", "0.80321914", "0.80310243", "0.8028313", "0.8012687", "0.8001046", "0.79868186", "0.79793876", "0.7961476", "0.7945525", "0.79452264", "0.7943563", "0.79370487", "0.791215", "0.7902789", "0.79019535"...
0.0
-1
Setup and validate dict scenario_base. on mandatory keys and default data. This function reduces code that constructs dict objects with specific schema (e.g. for API data).
def setup_dict(data, required=None, defaults=None): required = required or [] for i in set(required) - set(data): raise IndexError("Missed: %s" % i) defaults = defaults or {} for i in set(data) - set(required) - set(defaults): raise ValueError("Unexpected: %s" % i) defaults.update(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _populate_default_values(self):\n\n if 'input_data' not in self._definition:\n self._definition['input_data'] = []\n for input_dict in self._definition['input_data']:\n if 'required' not in input_dict:\n input_dict['required'] = True\n\n if 'jobs' not i...
[ "0.5773487", "0.57195365", "0.55938745", "0.5580329", "0.5551632", "0.5496867", "0.5436562", "0.5429427", "0.5415996", "0.53986484", "0.5394098", "0.5392729", "0.5356193", "0.53530467", "0.5286582", "0.526588", "0.52425957", "0.52369475", "0.5229048", "0.5223434", "0.52092475...
0.6213345
1
Add a component name
def addComponent(self, compName, strict): pound = compName.rfind("#") if pound < 0: self.__comps.append(Component(compName, 0)) elif strict: raise BadComponentName("Found \"#\" in component name \"%s\"" % compName) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def appendcomp(self, componentname, component):\n self.components.append(componentname, component)\n return component", "def add_comp(self, name, ctype):\n\n name = self.name + '.' + name\n\n assert name not in self.components, 'A component named \\'{}\\' already exists for node \\'{}...
[ "0.70968354", "0.660479", "0.658511", "0.6510825", "0.62747395", "0.6225243", "0.6225243", "0.60862494", "0.6035452", "0.6012724", "0.6010508", "0.59911615", "0.5982563", "0.5973668", "0.5956443", "0.59465796", "0.59465796", "0.59465796", "0.59465796", "0.59445155", "0.594397...
0.68719333
1
Create alien bullets which start position's based on the random position of the fleet of aliens
def create_alien_bullet(ai_settings, screen, alien_bullets): while (len(alien_bullets) < ai_settings.alien_bullets_allowed): alien_bullet = AlienBullet(ai_settings, screen) chosen_alien = choice(alien_list) alien_bullet.rect.x = chosen_alien.rect.x alien_bullet.y = float(chosen_alien.rect.y) alien_bullet.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_alien(ai_settings, screen, aliens, alien_number, row_number):\n\talien = Alien(ai_settings, screen)\n\talien_width = alien.rect.width \n\talien.x = alien_width + 2 * alien_width * alien_number \n\talien.rect.x = alien.x\n\talien.rect.y = alien.rect.height + 2 * alien.rect.height * row_number\n\taliens.a...
[ "0.7001898", "0.6949072", "0.6864322", "0.6854107", "0.6832133", "0.6664575", "0.66636646", "0.66156226", "0.6602296", "0.6543483", "0.6518003", "0.64847165", "0.64473593", "0.6238549", "0.62153125", "0.60807735", "0.6078389", "0.6076946", "0.607458", "0.5983817", "0.5981799"...
0.7109934
0
Fire a bullet if limit not reached yet.
def fire_bullet(ai_settings, screen, ship, bullets): #Create a new bullet and add it to the group 'bullets' using the add() method #Confirm the number of existing bullet is below the allowed number before creating a new bullet if len(bullets) < ai_settings.bullets_allowed: new_bullet = Bullet(ai_settings, screen, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fire_bullet(self):\n if len(self.bullets) < self.settings.bullets_max:\n new_bullet = Bullet(self)\n self.bullets.add(new_bullet)", "def _fire_bullet(self):\n\t\tif len(self.bullets)<self.settings.bullets_allowed:\n\t\t\tnew_bullet = Bullet(self)\n\t\t\tself.bullets.add(new_bull...
[ "0.808973", "0.8066096", "0.80463153", "0.7982287", "0.7982287", "0.7982287", "0.77150524", "0.7504872", "0.73041975", "0.7214485", "0.71303636", "0.70625645", "0.7041916", "0.7016957", "0.699944", "0.699944", "0.6978331", "0.6893995", "0.6866042", "0.6787114", "0.67867327", ...
0.71480703
10
Update position of bullets and get rid of old bullets
def update_bullets(ai_settings, screen, stats, sb, ship, aliens, bullets, long_bullets): #Update bullet positions bullets.update() #Get rid of bullets that have disappeared for bullet in bullets.copy(): if bullet.rect.bottom <= 0: bullets.remove(bullet) check_bullet_alien_collisions(ai_settings, screen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_bullets(bullets):\r\n\t# Update bullet positions.\r\n\tbullets.update()\r\n\tfor bullet in bullets.copy():\r\n\t\tif bullet.rect.right >= 1000:\r\n\t\t\tbullets.remove(bullet)", "def _update_bullets(self):\n # Update bullet positions.\n\n # Get rid of bullets that have disappeared.\n ...
[ "0.83320063", "0.82796854", "0.8136621", "0.7947123", "0.79224336", "0.78135484", "0.7784289", "0.7591755", "0.75068235", "0.7463247", "0.742813", "0.73883057", "0.7337073", "0.7105325", "0.70844364", "0.70701253", "0.706358", "0.7046096", "0.6909985", "0.68583447", "0.672196...
0.7385047
12
Check if any aliens have reached the bottom of the screen.
def check_aliens_bottom(ai_settings, screen, stats, sb, ship, aliens, bullets): screen_rect = screen.get_rect() for alien in aliens.sprites(): if alien.rect.bottom >= screen_rect.bottom: # Treat this the same as if the ship got hit. ship_hit(ai_settings, screen, stats, sb, ship, aliens, bullets) break
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_aliens_bottom(self):\n screen_rect = self.screen.get_rect()\n for alien in self.aliens.sprites():\n if alien.rect.bottom >= screen_rect.bottom:\n # Treat the same as if ship got hit.\n self._ship_hit()\n break", "def _check_aliens_b...
[ "0.8488519", "0.8463236", "0.8463236", "0.7786292", "0.7773279", "0.7770765", "0.7643997", "0.7637962", "0.7513589", "0.74630916", "0.70705986", "0.6925097", "0.6812674", "0.66488665", "0.6578848", "0.64894897", "0.646029", "0.6454268", "0.63865215", "0.63547957", "0.6332578"...
0.7865227
3
set here the main window properties and characteristics
def setUp(self): self.caption = "mirra extending classes" # window name self.size = 640, 480 #window size self.pos = 100,100 # window top left location self.fullScreen = 0 # if fullScreen is on it will overwrite your pos and size to match the display's resolution self.frameR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setupWindow(self):\n\n\t\tself.main_menu_window = MenuFrame.MainMenuFrame(self.uiCoordinator)\n\t\tself.menu_window = self.main_menu_window._mf\n\t\tself.score_window = self.main_menu_window._hf\n\t\tself.instructions_window = self.main_menu_window._if\n\t\tself.menu_window.playButton.focus_set()", "def init...
[ "0.74870974", "0.71970975", "0.7103817", "0.7031315", "0.69431365", "0.6934203", "0.6881714", "0.6881083", "0.68501943", "0.68368196", "0.68242544", "0.680263", "0.67571706", "0.67567474", "0.6756671", "0.6753777", "0.67212296", "0.67208457", "0.671212", "0.6709742", "0.66936...
0.70484686
3
set empty string to null value
def handle_empty_string(item): convert_to_string = str(item) return None if len(convert_to_string.strip()) == 0 or convert_to_string == 'None' else convert_to_string.strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def none_to_empty(data):\n return data if data is not None else ''", "def _nullify(self, value):\n if not str(value).strip():\n return None\n else:\n return value", "def noneType(value):\r\n return ''", "def noneToBlankString(text):\n if text in (N...
[ "0.77165824", "0.7414318", "0.7179596", "0.70693254", "0.6962233", "0.68122137", "0.67227304", "0.6678088", "0.6674466", "0.66558975", "0.6605869", "0.65152955", "0.6468661", "0.6440379", "0.639588", "0.6379841", "0.63708013", "0.6355972", "0.62991613", "0.6289052", "0.627359...
0.5977113
47
Return a dictionary of x and y velocities set to direction keys.
def create_vector_dict(self): return self.MOVE_DATA
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dictionary_indexes(self):\n direction_dictionary = {}\n direction_dictionary[UP] = self.direction_list(UP)\n direction_dictionary[DOWN] = self.direction_list(DOWN)\n direction_dictionary[LEFT] = self.direction_list(LEFT)\n direction_dictionary[RIGHT] = self.direction_l...
[ "0.6254711", "0.6165491", "0.60772276", "0.60451245", "0.60380155", "0.59783006", "0.5945442", "0.59347636", "0.59263325", "0.5862141", "0.5828923", "0.5805487", "0.57434696", "0.57302445", "0.5722963", "0.5720181", "0.5649537", "0.5648704", "0.56251", "0.560898", "0.56040496...
0.63620234
0
When the Person is not moving between tiles. Checks if the player is centered on a tile.
def resting(self): self.image = self.image_list[self.index] if self.rect.y % 32 != 0: self.correct_position(self.rect.y) if self.rect.x % 32 != 0: self.correct_position(self.rect.x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moving(self):\n self.animation()\n assert(self.rect.x % 32 == 0 or self.rect.y % 32 == 0), \\\n 'Not centered on tile'", "def is_center(self):\n if self.pupils_located:\n return self.is_right() is not True and self.is_left() is not True", "def time_to_move(self):\...
[ "0.6816601", "0.6590144", "0.64809424", "0.6412212", "0.6343745", "0.6329919", "0.6310371", "0.6301322", "0.6292232", "0.6245781", "0.62324846", "0.62149584", "0.6176276", "0.6148867", "0.6140854", "0.6131248", "0.6119145", "0.6112824", "0.61067694", "0.6052859", "0.6042103",...
0.0
-1
Determine when to move a sprite from resting to moving in a random direction.
def auto_resting(self): self.image_list = self.animation_dict[self.direction] self.image = self.image_list[self.index] if self.rect.y % 32 != 0: self.correct_position(self.rect.y) if self.rect.x % 32 != 0: self.correct_position(self.rect.x) if (self.curr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __random_movement(self):\n\t\tself.__steps += 1 \t\t# Increment after every frame\n\t\t# When __steps greater than threshold reverse the direction\n\t\t# and set threshold to a new random value\n\t\tif self.__steps >= self.__threshold_steps:\t\n\t\t\tif self.direction == 'RIGHT':\n\t\t\t\tself.move_left()\n\...
[ "0.6839113", "0.6830477", "0.6806836", "0.6777773", "0.67749155", "0.6655338", "0.6607078", "0.65657556", "0.6537841", "0.6485836", "0.64802426", "0.646948", "0.6452923", "0.64513296", "0.64493066", "0.6445841", "0.64438945", "0.64177024", "0.64131176", "0.6365357", "0.636106...
0.72588634
0
Adjust sprite position to be centered on tile.
def correct_position(self, rect_pos): diff = rect_pos % 32 if diff <= 16: rect_pos - diff else: rect_pos + diff
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rot_center(self):\n loc = self.rect.center\n self.image = pygame.transform.rotate(self.current_sprite_alpha, self.rot)\n self.rect = self.image.get_rect()\n self.rect.center = loc", "def center_ava(self):\n\t\tself.rect.midbottom = self.screen_rect.midbottom\n\t\tself.x = float(se...
[ "0.7204624", "0.6824213", "0.6794782", "0.6793859", "0.6771517", "0.6765323", "0.6765323", "0.6761111", "0.6665537", "0.6635976", "0.6635976", "0.6635976", "0.6573644", "0.65566486", "0.6532712", "0.6517682", "0.6378036", "0.6332726", "0.6331153", "0.6289626", "0.62809825", ...
0.0
-1
Return a dictionary of x and y velocities set to direction keys.
def create_vector_dict(self): return self.MOVE_DATA
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dictionary_indexes(self):\n direction_dictionary = {}\n direction_dictionary[UP] = self.direction_list(UP)\n direction_dictionary[DOWN] = self.direction_list(DOWN)\n direction_dictionary[LEFT] = self.direction_list(LEFT)\n direction_dictionary[RIGHT] = self.direction_l...
[ "0.6252338", "0.6168158", "0.6079317", "0.604458", "0.60374355", "0.59783566", "0.59452623", "0.59361947", "0.5928659", "0.5863374", "0.5827975", "0.58066773", "0.5745895", "0.57329255", "0.5721941", "0.571895", "0.5650772", "0.5649421", "0.5627464", "0.56077236", "0.5606704"...
0.6360432
1
String for representing the Model object.
def __str__(self): return f'{self.name} (${self.wage})'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )", "def __str__(self):\n \n res =...
[ "0.8236244", "0.7990606", "0.78480387", "0.7846219", "0.77502006", "0.7623238", "0.7623238", "0.7620921", "0.7620921", "0.7546437", "0.75244987", "0.7472402", "0.7470912", "0.7448822", "0.7448822", "0.7432068", "0.7427943", "0.73915136", "0.73503023", "0.7343569", "0.7324108"...
0.0
-1
String for representing the Model object.
def __str__(self): return f'Employee #{self.employee_id} ({self.job_group.name}, ${self.job_group.wage}) worked {self.hours_worked} hours on {self.date_worked}.'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )", "def __str__(self):\n \n res =...
[ "0.82368803", "0.79901737", "0.7849152", "0.78468513", "0.77520275", "0.7625378", "0.7625378", "0.76225406", "0.76225406", "0.75483394", "0.7522958", "0.7470355", "0.7469358", "0.7447144", "0.7447144", "0.74314755", "0.7427648", "0.7389925", "0.7351721", "0.73424315", "0.7322...
0.0
-1
Ensure it is not possible to create a project user request membership with an invalid user id.
def test_request_membership_form_with_an_invalid_user_id(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_request_membership_form_with_an_invalid_project_id(self):\n pass", "def test_project_create_cant_edit_users_existing_user(self):\n user = fake_clients.FakeUser(name=\"test@example.com\")\n\n setup_identity_cache(users=[user])\n\n url = \"/v1/actions/CreateProjectAndUser\"\n ...
[ "0.7771765", "0.672395", "0.6691616", "0.65924466", "0.6454126", "0.6308172", "0.626091", "0.6218301", "0.6210177", "0.61272955", "0.6126314", "0.61026174", "0.6094911", "0.60610944", "0.6011322", "0.5999685", "0.5997785", "0.5950712", "0.5950662", "0.5950322", "0.5950044", ...
0.75999993
1
Ensure it is not possible to create a project user request membership with an invalid project id.
def test_request_membership_form_with_an_invalid_project_id(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_request_membership_form_with_an_invalid_user_id(self):\n pass", "def test_form_with_an_invalid_project_code(self):\n self.approve_project(self.project)\n\n form = ProjectUserMembershipCreationForm(\n initial={\n 'user': self.project_applicant,\n ...
[ "0.7123037", "0.6854572", "0.6842469", "0.66606057", "0.66287714", "0.65952444", "0.6475645", "0.6462663", "0.6447144", "0.6420405", "0.6359585", "0.63521874", "0.62974006", "0.6151097", "0.6145583", "0.61217004", "0.60351676", "0.6034694", "0.6023145", "0.6016705", "0.599692...
0.81578374
0
Ensure it is not possible to create a project user membership whilst the project is currently awaiting approval.
def test_form_when_project_is_awaiting_approval(self): form = ProjectUserMembershipCreationForm( initial={ 'user': self.project_applicant, }, data={ 'project_code': self.project_code, }, ) self.assertFalse(form.is_va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_form_when_a_user_has_a_request_awaiting_authorisation(self):\n self.approve_project(self.project)\n\n # Create a project user membership.\n ProjectUserMembership.objects.create(\n project=self.project,\n user=self.project_applicant,\n status=ProjectUse...
[ "0.71828026", "0.6818286", "0.6807183", "0.6775216", "0.6703235", "0.6656375", "0.65853965", "0.65644246", "0.6529956", "0.65024036", "0.6427108", "0.6402141", "0.63695127", "0.6359912", "0.6353227", "0.6308405", "0.62856734", "0.6247337", "0.6229203", "0.62016773", "0.618701...
0.70771414
1
Ensure it is not possible to create a project user membership using an invalid project code.
def test_form_with_an_invalid_project_code(self): self.approve_project(self.project) form = ProjectUserMembershipCreationForm( initial={ 'user': self.project_applicant, }, data={ 'project_code': 'invalid-project-code', }, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_request_membership_form_with_an_invalid_project_id(self):\n pass", "def test_form_when_project_is_awaiting_approval(self):\n form = ProjectUserMembershipCreationForm(\n initial={\n 'user': self.project_applicant,\n },\n data={\n ...
[ "0.72043747", "0.6470788", "0.64616805", "0.6396551", "0.6390949", "0.63541067", "0.6309545", "0.6301749", "0.62750214", "0.6074508", "0.60686904", "0.6026213", "0.5949718", "0.59165776", "0.5914209", "0.5913365", "0.58918685", "0.58655685", "0.584238", "0.58372766", "0.58365...
0.74770546
0
Ensure it is not possible to create a project user membership when a user is an authorised member of the project. By default, when the project is approved, a project user membership will be created for the technical lead.
def test_form_with_an_authorised_project_member(self): accounts = [ self.project_owner, # self.project_applicant, ] # Authorise a project user membership for the project applicant. ProjectUserMembership.objects.create( project=self.project, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_new_user_not_my_project(self):\n setup_identity_cache()\n\n url = \"/v1/actions/InviteUser\"\n headers = {\n \"project_name\": \"test_project\",\n \"project_id\": \"test_project_id\",\n \"roles\": \"member\",\n \"username\": \"test@example.c...
[ "0.7100981", "0.68623835", "0.6846903", "0.6842477", "0.6813322", "0.6614665", "0.6593895", "0.6588802", "0.6588423", "0.65225714", "0.6412207", "0.64068687", "0.6392802", "0.63849676", "0.6334317", "0.6316186", "0.6306086", "0.63031113", "0.62880915", "0.6283835", "0.6258342...
0.72847086
0
Ensure it is not possible to create a project user membership when a user has a membership request awaiting authorisation.
def test_form_when_a_user_has_a_request_awaiting_authorisation(self): self.approve_project(self.project) # Create a project user membership. ProjectUserMembership.objects.create( project=self.project, user=self.project_applicant, status=ProjectUserMembership....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_request_membership_form_with_an_invalid_project_id(self):\n pass", "def test_form_with_an_authorised_project_member(self):\n accounts = [\n self.project_owner,\n # self.project_applicant,\n ]\n\n # Authorise a project user membership for the project appl...
[ "0.7007978", "0.6872322", "0.6773036", "0.66319555", "0.6578852", "0.6576186", "0.65527225", "0.65488917", "0.6442199", "0.64137244", "0.641298", "0.6381484", "0.6376958", "0.6361057", "0.63394165", "0.6268379", "0.6266567", "0.61876446", "0.61705714", "0.61513966", "0.614618...
0.7169097
0